dabo Commit
Revision 3554
Date: 2007-10-23 14:06:00 -0700 (Tue, 23 Oct 2007)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/3554
Changed:
A trunk/demo/samples/dHtmlBox.py
A trunk/demo/samples/dHyperLink.py
Log:
Added two more controls to the demo: dHyperLink and dHtmlBox.
Diff:
Added: trunk/demo/samples/dHtmlBox.py
===================================================================
--- trunk/demo/samples/dHtmlBox.py (rev 0)
+++ trunk/demo/samples/dHtmlBox.py 2007-10-23 21:06:00 UTC (rev 3554)
@@ -0,0 +1,63 @@
+# -*- coding: utf-8 -*-
+import datetime
+import dabo
+dabo.ui.loadUI("wx")
+import dabo.dEvents as dEvents
+from dabo.dLocalize import _
+
+
+class TestPanel(dabo.ui.dPanel):
+ def afterInit(self):
+ sz = self.Sizer = dabo.ui.dSizer("v")
+ sz.appendSpacer(25)
+
+ hb = dabo.ui.dHtmlBox(self)
+ sz.append(hb, 2, "x", border=10)
+ sz.appendSpacer(10)
+
+ lbl = dabo.ui.dLabel(self, FontBold=True, FontItalic=True,
ForeColor="blue", WordWrap=True,
+ Caption="Edit the HTML below, and then press
'TAB' to have the HTML updated in the dHtmlBox above.")
+ sz.append(lbl, halign="center")
+ sz.appendSpacer(2)
+
+ eb = dabo.ui.dEditBox(self)
+ sz.append1x(eb, border=10, borderSides=["left", "right"])
+ sz.appendSpacer(5)
+
+ eb.DataSource = hb
+ eb.DataField = "Source"
+ eb.Value = """<html>
+<body bgcolor="#ACAA60">
+<center>
+ <table bgcolor="#AACCFF" width="100%%" cellspacing="0" cellpadding="0"
+ border="1">
+ <tr>
+ <td align="center"><h1>dHtmlBox</h1></td>
+ </tr>
+ </table>
+</center>
+<p><b><font size="160%%" color="#FFFFFF">dHtmlBox</font></b> is a Dabo UI
widget that is designed to display html text.
+Be careful, though, because the widget doesn't support advanced functions like
+Javascript parsing.</p>
+<p>It's better to think of it as a way to display <b>rich text</b> using
+<font size="+1" color="#993300">HTML markup</font>, rather
+than a web browser replacement.</p>
+
+<p> </p>
+<div align="center"><img src="daboIcon.ico"></div>
+
+<p align="center"><b><a href="http://dabodev.com">Dabo</a></b> is brought to
you by <b>Ed Leafe</b>, <b>Paul McNett</b>,
+and others in the open source community. Copyright © 2004-%s
+</p>
+</body>
+</html>
+""" % datetime.date.today().year
+
+
+category = "Controls.dHtmlBox"
+
+overview = """
+<b>dHtmlBox</b> creates a scrolled panel that can load and display html pages
+
+The Html Window can load any html text, file, or url that is fed to it. It is
somewhat limited in the complexity of HTML that it can render; it doesn't
understand CSS or JavaScript. It's best to think of this not as a web browser,
but as a way to display rich text that happens to be formatted with HTML markup.
+"""
Property changes on: trunk/demo/samples/dHtmlBox.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/demo/samples/dHyperLink.py
===================================================================
--- trunk/demo/samples/dHyperLink.py (rev 0)
+++ trunk/demo/samples/dHyperLink.py 2007-10-23 21:06:00 UTC (rev 3554)
@@ -0,0 +1,157 @@
+# -*- coding: utf-8 -*-
+import datetime
+import dabo
+dabo.ui.loadUI("wx")
+import dabo.dEvents as dEvents
+from dabo.dLocalize import _
+
+
+class TestPanel(dabo.ui.dPanel):
+ def afterInit(self):
+ sz = self.Sizer = dabo.ui.dSizer("v")
+ sz.appendSpacer(20)
+
+ lbl = dabo.ui.dLabel(self, FontItalic=True,
+ WordWrap=True, Caption="Click on the link below
to launch the URL in your default browser.")
+ lbl.FontSize += 2
+ sz.append(lbl, halign="center")
+ sz.appendSpacer(5)
+
+ bs = dabo.ui.dBorderSizer(self)
+ lnk = self.link = dabo.ui.dHyperLink(self, Caption="The Dabo
Wiki", FontSize=24,
+ URL="http://dabodev.com/wiki/",
LinkColor="olive",
+ VisitedColor="maroon", HoverColor="crimson",
LinkUnderline=True,
+ HoverUnderline=False, VisitedUnderline=True)
+ bs.append(lnk, border=20)
+ sz.append(bs, halign="center")
+ sz.appendSpacer(20)
+
+ bs = dabo.ui.dBorderSizer(self, "v", Caption="Hyperlink
Properties",
+ DefaultSpacing=8)
+
+ class ColorPropPanel(dabo.ui.dPanel):
+ def beforeInit(self):
+ self._colorProp = ""
+
+ def afterInit(self):
+ hs = self.Sizer = dabo.ui.dSizer("h",
DefaultSpacing=4)
+ pnl = dabo.ui.dPanel(self, Size=(25,15),
BorderWidth=1, BorderColor="black",
+ DynamicBackColor=self.getColor)
+ lbl = self.lbl = dabo.ui.dLabel(self, Width=100,
+
DynamicCaption=lambda:self._colorProp)
+ txt = dabo.ui.dTextBox(self,
DynamicValue=self.getColor)
+ btn = dabo.ui.dButton(self, Width=30,
Caption="...", OnHit=self.changeColor)
+ hs.append(lbl, valign="middle")
+ hs.append(pnl, valign="middle")
+ hs.append(txt, valign="middle")
+ hs.append(btn, valign="middle")
+ self.layout()
+
+ def changeColor(self, evt):
+ self.Parent.changeColor(self.ColorProp)
+
+ def getColor(self):
+ return self.Parent.getColor(self.ColorProp)
+
+ def _getColorProp(self):
+ return self._colorProp
+
+ def _setColorProp(self, val):
+ if self._constructed():
+ self._colorProp = val
+ dabo.ui.callAfter(self.update)
+ else:
+ self._properties["ColorProp"] = val
+
+ ColorProp = property(_getColorProp, _setColorProp, None,
+ _("Name of property managed by this
panel (str)"))
+ #--------- end of ColorPropPanel class definition
--------------
+
+
+ lbl = dabo.ui.dLabel(self, Caption="Caption:")
+ txt = dabo.ui.dTextBox(self, DataSource=self.link,
DataField="Caption",
+ ToolTipText="The text that appears in the
hyperlink",
+ OnValueChanged=self.Parent.layout)
+ hs = dabo.ui.dSizer("h")
+ hs.append(lbl)
+ hs.appendSpacer(3)
+ hs.append(txt, 1)
+ bs.append(hs, "x")
+
+ lbl = dabo.ui.dLabel(self, Caption="URL:")
+ txt = dabo.ui.dTextBox(self, DataSource=self.link,
DataField="URL",
+ ToolTipText="The address that your browser will
open when the link is clicked")
+ hs = dabo.ui.dSizer("h")
+ hs.append(lbl)
+ hs.appendSpacer(3)
+ hs.append(txt, 1)
+ bs.append(hs, "x")
+
+ pnl = ColorPropPanel(self, ColorProp="LinkColor")
+ bs.append(pnl)
+ chk = dabo.ui.dCheckBox(self, Caption="LinkUnderline",
DataSource=self.link,
+ DataField="LinkUnderline")
+ bs.append(chk)
+ pnl = ColorPropPanel(self, ColorProp="VisitedColor")
+ bs.append(pnl)
+ chk = dabo.ui.dCheckBox(self, Caption="VisitedUnderline",
DataSource=self.link,
+ DataField="VisitedUnderline")
+ bs.append(chk)
+ pnl = ColorPropPanel(self, ColorProp="HoverColor")
+ bs.append(pnl)
+ chk = dabo.ui.dCheckBox(self, Caption="HoverUnderline",
DataSource=self.link,
+ DataField="HoverUnderline")
+ bs.append(chk)
+ sz.append(bs, halign="center")
+ sz.appendSpacer(5)
+
+ self.Form.update()
+ self.layout()
+ self.refresh()
+
+ def changeColor(self, prop):
+ color = self.getColor(prop)
+ newColor = dabo.ui.getColor(color)
+ if newColor:
+ self.link.__setattr__(prop, newColor)
+ self.update()
+
+ def getColor(self, prop):
+ return self.link.__getattribute__(prop)
+
+
+category = "Controls.dHyperLink"
+
+overview = """
+<b>dHyperLink</b> creates a text link that, when clicked, launches the
specified URL in the user's default browser.
+"""
+
+
+
+# HoverColor = property(_getHoverColor, _setHoverColor, None,
+# _("Color of the link when the mouse passes over it.
(str or tuple)"))
+#
+# HoverUnderline = property(_getHoverUnderline, _setHoverUnderline, None,
+# _("Is the link underlined when the mouse passes over
it? (bool)"))
+#
+# LinkColor = property(_getLinkColor, _setLinkColor, None,
+# _("Normal (unvisited) link text color. (str or
tuple)"))
+#
+# LinkUnderline = property(_getLinkUnderline, _setLinkUnderline, None,
+# _("Is the link underlined in the normal state?
(bool)"))
+#
+# ShowHover = property(_getShowHover, _setShowHover, None,
+# _("Does the link show the hover effect? (bool)"))
+#
+# URL = property(_getURL, _setURL, None,
+# _("URL for this link (str)"))
+#
+# Visited = property(_getVisited, _setVisited, None,
+# _("Has this link been visited? (bool)"))
+#
+# VisitedColor = property(_getVisitedColor, _setVisitedColor, None,
+# _("Color of visited links (str or tuple)"))
+#
+# VisitedUnderline = property(_getVisitedUnderline, _setVisitedUnderline,
None,
+# _("Is the link underlined in the visited state?
(bool)"))
+#
Property changes on: trunk/demo/samples/dHyperLink.py
___________________________________________________________________
Name: svn:eol-style
+ native
_______________________________________________
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/dabo-dev/[EMAIL PROTECTED]