Change UI loading for frozen

This commit is contained in:
Peter Šurda 2016-03-24 10:49:03 +01:00
parent 8b605a874a
commit ecfa18b1c6
1 changed files with 8 additions and 9 deletions

View File

@ -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)