dabo Commit
Revision 5819
Date: 2010-05-18 08:08:37 -0700 (Tue, 18 May 2010)
Author: Ed
Trac: http://trac.dabodev.com/changeset/5819

Changed:
A   trunk/demo/samples/dDockTabs.py
A   trunk/demo/samples/dPageFrame.py
A   trunk/demo/samples/dPageList.py
A   trunk/demo/samples/dPageSelect.py
U   trunk/demo/samples/dPageStyled.py
A   trunk/demo/samples/dPageToolBar.py

Log:
Added demo samples for all the other paged controls.

Diff:
Added: trunk/demo/samples/dDockTabs.py
===================================================================
--- trunk/demo/samples/dDockTabs.py                             (rev 0)
+++ trunk/demo/samples/dDockTabs.py     2010-05-18 15:08:37 UTC (rev 5819)
@@ -0,0 +1,63 @@
+# -*- coding: utf-8 -*-
+import dabo
+dabo.ui.loadUI("wx")
+import dabo.dEvents as dEvents
+from dabo.dLocalize import _
+
+
+class TestPanel(dabo.ui.dPanel):
+       def afterInit(self):
+               self.currentTabPosition = "Top"
+               sz = self.Sizer = dabo.ui.dSizer("v")
+               pgf = self.createDockTabs()
+               sz.appendSpacer(10)
+               hsz = dabo.ui.dSizer("h")
+               lbl = dabo.ui.dLabel(self, Caption="Tab Position:")
+               dd = self.ddPos = dabo.ui.dDropdownList(self, Choices=["Top", 
"Bottom"],
+                               DataSource=pgf, DataField="TabPosition")
+               hsz.append(lbl)
+               hsz.appendSpacer(3)
+               hsz.append(dd)
+               sz.append(hsz, halign="center")
+               sz.appendSpacer(20)
+
+       def createDockTabs(self):
+               try:
+                       self.pgf.release()
+               except AttributeError:
+                       pass
+               self.pgf = dabo.ui.dDockTabs(self, 
TabPosition=self.currentTabPosition,
+                               OnPageChanged=self.onPageChanged)
+               # Now add the pages, specifying which image key is displayed 
for each page.
+               pg = self.pgf.appendPage(caption="First")
+               pg.BackColor = "blue"
+               pg = self.pgf.appendPage(caption="Second")
+               pg.BackColor = "salmon"
+               pg = self.pgf.appendPage(caption="Third")
+               pg.BackColor = "darkred"
+               pg = self.pgf.appendPage(caption="Fourth")
+               pg.BackColor = "green"
+               self.Sizer.insert(0, self.pgf, "x", 1)
+               self.layout()
+               return self.pgf
+
+       def onPageChanged(self, evt):
+               self.Form.logit("Page number changed from %s to %s" % 
+                               (evt.oldPageNum, evt.newPageNum))
+
+
+
+category = "Controls.dDockTabs"
+
+overview = """
+<p><b>Paged Controls</b> allow you to organize the visual presentation of
+your data and UI controls onto separate 'pages' that are selected by various
+means. Only one page is visible at any given time.</p>
+
+<p><b>dDockTabs</b> is a variation on the common tabbed page control.
+The tabs are fully draggable, allowing you to not only re-arrange their order, 
but
+also detach them and dock their page to any edge of the control. You can place 
the 
+tabs at the top or bottom of the pages, and change that interactively. 
dDockTabs
+does not support tabs on the left or right sides, though.
+</p>
+"""

Added: trunk/demo/samples/dPageFrame.py
===================================================================
--- trunk/demo/samples/dPageFrame.py                            (rev 0)
+++ trunk/demo/samples/dPageFrame.py    2010-05-18 15:08:37 UTC (rev 5819)
@@ -0,0 +1,104 @@
+# -*- coding: utf-8 -*-
+import dabo
+dabo.ui.loadUI("wx")
+import dabo.dEvents as dEvents
+from dabo.dLocalize import _
+
+
+class TestPanel(dabo.ui.dPanel):
+       def afterInit(self):
+               self.currentTabPosition = "Top"
+               sz = self.Sizer = dabo.ui.dSizer("v")
+               pgf = self.createPageFrame()
+               sz.appendSpacer(10)
+               hsz = dabo.ui.dSizer("h")
+               lbl = dabo.ui.dLabel(self, Caption="Tab Position:")
+               dd = self.ddPos = dabo.ui.dDropdownList(self, Choices=["Top", 
"Right", "Bottom", "Left"],
+                               Value=self.currentTabPosition, 
OnHit=self.onNewPosition)
+               hsz.append(lbl)
+               hsz.appendSpacer(3)
+               hsz.append(dd)
+               sz.append(hsz, halign="center")
+               sz.appendSpacer(20)
+
+       def createPageFrame(self):
+               try:
+                       self.pgf.release()
+               except AttributeError:
+                       pass
+               self.pgf = dabo.ui.dPageFrame(self, 
TabPosition=self.currentTabPosition,
+                               OnPageChanged=self.onPageChanged)
+               self.pgf.appendPage(caption="First", BackColor="blue")
+               self.pgf.appendPage(caption="Second", BackColor="salmon")
+               self.pgf.appendPage(caption="Third", BackColor="darkred")
+               self.pgf.appendPage(caption="Fourth", BackColor="green")
+               self.Sizer.insert(0, self.pgf, "x", 1)
+               self.layout()
+               return self.pgf
+
+       def onPageChanged(self, evt):
+               self.Form.logit("Page number changed from %s to %s" % 
+                               (evt.oldPageNum, evt.newPageNum))
+
+       def onNewPosition(self, evt):
+               newpos = evt.EventObject.StringValue
+               if newpos != self.currentTabPosition:
+                       # Notify the user the first time.
+                       try:
+                               self.Form.seenTabPositionWarning
+                       except AttributeError:
+                               self.Form.seenTabPositionWarning = True
+                               msg = """TabPosition must be defined when the 
control
+is created, and cannot be changed afterwards. 
+
+The current dPageFrame control will be destroyed,
+and a new control with the position you selected
+will then be created."""
+                               dabo.ui.info(msg, "TabPosition Limitation")
+                       self.currentTabPosition = newpos
+                       self.createPageFrame()
+                       # Need to update the 
+
+#              gsz = dabo.ui.dGridSizer(MaxCols=2)
+#              for num, pos in enumerate(("Top", "Right", "Bottom", "Left")):
+#                      pgf = dabo.ui.dPageFrame(self, TabPosition=pos,
+#                              OnPageChanged=self.onPageChanged)
+#                      pgf.appendPage(caption="First", BackColor="blue")
+#                      pgf.appendPage(caption="Second", BackColor="salmon")
+#                      pgf.appendPage(caption="Third", BackColor="darkred")
+#                      pgf.appendPage(caption="Fourth", BackColor="green")
+#                      pgf.SelectedPageNumber = num
+#                      bsz = dabo.ui.dBorderSizer(self, Caption=pos)
+#                      bsz.append1x(pgf)
+#                      gsz.append(bsz, "x", border=10)
+#              gsz.setColExpand(True, "all")
+#              gsz.setRowExpand(True, "all")
+#              self.Sizer.append1x(gsz)
+# 
+#      def onPageChanged(self, evt):
+#              self.Form.logit("TabPosition: %s; page number changed from %s 
to %s" % 
+#                              (evt.EventObject.TabPosition, evt.oldPageNum, 
evt.newPageNum))
+
+
+category = "Controls.dPageFrame"
+
+overview = """
+<p><b>Paged Controls</b> allow you to organize the visual presentation of
+your data and UI controls onto separate 'pages' that are selected by various
+means. Only one page is visible at any given time.</p>
+
+<p>The following are all the paged control classes in Dabo:
+<ul>
+       <li>dPageFrame</li>
+       <li>dPageToolBar</li>
+       <li>dPageList</li>
+       <li>dPageSelect</li>
+       <li>dDockTabs</li>
+</ul>
+</p>
+
+<p><b>dPageFrame</b> is the most basic of the paged controls. The user can
+select the page they want by clicking on one of several tabs that are located 
along
+one edge of the control. Each page can have a Caption that will be displayed on
+the tab. The appearance of the tabs is controlled by the OS, not Dabo.</p>
+"""

Added: trunk/demo/samples/dPageList.py
===================================================================
--- trunk/demo/samples/dPageList.py                             (rev 0)
+++ trunk/demo/samples/dPageList.py     2010-05-18 15:08:37 UTC (rev 5819)
@@ -0,0 +1,73 @@
+# -*- coding: utf-8 -*-
+import dabo
+dabo.ui.loadUI("wx")
+import dabo.dEvents as dEvents
+from dabo.dLocalize import _
+
+
+class TestPanel(dabo.ui.dPanel):
+       def afterInit(self):
+               self.currentTabPosition = "Top"
+               sz = self.Sizer = dabo.ui.dSizer("v")
+               pgf = self.createPageList()
+               sz.appendSpacer(10)
+               hsz = dabo.ui.dSizer("h")
+               lbl = dabo.ui.dLabel(self, Caption="Tab Position:")
+               dd = self.ddPos = dabo.ui.dDropdownList(self, Choices=["Top", 
"Right", "Bottom", "Left"],
+                               Value=self.currentTabPosition, 
OnHit=self.onNewPosition)
+               hsz.append(lbl)
+               hsz.appendSpacer(3)
+               hsz.append(dd)
+               sz.append(hsz, halign="center")
+               sz.appendSpacer(20)
+
+       def createPageList(self):
+               try:
+                       self.pgf.release()
+               except AttributeError:
+                       pass
+               self.pgf = dabo.ui.dPageList(self, 
TabPosition=self.currentTabPosition,
+                               OnPageChanged=self.onPageChanged)
+               # Now add the pages, specifying which image key is displayed 
for each page.
+               self.pgf.appendPage(caption="First", BackColor="blue")
+               self.pgf.appendPage(caption="Second", BackColor="salmon")
+               self.pgf.appendPage(caption="Third", BackColor="darkred")
+               self.pgf.appendPage(caption="Fourth", BackColor="green")
+               self.Sizer.insert(0, self.pgf, "x", 1)
+               self.layout()
+               return self.pgf
+
+       def onPageChanged(self, evt):
+               self.Form.logit("Page number changed from %s to %s" % 
+                               (evt.oldPageNum, evt.newPageNum))
+
+       def onNewPosition(self, evt):
+               newpos = evt.EventObject.StringValue
+               if newpos != self.currentTabPosition:
+                       # Notify the user the first time.
+                       try:
+                               self.Form.seenTabPositionWarning
+                       except AttributeError:
+                               self.Form.seenTabPositionWarning = True
+                               msg = """TabPosition must be defined when the 
control
+is created, and cannot be changed afterwards. 
+
+The current dPageList control will be destroyed,
+and a new control with the position you selected
+will then be created."""
+                               dabo.ui.info(msg, "TabPosition Limitation")
+                       self.currentTabPosition = newpos
+                       self.createPageList()
+
+
+category = "Controls.dPageList"
+
+overview = """
+<p><b>Paged Controls</b> allow you to organize the visual presentation of
+your data and UI controls onto separate 'pages' that are selected by various
+means. Only one page is visible at any given time.</p>
+
+<p><b>dPageList</b> is a variation on the common tabbed page control.
+Instead of tabs, a list of the captions for the control's pages is used to 
select the
+page to display. The list is displayed along one edge of the control.</p>
+"""

Added: trunk/demo/samples/dPageSelect.py
===================================================================
--- trunk/demo/samples/dPageSelect.py                           (rev 0)
+++ trunk/demo/samples/dPageSelect.py   2010-05-18 15:08:37 UTC (rev 5819)
@@ -0,0 +1,74 @@
+# -*- coding: utf-8 -*-
+import dabo
+dabo.ui.loadUI("wx")
+import dabo.dEvents as dEvents
+from dabo.dLocalize import _
+
+
+class TestPanel(dabo.ui.dPanel):
+       def afterInit(self):
+               self.currentTabPosition = "Top"
+               sz = self.Sizer = dabo.ui.dSizer("v")
+               pgf = self.createPageSelect()
+               sz.appendSpacer(10)
+               hsz = dabo.ui.dSizer("h")
+               lbl = dabo.ui.dLabel(self, Caption="Tab Position:")
+               dd = self.ddPos = dabo.ui.dDropdownList(self, Choices=["Top", 
"Right", "Bottom", "Left"],
+                               Value=self.currentTabPosition, 
OnHit=self.onNewPosition)
+               hsz.append(lbl)
+               hsz.appendSpacer(3)
+               hsz.append(dd)
+               sz.append(hsz, halign="center")
+               sz.appendSpacer(20)
+
+       def createPageSelect(self):
+               try:
+                       self.pgf.release()
+               except AttributeError:
+                       pass
+               self.pgf = dabo.ui.dPageSelect(self, 
TabPosition=self.currentTabPosition,
+                               OnPageChanged=self.onPageChanged)
+               # Now add the pages, specifying which image key is displayed 
for each page.
+               self.pgf.appendPage(caption="First", BackColor="blue")
+               self.pgf.appendPage(caption="Second", BackColor="salmon")
+               self.pgf.appendPage(caption="Third", BackColor="darkred")
+               self.pgf.appendPage(caption="Fourth", BackColor="green")
+               self.Sizer.insert(0, self.pgf, "x", 1)
+               self.layout()
+               return self.pgf
+
+       def onPageChanged(self, evt):
+               self.Form.logit("Page number changed from %s to %s" % 
+                               (evt.oldPageNum, evt.newPageNum))
+
+       def onNewPosition(self, evt):
+               newpos = evt.EventObject.StringValue
+               if newpos != self.currentTabPosition:
+                       # Notify the user the first time.
+                       try:
+                               self.Form.seenTabPositionWarning
+                       except AttributeError:
+                               self.Form.seenTabPositionWarning = True
+                               msg = """TabPosition must be defined when the 
control
+is created, and cannot be changed afterwards. 
+
+The current dPageSelect control will be destroyed,
+and a new control with the position you selected
+will then be created."""
+                               dabo.ui.info(msg, "TabPosition Limitation")
+                       self.currentTabPosition = newpos
+                       self.createPageSelect()
+
+
+category = "Controls.dPageSelect"
+
+overview = """
+<p><b>Paged Controls</b> allow you to organize the visual presentation of
+your data and UI controls onto separate 'pages' that are selected by various
+means. Only one page is visible at any given time.</p>
+
+<p><b>dPageSelect</b> is a variation on the common tabbed page control.
+Instead of tabs, a dropdown list control containing the captions for the 
control's
+pages is used to select the page to display. The dropdown is displayed along 
one
+edge of the control.</p>
+"""

Modified: trunk/demo/samples/dPageStyled.py
===================================================================
--- trunk/demo/samples/dPageStyled.py   2010-05-17 14:34:01 UTC (rev 5818)
+++ trunk/demo/samples/dPageStyled.py   2010-05-18 15:08:37 UTC (rev 5819)
@@ -156,5 +156,23 @@
 category = "Controls.dPageStyled"
 
 overview = """
-Styled Paged Control
+<p><b>Paged Controls</b> allow you to organize the visual presentation of
+your data and UI controls onto separate 'pages' that are selected by various
+means. Only one page is visible at any given time.</p>
+
+<p>The <b>dPageStyled</b> control is not a native control, but rather one
+that was created by Andrea Gavana and later incorporated into wxPython as
+the <b>Flat Notebook</b> control. We wrapped it an renamed it to be consistent
+with our other paged controls.</p>
+
+<p>This control has several properties that control the appearance of the tabs,
+as well as several other optional controls that can appear in the tab area. 
This demo
+is designed to demonstrate the effect of changing these properties. Please note
+that some properties only have an effect with certain TabStyle settings.</p>
+
+<p>Unlike the other paged controls, you can change the <b>TabPosition</b>
+property after the control has been created, although I can't imagine any
+user-friendly interface where that would be needed. Also, you are limited
+to Top and Bottom for tab positions; tabs along the sides is not supported.
+You can also re-order the tabs by dragging them to their new position.</p>
 """

Added: trunk/demo/samples/dPageToolBar.py
===================================================================
--- trunk/demo/samples/dPageToolBar.py                          (rev 0)
+++ trunk/demo/samples/dPageToolBar.py  2010-05-18 15:08:37 UTC (rev 5819)
@@ -0,0 +1,85 @@
+# -*- coding: utf-8 -*-
+import dabo
+dabo.ui.loadUI("wx")
+import dabo.dEvents as dEvents
+from dabo.dLocalize import _
+
+
+class TestPanel(dabo.ui.dPanel):
+       def afterInit(self):
+               self.currentTabPosition = "Top"
+               sz = self.Sizer = dabo.ui.dSizer("v")
+               pgf = self.createPageToolBar()
+               sz.appendSpacer(10)
+               hsz = dabo.ui.dSizer("h")
+               lbl = dabo.ui.dLabel(self, Caption="Tab Position:")
+               dd = self.ddPos = dabo.ui.dDropdownList(self, Choices=["Top", 
"Right", "Bottom", "Left"],
+                               Value=self.currentTabPosition, 
OnHit=self.onNewPosition)
+               hsz.append(lbl)
+               hsz.appendSpacer(3)
+               hsz.append(dd)
+               sz.append(hsz, halign="center")
+               sz.appendSpacer(20)
+
+       def createPageToolBar(self):
+               try:
+                       self.pgf.release()
+               except AttributeError:
+                       pass
+               self.pgf = dabo.ui.dPageToolBar(self, 
TabPosition=self.currentTabPosition,
+                               OnPageChanged=self.onPageChanged)
+               # Add each image to the control, along with a string to use as 
a key value.
+               self.pgf.addImage("themes/tango/32x32/actions/go-home.png", 
"First")
+               self.pgf.addImage("themes/tango/32x32/actions/edit-clear.png", 
"Second")
+               
self.pgf.addImage("themes/tango/32x32/actions/software-update-available.png", 
"Third")
+               
self.pgf.addImage("themes/tango/32x32/actions/dialog-information.png", "Fourth")
+               # Now add the pages, specifying which image key is displayed 
for each page.
+               self.pgf.appendPage(caption="First", imgKey="First", 
BackColor="blue")
+               self.pgf.appendPage(caption="Second", imgKey="Second", 
BackColor="salmon")
+               self.pgf.appendPage(caption="Third", imgKey="Third", 
BackColor="darkred")
+               self.pgf.appendPage(caption="Fourth", imgKey="Fourth", 
BackColor="green")
+               self.Sizer.insert(0, self.pgf, "x", 1)
+               self.layout()
+               return self.pgf
+
+       def onPageChanged(self, evt):
+               self.Form.logit("Page number changed from %s to %s" % 
+                               (evt.oldPageNum, evt.newPageNum))
+
+       def onNewPosition(self, evt):
+               newpos = evt.EventObject.StringValue
+               if newpos != self.currentTabPosition:
+                       # Notify the user the first time.
+                       try:
+                               self.Form.seenTabPositionWarning
+                       except AttributeError:
+                               self.Form.seenTabPositionWarning = True
+                               msg = """TabPosition must be defined when the 
control
+is created, and cannot be changed afterwards. 
+
+The current dPageToolBar control will be destroyed,
+and a new control with the position you selected
+will then be created."""
+                               dabo.ui.info(msg, "TabPosition Limitation")
+                       self.currentTabPosition = newpos
+                       self.createPageToolBar()
+
+
+category = "Controls.dPageToolBar"
+
+overview = """
+<p><b>Paged Controls</b> allow you to organize the visual presentation of
+your data and UI controls onto separate 'pages' that are selected by various
+means. Only one page is visible at any given time.</p>
+
+<p><b>dPageToolBar</b> is a variation on the common tabbed page control.
+Instead of tabs, a toolbar is used to select the currently displayed page. The 
user
+can select the page they want by clicking on one of the buttons in the toolbar
+that is displayed along one edge of the control. To configure the images used
+on the buttons, call the control's <b>addImage()</b> method, passing in the
+path to the desired image (32x32 pixels), and a string that will be used as the
+<b>key</b> for that image. When you add pages to the control, you also
+specify the key for the image that you want to represent that page. The page's
+Caption is not displayed directly; instead, it appears as a tooltip when you 
hover
+the mouse over the toolbar icon.</p>
+"""



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to