[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue/navigator/src UIwxpython.py
From: |
Jason Cater |
Subject: |
gnue/navigator/src UIwxpython.py |
Date: |
Wed, 05 Jun 2002 20:35:48 -0400 |
CVSROOT: /home/cvs
Module name: gnue
Changes by: Jason Cater <address@hidden> 02/06/05 20:35:47
Modified files:
navigator/src : UIwxpython.py
Log message:
It's here! GNUe Navigator can launch multiple forms within its python
instance, requiring a single session login
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/navigator/src/UIwxpython.py.diff?cvsroot=OldCVS&tr1=1.9&tr2=1.10&r1=text&r2=text
Patches:
Index: gnue/navigator/src/UIwxpython.py
diff -c gnue/navigator/src/UIwxpython.py:1.9
gnue/navigator/src/UIwxpython.py:1.10
*** gnue/navigator/src/UIwxpython.py:1.9 Wed Jun 5 19:02:09 2002
--- gnue/navigator/src/UIwxpython.py Wed Jun 5 20:35:47 2002
***************
*** 35,52 ****
from gnue.common import GDataObjects, GConnections, dyn_import, openResource
from threading import Thread
! class Instance(wxApp):
def __init__(self, processes):
self.processes = processes
- wxApp.__init__(self)
self._formInstances = {}
self._lastSerialNumber = 0
def run(self, connections):
self.connections = connections
! self.MainLoop()
!
! def OnInit(self):
self.frame = wxFrame(NULL, -1, "GNUe Navigator", size=wxSize(500,250))
self.frame.SetSize(wxSize(300,400))
EVT_CLOSE(self.frame,self.OnClose)
--- 35,58 ----
from gnue.common import GDataObjects, GConnections, dyn_import, openResource
from threading import Thread
! try:
! from gnue.forms.GFInstance import GFInstance
! from gnue.forms import GFParser
! from gnue.forms.uidrivers import wx as ui
! except ImportError:
! raise 'GNUe Forms is not installed on your system'
!
!
! class Instance:
def __init__(self, processes):
self.processes = processes
self._formInstances = {}
self._lastSerialNumber = 0
def run(self, connections):
self.connections = connections
! app = ui.getWxApp()
! self._app = app
self.frame = wxFrame(NULL, -1, "GNUe Navigator", size=wxSize(500,250))
self.frame.SetSize(wxSize(300,400))
EVT_CLOSE(self.frame,self.OnClose)
***************
*** 56,63 ****
self.tree = wxTreeCtrl(self.frame,-1)
self.processes.setClientHandlers({'form':self.runForm})
! EVT_TREE_SEL_CHANGED(self, self.tree.GetId(), self.OnTreeItemSelected)
! EVT_TREE_ITEM_ACTIVATED(self, self.tree.GetId(), self.OnTreeItemActivated)
self._mapping = {}
self.processes.walk(self.__buildTreeControl)
--- 62,69 ----
self.tree = wxTreeCtrl(self.frame,-1)
self.processes.setClientHandlers({'form':self.runForm})
! EVT_TREE_SEL_CHANGED(app, self.tree.GetId(), self.OnTreeItemSelected)
! EVT_TREE_ITEM_ACTIVATED(app, self.tree.GetId(), self.OnTreeItemActivated)
self._mapping = {}
self.processes.walk(self.__buildTreeControl)
***************
*** 65,71 ****
self.tree.Expand(self.processes.__node)
self.frame.Show(true)
! return 1
def __buildTreeControl(self, object):
--- 71,78 ----
self.tree.Expand(self.processes.__node)
self.frame.Show(true)
! app.MainLoop()
!
def __buildTreeControl(self, object):
***************
*** 90,102 ****
def OnTreeItemSelected(self, event):
- print "I's ben selekt3d"
object = self.tree.GetPyData(event.GetItem())
def OnTreeItemActivated(self, event):
object = self.tree.GetPyData(event.GetItem())
- print object
if object._type != 'GNStep':
self.buildMenu(object)
--- 97,107 ----
***************
*** 124,133 ****
wxEndBusyCursor()
- def runForm(self, step):
- FormsThread(self, step)
-
-
def getNextSerialNumber (self):
self._lastSerialNumber = self._lastSerialNumber + 1
return self._lastSerialNumber
--- 129,134 ----
***************
*** 137,159 ****
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')
--- 138,148 ----
print mesg
! def runForm(self, step):
# 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
if os.path.basename(step.location) == step.location:
try:
formdir = gConfigNav('FormDir')
***************
*** 163,190 ****
else:
formfile = step.location
- try:
- from gnue.forms.GFInstance import GFInstance
- from gnue.forms import GFParser
- except ImportError:
- self.handleError('GNUe Forms is not installed on your system')
return
try:
#
# Create the instance
#
- 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
--- 152,171 ----
else:
formfile = step.location
return
try:
#
# Create the instance
#
instance = GFInstance(self, id(self),
! 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
***************
*** 216,223 ****
except GDataObjects.Error, mesg:
self.handleError(mesg)
def handleError(self, mesg):
! self.controller.handleError(mesg)
--- 197,205 ----
except GDataObjects.Error, mesg:
self.handleError(mesg)
+
def handleError(self, mesg):
! self.handleError(mesg)