From 96048b513362cc75ae2a18c7f1e2de498f0e5fe8 Mon Sep 17 00:00:00 2001 From: Constantin Wenger Date: Tue, 12 Jan 2016 18:46:24 +0100 Subject: [PATCH] added command line option to set the window title --- gui/mainFrame.py | 4 ++-- pyfa.py | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/gui/mainFrame.py b/gui/mainFrame.py index 3c47e08fd..6d56f7918 100644 --- a/gui/mainFrame.py +++ b/gui/mainFrame.py @@ -116,8 +116,8 @@ class MainFrame(wx.Frame): def getInstance(cls): return cls.__instance if cls.__instance is not None else MainFrame() - def __init__(self): - self.title="pyfa %s%s - Python Fitting Assistant"%(config.version, "" if config.tag.lower() != 'git' else " (git)") + def __init__(self, title): + self.title=title wx.Frame.__init__(self, None, wx.ID_ANY, self.title) MainFrame.__instance = self diff --git a/pyfa.py b/pyfa.py index c4a39c9d6..bf51de26a 100755 --- a/pyfa.py +++ b/pyfa.py @@ -43,6 +43,7 @@ parser = PassThroughOptionParser(usage=usage) parser.add_option("-r", "--root", action="store_true", dest="rootsavedata", help="if you want pyfa to store its data in root folder, use this option", default=False) parser.add_option("-w", "--wx28", action="store_true", dest="force28", help="Force usage of wxPython 2.8", default=False) parser.add_option("-d", "--debug", action="store_true", dest="debug", help="Set logger to debug level.", default=False) +parser.add_option("-t", "--title", action="store", dest="title", help="Set Window Title", default=None) (options, args) = parser.parse_args() @@ -99,6 +100,10 @@ if __name__ == "__main__": # Configure paths if options.rootsavedata is True: config.saveInRoot = True + + # set title if it wasn't supplied by argument + if options.title == None: + options.title = "pyfa %s%s - Python Fitting Assistant"%(config.version, "" if config.tag.lower() != 'git' else " (git)") config.debug = options.debug config.defPaths() @@ -123,5 +128,5 @@ if __name__ == "__main__": eos.db.saveddata_meta.create_all() pyfa = wx.App(False) - MainFrame() + MainFrame(options.title) pyfa.MainLoop()