Better handling of dev version

merge-requests/64/head
Hugo Posnic 2017-05-09 19:33:52 +02:00
parent b43e13499a
commit a3981a9835
2 changed files with 16 additions and 14 deletions

View File

@ -10,4 +10,4 @@ for lang in $(ls *.po); do
msgfmt -c -o ../locale/${lang//_/-}/LC_MESSAGES/manjaro-hello.mo $lang.po msgfmt -c -o ../locale/${lang//_/-}/LC_MESSAGES/manjaro-hello.mo $lang.po
done done
cd .. cd ..
python3 src/manjaro_hello.py python3 src/manjaro_hello.py --dev

View File

@ -18,27 +18,29 @@ class ManjaroHello():
def __init__(self): def __init__(self):
# App vars # App vars
self.app = "manjaro-hello" self.app = "manjaro-hello"
self.dev = False
for arg in sys.argv:
if arg == "--dev":
self.dev = True
# Paths # Paths
self.home_path = os.path.expanduser("~") self.home_path = os.path.expanduser("~")
self.config_path = self.home_path + "/.config/" self.config_path = self.home_path + "/.config/"
share_path = "/usr/share/"
if not self.dev:
self.data_path = "/usr/share/" + self.app + "/data/"
self.locale_path = "/usr/share/locale/"
ui_path = "/usr/share/" + self.app + "/ui/"
self.desktop_path = "/usr/share/applications/" + self.app + ".desktop"
else:
self.data_path = "data/" self.data_path = "data/"
self.locale_path = "locale/" self.locale_path = "locale/"
ui_path = "ui/" ui_path = "ui/"
self.desktop_path = self.app + ".desktop" self.desktop_path = os.getcwd() + "/" + self.app + ".desktop"
if os.path.basename(sys.argv[0]) == self.app: logo_path = "/usr/share/icons/hicolor/64x64/apps/manjaro.png"
self.data_path = share_path + self.app + "/" + self.data_path
self.locale_path = share_path + self.locale_path
ui_path = share_path + self.app + "/" + ui_path
self.desktop_path = share_path + "applications/" + self.desktop_path
else:
self.desktop_path = os.getcwd() + "/" + self.desktop_path
logo_path = share_path + "icons/hicolor/64x64/apps/manjaro.png"
self.preferences_path = self.config_path + self.app + ".json"
urls_path = self.data_path + "urls.json" urls_path = self.data_path + "urls.json"
self.preferences_path = self.config_path + self.app + ".json"
self.autostart_path = self.config_path + "autostart/" + self.app + ".desktop" self.autostart_path = self.config_path + "autostart/" + self.app + ".desktop"
self.live_path = "/run/miso/bootmnt/manjaro" self.live_path = "/run/miso/bootmnt/manjaro"