/[ascend]/trunk/pygtk/gtkbrowser.py
ViewVC logotype

Diff of /trunk/pygtk/gtkbrowser.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 626 by johnpye, Mon May 15 14:38:01 2006 UTC revision 627 by johnpye, Tue May 23 03:07:41 2006 UTC
# Line 8  def print_loading_status(status,msg=None Line 8  def print_loading_status(status,msg=None
8      sys.stderr.write(status+"...")      sys.stderr.write(status+"...")
9      sys.stderr.flush()      sys.stderr.flush()
10    
 print_loading_status("Loading PSYCO")  
   
 #try:  
 #   import psyco  
 #   psyco.full()  
 #   print "Running with PSYCO optimisation..."  
 #except ImportError:  
 #   pass  
   
   
 print_loading_status("Loading python standard libraries")  
   
 import re  
 import urlparse  
 import optparse  
 import platform  
 import sys  
 import os.path  
   
 if platform.system() != "Windows":  
     import dl  
     # This sets the flags for dlopen used by python so that the symbols in the  
     # ascend library are made available to libraries dlopened within ASCEND:  
     sys.setdlopenflags(dl.RTLD_GLOBAL|dl.RTLD_NOW)  
       
 print_loading_status("Loading LIBASCEND/ascpy")  
 import ascpy  
   
 print_loading_status("Loading PyGTK, glade, pango")  
   
 import pygtk  
 pygtk.require('2.0')  
 import gtk  
 import gtk.glade  
 import pango  
   
 print_loading_status("Loading python matplotlib")  
11  try:  try:
12      import matplotlib      print_loading_status("Loading PSYCO")
13    
14        #try:
15        #   import psyco
16        #   psyco.full()
17        #   print "Running with PSYCO optimisation..."
18        #except ImportError:
19        #   pass
20    
21    
22        print_loading_status("Loading python standard libraries")
23    
24        import re
25        import urlparse
26        import optparse
27        import platform
28        import sys
29        import os.path
30    
31        if platform.system() != "Windows":
32            import dl
33            # This sets the flags for dlopen used by python so that the symbols in the
34            # ascend library are made available to libraries dlopened within ASCEND:
35            sys.setdlopenflags(dl.RTLD_GLOBAL|dl.RTLD_NOW)
36    
37        print_loading_status("Loading LIBASCEND/ascpy")
38        import ascpy
39    
40        print_loading_status("Loading PyGTK, glade, pango")
41    
42        import pygtk
43        pygtk.require('2.0')
44        import gtk
45        import gtk.glade
46        import pango
47    
48        print_loading_status("Loading python matplotlib")
49      try:      try:
50          print_loading_status("Trying python numpy")          import matplotlib
51          import numpy  
         matplotlib.rcParams['numerix'] = 'numpy'    
         print_loading_status("","Using python module numpy")  
     except ImportError:  
52          try:          try:
53              print_loading_status("Trying python numarray")              print_loading_status("Trying python numpy")
54              import numarray              import numpy
55              matplotlib.rcParams['numerix'] = 'numarray'                matplotlib.rcParams['numerix'] = 'numpy'  
56              print_loading_status("","Using python module numarray")              print_loading_status("","Using python module numpy")
57          except ImportError:          except ImportError:
58              try:              try:
59                  print_loading_status("Trying python Numeric")                  print_loading_status("Trying python numarray")
60                  import Numeric                  import numarray
61                  matplotlib.rcParams['numerix'] = 'Numeric'                    matplotlib.rcParams['numerix'] = 'numarray'  
62                  print_loading_status("","Using python module Numeric")                  print_loading_status("","Using python module numarray")
63              except ImportError:              except ImportError:
64                  print_loading_status("","FAILED TO LOAD A NUMERIC MODULE FOR PYTHON")                  try:
65                        print_loading_status("Trying python Numeric")
66  except ImportError:                      import Numeric
67      print_loading_status("Loading python matplotlib","FAILED TO LOAD MATPLOTLIB")                      matplotlib.rcParams['numerix'] = 'Numeric'  
68                        print_loading_status("","Using python module Numeric")
69  print_loading_status("Loading ASCEND python modules")                  except ImportError:
70                        print_loading_status("","FAILED TO LOAD A NUMERIC MODULE FOR PYTHON")
71  from preferences import *      # loading/saving of .ini options  
72  from solverparameters import * # 'solver parameters' window      except ImportError,e:
73  from help import *             # viewing help files          print_loading_status("","FAILED TO LOAD MATPLOTLIB")
74  from incidencematrix import *  # incidence/sparsity matrix matplotlib window          raise RuntimeError("Failed to load MATPLOTLIB (is it installed?). Details:"+str(e))
75  from observer import *         # observer tab support  
76  from properties import *       # solver_var properties dialog      print_loading_status("Loading ASCEND python modules")
77  from varentry import *         # for inputting of variables with units  
78  from diagnose import *         # for diagnosing block non-convergence      from preferences import *      # loading/saving of .ini options
79  from solverreporter import *   # solver status reporting      from solverparameters import * # 'solver parameters' window
80  from modelview import *        # model browser      from help import *             # viewing help files
81  import config      from incidencematrix import *  # incidence/sparsity matrix matplotlib window
82        from observer import *         # observer tab support
83        from properties import *       # solver_var properties dialog
84        from varentry import *         # for inputting of variables with units
85        from diagnose import *         # for diagnosing block non-convergence
86        from solverreporter import *   # solver status reporting
87        from modelview import *        # model browser
88        import config
89    except RuntimeError, e:
90        print "ASCEND had problems starting up. Please report the following"
91        print "error message at http://mantis.cruncher2.dyndns.org/."
92        print "\n\nFull error message:",str(e)
93        print "\n\nPress ENTER to close this window."
94        sys.stdout.flush()
95        sys.stdin.readline();
96        sys.exit();
97    
98    except ImportError, e:
99        print "\n\n------------------  ERROR  ---------------------"
100        print     "ASCEND had problems importing required models."
101        print "\nPlease ensure you have all the runtime prerequisites installed."
102        print "Please then report a bug if you continue to have problems."
103        print "\nFull error message:",str(e)
104        if platform.system()=="Windows":
105            print "\nYou will also need to report the contents of any popup error"
106            print "messages from Windows if any were shown."
107        print "\n\nPress ENTER to close this window."
108        sys.stdout.flush()
109        sys.stdin.readline();
110        sys.exit();
111    
112  print_loading_status("Starting GUI")  print_loading_status("Starting GUI")
113    

Legend:
Removed from v.626  
changed lines
  Added in v.627

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22