RinUI 0.1.1.post1__py3-none-any.whl → 0.1.2__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/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  from .core import *
2
2
 
3
- __version__ = "0.1.1"
3
+ __version__ = "0.1.2"
4
4
  __author__ = "RinLit"
@@ -85,17 +85,6 @@ ComboBox {
85
85
  onClicked: menu.open()
86
86
  }
87
87
 
88
- // Text //
89
- // contentItem: Text {
90
- // id: text
91
- // typography: Typography.Body
92
- // anchors.left: parent.left
93
- // anchors.leftMargin: 11 // 左边距为 11
94
- // verticalAlignment: Text.AlignVCenter
95
- // height: parent.height
96
- // text: root.displayText ? root.displayText : root.placeholderText
97
- // color: root.displayText ? Theme.currentTheme.colors.textColor : Theme.currentTheme.colors.textSecondaryColor
98
- // }
99
88
 
100
89
  contentItem: TextField {
101
90
  id: text
@@ -1,5 +1,6 @@
1
1
  import QtQuick 2.15
2
2
  import QtQuick.Controls 2.15
3
+ import QtQuick.Layouts 2.15
3
4
  import "../../themes"
4
5
  import "../../components"
5
6
 
@@ -34,15 +35,11 @@ Menu {
34
35
  case Position.Right:
35
36
  return (parent.height - root.height) / 2
36
37
  default:
37
- // return -root.height + 5 // 默认顶部
38
38
  return root.y
39
39
  }
40
40
  }
41
41
 
42
- implicitWidth: Math.max(contentItem.implicitWidth, 80)
43
- implicitHeight: contentItem.implicitHeight
44
- // x: (parent.width - root.width) / 2
45
- // y: parent.height + 5
42
+ width: Math.max(contentItem.implicitWidth, 80)
46
43
 
47
44
  enter: Transition {
48
45
  ParallelAnimation {
@@ -101,13 +98,11 @@ Menu {
101
98
  }
102
99
  }
103
100
 
104
- spacing: 5
105
101
  topPadding: 5
106
102
  bottomPadding: 5
107
103
 
108
104
  background: Rectangle {
109
- implicitWidth: 80
110
- implicitHeight: 36
105
+ anchors.fill: parent
111
106
  radius: Theme.currentTheme.appearance.windowRadius
112
107
  color: Theme.currentTheme.colors.backgroundAcrylicColor
113
108
  border.color: Theme.currentTheme.colors.flyoutBorderColor
@@ -125,20 +120,16 @@ Menu {
125
120
  contentItem: Flickable {
126
121
  id: flickable
127
122
  clip: true
128
- anchors.fill: parent
129
- // contentWidth: width
130
- // contentHeight: column.implicitHeight
123
+ anchors.centerIn: parent
131
124
  implicitWidth: column.implicitWidth
132
125
  implicitHeight: column.implicitHeight
133
- // interactive: column.implicitHeight > height
134
126
 
135
- Column {
127
+ ColumnLayout {
136
128
  id: column
137
- topPadding: 5
138
- bottomPadding: 5
129
+ x: -5
130
+ spacing: 0
139
131
  Repeater {
140
- model: root.contentModel // 默认的 Menu 内容
141
- delegate: root.delegate
132
+ model: root.contentModel
142
133
  }
143
134
  }
144
135
 
@@ -7,6 +7,9 @@ import "../../components"
7
7
 
8
8
  MenuItem {
9
9
  id: root
10
+
11
+ Layout.fillWidth: true
12
+
10
13
  implicitWidth: {
11
14
  const leftMargin = 16;
12
15
  const arrowWidth = arrow.visible ? arrow.width + 16 : root.checked ? indicator.width + 16 : 0;
@@ -94,7 +97,7 @@ MenuItem {
94
97
  }
95
98
  Text {
96
99
  id: shortcutText
97
- Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
100
+ Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
98
101
  typography: Typography.Caption
99
102
  text: root.action ? root.action.shortcut : ""
100
103
  color: Theme.currentTheme.colors.textSecondaryColor
@@ -1,11 +1,13 @@
1
1
  import QtQuick 2.15
2
2
  import QtQuick.Controls.Basic 2.15
3
+ import QtQuick.Layouts 2.15
3
4
  import "../../themes"
4
5
  import "../../components"
5
6
 
6
7
 
7
8
  MenuSeparator {
8
9
  id: root
10
+ Layout.fillWidth: true
9
11
 
10
12
  contentItem: Rectangle {
11
13
  implicitHeight: 1
@@ -74,6 +74,7 @@ TextField {
74
74
 
75
75
  // 字体 / Font //
76
76
  font.pixelSize: Theme.currentTheme.typography.bodySize
77
+ font.family: Utils.fontFamily
77
78
 
78
79
  selectionColor: Theme.currentTheme.colors.primaryColor
79
80
  color: Theme.currentTheme.colors.textColor
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!")
RinUI/core/theme.py CHANGED
@@ -3,6 +3,7 @@ import platform
3
3
  import time
4
4
 
5
5
  from PySide6.QtCore import QObject, Signal, Slot, QThread
6
+ from PySide6.QtGui import QFontDatabase, QFont
6
7
 
7
8
  from .config import DEFAULT_CONFIG, RinConfig, is_win10, is_windows, is_win11, BackdropEffect
8
9
  import sys
RinUI/themes/utils.qml CHANGED
@@ -5,7 +5,8 @@ import "../themes"
5
5
  import "../utils"
6
6
 
7
7
  QtObject {
8
- property string fontFamily: Qt.application.font.family // 默认字体
8
+ property string fontFamily: Qt.platform.os === "windows"
9
+ ? "Microsoft YaHei" : Qt.application.font.family // 默认字体
9
10
  property string iconFontFamily: FontIconLoader.name
10
11
  property string fontIconSource: Qt.resolvedUrl("../assets/fonts/FluentSystemIcons-Resizable.ttf") // 字体图标路径
11
12
  property string fontIconIndexSource: Qt.resolvedUrl("../assets/fonts/FluentSystemIcons-Index.js") // 字体图标索引路径
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: RinUI
3
- Version: 0.1.1.post1
3
+ Version: 0.1.2
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
7
7
  Classifier: License :: OSI Approved :: MIT License
8
8
  Classifier: Operating System :: OS Independent
9
- Requires-Python: >=3.8
9
+ Requires-Python: >=3.12
10
10
  Description-Content-Type: text/markdown
11
11
  License-File: LICENSE
12
12
  Requires-Dist: PySide6>=6.6.3.1
@@ -1,4 +1,4 @@
1
- RinUI/__init__.py,sha256=_5VlpDxB19jOY72Tlru6omOpL80g5CkXSKytxs0BngM,65
1
+ RinUI/__init__.py,sha256=fNeQkYoiWjQ-_ixBLh28FY6AJ00dKNUUs3rX2ixJLQk,65
2
2
  RinUI/qmldir,sha256=fwUoGC3efxNnNJmFU6inBDH6Tx9s3-OI4b3-a-25o0U,3829
3
3
  RinUI/assets/fonts/FluentSystemIcons-Index.js,sha256=M2fUmCiOI7A1rxLWMFaekrB4KmasTSwbociYOzHJegE,253422
4
4
  RinUI/assets/fonts/FluentSystemIcons-Resizable.ttf,sha256=-IfF3NT1eODD0vOLVLC0Z2U5bsR6woSQAziX3qD1TqU,1447252
@@ -14,7 +14,7 @@ RinUI/components/Shadow.qml,sha256=8y9iAFr45hqDdXXnsfD49t90HHhiFyMzGUHqJa2tavk,1
14
14
  RinUI/components/qmldir,sha256=KiTLgqw5x2LehrUxVfaFZUkD0Al2n2dPjD30gA_6fWk,2255
15
15
  RinUI/components/BasicInput/Button.qml,sha256=78Qi7w7cR7N7nwdc9n1JNQ9F_SBlhF6KdVmdPQyqR2o,5244
16
16
  RinUI/components/BasicInput/CheckBox.qml,sha256=SJkmo16EY-5omXBxkS74Pk3UcSE_LODABIjiP086aNM,3085
17
- RinUI/components/BasicInput/ComboBox.qml,sha256=tylWrL2FZT2n4lc1VxTBx1H2jyi0RQauUL58TWf0Fxc,4589
17
+ RinUI/components/BasicInput/ComboBox.qml,sha256=-ZT3FWGybTX1ltEDhTJuoxiG0gW3OlDcxfPdHnVwqsM,4111
18
18
  RinUI/components/BasicInput/DropDownButton.qml,sha256=TEgRZgjCCOZMPuT8xXrsqCIEuZ7wObRX88PF1unWuaE,390
19
19
  RinUI/components/BasicInput/Hyperlink.qml,sha256=8K1JoyX6AKw25QJW-aiVFah5yKmvS1WpxEcXMduM94M,329
20
20
  RinUI/components/BasicInput/PillButton.qml,sha256=2eFgpKupz7xlGIWcJOHya4nK616ffByYD_oPRKQiSTg,205
@@ -42,11 +42,11 @@ RinUI/components/ListAndCollections/SettingCard.qml,sha256=hrNlpWmxvzUiGzBvBXkdk
42
42
  RinUI/components/ListAndCollections/TableView.qml,sha256=71zKoiHLmfmmxD72WJvmmGGLyvfNeGKzllD7EgB9Ok0,2151
43
43
  RinUI/components/ListAndCollections/TableViewDelegate.qml,sha256=IW8JVDiRSO9X7Z-lForRh6q4qFWuuhjtWKZXBjaZXOg,2283
44
44
  RinUI/components/Media/Avatar.qml,sha256=8I7MlIalrs4S0WTKTuMU9qxbUkYDrJ-bhKPHjv12-SM,2088
45
- RinUI/components/MenusAndToolbars/Menu.qml,sha256=LOjoQa0rYNWj0cjc4WctesJdrcaWkRTZXHeEYc3la8o,4503
45
+ RinUI/components/MenusAndToolbars/Menu.qml,sha256=iTk9J1KlZv7BdzQNGbPVPYVGC8dqC94lPX3ggtsZv9E,4103
46
46
  RinUI/components/MenusAndToolbars/MenuBar.qml,sha256=YqNcY9Tn2t3NmaDqYCHJIUd_j9EXtn0dtOHYCd7sRXQ,1055
47
- RinUI/components/MenusAndToolbars/MenuItem.qml,sha256=jZRm-ULnrJSbo7rjzLD15ENn2gxAscJLkwiRo67Rfr4,3784
47
+ RinUI/components/MenusAndToolbars/MenuItem.qml,sha256=L2ZThrVEzw6_klVWKm60LOZXuLYPaab_kYQQI_8Pel0,3813
48
48
  RinUI/components/MenusAndToolbars/MenuItemGroup.qml,sha256=FqnDxo7C6DQ-1xvurHtjxuiRZOD69MxdsKT-h236cIk,1014
49
- RinUI/components/MenusAndToolbars/MenuSeparator.qml,sha256=J9oFbxpUeu43EExlxOX3maGGDwPzDIzeZIuJzIJfckI,257
49
+ RinUI/components/MenusAndToolbars/MenuSeparator.qml,sha256=BQGQ_EjzwtnlJ14fDXT96LEBOoaQwmoNidON0LzAJX8,312
50
50
  RinUI/components/MenusAndToolbars/TextInputMenu.qml,sha256=Rm0CT6sKdK5IOQAjtYEaJxqK3RdEZqXe9PjIoWBp1yM,939
51
51
  RinUI/components/MenusAndToolbars/ToolSeparator.qml,sha256=X2cKZnTYhYUO0jOVRCwx81QSz4YNwVWRXoSD7kT86V4,414
52
52
  RinUI/components/Navigation/ErrorPage.qml,sha256=XplTs6CKs1Y1441uvp9nSD4AeD08OIqoXlmz5RlpCPo,1039
@@ -67,12 +67,12 @@ RinUI/components/StatusAndInfo/ToolTip.qml,sha256=f6S9rG_0GsHQl8BB1m4Niik35s7Lng
67
67
  RinUI/components/Text/SpinBox.qml,sha256=rY17yJ3a0ckkl6pX00qVIQQYLmoO-GLtcSZh-WKtPZs,4616
68
68
  RinUI/components/Text/Text.qml,sha256=SWJBJtAWkq9XldrX6_BWfCXGRcLQLBNofkRO5NG8q2Q,1714
69
69
  RinUI/components/Text/TextArea.qml,sha256=guhwcFBSEyZkTRT2V0ER3S03xW9WOkH_4U2Oor2I9PY,3706
70
- RinUI/components/Text/TextField.qml,sha256=1DBiO9UCfDTpwma4bWVWXWfolhQu_i4qnhGWascX7dU,3522
70
+ RinUI/components/Text/TextField.qml,sha256=BXuJ16AUQaSh-Og7jaYSNEu9r1PcyG7FQ95DaGciJZs,3556
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
75
- RinUI/core/theme.py,sha256=BK9EovR2sHvcNarzptgsoMOll78R1B_ftKwEUqzqQhA,10672
74
+ RinUI/core/launcher.py,sha256=Bep-74tsgFvzMw1GHklwgOgQBRjtr4ptPV8FlYDJ5AQ,5046
75
+ RinUI/core/theme.py,sha256=IKyyBXzlakvSsP6Oxf6gGfb0wQWFkxvnVMyfw4RdSo4,10719
76
76
  RinUI/core/translator.py,sha256=5GK7Iy7-2iMicF8hQr79CwU9UWvCwE-8vGd8QkhJ1h8,1037
77
77
  RinUI/hooks/__init__.py,sha256=7sQJlly1ZbiZTzZUkCV2hI_gY-DAxWP_0kLyhZQ2Tm8,74
78
78
  RinUI/hooks/hook-RinUI.py,sha256=VvQui-b3YNuxvhqjRJqLPKdtnWQ6Ev8G9DEgzGNUUUI,116
@@ -86,7 +86,7 @@ RinUI/themes/dark.qml,sha256=qAn7MDh18K-44f4gPIRiA1l_T_PWoBxhhzh0Z6igC0w,5793
86
86
  RinUI/themes/light.qml,sha256=L1Qy1yotvF3GemfhQxxTt1keyMdsjOoK9COP6NyVQHE,5741
87
87
  RinUI/themes/qmldir,sha256=7SbN6C8cqEW6VvPb-eYg9AlppfkehmekbciYNHRoNSA,184
88
88
  RinUI/themes/theme.qml,sha256=srSHRVV9KmQBc9uYitHDjMvXFzvLPolaLu82Tf0uc_Q,4265
89
- RinUI/themes/utils.qml,sha256=Oz8ezVhCgugCerZUAO9_FBXIRzJSX5GZA4L-94onxMw,1675
89
+ RinUI/themes/utils.qml,sha256=wJfvrsBTYZWi3uJmS-LFIJmsGWzxuT1lTvA7ufiG6Qg,1735
90
90
  RinUI/utils/Animation.qml,sha256=hRzsJU_5G78JArYLvVtxTmRxX2VAuMgeWdAHzqyuYWQ,134
91
91
  RinUI/utils/FloatLayer.qml,sha256=D0rkYxK6_09OjrNuLHDXhdsb4xbUq5l2IiuLHCsLGhE,3471
92
92
  RinUI/utils/FontIconLoader.qml,sha256=Zm-talvAPxCBSt4nd8gpJ6jY91R1uRoJvaXKU3AaWEU,294
@@ -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.2.data/data/LICENSE,sha256=vgoqqpny5vKYu34VDBUWYQKzT7Nn-Xy9y8USmcOCyZQ,1063
106
+ rinui-0.1.2.data/data/README.md,sha256=8ZcR55RYV2slRAQbhoYhqDTPOLXmewkFSvuA_cE6zD0,3044
107
+ rinui-0.1.2.dist-info/licenses/LICENSE,sha256=vgoqqpny5vKYu34VDBUWYQKzT7Nn-Xy9y8USmcOCyZQ,1063
108
+ rinui-0.1.2.dist-info/METADATA,sha256=TqEp5U_YJcreGSLKjUF8I-j0TlN3F7eySHM2_7Ui9-s,3590
109
+ rinui-0.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
110
+ rinui-0.1.2.dist-info/entry_points.txt,sha256=taxuZYCggoQa2LPubwcurQYRjBRC4cNYOjWaqOYZVxw,54
111
+ rinui-0.1.2.dist-info/top_level.txt,sha256=vKKjXBXEw5OFRIzTxZWUC5ZOj0CK5e3atbymBB4eJ6w,6
112
+ rinui-0.1.2.dist-info/RECORD,,