Author: bugman Date: Thu Nov 19 11:15:13 2009 New Revision: 9881 URL: http://svn.gna.org/viewcvs/relax?rev=9881&view=rev Log: Command line opts for launching the GUI mode (-g, --gui) and the specific Bieri GUI model (-b, --bieri). Modified: branches/bieri_gui/relax Modified: branches/bieri_gui/relax URL: http://svn.gna.org/viewcvs/relax/branches/bieri_gui/relax?rev=9881&r1=9880&r2=9881&view=diff ============================================================================== --- branches/bieri_gui/relax (original) +++ branches/bieri_gui/relax Thu Nov 19 11:15:13 2009 @@ -127,6 +127,10 @@ self.interpreter = interpreter.Interpreter(self, intro_string) self.interpreter.run(self.script_file) + # Execute the Bieri GUI. + elif mode == 'bieri_gui': + self.bieri_gui.run() + # Execute the relax test suite elif mode == 'test suite': # Load the interpreter and turn intros on. @@ -161,6 +165,10 @@ elif mode == 'licence': self.licence() + # Unknown mode. + else: + raise relax_errors.RelaxError("The '%s' mode is unknown." % mode) + def arguments(self): """Function for processing the command line arguments.""" @@ -173,6 +181,8 @@ parser.add_option('-l', '--log', action='store', type='string', dest='log', help='log relax output to the file LOG_FILE', metavar='LOG_FILE') parser.add_option('--licence', action='store_true', dest='licence', default=0, help='display the licence') parser.add_option('-t', '--tee', action='store', type='string', dest='tee', help='tee relax output to stdout and the file LOG_FILE', metavar='LOG_FILE') + parser.add_option('-g', '--gui', action='store', type='string', dest='gui', default=None, help='launch the specified GUI for relax') + parser.add_option('-b', '--bieri', action='store_true', dest='bieri_gui', default=0, help='launch the Bieri GUI for relax') parser.add_option('-p', '--pedantic', action='store_true', dest='pedantic', default=0, help='escalate all warnings to errors') parser.add_option('--test', action='store_true', dest='test', default=0, help='run relax in test mode') parser.add_option('-x', '--test-suite', action='store_true', dest='test_suite', default=0, help='execute the relax test suite') @@ -297,6 +307,26 @@ elif self.script_file: mode = 'script' + # GUI. + elif options.gui or options.bieri_gui: + # Make sure no script is supplied. + if self.script_file: + parser.error("a script should not be supplied in test mode") + + # Exclusive models. + if options.gui and options.gui != 'bieri' and options.bieri_gui: + parser.error("specifying multiple GUIs is not allowed") + elif options.test_suite or options.system_tests or options.unit_tests: + parser.error("the relax GUI mode and testing modes are mutually exclusive") + elif options.licence: + parser.error("the relax GUI mode and licence mode are mutually exclusive") + + # Set the mode. + if options.gui == 'bieri' or options.bieri_gui: + mode = 'bieri_gui' + else: + parser.error("the '%s' GUI interface is unknown" % options.gui) + # Prompt mode (default). else: mode = 'prompt'