from PyQt4 import uic
import os.path
import sys


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)

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 load(resFile, widget):
    uic.loadUi(resource_path(resFile), widget)

Change UI loading for frozen
Change UI loading for frozen

  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 load(resFile, widget):
+     uic.loadUi(resource_path(resFile), widget)
- 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)
- 
Change UI loading for frozen
## Code Before:
from PyQt4 import uic
import os.path
import sys


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)

## Instruction:
Change UI loading for frozen
## Code After:
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 load(resFile, widget):
    uic.loadUi(resource_path(resFile), widget)
