22from PySide6 .QtGui import QIcon , QShortcut , QKeySequence
33from PySide6 .QtCore import Qt , QSize
44from ui .ui_export_options_dialog import Ui_ExportOptionsDialog
5+ import os
6+ import sys
57
68class 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