[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue/forms samples/dialog/dialog.gfd src/GFForm...
From: |
James Thompson |
Subject: |
gnue/forms samples/dialog/dialog.gfd src/GFForm... |
Date: |
Wed, 11 Dec 2002 23:08:10 -0500 |
CVSROOT: /cvsroot/gnue
Module name: gnue
Changes by: James Thompson <address@hidden> 02/12/11 23:08:10
Modified files:
forms/samples/dialog: dialog.gfd
forms/src : GFForm.py GFInstance.py
forms/src/uidrivers/_base: UIdriver.py
forms/src/uidrivers/curses: UIdriver.py
forms/src/uidrivers/gtk2: UIdriver.py
forms/src/uidrivers/wx: UIdriver.py
Log message:
Fixed previousRecord events from buttons
Fixed <enter> key events on some entries
More UI cleanup
More work on <dialog> support. The structure is not final, the current
code
aims to let me test things w/o breaking the existing drivers.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/samples/dialog/dialog.gfd.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFForm.py.diff?tr1=1.217&tr2=1.218&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFInstance.py.diff?tr1=1.75&tr2=1.76&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/uidrivers/_base/UIdriver.py.diff?tr1=1.82&tr2=1.83&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/uidrivers/curses/UIdriver.py.diff?tr1=1.26&tr2=1.27&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/uidrivers/gtk2/UIdriver.py.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/uidrivers/wx/UIdriver.py.diff?tr1=1.222&tr2=1.223&r1=text&r2=text
Patches:
Index: gnue/forms/samples/dialog/dialog.gfd
diff -c gnue/forms/samples/dialog/dialog.gfd:1.4
gnue/forms/samples/dialog/dialog.gfd:1.5
*** gnue/forms/samples/dialog/dialog.gfd:1.4 Tue Dec 3 13:06:32 2002
--- gnue/forms/samples/dialog/dialog.gfd Wed Dec 11 23:08:09 2002
***************
*** 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>
--- 6,12 ----
<form xmlns:c="GNUe:Layout:Char">
<options/>
<trigger name="button1_Trigger" type="NAMED"><![CDATA[##
! activateDialog('selector')
print "dialog(selector,modal=1) comming soon"
]]></trigger>
<logic>
***************
*** 26,32 ****
</page>
</layout>
! <form style="dialog" xmlns:c="GNUe:Layout:Char" name="selector">
<options/>
<datasource name="dtsDrpStaticdrop1" type="static">
<staticset fields="key,descr">
--- 26,32 ----
</page>
</layout>
! <dialog xmlns:c="GNUe:Layout:Char" name="selector">
<options/>
<datasource name="dtsDrpStaticdrop1" type="static">
<staticset fields="key,descr">
***************
*** 45,62 ****
</staticset>
</datasource>
<logic>
! <block name="Block_1">
<field name="flddrop1" field="drop1" fk_description="descr"
fk_key="key"
fk_source="dtsDrpStaticdrop1"/>
</block>
</logic>
<layout c:height="6" c:width="12">
<page name="Page_1">
! <label name="Label_1" text="Chose One" c:width="9" c:x="1" c:y="1"/>
! <entry block="Block_1" field="flddrop1" style="dropdown" c:width="9"
c:x="1" c:y="2"/>
</page>
</layout>
! </form>
</form>
--- 45,63 ----
</staticset>
</datasource>
<logic>
! <block name="Block_2">
<field name="flddrop1" field="drop1" fk_description="descr"
fk_key="key"
fk_source="dtsDrpStaticdrop1"/>
</block>
</logic>
+
<layout c:height="6" c:width="12">
<page name="Page_1">
! <label name="Label_2" text="Chose One" c:width="9" c:x="1" c:y="1"/>
! <entry block="Block_2" field="flddrop1" style="dropdown" c:width="9"
c:x="1" c:y="2"/>
</page>
</layout>
! </dialog>
</form>
Index: gnue/forms/src/GFForm.py
diff -c gnue/forms/src/GFForm.py:1.217 gnue/forms/src/GFForm.py:1.218
*** gnue/forms/src/GFForm.py:1.217 Tue Dec 3 13:06:32 2002
--- gnue/forms/src/GFForm.py Wed Dec 11 23:08:09 2002
***************
*** 139,145 ****
},
'runForm':{'function':self.triggerRunForm,
'global': 1,
! }
}
self._features = {
--- 139,148 ----
},
'runForm':{'function':self.triggerRunForm,
'global': 1,
! } ,
!
'activateDialog':{'function':self.triggerActivateDialog,
! 'global': 1,
! } ,
}
self._features = {
***************
*** 582,591 ****
nextEntry = None
lastEntry = self._currentEntry
! if self._currentEntry._block.transparent:
source = self._currentEntry._page._focusOrder
else:
! source = self._currentEntry._block._focusOrder
for object in source:
if ((object._navigable) and ((not object.readonly) or
--- 585,594 ----
nextEntry = None
lastEntry = self._currentEntry
! if self._currentBlock.transparent:
source = self._currentEntry._page._focusOrder
else:
! source = self._currentBlock._focusOrder
for object in source:
if ((object._navigable) and ((not object.readonly) or
***************
*** 732,738 ****
def triggerRunForm(self,fileName):
self._instance.addFormFromFile(fileName)
self._instance.activate()
!
# Close this form.
def close(self):
event = events.Event('requestEXIT')
--- 735,744 ----
def triggerRunForm(self,fileName):
self._instance.addFormFromFile(fileName)
self._instance.activate()
!
! def triggerActivateDialog(self,dialogName):
! self._instance.activateForm(dialogName)
!
# Close this form.
def close(self):
event = events.Event('requestEXIT')
Index: gnue/forms/src/GFInstance.py
diff -c gnue/forms/src/GFInstance.py:1.75 gnue/forms/src/GFInstance.py:1.76
*** gnue/forms/src/GFInstance.py:1.75 Sat Dec 7 03:31:20 2002
--- gnue/forms/src/GFInstance.py Wed Dec 11 23:08:09 2002
***************
*** 179,185 ****
object.phaseInit()
self._form = form # TODO: temp hack to keep it working
!
#
# removes the subforms from the main tree before
# any UI stuff is constructed
--- 179,185 ----
object.phaseInit()
self._form = form # TODO: temp hack to keep it working
!
#
# removes the subforms from the main tree before
# any UI stuff is constructed
***************
*** 202,209 ****
# Construct the
self._uiinstance = self._uimodule.GFUserInterface(self.eventController,
self._disableSplash)
! self.activateForm('__main__')
self._uiinstance.mainLoop()
#
--- 202,224 ----
# Construct the
self._uiinstance = self._uimodule.GFUserInterface(self.eventController,
self._disableSplash)
! #
! # Build the UIs for all the forms
! #
! for dialog in self._formsDictionary.keys():
! self.buildForm(dialog)
!
! for dialog in self._formsDictionary.keys():
! print dialog
! print self._uiinstance._uiDictionary[dialog]._formToUIWidget
+ #
+ # Bring up the main form
+ #
+ self.activateForm('__main__')
+ # TODO : Hard coded test case for use w/ dialog.gfd
+ #self.activateForm('selector')
+
self._uiinstance.mainLoop()
#
***************
*** 211,223 ****
# sets that form to active status
#
def activateForm(self,formName='__main__'):
! form = self._formsDictionary[formName]
!
! if not form._currentEntry:
raise _('There are no navigable widgets in this form. Unable to
display.')
try:
! self._uiinstance.buildForm(form)
except GConnections.Error, mesg:
self.handleStartupError(mesg)
--- 226,255 ----
# sets that form to active status
#
def activateForm(self,formName='__main__'):
! self._form = self._formsDictionary[formName]
!
! print "Current entry", self._form._currentEntry
! if not self._form._currentEntry:
raise _('There are no navigable widgets in this form. Unable to
display.')
+ self._uiinstance.activateForm(formName)
+
+ self.dispatchEvent('gotoENTRY',{'object':self._form._currentEntry})
+ self.dispatchEvent('updateENTRY',self._form._currentEntry)
+ self._form.refreshDisplay(self._form)
+ self.updateStatus()
+
+ #
+ # buildForm
+ #
+ # Requests that the ui driver build a user interface
+ # for a form tree.
+ #
+ def buildForm(self,formName='__main__'):
+ form = self._formsDictionary[formName]
+
try:
! self._uiinstance.buildForm(form, formName)
except GConnections.Error, mesg:
self.handleStartupError(mesg)
***************
*** 229,244 ****
except GDataObjects.ConnectionError, mesg:
self.handleStartupError(
_("Error while communicating with datasource.\n\n %s") %mesg)
!
except GDataObjects.Error, mesg:
self.handleStartupError(mesg)
!
! self._uiinstance.activateForm(form)
!
! self.dispatchEvent('gotoENTRY',{'object':form._currentEntry})
! self.dispatchEvent('updateENTRY',form._currentEntry)
! self._form.refreshDisplay(form)
! self.updateStatus()
#
#
--- 261,270 ----
except GDataObjects.ConnectionError, mesg:
self.handleStartupError(
_("Error while communicating with datasource.\n\n %s") %mesg)
!
except GDataObjects.Error, mesg:
self.handleStartupError(mesg)
!
#
#
***************
*** 310,316 ****
self.dispatchEvent('gotoENTRY',{'object':self._form._currentEntry})
self.updateRecordCounter()
self.updateRecordStatus()
-
#
# proxyEntryEvent
--- 336,341 ----
Index: gnue/forms/src/uidrivers/_base/UIdriver.py
diff -c gnue/forms/src/uidrivers/_base/UIdriver.py:1.82
gnue/forms/src/uidrivers/_base/UIdriver.py:1.83
*** gnue/forms/src/uidrivers/_base/UIdriver.py:1.82 Tue Dec 3 22:05:28 2002
--- gnue/forms/src/uidrivers/_base/UIdriver.py Wed Dec 11 23:08:09 2002
***************
*** 34,39 ****
--- 34,48 ----
from gnue.forms.GFForm import *
+ class UIForm:
+ def __init__(self):
+ self._form = None # The GObj based form tree
+ self._interface = None # The widget tree constructed by
buildUI
+ self._formToUI = {} # the GFObj to UI widget cross ref
+ self._formToUIWidget = {} # dictionary of driver specific
UIfoo
+ # widgets with the GFObj used as
the key
+ self._pageList = [] # A list of page widgets created by
the form
+
#
# GFUserInterfaceBase
#
***************
*** 42,51 ****
#
class GFUserInterfaceBase(events.EventAware):
def __init__(self, eventHandler):
! events.EventAware.__init__(self, eventHandler)
#
! # Configure event handling
#
self.registerEventListeners( {
'gotoENTRY' : self.switchFocus,
'updateENTRY' : self.updateEntry,
--- 51,64 ----
#
class GFUserInterfaceBase(events.EventAware):
def __init__(self, eventHandler):
! ############################################################
#
! # Things you do not adjust in the individual UI drivers
#
+ ############################################################
+ events.EventAware.__init__(self, eventHandler)
+
+ # Configure event handling
self.registerEventListeners( {
'gotoENTRY' : self.switchFocus,
'updateENTRY' : self.updateEntry,
***************
*** 66,100 ****
'getCLIPBOARD' : self.getClipboardContents,
})
# Our local "clipboard"
self.__clipboard = None
! self.widgets = self._WIDGETS
! self._formToUI = {} # the GFObj to UI widget cross ref
! self._formToUIWidget = {} # dictionary of driver specific
UIfoo
! # widgets with the GFObj used as
the key
! self.containerWidgets= ['GFPage', 'GFBox'] # GFForm objects that
contain others
- self._pageList = [] # A list of page widgets created by
the form
! self.statusValues = {'saved':'OK', # dictionary of mappings from
record status to
! 'modified':'MOD',# what is displayed on the status
bar
! 'deleted':'DEL',
! 'query':'QRY'}
! # A dictionary of functions used by buildUI to build the widgets. Can
override in
! # UI specific module if necessary.
! self.widgetConstructorFunction = {
! 'GFBox' : self._stdHandler,
! 'GFButton' : self._stdHandler,
! 'GFEntry' : self._stdHandler,
! 'GFForm' : self._stdHandler,
! 'GFLabel' : self._stdHandler,
! 'GFScrollBar' : self._stdHandler,
! 'GFPage' : self._stdHandler,
! }
#
# buildUI
--- 79,154 ----
'getCLIPBOARD' : self.getClipboardContents,
})
+ # GFForm objects that can act as containers for other objects
+ self.containerWidgets= ['GFPage'] # , 'GFBox']
+
+
+ # Mapping - internal record status : displayed on status bar
+ self.statusValues = {'saved':'OK',
+ 'modified':'MOD',
+ 'deleted':'DEL',
+ 'query':'QRY'}
+
# Our local "clipboard"
self.__clipboard = None
! ############################################################
! #
! # Things you may need to adjust in the individual UI drivers
! #
! ############################################################
! #
! # A mapping of GFForm string types to an individual driver's
! # UIWidgets derived classes. This MUST be reset in each
! # driver or hideous, vile things will invade your fridge
! #
! self._WIDGETS = { 'GFLabel' : UIFailure,
! 'GFBox' : UIFailure,
! 'GFPage' : UIFailure,
! 'GFForm' : UIFailure,
! 'GFEntry' : UIFailure,
! 'GFButton' : UIFailure,
! 'GFScrollBar' : UIFailure,
! }
! #
! # Dialogs required by base
! #
! # Same notes apply to this as to _WIDGETS above
! # TODO: Once <dialog> works we may be able to
! # do away with these
! #
! self._DIALOGS = {'about' :UIFailure,
! 'messageBox' :UIFailure,
! }
! #
! # Widgets that should be represented in the UI and
! # the constructor needed to build them. The constructor
! # can overriden in UI specific module if necessary.
! #
! self.widgetConstructorFunction = {
! 'GFBox' : self._stdConstructor,
! 'GFButton' : self._stdConstructor,
! 'GFEntry' : self._stdConstructor,
! 'GFForm' : self._stdConstructor,
! 'GFLabel' : self._stdConstructor,
! 'GFScrollBar' : self._stdConstructor,
! 'GFPage' : self._stdConstructor,
! }
! #
! # Multi-form support
! #
! self._uiDictionary = {}
!
! # self.widgets = self._WIDGETS
! # self._formToUI = {} # the GFObj to UI widget cross ref
! # self._formToUIWidget = {} # dictionary of driver specific
UIfoo
! # # widgets with the GFObj used as
the key
! # self._pageList = [] # A list of page widgets created
by the form
#
# buildUI
***************
*** 109,114 ****
--- 163,169 ----
uiWidget = self.widgetConstructorFunction[self._currentObject[0]._type]
()
widget = uiWidget.widgets
GDebug.printMesg(2, "Widget is %s" % widget)
+
self._formToUIWidget[self._currentObject[0]]=uiWidget
# If the widget list is not empty then do the following
***************
*** 116,122 ****
--- 171,179 ----
if not widget == []:
# Create a cross reference to the GFObject that created
# one or more UI widgets
+
self._formToUI[self._currentObject[0]] = widget
+
# If the current object is a container then add the
# just created first created widget to it's widget list
if self._currentObject[0]._type in self.containerWidgets:
***************
*** 136,146 ****
self.currentWidget.pop(0)
#
! # _stdHandler
#
# The default function that builds a specific widget
#
! def _stdHandler(self):
object = self._currentObject[0]
event = self._updateCreateEvent(events.Event('CreateUIWidget',None,
object=object,
--- 193,203 ----
self.currentWidget.pop(0)
#
! # _stdConstructor
#
# The default function that builds a specific widget
#
! def _stdConstructor(self):
object = self._currentObject[0]
event = self._updateCreateEvent(events.Event('CreateUIWidget',None,
object=object,
***************
*** 151,157 ****
widgetHeight=self.widgetHeight,
interface=self,
initialize=1))
! newWidget = self.widgets[object._type](event)
return newWidget
--- 208,214 ----
widgetHeight=self.widgetHeight,
interface=self,
initialize=1))
! newWidget = self._WIDGETS[object._type](event)
return newWidget
***************
*** 170,181 ****
# when passed a GObj tree constructed from a .gfd file
# it handles the creatation of the user interface
#
! def buildForm(self, form):
! self._currentObject = [form]
self._form = form
# Create the UI from the GFForm passed in
self._buildUI()
#############################################################################
#
--- 227,263 ----
# when passed a GObj tree constructed from a .gfd file
# it handles the creatation of the user interface
#
! def buildForm(self, form, formName):
! currentForm = self._uiDictionary[formName] = UIForm()
!
! self._formToUI = {}
! self._formToUIWidget = {}
! self._pageList = []
self._form = form
+ self._currentObject = [form]
+
# Create the UI from the GFForm passed in
self._buildUI()
+ currentForm._formToUI = self._formToUI
+ currentForm._formToUIWidget = self._formToUIWidget
+ currentForm._pageList = self._pageList
+ currentForm._userInterface = self._pageList[0]
+ currentForm._form = form
+ currentForm._currentWidget = self.currentWidget
+
+ def activateForm(self,formName):
+
+ form = self._uiDictionary[formName]
+
+ self._formToUI = form._formToUI
+ self._formToUIWidget = form._formToUIWidget
+ self._pageList = form._pageList
+ self.currentWidget = form._currentWidget
+ self._form = form._form
+
+ self._activateForm(form._form)
+
#############################################################################
#
***************
*** 263,269 ****
selection1, selection2 = event.selection
widget.setSelectedArea(selection1, selection2, index)
-
#
# Clipboard routines
#
--- 345,350 ----
***************
*** 359,365 ****
# _updateCreateEvent
#
# Can be used by UI drivers to add more attributes to the event that
! # creates a widget. Called by the _stdHandler during the building of the UI
#
def _updateCreateEvent(self, event):
return event
--- 440,446 ----
# _updateCreateEvent
#
# Can be used by UI drivers to add more attributes to the event that
! # creates a widget. Called by the _stdConstructor during the building of
the UI
#
def _updateCreateEvent(self, event):
return event
***************
*** 371,383 ****
#
# Required Functions
#
! # UIDrivers must implement the following functions
! #
#
#
#
! def activateForm(self):
GDebug.printMesg(0, "Fatal UI driver error. Required function not
implemented")
sys.exit(1)
--- 452,463 ----
#
# Required Functions
#
! # UIDrivers must implement the following features
#
#
#
! def _activateForm(self):
GDebug.printMesg(0, "Fatal UI driver error. Required function not
implemented")
sys.exit(1)
***************
*** 388,394 ****
def gotoPage(self,event):
GDebug.printMesg(0, "Fatal UI driver error. Required function not
implemented")
sys.exit(1)
!
# Creating base dictionary for language font encodings
encodings = {
--- 468,486 ----
def gotoPage(self,event):
GDebug.printMesg(0, "Fatal UI driver error. Required function not
implemented")
sys.exit(1)
!
!
!
################################################################################
! #
! # Bogus class designed to force system failure if an individual ui driver
! # doesn't override GFUserInterfaceBase's _WIDGETS variable
! #
!
################################################################################
! class UIFailure:
! def __init__(self, event):
! print "Fatal UI driver error. _WIDGETS not properly setup in UI driver"
! sys.exit(1)
!
# Creating base dictionary for language font encodings
encodings = {
Index: gnue/forms/src/uidrivers/curses/UIdriver.py
diff -c gnue/forms/src/uidrivers/curses/UIdriver.py:1.26
gnue/forms/src/uidrivers/curses/UIdriver.py:1.27
*** gnue/forms/src/uidrivers/curses/UIdriver.py:1.26 Tue Dec 10 20:18:32 2002
--- gnue/forms/src/uidrivers/curses/UIdriver.py Wed Dec 11 23:08:10 2002
***************
*** 74,79 ****
--- 74,81 ----
#
class GFUserInterface(GFUserInterfaceBase):
def __init__(self, eventController, disableSplash = None):
+ GFUserInterfaceBase.__init__(self,eventController)
+
self._WIDGETS = {'GFLabel' : UILabel,
'GFBox' : UIBox,
'GFPage' : UIPage,
***************
*** 87,113 ****
'messageBox' :UIMessageBox,
}
- self._aboutDialog = UIAbout
- self._messageDialog = UIMessageBox
-
self._disableSplash = disableSplash
- GFUserInterfaceBase.__init__(self,eventController)
self._objectMapping = {}
global _EVENTPROCESSOR
_EVENTPROCESSOR = self.dispatchEvent
! self.forms = {}
!
! self.init()
#
# init
#
#
! def init(self):
#
# Create the main window
#
--- 89,109 ----
'messageBox' :UIMessageBox,
}
self._disableSplash = disableSplash
self._objectMapping = {}
global _EVENTPROCESSOR
_EVENTPROCESSOR = self.dispatchEvent
! self.init(disableSplash)
#
# init
#
#
! def init(self,disableSplash):
#
# Create the main window
#
***************
*** 120,126 ****
#
# SplashScreen
#
! if not self._disableSplash:
text = 'GNU Enterprise Forms\n' \
+ 'Version %s\n' % VERSION \
+ '(c)2000-2002 Free Software Foundation\n' \
--- 116,122 ----
#
# SplashScreen
#
! if disableSplash:
text = 'GNU Enterprise Forms\n' \
+ 'Version %s\n' % VERSION \
+ '(c)2000-2002 Free Software Foundation\n' \
Index: gnue/forms/src/uidrivers/gtk2/UIdriver.py
diff -c gnue/forms/src/uidrivers/gtk2/UIdriver.py:1.18
gnue/forms/src/uidrivers/gtk2/UIdriver.py:1.19
*** gnue/forms/src/uidrivers/gtk2/UIdriver.py:1.18 Wed Dec 11 01:45:25 2002
--- gnue/forms/src/uidrivers/gtk2/UIdriver.py Wed Dec 11 23:08:10 2002
***************
*** 120,144 ****
class GFUserInterface(GFUserInterfaceBase):
def __init__(self, eventController, disableSplash = None):
! self._WIDGETS = WIDGETS
self._DIALOGS = {'about' :UIAbout,
'messageBox' :UIMessageBox,
}
- self._aboutDialog = UIAbout
- self._messageDialog = UIMessageBox
-
self._disableSplash = disableSplash
- GFUserInterfaceBase.__init__(self,eventController)
global _EVENTPROCESSOR
_EVENTPROCESSOR = self.dispatchEvent
global _PROMPTFORRECORD
_PROMPTFORRECORD = self.promptForRecordNumber
! self.forms = {}
! self.init()
#
# init
--- 120,148 ----
class GFUserInterface(GFUserInterfaceBase):
def __init__(self, eventController, disableSplash = None):
! GFUserInterfaceBase.__init__(self,eventController)
!
! self._WIDGETS = {'GFLabel' : UILabel,
! 'GFBox' : UIBox,
! 'GFPage' : UIPage,
! 'GFForm' : UIForm,
! 'GFEntry' : UIEntry,
! 'GFButton' : UIButton,
! 'GFScrollBar' : UIScrollBar,
! }
self._DIALOGS = {'about' :UIAbout,
'messageBox' :UIMessageBox,
}
self._disableSplash = disableSplash
global _EVENTPROCESSOR
_EVENTPROCESSOR = self.dispatchEvent
global _PROMPTFORRECORD
_PROMPTFORRECORD = self.promptForRecordNumber
! self.init(disableSplash)
#
# init
***************
*** 146,159 ****
# Routine called by wxWindows when wxApp instance is created
# It is used the build the basic UI
#
! def init(self):
#
# Splash screen
#
# how to get rid of this thing???
# disabled for now...
! if not self._disableSplash and 0:
self.splash = gtk.Window(gtk.TRUE)
# not the best, but working decision
self.splash.connect('destroy', lambda win: self.splash.hide())
--- 150,163 ----
# Routine called by wxWindows when wxApp instance is created
# It is used the build the basic UI
#
! def init(self,disableSplash):
#
# Splash screen
#
# how to get rid of this thing???
# disabled for now...
! if not disableSplash and 0:
self.splash = gtk.Window(gtk.TRUE)
# not the best, but working decision
self.splash.connect('destroy', lambda win: self.splash.hide())
***************
*** 1586,1607 ****
#$self.app.loginCompleted(1)
#$else:
#$event.Skip()
-
-
-
-
-
-
- # Needed by Designer
- WIDGETS = {'GFLabel' : UILabel,
- 'GFBox' : UIBox,
- 'GFPage' : UIPage,
- 'GFForm' : UIForm,
- 'GFEntry' : UIEntry,
- 'GFButton' : UIButton,
- 'GFScrollBar' : UIScrollBar,
- }
-
# Shortcut
images_dir = GConfig.getInstalledBase('forms_images','common_images') + '/'
--- 1590,1595 ----
Index: gnue/forms/src/uidrivers/wx/UIdriver.py
diff -c gnue/forms/src/uidrivers/wx/UIdriver.py:1.222
gnue/forms/src/uidrivers/wx/UIdriver.py:1.223
*** gnue/forms/src/uidrivers/wx/UIdriver.py:1.222 Tue Dec 10 20:18:33 2002
--- gnue/forms/src/uidrivers/wx/UIdriver.py Wed Dec 11 23:08:10 2002
***************
*** 143,179 ****
#
class GFUserInterface(GFUserInterfaceBase):
def __init__(self, eventController, disableSplash = None):
!
! self._WIDGETS = WIDGETS
!
self._DIALOGS = {'about' :UIAbout,
'messageBox' :UIMessageBox,
}
! self._aboutDialog = UIAbout
! self._messageDialog = UIMessageBox
! self._wxapp = getWxApp()
! self._disableSplash = disableSplash
! GFUserInterfaceBase.__init__(self,eventController)
global _PROMPTFORRECORD
_PROMPTFORRECORD = self.promptForRecordNumber
! self.init()
!
! #
! # init
! #
! # Routine called by wxWindows when wxApp instance is created
! # It is used the build the basic UI
! #
! def init(self):
!
#
# SplashScreen
#
! if not self._disableSplash:
self.splash =
SplashScreen(None,bitmapfile=images_dir+gConfigForms('splashScreenPNG'),
duration = 3000, callback=self.onCloseSplash,
style=wxSIMPLE_BORDER|wxCENTRE_ON_SCREEN )
--- 143,170 ----
#
class GFUserInterface(GFUserInterfaceBase):
def __init__(self, eventController, disableSplash = None):
! GFUserInterfaceBase.__init__(self,eventController)
!
self._DIALOGS = {'about' :UIAbout,
'messageBox' :UIMessageBox,
}
! # On only this driver these are defined outside the GFUserInterface
! # class at the bottom of this file. This is because GNUe Designer
! # is written using wx and pulls these values from this driver
! self._WIDGETS = WIDGETS
! self.wxSpecificInit(disableSplash)
+ def wxSpecificInit(self, disableSplash):
global _PROMPTFORRECORD
_PROMPTFORRECORD = self.promptForRecordNumber
! self._wxapp = getWxApp()
#
# SplashScreen
#
! if not disableSplash:
self.splash =
SplashScreen(None,bitmapfile=images_dir+gConfigForms('splashScreenPNG'),
duration = 3000, callback=self.onCloseSplash,
style=wxSIMPLE_BORDER|wxCENTRE_ON_SCREEN )
***************
*** 246,267 ****
self.statusBar.SetStatusWidths([-1,50,50,75,75])
initFont(self.statusBar,0)
!
! self.mainWindow.panel = wxScrolledWindow(self.mainWindow,-1,
wxDefaultPosition,self.mainWindow.GetClientSize())
!
global _disabledColour
_disabledColour = self.mainWindow.GetBackgroundColour()
! self.currentWidget = [self.mainWindow.panel]
EVT_CLOSE(self.mainWindow,self.closeTrap)
- return true
-
-
- def activateForm(self, form):
self.menu_sb_space = 0
if not form._features['GUI:MENUBAR:SUPPRESS']:
self.menu_sb_space += 2
--- 237,256 ----
self.statusBar.SetStatusWidths([-1,50,50,75,75])
initFont(self.statusBar,0)
! self._scrollWindow = self.mainWindow.panel =
wxScrolledWindow(self.mainWindow,-1,
wxDefaultPosition,self.mainWindow.GetClientSize())
global _disabledColour
_disabledColour = self.mainWindow.GetBackgroundColour()
! self.currentWidget = [self._scrollWindow]
EVT_CLOSE(self.mainWindow,self.closeTrap)
+ def _activateForm(self, form):
+ #
+ # Build Menu
+ #
self.menu_sb_space = 0
if not form._features['GUI:MENUBAR:SUPPRESS']:
self.menu_sb_space += 2
***************
*** 270,276 ****
# where 1001 is the wxId associated with requestROLLBACK.
self.__eventMenuMapping = {}
-
fileMenu = wxMenu()
self.__addMenuItem(fileMenu, _("&Save\tF6"),_('Save all changes to
database.'),'requestCOMMIT')
self.__addMenuItem(fileMenu, _("&Clear Form\tF11"),_('Clear
Form'),'requestROLLBACK')
--- 259,264 ----
***************
*** 320,326 ****
self._menuBar = menuBar
self.mainWindow.SetMenuBar( self._menuBar );
!
if not form._features['GUI:TOOLBAR:SUPPRESS']:
self.menu_sb_space += 2
--- 308,316 ----
self._menuBar = menuBar
self.mainWindow.SetMenuBar( self._menuBar );
! #
! # Build Toolbar
! #
if not form._features['GUI:TOOLBAR:SUPPRESS']:
self.menu_sb_space += 2
***************
*** 356,361 ****
--- 346,354 ----
self._mainToolBar.Realize()
+ #
+ # Size based upon the form definition
+ #
width = int(self._form._layout.Char__width)
height = int(self._form._layout.Char__height)
***************
*** 376,406 ****
# This is the initial panel window setup during init
# not a wxPanel set per page right after this
tempx,tempy = self.mainWindow.GetClientSizeTuple()
! self.mainWindow.panel.SetScrollbars(1, 1, tempx, tempy)
!
self.mainWindow.panel = self._pageList[0]
self.mainWindow.panel.SetSize(self.mainWindow.GetClientSize())
! self._pageList[0].Show(TRUE)
!
# Only one page at a time can be visible
self.visiblePage = self._pageList[0]
! self._wxapp.SetTopWindow(self.mainWindow)
!
tempx,tempy = self.mainWindow.GetSizeTuple()
mainWindowSize = wxSize(20+tempx, 20+tempy)
-
self.mainWindow.SetSize(mainWindowSize)
!
self.mainWindow.CenterOnScreen()
self.mainWindow.Show(true)
! # Keep splash on top
! if hasattr(self,'splash'):
self.splash.Raise()
-
#############################################################################
#
# Private UIBase support functions
--- 369,399 ----
# This is the initial panel window setup during init
# not a wxPanel set per page right after this
tempx,tempy = self.mainWindow.GetClientSizeTuple()
! self._scrollWindow.SetScrollbars(1, 1, tempx, tempy)
self.mainWindow.panel = self._pageList[0]
self.mainWindow.panel.SetSize(self.mainWindow.GetClientSize())
! self.mainWindow.panel.Raise()
# Only one page at a time can be visible
self.visiblePage = self._pageList[0]
+ self.visiblePage.Show(TRUE)
+ #self.visiblePage.Raise()
+ #self._wxapp.SetTopWindow(self.mainWindow)
! # TODO: Scrollbar width adjustment?
tempx,tempy = self.mainWindow.GetSizeTuple()
mainWindowSize = wxSize(20+tempx, 20+tempy)
self.mainWindow.SetSize(mainWindowSize)
!
! # Go ahead and display
self.mainWindow.CenterOnScreen()
self.mainWindow.Show(true)
!
! # Ensure splashscreen is on top
! if hasattr(self,'splash') and self.splash:
self.splash.Raise()
#############################################################################
#
# Private UIBase support functions
***************
*** 649,654 ****
--- 642,648 ----
# the modal login box and all hell breaks loose
self.splash.Show(0)
self.splash.Destroy()
+ self.splash = None
#############################################################################
***************
*** 867,872 ****
--- 861,867 ----
_setDefaultEventHandlers(newWidget, event.eventHandler, event.initialize)
+ print "page", newWidget,event.container, event.object
event.interface._pageList.append(newWidget)
return newWidget
***************
*** 1160,1166 ****
not event.ControlDown() and \
not event.AltDown() and \
int (gConfigForms('enterIsNewLine')) and \
! object.Char__height > 1:
command = 'NEWLINE'
--- 1155,1161 ----
not event.ControlDown() and \
not event.AltDown() and \
int (gConfigForms('enterIsNewLine')) and \
! (hasattr(object,'Char__height') and object.Char__height) > 1:
command = 'NEWLINE'
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue/forms samples/dialog/dialog.gfd src/GFForm...,
James Thompson <=