File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed
Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change 1919
2020
2121class DAZWranglerApp (QMainWindow ):
22- def __init__ (self ):
22+ def __init__ (self , ui_path ):
2323 super ().__init__ ()
24- self .ui = uic .loadUi (os .path .join (os .getcwd (), 'daz_linux_casefix.ui' ), self )
24+ self .ui = uic .loadUi (ui_path , self )
25+
2526 self .show ()
2627
2728 globals .ui_object = self
@@ -151,21 +152,29 @@ def fix_directories(self):
151152
152153
153154
155+ def get_resource_path (relative_path ):
156+ """ Get the absolute path to the resource, works for dev and for PyInstaller """
157+ try :
158+ # PyInstaller creates a temp folder and stores path in _MEIPASS
159+ base_path = sys ._MEIPASS
160+ except Exception :
161+ base_path = os .path .abspath ("." )
154162
163+ return os .path .join (base_path , relative_path )
155164
156165
157166if __name__ == '__main__' :
158167 # Prints out the themes available
159168 # print(QStyleFactory.keys())
160169
161- # user_login_name = os.getlogin()
162- # print(user_login_name)
163170
164171 app = QApplication (sys .argv )
165172 app .setStyle ('Fusion' )
166173 app .setStyleSheet (qdarktheme .load_stylesheet ())
167174
168175 print (app .style ().objectName ())
169- App = DAZWranglerApp ()
176+ # Load the .ui file using the correct path
177+ ui_file_path = get_resource_path ('./daz_linux_casefix.ui' )
178+ App = DAZWranglerApp (ui_file_path )
170179
171180 sys .exit (app .exec ())
You can’t perform that action at this time.
0 commit comments