#!/usr/bin/env python # -*- coding: iso-8859-1 -*- # #------------------------------------------------------------------------------- # Code_Saturne version 1.3 # ------------------------ # # # This file is part of the Code_Saturne User Interface, element of the # Code_Saturne CFD tool. # # Copyright (C) 1998-2007 EDF S.A., France # # contact: saturne-support@edf.fr # # The Code_Saturne User Interface is free software; you can redistribute it # and/or modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # The Code_Saturne User Interface is distributed in the hope that it will be # useful, but WITHOUT ANY WARRANTY; without even the implied warranty # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with the Code_Saturne Kernel; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, # Boston, MA 02110-1301 USA # #------------------------------------------------------------------------------- """ A script that parses command line arguments and launches a SaturneTkGUI. This is to be used by folks who wish to use SaturneGUI as a standalone application. """ #------------------------------------------------------------------------------- # Library modules import #------------------------------------------------------------------------------- import sys #------------------------------------------------------------------------------- # Application modules import #------------------------------------------------------------------------------- from Base.Common import * from Base.CommandLine import usage, process_cmd_line #------------------------------------------------------------------------------- # If the user just wants help messagesr, print them before importing # any of big modules. #------------------------------------------------------------------------------- if ('-h' in sys.argv[1:]) or ('--help' in sys.argv[1:]): print usage() sys.exit(0) if ('-v' in sys.argv[1:]) or ('--version' in sys.argv[1:]): print 'SaturneGUI %s'%VERSION sys.exit(0) #------------------------------------------------------------------------------- # Start point of the Graphical User Interface. #------------------------------------------------------------------------------- def startGUI(): """ Starts Tix and then starts a session of the application. """ import Tix try: # Check if SaturneGUI is available as a module # (i.e. the PYTHONPATH is update). # import SaturneGUI except ImportError: # The script is being run from the main directory. # import Base.Main import Base.Toolbox case, lang, matisse, batch_window, batch_file, tree_window, read_only \ = process_cmd_line(sys.argv[1:]) try: root = Tix.Tk() except: print "Unable to display a Tk window. \n" print "Please check your diplay environment.\n" sys.exit(0) Base.Toolbox.setupWmDefault(root, wm) root.withdraw() myGUI = Base.Main.BaseTkGUI(root, case, lang, matisse, batch_window, batch_file, tree_window, read_only) root.mainloop() if __name__ == '__main__': startGUI() #------------------------------------------------------------------------------- # End #-------------------------------------------------------------------------------