commit-gnue
[Top][All Lists]
Advanced

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

gnue/navigator src/GNClient.py src/GNConfig.py ...


From: Jan Ischebeck
Subject: gnue/navigator src/GNClient.py src/GNConfig.py ...
Date: Mon, 10 Jun 2002 19:42:38 -0400

CVSROOT:        /cvsroot/gnue
Module name:    gnue
Changes by:     Jan Ischebeck <address@hidden>  02/06/10 19:42:38

Modified files:
        navigator/src  : GNClient.py GNConfig.py GNObjects.py UItext.py 
                         UIwxpython.py UIwxweb.py 
Added files:
        navigator/samples: foobulations.gpd 

Log message:
        add foobulations navigator test
        changes to let navigator start reports with single logon

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/navigator/samples/foobulations.gpd?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/navigator/src/GNClient.py.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/navigator/src/GNConfig.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/navigator/src/GNObjects.py.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/navigator/src/UItext.py.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/navigator/src/UIwxpython.py.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/navigator/src/UIwxweb.py.diff?tr1=1.7&tr2=1.8&r1=text&r2=text

Patches:
Index: gnue/navigator/src/GNClient.py
diff -c gnue/navigator/src/GNClient.py:1.12 gnue/navigator/src/GNClient.py:1.13
*** gnue/navigator/src/GNClient.py:1.12 Fri Jun  7 06:11:09 2002
--- gnue/navigator/src/GNClient.py      Mon Jun 10 19:42:38 2002
***************
*** 45,50 ****
--- 45,51 ----
  
  # TODO: Please go away!!!!!
  from gnue.forms.GFConfig import ConfigOptions
+ from gnue.reports.GRConfig import ConfigOptions as ReportsConfigOptions
  
  class GNClient(GClientApp):
    #
***************
*** 74,79 ****
--- 75,81 ----
    def __init__(self, connections=None):
      GClientApp.__init__(self, connections,'forms', ConfigOptions)
      
self.configurationManager.loadApplicationConfig(section="navigator",defaults=NavigatorConfigOptions)
+     
self.configurationManager.loadApplicationConfig(section="forms",defaults=ReportsConfigOptions)
      self.configurationManager.registerAlias('gConfigNav', 'navigator')
  
      self._formInstances = {}
***************
*** 141,146 ****
--- 143,151 ----
      if self.ui_type == 'text' :
        import UItext as interface
  
+     # add connections object to top object
+     nav._connections=self.connections
+     
      interface.Instance(nav).run(self.connections)
  
  if __name__ == '__main__':
Index: gnue/navigator/src/GNConfig.py
diff -c gnue/navigator/src/GNConfig.py:1.2 gnue/navigator/src/GNConfig.py:1.3
*** gnue/navigator/src/GNConfig.py:1.2  Tue Jun  4 19:20:47 2002
--- gnue/navigator/src/GNConfig.py      Mon Jun 10 19:42:38 2002
***************
*** 19,25 ****
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
  # FILE:
! # GFConfig.py
  #
  # DESCRIPTION:
  #
--- 19,25 ----
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
  # FILE:
! # GNConfig.py
  #
  # DESCRIPTION:
  #
***************
*** 48,53 ****
--- 48,60 ----
      'Description': 'Directory to search for .gfd files.',
      'Typecast'   : GTypecast.text,
      'Default'    : 'forms' },
+ 
+   { 'Name'       : 'ReportDir',
+     'Type'       : 'Setting',
+     'Comment'    : 'Directory to search for .grd files.',
+     'Description': 'Directory to search for .grd files.',
+     'Typecast'   : GTypecast.text,
+     'Default'    : 'reports' },
  
    { 'Name'       : 'ProcessDir',
      'Type'       : 'Setting',
Index: gnue/navigator/src/GNObjects.py
diff -c gnue/navigator/src/GNObjects.py:1.11 
gnue/navigator/src/GNObjects.py:1.12
*** gnue/navigator/src/GNObjects.py:1.11        Thu Jun  6 18:07:59 2002
--- gnue/navigator/src/GNObjects.py     Mon Jun 10 19:42:38 2002
***************
*** 28,36 ****
  #
  
  import sys, string, os, os.path
! from gnue.common import GObjects, GDebug
  import GNParser
! 
  
  # Base class for all Navigator objects
  class GNObject(GObjects.GObj):
--- 28,36 ----
  #
  
  import sys, string, os, os.path
! from gnue.common import GObjects, GDebug, GConfig
  import GNParser
! from gnue.reports import GREngine,GRExceptions
  
  # Base class for all Navigator objects
  class GNObject(GObjects.GObj):
***************
*** 55,61 ****
  
  
    def _runForm(self, step):
!     formCommand = gConfigNav('runFormCommand')
  
      if os.path.basename(step.location) == step.location:
        try:
--- 55,61 ----
  
  
    def _runForm(self, step):
!     formCommand = gConfigNav('RunFormCommand')
  
      if os.path.basename(step.location) == step.location:
        try:
***************
*** 89,97 ****
        os.spawnve(os.P_NOWAIT,command[0],command,os.environ)
  
    def _runReport(self, step):
!     GDebug.printMesg(1,'Reports Spawning Not Yet Implemented.')
!     pass
  
  
  
  class GNProcess(GNObject):
--- 89,144 ----
        os.spawnve(os.P_NOWAIT,command[0],command,os.environ)
  
    def _runReport(self, step):
!     reportCommand = gConfigNav('RunReportCommand')
  
+     # get the name of the report
+     if os.path.basename(step.location) == step.location:
+       try:
+         reportdir = gConfigNav('ReportDir')
+       except KeyError:
+         reportdir = ""
+       reportfile = os.environ['INSTALL_PREFIX']+'/'+reportdir+"/"+ \
+                    step.location
+     else:
+       reportfile = step.location
+       
+     # default parameter should be loaded from GREngine itself
+     params ={
+       'destination_type':'file',
+       'destination':'-',
+       'destination_options':'',
+       'filter':'raw',
+       'list_filters':0,
+       'filter_options': '',
+       'sortoption':'',
+       'comment':None,
+       'exclude_xml':None }
+     
+     # get parameters
+     for child in step._children:
+       if child._type=="GNParameter":
+         params[child.name]=child.value
+ 
+     i = self
+     while i._parent!=None:
+       i=i._parent
+ 
+     try:
+       engine=GREngine.GREngine(i._connections)
+       engine.processReport(reportfile,
+                            destination = params["destination"],
+                            destinationType = params["destination_type"],
+                            destinationOptions = params["destination_options"],
+                            filter = params['filter'],
+                            filterOptions = params['filter_options'],
+                   #         parameters=userParameters,
+                            sortoption=params["sortoption"],
+                            includeStructuralComments=params["comment"],
+                            omitGNUeXML=params["exclude_xml"])
+     except GRExceptions.ReportMarkupException, msg:
+       self.handleStartupError (msg)
+     except GRExceptions.ReportUnreadable, msg:
+       self.handleStartupError (msg)
  
  
  class GNProcess(GNObject):
Index: gnue/navigator/src/UItext.py
diff -c gnue/navigator/src/UItext.py:1.4 gnue/navigator/src/UItext.py:1.5
*** gnue/navigator/src/UItext.py:1.4    Fri Jun  7 06:11:09 2002
--- gnue/navigator/src/UItext.py        Mon Jun 10 19:42:38 2002
***************
*** 36,44 ****
      self.processes = processes
  
    def run(self, connections):
! 
      self.buildMenu(self.processes)
! 
  
    def buildMenu(self, process):
  
--- 36,51 ----
      self.processes = processes
  
    def run(self, connections):
!     print "Login Handler set"
!     
!     connections.setLoginHandler(LoginHandler())
      self.buildMenu(self.processes)
!     
!     self.connections = connections
!     #
!     # Assign the proper login handler based upon the user interface choice
!     #
!     self.connections.setLoginHandler(ui.UILoginHandler())
  
    def buildMenu(self, process):
  
***************
*** 134,137 ****
--- 141,181 ----
        return val
  
  
+ from gnue.common import GLoginHandler
+ import getpass
+ class LoginHandler(GLoginHandler.LoginHandler):
+ 
+   defaults = {'_username': None, '_password': None}
+ 
+   def getLogin(self, loginData, error):
+     try:
+       print ( "*"*60 )
+       if len(loginData[1]):
+         print ( 'Attempting to log into "%s" (%s):' % (loginData[1], 
loginData[0]) )
+       else:
+         print ( 'Attempting to log into %s:' % (loginData[0]) )
+       print ("")
+       val = {}
+       for prompt in loginData[2]:
+          if self.defaults.has_key(prompt[0])  and self.defaults[prompt[0]]:
+            print_nl ( "  %s: " % prompt[1] )
+            if prompt[2]:
+              print ( "***" )
+            else:
+              print ( self.defaults[prompt[0]] )
+            val[prompt[0]] = self.defaults[prompt[0]]
+          else:
+            if prompt[2]:
+              val[prompt[0]] = getpass.getpass("  %s: " % prompt[1])
+            else:
+              val[prompt[0]] = raw_input("  %s: " % prompt[1])
+       print ("")
+       print ("*"*60)
+       return val
+     except KeyboardInterrupt:
+       raise GLoginHandler.UserCanceledLogin
+ 
+ 
+   def destroyLoginDialog(self):
+     pass
  
Index: gnue/navigator/src/UIwxpython.py
diff -c gnue/navigator/src/UIwxpython.py:1.17 
gnue/navigator/src/UIwxpython.py:1.18
*** gnue/navigator/src/UIwxpython.py:1.17       Fri Jun  7 06:11:09 2002
--- gnue/navigator/src/UIwxpython.py    Mon Jun 10 19:42:38 2002
***************
*** 65,71 ****
--- 65,76 ----
      """ % (images_dir+"/ship2.png")
  
    def run(self, connections):
+     #
+     # Assign the proper login handler based upon the user interface choice
+     #
      self.connections = connections
+     self.connections.setLoginHandler(ui.UILoginHandler())
+ 
      app = ui.getWxApp()
      self._app = app
      self.frame = wxFrame(NULL, -1, "GNUe Navigator", size=wxSize(600,400))
***************
*** 234,243 ****
            connections=self.connections,
            ui=ui, disableSplash=1)
        self._formInstances[id(self)] = instance
-       #
-       # Assign the proper login handler based upon the user interface choice
-       #
-       self.connections.setLoginHandler(ui.UILoginHandler())
  
        #
        # Build the form tree
--- 239,244 ----
Index: gnue/navigator/src/UIwxweb.py
diff -c gnue/navigator/src/UIwxweb.py:1.7 gnue/navigator/src/UIwxweb.py:1.8
*** gnue/navigator/src/UIwxweb.py:1.7   Fri Jun  7 06:11:09 2002
--- gnue/navigator/src/UIwxweb.py       Mon Jun 10 19:42:38 2002
***************
*** 31,43 ****
  
  from wxPython.wx import *
  from wxPython.html import *
! 
  class Instance(wxApp):
    def __init__(self, processes):
      self.processes = processes
      wxApp.__init__(self)
  
    def run(self, connections):
      self.MainLoop()
  
    def OnInit(self):
--- 31,50 ----
  
  from wxPython.wx import *
  from wxPython.html import *
! from gnue.forms.uidrivers import wx as ui
!  
  class Instance(wxApp):
    def __init__(self, processes):
      self.processes = processes
      wxApp.__init__(self)
  
    def run(self, connections):
+     self.connections = connections
+     #
+     # Assign the proper login handler based upon the user interface choice
+     #
+     self.connections.setLoginHandler(ui.UILoginHandler())
+ 
      self.MainLoop()
  
    def OnInit(self):



reply via email to

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