[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
r6646 - trunk/gnue-forms/src/uidrivers/wx/widgets
From: |
kilo |
Subject: |
r6646 - trunk/gnue-forms/src/uidrivers/wx/widgets |
Date: |
Mon, 8 Nov 2004 04:47:27 -0600 (CST) |
Author: kilo
Date: 2004-11-08 04:47:26 -0600 (Mon, 08 Nov 2004)
New Revision: 6646
Modified:
trunk/gnue-forms/src/uidrivers/wx/widgets/_base.py
Log:
Added comments
Modified: trunk/gnue-forms/src/uidrivers/wx/widgets/_base.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx/widgets/_base.py 2004-11-08 10:18:20 UTC
(rev 6645)
+++ trunk/gnue-forms/src/uidrivers/wx/widgets/_base.py 2004-11-08 10:47:26 UTC
(rev 6646)
@@ -53,18 +53,25 @@
# require in each UIclass listed below.
#
class UIHelper(UIWidget):
- #
- # Functions limited to the wx driver
- #
+ """
+ Implements the common behaviour of WX widgets
+ """
+
+ # --------------------------------------------------------------------------
+ # Add a widget to the cross reference tables
+ # --------------------------------------------------------------------------
def _addToCrossRef(self, widget,gfobject, uiobject):
id = widget.GetId()
- self._uiDriver._IdToTkObj[id]=widget
- self._uiDriver._IdToGFObj[id]=gfobject
- self._uiDriver._IdToUIObj[id]=uiobject
+ self._uiDriver._IdToTkObj[id] = widget
+ self._uiDriver._IdToGFObj[id] = gfobject
+ self._uiDriver._IdToUIObj[id] = uiobject
# BAH! This isn't working
##widget.__origBackgroundColor = widget.GetBackgroundColour()
widget.__origBackgroundColor = wxWHITE
+ # --------------------------------------------------------------------------
+ # Remove a widget from the cross reference tables
+ # --------------------------------------------------------------------------
def _deleteFromCrossRef(self, widget, object):
id = widget.GetId()
try:
@@ -74,15 +81,26 @@
except:
pass
- #
- # Override the base UIWidget functions
- #
+ # --------------------------------------------------------------------------
+ # Show all ui-widgets managed by this object
+ # --------------------------------------------------------------------------
def show(self):
+ """
+ Calls the show() on all wx-widgets managed by this instance.
+ This is needed if a row-count greater than 0 is given.
+ """
for widget in self.widgets:
widget.Show(1)
widget.Raise()
+ # --------------------------------------------------------------------------
+ # Hide all ui-widgets managed by this object
+ # --------------------------------------------------------------------------
def hide(self):
+ """
+ Calls the hide() on all wx-widgets managed by this instance.
+ This is needed if a row-count greater than 0 is given.
+ """
for widget in self.widgets:
widget.Show(0)
@@ -124,6 +142,10 @@
# On lose of the focus we un-select ComboBox-Entries
# --------------------------------------------------------------------------
def loseFocus(self):
+ """
+ Releases focus from the widget that currently had it.
+ Resets the widget's color to normal if focus highlighting is used.
+ """
widget = self.widgets[self._uiDriver._uiFocusIndex]
widget.__focused = False
try:
@@ -186,26 +208,51 @@
widget.Refresh()
+ # --------------------------------------------------------------------------
+ # Set the cursor's location in a widget
+ # --------------------------------------------------------------------------
def setCursorPosition(self, position, index=0):
+ """
+ Sets the cursor's position to the given location inside a capable widget.
+ """
try:
self.widgets[index].SetInsertionPoint(position)
except AttributeError:
pass # For label-style entries
+ # --------------------------------------------------------------------------
+ # Set the selection inside a widget
+ # --------------------------------------------------------------------------
def setSelectedArea(self, selection1, selection2, index=0):
+ """
+ Sets the selection start/end inside a capable widget.
+ """
try:
self.widgets[index].SetSelection(selection1, selection2)
except (AttributeError, TypeError):
pass # For label-style & dropdown entries
+
+ # --------------------------------------------------------------------------
+ # Create a new widget and add it to the cross reference table
+ # --------------------------------------------------------------------------
def createWidget(self, event, spacer):
+ """
+ Creates a new WX widget and adds it to the cross reference table.
+ """
newWidget = self._createWidget(event, spacer)
initFont(newWidget)
if event.initialize:
self._addToCrossRef(newWidget,event.object,self)
return newWidget
+ # --------------------------------------------------------------------------
+ # Make sure we leave everything clean and tidy
+ # --------------------------------------------------------------------------
def cleanup(self, object):
+ """
+ Cleans up everything, ie deletes all widgets in this instance.
+ """
for widget in self.widgets[:]:
id = widget.GetId()
try:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- r6646 - trunk/gnue-forms/src/uidrivers/wx/widgets,
kilo <=