From ecfa18b1c6d8dfd565ab625b3bb600d2d792310f Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Thu, 24 Mar 2016 10:49:03 +0100 Subject: [PATCH] Change UI loading for frozen --- src/bitmessageqt/widgets.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/bitmessageqt/widgets.py b/src/bitmessageqt/widgets.py index 7919d7f9..02394296 100644 --- a/src/bitmessageqt/widgets.py +++ b/src/bitmessageqt/widgets.py @@ -1,14 +1,13 @@ from PyQt4 import uic import os.path import sys +from shared import codePath +def resource_path(resFile): + baseDir = codePath() + for subDir in ["ui", "bitmessageqt"]: + if os.path.isdir(os.path.join(baseDir, subDir)) and os.path.isfile(os.path.join(baseDir, subDir, resFile)): + return os.path.join(baseDir, subDir, resFile) -def resource_path(path): - try: - return os.path.join(sys._MEIPASS, path) - except: - return os.path.join(os.path.dirname(__file__), path) - - -def load(path, widget): - uic.loadUi(resource_path(path), widget) +def load(resFile, widget): + uic.loadUi(resource_path(resFile), widget)