dabo Commit
Revision 2318
Date: 2006-10-08 16:32:52 -0700 (Sun, 08 Oct 2006)
Author: ed
Changed:
U trunk/dabo/ui/uiwx/dKeys.py
U trunk/dabo/ui/uiwx/dPage.py
U trunk/dabo/ui/uiwx/dPageFrameMixin.py
U trunk/dabo/ui/uiwx/dPageFrameNoTabs.py
U trunk/dabo/ui/uiwx/dPanel.py
U trunk/dabo/ui/uiwx/dPemMixin.py
Log:
Modifed dKeys to reflect the different key codes on OS X. This might be only be
an issue with PowerPC-based Macs, since I thought it was working with my
MacBook. When I get that back I'll have to test on Intel Macs.
Fixed a bug in the containerCoordinates() method when calculating objects
inside of pageframe-type controls. Added default values of the object's
Position as the argument for absoluteCoordinates() and relativeCoordinates() in
dPemMixin.
Changed the paged controls so that pages can be added without automatically
having sizers set for them. By setting the pageframe's PageSizerClass property
to None, pages will be added without sizers.
Changed dScrollPanel so that its Children property doesn't include its
scrollbars, which are raw wx controls.
Diff:
Modified: trunk/dabo/ui/uiwx/dKeys.py
===================================================================
--- trunk/dabo/ui/uiwx/dKeys.py 2006-10-08 23:23:06 UTC (rev 2317)
+++ trunk/dabo/ui/uiwx/dKeys.py 2006-10-08 23:32:52 UTC (rev 2318)
@@ -1,4 +1,5 @@
import wx
+import dabo
key_Alt = wx.WXK_ALT
key_Back = wx.WXK_BACK
@@ -22,10 +23,16 @@
key_Next = wx.WXK_NEXT
key_End = wx.WXK_END
key_Home = wx.WXK_HOME
-key_Left = wx.WXK_LEFT
-key_Up = wx.WXK_UP
-key_Right = wx.WXK_RIGHT
-key_Down = wx.WXK_DOWN
+if wx.Platform == "__WXMAC__":
+ key_Left = 28
+ key_Up = 30
+ key_Right = 29
+ key_Down = 31
+else:
+ key_Left = wx.WXK_LEFT
+ key_Up = wx.WXK_UP
+ key_Right = wx.WXK_RIGHT
+ key_Down = wx.WXK_DOWN
key_Select = wx.WXK_SELECT
key_Print = wx.WXK_PRINT
key_Execute = wx.WXK_EXECUTE
Modified: trunk/dabo/ui/uiwx/dPage.py
===================================================================
--- trunk/dabo/ui/uiwx/dPage.py 2006-10-08 23:23:06 UTC (rev 2317)
+++ trunk/dabo/ui/uiwx/dPage.py 2006-10-08 23:32:52 UTC (rev 2318)
@@ -27,7 +27,9 @@
def initSizer(self):
""" Set up the default vertical box sizer for the page."""
- self.Sizer = dSizer.dSizer("vertical")
+ szCls = self.Parent.PageSizerClass
+ if szCls is not None:
+ self.Sizer = szCls("vertical")
def _createItems(self):
Modified: trunk/dabo/ui/uiwx/dPageFrameMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dPageFrameMixin.py 2006-10-08 23:23:06 UTC (rev
2317)
+++ trunk/dabo/ui/uiwx/dPageFrameMixin.py 2006-10-08 23:32:52 UTC (rev
2318)
@@ -14,6 +14,7 @@
class dPageFrameMixin(cm.dControlMixin):
"""Creates a container for an unlimited number of pages."""
def _initEvents(self):
+ self._pageSizerClass = dabo.ui.dSizer
super(dPageFrameMixin, self)._initEvents()
self.Bind(self._evtPageChanged, self.__onPageChanged)
self.bindEvent(dEvents.Create, self.__onCreate)
@@ -284,6 +285,16 @@
return [self.GetPage(pg) for pg in range(self.PageCount)]
+ def _getPageSizerClass(self):
+ return self._pageSizerClass
+
+ def _setPageSizerClass(self, val):
+ if self._constructed():
+ self._pageSizerClass = val
+ else:
+ self._properties["PageSizerClass"] = val
+
+
def _getSelectedPage(self):
try:
ret = self.GetPage(self.GetSelection())
@@ -353,6 +364,11 @@
Pages = property(_getPgs, None, None,
_("Returns a list of the contained pages. (list)") )
+ PageSizerClass = property(_getPageSizerClass, _setPageSizerClass, None,
+ _("""Default sizer class for pages added automatically
to this control. Set
+ this to None to prevent sizers from being automatically
added to child
+ pages. (dSizer or None)"""))
+
SelectedPage = property(_getSelectedPage, _setSelectedPage, None,
_("References the current frontmost page. (dPage)") )
Modified: trunk/dabo/ui/uiwx/dPageFrameNoTabs.py
===================================================================
--- trunk/dabo/ui/uiwx/dPageFrameNoTabs.py 2006-10-08 23:23:06 UTC (rev
2317)
+++ trunk/dabo/ui/uiwx/dPageFrameNoTabs.py 2006-10-08 23:32:52 UTC (rev
2318)
@@ -16,6 +16,7 @@
"""
def __init__(self, *args, **kwargs):
self._pageClass = dPage
+ self._pageSizerClass = dabo.ui.dSizer
self._activePage = None
self._pages = []
super(dPageFrameNoTabs, self).__init__(*args, **kwargs)
@@ -200,6 +201,16 @@
return self._pages
+ def _getPageSizerClass(self):
+ return self._pageSizerClass
+
+ def _setPageSizerClass(self, val):
+ if self._constructed():
+ self._pageSizerClass = val
+ else:
+ self._properties["PageSizerClass"] = val
+
+
def _getSel(self):
try:
return self._activePage
@@ -227,6 +238,11 @@
Pages = property(_getPages, None, None,
_("List of all the pages. (list)") )
+ PageSizerClass = property(_getPageSizerClass, _setPageSizerClass, None,
+ _("""Default sizer class for pages added automatically
to this control. Set
+ this to None to prevent sizers from being automatically
added to child
+ pages. (dSizer or None)"""))
+
SelectedPage = property(_getSel, _setSel, None,
_("Returns a reference to the currently displayed page
(dPage | dPanel)") )
Modified: trunk/dabo/ui/uiwx/dPanel.py
===================================================================
--- trunk/dabo/ui/uiwx/dPanel.py 2006-10-08 23:23:06 UTC (rev 2317)
+++ trunk/dabo/ui/uiwx/dPanel.py 2006-10-08 23:32:52 UTC (rev 2318)
@@ -121,6 +121,15 @@
pass
+ def _getChildren(self):
+ ret = super(dScrollPanel, self)._getChildren()
+ return [kid for kid in ret
+ if isinstance(kid,
dabo.ui.dPemMixinBase.dPemMixinBase)]
+
+ def _setChildren(self, val):
+ super(dScrollPanel, self)._setChildren(val)
+
+
def _getHorizontalScroll(self):
return self._horizontalScroll
@@ -137,12 +146,18 @@
self.EnableScrolling(self._horizontalScroll,
self._verticalScroll)
+ Children = property(_getChildren, _setChildren, None,
+ _("""Child controls of this panel. This excludes the
wx-specific
+ scroll bars (list of objects)"""))
+
HorizontalScroll = property(_getHorizontalScroll, _setHorizontalScroll,
None,
_("Controls whether this object will scroll
horizontally (default=True) (bool)"))
- DynamicHorizontalScroll = makeDynamicProperty(HorizontalScroll)
VerticalScroll = property(_getVerticalScroll, _setVerticalScroll, None,
_("Controls whether this object will scroll vertically
(default=True) (bool)"))
+
+
+ DynamicHorizontalScroll = makeDynamicProperty(HorizontalScroll)
DynamicVerticalScroll = makeDynamicProperty(VerticalScroll)
Modified: trunk/dabo/ui/uiwx/dPemMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dPemMixin.py 2006-10-08 23:23:06 UTC (rev 2317)
+++ trunk/dabo/ui/uiwx/dPemMixin.py 2006-10-08 23:32:52 UTC (rev 2318)
@@ -787,6 +787,10 @@
l, t = 0, 0
else:
l, t = pos
+ # If the container is a page, we need to use its containing
+ # pageframe/pagelist, etc.
+ if isinstance(cnt, dabo.ui.dPage):
+ cnt = cnt.Parent
p = self
found = False
while (p is not None):
@@ -809,7 +813,7 @@
return (l, t)
- def objectCoordinates(self, cnt, pos=None):
+ def objectCoordinates(self, pos=None):
"""Given a position relative to the form, return a position
relative
to this object. If no position is passed, returns the position
of this control relative to the form.
@@ -826,13 +830,17 @@
return (x, y)
- def absoluteCoordinates(self, pos):
+ def absoluteCoordinates(self, pos=None):
"""Translates a position value for a control to absolute screen
position."""
+ if pos is None:
+ pos = self.Position
return self.ClientToScreen(pos)
- def relativeCoordinates(self, pos):
+ def relativeCoordinates(self, pos=None):
"""Translates an absolute screen position to position value for
a control."""
+ if pos is None:
+ pos = self.Position
return self.ScreenToClient(pos)
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev