prkit 0.3.2__tar.gz → 0.3.3__tar.gz
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.
- {prkit-0.3.2 → prkit-0.3.3}/PKG-INFO +5 -5
- {prkit-0.3.2 → prkit-0.3.3}/README.md +4 -4
- {prkit-0.3.2 → prkit-0.3.3}/pyproject.toml +1 -1
- {prkit-0.3.2 → prkit-0.3.3}/pyproject.toml.orig +1 -1
- {prkit-0.3.2 → prkit-0.3.3}/src/prkit/__init__.py +1 -1
- {prkit-0.3.2 → prkit-0.3.3}/src/prkit/language.py +14 -1
- {prkit-0.3.2 → prkit-0.3.3}/src/prkit/tray.py +57 -6
- {prkit-0.3.2 → prkit-0.3.3}/LICENSE +0 -0
- {prkit-0.3.2 → prkit-0.3.3}/src/prkit/__main__.py +0 -0
- {prkit-0.3.2 → prkit-0.3.3}/src/prkit/app.py +0 -0
- {prkit-0.3.2 → prkit-0.3.3}/src/prkit/autostart.py +0 -0
- {prkit-0.3.2 → prkit-0.3.3}/src/prkit/capslock.py +0 -0
- {prkit-0.3.2 → prkit-0.3.3}/src/prkit/cursor_watchdog.py +0 -0
- {prkit-0.3.2 → prkit-0.3.3}/src/prkit/icon.py +0 -0
- {prkit-0.3.2 → prkit-0.3.3}/src/prkit/input_source.py +0 -0
- {prkit-0.3.2 → prkit-0.3.3}/src/prkit/keyboard.py +0 -0
- {prkit-0.3.2 → prkit-0.3.3}/src/prkit/keys.py +0 -0
- {prkit-0.3.2 → prkit-0.3.3}/src/prkit/mac_capslock.py +0 -0
- {prkit-0.3.2 → prkit-0.3.3}/src/prkit/mac_keyboard.py +0 -0
- {prkit-0.3.2 → prkit-0.3.3}/src/prkit/message_dialog.py +0 -0
- {prkit-0.3.2 → prkit-0.3.3}/src/prkit/overlays.py +0 -0
- {prkit-0.3.2 → prkit-0.3.3}/src/prkit/platform.py +0 -0
- {prkit-0.3.2 → prkit-0.3.3}/src/prkit/py.typed +0 -0
- {prkit-0.3.2 → prkit-0.3.3}/src/prkit/settings.py +0 -0
- {prkit-0.3.2 → prkit-0.3.3}/src/prkit/single_instance.py +0 -0
- {prkit-0.3.2 → prkit-0.3.3}/src/prkit/spotlight.py +0 -0
- {prkit-0.3.2 → prkit-0.3.3}/src/prkit/windows_cursor.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: prkit
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.3
|
|
4
4
|
Summary: A cross-platform system-tray presentation toolkit
|
|
5
5
|
Author: meebox
|
|
6
6
|
Author-email: meebox <meebox@gmail.com>
|
|
@@ -40,12 +40,12 @@ Description-Content-Type: text/markdown
|
|
|
40
40
|
|
|
41
41
|
| 平台 | 下載檔案 | 啟動方式 |
|
|
42
42
|
| --- | --- | --- |
|
|
43
|
-
| Windows x64 | `PRKit-0.3.
|
|
44
|
-
| macOS Apple Silicon | `PRKit-0.3.
|
|
43
|
+
| Windows x64 | `PRKit-0.3.3-windows-x64.zip` | 解壓完整資料夾後執行 `PRKit/PRKit.exe` |
|
|
44
|
+
| macOS Apple Silicon | `PRKit-0.3.3-macos-arm64.dmg` | 開啟 DMG,將 `PRKit.app` 拖到「Applications」捷徑後啟動 |
|
|
45
45
|
|
|
46
46
|
Windows ZIP 包含完整執行環境與游標復原 watchdog;請保留整個 `PRKit` 資料夾。macOS 目前僅提供 Apple Silicon 版。程式啟動後顯示在系統匣/選單列,不會開啟主視窗。若啟用了開機自動啟動,搬移 Windows 資料夾後請在選單取消勾選再重新勾選,以更新啟動路徑。
|
|
47
47
|
|
|
48
|
-
系統匣選單中的「開機自動啟動」會在目前使用者登入時啟動程式,取消勾選即可移除。語言按鈕依序切換地球(隨系統)、「中」(中文)和「En
|
|
48
|
+
系統匣選單中的「開機自動啟動」會在目前使用者登入時啟動程式,取消勾選即可移除。語言按鈕依序切換地球(隨系統)、「中」(中文)和「En」(英文);切換會立即生效並保存。「隨系統」依介面語言偏好選取支援的中文或英文;macOS 繁體中文系統會顯示中文。色塊與語言按鈕採無框線樣式,滑鼠移入時顯示背景回饋。
|
|
49
49
|
|
|
50
50
|
桌面版尚未使用 Windows 發行者憑證或 Apple Developer ID 簽署/公證;macOS 僅使用 ad-hoc 簽章。若系統阻擋你確認來源的下載檔案,請依系統安全提示允許開啟。macOS 按鍵顯示仍需在「輸入監控」允許 `PRKit`;輸入法狀態模式不需此權限。每個下載檔另提供 `.sha256` 校驗檔。
|
|
51
51
|
|
|
@@ -74,7 +74,7 @@ uv tool install git+https://github.com/codemee/prkit.git@latest
|
|
|
74
74
|
prkit
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
若要固定特定版本,將 `latest` 改成版本標籤,例如 `v0.3.
|
|
77
|
+
若要固定特定版本,將 `latest` 改成版本標籤,例如 `v0.3.3`。
|
|
78
78
|
|
|
79
79
|
## 授權
|
|
80
80
|
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
|
|
22
22
|
| 平台 | 下載檔案 | 啟動方式 |
|
|
23
23
|
| --- | --- | --- |
|
|
24
|
-
| Windows x64 | `PRKit-0.3.
|
|
25
|
-
| macOS Apple Silicon | `PRKit-0.3.
|
|
24
|
+
| Windows x64 | `PRKit-0.3.3-windows-x64.zip` | 解壓完整資料夾後執行 `PRKit/PRKit.exe` |
|
|
25
|
+
| macOS Apple Silicon | `PRKit-0.3.3-macos-arm64.dmg` | 開啟 DMG,將 `PRKit.app` 拖到「Applications」捷徑後啟動 |
|
|
26
26
|
|
|
27
27
|
Windows ZIP 包含完整執行環境與游標復原 watchdog;請保留整個 `PRKit` 資料夾。macOS 目前僅提供 Apple Silicon 版。程式啟動後顯示在系統匣/選單列,不會開啟主視窗。若啟用了開機自動啟動,搬移 Windows 資料夾後請在選單取消勾選再重新勾選,以更新啟動路徑。
|
|
28
28
|
|
|
29
|
-
系統匣選單中的「開機自動啟動」會在目前使用者登入時啟動程式,取消勾選即可移除。語言按鈕依序切換地球(隨系統)、「中」(中文)和「En
|
|
29
|
+
系統匣選單中的「開機自動啟動」會在目前使用者登入時啟動程式,取消勾選即可移除。語言按鈕依序切換地球(隨系統)、「中」(中文)和「En」(英文);切換會立即生效並保存。「隨系統」依介面語言偏好選取支援的中文或英文;macOS 繁體中文系統會顯示中文。色塊與語言按鈕採無框線樣式,滑鼠移入時顯示背景回饋。
|
|
30
30
|
|
|
31
31
|
桌面版尚未使用 Windows 發行者憑證或 Apple Developer ID 簽署/公證;macOS 僅使用 ad-hoc 簽章。若系統阻擋你確認來源的下載檔案,請依系統安全提示允許開啟。macOS 按鍵顯示仍需在「輸入監控」允許 `PRKit`;輸入法狀態模式不需此權限。每個下載檔另提供 `.sha256` 校驗檔。
|
|
32
32
|
|
|
@@ -55,7 +55,7 @@ uv tool install git+https://github.com/codemee/prkit.git@latest
|
|
|
55
55
|
prkit
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
若要固定特定版本,將 `latest` 改成版本標籤,例如 `v0.3.
|
|
58
|
+
若要固定特定版本,將 `latest` 改成版本標籤,例如 `v0.3.3`。
|
|
59
59
|
|
|
60
60
|
## 授權
|
|
61
61
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import sys
|
|
4
|
+
|
|
3
5
|
from PySide6.QtCore import QLocale
|
|
4
6
|
|
|
5
7
|
ENGLISH = {
|
|
@@ -50,7 +52,18 @@ ENGLISH = {
|
|
|
50
52
|
|
|
51
53
|
def effective_language(preference: str) -> str:
|
|
52
54
|
if preference == "system":
|
|
53
|
-
|
|
55
|
+
if sys.platform == "darwin":
|
|
56
|
+
from Foundation import NSLocale
|
|
57
|
+
|
|
58
|
+
# Qt's locale can be C/English even when macOS prefers Chinese.
|
|
59
|
+
languages = NSLocale.preferredLanguages()
|
|
60
|
+
else:
|
|
61
|
+
languages = QLocale.system().uiLanguages()
|
|
62
|
+
for tag in languages:
|
|
63
|
+
language = str(tag).replace("_", "-").split("-", 1)[0].lower()
|
|
64
|
+
if language in {"zh", "en"}:
|
|
65
|
+
return language
|
|
66
|
+
return "en"
|
|
54
67
|
return preference if preference in {"zh", "en"} else "zh"
|
|
55
68
|
|
|
56
69
|
|
|
@@ -3,8 +3,8 @@ from __future__ import annotations
|
|
|
3
3
|
import sys
|
|
4
4
|
from collections.abc import Callable
|
|
5
5
|
|
|
6
|
-
from PySide6.QtCore import QObject, Qt, Signal
|
|
7
|
-
from PySide6.QtGui import QAction, QColor
|
|
6
|
+
from PySide6.QtCore import QObject, Qt, QTimer, Signal
|
|
7
|
+
from PySide6.QtGui import QAction, QColor, QCursor
|
|
8
8
|
from PySide6.QtWidgets import (
|
|
9
9
|
QCheckBox,
|
|
10
10
|
QColorDialog,
|
|
@@ -40,6 +40,8 @@ class ColorButton(QPushButton):
|
|
|
40
40
|
self._color = color
|
|
41
41
|
self._dialog_title = "選擇顏色"
|
|
42
42
|
self.setFixedSize(42, 24)
|
|
43
|
+
self.setFlat(True)
|
|
44
|
+
self.setCursor(Qt.CursorShape.PointingHandCursor)
|
|
43
45
|
self.setToolTip("選擇顏色")
|
|
44
46
|
self.clicked.connect(self._choose_color)
|
|
45
47
|
self.set_color(color)
|
|
@@ -50,9 +52,15 @@ class ColorButton(QPushButton):
|
|
|
50
52
|
|
|
51
53
|
def set_color(self, color: str) -> None:
|
|
52
54
|
self._color = QColor(color).name().upper()
|
|
55
|
+
swatch = QColor(self._color)
|
|
56
|
+
hover = swatch.darker(115) if swatch.lightnessF() > 0.5 else swatch.lighter(140)
|
|
57
|
+
# Lifting black also needs a visible hover state (lighter() keeps it black).
|
|
58
|
+
if swatch.lightnessF() < 0.05:
|
|
59
|
+
hover = QColor("#303030")
|
|
53
60
|
self.setStyleSheet(
|
|
54
|
-
f"QPushButton {{ background: {self._color}; border:
|
|
55
|
-
"border-radius:
|
|
61
|
+
f"QPushButton {{ background: {self._color}; border: none; "
|
|
62
|
+
"border-radius: 6px; }"
|
|
63
|
+
f"QPushButton:hover, QPushButton:focus {{ background: {hover.name()}; }}"
|
|
56
64
|
)
|
|
57
65
|
|
|
58
66
|
def _choose_color(self) -> None:
|
|
@@ -242,7 +250,8 @@ class SettingsPanel(QWidget):
|
|
|
242
250
|
def _separator() -> QFrame:
|
|
243
251
|
frame = QFrame()
|
|
244
252
|
frame.setFrameShape(QFrame.Shape.HLine)
|
|
245
|
-
frame.
|
|
253
|
+
frame.setFixedHeight(1)
|
|
254
|
+
frame.setStyleSheet("border: none; background: palette(midlight);")
|
|
246
255
|
return frame
|
|
247
256
|
|
|
248
257
|
@staticmethod
|
|
@@ -286,6 +295,15 @@ class TrayController(QObject):
|
|
|
286
295
|
self.language_label = QLabel(language_row)
|
|
287
296
|
self.language_button = QPushButton(language_row)
|
|
288
297
|
self.language_button.setFixedSize(40, 36)
|
|
298
|
+
self.language_button.setFlat(True)
|
|
299
|
+
self.language_button.setCursor(Qt.CursorShape.PointingHandCursor)
|
|
300
|
+
self.language_button.setAttribute(Qt.WidgetAttribute.WA_Hover, True)
|
|
301
|
+
self.language_button.setStyleSheet(
|
|
302
|
+
"QPushButton { background: transparent; border: none; border-radius: 6px; }"
|
|
303
|
+
'QPushButton:hover, QPushButton[pointerHover="true"] '
|
|
304
|
+
"{ background: rgba(128, 128, 128, 144); }"
|
|
305
|
+
"QPushButton:pressed { background: rgba(128, 128, 128, 192); }"
|
|
306
|
+
)
|
|
289
307
|
self.language_button.clicked.connect(self._cycle_language)
|
|
290
308
|
language_layout.addWidget(self.language_label)
|
|
291
309
|
language_layout.addStretch(1)
|
|
@@ -297,9 +315,42 @@ class TrayController(QObject):
|
|
|
297
315
|
self.exit_action.triggered.connect(self.exit_requested)
|
|
298
316
|
self.menu.addAction(self.exit_action)
|
|
299
317
|
self.tray = QSystemTrayIcon(tray_icon(), self)
|
|
300
|
-
|
|
318
|
+
if sys.platform == "darwin":
|
|
319
|
+
# Native macOS menus do not track hover for embedded QWidgetActions.
|
|
320
|
+
# Open a Qt popup instead so the settings controls receive mouse events.
|
|
321
|
+
self.tray.activated.connect(self._show_menu)
|
|
322
|
+
self._hover_timer = QTimer(self)
|
|
323
|
+
self._hover_timer.setInterval(40)
|
|
324
|
+
self._hover_timer.timeout.connect(self._refresh_language_hover)
|
|
325
|
+
self.menu.aboutToShow.connect(self._hover_timer.start)
|
|
326
|
+
self.menu.aboutToHide.connect(self._clear_language_hover)
|
|
327
|
+
else:
|
|
328
|
+
self.tray.setContextMenu(self.menu)
|
|
301
329
|
self.retranslate(effective_language(settings.language))
|
|
302
330
|
|
|
331
|
+
def _show_menu(self, reason: QSystemTrayIcon.ActivationReason) -> None:
|
|
332
|
+
if reason in {
|
|
333
|
+
QSystemTrayIcon.ActivationReason.Trigger,
|
|
334
|
+
QSystemTrayIcon.ActivationReason.Context,
|
|
335
|
+
}:
|
|
336
|
+
self.menu.popup(QCursor.pos())
|
|
337
|
+
|
|
338
|
+
def _refresh_language_hover(self) -> None:
|
|
339
|
+
button = self.language_button
|
|
340
|
+
hovered = button.rect().contains(button.mapFromGlobal(QCursor.pos()))
|
|
341
|
+
if button.property("pointerHover") != hovered:
|
|
342
|
+
button.setProperty("pointerHover", hovered)
|
|
343
|
+
button.style().unpolish(button)
|
|
344
|
+
button.style().polish(button)
|
|
345
|
+
button.update()
|
|
346
|
+
|
|
347
|
+
def _clear_language_hover(self) -> None:
|
|
348
|
+
self._hover_timer.stop()
|
|
349
|
+
self.language_button.setProperty("pointerHover", False)
|
|
350
|
+
self.language_button.style().unpolish(self.language_button)
|
|
351
|
+
self.language_button.style().polish(self.language_button)
|
|
352
|
+
self.language_button.update()
|
|
353
|
+
|
|
303
354
|
def retranslate(self, language: str) -> None:
|
|
304
355
|
self.panel.retranslate(language)
|
|
305
356
|
self.autostart_checkbox.setText(tr("開機自動啟動", language))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|