refixed problem with running installed bungloo

This commit is contained in:
jeena 2013-03-04 08:17:15 +01:00
parent 0120e69429
commit 0c36523673
2 changed files with 17 additions and 16 deletions

1
.gitignore vendored
View file

@ -4,3 +4,4 @@ dsa_priv.pem
*.pyc *.pyc
.DS_Store .DS_Store
*~ *~
Linux/build/

View file

@ -1,14 +1,14 @@
#!/usr/bin/env python2 #!/usr/bin/env python2
import os, sys, pickle, subprocess import os, sys, pickle, subprocess, shutil
from PyQt4 import QtCore, QtGui, QtWebKit from PyQt4 import QtCore, QtGui, QtWebKit
if __name__ == "__main__": RUNNING_LOCAL = os.path.basename(__file__) == "Bungloo.py"
import Windows, Helper
else:
from bungloo import Windows, Helper
import shutil if RUNNING_LOCAL:
import Windows, Helper
else:
from bungloo import Windows, Helper
class Bungloo: class Bungloo:
@ -29,10 +29,10 @@ class Bungloo:
self.app.exec_() self.app.exec_()
def resources_path(self): def resources_path(self):
if __name__ == '__main__': if RUNNING_LOCAL:
return os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) return os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
else: else:
return Helper.Helper.get_resource_path() return Helper.Helper.get_resource_path()
def resources_uri(self): def resources_uri(self):
return "file://localhost/" + os.path.abspath(os.path.join(self.resources_path(), "WebKit")) 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) QtCore.QObject.__init__(self)
self.app = app self.app = app
oldpath = os.path.expanduser('~/.bungloo/') oldpath = os.path.expanduser('~/.bungloo/')
if os.path.isdir(oldpath): if os.path.isdir(oldpath):
shutil.copytree(oldpath, os.path.expanduser('~/.config/bungloo/')) shutil.copytree(oldpath, os.path.expanduser('~/.config/bungloo/'))
shutil.rmtree(os.path.expanduser('~/.bungloo/')) shutil.rmtree(os.path.expanduser('~/.bungloo/'))
if not os.path.exists(os.path.expanduser("~/.config/bungloo/")): if not os.path.exists(os.path.expanduser("~/.config/bungloo/")):
os.makedirs(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): if os.access(self.config_path, os.R_OK):
with open(self.config_path, 'r') as f: with open(self.config_path, 'r') as f: