diff --git a/.gitignore b/.gitignore index 6a1b44d..3d7cc77 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ dsa_priv.pem *.pyc .DS_Store *~ +Linux/build/ diff --git a/Linux/Bungloo.py b/Linux/Bungloo.py index 42610f1..6eaebd5 100755 --- a/Linux/Bungloo.py +++ b/Linux/Bungloo.py @@ -1,14 +1,14 @@ #!/usr/bin/env python2 -import os, sys, pickle, subprocess +import os, sys, pickle, subprocess, shutil from PyQt4 import QtCore, QtGui, QtWebKit -if __name__ == "__main__": - import Windows, Helper -else: - from bungloo import Windows, Helper +RUNNING_LOCAL = os.path.basename(__file__) == "Bungloo.py" -import shutil +if RUNNING_LOCAL: + import Windows, Helper +else: + from bungloo import Windows, Helper class Bungloo: @@ -29,10 +29,10 @@ class Bungloo: self.app.exec_() def resources_path(self): - if __name__ == '__main__': - return os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) - else: - return Helper.Helper.get_resource_path() + if RUNNING_LOCAL: + return os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) + else: + return Helper.Helper.get_resource_path() def resources_uri(self): return "file://localhost/" + os.path.abspath(os.path.join(self.resources_path(), "WebKit")) @@ -73,15 +73,15 @@ class Controller(QtCore.QObject): QtCore.QObject.__init__(self) self.app = app - oldpath = os.path.expanduser('~/.bungloo/') - if os.path.isdir(oldpath): - shutil.copytree(oldpath, os.path.expanduser('~/.config/bungloo/')) - shutil.rmtree(os.path.expanduser('~/.bungloo/')) + oldpath = os.path.expanduser('~/.bungloo/') + if os.path.isdir(oldpath): + shutil.copytree(oldpath, os.path.expanduser('~/.config/bungloo/')) + shutil.rmtree(os.path.expanduser('~/.bungloo/')) if not os.path.exists(os.path.expanduser("~/.config/bungloo/")): os.makedirs(os.path.expanduser("~/.config/bungloo/")) - - self.config_path = os.path.expanduser('~/.config/bungloo/bungloo.cfg') + + self.config_path = os.path.expanduser('~/.config/bungloo/bungloo.cfg') if os.access(self.config_path, os.R_OK): with open(self.config_path, 'r') as f: