[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue/forms samples/dialog/dialog.gfd src/GFClie...
From: |
James Thompson |
Subject: |
gnue/forms samples/dialog/dialog.gfd src/GFClie... |
Date: |
Wed, 27 Nov 2002 22:35:53 -0500 |
CVSROOT: /cvsroot/gnue
Module name: gnue
Changes by: James Thompson <address@hidden> 02/11/27 22:35:53
Modified files:
forms/samples/dialog: dialog.gfd
forms/src : GFClient.py GFForm.py GFInstance.py
Log message:
Moved final things out of gfclient that belong in gfinstance
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/samples/dialog/dialog.gfd.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFClient.py.diff?tr1=1.58&tr2=1.59&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFForm.py.diff?tr1=1.211&tr2=1.212&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFInstance.py.diff?tr1=1.69&tr2=1.70&r1=text&r2=text
Patches:
Index: gnue/forms/samples/dialog/dialog.gfd
diff -c gnue/forms/samples/dialog/dialog.gfd:1.2
gnue/forms/samples/dialog/dialog.gfd:1.3
*** gnue/forms/samples/dialog/dialog.gfd:1.2 Wed Nov 27 16:29:16 2002
--- gnue/forms/samples/dialog/dialog.gfd Wed Nov 27 22:35:53 2002
***************
*** 6,12 ****
<form xmlns:c="GNUe:Layout:Char">
<options/>
<trigger name="button1_Trigger" type="NAMED"><![CDATA[##
! runDialog("selector")
print "dialog(selector,modal=1) comming soon"
]]></trigger>
<logic>
--- 6,12 ----
<form xmlns:c="GNUe:Layout:Char">
<options/>
<trigger name="button1_Trigger" type="NAMED"><![CDATA[##
! runForm("pop.gfd")
print "dialog(selector,modal=1) comming soon"
]]></trigger>
<logic>
Index: gnue/forms/src/GFClient.py
diff -c gnue/forms/src/GFClient.py:1.58 gnue/forms/src/GFClient.py:1.59
*** gnue/forms/src/GFClient.py:1.58 Wed Nov 27 21:24:39 2002
--- gnue/forms/src/GFClient.py Wed Nov 27 22:35:53 2002
***************
*** 22,46 ****
# GFClient.py
#
# DESCRIPTION:
! # Client startup file that parses args, builds form from file
! # and passes control to a UI.
#
# NOTES:
! # Once all the events are moved back in here
! # debug
! # make the next/prec methods more generic in the GFForm
! # change self._form in here to a list
! import os
! import sys
from gnue.common.GClientApp import *
- from gnue.forms.GFInstance import *
- from gnue.forms.GFParser import loadFile
from gnue.common import GDebug
from gnue.common import GConfig, GDataObjects, GConnections
from gnue.common.FileUtils import dyn_import
from gnue.forms import VERSION
from gnue.forms.GFConfig import ConfigOptions
class GFClient(GClientApp):
--- 22,43 ----
# GFClient.py
#
# DESCRIPTION:
! # Command line client startup file that parses args,
! # imports the required UI, configures the controling
! # GFInstance and passes control to it.
#
# NOTES:
! #
! import os, sys
from gnue.common.GClientApp import *
from gnue.common import GDebug
from gnue.common import GConfig, GDataObjects, GConnections
from gnue.common.FileUtils import dyn_import
+
from gnue.forms import VERSION
+ from gnue.forms.GFInstance import *
from gnue.forms.GFConfig import ConfigOptions
class GFClient(GClientApp):
***************
*** 63,92 ****
def __init__(self, connections=None):
GClientApp.__init__(self, connections,'forms',ConfigOptions)
-
self.configurationManager.registerAlias('gConfigForms', 'forms')
- self.ui_type = self.OPTIONS['user_interface']
- if not self.ui_type:
- self.ui_type = gConfigForms('DefaultUI')
-
- if gConfig('disableSplash') == '1':
- self.disableSplash = 1
- else:
- self.disableSplash = self.OPTIONS['splash_screen']
-
- #
- # Will move to GFInstance
- #
- self._formInstances = {}
- self._lastSerialNumber = 0
-
-
#
# Run the client application
#
- # GClientApp().run() override
- #
def run(self):
#
# assign form file from 1st free argument
--- 60,70 ----
***************
*** 126,131 ****
--- 104,113 ----
#
# Initialize user interface
#
+ self.ui_type = self.OPTIONS['user_interface']
+ if not self.ui_type:
+ self.ui_type = gConfigForms('DefaultUI')
+
while 1:
try:
self._ui = dyn_import("gnue.forms.uidrivers.%s" % (self.ui_type))
***************
*** 139,144 ****
--- 121,131 ----
self.handleStartupError(_("Unable to load any valid UI drivers.
Aborting."))
sys.exit()
+ if gConfig('disableSplash') == '1':
+ self.disableSplash = 1
+ else:
+ self.disableSplash = self.OPTIONS['splash_screen']
+
#
# Assign the proper login handler based upon the user interface choice
#
***************
*** 147,246 ****
#
# Create the Instance that will control the loaded form(s)
#
!
! #
! # Add the form to the instance
! #
!
! #
! # activate the instance
! #
! self.runForm(formfile, self.disableSplash, parameters=userParameters)
!
! def runFormFromTrigger(self, formFile, parameters={}):
! self.runForm(formFile, disableSplash=1, parameters=parameters)
!
!
! def runForm(self, formFile, disableSplash=0, parameters={}):
! try:
! #
! # Create the instance
! #
! instance = GFInstance(self, self.getNextSerialNumber(),
! connections=self.connections, ui=self._ui,
disableSplash=disableSplash,
! parameters=parameters)
! self._formInstances[instance.getSerialNumber()] = instance
!
! #
! # Tell the instance to load the requested form
! #
! instance.addFormFromFile(formFile)
!
! #
! # Hand control over to the instance
! #
! instance.activate()
!
! except GConnections.Error, mesg:
! self.handleStartupError(mesg)
!
! except IOError, mesg:
! self.handleStartupError(_("Unable to open file\n\n %s")%mesg)
!
! except GDataObjects.ConnectError, mesg:
! self.handleStartupError(\
! _("Unable to login to datasource.\n\n %s") %mesg)
!
! except GDataObjects.ConnectionError, mesg:
! self.handleStartupError(\
! _("Error while communicating with datasource.\n\n %s") %mesg)
!
! except GDataObjects.Error, mesg:
! self.handleStartupError(mesg)
!
! #
! # runDialog goes into instance
! #
!
! def runDialog(self, formName, disableSplash=0, parameters={}):
! try:
! #
! # Create the instance
! #
! instance = GFInstance(self, self.getNextSerialNumber(),
! connections=self.connections, ui=self._ui,
disableSplash=disableSplash,
! parameters=parameters)
! self._formInstances[instance.getSerialNumber()] = instance
!
! #
! # Assign the proper login handler based upon the user interface choice
! #
! self.getConnectionManager().setLoginHandler(self._ui.UILoginHandler())
!
! self._formInstances[1]._form._dialogDictionary[formName].showTree()
!
! except GConnections.Error, mesg:
! self.handleStartupError(mesg)
!
! except IOError, mesg:
! self.handleStartupError(_("Unable to open file\n\n %s")%mesg)
!
! except GDataObjects.ConnectError, mesg:
! self.handleStartupError(\
! _("Unable to login to datasource.\n\n %s") %mesg)
!
! except GDataObjects.ConnectionError, mesg:
! self.handleStartupError(\
! _("Error while communicating with datasource.\n\n %s") %mesg)
!
! except GDataObjects.Error, mesg:
! self.handleStartupError(mesg)
!
!
! def getNextSerialNumber (self):
! self._lastSerialNumber = self._lastSerialNumber + 1
! return self._lastSerialNumber
if __name__ == '__main__':
GFClient().run()
--- 134,147 ----
#
# Create the Instance that will control the loaded form(s)
#
! instance = GFInstance(self,
! connections=self.connections, ui=self._ui,
! disableSplash=self.disableSplash,
! parameters=userParameters)
!
! instance.addFormFromFile(formfile)
! instance.activate()
if __name__ == '__main__':
GFClient().run()
Index: gnue/forms/src/GFForm.py
diff -c gnue/forms/src/GFForm.py:1.211 gnue/forms/src/GFForm.py:1.212
*** gnue/forms/src/GFForm.py:1.211 Wed Nov 27 21:24:39 2002
--- gnue/forms/src/GFForm.py Wed Nov 27 22:35:53 2002
***************
*** 50,56 ****
#
# GFForm
#
! # app is passed into the initializer so that
# designer can pass that in
#
class GFForm(GRootObj, GFObj, events.EventAware):
--- 50,56 ----
#
# GFForm
#
! # instance is passed into the initializer so that
# designer can pass that in
#
class GFForm(GRootObj, GFObj, events.EventAware):
***************
*** 132,138 ****
},
'setFeature':{'function':self.triggerSetFeature,
'global': 1,
! }
}
self._features = {
--- 132,141 ----
},
'setFeature':{'function':self.triggerSetFeature,
'global': 1,
! },
! 'runForm':{'function':self.triggerRunForm,
! 'global': 1,
! }
}
self._features = {
***************
*** 202,210 ****
self.initTriggerSystem()
self._triggerns.update(self._triggerNamespaceTree._globalNamespace)
- # TODO: Is this right
- self._triggerns['runForm'] = self._instance.manager.runFormFromTrigger
- self._triggerns['runDialog'] = self._instance.manager.runDialog
#
# Secondary init (stuff that must happen
--- 205,210 ----
***************
*** 739,744 ****
--- 739,748 ----
def triggerSetStatusText(self,tip=''):
self.dispatchEvent(events.Event('uiUPDATESTATUS',[tip,None,None,None,None,None,None]))
+ def triggerRunForm(self,fileName):
+ self._instance.addFormFromFile(fileName)
+ self._instance.activate()
+
# Close this form.
def close(self):
event = events.Event('requestEXIT')
Index: gnue/forms/src/GFInstance.py
diff -c gnue/forms/src/GFInstance.py:1.69 gnue/forms/src/GFInstance.py:1.70
*** gnue/forms/src/GFInstance.py:1.69 Wed Nov 27 21:24:39 2002
--- gnue/forms/src/GFInstance.py Wed Nov 27 22:35:53 2002
***************
*** 46,52 ****
#
# Initialize the class
#
! def __init__(self, manager, serial, connections, ui, disableSplash=0,
parameters={}):
#
# Configure event handling
--- 46,53 ----
#
# Initialize the class
#
! # def __init__(self, manager, serial, connections, ui, disableSplash=0,
! def __init__(self, manager, connections, ui, disableSplash=0,
parameters={}):
#
# Configure event handling
***************
*** 118,124 ****
self.connections = connections
self.manager = manager
! self._serial = serial
self._uimodule = ui
self._disableSplash = disableSplash
self._parameters = parameters
--- 119,125 ----
self.connections = connections
self.manager = manager
! # self._serial = serial
self._uimodule = ui
self._disableSplash = disableSplash
self._parameters = parameters
***************
*** 141,147 ****
GFKeyMapper.KeyMapper.loadUserKeyMap(mapping)
-
#
# addFormFromFile
#
--- 142,147 ----
***************
*** 151,160 ****
# the base app
#
def addFormFromFile(self,fileName):
! fileHandle=openResource(fileName)
! self._form = loadFile (fileHandle, self)
! fileHandle.close()
!
#
# Associate a form object with this instance
#
--- 151,202 ----
# the base app
#
def addFormFromFile(self,fileName):
! try:
! fileHandle=openResource(fileName)
! self._form = loadFile (fileHandle, self)
! fileHandle.close()
! except IOError, mesg:
! self.manager.handleStartupError(_("Unable to open file\n\n
%s")%mesg)
!
! #
! # Activate the instance
! #
! # Builds the UI and turns control over to it
! #
! def activate(self):
! ui = self._uiinstance =
self._uimodule.GFUserInterface(self.eventController, self._disableSplash)
! try:
! ui.buildForm(self._form)
! except GConnections.Error, mesg:
! self.handleStartupError(mesg)
!
! except GDataObjects.ConnectError, mesg:
! self.handleStartupError(
! _("Unable to login to datasource.\n\n %s") %mesg)
!
! except GDataObjects.ConnectionError, mesg:
! self.handleStartupError(
! _("Error while communicating with datasource.\n\n %s") %mesg)
!
! except GDataObjects.Error, mesg:
! self.handleStartupError(mesg)
!
! ui.activateForm(self._form)
!
! currentEntry = self._form._currentEntry
! if not currentEntry:
! raise _('There are no navigable widgets in this form. Unable to
display.')
!
! self.dispatchEvent(events.Event('gotoENTRY',{'object':currentEntry}))
! self.dispatchEvent(events.Event('updateENTRY',currentEntry))
! self._form.refreshDisplay(self._form)
! self.updateStatus()
! self._ui = ui
!
! # pass control to UI
! ui.mainLoop()
!
!
#
# Associate a form object with this instance
#
***************
*** 647,671 ****
def fireButton(self, event):
event.data.processTrigger('On-Action')
- #
- # Activate the instance
- #
- # Builds the UI and turns control over to it
- #
- def activate(self):
- ui = self._uiinstance =
self._uimodule.GFUserInterface(self.eventController, self._disableSplash)
- ui.buildForm(self._form)
- ui.activateForm(self._form)
-
- currentEntry = self._form._currentEntry
- if not currentEntry:
- raise _('There are no navigable widgets in this form. Unable to
display.')
-
- self.dispatchEvent(events.Event('gotoENTRY',{'object':currentEntry}))
- self.dispatchEvent(events.Event('updateENTRY',currentEntry))
- self._form.refreshDisplay(self._form)
- self.updateStatus()
- self._ui = ui
-
- # pass control to UI
- ui.mainLoop()
--- 689,691 ----
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue/forms samples/dialog/dialog.gfd src/GFClie...,
James Thompson <=