/[gnue]/gnue-navigator/src/GNClient.py
ViewVC logotype

Diff of /gnue-navigator/src/GNClient.py

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

revision 1.21 by siesel, Mon Aug 4 15:41:37 2003 UTC revision 1.22 by btami, Sun Aug 10 23:28:29 2003 UTC
# Line 37  import string Line 37  import string
37  from gnue.navigator.GNParser import loadProcesses  from gnue.navigator.GNParser import loadProcesses
38  from gnue.navigator import Actions  from gnue.navigator import Actions
39  from gnue.common.apps import GDebug  from gnue.common.apps import GDebug
40  from gnue.common.utils.FileUtils import openResource  from gnue.common.utils.FileUtils import openResource, dyn_import
41  from gnue.common.datasources import GDataObjects, GConnections  from gnue.common.datasources import GDataObjects, GConnections
42  from gnue.common.apps.GClientApp import *  from gnue.common.apps.GClientApp import *
43  from gnue.navigator import VERSION  from gnue.navigator import VERSION
# Line 66  class GNClient(GClientApp): Line 66  class GNClient(GClientApp):
66    NAME = "GNUe Navigator"    NAME = "GNUe Navigator"
67    USAGE = "[options] file"    USAGE = "[options] file"
68    COMMAND_OPTIONS = [    COMMAND_OPTIONS = [
69        [ 'user_interface', 'u', 'user_interface', 1, 'gui', 'type',        [ 'user_interface', 'u', 'user_interface', 1, None, 'type',
70            'The currently supported values for <type> are ' \            'The currently supported values for <type> are ' \
71          + 'gui, web (a themable web-like interface), and text' ],          + 'wx, gtk2, win32, web (a themable web-like interface), and text' ],
72        [ 'splash_screen','s','no-splash', 0, None, None,        [ 'splash_screen','s','no-splash', 0, None, None,
73            'Disables the splash screen'],            'Disables the splash screen'],
74        [ 'gnome_menu',None,'install-gnome-menu', 0, None, None,        [ 'gnome_menu',None,'install-gnome-menu', 0, None, None,
# Line 96  class GNClient(GClientApp): Line 96  class GNClient(GClientApp):
96      self._formInstances = {}      self._formInstances = {}
97      self._lastSerialNumber = 0      self._lastSerialNumber = 0
98    
     self.ui_type = self.OPTIONS['user_interface']  
     if gConfigNav('disableSplash') == '1':  
       self.disableSplash = 1  
     else:  
       self.disableSplash = self.OPTIONS['splash_screen']  
99    
100    #    #
101    # Run the client application    # Run the client application
# Line 109  class GNClient(GClientApp): Line 104  class GNClient(GClientApp):
104    #    #
105    def run(self):    def run(self):
106    
107        #
108        # Initialize user interface
109        #
110        self.ui_type = self.OPTIONS['user_interface']
111        if self.ui_type:
112          SPECIFIC_UI = 1
113        else:
114          SPECIFIC_UI = 0
115          self.ui_type = gConfigForms('DefaultUI')
116    
117        while 1:
118          try:
119            self._ui = dyn_import("gnue.navigator.UI%s" % (self.ui_type))
120            break
121          except ImportError, err:
122            GDebug.printMesg(1,_("Unable to load UI driver")+" %s" % self.ui_type)
123            GDebug.printMesg(1,err)
124    
125            # If user specified a specific UI, don't cycle...
126            if SPECIFIC_UI:
127              raise  # TODO: TEMPORARY
128              self.handleStartupError(_("Unable to load any valid UI drivers.  Aborting.\n\nTraceback\n%s") % err)
129    
130            if self.ui_type != 'text':
131              self.ui_type = 'text'
132            else:
133              self.handleStartupError(_("Unable to load any valid UI drivers.  Aborting."))
134    
135    
136        #
137      # assign menu file from 1st free argument      # assign menu file from 1st free argument
138        #
139      try:      try:
140        processFile = self.ARGUMENTS[0]        processFile = self.ARGUMENTS[0]
141      except:      except:
# Line 127  class GNClient(GClientApp): Line 153  class GNClient(GClientApp):
153      fileHandle.close()      fileHandle.close()
154    
155    
   
156      # Handle any action commands      # Handle any action commands
157      if self.OPTIONS['kde_menu']:      if self.OPTIONS['kde_menu']:
158        from gnue.navigator.Actions import kde_menu        from gnue.navigator.Actions import kde_menu
# Line 140  class GNClient(GClientApp): Line 165  class GNClient(GClientApp):
165        sys.exit()        sys.exit()
166    
167    
168        if gConfigNav('disableSplash') == '1':
169      # Initialize user interface (defaults to gui)        self.disableSplash = 1
     #  If the DISPLAY var isn't set then switch to text  
     if self.ui_type == 'web':  
       if os.environ.has_key('DISPLAY') or os.name != 'posix':  
         import UIwxweb as interface  
       else:  
         self.ui_type='text'  
   
     elif self.ui_type == 'win32':  
       if os.environ.has_key('DISPLAY') or os.name != 'posix':  
         import UIwin32 as interface  
       else:  
         self.ui_type='text'  
   
     elif self.ui_type == 'gtk2':  
       if os.environ.has_key('DISPLAY') or os.name != 'posix':  
         import UIgtk2 as interface  
       else:  
         self.ui_type='text'  
   
     elif self.ui_type == 'gui':  
       if os.environ.has_key('DISPLAY') or os.name != 'posix':  
         import UIwxpython as interface  
       else:  
         self.ui_type='text'  
   
     elif self.ui_type == 'text' :  
       import UItext as interface  
   
170      else:      else:
171        print "Wrong UI Type"        self.disableSplash = self.OPTIONS['splash_screen']
172        sys.exit(1)  
173    
174      # add connections object to top object      # add connections object to top object
175      nav._connections=self.connections      nav._connections=self.connections
176            
177      interface.Instance(nav).run(self.connections)      self._ui.Instance(nav).run(self.connections)
178    
179  if __name__ == '__main__':  if __name__ == '__main__':
180    GNClient().run()    GNClient().run()

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26