Skip to content

Commit

Permalink
prepared the main script to enable a linux launcher
Browse files Browse the repository at this point in the history
  • Loading branch information
Noiredd committed Mar 2, 2019
1 parent 55a5e66 commit 0e552b3
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions filmatyk/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,9 @@ class Main(object):
filename = 'filmatyk.dat' # will be created in user documents/home directory
wintitle = '{}Filmatyk' # format with debug flag

def __init__(self, debugMode=False):
def __init__(self, debugMode=False, isOnLinux=False):
self.debugMode = debugMode
self.isOnLinux = isOnLinux
self.root = root = tk.Tk()
root.title(self.wintitle.format('[DEBUG] ' if self.debugMode else ''))
# construct the window: first the notebook for tabbed view
Expand Down Expand Up @@ -290,15 +291,18 @@ def _quit(self, restart=False):
# Updater might request the whole app to restart. In this case, a request
# is passed higher to the system shell to launch the app again.
if restart:
command = "cd .. && Filmatyk.bat"
command = "cd .. &&"
# remember which launcher was used
if self.isOnLinux:
command += " Filmatyk_linux.sh"
else:
command += " Filmatyk.bat"
# maintain debug status
if self.debugMode:
command += " debug"
os.system(command)

if __name__ == "__main__":
try:
isDebug = sys.argv[1] == "debug"
except:
isDebug = False
Main(debugMode=isDebug)
debugMode = "debug" in sys.argv
isOnLinux = "linux" in sys.argv
Main(debugMode=debugMode, isOnLinux=isOnLinux)

0 comments on commit 0e552b3

Please sign in to comment.