commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnue-navigator/src GNClient.py UIweb.py UIwx.py


From: Bajusz Tamás
Subject: gnue-navigator/src GNClient.py UIweb.py UIwx.py
Date: Sun, 10 Aug 2003 19:28:29 -0400

CVSROOT:        /cvsroot/gnue
Module name:    gnue-navigator
Branch:         
Changes by:     Bajusz Tamás <address@hidden>   03/08/10 19:28:29

Modified files:
        src            : GNClient.py 
Added files:
        src            : UIweb.py UIwx.py 

Log message:
        changing to dyn_import

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-navigator/src/UIweb.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-navigator/src/UIwx.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-navigator/src/GNClient.py.diff?tr1=1.21&tr2=1.22&r1=text&r2=text

Patches:
Index: gnue-navigator/src/GNClient.py
diff -c gnue-navigator/src/GNClient.py:1.21 gnue-navigator/src/GNClient.py:1.22
*** gnue-navigator/src/GNClient.py:1.21 Mon Aug  4 11:41:37 2003
--- gnue-navigator/src/GNClient.py      Sun Aug 10 19:28:29 2003
***************
*** 37,43 ****
  from gnue.navigator.GNParser import loadProcesses
  from gnue.navigator import Actions
  from gnue.common.apps import GDebug
! from gnue.common.utils.FileUtils import openResource
  from gnue.common.datasources import GDataObjects, GConnections
  from gnue.common.apps.GClientApp import *
  from gnue.navigator import VERSION
--- 37,43 ----
  from gnue.navigator.GNParser import loadProcesses
  from gnue.navigator import Actions
  from gnue.common.apps import GDebug
! from gnue.common.utils.FileUtils import openResource, dyn_import
  from gnue.common.datasources import GDataObjects, GConnections
  from gnue.common.apps.GClientApp import *
  from gnue.navigator import VERSION
***************
*** 66,74 ****
    NAME = "GNUe Navigator"
    USAGE = "[options] file"
    COMMAND_OPTIONS = [
!       [ 'user_interface', 'u', 'user_interface', 1, 'gui', 'type',
            'The currently supported values for <type> are ' \
!         + 'gui, web (a themable web-like interface), and text' ],
        [ 'splash_screen','s','no-splash', 0, None, None,
            'Disables the splash screen'],
        [ 'gnome_menu',None,'install-gnome-menu', 0, None, None,
--- 66,74 ----
    NAME = "GNUe Navigator"
    USAGE = "[options] file"
    COMMAND_OPTIONS = [
!       [ 'user_interface', 'u', 'user_interface', 1, None, 'type',
            'The currently supported values for <type> are ' \
!         + 'wx, gtk2, win32, web (a themable web-like interface), and text' ],
        [ 'splash_screen','s','no-splash', 0, None, None,
            'Disables the splash screen'],
        [ 'gnome_menu',None,'install-gnome-menu', 0, None, None,
***************
*** 96,106 ****
      self._formInstances = {}
      self._lastSerialNumber = 0
  
-     self.ui_type = self.OPTIONS['user_interface']
-     if gConfigNav('disableSplash') == '1':
-       self.disableSplash = 1
-     else:
-       self.disableSplash = self.OPTIONS['splash_screen']
  
    #
    # Run the client application
--- 96,101 ----
***************
*** 109,115 ****
--- 104,141 ----
    #
    def run(self):
  
+     #
+     # Initialize user interface
+     #
+     self.ui_type = self.OPTIONS['user_interface']
+     if self.ui_type:
+       SPECIFIC_UI = 1
+     else:
+       SPECIFIC_UI = 0
+       self.ui_type = gConfigForms('DefaultUI')
+ 
+     while 1:
+       try:
+         self._ui = dyn_import("gnue.navigator.UI%s" % (self.ui_type))
+         break
+       except ImportError, err:
+         GDebug.printMesg(1,_("Unable to load UI driver")+" %s" % self.ui_type)
+         GDebug.printMesg(1,err)
+ 
+         # If user specified a specific UI, don't cycle...
+         if SPECIFIC_UI:
+           raise  # TODO: TEMPORARY
+           self.handleStartupError(_("Unable to load any valid UI drivers.  
Aborting.\n\nTraceback\n%s") % err)
+ 
+         if self.ui_type != 'text':
+           self.ui_type = 'text'
+         else:
+           self.handleStartupError(_("Unable to load any valid UI drivers.  
Aborting."))
+ 
+ 
+     #
      # assign menu file from 1st free argument
+     #
      try:
        processFile = self.ARGUMENTS[0]
      except:
***************
*** 127,133 ****
      fileHandle.close()
  
  
- 
      # Handle any action commands
      if self.OPTIONS['kde_menu']:
        from gnue.navigator.Actions import kde_menu
--- 153,158 ----
***************
*** 140,183 ****
        sys.exit()
  
  
! 
!     # Initialize user interface (defaults to gui)
!     #  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
! 
      else:
!       print "Wrong UI Type"
!       sys.exit(1)
  
      # add connections object to top object
      nav._connections=self.connections
      
!     interface.Instance(nav).run(self.connections)
  
  if __name__ == '__main__':
    GNClient().run()
--- 165,180 ----
        sys.exit()
  
  
!     if gConfigNav('disableSplash') == '1':
!       self.disableSplash = 1
      else:
!       self.disableSplash = self.OPTIONS['splash_screen']
! 
  
      # add connections object to top object
      nav._connections=self.connections
      
!     self._ui.Instance(nav).run(self.connections)
  
  if __name__ == '__main__':
    GNClient().run()




reply via email to

[Prev in Thread] Current Thread [Next in Thread]