[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue common/src/GConfig.py navigator/src/GNClie...
From: |
Jason Cater |
Subject: |
gnue common/src/GConfig.py navigator/src/GNClie... |
Date: |
Wed, 05 Jun 2002 19:02:10 -0400 |
CVSROOT: /cvsroot/gnue
Module name: gnue
Changes by: Jason Cater <address@hidden> 02/06/05 19:02:09
Modified files:
common/src : GConfig.py
navigator/src : GNClient.py GNObjects.py UIwxpython.py
Log message:
more work on threading support in Navigator
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GConfig.py.diff?tr1=1.24&tr2=1.25&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/navigator/src/GNClient.py.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/navigator/src/GNObjects.py.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/navigator/src/UIwxpython.py.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
Patches:
Index: gnue/common/src/GConfig.py
diff -c gnue/common/src/GConfig.py:1.24 gnue/common/src/GConfig.py:1.25
*** gnue/common/src/GConfig.py:1.24 Sat Jun 1 15:35:52 2002
--- gnue/common/src/GConfig.py Wed Jun 5 19:02:09 2002
***************
*** 52,58 ****
import __builtin__
__builtin__.__dict__['gConfig'] = self.gConfig
__builtin__.__dict__['gConfigDict'] = self.gConfigDict
!
def loadApplicationConfig(self, configFilename="gnue.conf",
homeConfigDir=".gnue", section="DEFAULT", defaults = None):
GDebug.printMesg(1,'Reading configuration info from %s section %s'
%(configFilename,section))
--- 52,65 ----
import __builtin__
__builtin__.__dict__['gConfig'] = self.gConfig
__builtin__.__dict__['gConfigDict'] = self.gConfigDict
!
!
! def registerAlias(self, name, section):
! alias = GConfigAlias(self.gConfig, section)
! import __builtin__
! __builtin__.__dict__[name] = alias.gConfig
!
!
def loadApplicationConfig(self, configFilename="gnue.conf",
homeConfigDir=".gnue", section="DEFAULT", defaults = None):
GDebug.printMesg(1,'Reading configuration info from %s section %s'
%(configFilename,section))
***************
*** 94,100 ****
# system fixed config file
if etc_base:
fileLocations.append(os.path.join(etc_base,configFilename+'.fixed'))
!
try:
parser.read(fileLocations)
except DuplicateSectionError:
--- 101,107 ----
# system fixed config file
if etc_base:
fileLocations.append(os.path.join(etc_base,configFilename+'.fixed'))
!
try:
parser.read(fileLocations)
except DuplicateSectionError:
***************
*** 122,128 ****
options = {}
for option in self._loadedConfigs[configFilename].options(section):
options[option] =
self._loadedConfigs[configFilename].get(section,string.lower(option))
!
return options
def _buildDefaults(self, defaultDefinitions):
--- 129,135 ----
options = {}
for option in self._loadedConfigs[configFilename].options(section):
options[option] =
self._loadedConfigs[configFilename].get(section,string.lower(option))
!
return options
def _buildDefaults(self, defaultDefinitions):
***************
*** 131,136 ****
--- 138,155 ----
for definition in defaultDefinitions:
defaults[string.lower(definition['Name'])]=string.lower(str(definition['Default']))
return defaults
+
+
+ class GConfigAlias:
+ def __init__(self, gconfig, name):
+ self._gConfig = gconfig
+ self._section = name
+
+ def gConfig(self, varName, configFilename=None, section=None):
+ if not section:
+ section = self._section
+ return self._gConfig(varName, configFilename=configFilename, section =
section)
+
def getInstalledBase(*parameters):
for param in parameters:
Index: gnue/navigator/src/GNClient.py
diff -c gnue/navigator/src/GNClient.py:1.9 gnue/navigator/src/GNClient.py:1.10
*** gnue/navigator/src/GNClient.py:1.9 Tue Jun 4 23:54:27 2002
--- gnue/navigator/src/GNClient.py Wed Jun 5 19:02:09 2002
***************
*** 41,47 ****
from gnue.common.GClientApp import *
from gnue.navigator import VERSION
! from GNConfig import ConfigOptions as NavigationConfigOptions
# TODO: Please go away!!!!!
from gnue.forms.GFConfig import ConfigOptions
--- 41,47 ----
from gnue.common.GClientApp import *
from gnue.navigator import VERSION
! from GNConfig import ConfigOptions as NavigatorConfigOptions
# TODO: Please go away!!!!!
from gnue.forms.GFConfig import ConfigOptions
***************
*** 73,85 ****
#
def __init__(self, connections=None):
GClientApp.__init__(self, connections,'forms', ConfigOptions)
!
self.configurationManager.loadApplicationConfig(section="navigator",defaults=NavigationConfigOptions)
self._formInstances = {}
self._lastSerialNumber = 0
self.ui_type = self.OPTIONS['user_interface']
! if gConfig('disableSplash') == '1':
self.disableSplash = 1
else:
self.disableSplash = self.OPTIONS['splash_screen']
--- 73,86 ----
#
def __init__(self, connections=None):
GClientApp.__init__(self, connections,'forms', ConfigOptions)
!
self.configurationManager.loadApplicationConfig(section="navigator",defaults=NavigatorConfigOptions)
! self.configurationManager.registerAlias('gConfigNav', 'navigator')
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']
***************
*** 97,103 ****
except:
try:
if string.split(string.lower(os.path.basename(sys.argv[0])),'.')[0]
not in ('gnue-navigator','gncvs'):
! processFile =
os.environ['INSTALL_PREFIX']+'/'+gConfig('ProcessDir')+"/"+os.path.basename(sys.argv[0])+".gpd"
else:
raise IndexError
except IndexError:
--- 98,104 ----
except:
try:
if string.split(string.lower(os.path.basename(sys.argv[0])),'.')[0]
not in ('gnue-navigator','gncvs'):
! processFile =
os.environ['INSTALL_PREFIX']+'/'+gConfigNav('ProcessDir')+"/"+os.path.basename(sys.argv[0])+".gpd"
else:
raise IndexError
except IndexError:
Index: gnue/navigator/src/GNObjects.py
diff -c gnue/navigator/src/GNObjects.py:1.9 gnue/navigator/src/GNObjects.py:1.10
*** gnue/navigator/src/GNObjects.py:1.9 Tue Jun 4 19:20:47 2002
--- gnue/navigator/src/GNObjects.py Wed Jun 5 19:02:09 2002
***************
*** 55,65 ****
def _runForm(self, step):
! formCommand = gConfig('runFormCommand')
if os.path.basename(step.location) == step.location:
try:
! formdir = gConfig('FormDir')
except KeyError:
formdir = ""
formfile = os.environ['INSTALL_PREFIX']+'/'+formdir+"/"+step.location
--- 55,65 ----
def _runForm(self, step):
! formCommand = gConfigNav('runFormCommand')
if os.path.basename(step.location) == step.location:
try:
! formdir = gConfigNav('FormDir')
except KeyError:
formdir = ""
formfile = os.environ['INSTALL_PREFIX']+'/'+formdir+"/"+step.location
Index: gnue/navigator/src/UIwxpython.py
diff -c gnue/navigator/src/UIwxpython.py:1.8
gnue/navigator/src/UIwxpython.py:1.9
*** gnue/navigator/src/UIwxpython.py:1.8 Tue Jun 4 19:20:47 2002
--- gnue/navigator/src/UIwxpython.py Wed Jun 5 19:02:09 2002
***************
*** 33,39 ****
from time import sleep
import os, sys, string
from gnue.common import GDataObjects, GConnections, dyn_import, openResource
!
class Instance(wxApp):
def __init__(self, processes):
--- 33,39 ----
from time import sleep
import os, sys, string
from gnue.common import GDataObjects, GConnections, dyn_import, openResource
! from threading import Thread
class Instance(wxApp):
def __init__(self, processes):
***************
*** 90,95 ****
--- 90,96 ----
def OnTreeItemSelected(self, event):
+ print "I's ben selekt3d"
object = self.tree.GetPyData(event.GetItem())
***************
*** 100,115 ****
if object._type != 'GNStep':
self.buildMenu(object)
else:
! delay = gConfig('hourglassDelay','')
! if not delay:
! delay = 2
! else:
! delay = int(delay)
- self.beginWait()
object.run()
! sleep(delay)
! self.endWait()
# Called whenever forms goes into a "wait" state in which user cannot
--- 101,117 ----
if object._type != 'GNStep':
self.buildMenu(object)
else:
! ## delay = gConfigNav('hourglassDelay','')
! ## if not delay:
! ## delay = 2
! ## else:
! ## delay = int(delay)
! ## self.beginWait()
object.run()
!
! ## sleep(delay)
! ## self.endWait()
# Called whenever forms goes into a "wait" state in which user cannot
***************
*** 123,131 ****
def runForm(self, step):
if os.path.basename(step.location) == step.location:
try:
! formdir = gConfig('FormDir')
except KeyError:
formdir = ""
formfile = os.environ['INSTALL_PREFIX']+'/'+formdir+"/"+step.location
--- 125,162 ----
def runForm(self, step):
+ FormsThread(self, step)
+
+
+ def getNextSerialNumber (self):
+ self._lastSerialNumber = self._lastSerialNumber + 1
+ return self._lastSerialNumber
+
+
+ def handleError(self, mesg):
+ print mesg
+
+
+ # Thread class that executes processing
+ class FormsThread(Thread):
+ def __init__(self, controller, step):
+ Thread.__init__(self)
+ self.step = step
+ self.controller = controller
+
+ # This starts the thread running on creation, but you could
+ # also make the GUI thread responsible for calling this
+ self.start()
+
+ def run(self):
+ # This is the code executing in the new thread. Simulation of
+ # a long process (well, 10s here) as a simple loop - you will
+ # need to structure your processing so that you periodically
+ # peek at the abort variable
+ step = self.step
if os.path.basename(step.location) == step.location:
try:
! formdir = gConfigNav('FormDir')
except KeyError:
formdir = ""
formfile = os.environ['INSTALL_PREFIX']+'/'+formdir+"/"+step.location
***************
*** 146,158 ****
self._ui = dyn_import("gnue.forms.uidrivers.wx")
self._ui.__dict__['__wxApp'] = self
! instance = GFInstance(self, self.getNextSerialNumber(),
! connections=self.connections, ui=self._ui, disableSplash=1)
! self._formInstances[instance.getSerialNumber()] = instance
#
# Assign the proper login handler based upon the user interface choice
#
! self.connections.setLoginHandler(self._ui.UILoginHandler())
#
# Build the form tree
--- 177,190 ----
self._ui = dyn_import("gnue.forms.uidrivers.wx")
self._ui.__dict__['__wxApp'] = self
! instance = GFInstance(self, id(self),
! connections=self.controller.connections,
! ui=self._ui, disableSplash=1)
! self.controller._formInstances[id(self)] = instance
#
# Assign the proper login handler based upon the user interface choice
#
! self.controller.connections.setLoginHandler(self._ui.UILoginHandler())
#
# Build the form tree
***************
*** 184,197 ****
except GDataObjects.Error, mesg:
self.handleError(mesg)
!
! def getNextSerialNumber (self):
! self._lastSerialNumber = self._lastSerialNumber + 1
! return self._lastSerialNumber
- def handleError(self, mesg):
- print mesg
ID_EXIT = wxNewId()
ID_FAV_ORG = wxNewId()
--- 216,225 ----
except GDataObjects.Error, mesg:
self.handleError(mesg)
! def handleError(self, mesg):
! self.controller.handleError(mesg)
ID_EXIT = wxNewId()
ID_FAV_ORG = wxNewId()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue common/src/GConfig.py navigator/src/GNClie...,
Jason Cater <=