From 2cd1178905b2e82131e4a752d864a0123d68eb6e Mon Sep 17 00:00:00 2001 From: ccremers Date: Wed, 9 Aug 2006 09:26:15 +0000 Subject: [PATCH] - Improved binary locator. --- gui/Gui/Preference.py | 3 ++- gui/Scyther/Scyther.py | 19 ++++++++++++++++--- gui/scyther-gui.py | 6 ++++++ 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/gui/Gui/Preference.py b/gui/Gui/Preference.py index 13e7d54..7a07611 100644 --- a/gui/Gui/Preference.py +++ b/gui/Gui/Preference.py @@ -13,8 +13,9 @@ match maxruns - scyther scytheroptions + bindir where the scyther executables reside + splashscreen 0/1 """ #--------------------------------------------------------------------------- diff --git a/gui/Scyther/Scyther.py b/gui/Scyther/Scyther.py index 497279b..58df127 100755 --- a/gui/Scyther/Scyther.py +++ b/gui/Scyther/Scyther.py @@ -19,19 +19,32 @@ from Misc import * #--------------------------------------------------------------------------- +""" Globals """ +bindir="." + +#--------------------------------------------------------------------------- + +def init(dir): + global bindir + + bindir = dir + +#--------------------------------------------------------------------------- + class Scyther(object): def __init__ ( self): + global bindir # Where is my executable? if sys.platform.startswith('win'): """ Windows """ # TODO hardcoded for now, bad - self.program = "Scyther.exe" + self.program = os.path.join(bindir,"Scyther.exe") if not os.path.isfile(self.program): print "I can't find the Scyther executable at %s" % (self.program) else: - """ Non-windows """ - self.program = "scyther" + """ Non-windows (linux) """ + self.program = os.path.join(bindir,"scyther") # Init self.spdl = None diff --git a/gui/scyther-gui.py b/gui/scyther-gui.py index 373bc9a..8d4edbb 100755 --- a/gui/scyther-gui.py +++ b/gui/scyther-gui.py @@ -14,6 +14,7 @@ from optparse import OptionParser, SUPPRESS_HELP import Gui.Preference as Preference import Gui.Mainwindow as Mainwindow import Gui.Misc as Misc +import Scyther.Scyther as Scyther #--------------------------------------------------------------------------- @@ -75,11 +76,16 @@ class ScytherApp(wx.App): wx.GetApp().SetAppName("Scyther-gui") # Parse arguments + basedir = os.path.abspath(os.path.dirname(sys.argv[0])) (opts,args) = parseArgs() # Load preferences file Preference.init() + # Init Scyther libs + bindir = Preference.get("bindir",os.path.join(basedir,"Scyther")) + Scyther.init(bindir) + """ Create and show the splash screen. It will then create and show the main frame when it is time to do so.