RinUI 0.1.1.post1__py3-none-any.whl → 0.1.1.post2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
RinUI/core/launcher.py CHANGED
@@ -1,20 +1,23 @@
1
1
  import os
2
2
  import sys
3
+ from typing import Union
3
4
 
4
5
  from PySide6.QtCore import QCoreApplication, QUrl, QObject
5
6
  from PySide6.QtGui import QIcon
6
7
  from PySide6.QtWidgets import QApplication
7
8
  from PySide6.QtQml import QQmlApplicationEngine
9
+ from pathlib import Path
8
10
 
9
11
  from .theme import ThemeManager
10
12
  from .config import BackdropEffect, is_windows, Theme, RINUI_PATH, RinConfig
11
13
 
12
14
 
13
15
  class RinUIWindow:
14
- def __init__(self, qml_path: str):
16
+ def __init__(self, qml_path: Union[str, Path] = None):
15
17
  """
16
18
  Create an application window with RinUI.
17
- :param qml_path: str, QML file path (eg = "path/to/main.qml")
19
+ If qml_path is provided, it will automatically load the specified QML file.
20
+ :param qml_path: str or Path, QML file path (eg = "path/to/main.qml")
18
21
  """
19
22
  super().__init__()
20
23
  if hasattr(self, "_initialized") and self._initialized:
@@ -33,14 +36,22 @@ class RinUIWindow:
33
36
  self.autoSetWindowsEffect = True
34
37
 
35
38
  app_instance.aboutToQuit.connect(self.theme_manager.clean_up)
36
- self._setup_application()
37
- self.print_startup_info()
38
39
 
39
- def _setup_application(self) -> None:
40
- """Setup"""
40
+ if qml_path is not None:
41
+ self.load(qml_path)
42
+
43
+ def load(self, qml_path: Union[str, Path] = None) -> None:
44
+ """
45
+ Load the QML file and set up the application window.
46
+ :param qml_path:
47
+ :return:
48
+ """
41
49
  # RInUI 模块
42
50
  print(f"UI Module Path: {RINUI_PATH}")
43
51
 
52
+ if qml_path is not None:
53
+ self.qml_path = qml_path
54
+
44
55
  if os.path.exists(RINUI_PATH):
45
56
  self.engine.addImportPath(RINUI_PATH)
46
57
  else:
@@ -62,6 +73,8 @@ class RinUIWindow:
62
73
  self.theme_manager.set_window(self.root_window)
63
74
  self._apply_windows_effects() if self.autoSetWindowsEffect else None
64
75
 
76
+ self._print_startup_info()
77
+
65
78
  def setIcon(self, path: str) -> None:
66
79
  """
67
80
  Sets the icon for the application.
@@ -109,9 +122,9 @@ class RinUIWindow:
109
122
  root = object.__getattribute__(self, "root_window")
110
123
  return getattr(root, name)
111
124
  except AttributeError:
112
- raise AttributeError(f"\"RinUIWindow\" object has no attribute '{name}'")
125
+ raise AttributeError(f"\"RinUIWindow\" object has no attribute '{name}', you need to load() qml at first.")
113
126
 
114
- def print_startup_info(self) -> None:
127
+ def _print_startup_info(self) -> None:
115
128
  border = "=" * 40
116
129
  print(f"\n{border}")
117
130
  print("✨ RinUIWindow Loaded Successfully!")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: RinUI
3
- Version: 0.1.1.post1
3
+ Version: 0.1.1.post2
4
4
  Summary: A Fluent Design-like UI library for Qt Quick (QML) based on PySide6
5
5
  Author-email: RinLit <lintu233_qwq@icloud.com>
6
6
  Classifier: Programming Language :: Python :: 3
@@ -71,7 +71,7 @@ RinUI/components/Text/TextField.qml,sha256=1DBiO9UCfDTpwma4bWVWXWfolhQu_i4qnhGWa
71
71
  RinUI/components/Text/TextInput.qml,sha256=gyTJmrYi5yuc-j5dDRSbu5PCxiuQo2xNBm6jWL9ezYk,1611
72
72
  RinUI/core/__init__.py,sha256=LF4-YjoBLaix1UEWYzc5rhXiYGdZXC_J-NyCoYkCpUE,196
73
73
  RinUI/core/config.py,sha256=kO0bR1EhZB6Mh0KFa7uyBa0KgYr58DdBsHEP2oSGX7U,3722
74
- RinUI/core/launcher.py,sha256=sSPWi8iERTuVmtcIYe0PYcAkKKizrN_bNLhnChggv8k,4616
74
+ RinUI/core/launcher.py,sha256=Bep-74tsgFvzMw1GHklwgOgQBRjtr4ptPV8FlYDJ5AQ,5046
75
75
  RinUI/core/theme.py,sha256=BK9EovR2sHvcNarzptgsoMOll78R1B_ftKwEUqzqQhA,10672
76
76
  RinUI/core/translator.py,sha256=5GK7Iy7-2iMicF8hQr79CwU9UWvCwE-8vGd8QkhJ1h8,1037
77
77
  RinUI/hooks/__init__.py,sha256=7sQJlly1ZbiZTzZUkCV2hI_gY-DAxWP_0kLyhZQ2Tm8,74
@@ -102,11 +102,11 @@ RinUI/windows/TitleBar.qml,sha256=zzOGP6fLm692BMY2UF_eDwjsgtVIZ0Fx90VDPGweHLA,37
102
102
  RinUI/windows/qmldir,sha256=LMeM0QzRNU0CIHemtD1j19hGRCuV987DRDuB5W6UJ-k,205
103
103
  RinUI/windows/window/ApplicationWindow.qml,sha256=4_COTBi9SoHeHdS0lIOPvqncevUB4P18svZfH3V5GaM,188
104
104
  RinUI/windows/window/Window.qml,sha256=pye3j-RI7Tzm8WW7oIctaeFxQ-FJsqXpW2U4Xp3m418,3485
105
- rinui-0.1.1.post1.data/data/LICENSE,sha256=vgoqqpny5vKYu34VDBUWYQKzT7Nn-Xy9y8USmcOCyZQ,1063
106
- rinui-0.1.1.post1.data/data/README.md,sha256=8ZcR55RYV2slRAQbhoYhqDTPOLXmewkFSvuA_cE6zD0,3044
107
- rinui-0.1.1.post1.dist-info/licenses/LICENSE,sha256=vgoqqpny5vKYu34VDBUWYQKzT7Nn-Xy9y8USmcOCyZQ,1063
108
- rinui-0.1.1.post1.dist-info/METADATA,sha256=6kUNG4vqLk9kyI4iflqtlJfu9r4Sikrj6UqHgrQQv1Y,3595
109
- rinui-0.1.1.post1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
110
- rinui-0.1.1.post1.dist-info/entry_points.txt,sha256=taxuZYCggoQa2LPubwcurQYRjBRC4cNYOjWaqOYZVxw,54
111
- rinui-0.1.1.post1.dist-info/top_level.txt,sha256=vKKjXBXEw5OFRIzTxZWUC5ZOj0CK5e3atbymBB4eJ6w,6
112
- rinui-0.1.1.post1.dist-info/RECORD,,
105
+ rinui-0.1.1.post2.data/data/LICENSE,sha256=vgoqqpny5vKYu34VDBUWYQKzT7Nn-Xy9y8USmcOCyZQ,1063
106
+ rinui-0.1.1.post2.data/data/README.md,sha256=8ZcR55RYV2slRAQbhoYhqDTPOLXmewkFSvuA_cE6zD0,3044
107
+ rinui-0.1.1.post2.dist-info/licenses/LICENSE,sha256=vgoqqpny5vKYu34VDBUWYQKzT7Nn-Xy9y8USmcOCyZQ,1063
108
+ rinui-0.1.1.post2.dist-info/METADATA,sha256=BztEGKnZZS83is7iZsFsMkdc-DudybF34nNujpYzxi4,3595
109
+ rinui-0.1.1.post2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
110
+ rinui-0.1.1.post2.dist-info/entry_points.txt,sha256=taxuZYCggoQa2LPubwcurQYRjBRC4cNYOjWaqOYZVxw,54
111
+ rinui-0.1.1.post2.dist-info/top_level.txt,sha256=vKKjXBXEw5OFRIzTxZWUC5ZOj0CK5e3atbymBB4eJ6w,6
112
+ rinui-0.1.1.post2.dist-info/RECORD,,