Skip to content

Commit 0fa3cdc

Browse files
authored
UI Fixed (#31) v0.0.4
1 parent 3c5ce59 commit 0fa3cdc

17 files changed

Lines changed: 1561 additions & 1140 deletions

.github/workflows/build.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@ jobs:
105105
if: matrix.config.name == 'windows'
106106
run: |
107107
cd dist
108-
Compress-Archive -Path OpenPoster -DestinationPath "OpenPoster-${{ matrix.config.name }}.zip"
108+
if (Test-Path -Path "OpenPoster" -PathType Container) {
109+
Compress-Archive -Path OpenPoster -DestinationPath "OpenPoster-${{ matrix.config.name }}.zip"
110+
} else {
111+
Compress-Archive -Path OpenPoster.exe -DestinationPath "OpenPoster-${{ matrix.config.name }}.zip"
112+
}
109113
110114
- name: Zip (macOS)
111115
if: matrix.config.name != 'windows'

app.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def event(self, event):
2727
return super().event(event)
2828

2929
if __name__ == "__main__":
30-
app = OpenPosterApplication([])
30+
app = OpenPosterApplication(sys.argv)
3131

3232
# ─── Localization ───────────────────────────────────
3333
config = ConfigManager()
@@ -47,7 +47,14 @@ def event(self, event):
4747
# ─── Global QSS theme ───────────────────────────────
4848
palette = app.palette()
4949
text_color = palette.color(QtGui.QPalette.Active, QtGui.QPalette.WindowText)
50-
is_dark = text_color.lightness() > 128
50+
system_is_dark = text_color.lightness() > 128
51+
52+
theme = config.get_config("ui_theme", None)
53+
if theme is None:
54+
theme = "dark" if system_is_dark else "light"
55+
config.set_config("ui_theme", theme)
56+
57+
is_dark = theme == "dark"
5158
qss_file = "themes/dark_style.qss" if is_dark else "themes/light_style.qss"
5259
qss_path = os.path.join(os.path.dirname(__file__), qss_file)
5360
if os.path.exists(qss_path):
@@ -123,7 +130,7 @@ def event(self, event):
123130
break
124131
if ca_file:
125132
widget.open_project(ca_file)
126-
elif app.file_to_open:
133+
elif app.file_to_open and app.file_to_open != sys.argv[0]:
127134
widget.open_project(app.file_to_open)
128135
# ───────────────────────────────────────────────────
129136

compile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
args = [
88
'app.py',
9-
'--onedir',
9+
'--onefile',
1010
# '--noconfirm',
1111
'--name=OpenPoster',
1212
'--optimize=2',

gui/_meta.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# app version
2-
__version__ = "0.0.3"
2+
__version__ = "0.0.4"
33

44
# that's about it really thank you

gui/config_manager.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,4 +220,11 @@ def set_filename_display_mode(self, value: str) -> None:
220220
if "ui" not in self.config:
221221
self.config["ui"] = {}
222222
self.config["ui"]["filename_display_mode"] = value
223+
self.save_config()
224+
225+
def get_config(self, key: str, default: Any = None) -> Any:
226+
return self.config.get(key, default)
227+
228+
def set_config(self, key: str, value: Any) -> None:
229+
self.config[key] = value
223230
self.save_config()

gui/custom_widgets.py

Lines changed: 149 additions & 183 deletions
Large diffs are not rendered by default.

gui/exportoptions_window.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22
from PySide6.QtGui import QIcon, QShortcut, QKeySequence
33
from PySide6.QtCore import Qt, QSize
44
from ui.ui_export_options_dialog import Ui_ExportOptionsDialog
5+
import os
6+
import sys
57

68
class ExportOptionsDialog(QDialog):
79
def __init__(self, parent=None, config_manager=None):
810
super().__init__(parent)
911
self.choice = None
1012
self.config_manager = config_manager
13+
self.setObjectName("ExportOptionsDialog")
1114

1215
self.ui = Ui_ExportOptionsDialog()
1316
self.ui.setupUi(self)
@@ -30,10 +33,27 @@ def __init__(self, parent=None, config_manager=None):
3033
is_dark = False
3134
if parent and hasattr(parent, 'isDarkMode'):
3235
is_dark = parent.isDarkMode
36+
self.apply_theme(is_dark)
3337

3438
nugget_icon_path = ":/icons/nugget-export-white.png" if is_dark else ":/icons/nugget-export.png"
3539
self.ui.nuggetButton.setIcon(QIcon(nugget_icon_path))
3640

3741
def set_choice(self, choice):
3842
self.choice = choice
39-
self.accept()
43+
self.accept()
44+
45+
def apply_theme(self, is_dark):
46+
if hasattr(sys, '_MEIPASS'):
47+
base_path = sys._MEIPASS
48+
else:
49+
base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
50+
51+
qss_file = "themes/dark_style.qss" if is_dark else "themes/light_style.qss"
52+
qss_path = os.path.join(base_path, qss_file)
53+
54+
if os.path.exists(qss_path):
55+
try:
56+
with open(qss_path, "r") as f:
57+
self.setStyleSheet(f.read())
58+
except Exception as e:
59+
print(f"Error applying {qss_file} to export options dialog: {e}")

0 commit comments

Comments
 (0)