More lib and demo patches to drop the wx prefix (Jeff has been busy!)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24965 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -11,6 +11,15 @@
|
|||||||
#
|
#
|
||||||
# o A few changes to correct my own mistakes earlier :-).
|
# o A few changes to correct my own mistakes earlier :-).
|
||||||
#
|
#
|
||||||
|
# 12/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxMaskedTextCtrl -> MaskedTextCtrl
|
||||||
|
# o wxMaskedComboBox -> MaskedComboBox
|
||||||
|
# o wxIpAddrCtrl -> IpAddrCtrl
|
||||||
|
# o wxMaskedNumCtrl -> MaskedNumCtrl
|
||||||
|
# o wxTimeCtrl -> TimeCtrl
|
||||||
|
# o wxScrolledPanel -> ScrolledPanel
|
||||||
|
#
|
||||||
|
|
||||||
import string
|
import string
|
||||||
import sys
|
import sys
|
||||||
@@ -31,7 +40,7 @@ class demoMixin:
|
|||||||
mask = wx.StaticText( self, -1, "Mask Value" )
|
mask = wx.StaticText( self, -1, "Mask Value" )
|
||||||
formatcode = wx.StaticText( self, -1, "Format" )
|
formatcode = wx.StaticText( self, -1, "Format" )
|
||||||
regex = wx.StaticText( self, -1, "Regexp Validator(opt.)" )
|
regex = wx.StaticText( self, -1, "Regexp Validator(opt.)" )
|
||||||
ctrl = wx.StaticText( self, -1, "wxMaskedTextCtrl" )
|
ctrl = wx.StaticText( self, -1, "MaskedTextCtrl" )
|
||||||
|
|
||||||
description.SetFont( wx.Font(9, wx.SWISS, wx.NORMAL, wx.BOLD))
|
description.SetFont( wx.Font(9, wx.SWISS, wx.NORMAL, wx.BOLD))
|
||||||
mask.SetFont( wx.Font(9, wx.SWISS, wx.NORMAL, wx.BOLD))
|
mask.SetFont( wx.Font(9, wx.SWISS, wx.NORMAL, wx.BOLD))
|
||||||
@@ -54,7 +63,7 @@ class demoMixin:
|
|||||||
sizer.Add( wx.StaticText( self, -1, control[4]) )
|
sizer.Add( wx.StaticText( self, -1, control[4]) )
|
||||||
|
|
||||||
if control in controls:
|
if control in controls:
|
||||||
newControl = med.wxMaskedTextCtrl( self, -1, "",
|
newControl = med.MaskedTextCtrl( self, -1, "",
|
||||||
mask = control[1],
|
mask = control[1],
|
||||||
excludeChars = control[2],
|
excludeChars = control[2],
|
||||||
formatcodes = control[3],
|
formatcodes = control[3],
|
||||||
@@ -85,9 +94,9 @@ class demoMixin:
|
|||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
class demoPage1(scroll.wxScrolledPanel, demoMixin):
|
class demoPage1(scroll.ScrolledPanel, demoMixin):
|
||||||
def __init__(self, parent, log):
|
def __init__(self, parent, log):
|
||||||
scroll.wxScrolledPanel.__init__(self, parent, -1)
|
scroll.ScrolledPanel.__init__(self, parent, -1)
|
||||||
self.sizer = wx.BoxSizer( wx.VERTICAL )
|
self.sizer = wx.BoxSizer( wx.VERTICAL )
|
||||||
self.editList = []
|
self.editList = []
|
||||||
|
|
||||||
@@ -157,10 +166,10 @@ Smith, Jones, Williams). Signs on numbers can be toggled with the minus key.
|
|||||||
self.changeControlParams( event, "fillChar", '?', ' ' )
|
self.changeControlParams( event, "fillChar", '?', ' ' )
|
||||||
|
|
||||||
|
|
||||||
class demoPage2(scroll.wxScrolledPanel, demoMixin):
|
class demoPage2(scroll.ScrolledPanel, demoMixin):
|
||||||
def __init__( self, parent, log ):
|
def __init__( self, parent, log ):
|
||||||
self.log = log
|
self.log = log
|
||||||
scroll.wxScrolledPanel.__init__( self, parent, -1 )
|
scroll.ScrolledPanel.__init__( self, parent, -1 )
|
||||||
self.sizer = wx.BoxSizer( wx.VERTICAL )
|
self.sizer = wx.BoxSizer( wx.VERTICAL )
|
||||||
|
|
||||||
label = wx.StaticText( self, -1, """\
|
label = wx.StaticText( self, -1, """\
|
||||||
@@ -202,15 +211,15 @@ Many of these already do complicated validation; To see some examples, try
|
|||||||
self.SetupScrolling()
|
self.SetupScrolling()
|
||||||
|
|
||||||
|
|
||||||
class demoPage3(scroll.wxScrolledPanel, demoMixin):
|
class demoPage3(scroll.ScrolledPanel, demoMixin):
|
||||||
def __init__(self, parent, log):
|
def __init__(self, parent, log):
|
||||||
self.log = log
|
self.log = log
|
||||||
scroll.wxScrolledPanel.__init__(self, parent, -1)
|
scroll.ScrolledPanel.__init__(self, parent, -1)
|
||||||
self.sizer = wx.BoxSizer( wx.VERTICAL )
|
self.sizer = wx.BoxSizer( wx.VERTICAL )
|
||||||
self.editList = []
|
self.editList = []
|
||||||
|
|
||||||
label = wx.StaticText( self, -1, """\
|
label = wx.StaticText( self, -1, """\
|
||||||
Here wxMaskedTextCtrls that have default values. The states
|
Here MaskedTextCtrls that have default values. The states
|
||||||
control has a list of valid values, and the unsigned integer
|
control has a list of valid values, and the unsigned integer
|
||||||
has a legal range specified.
|
has a legal range specified.
|
||||||
""")
|
""")
|
||||||
@@ -248,10 +257,10 @@ has a legal range specified.
|
|||||||
self.changeControlParams( event, "validRequired", True, False )
|
self.changeControlParams( event, "validRequired", True, False )
|
||||||
|
|
||||||
|
|
||||||
class demoPage4(scroll.wxScrolledPanel, demoMixin):
|
class demoPage4(scroll.ScrolledPanel, demoMixin):
|
||||||
def __init__( self, parent, log ):
|
def __init__( self, parent, log ):
|
||||||
self.log = log
|
self.log = log
|
||||||
scroll.wxScrolledPanel.__init__( self, parent, -1 )
|
scroll.ScrolledPanel.__init__( self, parent, -1 )
|
||||||
self.sizer = wx.BoxSizer( wx.VERTICAL )
|
self.sizer = wx.BoxSizer( wx.VERTICAL )
|
||||||
|
|
||||||
label = wx.StaticText( self, -1, """\
|
label = wx.StaticText( self, -1, """\
|
||||||
@@ -269,7 +278,7 @@ Page Up and Shift-Up arrow will similarly cycle backwards through the list.
|
|||||||
description = wx.StaticText( self, -1, "Description" )
|
description = wx.StaticText( self, -1, "Description" )
|
||||||
autofmt = wx.StaticText( self, -1, "AutoFormat Code" )
|
autofmt = wx.StaticText( self, -1, "AutoFormat Code" )
|
||||||
fields = wx.StaticText( self, -1, "Field Objects" )
|
fields = wx.StaticText( self, -1, "Field Objects" )
|
||||||
ctrl = wx.StaticText( self, -1, "wxMaskedTextCtrl" )
|
ctrl = wx.StaticText( self, -1, "MaskedTextCtrl" )
|
||||||
|
|
||||||
description.SetFont( wx.Font( 9, wx.SWISS, wx.NORMAL, wx.BOLD ) )
|
description.SetFont( wx.Font( 9, wx.SWISS, wx.NORMAL, wx.BOLD ) )
|
||||||
autofmt.SetFont( wx.Font( 9, wx.SWISS, wx.NORMAL, wx.BOLD ) )
|
autofmt.SetFont( wx.Font( 9, wx.SWISS, wx.NORMAL, wx.BOLD ) )
|
||||||
@@ -292,7 +301,7 @@ Page Up and Shift-Up arrow will similarly cycle backwards through the list.
|
|||||||
grid.Add( wx.StaticText( self, -1, "Restricted Area Code"), 0, wx.ALIGN_LEFT )
|
grid.Add( wx.StaticText( self, -1, "Restricted Area Code"), 0, wx.ALIGN_LEFT )
|
||||||
grid.Add( wx.StaticText( self, -1, autoformat), 0, wx.ALIGN_LEFT )
|
grid.Add( wx.StaticText( self, -1, autoformat), 0, wx.ALIGN_LEFT )
|
||||||
grid.Add( wx.StaticText( self, -1, fieldsLabel), 0, wx.ALIGN_LEFT )
|
grid.Add( wx.StaticText( self, -1, fieldsLabel), 0, wx.ALIGN_LEFT )
|
||||||
grid.Add( med.wxMaskedTextCtrl( self, -1, "",
|
grid.Add( med.MaskedTextCtrl( self, -1, "",
|
||||||
autoformat = autoformat,
|
autoformat = autoformat,
|
||||||
fields = fieldsDict,
|
fields = fieldsDict,
|
||||||
demo = True,
|
demo = True,
|
||||||
@@ -305,7 +314,7 @@ Page Up and Shift-Up arrow will similarly cycle backwards through the list.
|
|||||||
{1: Field(choices=[
|
{1: Field(choices=[
|
||||||
"03", "04", "05"],
|
"03", "04", "05"],
|
||||||
choiceRequired=True)}"""
|
choiceRequired=True)}"""
|
||||||
exp = med.wxMaskedTextCtrl( self, -1, "",
|
exp = med.MaskedTextCtrl( self, -1, "",
|
||||||
autoformat = autoformat,
|
autoformat = autoformat,
|
||||||
fields = fieldsDict,
|
fields = fieldsDict,
|
||||||
demo = True,
|
demo = True,
|
||||||
@@ -324,7 +333,7 @@ Page Up and Shift-Up arrow will similarly cycle backwards through the list.
|
|||||||
1: Field(choices=["1234", "5678"],
|
1: Field(choices=["1234", "5678"],
|
||||||
choiceRequired=False)}"""
|
choiceRequired=False)}"""
|
||||||
autoformat = "USZIPPLUS4"
|
autoformat = "USZIPPLUS4"
|
||||||
zip = med.wxMaskedTextCtrl( self, -1, "",
|
zip = med.MaskedTextCtrl( self, -1, "",
|
||||||
autoformat = autoformat,
|
autoformat = autoformat,
|
||||||
fields = fieldsDict,
|
fields = fieldsDict,
|
||||||
demo = True,
|
demo = True,
|
||||||
@@ -341,15 +350,15 @@ Page Up and Shift-Up arrow will similarly cycle backwards through the list.
|
|||||||
self.SetupScrolling()
|
self.SetupScrolling()
|
||||||
|
|
||||||
|
|
||||||
class demoPage5(scroll.wxScrolledPanel, demoMixin):
|
class demoPage5(scroll.ScrolledPanel, demoMixin):
|
||||||
def __init__( self, parent, log ):
|
def __init__( self, parent, log ):
|
||||||
self.log = log
|
self.log = log
|
||||||
scroll.wxScrolledPanel.__init__( self, parent, -1 )
|
scroll.ScrolledPanel.__init__( self, parent, -1 )
|
||||||
self.sizer = wx.BoxSizer( wx.VERTICAL )
|
self.sizer = wx.BoxSizer( wx.VERTICAL )
|
||||||
|
|
||||||
|
|
||||||
labelMaskedCombos = wx.StaticText( self, -1, """\
|
labelMaskedCombos = wx.StaticText( self, -1, """\
|
||||||
These are some examples of wxMaskedComboBox:""")
|
These are some examples of MaskedComboBox:""")
|
||||||
labelMaskedCombos.SetForegroundColour( "Blue" )
|
labelMaskedCombos.SetForegroundColour( "Blue" )
|
||||||
|
|
||||||
|
|
||||||
@@ -357,7 +366,7 @@ These are some examples of wxMaskedComboBox:""")
|
|||||||
A state selector; only
|
A state selector; only
|
||||||
"legal" values can be
|
"legal" values can be
|
||||||
entered:""")
|
entered:""")
|
||||||
statecode = med.wxMaskedComboBox( self, -1, med.states[0],
|
statecode = med.MaskedComboBox( self, -1, med.states[0],
|
||||||
choices = med.states,
|
choices = med.states,
|
||||||
autoformat="USSTATE")
|
autoformat="USSTATE")
|
||||||
|
|
||||||
@@ -405,7 +414,7 @@ A masked ComboBox to validate
|
|||||||
text from a list of numeric codes:""")
|
text from a list of numeric codes:""")
|
||||||
|
|
||||||
choices = ["91", "136", "305", "4579"]
|
choices = ["91", "136", "305", "4579"]
|
||||||
code = med.wxMaskedComboBox( self, -1, choices[0],
|
code = med.MaskedComboBox( self, -1, choices[0],
|
||||||
choices = choices,
|
choices = choices,
|
||||||
choiceRequired = True,
|
choiceRequired = True,
|
||||||
formatcodes = "F_r",
|
formatcodes = "F_r",
|
||||||
@@ -428,16 +437,16 @@ choice sets:""")
|
|||||||
|
|
||||||
|
|
||||||
labelIpAddrs = wx.StaticText( self, -1, """\
|
labelIpAddrs = wx.StaticText( self, -1, """\
|
||||||
Here are some examples of wxIpAddrCtrl, a control derived from wxMaskedTextCtrl:""")
|
Here are some examples of IpAddrCtrl, a control derived from MaskedTextCtrl:""")
|
||||||
labelIpAddrs.SetForegroundColour( "Blue" )
|
labelIpAddrs.SetForegroundColour( "Blue" )
|
||||||
|
|
||||||
|
|
||||||
label_ipaddr1 = wx.StaticText( self, -1, "An empty control:")
|
label_ipaddr1 = wx.StaticText( self, -1, "An empty control:")
|
||||||
ipaddr1 = med.wxIpAddrCtrl( self, -1, style = wx.TE_PROCESS_TAB )
|
ipaddr1 = med.IpAddrCtrl( self, -1, style = wx.TE_PROCESS_TAB )
|
||||||
|
|
||||||
|
|
||||||
label_ipaddr2 = wx.StaticText( self, -1, "A restricted mask:")
|
label_ipaddr2 = wx.StaticText( self, -1, "A restricted mask:")
|
||||||
ipaddr2 = med.wxIpAddrCtrl( self, -1, mask=" 10. 1.109.###" )
|
ipaddr2 = med.IpAddrCtrl( self, -1, mask=" 10. 1.109.###" )
|
||||||
|
|
||||||
|
|
||||||
label_ipaddr3 = wx.StaticText( self, -1, """\
|
label_ipaddr3 = wx.StaticText( self, -1, """\
|
||||||
@@ -454,22 +463,22 @@ A control with restricted legal values:
|
|||||||
|
|
||||||
|
|
||||||
labelNumerics = wx.StaticText( self, -1, """\
|
labelNumerics = wx.StaticText( self, -1, """\
|
||||||
Here are some useful configurations of a wxMaskedTextCtrl for integer and floating point input that still treat
|
Here are some useful configurations of a MaskedTextCtrl for integer and floating point input that still treat
|
||||||
the control as a text control. (For a true numeric control, check out the wxMaskedNumCtrl class!)""")
|
the control as a text control. (For a true numeric control, check out the MaskedNumCtrl class!)""")
|
||||||
labelNumerics.SetForegroundColour( "Blue" )
|
labelNumerics.SetForegroundColour( "Blue" )
|
||||||
|
|
||||||
label_intctrl1 = wx.StaticText( self, -1, """\
|
label_intctrl1 = wx.StaticText( self, -1, """\
|
||||||
An integer entry control with
|
An integer entry control with
|
||||||
shifting insert enabled:""")
|
shifting insert enabled:""")
|
||||||
self.intctrl1 = med.wxMaskedTextCtrl(self, -1, name='intctrl', mask="#{9}", formatcodes = '_-,F>')
|
self.intctrl1 = med.MaskedTextCtrl(self, -1, name='intctrl', mask="#{9}", formatcodes = '_-,F>')
|
||||||
label_intctrl2 = wx.StaticText( self, -1, """\
|
label_intctrl2 = wx.StaticText( self, -1, """\
|
||||||
Right-insert integer entry:""")
|
Right-insert integer entry:""")
|
||||||
self.intctrl2 = med.wxMaskedTextCtrl(self, -1, name='intctrl', mask="#{9}", formatcodes = '_-,Fr')
|
self.intctrl2 = med.MaskedTextCtrl(self, -1, name='intctrl', mask="#{9}", formatcodes = '_-,Fr')
|
||||||
|
|
||||||
label_floatctrl = wx.StaticText( self, -1, """\
|
label_floatctrl = wx.StaticText( self, -1, """\
|
||||||
A floating point entry control
|
A floating point entry control
|
||||||
with right-insert for ordinal:""")
|
with right-insert for ordinal:""")
|
||||||
self.floatctrl = med.wxMaskedTextCtrl(self, -1, name='floatctrl', mask="#{9}.#{2}", formatcodes="F,_-R", useParensForNegatives=False)
|
self.floatctrl = med.MaskedTextCtrl(self, -1, name='floatctrl', mask="#{9}.#{2}", formatcodes="F,_-R", useParensForNegatives=False)
|
||||||
self.floatctrl.SetFieldParameters(0, formatcodes='r<', validRequired=True) # right-insert, require explicit cursor movement to change fields
|
self.floatctrl.SetFieldParameters(0, formatcodes='r<', validRequired=True) # right-insert, require explicit cursor movement to change fields
|
||||||
self.floatctrl.SetFieldParameters(1, defaultValue='00') # don't allow blank fraction
|
self.floatctrl.SetFieldParameters(1, defaultValue='00') # don't allow blank fraction
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
import wx
|
import wx
|
||||||
import wx.lib.infoframe as infoframe
|
import wx.lib.infoframe
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -82,14 +82,14 @@ class MyFrame(wx.Frame):
|
|||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
overview = infoframe.__doc__
|
overview = wx.lib.infoframe.__doc__
|
||||||
|
|
||||||
def runTest(frame, nb, log):
|
def runTest(frame, nb, log):
|
||||||
"""
|
"""
|
||||||
This method is used by the wxPython Demo Framework for integrating
|
This method is used by the wxPython Demo Framework for integrating
|
||||||
this demo with the rest.
|
this demo with the rest.
|
||||||
"""
|
"""
|
||||||
win = MyFrame(infoframe.wxPyInformationalMessagesFrame())
|
win = MyFrame(wx.lib.infoframe.PyInformationalMessagesFrame())
|
||||||
frame.otherWin = win
|
frame.otherWin = win
|
||||||
win.Show(1)
|
win.Show(1)
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ if __name__ == "__main__":
|
|||||||
## output.SetOtherMenuBar(menubar,menuname="Output")
|
## output.SetOtherMenuBar(menubar,menuname="Output")
|
||||||
|
|
||||||
## def OnClose(self,event):
|
## def OnClose(self,event):
|
||||||
## if isinstance(sys.stdout,wxPyInformationalMessagesFrame):
|
## if isinstance(sys.stdout,wx.lib.infoframe.PyInformationalMessagesFrame):
|
||||||
## sys.stdout.close()
|
## sys.stdout.close()
|
||||||
## self.Destroy()
|
## self.Destroy()
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
# Override the default output window and point it to the
|
# Override the default output window and point it to the
|
||||||
# custom class.
|
# custom class.
|
||||||
outputWindowClass = infoframe.wxPyInformationalMessagesFrame
|
outputWindowClass = wx.lib.infoframe.PyInformationalMessagesFrame
|
||||||
|
|
||||||
def OnInit(self):
|
def OnInit(self):
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ if __name__ == "__main__":
|
|||||||
self.SetTopWindow(frame)
|
self.SetTopWindow(frame)
|
||||||
|
|
||||||
# Associate the frame with stdout.
|
# Associate the frame with stdout.
|
||||||
if isinstance(sys.stdout, infoframe.wxPyInformationalMessagesFrame):
|
if isinstance(sys.stdout, wx.lib.infoframe.PyInformationalMessagesFrame):
|
||||||
sys.stdout.SetParent(frame)
|
sys.stdout.SetParent(frame)
|
||||||
|
|
||||||
print "Starting.\n",
|
print "Starting.\n",
|
||||||
|
@@ -6,6 +6,10 @@
|
|||||||
#
|
#
|
||||||
# o editor lib hasn't been hit by the renamer yet.
|
# o editor lib hasn't been hit by the renamer yet.
|
||||||
#
|
#
|
||||||
|
# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxEditor -> Editor
|
||||||
|
#
|
||||||
|
|
||||||
import wx
|
import wx
|
||||||
import wx.lib.editor as editor
|
import wx.lib.editor as editor
|
||||||
@@ -14,7 +18,7 @@ import wx.lib.editor as editor
|
|||||||
|
|
||||||
def runTest(frame, nb, log):
|
def runTest(frame, nb, log):
|
||||||
win = wx.Panel(nb, -1)
|
win = wx.Panel(nb, -1)
|
||||||
ed = editor.wxEditor(win, -1, style=wx.SUNKEN_BORDER)
|
ed = editor.Editor(win, -1, style=wx.SUNKEN_BORDER)
|
||||||
box = wx.BoxSizer(wx.VERTICAL)
|
box = wx.BoxSizer(wx.VERTICAL)
|
||||||
box.Add(ed, 1, wx.ALL|wx.GROW, 1)
|
box.Add(ed, 1, wx.ALL|wx.GROW, 1)
|
||||||
win.SetSizer(box)
|
win.SetSizer(box)
|
||||||
@@ -22,7 +26,7 @@ def runTest(frame, nb, log):
|
|||||||
|
|
||||||
ed.SetText(["",
|
ed.SetText(["",
|
||||||
"This is a simple text editor, the class name is",
|
"This is a simple text editor, the class name is",
|
||||||
"wxEditor. Type a few lines and try it out.",
|
"Editor. Type a few lines and try it out.",
|
||||||
"",
|
"",
|
||||||
"It uses Windows-style key commands that can be overridden by subclassing.",
|
"It uses Windows-style key commands that can be overridden by subclassing.",
|
||||||
"Mouse select works. Here are the key commands:",
|
"Mouse select works. Here are the key commands:",
|
||||||
@@ -44,19 +48,19 @@ def runTest(frame, nb, log):
|
|||||||
|
|
||||||
|
|
||||||
overview = """
|
overview = """
|
||||||
The wxEditor class implements a simple text editor using wxPython. You
|
The Editor class implements a simple text editor using wxPython. You
|
||||||
can create a custom editor by subclassing wxEditor. Even though much of
|
can create a custom editor by subclassing Editor. Even though much of
|
||||||
the editor is implemented in Python, it runs surprisingly smoothly on
|
the editor is implemented in Python, it runs surprisingly smoothly on
|
||||||
normal hardware with small files.
|
normal hardware with small files.
|
||||||
|
|
||||||
How to use it
|
How to use it
|
||||||
-------------
|
-------------
|
||||||
The demo code (demo/wxEditor.py) shows how to use wxEditor as a simple text
|
The demo code (demo/Editor.py) shows how to use Editor as a simple text
|
||||||
box. Use the SetText() and GetText() methods to set or get text from
|
box. Use the SetText() and GetText() methods to set or get text from
|
||||||
the component; these both use a list of strings.
|
the component; these both use a list of strings.
|
||||||
|
|
||||||
The samples/FrogEdit directory has an example of a simple text editor
|
The samples/FrogEdit directory has an example of a simple text editor
|
||||||
application that uses the wxEditor component.
|
application that uses the Editor component.
|
||||||
|
|
||||||
Subclassing
|
Subclassing
|
||||||
-----------
|
-----------
|
||||||
|
@@ -11,9 +11,13 @@
|
|||||||
#
|
#
|
||||||
# o All issues corrected
|
# o All issues corrected
|
||||||
#
|
#
|
||||||
|
# 12/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxIntCtrl -> IntCtrl
|
||||||
|
#
|
||||||
|
|
||||||
import wx
|
import wx
|
||||||
import wx.lib.intctrl as intctrl
|
import wx.lib.intctrl
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -25,11 +29,11 @@ class TestPanel( wx.Panel ):
|
|||||||
panel = wx.Panel( self, -1 )
|
panel = wx.Panel( self, -1 )
|
||||||
|
|
||||||
self.set_min = wx.CheckBox( panel, -1, "Set minimum value:" )
|
self.set_min = wx.CheckBox( panel, -1, "Set minimum value:" )
|
||||||
self.min = intctrl.wxIntCtrl( panel, size=( 50, -1 ) )
|
self.min = wx.lib.intctrl.IntCtrl( panel, size=( 50, -1 ) )
|
||||||
self.min.Enable( False )
|
self.min.Enable( False )
|
||||||
|
|
||||||
self.set_max = wx.CheckBox( panel, -1, "Set maximum value:" )
|
self.set_max = wx.CheckBox( panel, -1, "Set maximum value:" )
|
||||||
self.max = intctrl.wxIntCtrl( panel, size=( 50, -1 ) )
|
self.max = wx.lib.intctrl.IntCtrl( panel, size=( 50, -1 ) )
|
||||||
self.max.Enable( False )
|
self.max.Enable( False )
|
||||||
|
|
||||||
self.limit_target = wx.CheckBox( panel, -1, "Limit control" )
|
self.limit_target = wx.CheckBox( panel, -1, "Limit control" )
|
||||||
@@ -37,7 +41,7 @@ class TestPanel( wx.Panel ):
|
|||||||
self.allow_long = wx.CheckBox( panel, -1, "Allow long integers" )
|
self.allow_long = wx.CheckBox( panel, -1, "Allow long integers" )
|
||||||
|
|
||||||
label = wx.StaticText( panel, -1, "Resulting integer control:" )
|
label = wx.StaticText( panel, -1, "Resulting integer control:" )
|
||||||
self.target_ctl = intctrl.wxIntCtrl( panel )
|
self.target_ctl = wx.lib.intctrl.IntCtrl( panel )
|
||||||
|
|
||||||
grid = wx.FlexGridSizer( 0, 2, 0, 0 )
|
grid = wx.FlexGridSizer( 0, 2, 0, 0 )
|
||||||
grid.Add( self.set_min, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
|
grid.Add( self.set_min, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
|
||||||
@@ -74,9 +78,9 @@ class TestPanel( wx.Panel ):
|
|||||||
self.Bind(wx.EVT_CHECKBOX, self.OnSetAllowNone, self.allow_none)
|
self.Bind(wx.EVT_CHECKBOX, self.OnSetAllowNone, self.allow_none)
|
||||||
self.Bind(wx.EVT_CHECKBOX, self.OnSetAllowLong, self.allow_long)
|
self.Bind(wx.EVT_CHECKBOX, self.OnSetAllowLong, self.allow_long)
|
||||||
|
|
||||||
self.Bind(intctrl.EVT_INT, self.SetTargetMinMax, self.min)
|
self.Bind(wx.lib.intctrl.EVT_INT, self.SetTargetMinMax, self.min)
|
||||||
self.Bind(intctrl.EVT_INT, self.SetTargetMinMax, self.max)
|
self.Bind(wx.lib.intctrl.EVT_INT, self.SetTargetMinMax, self.max)
|
||||||
self.Bind(intctrl.EVT_INT, self.OnTargetChange, self.target_ctl)
|
self.Bind(wx.lib.intctrl.EVT_INT, self.OnTargetChange, self.target_ctl)
|
||||||
|
|
||||||
|
|
||||||
def OnSetMin( self, event ):
|
def OnSetMin( self, event ):
|
||||||
@@ -146,13 +150,13 @@ def runTest( frame, nb, log ):
|
|||||||
|
|
||||||
overview = """<html><body>
|
overview = """<html><body>
|
||||||
<P>
|
<P>
|
||||||
<B>wxIntCtrl</B> provides a control that takes and returns integers as
|
<B>IntCtrl</B> provides a control that takes and returns integers as
|
||||||
value, and provides bounds support and optional value limiting.
|
value, and provides bounds support and optional value limiting.
|
||||||
<P>
|
<P>
|
||||||
<P>
|
<P>
|
||||||
Here's the API for wxIntCtrl:
|
Here's the API for IntCtrl:
|
||||||
<DL><PRE>
|
<DL><PRE>
|
||||||
<B>wxIntCtrl</B>(
|
<B>IntCtrl</B>(
|
||||||
parent, id = -1,
|
parent, id = -1,
|
||||||
<B>value</B> = 0,
|
<B>value</B> = 0,
|
||||||
<B>min</B> = None,
|
<B>min</B> = None,
|
||||||
|
@@ -6,6 +6,10 @@
|
|||||||
#
|
#
|
||||||
# o lib.mixins.listctrl needs wx renamer applied.
|
# o lib.mixins.listctrl needs wx renamer applied.
|
||||||
#
|
#
|
||||||
|
# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxListCtrlAutoWidthMixin -> ListCtrlAutoWidthMixin
|
||||||
|
#
|
||||||
|
|
||||||
import wx
|
import wx
|
||||||
import wx.lib.mixins.listctrl as listmix
|
import wx.lib.mixins.listctrl as listmix
|
||||||
@@ -204,12 +208,12 @@ class KeySink(wx.Window):
|
|||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
class KeyLog(wx.ListCtrl, listmix.wxListCtrlAutoWidthMixin):
|
class KeyLog(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin):
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
wx.ListCtrl.__init__(self, parent, -1,
|
wx.ListCtrl.__init__(self, parent, -1,
|
||||||
style = wx.LC_REPORT|wx.LC_VRULES|wx.LC_HRULES)
|
style = wx.LC_REPORT|wx.LC_VRULES|wx.LC_HRULES)
|
||||||
listmix.wxListCtrlAutoWidthMixin.__init__(self)
|
listmix.ListCtrlAutoWidthMixin.__init__(self)
|
||||||
|
|
||||||
self.InsertColumn(0, "Event Type")
|
self.InsertColumn(0, "Event Type")
|
||||||
self.InsertColumn(1, "Key Name")
|
self.InsertColumn(1, "Key Name")
|
||||||
|
@@ -24,6 +24,11 @@
|
|||||||
# o ColumnSorterMixin implementation was broke - added event.Skip()
|
# o ColumnSorterMixin implementation was broke - added event.Skip()
|
||||||
# to column click event to allow event to fall through to mixin.
|
# to column click event to allow event to fall through to mixin.
|
||||||
#
|
#
|
||||||
|
# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxColumnSorterMixin -> ColumnSorterMixin
|
||||||
|
# o wxListCtrlAutoWidthMixin -> ListCtrlAutoWidthMixin
|
||||||
|
#
|
||||||
|
|
||||||
import wx
|
import wx
|
||||||
import wx.lib.mixins.listctrl as listmix
|
import wx.lib.mixins.listctrl as listmix
|
||||||
@@ -91,14 +96,14 @@ musicdata = {
|
|||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class TestListCtrl(wx.ListCtrl, listmix.wxListCtrlAutoWidthMixin):
|
class TestListCtrl(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin):
|
||||||
def __init__(self, parent, ID, pos=wx.DefaultPosition,
|
def __init__(self, parent, ID, pos=wx.DefaultPosition,
|
||||||
size=wx.DefaultSize, style=0):
|
size=wx.DefaultSize, style=0):
|
||||||
wx.ListCtrl.__init__(self, parent, ID, pos, size, style)
|
wx.ListCtrl.__init__(self, parent, ID, pos, size, style)
|
||||||
listmix.wxListCtrlAutoWidthMixin.__init__(self)
|
listmix.ListCtrlAutoWidthMixin.__init__(self)
|
||||||
|
|
||||||
|
|
||||||
class TestListCtrlPanel(wx.Panel, listmix.wxColumnSorterMixin):
|
class TestListCtrlPanel(wx.Panel, listmix.ColumnSorterMixin):
|
||||||
def __init__(self, parent, log):
|
def __init__(self, parent, log):
|
||||||
wx.Panel.__init__(self, parent, -1, style=wx.WANTS_CHARS)
|
wx.Panel.__init__(self, parent, -1, style=wx.WANTS_CHARS)
|
||||||
|
|
||||||
@@ -126,7 +131,7 @@ class TestListCtrlPanel(wx.Panel, listmix.wxColumnSorterMixin):
|
|||||||
# Now that the list exists we can init the other base class,
|
# Now that the list exists we can init the other base class,
|
||||||
# see wxPython/lib/mixins/listctrl.py
|
# see wxPython/lib/mixins/listctrl.py
|
||||||
self.itemDataMap = musicdata
|
self.itemDataMap = musicdata
|
||||||
listmix.wxColumnSorterMixin.__init__(self, 3)
|
listmix.ColumnSorterMixin.__init__(self, 3)
|
||||||
#self.SortListItems(0, True)
|
#self.SortListItems(0, True)
|
||||||
|
|
||||||
self.Bind(wx.EVT_SIZE, self.OnSize)
|
self.Bind(wx.EVT_SIZE, self.OnSize)
|
||||||
@@ -201,11 +206,11 @@ class TestListCtrlPanel(wx.Panel, listmix.wxColumnSorterMixin):
|
|||||||
self.currentItem = 0
|
self.currentItem = 0
|
||||||
|
|
||||||
|
|
||||||
# Used by the wxColumnSorterMixin, see wxPython/lib/mixins/listctrl.py
|
# Used by the ColumnSorterMixin, see wxPython/lib/mixins/listctrl.py
|
||||||
def GetListCtrl(self):
|
def GetListCtrl(self):
|
||||||
return self.list
|
return self.list
|
||||||
|
|
||||||
# Used by the wxColumnSorterMixin, see wxPython/lib/mixins/listctrl.py
|
# Used by the ColumnSorterMixin, see wxPython/lib/mixins/listctrl.py
|
||||||
def GetSortImages(self):
|
def GetSortImages(self):
|
||||||
return (self.sm_dn, self.sm_up)
|
return (self.sm_dn, self.sm_up)
|
||||||
|
|
||||||
@@ -441,7 +446,7 @@ item data values.
|
|||||||
|
|
||||||
<h4>ListCtrlAutoWidthMixin</h4>
|
<h4>ListCtrlAutoWidthMixin</h4>
|
||||||
|
|
||||||
<code><b>wxListCtrlAutoWidthMixin()</b></code>
|
<code><b>ListCtrlAutoWidthMixin()</b></code>
|
||||||
|
|
||||||
<p>A mix-in class that automatically resizes the last column to take up the
|
<p>A mix-in class that automatically resizes the last column to take up the
|
||||||
remaining width of the ListCtrl.
|
remaining width of the ListCtrl.
|
||||||
|
@@ -6,6 +6,10 @@
|
|||||||
#
|
#
|
||||||
# o Library must be updated for this to run.
|
# o Library must be updated for this to run.
|
||||||
#
|
#
|
||||||
|
# 12/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxMVCTree -> MVCTree
|
||||||
|
#
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
@@ -32,12 +36,12 @@ def delitem(evt):
|
|||||||
logger.write("Delete\n")
|
logger.write("Delete\n")
|
||||||
|
|
||||||
def runTest(frame, nb, log):
|
def runTest(frame, nb, log):
|
||||||
#f = wx.Frame(frame, -1, "wxMVCTree", (0,0), (200,500))
|
#f = wx.Frame(frame, -1, "MVCTree", (0,0), (200,500))
|
||||||
global logger
|
global logger
|
||||||
logger = log
|
logger = log
|
||||||
p = tree.wxMVCTree(nb, -1)
|
p = tree.MVCTree(nb, -1)
|
||||||
#f = wx.Frame(frame, -1, "wxMVCTree")
|
#f = wx.Frame(frame, -1, "MVCTree")
|
||||||
#p = tree.wxMVCTree(f, -1)
|
#p = tree.MVCTree(f, -1)
|
||||||
p.SetAssumeChildren(True)
|
p.SetAssumeChildren(True)
|
||||||
p.SetModel(tree.LateFSTreeModel(os.path.normpath(os.getcwd() + os.sep +'..')))
|
p.SetModel(tree.LateFSTreeModel(os.path.normpath(os.getcwd() + os.sep +'..')))
|
||||||
|
|
||||||
@@ -61,7 +65,7 @@ def runTest(frame, nb, log):
|
|||||||
|
|
||||||
overview = """\
|
overview = """\
|
||||||
|
|
||||||
wxMVCTree is a control which handles hierarchical data. It is
|
MVCTree is a control which handles hierarchical data. It is
|
||||||
constructed in model-view-controller architecture, so the display of
|
constructed in model-view-controller architecture, so the display of
|
||||||
that data, and the content of the data can be changed greatly without
|
that data, and the content of the data can be changed greatly without
|
||||||
affecting the other parts.
|
affecting the other parts.
|
||||||
|
@@ -10,6 +10,10 @@
|
|||||||
#
|
#
|
||||||
# o Issues with lib corrected.
|
# o Issues with lib corrected.
|
||||||
#
|
#
|
||||||
|
# 12/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxMaskedNumCtrl -> MaskedNumCtrl
|
||||||
|
#
|
||||||
|
|
||||||
import string
|
import string
|
||||||
import sys
|
import sys
|
||||||
@@ -27,40 +31,40 @@ class TestPanel( wx.Panel ):
|
|||||||
panel = wx.Panel( self, -1 )
|
panel = wx.Panel( self, -1 )
|
||||||
|
|
||||||
header = wx.StaticText(panel, -1, """\
|
header = wx.StaticText(panel, -1, """\
|
||||||
This shows the various options for wxMaskedNumCtrl.
|
This shows the various options for MaskedNumCtrl.
|
||||||
The controls at the top reconfigure the resulting control at the bottom.
|
The controls at the top reconfigure the resulting control at the bottom.
|
||||||
""")
|
""")
|
||||||
header.SetForegroundColour( "Blue" )
|
header.SetForegroundColour( "Blue" )
|
||||||
|
|
||||||
intlabel = wx.StaticText( panel, -1, "Integer width:" )
|
intlabel = wx.StaticText( panel, -1, "Integer width:" )
|
||||||
self.integerwidth = mnum.wxMaskedNumCtrl(
|
self.integerwidth = mnum.MaskedNumCtrl(
|
||||||
panel, value=10, integerWidth=2, allowNegative=False
|
panel, value=10, integerWidth=2, allowNegative=False
|
||||||
)
|
)
|
||||||
|
|
||||||
fraclabel = wx.StaticText( panel, -1, "Fraction width:" )
|
fraclabel = wx.StaticText( panel, -1, "Fraction width:" )
|
||||||
self.fractionwidth = mnum.wxMaskedNumCtrl(
|
self.fractionwidth = mnum.MaskedNumCtrl(
|
||||||
panel, value=0, integerWidth=2, allowNegative=False
|
panel, value=0, integerWidth=2, allowNegative=False
|
||||||
)
|
)
|
||||||
|
|
||||||
groupcharlabel = wx.StaticText( panel,-1, "Grouping char:" )
|
groupcharlabel = wx.StaticText( panel,-1, "Grouping char:" )
|
||||||
self.groupchar = mnum.wxMaskedTextCtrl(
|
self.groupchar = mnum.MaskedTextCtrl(
|
||||||
panel, -1, value=',', mask='&', excludeChars = '-()',
|
panel, -1, value=',', mask='&', excludeChars = '-()',
|
||||||
formatcodes='F', emptyInvalid=True, validRequired=True
|
formatcodes='F', emptyInvalid=True, validRequired=True
|
||||||
)
|
)
|
||||||
|
|
||||||
decimalcharlabel = wx.StaticText( panel,-1, "Decimal char:" )
|
decimalcharlabel = wx.StaticText( panel,-1, "Decimal char:" )
|
||||||
self.decimalchar = mnum.wxMaskedTextCtrl(
|
self.decimalchar = mnum.MaskedTextCtrl(
|
||||||
panel, -1, value='.', mask='&', excludeChars = '-()',
|
panel, -1, value='.', mask='&', excludeChars = '-()',
|
||||||
formatcodes='F', emptyInvalid=True, validRequired=True
|
formatcodes='F', emptyInvalid=True, validRequired=True
|
||||||
)
|
)
|
||||||
|
|
||||||
self.set_min = wx.CheckBox( panel, -1, "Set minimum value:" )
|
self.set_min = wx.CheckBox( panel, -1, "Set minimum value:" )
|
||||||
# Create this MaskedNumCtrl using factory, to show how:
|
# Create this MaskedNumCtrl using factory, to show how:
|
||||||
self.min = mnum.wxMaskedNumCtrl( panel, integerWidth=5, fractionWidth=2 )
|
self.min = mnum.MaskedNumCtrl( panel, integerWidth=5, fractionWidth=2 )
|
||||||
self.min.Enable( False )
|
self.min.Enable( False )
|
||||||
|
|
||||||
self.set_max = wx.CheckBox( panel, -1, "Set maximum value:" )
|
self.set_max = wx.CheckBox( panel, -1, "Set maximum value:" )
|
||||||
self.max = mnum.wxMaskedNumCtrl( panel, integerWidth=5, fractionWidth=2 )
|
self.max = mnum.MaskedNumCtrl( panel, integerWidth=5, fractionWidth=2 )
|
||||||
self.max.Enable( False )
|
self.max.Enable( False )
|
||||||
|
|
||||||
|
|
||||||
@@ -79,7 +83,7 @@ The controls at the top reconfigure the resulting control at the bottom.
|
|||||||
font.SetWeight(wx.BOLD)
|
font.SetWeight(wx.BOLD)
|
||||||
label.SetFont(font)
|
label.SetFont(font)
|
||||||
|
|
||||||
self.target_ctl = mnum.wxMaskedNumCtrl( panel, -1, name="target control" )
|
self.target_ctl = mnum.MaskedNumCtrl( panel, -1, name="target control" )
|
||||||
|
|
||||||
label_numselect = wx.StaticText( panel, -1, """\
|
label_numselect = wx.StaticText( panel, -1, """\
|
||||||
Programmatically set the above
|
Programmatically set the above
|
||||||
|
@@ -12,6 +12,10 @@
|
|||||||
#
|
#
|
||||||
# o renamer issue shelved.
|
# o renamer issue shelved.
|
||||||
#
|
#
|
||||||
|
# 12/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxMultiSash -> MultiSash
|
||||||
|
#
|
||||||
|
|
||||||
import wx
|
import wx
|
||||||
import wx.lib.multisash as sash
|
import wx.lib.multisash as sash
|
||||||
@@ -76,7 +80,7 @@ class TestWindow(stc.StyledTextCtrl):
|
|||||||
|
|
||||||
|
|
||||||
def runTest(frame, nb, log):
|
def runTest(frame, nb, log):
|
||||||
multi = sash.wxMultiSash(nb, -1, pos = (0,0), size = (640,480))
|
multi = sash.MultiSash(nb, -1, pos = (0,0), size = (640,480))
|
||||||
|
|
||||||
# Use this method to set the default class that will be created when
|
# Use this method to set the default class that will be created when
|
||||||
# a new sash is created. The class's constructor needs 1 parameter
|
# a new sash is created. The class's constructor needs 1 parameter
|
||||||
@@ -90,9 +94,9 @@ def runTest(frame, nb, log):
|
|||||||
|
|
||||||
|
|
||||||
overview = """<html><body>
|
overview = """<html><body>
|
||||||
<h2><center>wxMultiSash</center></h2>
|
<h2><center>MultiSash</center></h2>
|
||||||
|
|
||||||
wxMultiSash allows the user to split a window any number of times
|
MultiSash allows the user to split a window any number of times
|
||||||
either horizontally or vertically, and to close the split off windows
|
either horizontally or vertically, and to close the split off windows
|
||||||
when desired.
|
when desired.
|
||||||
|
|
||||||
|
@@ -6,14 +6,18 @@
|
|||||||
#
|
#
|
||||||
# o Is it just me or are the graphics for the control not lining up right?
|
# o Is it just me or are the graphics for the control not lining up right?
|
||||||
#
|
#
|
||||||
|
# 12/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxPopupControl -> PopupControl
|
||||||
|
#
|
||||||
|
|
||||||
import wx
|
import wx
|
||||||
import wx.lib.popupctl as pop
|
import wx.lib.popupctl as pop
|
||||||
import wx.calendar as cal
|
import wx.calendar as cal
|
||||||
|
|
||||||
class TestDateControl(pop.wxPopupControl):
|
class TestDateControl(pop.PopupControl):
|
||||||
def __init__(self,*_args,**_kwargs):
|
def __init__(self,*_args,**_kwargs):
|
||||||
apply(pop.wxPopupControl.__init__,(self,) + _args,_kwargs)
|
apply(pop.PopupControl.__init__,(self,) + _args,_kwargs)
|
||||||
|
|
||||||
self.win = wx.Window(self,-1,pos = (0,0),style = 0)
|
self.win = wx.Window(self,-1,pos = (0,0),style = 0)
|
||||||
self.cal = cal.CalendarCtrl(self.win,-1,pos = (0,0))
|
self.cal = cal.CalendarCtrl(self.win,-1,pos = (0,0))
|
||||||
@@ -39,7 +43,7 @@ class TestDateControl(pop.wxPopupControl):
|
|||||||
date.GetYear()))
|
date.GetYear()))
|
||||||
evt.Skip()
|
evt.Skip()
|
||||||
|
|
||||||
# Method overridden from wxPopupControl
|
# Method overridden from PopupControl
|
||||||
# This method is called just before the popup is displayed
|
# This method is called just before the popup is displayed
|
||||||
# Use this method to format any controls in the popup
|
# Use this method to format any controls in the popup
|
||||||
def FormatContent(self):
|
def FormatContent(self):
|
||||||
@@ -82,9 +86,9 @@ def runTest(frame, nb, log):
|
|||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
overview = """<html><body>
|
overview = """<html><body>
|
||||||
<h2><center>wxPopupControl</center></h2>
|
<h2><center>PopupControl</center></h2>
|
||||||
|
|
||||||
wxPopupControl is a class that can display a value and has a button
|
PopupControl is a class that can display a value and has a button
|
||||||
that will popup another window similar to how a wxComboBox works. The
|
that will popup another window similar to how a wxComboBox works. The
|
||||||
popup window can contain whatever is needed to edit the value. This
|
popup window can contain whatever is needed to edit the value. This
|
||||||
example uses a wxCalendarCtrl.
|
example uses a wxCalendarCtrl.
|
||||||
|
@@ -6,6 +6,11 @@
|
|||||||
#
|
#
|
||||||
# o Updated URL for SF link in overview.
|
# o Updated URL for SF link in overview.
|
||||||
#
|
#
|
||||||
|
# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxPyColorChooser -> PyColorChooser
|
||||||
|
# o wxPyColourChooser -> PyColourChooser
|
||||||
|
#
|
||||||
|
|
||||||
import wx
|
import wx
|
||||||
import wx.lib.colourchooser as cc
|
import wx.lib.colourchooser as cc
|
||||||
@@ -17,7 +22,7 @@ class TestColourChooser(wx.Panel):
|
|||||||
wx.Panel.__init__(self, parent, -1)
|
wx.Panel.__init__(self, parent, -1)
|
||||||
self.log = log
|
self.log = log
|
||||||
|
|
||||||
chooser = cc.wxPyColourChooser(self, -1)
|
chooser = cc.PyColourChooser(self, -1)
|
||||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||||
sizer.Add(chooser, 0, wx.ALL, 25)
|
sizer.Add(chooser, 0, wx.ALL, 25)
|
||||||
|
|
||||||
@@ -33,7 +38,7 @@ def runTest(frame, nb, log):
|
|||||||
#---------------------------------------------------------------
|
#---------------------------------------------------------------
|
||||||
|
|
||||||
overview = """
|
overview = """
|
||||||
The wxPyColourChooser component creates a colour chooser window
|
The PyColourChooser component creates a colour chooser window
|
||||||
that is similar to the Microsoft Windows colour chooser dialog.
|
that is similar to the Microsoft Windows colour chooser dialog.
|
||||||
This dialog component is drawn in a panel, and thus can be
|
This dialog component is drawn in a panel, and thus can be
|
||||||
embedded inside any widget (although it cannot be resized).
|
embedded inside any widget (although it cannot be resized).
|
||||||
@@ -43,17 +48,17 @@ chooser on any platform that might have an ugly one :)
|
|||||||
How to use it
|
How to use it
|
||||||
------------------------------
|
------------------------------
|
||||||
|
|
||||||
The demo (demo/wxPyColourChooser.py code shows how to display
|
The demo (demo/PyColourChooser.py code shows how to display
|
||||||
a colour chooser and retrieve its options.
|
a colour chooser and retrieve its options.
|
||||||
|
|
||||||
Contact and Author Info
|
Contact and Author Info
|
||||||
------------------------------
|
------------------------------
|
||||||
|
|
||||||
wxPyColourChooser was written and is maintained by:
|
PyColourChooser was written and is maintained by:
|
||||||
|
|
||||||
Michael Gilfix <mgilfix@eecs.tufts.edu>
|
Michael Gilfix <mgilfix@eecs.tufts.edu>
|
||||||
|
|
||||||
You can find the latest wxPyColourChooser code at
|
You can find the latest PyColourChooser code at
|
||||||
http://sourceforge.net/projects/wxcolourchooser/. If you have
|
http://sourceforge.net/projects/wxcolourchooser/. If you have
|
||||||
any suggestions or want to submit a patch, please send
|
any suggestions or want to submit a patch, please send
|
||||||
it my way at: mgilfix@eecs.tufts.edu
|
it my way at: mgilfix@eecs.tufts.edu
|
||||||
|
@@ -10,7 +10,10 @@
|
|||||||
#
|
#
|
||||||
# o All issues resolved.
|
# o All issues resolved.
|
||||||
#
|
#
|
||||||
|
# 12/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxRightTextCtrl -> RightTextCtrl
|
||||||
|
#
|
||||||
|
|
||||||
############################################################################\
|
############################################################################\
|
||||||
# Note: this demo has been converted, but the control is deprecated because |
|
# Note: this demo has been converted, but the control is deprecated because |
|
||||||
@@ -37,19 +40,19 @@ class TestPanel(wx.Panel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
fgs.Add(txt)
|
fgs.Add(txt)
|
||||||
fgs.Add(right.wxRightTextCtrl(self, -1, "", size=(75, -1)))
|
fgs.Add(right.RightTextCtrl(self, -1, "", size=(75, -1)))
|
||||||
|
|
||||||
fgs.Add((10,10))
|
fgs.Add((10,10))
|
||||||
fgs.Add(right.wxRightTextCtrl(self, -1, "123.45", size=(75, -1)))
|
fgs.Add(right.RightTextCtrl(self, -1, "123.45", size=(75, -1)))
|
||||||
|
|
||||||
fgs.Add((10,10))
|
fgs.Add((10,10))
|
||||||
fgs.Add(right.wxRightTextCtrl(self, -1, "234.56", size=(75, -1)))
|
fgs.Add(right.RightTextCtrl(self, -1, "234.56", size=(75, -1)))
|
||||||
|
|
||||||
fgs.Add((10,10))
|
fgs.Add((10,10))
|
||||||
fgs.Add(right.wxRightTextCtrl(self, -1, "345.67", size=(75, -1)))
|
fgs.Add(right.RightTextCtrl(self, -1, "345.67", size=(75, -1)))
|
||||||
|
|
||||||
fgs.Add((10,10))
|
fgs.Add((10,10))
|
||||||
fgs.Add(right.wxRightTextCtrl(self, -1, "456.78", size=(75, -1)))
|
fgs.Add(right.RightTextCtrl(self, -1, "456.78", size=(75, -1)))
|
||||||
|
|
||||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||||
sizer.Add(fgs, 0, wx.ALL, 25)
|
sizer.Add(fgs, 0, wx.ALL, 25)
|
||||||
|
@@ -10,6 +10,10 @@
|
|||||||
#
|
#
|
||||||
# o lib updated, all is well.
|
# o lib updated, all is well.
|
||||||
#
|
#
|
||||||
|
# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxScrolledPanel -> ScrolledPanel
|
||||||
|
#
|
||||||
|
|
||||||
import wx
|
import wx
|
||||||
import wx.lib.scrolledpanel as scrolled
|
import wx.lib.scrolledpanel as scrolled
|
||||||
@@ -19,14 +23,14 @@ import wx.lib.scrolledpanel as scrolled
|
|||||||
text = "one two buckle my shoe three four shut the door five six pick up sticks seven eight lay them straight nine ten big fat hen"
|
text = "one two buckle my shoe three four shut the door five six pick up sticks seven eight lay them straight nine ten big fat hen"
|
||||||
|
|
||||||
|
|
||||||
class TestPanel(scrolled.wxScrolledPanel):
|
class TestPanel(scrolled.ScrolledPanel):
|
||||||
def __init__(self, parent, log):
|
def __init__(self, parent, log):
|
||||||
self.log = log
|
self.log = log
|
||||||
scrolled.wxScrolledPanel.__init__(self, parent, -1)
|
scrolled.ScrolledPanel.__init__(self, parent, -1)
|
||||||
|
|
||||||
vbox = wx.BoxSizer(wx.VERTICAL)
|
vbox = wx.BoxSizer(wx.VERTICAL)
|
||||||
desc = wx.StaticText(self, -1,
|
desc = wx.StaticText(self, -1,
|
||||||
"wxScrolledPanel extends wxScrolledWindow, adding all "
|
"ScrolledPanel extends wxScrolledWindow, adding all "
|
||||||
"the necessary bits to set up scroll handling for you.\n\n"
|
"the necessary bits to set up scroll handling for you.\n\n"
|
||||||
"Here are three fixed size examples of its use. The "
|
"Here are three fixed size examples of its use. The "
|
||||||
"demo panel for this sample is also using it -- the \nwxStaticLine"
|
"demo panel for this sample is also using it -- the \nwxStaticLine"
|
||||||
@@ -40,7 +44,7 @@ class TestPanel(scrolled.wxScrolledPanel):
|
|||||||
|
|
||||||
words = text.split()
|
words = text.split()
|
||||||
|
|
||||||
panel1 = scrolled.wxScrolledPanel(self, -1, size=(120,300),
|
panel1 = scrolled.ScrolledPanel(self, -1, size=(120,300),
|
||||||
style = wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER )
|
style = wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER )
|
||||||
fgs1 = wx.FlexGridSizer(cols=2, vgap=4, hgap=4)
|
fgs1 = wx.FlexGridSizer(cols=2, vgap=4, hgap=4)
|
||||||
|
|
||||||
@@ -54,9 +58,9 @@ class TestPanel(scrolled.wxScrolledPanel):
|
|||||||
panel1.SetAutoLayout(1)
|
panel1.SetAutoLayout(1)
|
||||||
panel1.SetupScrolling( scroll_x=False )
|
panel1.SetupScrolling( scroll_x=False )
|
||||||
|
|
||||||
panel2 = scrolled.wxScrolledPanel(self, -1, size=(350, 40),
|
panel2 = scrolled.ScrolledPanel(self, -1, size=(350, 40),
|
||||||
style = wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER)
|
style = wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER)
|
||||||
panel3 = scrolled.wxScrolledPanel(self, -1, size=(200,100),
|
panel3 = scrolled.ScrolledPanel(self, -1, size=(200,100),
|
||||||
style = wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER)
|
style = wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER)
|
||||||
|
|
||||||
fgs2 = wx.FlexGridSizer(cols=25, vgap=4, hgap=4)
|
fgs2 = wx.FlexGridSizer(cols=25, vgap=4, hgap=4)
|
||||||
@@ -114,7 +118,7 @@ def runTest(frame, nb, log):
|
|||||||
|
|
||||||
|
|
||||||
overview = """<html><body>
|
overview = """<html><body>
|
||||||
wxScrolledPanel fills a "hole" in the implementation of wxScrolledWindow,
|
ScrolledPanel fills a "hole" in the implementation of wxScrolledWindow,
|
||||||
providing automatic scrollbar and scrolling behavior and the tab traversal
|
providing automatic scrollbar and scrolling behavior and the tab traversal
|
||||||
mangement that wxScrolledWindow lacks.
|
mangement that wxScrolledWindow lacks.
|
||||||
</body></html>
|
</body></html>
|
||||||
|
@@ -11,6 +11,11 @@
|
|||||||
#
|
#
|
||||||
# o New binders applied. Issues still exist.
|
# o New binders applied. Issues still exist.
|
||||||
#
|
#
|
||||||
|
# 12/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxTimeCtrl -> TimeCtrl
|
||||||
|
# o wxScrolledPanel -> ScrolledPanel
|
||||||
|
#
|
||||||
|
|
||||||
import wx
|
import wx
|
||||||
import wx.lib.timectrl as timectl
|
import wx.lib.timectrl as timectl
|
||||||
@@ -18,27 +23,27 @@ import wx.lib.scrolledpanel as scrolled
|
|||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
class TestPanel( scrolled.wxScrolledPanel ):
|
class TestPanel( scrolled.ScrolledPanel ):
|
||||||
def __init__( self, parent, log ):
|
def __init__( self, parent, log ):
|
||||||
|
|
||||||
scrolled.wxScrolledPanel.__init__( self, parent, -1 )
|
scrolled.ScrolledPanel.__init__( self, parent, -1 )
|
||||||
self.log = log
|
self.log = log
|
||||||
|
|
||||||
|
|
||||||
text1 = wx.StaticText( self, -1, "12-hour format:")
|
text1 = wx.StaticText( self, -1, "12-hour format:")
|
||||||
self.time12 = timectl.wxTimeCtrl( self, -1, name="12 hour control" )
|
self.time12 = timectl.TimeCtrl( self, -1, name="12 hour control" )
|
||||||
spin1 = wx.SpinButton( self, -1, wx.DefaultPosition, (-1,20), 0 )
|
spin1 = wx.SpinButton( self, -1, wx.DefaultPosition, (-1,20), 0 )
|
||||||
self.time12.BindSpinButton( spin1 )
|
self.time12.BindSpinButton( spin1 )
|
||||||
|
|
||||||
text2 = wx.StaticText( self, -1, "24-hour format:")
|
text2 = wx.StaticText( self, -1, "24-hour format:")
|
||||||
spin2 = wx.SpinButton( self, -1, wx.DefaultPosition, (-1,20), 0 )
|
spin2 = wx.SpinButton( self, -1, wx.DefaultPosition, (-1,20), 0 )
|
||||||
self.time24 = timectl.wxTimeCtrl(
|
self.time24 = timectl.TimeCtrl(
|
||||||
self, -1, name="24 hour control", fmt24hr=True,
|
self, -1, name="24 hour control", fmt24hr=True,
|
||||||
spinButton = spin2
|
spinButton = spin2
|
||||||
)
|
)
|
||||||
|
|
||||||
text3 = wx.StaticText( self, -1, "No seconds\nor spin button:")
|
text3 = wx.StaticText( self, -1, "No seconds\nor spin button:")
|
||||||
self.spinless_ctrl = timectl.wxTimeCtrl(
|
self.spinless_ctrl = timectl.TimeCtrl(
|
||||||
self, -1, name="spinless control",
|
self, -1, name="spinless control",
|
||||||
display_seconds = False
|
display_seconds = False
|
||||||
)
|
)
|
||||||
@@ -94,17 +99,17 @@ class TestPanel( scrolled.wxScrolledPanel ):
|
|||||||
self.set_bounds = wx.CheckBox( self, -1, "Set time bounds:" )
|
self.set_bounds = wx.CheckBox( self, -1, "Set time bounds:" )
|
||||||
|
|
||||||
minlabel = wx.StaticText( self, -1, "minimum time:" )
|
minlabel = wx.StaticText( self, -1, "minimum time:" )
|
||||||
self.min = timectl.wxTimeCtrl( self, -1, name="min", display_seconds = False )
|
self.min = timectl.TimeCtrl( self, -1, name="min", display_seconds = False )
|
||||||
self.min.Enable( False )
|
self.min.Enable( False )
|
||||||
|
|
||||||
maxlabel = wx.StaticText( self, -1, "maximum time:" )
|
maxlabel = wx.StaticText( self, -1, "maximum time:" )
|
||||||
self.max = timectl.wxTimeCtrl( self, -1, name="max", display_seconds = False )
|
self.max = timectl.TimeCtrl( self, -1, name="max", display_seconds = False )
|
||||||
self.max.Enable( False )
|
self.max.Enable( False )
|
||||||
|
|
||||||
self.limit_check = wx.CheckBox( self, -1, "Limit control" )
|
self.limit_check = wx.CheckBox( self, -1, "Limit control" )
|
||||||
|
|
||||||
label = wx.StaticText( self, -1, "Resulting time control:" )
|
label = wx.StaticText( self, -1, "Resulting time control:" )
|
||||||
self.target_ctrl = timectl.wxTimeCtrl( self, -1, name="new" )
|
self.target_ctrl = timectl.TimeCtrl( self, -1, name="new" )
|
||||||
|
|
||||||
grid2 = wx.FlexGridSizer( 0, 2, 0, 0 )
|
grid2 = wx.FlexGridSizer( 0, 2, 0, 0 )
|
||||||
grid2.Add( (20, 0), 0, wx.ALIGN_LEFT|wx.ALL, 5 )
|
grid2.Add( (20, 0), 0, wx.ALIGN_LEFT|wx.ALL, 5 )
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
"""
|
"""
|
||||||
wxPyColourChooser
|
PyColourChooser
|
||||||
Copyright (C) 2002 Michael Gilfix <mgilfix@eecs.tufts.edu>
|
Copyright (C) 2002 Michael Gilfix <mgilfix@eecs.tufts.edu>
|
||||||
|
|
||||||
This file is part of wxPyColourChooser.
|
This file is part of PyColourChooser.
|
||||||
|
|
||||||
This version of wxPyColourChooser is open source; you can redistribute it
|
This version of PyColourChooser is open source; you can redistribute it
|
||||||
and/or modify it under the licensed terms.
|
and/or modify it under the licensed terms.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
@@ -16,11 +16,16 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|||||||
#
|
#
|
||||||
# o 2.5 compatability update.
|
# o 2.5 compatability update.
|
||||||
#
|
#
|
||||||
|
# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxPyColorChooser -> PyColorChooser
|
||||||
|
# o wxPyColourChooser -> PyColourChooser
|
||||||
|
#
|
||||||
|
|
||||||
from pycolourchooser import *
|
from pycolourchooser import *
|
||||||
|
|
||||||
# For the American in you
|
# For the American in you
|
||||||
wxPyColorChooser = wxPyColourChooser
|
PyColorChooser = PyColourChooser
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'canvas',
|
'canvas',
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
"""
|
"""
|
||||||
wxPyColourChooser
|
PyColourChooser
|
||||||
Copyright (C) 2002 Michael Gilfix <mgilfix@eecs.tufts.edu>
|
Copyright (C) 2002 Michael Gilfix <mgilfix@eecs.tufts.edu>
|
||||||
|
|
||||||
This file is part of wxPyColourChooser.
|
This file is part of PyColourChooser.
|
||||||
|
|
||||||
This version of wxPyColourChooser is open source; you can redistribute it
|
This version of PyColourChooser is open source; you can redistribute it
|
||||||
and/or modify it under the licensed terms.
|
and/or modify it under the licensed terms.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
@@ -16,6 +16,11 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|||||||
#
|
#
|
||||||
# o 2.5 compatability update.
|
# o 2.5 compatability update.
|
||||||
#
|
#
|
||||||
|
# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxPyColorChooser -> PyColorChooser
|
||||||
|
# o wxPyColourChooser -> PyColourChooser
|
||||||
|
#
|
||||||
|
|
||||||
import wx
|
import wx
|
||||||
|
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
"""
|
"""
|
||||||
wxPyColourChooser
|
PyColourChooser
|
||||||
Copyright (C) 2002 Michael Gilfix <mgilfix@eecs.tufts.edu>
|
Copyright (C) 2002 Michael Gilfix <mgilfix@eecs.tufts.edu>
|
||||||
|
|
||||||
This file is part of wxPyColourChooser.
|
This file is part of PyColourChooser.
|
||||||
|
|
||||||
This version of wxPyColourChooser is open source; you can redistribute it
|
This version of PyColourChooser is open source; you can redistribute it
|
||||||
and/or modify it under the licensed terms.
|
and/or modify it under the licensed terms.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
@@ -15,8 +15,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|||||||
try:
|
try:
|
||||||
import gettext
|
import gettext
|
||||||
|
|
||||||
gettext.bindtextdomain('wxpycolourchooser')
|
gettext.bindtextdomain('pycolourchooser')
|
||||||
gettext.textdomain('wxpycolourchooser')
|
gettext.textdomain('pycolourchooser')
|
||||||
_ = gettext.gettext
|
_ = gettext.gettext
|
||||||
except Exception, strerror:
|
except Exception, strerror:
|
||||||
print "Warning: Couldn't import translation function: %(str)s" %{ 'str' : strerror }
|
print "Warning: Couldn't import translation function: %(str)s" %{ 'str' : strerror }
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
"""
|
"""
|
||||||
wxPyColourChooser
|
PyColourChooser
|
||||||
Copyright (C) 2002 Michael Gilfix <mgilfix@eecs.tufts.edu>
|
Copyright (C) 2002 Michael Gilfix <mgilfix@eecs.tufts.edu>
|
||||||
|
|
||||||
This file is part of wxPyColourChooser.
|
This file is part of PyColourChooser.
|
||||||
|
|
||||||
This version of wxPyColourChooser is open source; you can redistribute it
|
This version of PyColourChooser is open source; you can redistribute it
|
||||||
and/or modify it under the licensed terms.
|
and/or modify it under the licensed terms.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
@@ -15,6 +15,11 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|||||||
#
|
#
|
||||||
# o 2.5 compatability update.
|
# o 2.5 compatability update.
|
||||||
#
|
#
|
||||||
|
# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxPyColorChooser -> PyColorChooser
|
||||||
|
# o wxPyColourChooser -> PyColourChooser
|
||||||
|
#
|
||||||
|
|
||||||
import wx
|
import wx
|
||||||
|
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
"""
|
"""
|
||||||
wxPyColourChooser
|
PyColourChooser
|
||||||
Copyright (C) 2002 Michael Gilfix <mgilfix@eecs.tufts.edu>
|
Copyright (C) 2002 Michael Gilfix <mgilfix@eecs.tufts.edu>
|
||||||
|
|
||||||
This file is part of wxPyColourChooser.
|
This file is part of PyColourChooser.
|
||||||
|
|
||||||
This version of wxPyColourChooser is open source; you can redistribute it
|
This version of PyColourChooser is open source; you can redistribute it
|
||||||
and/or modify it under the licensed terms.
|
and/or modify it under the licensed terms.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
@@ -16,6 +16,13 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|||||||
#
|
#
|
||||||
# o 2.5 compatability update.
|
# o 2.5 compatability update.
|
||||||
#
|
#
|
||||||
|
# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxPyColorChooser -> PyColorChooser
|
||||||
|
# o wxPyColourChooser -> PyColourChooser
|
||||||
|
# o Added wx.InitAllImageHandlers() to test code since
|
||||||
|
# that's where it belongs.
|
||||||
|
#
|
||||||
|
|
||||||
import wx
|
import wx
|
||||||
|
|
||||||
@@ -27,7 +34,7 @@ import intl
|
|||||||
|
|
||||||
from intl import _ # _
|
from intl import _ # _
|
||||||
|
|
||||||
class wxPyColourChooser(wx.Panel):
|
class PyColourChooser(wx.Panel):
|
||||||
"""A Pure-Python implementation of the colour chooser dialog.
|
"""A Pure-Python implementation of the colour chooser dialog.
|
||||||
|
|
||||||
The PyColourChooser is a pure python implementation of the colour
|
The PyColourChooser is a pure python implementation of the colour
|
||||||
@@ -383,7 +390,13 @@ def main():
|
|||||||
def OnInit(self):
|
def OnInit(self):
|
||||||
frame = wx.Frame(None, -1, 'PyColourChooser Test')
|
frame = wx.Frame(None, -1, 'PyColourChooser Test')
|
||||||
|
|
||||||
chooser = wxPyColourChooser(frame, -1)
|
# Added here because that's where it's supposed to be,
|
||||||
|
# not embedded in the library. If it's embedded in the
|
||||||
|
# library, debug messages will be generated for duplicate
|
||||||
|
# handlers.
|
||||||
|
wx.InitAllImageHandlers()
|
||||||
|
|
||||||
|
chooser = PyColourChooser(frame, -1)
|
||||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||||
sizer.Add(chooser, 0, 0)
|
sizer.Add(chooser, 0, 0)
|
||||||
frame.SetAutoLayout(True)
|
frame.SetAutoLayout(True)
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
"""
|
"""
|
||||||
wxPyColourChooser
|
PyColourChooser
|
||||||
Copyright (C) 2002 Michael Gilfix
|
Copyright (C) 2002 Michael Gilfix
|
||||||
|
|
||||||
This file is part of wxPyColourChooser.
|
This file is part of PyColourChooser.
|
||||||
|
|
||||||
You should have received a file COPYING containing license terms
|
You should have received a file COPYING containing license terms
|
||||||
along with this program; if not, write to Michael Gilfix
|
along with this program; if not, write to Michael Gilfix
|
||||||
(mgilfix@eecs.tufts.edu) for a copy.
|
(mgilfix@eecs.tufts.edu) for a copy.
|
||||||
|
|
||||||
This version of wxPyColourChooser is open source; you can redistribute it and/or
|
This version of PyColourChooser is open source; you can redistribute it and/or
|
||||||
modify it under the terms listed in the file COPYING.
|
modify it under the terms listed in the file COPYING.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
@@ -20,6 +20,11 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|||||||
#
|
#
|
||||||
# o 2.5 compatability update.
|
# o 2.5 compatability update.
|
||||||
#
|
#
|
||||||
|
# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxPyColorChooser -> PyColorChooser
|
||||||
|
# o wxPyColourChooser -> PyColourChooser
|
||||||
|
#
|
||||||
|
|
||||||
import wx
|
import wx
|
||||||
|
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
"""
|
"""
|
||||||
wxPyColourChooser
|
PyColourChooser
|
||||||
Copyright (C) 2002 Michael Gilfix
|
Copyright (C) 2002 Michael Gilfix
|
||||||
|
|
||||||
This file is part of wxPyColourChooser.
|
This file is part of PyColourChooser.
|
||||||
|
|
||||||
You should have received a file COPYING containing license terms
|
You should have received a file COPYING containing license terms
|
||||||
along with this program; if not, write to Michael Gilfix
|
along with this program; if not, write to Michael Gilfix
|
||||||
(mgilfix@eecs.tufts.edu) for a copy.
|
(mgilfix@eecs.tufts.edu) for a copy.
|
||||||
|
|
||||||
This version of wxPyColourChooser is open source; you can redistribute it and/or
|
This version of PyColourChooser is open source; you can redistribute it and/or
|
||||||
modify it under the terms listed in the file COPYING.
|
modify it under the terms listed in the file COPYING.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
@@ -19,6 +19,13 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|||||||
#
|
#
|
||||||
# o 2.5 compatability update.
|
# o 2.5 compatability update.
|
||||||
#
|
#
|
||||||
|
# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxPyColorChooser -> PyColorChooser
|
||||||
|
# o wxPyColourChooser -> PyColourChooser
|
||||||
|
# o Commented out wx.InitAllImageHandlers() (see comments at that
|
||||||
|
# point for explanation
|
||||||
|
#
|
||||||
|
|
||||||
import cStringIO
|
import cStringIO
|
||||||
import zlib
|
import zlib
|
||||||
@@ -164,7 +171,12 @@ class PyPalette(canvas.Canvas):
|
|||||||
def __init__(self, parent, id):
|
def __init__(self, parent, id):
|
||||||
"""Creates a palette object."""
|
"""Creates a palette object."""
|
||||||
# Load the pre-generated palette XPM
|
# Load the pre-generated palette XPM
|
||||||
wx.InitAllImageHandlers()
|
|
||||||
|
# Leaving this in causes warning messages in some cases.
|
||||||
|
# It is the responsibility of the app to init the image
|
||||||
|
# handlers, IAW RD
|
||||||
|
#wx.InitAllImageHandlers()
|
||||||
|
|
||||||
self.palette = getBitmap ()
|
self.palette = getBitmap ()
|
||||||
canvas.Canvas.__init__ (self, parent, id, size=(200, 192))
|
canvas.Canvas.__init__ (self, parent, id, size=(200, 192))
|
||||||
|
|
||||||
|
@@ -13,9 +13,13 @@
|
|||||||
#
|
#
|
||||||
# o 2.5 compatability update.
|
# o 2.5 compatability update.
|
||||||
#
|
#
|
||||||
|
# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxEditor -> Editor
|
||||||
|
#
|
||||||
|
|
||||||
# This file makes this directory into a Python package
|
# This file makes this directory into a Python package
|
||||||
|
|
||||||
|
|
||||||
# import the main classes into the package namespace.
|
# import the main classes into the package namespace.
|
||||||
from editor import wxEditor
|
from editor import Editor
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
# Name: wxPython.lib.editor.wxEditor
|
# Name: wxPython.lib.editor.Editor
|
||||||
# Purpose: An intelligent text editor with colorization capabilities.
|
# Purpose: An intelligent text editor with colorization capabilities.
|
||||||
#
|
#
|
||||||
# Original
|
# Original
|
||||||
@@ -24,6 +24,10 @@
|
|||||||
#
|
#
|
||||||
# o 2.5 compatability update.
|
# o 2.5 compatability update.
|
||||||
#
|
#
|
||||||
|
# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxEditor -> Editor
|
||||||
|
#
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
@@ -75,7 +79,7 @@ class Scroller:
|
|||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
class wxEditor(wx.ScrolledWindow):
|
class Editor(wx.ScrolledWindow):
|
||||||
|
|
||||||
def __init__(self, parent, id,
|
def __init__(self, parent, id,
|
||||||
pos=wx.DefaultPosition, size=wx.DefaultSize, style=0):
|
pos=wx.DefaultPosition, size=wx.DefaultSize, style=0):
|
||||||
|
@@ -14,15 +14,26 @@
|
|||||||
#
|
#
|
||||||
# o 2.5 Compatability changes
|
# o 2.5 Compatability changes
|
||||||
#
|
#
|
||||||
|
# 12/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o In keeping with the common idiom, the sizers in this module
|
||||||
|
# have been given the 'Py' prefix to avoid confusion with the
|
||||||
|
# native sizers of the same name. However, the reverse renamer
|
||||||
|
# still has the old wx*Sizer since the whole point of the
|
||||||
|
# reverse renamer is backward compatability.
|
||||||
|
# o wxGridSizer -> PyGridSizer
|
||||||
|
# o wxFlexGridSizer -> PyFlexGridSizer
|
||||||
|
# o Deprecation warning added.
|
||||||
|
#
|
||||||
|
|
||||||
"""
|
"""
|
||||||
In this module you will find wxGridSizer and wxFlexGridSizer. Please
|
In this module you will find PyGridSizer and PyFlexGridSizer. Please
|
||||||
note that these sizers have since been ported to C++ and those
|
note that these sizers have since been ported to C++ (as wx.GridSizer
|
||||||
versions are now exposed in the regular wxPython wrappers. However I
|
and wx.FlexGridSizer) and those versions are now exposed in the regular
|
||||||
am also leaving them here in the library so they can serve as an
|
wxPython wrappers. However I am also leaving them here in the library
|
||||||
example of how to implement sizers in Python.
|
so they can serve as an example of how to implement sizers in Python.
|
||||||
|
|
||||||
wxGridSizer: Sizes and positions items such that all rows are the same
|
PyGridSizer: Sizes and positions items such that all rows are the same
|
||||||
height and all columns are the same width. You can specify a gap in
|
height and all columns are the same width. You can specify a gap in
|
||||||
pixels to be used between the rows and/or the columns. When you
|
pixels to be used between the rows and/or the columns. When you
|
||||||
create the sizer you specify the number of rows or the number of
|
create the sizer you specify the number of rows or the number of
|
||||||
@@ -33,7 +44,7 @@ center of the space. When the sizer is resized, all the items are
|
|||||||
resized the same amount so all rows and all columns remain the same
|
resized the same amount so all rows and all columns remain the same
|
||||||
size.
|
size.
|
||||||
|
|
||||||
wxFlexGridSizer: Derives from wxGridSizer and adds the ability for
|
PyFlexGridSizer: Derives from PyGridSizer and adds the ability for
|
||||||
particular rows and/or columns to be marked as growable. This means
|
particular rows and/or columns to be marked as growable. This means
|
||||||
that when the sizer changes size, the growable rows and colums are the
|
that when the sizer changes size, the growable rows and colums are the
|
||||||
ones that stretch. The others remain at their initial size.
|
ones that stretch. The others remain at their initial size.
|
||||||
@@ -41,11 +52,28 @@ ones that stretch. The others remain at their initial size.
|
|||||||
|
|
||||||
|
|
||||||
import operator
|
import operator
|
||||||
|
import warnings
|
||||||
import wx
|
import wx
|
||||||
|
|
||||||
|
warningmsg = r"""\
|
||||||
|
|
||||||
|
################################################\
|
||||||
|
# THIS MODULE IS DEPRECATED |
|
||||||
|
# |
|
||||||
|
# You should use the native wx.GridSizer and |
|
||||||
|
# wx.FlexGridSizer unless there is a compelling |
|
||||||
|
# need to use this module. |
|
||||||
|
################################################/
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
warnings.warn(warningmsg, DeprecationWarning, stacklevel=2)
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
class wxGridSizer(wx.PySizer):
|
class PyGridSizer(wx.PySizer):
|
||||||
def __init__(self, rows=0, cols=0, hgap=0, vgap=0):
|
def __init__(self, rows=0, cols=0, hgap=0, vgap=0):
|
||||||
wx.PySizer.__init__(self)
|
wx.PySizer.__init__(self)
|
||||||
if rows == 0 and cols == 0:
|
if rows == 0 and cols == 0:
|
||||||
@@ -171,7 +199,7 @@ class wxGridSizer(wx.PySizer):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
class wxFlexGridSizer(wxGridSizer):
|
class PyFlexGridSizer(wxGridSizer):
|
||||||
def __init__(self, rows=0, cols=0, hgap=0, vgap=0):
|
def __init__(self, rows=0, cols=0, hgap=0, vgap=0):
|
||||||
wxGridSizer.__init__(self, rows, cols, hgap, vgap)
|
wxGridSizer.__init__(self, rows, cols, hgap, vgap)
|
||||||
self.rowHeights = []
|
self.rowHeights = []
|
||||||
|
@@ -124,7 +124,7 @@ class ImageDialog(wx.Dialog):
|
|||||||
self.y_pos = 20
|
self.y_pos = 20
|
||||||
self.delta = 20
|
self.delta = 20
|
||||||
|
|
||||||
size = wxSize(80, 25)
|
size = wx.Size(80, 25)
|
||||||
|
|
||||||
self.set_dir = os.getcwd()
|
self.set_dir = os.getcwd()
|
||||||
self.set_file = None
|
self.set_file = None
|
||||||
|
@@ -1,3 +1,9 @@
|
|||||||
|
# 12/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxPyInformationalMessagesFrame -> PyInformationalMessagesFrame
|
||||||
|
# o dummy_wxPyInformationalMessagesFrame -> dummy_PyInformationalMessagesFrame
|
||||||
|
#
|
||||||
|
|
||||||
"""
|
"""
|
||||||
infoframe.py
|
infoframe.py
|
||||||
Released under wxWindows license etc.
|
Released under wxWindows license etc.
|
||||||
@@ -30,7 +36,7 @@ Typical usage:
|
|||||||
from wxPython.lib.infoframe import *
|
from wxPython.lib.infoframe import *
|
||||||
... # ... modify your wxApp as follows:
|
... # ... modify your wxApp as follows:
|
||||||
class myApp(wxApp):
|
class myApp(wxApp):
|
||||||
outputWindowClass = wxPyInformationalMessagesFrame
|
outputWindowClass = PyInformationalMessagesFrame
|
||||||
...
|
...
|
||||||
If you're running on Linux, you'll also have to supply an argument 1 to your
|
If you're running on Linux, you'll also have to supply an argument 1 to your
|
||||||
constructor of myApp to redirect stdout/stderr to this window (it's done
|
constructor of myApp to redirect stdout/stderr to this window (it's done
|
||||||
@@ -39,7 +45,7 @@ automatically for you on Windows).
|
|||||||
If you don't want to redirect stdout/stderr, but use the class directly: do
|
If you don't want to redirect stdout/stderr, but use the class directly: do
|
||||||
it this way:
|
it this way:
|
||||||
|
|
||||||
InformationalMessagesFrame = wxPyInformationalMessagesFrame\
|
InformationalMessagesFrame = PyInformationalMessagesFrame\
|
||||||
([options from progname (default ""),
|
([options from progname (default ""),
|
||||||
txt (default "informational
|
txt (default "informational
|
||||||
messages"])
|
messages"])
|
||||||
@@ -192,7 +198,7 @@ class _MyStatusBar(wx.StatusBar):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
class wxPyInformationalMessagesFrame:
|
class PyInformationalMessagesFrame:
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
progname="",
|
progname="",
|
||||||
text="informational messages",
|
text="informational messages",
|
||||||
@@ -456,7 +462,7 @@ class wxPyInformationalMessagesFrame:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Dummy_wxPyInformationalMessagesFrame:
|
class Dummy_PyInformationalMessagesFrame:
|
||||||
def __init__(self,progname=""):
|
def __init__(self,progname=""):
|
||||||
self.softspace = 1
|
self.softspace = 1
|
||||||
def __call__(self,*args):
|
def __call__(self,*args):
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
# NOTE:
|
# NOTE:
|
||||||
# This was written to provide a standard integer edit control for wxPython.
|
# This was written to provide a standard integer edit control for wxPython.
|
||||||
#
|
#
|
||||||
# wxIntCtrl permits integer (long) values to be retrieved or set via
|
# IntCtrl permits integer (long) values to be retrieved or set via
|
||||||
# .GetValue() and .SetValue(), and provides an EVT_INT() event function
|
# .GetValue() and .SetValue(), and provides an EVT_INT() event function
|
||||||
# for trapping changes to the control.
|
# for trapping changes to the control.
|
||||||
#
|
#
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
# contents of the control with '-' will result in a selected (absolute)
|
# contents of the control with '-' will result in a selected (absolute)
|
||||||
# value of -1.
|
# value of -1.
|
||||||
#
|
#
|
||||||
# wxIntCtrl also supports range limits, with the option of either
|
# IntCtrl also supports range limits, with the option of either
|
||||||
# enforcing them or simply coloring the text of the control if the limits
|
# enforcing them or simply coloring the text of the control if the limits
|
||||||
# are exceeded.
|
# are exceeded.
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
@@ -29,6 +29,12 @@
|
|||||||
#
|
#
|
||||||
# o 2.5 Compatability changes
|
# o 2.5 Compatability changes
|
||||||
#
|
#
|
||||||
|
# 12/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxIntUpdateEvent -> IntUpdateEvent
|
||||||
|
# o wxIntValidator -> IntValidator
|
||||||
|
# o wxIntCtrl -> IntCtrl
|
||||||
|
#
|
||||||
|
|
||||||
import string
|
import string
|
||||||
import types
|
import types
|
||||||
@@ -59,7 +65,7 @@ EVT_INT = wx.PyEventBinder(wxEVT_COMMAND_INT_UPDATED, 1)
|
|||||||
WXK_CTRL_X = (ord('X')+1) - ord('A')
|
WXK_CTRL_X = (ord('X')+1) - ord('A')
|
||||||
WXK_CTRL_V = (ord('V')+1) - ord('A')
|
WXK_CTRL_V = (ord('V')+1) - ord('A')
|
||||||
|
|
||||||
class wxIntUpdatedEvent(wx.PyCommandEvent):
|
class IntUpdatedEvent(wx.PyCommandEvent):
|
||||||
def __init__(self, id, value = 0, object=None):
|
def __init__(self, id, value = 0, object=None):
|
||||||
wx.PyCommandEvent.__init__(self, wxEVT_COMMAND_INT_UPDATED, id)
|
wx.PyCommandEvent.__init__(self, wxEVT_COMMAND_INT_UPDATED, id)
|
||||||
|
|
||||||
@@ -74,9 +80,9 @@ class wxIntUpdatedEvent(wx.PyCommandEvent):
|
|||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
class wxIntValidator( wx.PyValidator ):
|
class IntValidator( wx.PyValidator ):
|
||||||
"""
|
"""
|
||||||
Validator class used with wxIntCtrl; handles all validation of input
|
Validator class used with IntCtrl; handles all validation of input
|
||||||
prior to changing the value of the underlying wx.TextCtrl.
|
prior to changing the value of the underlying wx.TextCtrl.
|
||||||
"""
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@@ -341,12 +347,12 @@ class wxIntValidator( wx.PyValidator ):
|
|||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
class wxIntCtrl(wx.TextCtrl):
|
class IntCtrl(wx.TextCtrl):
|
||||||
"""
|
"""
|
||||||
This class provides a control that takes and returns integers as
|
This class provides a control that takes and returns integers as
|
||||||
value, and provides bounds support and optional value limiting.
|
value, and provides bounds support and optional value limiting.
|
||||||
|
|
||||||
wxIntCtrl(
|
IntCtrl(
|
||||||
parent, id = -1,
|
parent, id = -1,
|
||||||
value = 0,
|
value = 0,
|
||||||
pos = wxDefaultPosition,
|
pos = wxDefaultPosition,
|
||||||
@@ -404,10 +410,10 @@ class wxIntCtrl(wx.TextCtrl):
|
|||||||
when the bounds are set but the control is not limited.
|
when the bounds are set but the control is not limited.
|
||||||
|
|
||||||
validator
|
validator
|
||||||
Normally None, wxIntCtrl uses its own validator to do value
|
Normally None, IntCtrl uses its own validator to do value
|
||||||
validation and input control. However, a validator derived
|
validation and input control. However, a validator derived
|
||||||
from wxIntValidator can be supplied to override the data
|
from IntValidator can be supplied to override the data
|
||||||
transfer methods for the wxIntValidator class.
|
transfer methods for the IntValidator class.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__ (
|
def __init__ (
|
||||||
@@ -431,7 +437,7 @@ class wxIntCtrl(wx.TextCtrl):
|
|||||||
self.__oldvalue = None
|
self.__oldvalue = None
|
||||||
|
|
||||||
if validator == wx.DefaultValidator:
|
if validator == wx.DefaultValidator:
|
||||||
validator = wxIntValidator()
|
validator = IntValidator()
|
||||||
|
|
||||||
wx.TextCtrl.__init__(
|
wx.TextCtrl.__init__(
|
||||||
self, parent, id, self._toGUI(0),
|
self, parent, id, self._toGUI(0),
|
||||||
@@ -464,7 +470,7 @@ class wxIntCtrl(wx.TextCtrl):
|
|||||||
if value != self.__oldvalue:
|
if value != self.__oldvalue:
|
||||||
try:
|
try:
|
||||||
self.GetEventHandler().ProcessEvent(
|
self.GetEventHandler().ProcessEvent(
|
||||||
wxIntUpdatedEvent( self.GetId(), self.GetValue(), self ) )
|
IntUpdatedEvent( self.GetId(), self.GetValue(), self ) )
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return
|
return
|
||||||
# let normal processing of the text continue
|
# let normal processing of the text continue
|
||||||
@@ -632,7 +638,7 @@ class wxIntCtrl(wx.TextCtrl):
|
|||||||
if( not (value is None and self.IsNoneAllowed())
|
if( not (value is None and self.IsNoneAllowed())
|
||||||
and type(value) not in (types.IntType, types.LongType) ):
|
and type(value) not in (types.IntType, types.LongType) ):
|
||||||
raise ValueError (
|
raise ValueError (
|
||||||
'wxIntCtrl requires integer values, passed %s'% repr(value) )
|
'IntCtrl requires integer values, passed %s'% repr(value) )
|
||||||
|
|
||||||
min = self.GetMin()
|
min = self.GetMin()
|
||||||
max = self.GetMax()
|
max = self.GetMax()
|
||||||
@@ -729,10 +735,10 @@ class wxIntCtrl(wx.TextCtrl):
|
|||||||
return ''
|
return ''
|
||||||
elif type(value) == types.LongType and not self.IsLongAllowed():
|
elif type(value) == types.LongType and not self.IsLongAllowed():
|
||||||
raise ValueError (
|
raise ValueError (
|
||||||
'wxIntCtrl requires integer value, passed long' )
|
'IntCtrl requires integer value, passed long' )
|
||||||
elif type(value) not in (types.IntType, types.LongType):
|
elif type(value) not in (types.IntType, types.LongType):
|
||||||
raise ValueError (
|
raise ValueError (
|
||||||
'wxIntCtrl requires integer value, passed %s'% repr(value) )
|
'IntCtrl requires integer value, passed %s'% repr(value) )
|
||||||
|
|
||||||
elif self.IsLimited():
|
elif self.IsLimited():
|
||||||
min = self.GetMin()
|
min = self.GetMin()
|
||||||
@@ -850,7 +856,7 @@ if __name__ == '__main__':
|
|||||||
style = wx.DEFAULT_DIALOG_STYLE ):
|
style = wx.DEFAULT_DIALOG_STYLE ):
|
||||||
wx.Dialog.__init__(self, parent, id, title, pos, size, style)
|
wx.Dialog.__init__(self, parent, id, title, pos, size, style)
|
||||||
|
|
||||||
self.int_ctrl = wxIntCtrl(self, wx.NewId(), size=(55,20))
|
self.int_ctrl = IntCtrl(self, wx.NewId(), size=(55,20))
|
||||||
self.OK = wx.Button( self, wx.ID_OK, "OK")
|
self.OK = wx.Button( self, wx.ID_OK, "OK")
|
||||||
self.Cancel = wx.Button( self, wx.ID_CANCEL, "Cancel")
|
self.Cancel = wx.Button( self, wx.ID_CANCEL, "Cancel")
|
||||||
|
|
||||||
@@ -883,7 +889,7 @@ if __name__ == '__main__':
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def OnClick(self, event):
|
def OnClick(self, event):
|
||||||
dlg = myDialog(self.panel, -1, "test wxIntCtrl")
|
dlg = myDialog(self.panel, -1, "test IntCtrl")
|
||||||
dlg.int_ctrl.SetValue(501)
|
dlg.int_ctrl.SetValue(501)
|
||||||
dlg.int_ctrl.SetInsertionPoint(1)
|
dlg.int_ctrl.SetInsertionPoint(1)
|
||||||
dlg.int_ctrl.SetSelection(1,2)
|
dlg.int_ctrl.SetSelection(1,2)
|
||||||
|
@@ -10,21 +10,25 @@
|
|||||||
#
|
#
|
||||||
# o Updated for wx namespace (minor)
|
# o Updated for wx namespace (minor)
|
||||||
#
|
#
|
||||||
|
# 12/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o Removed wx prefix
|
||||||
|
#
|
||||||
|
|
||||||
"""<html><body>
|
"""<html><body>
|
||||||
<P>
|
<P>
|
||||||
<B>wxMaskedCtrl</B> is actually a factory function for several types of
|
<B>MaskedCtrl</B> is actually a factory function for several types of
|
||||||
masked edit controls:
|
masked edit controls:
|
||||||
<P>
|
<P>
|
||||||
<UL>
|
<UL>
|
||||||
<LI><b>wxMaskedTextCtrl</b> - standard masked edit text box</LI>
|
<LI><b>MaskedTextCtrl</b> - standard masked edit text box</LI>
|
||||||
<LI><b>wxMaskedComboBox</b> - adds combobox capabilities</LI>
|
<LI><b>MaskedComboBox</b> - adds combobox capabilities</LI>
|
||||||
<LI><b>wxIpAddrCtrl</b> - adds logical input semantics for IP address entry</LI>
|
<LI><b>IpAddrCtrl</b> - adds logical input semantics for IP address entry</LI>
|
||||||
<LI><b>wxTimeCtrl</b> - special subclass handling lots of time formats as values</LI>
|
<LI><b>TimeCtrl</b> - special subclass handling lots of time formats as values</LI>
|
||||||
<LI><b>wxMaskedNumCtrl</b> - special subclass handling numeric values</LI>
|
<LI><b>MaskedNumCtrl</b> - special subclass handling numeric values</LI>
|
||||||
</UL>
|
</UL>
|
||||||
<P>
|
<P>
|
||||||
<B>wxMaskedCtrl</B> works by looking for a special <b><i>controlType</i></b>
|
<B>MaskedCtrl</B> works by looking for a special <b><i>controlType</i></b>
|
||||||
parameter in the variable arguments of the control, to determine
|
parameter in the variable arguments of the control, to determine
|
||||||
what kind of instance to return.
|
what kind of instance to return.
|
||||||
controlType can be one of:
|
controlType can be one of:
|
||||||
@@ -38,22 +42,22 @@ controlType can be one of:
|
|||||||
These constants are also available individually, ie, you can
|
These constants are also available individually, ie, you can
|
||||||
use either of the following:
|
use either of the following:
|
||||||
<PRE><FONT SIZE=-1>
|
<PRE><FONT SIZE=-1>
|
||||||
from wxPython.wx.lib.maskedctrl import wxMaskedCtrl, MASKEDCOMBO, MASKEDTEXT, NUMBER
|
from wxPython.wx.lib.maskedctrl import MaskedCtrl, MASKEDCOMBO, MASKEDTEXT, NUMBER
|
||||||
from wxPython.wx.lib.maskedctrl import wxMaskedCtrl, controlTypes
|
from wxPython.wx.lib.maskedctrl import MaskedCtrl, controlTypes
|
||||||
</FONT></PRE>
|
</FONT></PRE>
|
||||||
If not specified as a keyword argument, the default controlType is
|
If not specified as a keyword argument, the default controlType is
|
||||||
controlTypes.MASKEDTEXT.
|
controlTypes.MASKEDTEXT.
|
||||||
<P>
|
<P>
|
||||||
Each of the above classes has its own unique arguments, but wxMaskedCtrl
|
Each of the above classes has its own unique arguments, but MaskedCtrl
|
||||||
provides a single "unified" interface for masked controls. wxMaskedTextCtrl,
|
provides a single "unified" interface for masked controls. MaskedTextCtrl,
|
||||||
wxMaskedComboBox and wxIpAddrCtrl are all documented below; the others have
|
MaskedComboBox and IpAddrCtrl are all documented below; the others have
|
||||||
their own demo pages and interface descriptions.
|
their own demo pages and interface descriptions.
|
||||||
</body></html>
|
</body></html>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from wx.lib.maskededit import wxMaskedTextCtrl, wxMaskedComboBox, wxIpAddrCtrl
|
from wx.lib.maskededit import MaskedTextCtrl, MaskedComboBox, IpAddrCtrl
|
||||||
from wx.lib.maskednumctrl import wxMaskedNumCtrl
|
from wx.lib.maskednumctrl import MaskedNumCtrl
|
||||||
from wx.lib.timectrl import wxTimeCtrl
|
from wx.lib.timectrl import TimeCtrl
|
||||||
|
|
||||||
|
|
||||||
# "type" enumeration for class instance factory function
|
# "type" enumeration for class instance factory function
|
||||||
@@ -72,7 +76,7 @@ class controlTypes:
|
|||||||
NUMBER = NUMBER
|
NUMBER = NUMBER
|
||||||
|
|
||||||
|
|
||||||
def wxMaskedCtrl( *args, **kwargs):
|
def MaskedCtrl( *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
Actually a factory function providing a unifying
|
Actually a factory function providing a unifying
|
||||||
interface for generating masked controls.
|
interface for generating masked controls.
|
||||||
@@ -84,19 +88,19 @@ def wxMaskedCtrl( *args, **kwargs):
|
|||||||
del kwargs['controlType']
|
del kwargs['controlType']
|
||||||
|
|
||||||
if controlType == MASKEDTEXT:
|
if controlType == MASKEDTEXT:
|
||||||
return wxMaskedTextCtrl(*args, **kwargs)
|
return MaskedTextCtrl(*args, **kwargs)
|
||||||
|
|
||||||
elif controlType == MASKEDCOMBO:
|
elif controlType == MASKEDCOMBO:
|
||||||
return wxMaskedComboBox(*args, **kwargs)
|
return MaskedComboBox(*args, **kwargs)
|
||||||
|
|
||||||
elif controlType == IPADDR:
|
elif controlType == IPADDR:
|
||||||
return wxIpAddrCtrl(*args, **kwargs)
|
return IpAddrCtrl(*args, **kwargs)
|
||||||
|
|
||||||
elif controlType == TIME:
|
elif controlType == TIME:
|
||||||
return wxTimeCtrl(*args, **kwargs)
|
return TimeCtrl(*args, **kwargs)
|
||||||
|
|
||||||
elif controlType == NUMBER:
|
elif controlType == NUMBER:
|
||||||
return wxMaskedNumCtrl(*args, **kwargs)
|
return MaskedNumCtrl(*args, **kwargs)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise AttributeError(
|
raise AttributeError(
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -9,10 +9,10 @@
|
|||||||
# NOTE:
|
# NOTE:
|
||||||
# This was written to provide a numeric edit control for wxPython that
|
# This was written to provide a numeric edit control for wxPython that
|
||||||
# does things like right-insert (like a calculator), and does grouping, etc.
|
# does things like right-insert (like a calculator), and does grouping, etc.
|
||||||
# (ie. the features of wxMaskedTextCtrl), but allows Get/Set of numeric
|
# (ie. the features of MaskedTextCtrl), but allows Get/Set of numeric
|
||||||
# values, rather than text.
|
# values, rather than text.
|
||||||
#
|
#
|
||||||
# wxMaskedNumCtrl permits integer, and floating point values to be set
|
# MaskedNumCtrl permits integer, and floating point values to be set
|
||||||
# retrieved or set via .GetValue() and .SetValue() (type chosen based on
|
# retrieved or set via .GetValue() and .SetValue() (type chosen based on
|
||||||
# fraction width, and provides an EVT_MASKEDNUM() event function for trapping
|
# fraction width, and provides an EVT_MASKEDNUM() event function for trapping
|
||||||
# changes to the control.
|
# changes to the control.
|
||||||
@@ -24,38 +24,45 @@
|
|||||||
# Similarly, replacing the contents of the control with '-' will result in
|
# Similarly, replacing the contents of the control with '-' will result in
|
||||||
# a selected (absolute) value of -1.
|
# a selected (absolute) value of -1.
|
||||||
#
|
#
|
||||||
# wxMaskedNumCtrl also supports range limits, with the option of either
|
# MaskedNumCtrl also supports range limits, with the option of either
|
||||||
# enforcing them or simply coloring the text of the control if the limits
|
# enforcing them or simply coloring the text of the control if the limits
|
||||||
# are exceeded.
|
# are exceeded.
|
||||||
#
|
#
|
||||||
# wxMaskedNumCtrl is intended to support fixed-point numeric entry, and
|
# MaskedNumCtrl is intended to support fixed-point numeric entry, and
|
||||||
# is derived from wxMaskedTextCtrl. As such, it supports a limited range
|
# is derived from MaskedTextCtrl. As such, it supports a limited range
|
||||||
# of values to comply with a fixed-width entry mask.
|
# of values to comply with a fixed-width entry mask.
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# 12/09/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
# 12/09/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
#
|
#
|
||||||
# o Updated for wx namespace
|
# o Updated for wx namespace
|
||||||
#
|
#
|
||||||
|
# 12/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxMaskedEditMixin -> MaskedEditMixin
|
||||||
|
# o wxMaskedTextCtrl -> MaskedTextCtrl
|
||||||
|
# o wxMaskedNumNumberUpdatedEvent -> MaskedNumNumberUpdatedEvent
|
||||||
|
# o wxMaskedNumCtrl -> MaskedNumCtrl
|
||||||
|
#
|
||||||
|
|
||||||
"""<html><body>
|
"""<html><body>
|
||||||
<P>
|
<P>
|
||||||
<B>wxMaskedNumCtrl:</B>
|
<B>MaskedNumCtrl:</B>
|
||||||
<UL>
|
<UL>
|
||||||
<LI>allows you to get and set integer or floating point numbers as value,</LI>
|
<LI>allows you to get and set integer or floating point numbers as value,</LI>
|
||||||
<LI>provides bounds support and optional value limiting,</LI>
|
<LI>provides bounds support and optional value limiting,</LI>
|
||||||
<LI>has the right-insert input style that wxMaskedTextCtrl supports,</LI>
|
<LI>has the right-insert input style that MaskedTextCtrl supports,</LI>
|
||||||
<LI>provides optional automatic grouping, sign control and format, grouping and decimal
|
<LI>provides optional automatic grouping, sign control and format, grouping and decimal
|
||||||
character selection, etc. etc.</LI>
|
character selection, etc. etc.</LI>
|
||||||
</UL>
|
</UL>
|
||||||
<P>
|
<P>
|
||||||
Being derived from wxMaskedTextCtrl, the control only allows
|
Being derived from MaskedTextCtrl, the control only allows
|
||||||
fixed-point notation. That is, it has a fixed (though reconfigurable)
|
fixed-point notation. That is, it has a fixed (though reconfigurable)
|
||||||
maximum width for the integer portion and optional fixed width
|
maximum width for the integer portion and optional fixed width
|
||||||
fractional portion.
|
fractional portion.
|
||||||
<P>
|
<P>
|
||||||
Here's the API:
|
Here's the API:
|
||||||
<DL><PRE>
|
<DL><PRE>
|
||||||
<B>wxMaskedNumCtrl</B>(
|
<B>MaskedNumCtrl</B>(
|
||||||
parent, id = -1,
|
parent, id = -1,
|
||||||
<B>value</B> = 0,
|
<B>value</B> = 0,
|
||||||
pos = wxDefaultPosition,
|
pos = wxDefaultPosition,
|
||||||
@@ -361,7 +368,7 @@ MAXINT = maxint # (constants should be in upper case)
|
|||||||
MININT = -maxint-1
|
MININT = -maxint-1
|
||||||
|
|
||||||
from wx.tools.dbg import Logger
|
from wx.tools.dbg import Logger
|
||||||
from wx.lib.maskededit import wxMaskedEditMixin, wxMaskedTextCtrl, Field
|
from wx.lib.maskededit import MaskedEditMixin, MaskedTextCtrl, Field
|
||||||
|
|
||||||
dbg = Logger()
|
dbg = Logger()
|
||||||
dbg(enable=0)
|
dbg(enable=0)
|
||||||
@@ -373,7 +380,7 @@ EVT_MASKEDNUM = wx.PyEventBinder(wxEVT_COMMAND_MASKED_NUMBER_UPDATED, 1)
|
|||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
class wxMaskedNumNumberUpdatedEvent(wx.PyCommandEvent):
|
class MaskedNumNumberUpdatedEvent(wx.PyCommandEvent):
|
||||||
def __init__(self, id, value = 0, object=None):
|
def __init__(self, id, value = 0, object=None):
|
||||||
wx.PyCommandEvent.__init__(self, wxEVT_COMMAND_MASKED_NUMBER_UPDATED, id)
|
wx.PyCommandEvent.__init__(self, wxEVT_COMMAND_MASKED_NUMBER_UPDATED, id)
|
||||||
|
|
||||||
@@ -388,7 +395,7 @@ class wxMaskedNumNumberUpdatedEvent(wx.PyCommandEvent):
|
|||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
class wxMaskedNumCtrl(wxMaskedTextCtrl):
|
class MaskedNumCtrl(MaskedTextCtrl):
|
||||||
|
|
||||||
valid_ctrl_params = {
|
valid_ctrl_params = {
|
||||||
'integerWidth': 10, # by default allow all 32-bit integers
|
'integerWidth': 10, # by default allow all 32-bit integers
|
||||||
@@ -419,21 +426,21 @@ class wxMaskedNumCtrl(wxMaskedTextCtrl):
|
|||||||
name = "maskednum",
|
name = "maskednum",
|
||||||
**kwargs ):
|
**kwargs ):
|
||||||
|
|
||||||
dbg('wxMaskedNumCtrl::__init__', indent=1)
|
dbg('MaskedNumCtrl::__init__', indent=1)
|
||||||
|
|
||||||
# Set defaults for control:
|
# Set defaults for control:
|
||||||
dbg('setting defaults:')
|
dbg('setting defaults:')
|
||||||
for key, param_value in wxMaskedNumCtrl.valid_ctrl_params.items():
|
for key, param_value in MaskedNumCtrl.valid_ctrl_params.items():
|
||||||
# This is done this way to make setattr behave consistently with
|
# This is done this way to make setattr behave consistently with
|
||||||
# "private attribute" name mangling
|
# "private attribute" name mangling
|
||||||
setattr(self, '_' + key, copy.copy(param_value))
|
setattr(self, '_' + key, copy.copy(param_value))
|
||||||
|
|
||||||
# Assign defaults for all attributes:
|
# Assign defaults for all attributes:
|
||||||
init_args = copy.deepcopy(wxMaskedNumCtrl.valid_ctrl_params)
|
init_args = copy.deepcopy(MaskedNumCtrl.valid_ctrl_params)
|
||||||
dbg('kwargs:', kwargs)
|
dbg('kwargs:', kwargs)
|
||||||
for key, param_value in kwargs.items():
|
for key, param_value in kwargs.items():
|
||||||
key = key.replace('Color', 'Colour')
|
key = key.replace('Color', 'Colour')
|
||||||
if key not in wxMaskedNumCtrl.valid_ctrl_params.keys():
|
if key not in MaskedNumCtrl.valid_ctrl_params.keys():
|
||||||
raise AttributeError('invalid keyword argument "%s"' % key)
|
raise AttributeError('invalid keyword argument "%s"' % key)
|
||||||
else:
|
else:
|
||||||
init_args[key] = param_value
|
init_args[key] = param_value
|
||||||
@@ -490,7 +497,7 @@ class wxMaskedNumCtrl(wxMaskedTextCtrl):
|
|||||||
self._typedSign = False
|
self._typedSign = False
|
||||||
|
|
||||||
# Construct the base control:
|
# Construct the base control:
|
||||||
wxMaskedTextCtrl.__init__(
|
MaskedTextCtrl.__init__(
|
||||||
self, parent, id, '',
|
self, parent, id, '',
|
||||||
pos, size, style, validator, name,
|
pos, size, style, validator, name,
|
||||||
mask = mask,
|
mask = mask,
|
||||||
@@ -517,14 +524,14 @@ class wxMaskedNumCtrl(wxMaskedTextCtrl):
|
|||||||
|
|
||||||
# Ensure proper coloring:
|
# Ensure proper coloring:
|
||||||
self.Refresh()
|
self.Refresh()
|
||||||
dbg('finished wxMaskedNumCtrl::__init__', indent=0)
|
dbg('finished MaskedNumCtrl::__init__', indent=0)
|
||||||
|
|
||||||
|
|
||||||
def SetParameters(self, **kwargs):
|
def SetParameters(self, **kwargs):
|
||||||
"""
|
"""
|
||||||
This routine is used to initialize and reconfigure the control:
|
This routine is used to initialize and reconfigure the control:
|
||||||
"""
|
"""
|
||||||
dbg('wxMaskedNumCtrl::SetParameters', indent=1)
|
dbg('MaskedNumCtrl::SetParameters', indent=1)
|
||||||
maskededit_kwargs = {}
|
maskededit_kwargs = {}
|
||||||
reset_fraction_width = False
|
reset_fraction_width = False
|
||||||
|
|
||||||
@@ -596,9 +603,9 @@ class wxMaskedNumCtrl(wxMaskedTextCtrl):
|
|||||||
# for all other parameters, assign keyword args as appropriate:
|
# for all other parameters, assign keyword args as appropriate:
|
||||||
for key, param_value in kwargs.items():
|
for key, param_value in kwargs.items():
|
||||||
key = key.replace('Color', 'Colour')
|
key = key.replace('Color', 'Colour')
|
||||||
if key not in wxMaskedNumCtrl.valid_ctrl_params.keys():
|
if key not in MaskedNumCtrl.valid_ctrl_params.keys():
|
||||||
raise AttributeError('invalid keyword argument "%s"' % key)
|
raise AttributeError('invalid keyword argument "%s"' % key)
|
||||||
elif key not in wxMaskedEditMixin.valid_ctrl_params.keys():
|
elif key not in MaskedEditMixin.valid_ctrl_params.keys():
|
||||||
setattr(self, '_' + key, param_value)
|
setattr(self, '_' + key, param_value)
|
||||||
elif key in ('mask', 'autoformat'): # disallow explicit setting of mask
|
elif key in ('mask', 'autoformat'): # disallow explicit setting of mask
|
||||||
raise AttributeError('invalid keyword argument "%s"' % key)
|
raise AttributeError('invalid keyword argument "%s"' % key)
|
||||||
@@ -726,7 +733,7 @@ class wxMaskedNumCtrl(wxMaskedTextCtrl):
|
|||||||
dbg('abs(value):', value)
|
dbg('abs(value):', value)
|
||||||
self._isNeg = False
|
self._isNeg = False
|
||||||
|
|
||||||
elif not self._allowNone and wxMaskedTextCtrl.GetValue(self) == '':
|
elif not self._allowNone and MaskedTextCtrl.GetValue(self) == '':
|
||||||
if self._min > 0:
|
if self._min > 0:
|
||||||
value = self._min
|
value = self._min
|
||||||
else:
|
else:
|
||||||
@@ -746,7 +753,7 @@ class wxMaskedNumCtrl(wxMaskedTextCtrl):
|
|||||||
sel_start, sel_to = self.GetSelection()
|
sel_start, sel_to = self.GetSelection()
|
||||||
self._SetValue(self._toGUI(value))
|
self._SetValue(self._toGUI(value))
|
||||||
self.Refresh() # recolor as appropriate
|
self.Refresh() # recolor as appropriate
|
||||||
dbg('finished wxMaskedNumCtrl::SetParameters', indent=0)
|
dbg('finished MaskedNumCtrl::SetParameters', indent=0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -768,7 +775,7 @@ class wxMaskedNumCtrl(wxMaskedTextCtrl):
|
|||||||
else:
|
else:
|
||||||
fracstart, fracend = self._fields[1]._extent
|
fracstart, fracend = self._fields[1]._extent
|
||||||
if candidate is None:
|
if candidate is None:
|
||||||
value = self._toGUI(wxMaskedTextCtrl.GetValue(self))
|
value = self._toGUI(MaskedTextCtrl.GetValue(self))
|
||||||
else:
|
else:
|
||||||
value = self._toGUI(candidate)
|
value = self._toGUI(candidate)
|
||||||
fracstring = value[fracstart:fracend].strip()
|
fracstring = value[fracstart:fracend].strip()
|
||||||
@@ -778,14 +785,14 @@ class wxMaskedNumCtrl(wxMaskedTextCtrl):
|
|||||||
return string.atof(fracstring)
|
return string.atof(fracstring)
|
||||||
|
|
||||||
def _OnChangeSign(self, event):
|
def _OnChangeSign(self, event):
|
||||||
dbg('wxMaskedNumCtrl::_OnChangeSign', indent=1)
|
dbg('MaskedNumCtrl::_OnChangeSign', indent=1)
|
||||||
self._typedSign = True
|
self._typedSign = True
|
||||||
wxMaskedEditMixin._OnChangeSign(self, event)
|
MaskedEditMixin._OnChangeSign(self, event)
|
||||||
dbg(indent=0)
|
dbg(indent=0)
|
||||||
|
|
||||||
|
|
||||||
def _disallowValue(self):
|
def _disallowValue(self):
|
||||||
dbg('wxMaskedNumCtrl::_disallowValue')
|
dbg('MaskedNumCtrl::_disallowValue')
|
||||||
# limited and -1 is out of bounds
|
# limited and -1 is out of bounds
|
||||||
if self._typedSign:
|
if self._typedSign:
|
||||||
self._isNeg = False
|
self._isNeg = False
|
||||||
@@ -805,7 +812,7 @@ class wxMaskedNumCtrl(wxMaskedTextCtrl):
|
|||||||
by the user.
|
by the user.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
dbg('wxMaskedNumCtrl::_SetValue("%s")' % value, indent=1)
|
dbg('MaskedNumCtrl::_SetValue("%s")' % value, indent=1)
|
||||||
|
|
||||||
if( (self._fractionWidth and value.find(self._decimalChar) == -1) or
|
if( (self._fractionWidth and value.find(self._decimalChar) == -1) or
|
||||||
(self._fractionWidth == 0 and value.find(self._decimalChar) != -1) ) :
|
(self._fractionWidth == 0 and value.find(self._decimalChar) != -1) ) :
|
||||||
@@ -817,8 +824,8 @@ class wxMaskedNumCtrl(wxMaskedTextCtrl):
|
|||||||
|
|
||||||
if numvalue == "":
|
if numvalue == "":
|
||||||
if self._allowNone:
|
if self._allowNone:
|
||||||
dbg('calling base wxMaskedTextCtrl._SetValue(self, "%s")' % value)
|
dbg('calling base MaskedTextCtrl._SetValue(self, "%s")' % value)
|
||||||
wxMaskedTextCtrl._SetValue(self, value)
|
MaskedTextCtrl._SetValue(self, value)
|
||||||
self.Refresh()
|
self.Refresh()
|
||||||
return
|
return
|
||||||
elif self._min > 0 and self.IsLimited():
|
elif self._min > 0 and self.IsLimited():
|
||||||
@@ -918,7 +925,7 @@ class wxMaskedNumCtrl(wxMaskedTextCtrl):
|
|||||||
# reasonable instead:
|
# reasonable instead:
|
||||||
dbg('setting replacement value:', replacement)
|
dbg('setting replacement value:', replacement)
|
||||||
self._SetValue(self._toGUI(replacement))
|
self._SetValue(self._toGUI(replacement))
|
||||||
sel_start = wxMaskedTextCtrl.GetValue(self).find(str(abs(replacement))) # find where it put the 1, so we can select it
|
sel_start = MaskedTextCtrl.GetValue(self).find(str(abs(replacement))) # find where it put the 1, so we can select it
|
||||||
sel_to = sel_start + len(str(abs(replacement)))
|
sel_to = sel_start + len(str(abs(replacement)))
|
||||||
dbg('queuing selection of (%d, %d)' %(sel_start, sel_to))
|
dbg('queuing selection of (%d, %d)' %(sel_start, sel_to))
|
||||||
wx.CallAfter(self.SetInsertionPoint, sel_start)
|
wx.CallAfter(self.SetInsertionPoint, sel_start)
|
||||||
@@ -944,18 +951,18 @@ class wxMaskedNumCtrl(wxMaskedTextCtrl):
|
|||||||
|
|
||||||
|
|
||||||
sel_start, sel_to = self._GetSelection() # record current insertion point
|
sel_start, sel_to = self._GetSelection() # record current insertion point
|
||||||
dbg('calling base wxMaskedTextCtrl._SetValue(self, "%s")' % adjvalue)
|
dbg('calling base MaskedTextCtrl._SetValue(self, "%s")' % adjvalue)
|
||||||
wxMaskedTextCtrl._SetValue(self, adjvalue)
|
MaskedTextCtrl._SetValue(self, adjvalue)
|
||||||
# After all actions so far scheduled, check that resulting cursor
|
# After all actions so far scheduled, check that resulting cursor
|
||||||
# position is appropriate, and move if not:
|
# position is appropriate, and move if not:
|
||||||
wx.CallAfter(self._CheckInsertionPoint)
|
wx.CallAfter(self._CheckInsertionPoint)
|
||||||
|
|
||||||
dbg('finished wxMaskedNumCtrl::_SetValue', indent=0)
|
dbg('finished MaskedNumCtrl::_SetValue', indent=0)
|
||||||
|
|
||||||
def _CheckInsertionPoint(self):
|
def _CheckInsertionPoint(self):
|
||||||
# If current insertion point is before the end of the integer and
|
# If current insertion point is before the end of the integer and
|
||||||
# its before the 1st digit, place it just after the sign position:
|
# its before the 1st digit, place it just after the sign position:
|
||||||
dbg('wxMaskedNumCtrl::CheckInsertionPoint', indent=1)
|
dbg('MaskedNumCtrl::CheckInsertionPoint', indent=1)
|
||||||
sel_start, sel_to = self._GetSelection()
|
sel_start, sel_to = self._GetSelection()
|
||||||
text = self._GetValue()
|
text = self._GetValue()
|
||||||
if sel_to < self._fields[0]._extent[1] and text[sel_to] in (' ', '-', '('):
|
if sel_to < self._fields[0]._extent[1] and text[sel_to] in (' ', '-', '('):
|
||||||
@@ -972,13 +979,13 @@ class wxMaskedNumCtrl(wxMaskedTextCtrl):
|
|||||||
grouping characters auto selects the digit before or after the
|
grouping characters auto selects the digit before or after the
|
||||||
grouping character, so that the erasure does the right thing.
|
grouping character, so that the erasure does the right thing.
|
||||||
"""
|
"""
|
||||||
dbg('wxMaskedNumCtrl::_OnErase', indent=1)
|
dbg('MaskedNumCtrl::_OnErase', indent=1)
|
||||||
|
|
||||||
#if grouping digits, make sure deletes next to group char always
|
#if grouping digits, make sure deletes next to group char always
|
||||||
# delete next digit to appropriate side:
|
# delete next digit to appropriate side:
|
||||||
if self._groupDigits:
|
if self._groupDigits:
|
||||||
key = event.GetKeyCode()
|
key = event.GetKeyCode()
|
||||||
value = wxMaskedTextCtrl.GetValue(self)
|
value = MaskedTextCtrl.GetValue(self)
|
||||||
sel_start, sel_to = self._GetSelection()
|
sel_start, sel_to = self._GetSelection()
|
||||||
|
|
||||||
if key == wx.WXK_BACK:
|
if key == wx.WXK_BACK:
|
||||||
@@ -1004,7 +1011,7 @@ class wxMaskedNumCtrl(wxMaskedTextCtrl):
|
|||||||
self.SetInsertionPoint(sel_start)
|
self.SetInsertionPoint(sel_start)
|
||||||
self.SetSelection(sel_start, sel_to+1)
|
self.SetSelection(sel_start, sel_to+1)
|
||||||
|
|
||||||
wxMaskedTextCtrl._OnErase(self, event)
|
MaskedTextCtrl._OnErase(self, event)
|
||||||
dbg(indent=0)
|
dbg(indent=0)
|
||||||
|
|
||||||
|
|
||||||
@@ -1017,8 +1024,8 @@ class wxMaskedNumCtrl(wxMaskedTextCtrl):
|
|||||||
text events. So we check for actual changes to the text
|
text events. So we check for actual changes to the text
|
||||||
before passing the events on.
|
before passing the events on.
|
||||||
"""
|
"""
|
||||||
dbg('wxMaskedNumCtrl::OnTextChange', indent=1)
|
dbg('MaskedNumCtrl::OnTextChange', indent=1)
|
||||||
if not wxMaskedTextCtrl._OnTextChange(self, event):
|
if not MaskedTextCtrl._OnTextChange(self, event):
|
||||||
dbg(indent=0)
|
dbg(indent=0)
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -1028,7 +1035,7 @@ class wxMaskedNumCtrl(wxMaskedTextCtrl):
|
|||||||
if value != self._oldvalue:
|
if value != self._oldvalue:
|
||||||
try:
|
try:
|
||||||
self.GetEventHandler().ProcessEvent(
|
self.GetEventHandler().ProcessEvent(
|
||||||
wxMaskedNumNumberUpdatedEvent( self.GetId(), self.GetValue(), self ) )
|
MaskedNumNumberUpdatedEvent( self.GetId(), self.GetValue(), self ) )
|
||||||
except ValueError:
|
except ValueError:
|
||||||
dbg(indent=0)
|
dbg(indent=0)
|
||||||
return
|
return
|
||||||
@@ -1039,7 +1046,7 @@ class wxMaskedNumCtrl(wxMaskedTextCtrl):
|
|||||||
|
|
||||||
def _GetValue(self):
|
def _GetValue(self):
|
||||||
"""
|
"""
|
||||||
Override of wxMaskedTextCtrl to allow amixin to get the raw text value of the
|
Override of MaskedTextCtrl to allow amixin to get the raw text value of the
|
||||||
control with this function.
|
control with this function.
|
||||||
"""
|
"""
|
||||||
return wx.TextCtrl.GetValue(self)
|
return wx.TextCtrl.GetValue(self)
|
||||||
@@ -1049,7 +1056,7 @@ class wxMaskedNumCtrl(wxMaskedTextCtrl):
|
|||||||
"""
|
"""
|
||||||
Returns the current numeric value of the control.
|
Returns the current numeric value of the control.
|
||||||
"""
|
"""
|
||||||
return self._fromGUI( wxMaskedTextCtrl.GetValue(self) )
|
return self._fromGUI( MaskedTextCtrl.GetValue(self) )
|
||||||
|
|
||||||
def SetValue(self, value):
|
def SetValue(self, value):
|
||||||
"""
|
"""
|
||||||
@@ -1060,7 +1067,7 @@ class wxMaskedNumCtrl(wxMaskedTextCtrl):
|
|||||||
A ValueError exception will be raised if an invalid value
|
A ValueError exception will be raised if an invalid value
|
||||||
is specified.
|
is specified.
|
||||||
"""
|
"""
|
||||||
wxMaskedTextCtrl.SetValue( self, self._toGUI(value) )
|
MaskedTextCtrl.SetValue( self, self._toGUI(value) )
|
||||||
|
|
||||||
|
|
||||||
def SetIntegerWidth(self, value):
|
def SetIntegerWidth(self, value):
|
||||||
@@ -1091,7 +1098,7 @@ class wxMaskedNumCtrl(wxMaskedTextCtrl):
|
|||||||
If min > the max value allowed by the width of the control,
|
If min > the max value allowed by the width of the control,
|
||||||
the function will return False, and the min will not be set.
|
the function will return False, and the min will not be set.
|
||||||
"""
|
"""
|
||||||
dbg('wxMaskedNumCtrl::SetMin(%s)' % repr(min), indent=1)
|
dbg('MaskedNumCtrl::SetMin(%s)' % repr(min), indent=1)
|
||||||
if( self._max is None
|
if( self._max is None
|
||||||
or min is None
|
or min is None
|
||||||
or (self._max is not None and self._max >= min) ):
|
or (self._max is not None and self._max >= min) ):
|
||||||
@@ -1296,7 +1303,7 @@ class wxMaskedNumCtrl(wxMaskedTextCtrl):
|
|||||||
type and bounds checking and raises ValueError if argument is
|
type and bounds checking and raises ValueError if argument is
|
||||||
not a valid value.
|
not a valid value.
|
||||||
"""
|
"""
|
||||||
dbg('wxMaskedNumCtrl::_toGUI(%s)' % repr(value), indent=1)
|
dbg('MaskedNumCtrl::_toGUI(%s)' % repr(value), indent=1)
|
||||||
if value is None and self.IsNoneAllowed():
|
if value is None and self.IsNoneAllowed():
|
||||||
dbg(indent=0)
|
dbg(indent=0)
|
||||||
return self._template
|
return self._template
|
||||||
@@ -1311,12 +1318,12 @@ class wxMaskedNumCtrl(wxMaskedTextCtrl):
|
|||||||
value = long(value)
|
value = long(value)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
dbg('exception raised:', e, indent=0)
|
dbg('exception raised:', e, indent=0)
|
||||||
raise ValueError ('wxMaskedNumCtrl requires numeric value, passed %s'% repr(value) )
|
raise ValueError ('MaskedNumCtrl requires numeric value, passed %s'% repr(value) )
|
||||||
|
|
||||||
elif type(value) not in (types.IntType, types.LongType, types.FloatType):
|
elif type(value) not in (types.IntType, types.LongType, types.FloatType):
|
||||||
dbg(indent=0)
|
dbg(indent=0)
|
||||||
raise ValueError (
|
raise ValueError (
|
||||||
'wxMaskedNumCtrl requires numeric value, passed %s'% repr(value) )
|
'MaskedNumCtrl requires numeric value, passed %s'% repr(value) )
|
||||||
|
|
||||||
if not self._allowNegative and value < 0:
|
if not self._allowNegative and value < 0:
|
||||||
raise ValueError (
|
raise ValueError (
|
||||||
@@ -1366,7 +1373,7 @@ class wxMaskedNumCtrl(wxMaskedTextCtrl):
|
|||||||
Conversion function used in getting the value of the control.
|
Conversion function used in getting the value of the control.
|
||||||
"""
|
"""
|
||||||
dbg(suspend=0)
|
dbg(suspend=0)
|
||||||
dbg('wxMaskedNumCtrl::_fromGUI(%s)' % value, indent=1)
|
dbg('MaskedNumCtrl::_fromGUI(%s)' % value, indent=1)
|
||||||
# One or more of the underlying text control implementations
|
# One or more of the underlying text control implementations
|
||||||
# issue an intermediate EVT_TEXT when replacing the control's
|
# issue an intermediate EVT_TEXT when replacing the control's
|
||||||
# value, where the intermediate value is an empty string.
|
# value, where the intermediate value is an empty string.
|
||||||
@@ -1419,7 +1426,7 @@ class wxMaskedNumCtrl(wxMaskedTextCtrl):
|
|||||||
Preprocessor for base control paste; if value needs to be right-justified
|
Preprocessor for base control paste; if value needs to be right-justified
|
||||||
to fit in control, do so prior to paste:
|
to fit in control, do so prior to paste:
|
||||||
"""
|
"""
|
||||||
dbg('wxMaskedNumCtrl::_Paste (value = "%s")' % value)
|
dbg('MaskedNumCtrl::_Paste (value = "%s")' % value)
|
||||||
if value is None:
|
if value is None:
|
||||||
paste_text = self._getClipboardContents()
|
paste_text = self._getClipboardContents()
|
||||||
else:
|
else:
|
||||||
@@ -1431,7 +1438,7 @@ class wxMaskedNumCtrl(wxMaskedTextCtrl):
|
|||||||
paste_text = self._toGUI(paste_text)
|
paste_text = self._toGUI(paste_text)
|
||||||
self._SetSelection(0, len(self._mask))
|
self._SetSelection(0, len(self._mask))
|
||||||
|
|
||||||
return wxMaskedEditMixin._Paste(self,
|
return MaskedEditMixin._Paste(self,
|
||||||
paste_text,
|
paste_text,
|
||||||
raise_on_invalid=raise_on_invalid,
|
raise_on_invalid=raise_on_invalid,
|
||||||
just_return_value=just_return_value)
|
just_return_value=just_return_value)
|
||||||
@@ -1450,7 +1457,7 @@ if __name__ == '__main__':
|
|||||||
style = wx.DEFAULT_DIALOG_STYLE ):
|
style = wx.DEFAULT_DIALOG_STYLE ):
|
||||||
wx.Dialog.__init__(self, parent, id, title, pos, size, style)
|
wx.Dialog.__init__(self, parent, id, title, pos, size, style)
|
||||||
|
|
||||||
self.int_ctrl = wxMaskedNumCtrl(self, wx.NewId(), size=(55,20))
|
self.int_ctrl = MaskedNumCtrl(self, wx.NewId(), size=(55,20))
|
||||||
self.OK = wx.Button( self, wx.ID_OK, "OK")
|
self.OK = wx.Button( self, wx.ID_OK, "OK")
|
||||||
self.Cancel = wx.Button( self, wx.ID_CANCEL, "Cancel")
|
self.Cancel = wx.Button( self, wx.ID_CANCEL, "Cancel")
|
||||||
|
|
||||||
@@ -1483,7 +1490,7 @@ if __name__ == '__main__':
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def OnClick(self, event):
|
def OnClick(self, event):
|
||||||
dlg = myDialog(self.panel, -1, "test wxMaskedNumCtrl")
|
dlg = myDialog(self.panel, -1, "test MaskedNumCtrl")
|
||||||
dlg.int_ctrl.SetValue(501)
|
dlg.int_ctrl.SetValue(501)
|
||||||
dlg.int_ctrl.SetInsertionPoint(1)
|
dlg.int_ctrl.SetInsertionPoint(1)
|
||||||
dlg.int_ctrl.SetSelection(1,2)
|
dlg.int_ctrl.SetSelection(1,2)
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# Name: wxPython.lib.mixins.grid
|
# Name: wxPython.lib.mixins.grid
|
||||||
# Purpose: Helpful mix-in classes for wxGrid
|
# Purpose: Helpful mix-in classes for wx.Grid
|
||||||
#
|
#
|
||||||
# Author: Robin Dunn
|
# Author: Robin Dunn
|
||||||
#
|
#
|
||||||
@@ -14,6 +14,10 @@
|
|||||||
# o 2.5 compatability update.
|
# o 2.5 compatability update.
|
||||||
# o Untested
|
# o Untested
|
||||||
#
|
#
|
||||||
|
# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxGridAutoEditMixin -> GridAutoEditMixin
|
||||||
|
#
|
||||||
|
|
||||||
import wx
|
import wx
|
||||||
import wx.grid
|
import wx.grid
|
||||||
@@ -21,7 +25,7 @@ import wx.grid
|
|||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
class wxGridAutoEditMixin:
|
class GridAutoEditMixin:
|
||||||
"""A mix-in class that automatically enables the grid edit control when
|
"""A mix-in class that automatically enables the grid edit control when
|
||||||
a cell is selected.
|
a cell is selected.
|
||||||
|
|
||||||
|
@@ -14,13 +14,18 @@
|
|||||||
# o 2.5 compatability update.
|
# o 2.5 compatability update.
|
||||||
# o ListCtrlSelectionManagerMix untested.
|
# o ListCtrlSelectionManagerMix untested.
|
||||||
#
|
#
|
||||||
|
# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxColumnSorterMixin -> ColumnSorterMixin
|
||||||
|
# o wxListCtrlAutoWidthMixin -> ListCtrlAutoWidthMixin
|
||||||
|
#
|
||||||
|
|
||||||
import locale
|
import locale
|
||||||
import wx
|
import wx
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
class wxColumnSorterMixin:
|
class ColumnSorterMixin:
|
||||||
"""
|
"""
|
||||||
A mixin class that handles sorting of a wx.ListCtrl in REPORT mode when
|
A mixin class that handles sorting of a wx.ListCtrl in REPORT mode when
|
||||||
the column header is clicked on.
|
the column header is clicked on.
|
||||||
@@ -144,7 +149,7 @@ class wxColumnSorterMixin:
|
|||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
class wxListCtrlAutoWidthMixin:
|
class ListCtrlAutoWidthMixin:
|
||||||
""" A mix-in class that automatically resizes the last column to take up
|
""" A mix-in class that automatically resizes the last column to take up
|
||||||
the remaining width of the wx.ListCtrl.
|
the remaining width of the wx.ListCtrl.
|
||||||
|
|
||||||
|
@@ -7,12 +7,18 @@
|
|||||||
# Created: 2002/11/20
|
# Created: 2002/11/20
|
||||||
# Version: 0.1
|
# Version: 0.1
|
||||||
# RCS-ID: $Id$
|
# RCS-ID: $Id$
|
||||||
# License: wxWindows licensie
|
# License: wxWindows license
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
# 12/09/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
# 12/09/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
#
|
#
|
||||||
# o 2.5 compatability update.
|
# o 2.5 compatability update.
|
||||||
#
|
#
|
||||||
|
# 12/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxMultiSash -> MultiSash
|
||||||
|
# o wxMultiSplit -> MultiSplit wxMultiViewLeaf
|
||||||
|
# o wxMultiViewLeaf -> MultiViewLeaf
|
||||||
|
#
|
||||||
|
|
||||||
import wx
|
import wx
|
||||||
|
|
||||||
@@ -24,11 +30,11 @@ CR_SIZE = SH_SIZE * 3
|
|||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
class wxMultiSash(wx.Window):
|
class MultiSash(wx.Window):
|
||||||
def __init__(self, *_args,**_kwargs):
|
def __init__(self, *_args,**_kwargs):
|
||||||
apply(wx.Window.__init__,(self,) + _args,_kwargs)
|
apply(wx.Window.__init__,(self,) + _args,_kwargs)
|
||||||
self._defChild = EmptyChild
|
self._defChild = EmptyChild
|
||||||
self.child = wxMultiSplit(self,self,(0,0),self.GetSize())
|
self.child = MultiSplit(self,self,(0,0),self.GetSize())
|
||||||
self.Bind(wx.EVT_SIZE,self.OnMultiSize)
|
self.Bind(wx.EVT_SIZE,self.OnMultiSize)
|
||||||
|
|
||||||
def SetDefaultChildClass(self,childCls):
|
def SetDefaultChildClass(self,childCls):
|
||||||
@@ -43,7 +49,7 @@ class wxMultiSash(wx.Window):
|
|||||||
|
|
||||||
def Clear(self):
|
def Clear(self):
|
||||||
old = self.child
|
old = self.child
|
||||||
self.child = wxMultiSplit(self,self,(0,0),self.GetSize())
|
self.child = MultiSplit(self,self,(0,0),self.GetSize())
|
||||||
old.Destroy()
|
old.Destroy()
|
||||||
self.child.OnSize(None)
|
self.child.OnSize(None)
|
||||||
|
|
||||||
@@ -59,7 +65,7 @@ class wxMultiSash(wx.Window):
|
|||||||
exec 'import %s' % mod
|
exec 'import %s' % mod
|
||||||
self._defChild = eval(dChild)
|
self._defChild = eval(dChild)
|
||||||
old = self.child
|
old = self.child
|
||||||
self.child = wxMultiSplit(self,self,wxPoint(0,0),self.GetSize())
|
self.child = MultiSplit(self,self,wxPoint(0,0),self.GetSize())
|
||||||
self.child.SetSaveData(data['child'])
|
self.child.SetSaveData(data['child'])
|
||||||
old.Destroy()
|
old.Destroy()
|
||||||
self.OnMultiSize(None)
|
self.OnMultiSize(None)
|
||||||
@@ -69,7 +75,7 @@ class wxMultiSash(wx.Window):
|
|||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
class wxMultiSplit(wx.Window):
|
class MultiSplit(wx.Window):
|
||||||
def __init__(self,multiView,parent,pos,size,view1 = None):
|
def __init__(self,multiView,parent,pos,size,view1 = None):
|
||||||
wx.Window.__init__(self,id = -1,parent = parent,pos = pos,size = size,
|
wx.Window.__init__(self,id = -1,parent = parent,pos = pos,size = size,
|
||||||
style = wx.CLIP_CHILDREN)
|
style = wx.CLIP_CHILDREN)
|
||||||
@@ -80,7 +86,7 @@ class wxMultiSplit(wx.Window):
|
|||||||
self.view1.Reparent(self)
|
self.view1.Reparent(self)
|
||||||
self.view1.MoveXY(0,0)
|
self.view1.MoveXY(0,0)
|
||||||
else:
|
else:
|
||||||
self.view1 = wxMultiViewLeaf(self.multiView,self,
|
self.view1 = MultiViewLeaf(self.multiView,self,
|
||||||
(0,0),self.GetSize())
|
(0,0),self.GetSize())
|
||||||
self.direction = None
|
self.direction = None
|
||||||
|
|
||||||
@@ -90,11 +96,11 @@ class wxMultiSplit(wx.Window):
|
|||||||
saveData = {}
|
saveData = {}
|
||||||
if self.view1:
|
if self.view1:
|
||||||
saveData['view1'] = self.view1.GetSaveData()
|
saveData['view1'] = self.view1.GetSaveData()
|
||||||
if isinstance(self.view1,wxMultiSplit):
|
if isinstance(self.view1,MultiSplit):
|
||||||
saveData['view1IsSplit'] = 1
|
saveData['view1IsSplit'] = 1
|
||||||
if self.view2:
|
if self.view2:
|
||||||
saveData['view2'] = self.view2.GetSaveData()
|
saveData['view2'] = self.view2.GetSaveData()
|
||||||
if isinstance(self.view2,wxMultiSplit):
|
if isinstance(self.view2,MultiSplit):
|
||||||
saveData['view2IsSplit'] = 1
|
saveData['view2IsSplit'] = 1
|
||||||
saveData['direction'] = self.direction
|
saveData['direction'] = self.direction
|
||||||
v1,v2 = self.GetPosition()
|
v1,v2 = self.GetPosition()
|
||||||
@@ -113,10 +119,10 @@ class wxMultiSplit(wx.Window):
|
|||||||
isSplit = data.get('view1IsSplit',None)
|
isSplit = data.get('view1IsSplit',None)
|
||||||
old = self.view1
|
old = self.view1
|
||||||
if isSplit:
|
if isSplit:
|
||||||
self.view1 = wxMultiSplit(self.multiView,self,
|
self.view1 = MultiSplit(self.multiView,self,
|
||||||
(0,0),self.GetSize())
|
(0,0),self.GetSize())
|
||||||
else:
|
else:
|
||||||
self.view1 = wxMultiViewLeaf(self.multiView,self,
|
self.view1 = MultiViewLeaf(self.multiView,self,
|
||||||
(0,0),self.GetSize())
|
(0,0),self.GetSize())
|
||||||
self.view1.SetSaveData(v1Data)
|
self.view1.SetSaveData(v1Data)
|
||||||
if old:
|
if old:
|
||||||
@@ -126,10 +132,10 @@ class wxMultiSplit(wx.Window):
|
|||||||
isSplit = data.get('view2IsSplit',None)
|
isSplit = data.get('view2IsSplit',None)
|
||||||
old = self.view2
|
old = self.view2
|
||||||
if isSplit:
|
if isSplit:
|
||||||
self.view2 = wxMultiSplit(self.multiView,self,
|
self.view2 = MultiSplit(self.multiView,self,
|
||||||
(0,0),self.GetSize())
|
(0,0),self.GetSize())
|
||||||
else:
|
else:
|
||||||
self.view2 = wxMultiViewLeaf(self.multiView,self,
|
self.view2 = MultiViewLeaf(self.multiView,self,
|
||||||
(0,0),self.GetSize())
|
(0,0),self.GetSize())
|
||||||
self.view2.SetSaveData(v2Data)
|
self.view2.SetSaveData(v2Data)
|
||||||
if old:
|
if old:
|
||||||
@@ -152,13 +158,13 @@ class wxMultiSplit(wx.Window):
|
|||||||
def AddLeaf(self,direction,caller,pos):
|
def AddLeaf(self,direction,caller,pos):
|
||||||
if self.view2:
|
if self.view2:
|
||||||
if caller == self.view1:
|
if caller == self.view1:
|
||||||
self.view1 = wxMultiSplit(self.multiView,self,
|
self.view1 = MultiSplit(self.multiView,self,
|
||||||
caller.GetPosition(),
|
caller.GetPosition(),
|
||||||
caller.GetSize(),
|
caller.GetSize(),
|
||||||
caller)
|
caller)
|
||||||
self.view1.AddLeaf(direction,caller,pos)
|
self.view1.AddLeaf(direction,caller,pos)
|
||||||
else:
|
else:
|
||||||
self.view2 = wxMultiSplit(self.multiView,self,
|
self.view2 = MultiSplit(self.multiView,self,
|
||||||
caller.GetPosition(),
|
caller.GetPosition(),
|
||||||
caller.GetSize(),
|
caller.GetSize(),
|
||||||
caller)
|
caller)
|
||||||
@@ -174,7 +180,7 @@ class wxMultiSplit(wx.Window):
|
|||||||
x,y = (0,pos)
|
x,y = (0,pos)
|
||||||
w1,h1 = (w,h-pos)
|
w1,h1 = (w,h-pos)
|
||||||
w2,h2 = (w,pos)
|
w2,h2 = (w,pos)
|
||||||
self.view2 = wxMultiViewLeaf(self.multiView, self, (x,y), (w1,h1))
|
self.view2 = MultiViewLeaf(self.multiView, self, (x,y), (w1,h1))
|
||||||
self.view1.SetSize((w2,h2))
|
self.view1.SetSize((w2,h2))
|
||||||
self.view2.OnSize(None)
|
self.view2.OnSize(None)
|
||||||
|
|
||||||
@@ -281,7 +287,7 @@ class wxMultiSplit(wx.Window):
|
|||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
class wxMultiViewLeaf(wx.Window):
|
class MultiViewLeaf(wx.Window):
|
||||||
def __init__(self,multiView,parent,pos,size):
|
def __init__(self,multiView,parent,pos,size):
|
||||||
wx.Window.__init__(self,id = -1,parent = parent,pos = pos,size = size,
|
wx.Window.__init__(self,id = -1,parent = parent,pos = pos,size = size,
|
||||||
style = wx.CLIP_CHILDREN)
|
style = wx.CLIP_CHILDREN)
|
||||||
|
@@ -3,15 +3,22 @@
|
|||||||
# o 2.5 compatability update.
|
# o 2.5 compatability update.
|
||||||
# o I'm a little nervous about some of it though.
|
# o I'm a little nervous about some of it though.
|
||||||
#
|
#
|
||||||
|
# 12/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxTreeModel -> TreeModel
|
||||||
|
# o wxMVCTree -> MVCTree
|
||||||
|
# o wxMVCTreeEvent -> MVCTreeEvent
|
||||||
|
# o wxMVCTreeNotifyEvent -> MVCTreeNotifyEvent
|
||||||
|
#
|
||||||
|
|
||||||
"""
|
"""
|
||||||
wxMVCTree is a control which handles hierarchical data. It is constructed
|
MVCTree is a control which handles hierarchical data. It is constructed
|
||||||
in model-view-controller architecture, so the display of that data, and
|
in model-view-controller architecture, so the display of that data, and
|
||||||
the content of the data can be changed greatly without affecting the other parts.
|
the content of the data can be changed greatly without affecting the other parts.
|
||||||
|
|
||||||
wxMVCTree actually is even more configurable than MVC normally implies, because
|
MVCTree actually is even more configurable than MVC normally implies, because
|
||||||
almost every aspect of it is pluggable:
|
almost every aspect of it is pluggable:
|
||||||
wxMVCTree - Overall controller, and the window that actually gets placed
|
MVCTree - Overall controller, and the window that actually gets placed
|
||||||
in the GUI.
|
in the GUI.
|
||||||
Painter - Paints the control. The 'view' part of MVC.
|
Painter - Paints the control. The 'view' part of MVC.
|
||||||
NodePainter - Paints just the nodes
|
NodePainter - Paints just the nodes
|
||||||
@@ -57,7 +64,7 @@ warnings.warn(warningmsg, DeprecationWarning, stacklevel=2)
|
|||||||
|
|
||||||
class MVCTreeNode:
|
class MVCTreeNode:
|
||||||
"""
|
"""
|
||||||
Used internally by wxMVCTree to manage its data. Contains information about
|
Used internally by MVCTree to manage its data. Contains information about
|
||||||
screen placement, the actual data associated with it, and more. These are
|
screen placement, the actual data associated with it, and more. These are
|
||||||
the nodes passed to all the other helper parts to do their work with.
|
the nodes passed to all the other helper parts to do their work with.
|
||||||
"""
|
"""
|
||||||
@@ -151,7 +158,7 @@ class Transform:
|
|||||||
|
|
||||||
class Painter:
|
class Painter:
|
||||||
"""
|
"""
|
||||||
This is the interface that wxMVCTree expects from painters. All painters should
|
This is the interface that MVCTree expects from painters. All painters should
|
||||||
be Painter subclasses.
|
be Painter subclasses.
|
||||||
"""
|
"""
|
||||||
def __init__(self, tree):
|
def __init__(self, tree):
|
||||||
@@ -236,7 +243,7 @@ class Painter:
|
|||||||
evt.Skip()
|
evt.Skip()
|
||||||
|
|
||||||
|
|
||||||
class wxTreeModel:
|
class TreeModel:
|
||||||
"""
|
"""
|
||||||
Interface for tree models
|
Interface for tree models
|
||||||
"""
|
"""
|
||||||
@@ -305,7 +312,7 @@ class TextConverter:
|
|||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|
||||||
class BasicTreeModel(wxTreeModel):
|
class BasicTreeModel(TreeModel):
|
||||||
"""
|
"""
|
||||||
A very simple treemodel implementation, but flexible enough for many needs.
|
A very simple treemodel implementation, but flexible enough for many needs.
|
||||||
"""
|
"""
|
||||||
@@ -333,21 +340,21 @@ class BasicTreeModel(wxTreeModel):
|
|||||||
if not self.children.has_key(parent):
|
if not self.children.has_key(parent):
|
||||||
self.children[parent]=[]
|
self.children[parent]=[]
|
||||||
self.children[parent].append(child)
|
self.children[parent].append(child)
|
||||||
wxTreeModel.AddChild(self, parent, child)
|
TreeModel.AddChild(self, parent, child)
|
||||||
return child
|
return child
|
||||||
|
|
||||||
def RemoveNode(self, node):
|
def RemoveNode(self, node):
|
||||||
parent = self.parents[node]
|
parent = self.parents[node]
|
||||||
del self.parents[node]
|
del self.parents[node]
|
||||||
self.children[parent].remove(node)
|
self.children[parent].remove(node)
|
||||||
wxTreeModel.RemoveNode(self, node)
|
TreeModel.RemoveNode(self, node)
|
||||||
|
|
||||||
def InsertChild(self, parent, child, index):
|
def InsertChild(self, parent, child, index):
|
||||||
self.parents[child]=parent
|
self.parents[child]=parent
|
||||||
if not self.children.has_key(parent):
|
if not self.children.has_key(parent):
|
||||||
self.children[parent]=[]
|
self.children[parent]=[]
|
||||||
self.children[parent].insert(child, index)
|
self.children[parent].insert(child, index)
|
||||||
wxTreeModel.InsertChild(self, parent, child, index)
|
TreeModel.InsertChild(self, parent, child, index)
|
||||||
return child
|
return child
|
||||||
|
|
||||||
def IsLeaf(self, node):
|
def IsLeaf(self, node):
|
||||||
@@ -728,7 +735,7 @@ EVT_MVCTREE_ADD_ITEM = wx.PyEventBinder(wxEVT_MVCTREE_ADD_ITEM, 1)
|
|||||||
EVT_MVCTREE_DELETE_ITEM = wx.PyEventBinder(wxEVT_MVCTREE_DELETE_ITEM, 1)
|
EVT_MVCTREE_DELETE_ITEM = wx.PyEventBinder(wxEVT_MVCTREE_DELETE_ITEM, 1)
|
||||||
EVT_MVCTREE_KEY_DOWN = wx.PyEventBinder(wxEVT_MVCTREE_KEY_DOWN, 1)
|
EVT_MVCTREE_KEY_DOWN = wx.PyEventBinder(wxEVT_MVCTREE_KEY_DOWN, 1)
|
||||||
|
|
||||||
class wxMVCTreeEvent(wx.PyCommandEvent):
|
class MVCTreeEvent(wx.PyCommandEvent):
|
||||||
def __init__(self, type, id, node = None, nodes = None, keyEvent = None, **kwargs):
|
def __init__(self, type, id, node = None, nodes = None, keyEvent = None, **kwargs):
|
||||||
apply(wx.PyCommandEvent.__init__, (self, type, id), kwargs)
|
apply(wx.PyCommandEvent.__init__, (self, type, id), kwargs)
|
||||||
self.node = node
|
self.node = node
|
||||||
@@ -741,14 +748,14 @@ class wxMVCTreeEvent(wx.PyCommandEvent):
|
|||||||
def getKeyEvent(self):
|
def getKeyEvent(self):
|
||||||
return self.keyEvent
|
return self.keyEvent
|
||||||
|
|
||||||
class wxMVCTreeNotifyEvent(wxMVCTreeEvent):
|
class MVCTreeNotifyEvent(MVCTreeEvent):
|
||||||
def __init__(self, type, id, node = None, nodes = None, **kwargs):
|
def __init__(self, type, id, node = None, nodes = None, **kwargs):
|
||||||
apply(wxMVCTreeEvent.__init__, (self, type, id, node, nodes), kwargs)
|
apply(MVCTreeEvent.__init__, (self, type, id, node, nodes), kwargs)
|
||||||
self.notify = wx.NotifyEvent(type, id)
|
self.notify = wx.NotifyEvent(type, id)
|
||||||
def getNotifyEvent(self):
|
def getNotifyEvent(self):
|
||||||
return self.notify
|
return self.notify
|
||||||
|
|
||||||
class wxMVCTree(wx.ScrolledWindow):
|
class MVCTree(wx.ScrolledWindow):
|
||||||
"""
|
"""
|
||||||
The main mvc tree class.
|
The main mvc tree class.
|
||||||
"""
|
"""
|
||||||
@@ -801,28 +808,28 @@ class wxMVCTree(wx.ScrolledWindow):
|
|||||||
return self.transform
|
return self.transform
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<wxMVCTree instance at %s>" % str(hex(id(self)))
|
return "<MVCTree instance at %s>" % str(hex(id(self)))
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.__repr__()
|
return self.__repr__()
|
||||||
|
|
||||||
def NodeAdded(self, parent, child):
|
def NodeAdded(self, parent, child):
|
||||||
e = wxMVCTreeEvent(wxEVT_MVCTREE_ADD_ITEM, self.GetId(), node = child, nodes = [parent, child])
|
e = MVCTreeEvent(wxEVT_MVCTREE_ADD_ITEM, self.GetId(), node = child, nodes = [parent, child])
|
||||||
self.GetEventHandler().ProcessEvent(e)
|
self.GetEventHandler().ProcessEvent(e)
|
||||||
self.painter.ClearBuffer()
|
self.painter.ClearBuffer()
|
||||||
|
|
||||||
def NodeInserted(self, parent, child, index):
|
def NodeInserted(self, parent, child, index):
|
||||||
e = wxMVCTreeEvent(wxEVT_MVCTREE_ADD_ITEM, self.GetId(), node = child, nodes = [parent, child])
|
e = MVCTreeEvent(wxEVT_MVCTREE_ADD_ITEM, self.GetId(), node = child, nodes = [parent, child])
|
||||||
self.GetEventHandler().ProcessEvent(e)
|
self.GetEventHandler().ProcessEvent(e)
|
||||||
self.painter.ClearBuffer()
|
self.painter.ClearBuffer()
|
||||||
|
|
||||||
def NodeRemoved(self, node):
|
def NodeRemoved(self, node):
|
||||||
e = wxMVCTreeEvent(wxEVT_MVCTREE_DELETE_ITEM, self.GetId(), node = child, nodes = [parent, child])
|
e = MVCTreeEvent(wxEVT_MVCTREE_DELETE_ITEM, self.GetId(), node = child, nodes = [parent, child])
|
||||||
self.GetEventHandler().ProcessEvent(e)
|
self.GetEventHandler().ProcessEvent(e)
|
||||||
self.painter.ClearBuffer()
|
self.painter.ClearBuffer()
|
||||||
|
|
||||||
def OnKeyDown(self, evt):
|
def OnKeyDown(self, evt):
|
||||||
e = wxMVCTreeEvent(wxEVT_MVCTREE_KEY_DOWN, self.GetId(), keyEvent = evt)
|
e = MVCTreeEvent(wxEVT_MVCTREE_KEY_DOWN, self.GetId(), keyEvent = evt)
|
||||||
self.GetEventHandler().ProcessEvent(e)
|
self.GetEventHandler().ProcessEvent(e)
|
||||||
|
|
||||||
def SetFont(self, font):
|
def SetFont(self, font):
|
||||||
@@ -862,7 +869,7 @@ class wxMVCTree(wx.ScrolledWindow):
|
|||||||
|
|
||||||
def SetDoubleBuffered(self, bool):
|
def SetDoubleBuffered(self, bool):
|
||||||
"""
|
"""
|
||||||
By default wxMVCTree is double-buffered.
|
By default MVCTree is double-buffered.
|
||||||
"""
|
"""
|
||||||
self.doubleBuffered = bool
|
self.doubleBuffered = bool
|
||||||
|
|
||||||
@@ -923,7 +930,7 @@ class wxMVCTree(wx.ScrolledWindow):
|
|||||||
def SetSelection(self, nodeTuple):
|
def SetSelection(self, nodeTuple):
|
||||||
if type(nodeTuple) != type(()):
|
if type(nodeTuple) != type(()):
|
||||||
nodeTuple = (nodeTuple,)
|
nodeTuple = (nodeTuple,)
|
||||||
e = wxMVCTreeNotifyEvent(wxEVT_MVCTREE_SEL_CHANGING, self.GetId(), nodeTuple[0], nodes = nodeTuple)
|
e = MVCTreeNotifyEvent(wxEVT_MVCTREE_SEL_CHANGING, self.GetId(), nodeTuple[0], nodes = nodeTuple)
|
||||||
self.GetEventHandler().ProcessEvent(e)
|
self.GetEventHandler().ProcessEvent(e)
|
||||||
if not e.notify.IsAllowed():
|
if not e.notify.IsAllowed():
|
||||||
return
|
return
|
||||||
@@ -934,7 +941,7 @@ class wxMVCTree(wx.ScrolledWindow):
|
|||||||
treenode = self.nodemap[node]
|
treenode = self.nodemap[node]
|
||||||
node.selected = False
|
node.selected = False
|
||||||
self._selections = list(nodeTuple)
|
self._selections = list(nodeTuple)
|
||||||
e = wxMVCTreeEvent(wxEVT_MVCTREE_SEL_CHANGED, self.GetId(), nodeTuple[0], nodes = nodeTuple)
|
e = MVCTreeEvent(wxEVT_MVCTREE_SEL_CHANGED, self.GetId(), nodeTuple[0], nodes = nodeTuple)
|
||||||
self.GetEventHandler().ProcessEvent(e)
|
self.GetEventHandler().ProcessEvent(e)
|
||||||
|
|
||||||
def IsMultiSelect(self):
|
def IsMultiSelect(self):
|
||||||
@@ -951,7 +958,7 @@ class wxMVCTree(wx.ScrolledWindow):
|
|||||||
return
|
return
|
||||||
for ed in self._editors:
|
for ed in self._editors:
|
||||||
if ed.CanEdit(node):
|
if ed.CanEdit(node):
|
||||||
e = wxMVCTreeNotifyEvent(wxEVT_MVCTREE_BEGIN_EDIT, self.GetId(), node)
|
e = MVCTreeNotifyEvent(wxEVT_MVCTREE_BEGIN_EDIT, self.GetId(), node)
|
||||||
self.GetEventHandler().ProcessEvent(e)
|
self.GetEventHandler().ProcessEvent(e)
|
||||||
if not e.notify.IsAllowed():
|
if not e.notify.IsAllowed():
|
||||||
return
|
return
|
||||||
@@ -965,7 +972,7 @@ class wxMVCTree(wx.ScrolledWindow):
|
|||||||
self._currentEditor = None
|
self._currentEditor = None
|
||||||
|
|
||||||
def _EditEnding(self, node):
|
def _EditEnding(self, node):
|
||||||
e = wxMVCTreeNotifyEvent(wxEVT_MVCTREE_END_EDIT, self.GetId(), node)
|
e = MVCTreeNotifyEvent(wxEVT_MVCTREE_END_EDIT, self.GetId(), node)
|
||||||
self.GetEventHandler().ProcessEvent(e)
|
self.GetEventHandler().ProcessEvent(e)
|
||||||
if not e.notify.IsAllowed():
|
if not e.notify.IsAllowed():
|
||||||
return False
|
return False
|
||||||
@@ -976,23 +983,23 @@ class wxMVCTree(wx.ScrolledWindow):
|
|||||||
def SetExpanded(self, node, bool):
|
def SetExpanded(self, node, bool):
|
||||||
treenode = self.nodemap[node]
|
treenode = self.nodemap[node]
|
||||||
if bool:
|
if bool:
|
||||||
e = wxMVCTreeNotifyEvent(wxEVT_MVCTREE_ITEM_EXPANDING, self.GetId(), node)
|
e = MVCTreeNotifyEvent(wxEVT_MVCTREE_ITEM_EXPANDING, self.GetId(), node)
|
||||||
self.GetEventHandler().ProcessEvent(e)
|
self.GetEventHandler().ProcessEvent(e)
|
||||||
if not e.notify.IsAllowed():
|
if not e.notify.IsAllowed():
|
||||||
return
|
return
|
||||||
if not treenode.built:
|
if not treenode.built:
|
||||||
self.LoadChildren(treenode)
|
self.LoadChildren(treenode)
|
||||||
else:
|
else:
|
||||||
e = wxMVCTreeNotifyEvent(wxEVT_MVCTREE_ITEM_COLLAPSING, self.GetId(), node)
|
e = MVCTreeNotifyEvent(wxEVT_MVCTREE_ITEM_COLLAPSING, self.GetId(), node)
|
||||||
self.GetEventHandler().ProcessEvent(e)
|
self.GetEventHandler().ProcessEvent(e)
|
||||||
if not e.notify.IsAllowed():
|
if not e.notify.IsAllowed():
|
||||||
return
|
return
|
||||||
treenode.expanded = bool
|
treenode.expanded = bool
|
||||||
e = None
|
e = None
|
||||||
if treenode.expanded:
|
if treenode.expanded:
|
||||||
e = wxMVCTreeEvent(wxEVT_MVCTREE_ITEM_EXPANDED, self.GetId(), node)
|
e = MVCTreeEvent(wxEVT_MVCTREE_ITEM_EXPANDED, self.GetId(), node)
|
||||||
else:
|
else:
|
||||||
e = wxMVCTreeEvent(wxEVT_MVCTREE_ITEM_COLLAPSED, self.GetId(), node)
|
e = MVCTreeEvent(wxEVT_MVCTREE_ITEM_COLLAPSED, self.GetId(), node)
|
||||||
self.GetEventHandler().ProcessEvent(e)
|
self.GetEventHandler().ProcessEvent(e)
|
||||||
self.layout.Layout(self.currentRoot)
|
self.layout.Layout(self.currentRoot)
|
||||||
self.transform.Transform(self.currentRoot, self.offset, self.rotation)
|
self.transform.Transform(self.currentRoot, self.offset, self.rotation)
|
||||||
@@ -1005,7 +1012,7 @@ class wxMVCTree(wx.ScrolledWindow):
|
|||||||
nodeTuple = nodeOrTuple
|
nodeTuple = nodeOrTuple
|
||||||
if type(nodeOrTuple)!= type(()):
|
if type(nodeOrTuple)!= type(()):
|
||||||
nodeTuple = (nodeOrTuple,)
|
nodeTuple = (nodeOrTuple,)
|
||||||
e = wxMVCTreeNotifyEvent(wxEVT_MVCTREE_SEL_CHANGING, self.GetId(), nodeTuple[0], nodes = nodeTuple)
|
e = MVCTreeNotifyEvent(wxEVT_MVCTREE_SEL_CHANGING, self.GetId(), nodeTuple[0], nodes = nodeTuple)
|
||||||
self.GetEventHandler().ProcessEvent(e)
|
self.GetEventHandler().ProcessEvent(e)
|
||||||
if not e.notify.IsAllowed():
|
if not e.notify.IsAllowed():
|
||||||
return
|
return
|
||||||
@@ -1046,7 +1053,7 @@ class wxMVCTree(wx.ScrolledWindow):
|
|||||||
treenode = self.nodemap[node]
|
treenode = self.nodemap[node]
|
||||||
treenode.selected = True
|
treenode.selected = True
|
||||||
changeparents.append(treenode)
|
changeparents.append(treenode)
|
||||||
e = wxMVCTreeEvent(wxEVT_MVCTREE_SEL_CHANGED, self.GetId(), nodeTuple[0], nodes = nodeTuple)
|
e = MVCTreeEvent(wxEVT_MVCTREE_SEL_CHANGED, self.GetId(), nodeTuple[0], nodes = nodeTuple)
|
||||||
self.GetEventHandler().ProcessEvent(e)
|
self.GetEventHandler().ProcessEvent(e)
|
||||||
dc = wx.ClientDC(self)
|
dc = wx.ClientDC(self)
|
||||||
self.PrepareDC(dc)
|
self.PrepareDC(dc)
|
||||||
@@ -1064,7 +1071,7 @@ class wxMVCTree(wx.ScrolledWindow):
|
|||||||
treenode = self.nodemap[node]
|
treenode = self.nodemap[node]
|
||||||
changeparents.append(treenode)
|
changeparents.append(treenode)
|
||||||
treenode.selected = False
|
treenode.selected = False
|
||||||
e = wxMVCTreeEvent(wxEVT_MVCTREE_SEL_CHANGED, self.GetId(), node, nodes = nodeTuple)
|
e = MVCTreeEvent(wxEVT_MVCTREE_SEL_CHANGED, self.GetId(), node, nodes = nodeTuple)
|
||||||
self.GetEventHandler().ProcessEvent(e)
|
self.GetEventHandler().ProcessEvent(e)
|
||||||
dc = wx.ClientDC(self)
|
dc = wx.ClientDC(self)
|
||||||
self.PrepareDC(dc)
|
self.PrepareDC(dc)
|
||||||
|
@@ -13,6 +13,11 @@
|
|||||||
#
|
#
|
||||||
# o 2.5 compatability update.
|
# o 2.5 compatability update.
|
||||||
#
|
#
|
||||||
|
# 12/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxPopupDialog -> PopupDialog
|
||||||
|
# o wxPopupControl -> PopupControl
|
||||||
|
#
|
||||||
|
|
||||||
import wx
|
import wx
|
||||||
from wx.lib.buttons import GenButtonEvent
|
from wx.lib.buttons import GenButtonEvent
|
||||||
@@ -142,7 +147,7 @@ class PopButton(wx.PyControl):
|
|||||||
|
|
||||||
|
|
||||||
# Tried to use wxPopupWindow but the control misbehaves on MSW
|
# Tried to use wxPopupWindow but the control misbehaves on MSW
|
||||||
class wxPopupDialog(wx.Dialog):
|
class PopupDialog(wx.Dialog):
|
||||||
def __init__(self,parent,content = None):
|
def __init__(self,parent,content = None):
|
||||||
wx.Dialog.__init__(self,parent,-1,'', style = wx.BORDER_SIMPLE|wx.STAY_ON_TOP)
|
wx.Dialog.__init__(self,parent,-1,'', style = wx.BORDER_SIMPLE|wx.STAY_ON_TOP)
|
||||||
|
|
||||||
@@ -187,7 +192,7 @@ class wxPopupDialog(wx.Dialog):
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
class wxPopupControl(wx.PyControl):
|
class PopupControl(wx.PyControl):
|
||||||
def __init__(self,*_args,**_kwargs):
|
def __init__(self,*_args,**_kwargs):
|
||||||
if _kwargs.has_key('value'):
|
if _kwargs.has_key('value'):
|
||||||
del _kwargs['value']
|
del _kwargs['value']
|
||||||
@@ -216,7 +221,7 @@ class wxPopupControl(wx.PyControl):
|
|||||||
def OnButton(self,evt):
|
def OnButton(self,evt):
|
||||||
if not self.pop:
|
if not self.pop:
|
||||||
if self.content:
|
if self.content:
|
||||||
self.pop = wxPopupDialog(self,self.content)
|
self.pop = PopupDialog(self,self.content)
|
||||||
del self.content
|
del self.content
|
||||||
else:
|
else:
|
||||||
print 'No Content to pop'
|
print 'No Content to pop'
|
||||||
@@ -250,4 +255,4 @@ class wxPopupControl(wx.PyControl):
|
|||||||
|
|
||||||
|
|
||||||
# an alias
|
# an alias
|
||||||
wxPopupCtrl = wxPopupControl
|
PopupCtrl = PopupControl
|
||||||
|
@@ -16,6 +16,10 @@
|
|||||||
# o 2.5 compatability update.
|
# o 2.5 compatability update.
|
||||||
# o Added deprecation warning.
|
# o Added deprecation warning.
|
||||||
#
|
#
|
||||||
|
# 12/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxRightTextCtrl -> RightTextCtrl
|
||||||
|
#
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Some time ago, I asked about how to right-align
|
Some time ago, I asked about how to right-align
|
||||||
@@ -60,7 +64,7 @@ warnings.warn(warningmsg, DeprecationWarning, stacklevel=2)
|
|||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
class wxRightTextCtrl(wx.TextCtrl):
|
class RightTextCtrl(wx.TextCtrl):
|
||||||
def __init__(self, parent, id, *args, **kwargs):
|
def __init__(self, parent, id, *args, **kwargs):
|
||||||
wx.TextCtrl.__init__(self, parent, id, *args, **kwargs)
|
wx.TextCtrl.__init__(self, parent, id, *args, **kwargs)
|
||||||
self.Bind(wx.EVT_KILL_FOCUS, self.OnKillFocus)
|
self.Bind(wx.EVT_KILL_FOCUS, self.OnKillFocus)
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# Name: wxScrolledPanel.py
|
# Name: scrolledpanel.py
|
||||||
# Author: Will Sadkin
|
# Author: Will Sadkin
|
||||||
# Created: 03/21/2003
|
# Created: 03/21/2003
|
||||||
# Copyright: (c) 2003 by Will Sadkin
|
# Copyright: (c) 2003 by Will Sadkin
|
||||||
@@ -10,13 +10,17 @@
|
|||||||
#
|
#
|
||||||
# o 2.5 compatability update.
|
# o 2.5 compatability update.
|
||||||
#
|
#
|
||||||
|
# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxScrolledPanel -> ScrolledPanel
|
||||||
|
#
|
||||||
|
|
||||||
import wx
|
import wx
|
||||||
|
|
||||||
|
|
||||||
class wxScrolledPanel( wx.ScrolledWindow ):
|
class ScrolledPanel( wx.ScrolledWindow ):
|
||||||
"""\
|
"""\
|
||||||
wxScrolledPanel fills a "hole" in the implementation of wxScrolledWindow,
|
ScrolledPanel fills a "hole" in the implementation of wx.ScrolledWindow,
|
||||||
providing automatic scrollbar and scrolling behavior and the tab traversal
|
providing automatic scrollbar and scrolling behavior and the tab traversal
|
||||||
management that wxScrolledWindow lacks. This code was based on the original
|
management that wxScrolledWindow lacks. This code was based on the original
|
||||||
demo code showing how to do this, but is now available for general use
|
demo code showing how to do this, but is now available for general use
|
||||||
@@ -37,7 +41,7 @@ as a proper class (and the demo is now converted to just use it.)
|
|||||||
"""
|
"""
|
||||||
This function sets up the event handling necessary to handle
|
This function sets up the event handling necessary to handle
|
||||||
scrolling properly. It should be called within the __init__
|
scrolling properly. It should be called within the __init__
|
||||||
function of any class that is derived from wxScrolledPanel,
|
function of any class that is derived from ScrolledPanel,
|
||||||
once the controls on the panel have been constructed and
|
once the controls on the panel have been constructed and
|
||||||
thus the size of the scrolling area can be determined.
|
thus the size of the scrolling area can be determined.
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# Name: wxTimeCtrl.py
|
# Name: timectrl.py
|
||||||
# Author: Will Sadkin
|
# Author: Will Sadkin
|
||||||
# Created: 09/19/2002
|
# Created: 09/19/2002
|
||||||
# Copyright: (c) 2002 by Will Sadkin, 2002
|
# Copyright: (c) 2002 by Will Sadkin, 2002
|
||||||
@@ -13,12 +13,12 @@
|
|||||||
# component of that control is inaccessible through the interface exposed in
|
# component of that control is inaccessible through the interface exposed in
|
||||||
# wxPython.
|
# wxPython.
|
||||||
#
|
#
|
||||||
# wxTimeCtrl does not use validators, because it does careful manipulation
|
# TimeCtrl does not use validators, because it does careful manipulation
|
||||||
# of the cursor in the text window on each keystroke, and validation is
|
# of the cursor in the text window on each keystroke, and validation is
|
||||||
# cursor-position specific, so the control intercepts the key codes before the
|
# cursor-position specific, so the control intercepts the key codes before the
|
||||||
# validator would fire.
|
# validator would fire.
|
||||||
#
|
#
|
||||||
# wxTimeCtrl now also supports .SetValue() with either strings or wxDateTime
|
# TimeCtrl now also supports .SetValue() with either strings or wxDateTime
|
||||||
# values, as well as range limits, with the option of either enforcing them
|
# values, as well as range limits, with the option of either enforcing them
|
||||||
# or simply coloring the text of the control if the limits are exceeded.
|
# or simply coloring the text of the control if the limits are exceeded.
|
||||||
#
|
#
|
||||||
@@ -37,22 +37,27 @@
|
|||||||
# lock up. Noted in other places using it too, it's not this module
|
# lock up. Noted in other places using it too, it's not this module
|
||||||
# that's at fault.
|
# that's at fault.
|
||||||
#
|
#
|
||||||
|
# 12/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxMaskedTextCtrl -> MaskedTextCtrl
|
||||||
|
# o wxTimeCtrl -> TimeCtrl
|
||||||
|
#
|
||||||
|
|
||||||
"""<html><body>
|
"""<html><body>
|
||||||
<P>
|
<P>
|
||||||
<B>wxTimeCtrl</B> provides a multi-cell control that allows manipulation of a time
|
<B>TimeCtrl</B> provides a multi-cell control that allows manipulation of a time
|
||||||
value. It supports 12 or 24 hour format, and you can use wxDateTime or mxDateTime
|
value. It supports 12 or 24 hour format, and you can use wxDateTime or mxDateTime
|
||||||
to get/set values from the control.
|
to get/set values from the control.
|
||||||
<P>
|
<P>
|
||||||
Left/right/tab keys to switch cells within a wxTimeCtrl, and the up/down arrows act
|
Left/right/tab keys to switch cells within a TimeCtrl, and the up/down arrows act
|
||||||
like a spin control. wxTimeCtrl also allows for an actual spin button to be attached
|
like a spin control. TimeCtrl also allows for an actual spin button to be attached
|
||||||
to the control, so that it acts like the up/down arrow keys.
|
to the control, so that it acts like the up/down arrow keys.
|
||||||
<P>
|
<P>
|
||||||
The <B>!</B> or <B>c</B> key sets the value of the control to the current time.
|
The <B>!</B> or <B>c</B> key sets the value of the control to the current time.
|
||||||
<P>
|
<P>
|
||||||
Here's the API for wxTimeCtrl:
|
Here's the API for TimeCtrl:
|
||||||
<DL><PRE>
|
<DL><PRE>
|
||||||
<B>wxTimeCtrl</B>(
|
<B>TimeCtrl</B>(
|
||||||
parent, id = -1,
|
parent, id = -1,
|
||||||
<B>value</B> = '12:00:00 AM',
|
<B>value</B> = '12:00:00 AM',
|
||||||
pos = wxDefaultPosition,
|
pos = wxDefaultPosition,
|
||||||
@@ -77,10 +82,10 @@ Here's the API for wxTimeCtrl:
|
|||||||
<DD>The size of the control will be automatically adjusted for 12/24 hour format
|
<DD>The size of the control will be automatically adjusted for 12/24 hour format
|
||||||
if wxDefaultSize is specified.
|
if wxDefaultSize is specified.
|
||||||
<DT><B>style</B>
|
<DT><B>style</B>
|
||||||
<DD>By default, wxTimeCtrl will process TAB events, by allowing tab to the
|
<DD>By default, TimeCtrl will process TAB events, by allowing tab to the
|
||||||
different cells within the control.
|
different cells within the control.
|
||||||
<DT><B>validator</B>
|
<DT><B>validator</B>
|
||||||
<DD>By default, wxTimeCtrl just uses the default (empty) validator, as all
|
<DD>By default, TimeCtrl just uses the default (empty) validator, as all
|
||||||
of its validation for entry control is handled internally. However, a validator
|
of its validation for entry control is handled internally. However, a validator
|
||||||
can be supplied to provide data transfer capability to the control.
|
can be supplied to provide data transfer capability to the control.
|
||||||
<BR>
|
<BR>
|
||||||
@@ -91,11 +96,11 @@ Here's the API for wxTimeCtrl:
|
|||||||
<BR>
|
<BR>
|
||||||
<DT><B>spinButton</B>
|
<DT><B>spinButton</B>
|
||||||
<DD>If specified, this button's events will be bound to the behavior of the
|
<DD>If specified, this button's events will be bound to the behavior of the
|
||||||
wxTimeCtrl, working like up/down cursor key events. (See BindSpinButton.)
|
TimeCtrl, working like up/down cursor key events. (See BindSpinButton.)
|
||||||
<BR>
|
<BR>
|
||||||
<DT><B>min</B>
|
<DT><B>min</B>
|
||||||
<DD>Defines the lower bound for "valid" selections in the control.
|
<DD>Defines the lower bound for "valid" selections in the control.
|
||||||
By default, wxTimeCtrl doesn't have bounds. You must set both upper and lower
|
By default, TimeCtrl doesn't have bounds. You must set both upper and lower
|
||||||
bounds to make the control pay attention to them, (as only one bound makes no sense
|
bounds to make the control pay attention to them, (as only one bound makes no sense
|
||||||
with times.) "Valid" times will fall between the min and max "pie wedge" of the
|
with times.) "Valid" times will fall between the min and max "pie wedge" of the
|
||||||
clock.
|
clock.
|
||||||
@@ -253,7 +258,7 @@ import types
|
|||||||
import wx
|
import wx
|
||||||
|
|
||||||
from wx.tools.dbg import Logger
|
from wx.tools.dbg import Logger
|
||||||
from wx.lib.maskededit import wxMaskedTextCtrl, Field
|
from wx.lib.maskededit import MaskedTextCtrl, Field
|
||||||
|
|
||||||
dbg = Logger()
|
dbg = Logger()
|
||||||
dbg(enable=0)
|
dbg(enable=0)
|
||||||
@@ -277,7 +282,7 @@ class TimeUpdatedEvent(wx.PyCommandEvent):
|
|||||||
return self.value
|
return self.value
|
||||||
|
|
||||||
|
|
||||||
class wxTimeCtrl(wxMaskedTextCtrl):
|
class TimeCtrl(MaskedTextCtrl):
|
||||||
|
|
||||||
valid_ctrl_params = {
|
valid_ctrl_params = {
|
||||||
'display_seconds' : True, # by default, shows seconds
|
'display_seconds' : True, # by default, shows seconds
|
||||||
@@ -285,7 +290,7 @@ class wxTimeCtrl(wxMaskedTextCtrl):
|
|||||||
'max': None,
|
'max': None,
|
||||||
'limited': False, # by default, no limiting even if bounds set
|
'limited': False, # by default, no limiting even if bounds set
|
||||||
'useFixedWidthFont': True, # by default, use a fixed-width font
|
'useFixedWidthFont': True, # by default, use a fixed-width font
|
||||||
'oob_color': "Yellow" # by default, the default wxMaskedTextCtrl "invalid" color
|
'oob_color': "Yellow" # by default, the default MaskedTextCtrl "invalid" color
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__ (
|
def __init__ (
|
||||||
@@ -300,10 +305,10 @@ class wxTimeCtrl(wxMaskedTextCtrl):
|
|||||||
|
|
||||||
# set defaults for control:
|
# set defaults for control:
|
||||||
dbg('setting defaults:')
|
dbg('setting defaults:')
|
||||||
for key, param_value in wxTimeCtrl.valid_ctrl_params.items():
|
for key, param_value in TimeCtrl.valid_ctrl_params.items():
|
||||||
# This is done this way to make setattr behave consistently with
|
# This is done this way to make setattr behave consistently with
|
||||||
# "private attribute" name mangling
|
# "private attribute" name mangling
|
||||||
setattr(self, "_wxTimeCtrl__" + key, copy.copy(param_value))
|
setattr(self, "_TimeCtrl__" + key, copy.copy(param_value))
|
||||||
|
|
||||||
# create locals from current defaults, so we can override if
|
# create locals from current defaults, so we can override if
|
||||||
# specified in kwargs, and handle uniformly:
|
# specified in kwargs, and handle uniformly:
|
||||||
@@ -320,7 +325,7 @@ class wxTimeCtrl(wxMaskedTextCtrl):
|
|||||||
|
|
||||||
# assign keyword args as appropriate:
|
# assign keyword args as appropriate:
|
||||||
for key, param_value in kwargs.items():
|
for key, param_value in kwargs.items():
|
||||||
if key not in wxTimeCtrl.valid_ctrl_params.keys():
|
if key not in TimeCtrl.valid_ctrl_params.keys():
|
||||||
raise AttributeError('invalid keyword argument "%s"' % key)
|
raise AttributeError('invalid keyword argument "%s"' % key)
|
||||||
|
|
||||||
if key == "display_seconds":
|
if key == "display_seconds":
|
||||||
@@ -383,7 +388,7 @@ class wxTimeCtrl(wxMaskedTextCtrl):
|
|||||||
maskededit_kwargs['formatcodes'] = 'T!'
|
maskededit_kwargs['formatcodes'] = 'T!'
|
||||||
|
|
||||||
# Now we can initialize the base control:
|
# Now we can initialize the base control:
|
||||||
wxMaskedTextCtrl.__init__(
|
MaskedTextCtrl.__init__(
|
||||||
self, parent, id=id,
|
self, parent, id=id,
|
||||||
pos=pos, size=size,
|
pos=pos, size=size,
|
||||||
style = style,
|
style = style,
|
||||||
@@ -420,7 +425,7 @@ class wxTimeCtrl(wxMaskedTextCtrl):
|
|||||||
self.Bind(wx.EVT_LEFT_DCLICK, self._OnDoubleClick ) ## select field under cursor on dclick
|
self.Bind(wx.EVT_LEFT_DCLICK, self._OnDoubleClick ) ## select field under cursor on dclick
|
||||||
self.Bind(wx.EVT_KEY_DOWN, self._OnKeyDown ) ## capture control events not normally seen, eg ctrl-tab.
|
self.Bind(wx.EVT_KEY_DOWN, self._OnKeyDown ) ## capture control events not normally seen, eg ctrl-tab.
|
||||||
self.Bind(wx.EVT_CHAR, self.__OnChar ) ## remove "shift" attribute from colon key event,
|
self.Bind(wx.EVT_CHAR, self.__OnChar ) ## remove "shift" attribute from colon key event,
|
||||||
## then call wxMaskedTextCtrl._OnChar with
|
## then call MaskedTextCtrl._OnChar with
|
||||||
## the possibly modified event.
|
## the possibly modified event.
|
||||||
self.Bind(wx.EVT_TEXT, self.__OnTextChange, self ) ## color control appropriately and EVT_TIMEUPDATE events
|
self.Bind(wx.EVT_TEXT, self.__OnTextChange, self ) ## color control appropriately and EVT_TIMEUPDATE events
|
||||||
|
|
||||||
@@ -443,7 +448,7 @@ class wxTimeCtrl(wxMaskedTextCtrl):
|
|||||||
This function binds an externally created spin button to the control, so that
|
This function binds an externally created spin button to the control, so that
|
||||||
up/down events from the button automatically change the control.
|
up/down events from the button automatically change the control.
|
||||||
"""
|
"""
|
||||||
dbg('wxTimeCtrl::BindSpinButton')
|
dbg('TimeCtrl::BindSpinButton')
|
||||||
self.__spinButton = sb
|
self.__spinButton = sb
|
||||||
if self.__spinButton:
|
if self.__spinButton:
|
||||||
# bind event handlers to spin ctrl
|
# bind event handlers to spin ctrl
|
||||||
@@ -452,7 +457,7 @@ class wxTimeCtrl(wxMaskedTextCtrl):
|
|||||||
|
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<wxTimeCtrl: %s>" % self.GetValue()
|
return "<TimeCtrl: %s>" % self.GetValue()
|
||||||
|
|
||||||
|
|
||||||
def SetValue(self, value):
|
def SetValue(self, value):
|
||||||
@@ -462,7 +467,7 @@ class wxTimeCtrl(wxMaskedTextCtrl):
|
|||||||
and convert wxDateTime, mxDateTime, or 12/24 format time string
|
and convert wxDateTime, mxDateTime, or 12/24 format time string
|
||||||
into the appropriate format string for the control.
|
into the appropriate format string for the control.
|
||||||
"""
|
"""
|
||||||
dbg('wxTimeCtrl::SetValue(%s)' % repr(value), indent=1)
|
dbg('TimeCtrl::SetValue(%s)' % repr(value), indent=1)
|
||||||
try:
|
try:
|
||||||
strtime = self._toGUI(self.__validateValue(value))
|
strtime = self._toGUI(self.__validateValue(value))
|
||||||
except:
|
except:
|
||||||
@@ -491,7 +496,7 @@ class wxTimeCtrl(wxMaskedTextCtrl):
|
|||||||
elif as_mxDateTimeDelta:
|
elif as_mxDateTimeDelta:
|
||||||
value = DateTime.DateTimeDelta(0, value.GetHour(), value.GetMinute(), value.GetSecond())
|
value = DateTime.DateTimeDelta(0, value.GetHour(), value.GetMinute(), value.GetSecond())
|
||||||
else:
|
else:
|
||||||
value = wxMaskedTextCtrl.GetValue(self)
|
value = MaskedTextCtrl.GetValue(self)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
@@ -504,7 +509,7 @@ class wxTimeCtrl(wxMaskedTextCtrl):
|
|||||||
|
|
||||||
def GetWxDateTime(self, value=None):
|
def GetWxDateTime(self, value=None):
|
||||||
"""
|
"""
|
||||||
This function is the conversion engine for wxTimeCtrl; it takes
|
This function is the conversion engine for TimeCtrl; it takes
|
||||||
one of the following types:
|
one of the following types:
|
||||||
time string
|
time string
|
||||||
wxDateTime
|
wxDateTime
|
||||||
@@ -520,7 +525,7 @@ class wxTimeCtrl(wxMaskedTextCtrl):
|
|||||||
"""
|
"""
|
||||||
global accept_mx
|
global accept_mx
|
||||||
dbg(suspend=1)
|
dbg(suspend=1)
|
||||||
dbg('wxTimeCtrl::GetWxDateTime(%s)' % repr(value), indent=1)
|
dbg('TimeCtrl::GetWxDateTime(%s)' % repr(value), indent=1)
|
||||||
if value is None:
|
if value is None:
|
||||||
dbg('getting control value')
|
dbg('getting control value')
|
||||||
value = self.GetValue()
|
value = self.GetValue()
|
||||||
@@ -608,7 +613,7 @@ class wxTimeCtrl(wxMaskedTextCtrl):
|
|||||||
adjusted to the new minimum value; if not limited, the value in the
|
adjusted to the new minimum value; if not limited, the value in the
|
||||||
control will be colored as invalid.
|
control will be colored as invalid.
|
||||||
"""
|
"""
|
||||||
dbg('wxTimeCtrl::SetMin(%s)'% repr(min), indent=1)
|
dbg('TimeCtrl::SetMin(%s)'% repr(min), indent=1)
|
||||||
if min is not None:
|
if min is not None:
|
||||||
try:
|
try:
|
||||||
min = self.GetWxDateTime(min)
|
min = self.GetWxDateTime(min)
|
||||||
@@ -636,7 +641,7 @@ class wxTimeCtrl(wxMaskedTextCtrl):
|
|||||||
by default, or as a string if as_string argument is True.
|
by default, or as a string if as_string argument is True.
|
||||||
"""
|
"""
|
||||||
dbg(suspend=1)
|
dbg(suspend=1)
|
||||||
dbg('wxTimeCtrl::GetMin, as_string?', as_string, indent=1)
|
dbg('TimeCtrl::GetMin, as_string?', as_string, indent=1)
|
||||||
if self.__min is None:
|
if self.__min is None:
|
||||||
dbg('(min == None)')
|
dbg('(min == None)')
|
||||||
ret = self.__min
|
ret = self.__min
|
||||||
@@ -667,7 +672,7 @@ class wxTimeCtrl(wxMaskedTextCtrl):
|
|||||||
adjusted to this maximum value; if not limited, the value in the
|
adjusted to this maximum value; if not limited, the value in the
|
||||||
control will be colored as invalid.
|
control will be colored as invalid.
|
||||||
"""
|
"""
|
||||||
dbg('wxTimeCtrl::SetMax(%s)' % repr(max), indent=1)
|
dbg('TimeCtrl::SetMax(%s)' % repr(max), indent=1)
|
||||||
if max is not None:
|
if max is not None:
|
||||||
try:
|
try:
|
||||||
max = self.GetWxDateTime(max)
|
max = self.GetWxDateTime(max)
|
||||||
@@ -695,7 +700,7 @@ class wxTimeCtrl(wxMaskedTextCtrl):
|
|||||||
by default, or as a string if as_string argument is True.
|
by default, or as a string if as_string argument is True.
|
||||||
"""
|
"""
|
||||||
dbg(suspend=1)
|
dbg(suspend=1)
|
||||||
dbg('wxTimeCtrl::GetMin, as_string?', as_string, indent=1)
|
dbg('TimeCtrl::GetMin, as_string?', as_string, indent=1)
|
||||||
if self.__max is None:
|
if self.__max is None:
|
||||||
dbg('(max == None)')
|
dbg('(max == None)')
|
||||||
ret = self.__max
|
ret = self.__max
|
||||||
@@ -746,7 +751,7 @@ class wxTimeCtrl(wxMaskedTextCtrl):
|
|||||||
limiting, but coloring of out-of-bounds values will still take
|
limiting, but coloring of out-of-bounds values will still take
|
||||||
place if bounds have been set for the control.
|
place if bounds have been set for the control.
|
||||||
"""
|
"""
|
||||||
dbg('wxTimeCtrl::SetLimited(%d)' % limited, indent=1)
|
dbg('TimeCtrl::SetLimited(%d)' % limited, indent=1)
|
||||||
self.__limited = limited
|
self.__limited = limited
|
||||||
|
|
||||||
if not limited:
|
if not limited:
|
||||||
@@ -842,7 +847,7 @@ class wxTimeCtrl(wxMaskedTextCtrl):
|
|||||||
dbg('ValueError getting wxDateTime for %s' % repr(value), indent=0)
|
dbg('ValueError getting wxDateTime for %s' % repr(value), indent=0)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
dbg('wxTimeCtrl::IsInBounds(%s)' % repr(value), indent=1)
|
dbg('TimeCtrl::IsInBounds(%s)' % repr(value), indent=1)
|
||||||
if self.__min is None or self.__max is None:
|
if self.__min is None or self.__max is None:
|
||||||
dbg(indent=0)
|
dbg(indent=0)
|
||||||
return True
|
return True
|
||||||
@@ -889,7 +894,7 @@ class wxTimeCtrl(wxMaskedTextCtrl):
|
|||||||
|
|
||||||
|
|
||||||
def __OnTextChange(self, event=None):
|
def __OnTextChange(self, event=None):
|
||||||
dbg('wxTimeCtrl::OnTextChange', indent=1)
|
dbg('TimeCtrl::OnTextChange', indent=1)
|
||||||
|
|
||||||
# Allow wxMaskedtext base control to color as appropriate,
|
# Allow wxMaskedtext base control to color as appropriate,
|
||||||
# and Skip the EVT_TEXT event (if appropriate.)
|
# and Skip the EVT_TEXT event (if appropriate.)
|
||||||
@@ -900,7 +905,7 @@ class wxTimeCtrl(wxMaskedTextCtrl):
|
|||||||
## event iff the value has actually changed. The masked edit
|
## event iff the value has actually changed. The masked edit
|
||||||
## OnTextChange routine does this, and returns True on a valid event,
|
## OnTextChange routine does this, and returns True on a valid event,
|
||||||
## False otherwise.
|
## False otherwise.
|
||||||
if not wxMaskedTextCtrl._OnTextChange(self, event):
|
if not MaskedTextCtrl._OnTextChange(self, event):
|
||||||
return
|
return
|
||||||
|
|
||||||
dbg('firing TimeUpdatedEvent...')
|
dbg('firing TimeUpdatedEvent...')
|
||||||
@@ -916,14 +921,14 @@ class wxTimeCtrl(wxMaskedTextCtrl):
|
|||||||
This is necessary to handle the optional spin button, because the insertion
|
This is necessary to handle the optional spin button, because the insertion
|
||||||
point is lost when the focus shifts to the spin button.
|
point is lost when the focus shifts to the spin button.
|
||||||
"""
|
"""
|
||||||
dbg('wxTimeCtrl::SetInsertionPoint', pos, indent=1)
|
dbg('TimeCtrl::SetInsertionPoint', pos, indent=1)
|
||||||
wxMaskedTextCtrl.SetInsertionPoint(self, pos) # (causes EVT_TEXT event to fire)
|
MaskedTextCtrl.SetInsertionPoint(self, pos) # (causes EVT_TEXT event to fire)
|
||||||
self.__posCurrent = self.GetInsertionPoint()
|
self.__posCurrent = self.GetInsertionPoint()
|
||||||
dbg(indent=0)
|
dbg(indent=0)
|
||||||
|
|
||||||
|
|
||||||
def SetSelection(self, sel_start, sel_to):
|
def SetSelection(self, sel_start, sel_to):
|
||||||
dbg('wxTimeCtrl::SetSelection', sel_start, sel_to, indent=1)
|
dbg('TimeCtrl::SetSelection', sel_start, sel_to, indent=1)
|
||||||
|
|
||||||
# Adjust selection range to legal extent if not already
|
# Adjust selection range to legal extent if not already
|
||||||
if sel_start < 0:
|
if sel_start < 0:
|
||||||
@@ -936,7 +941,7 @@ class wxTimeCtrl(wxMaskedTextCtrl):
|
|||||||
sel_to = cell_end
|
sel_to = cell_end
|
||||||
|
|
||||||
self.__bSelection = sel_start != sel_to
|
self.__bSelection = sel_start != sel_to
|
||||||
wxMaskedTextCtrl.SetSelection(self, sel_start, sel_to)
|
MaskedTextCtrl.SetSelection(self, sel_start, sel_to)
|
||||||
dbg(indent=0)
|
dbg(indent=0)
|
||||||
|
|
||||||
|
|
||||||
@@ -961,7 +966,7 @@ class wxTimeCtrl(wxMaskedTextCtrl):
|
|||||||
Event handler for any bound spin button on EVT_SPIN_UP;
|
Event handler for any bound spin button on EVT_SPIN_UP;
|
||||||
causes control to behave as if up arrow was pressed.
|
causes control to behave as if up arrow was pressed.
|
||||||
"""
|
"""
|
||||||
dbg('wxTimeCtrl::OnSpinUp', indent=1)
|
dbg('TimeCtrl::OnSpinUp', indent=1)
|
||||||
self.__OnSpin(WXK_UP)
|
self.__OnSpin(WXK_UP)
|
||||||
keep_processing = False
|
keep_processing = False
|
||||||
dbg(indent=0)
|
dbg(indent=0)
|
||||||
@@ -973,7 +978,7 @@ class wxTimeCtrl(wxMaskedTextCtrl):
|
|||||||
Event handler for any bound spin button on EVT_SPIN_DOWN;
|
Event handler for any bound spin button on EVT_SPIN_DOWN;
|
||||||
causes control to behave as if down arrow was pressed.
|
causes control to behave as if down arrow was pressed.
|
||||||
"""
|
"""
|
||||||
dbg('wxTimeCtrl::OnSpinDown', indent=1)
|
dbg('TimeCtrl::OnSpinDown', indent=1)
|
||||||
self.__OnSpin(WXK_DOWN)
|
self.__OnSpin(WXK_DOWN)
|
||||||
keep_processing = False
|
keep_processing = False
|
||||||
dbg(indent=0)
|
dbg(indent=0)
|
||||||
@@ -987,13 +992,13 @@ class wxTimeCtrl(wxMaskedTextCtrl):
|
|||||||
It then calls the base control's _OnChar routine with the modified
|
It then calls the base control's _OnChar routine with the modified
|
||||||
event instance.
|
event instance.
|
||||||
"""
|
"""
|
||||||
dbg('wxTimeCtrl::OnChar', indent=1)
|
dbg('TimeCtrl::OnChar', indent=1)
|
||||||
keycode = event.GetKeyCode()
|
keycode = event.GetKeyCode()
|
||||||
dbg('keycode:', keycode)
|
dbg('keycode:', keycode)
|
||||||
if keycode == ord(':'):
|
if keycode == ord(':'):
|
||||||
dbg('colon seen! removing shift attribute')
|
dbg('colon seen! removing shift attribute')
|
||||||
event.m_shiftDown = False
|
event.m_shiftDown = False
|
||||||
wxMaskedTextCtrl._OnChar(self, event ) ## handle each keypress
|
MaskedTextCtrl._OnChar(self, event ) ## handle each keypress
|
||||||
dbg(indent=0)
|
dbg(indent=0)
|
||||||
|
|
||||||
|
|
||||||
@@ -1012,7 +1017,7 @@ class wxTimeCtrl(wxMaskedTextCtrl):
|
|||||||
Event handler for motion events; this handler
|
Event handler for motion events; this handler
|
||||||
changes limits the selection to the new cell boundaries.
|
changes limits the selection to the new cell boundaries.
|
||||||
"""
|
"""
|
||||||
dbg('wxTimeCtrl::LimitSelection', indent=1)
|
dbg('TimeCtrl::LimitSelection', indent=1)
|
||||||
pos = self.GetInsertionPoint()
|
pos = self.GetInsertionPoint()
|
||||||
self.__posCurrent = pos
|
self.__posCurrent = pos
|
||||||
sel_start, sel_to = self.GetSelection()
|
sel_start, sel_to = self.GetSelection()
|
||||||
@@ -1031,7 +1036,7 @@ class wxTimeCtrl(wxMaskedTextCtrl):
|
|||||||
|
|
||||||
|
|
||||||
def __IncrementValue(self, key, pos):
|
def __IncrementValue(self, key, pos):
|
||||||
dbg('wxTimeCtrl::IncrementValue', key, pos, indent=1)
|
dbg('TimeCtrl::IncrementValue', key, pos, indent=1)
|
||||||
text = self.GetValue()
|
text = self.GetValue()
|
||||||
field = self._FindField(pos)
|
field = self._FindField(pos)
|
||||||
dbg('field: ', field._index)
|
dbg('field: ', field._index)
|
||||||
@@ -1095,7 +1100,7 @@ class wxTimeCtrl(wxMaskedTextCtrl):
|
|||||||
not a valid value for the control as currently specified.
|
not a valid value for the control as currently specified.
|
||||||
It is used by both the SetValue() and the IsValid() methods.
|
It is used by both the SetValue() and the IsValid() methods.
|
||||||
"""
|
"""
|
||||||
dbg('wxTimeCtrl::__validateValue(%s)' % repr(value), indent=1)
|
dbg('TimeCtrl::__validateValue(%s)' % repr(value), indent=1)
|
||||||
if not value:
|
if not value:
|
||||||
dbg(indent=0)
|
dbg(indent=0)
|
||||||
raise ValueError('%s not a valid time value' % repr(value))
|
raise ValueError('%s not a valid time value' % repr(value))
|
||||||
@@ -1115,7 +1120,7 @@ class wxTimeCtrl(wxMaskedTextCtrl):
|
|||||||
return value
|
return value
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# Test jig for wxTimeCtrl:
|
# Test jig for TimeCtrl:
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import traceback
|
import traceback
|
||||||
@@ -1130,7 +1135,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
self.test_mx = test_mx
|
self.test_mx = test_mx
|
||||||
|
|
||||||
self.tc = wxTimeCtrl(self, 10, fmt24hr = fmt24hr)
|
self.tc = TimeCtrl(self, 10, fmt24hr = fmt24hr)
|
||||||
sb = wx.SpinButton( self, 20, wx.DefaultPosition, (-1,20), 0 )
|
sb = wx.SpinButton( self, 20, wx.DefaultPosition, (-1,20), 0 )
|
||||||
self.tc.BindSpinButton(sb)
|
self.tc.BindSpinButton(sb)
|
||||||
|
|
||||||
@@ -1160,7 +1165,7 @@ if __name__ == '__main__':
|
|||||||
fmt24hr = '24' in sys.argv
|
fmt24hr = '24' in sys.argv
|
||||||
test_mx = 'mx' in sys.argv
|
test_mx = 'mx' in sys.argv
|
||||||
try:
|
try:
|
||||||
frame = wx.Frame(None, -1, "wxTimeCtrl Test", (20,20), (100,100) )
|
frame = wx.Frame(None, -1, "TimeCtrl Test", (20,20), (100,100) )
|
||||||
panel = TestPanel(frame, -1, (-1,-1), fmt24hr=fmt24hr, test_mx = test_mx)
|
panel = TestPanel(frame, -1, (-1,-1), fmt24hr=fmt24hr, test_mx = test_mx)
|
||||||
frame.Show(True)
|
frame.Show(True)
|
||||||
except:
|
except:
|
||||||
|
@@ -7,6 +7,10 @@
|
|||||||
# Copyright: (c) 2002 by Will Sadkin, 2002
|
# Copyright: (c) 2002 by Will Sadkin, 2002
|
||||||
# License: wxWindows license
|
# License: wxWindows license
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o V2.5 compatability update
|
||||||
|
#
|
||||||
|
|
||||||
"""
|
"""
|
||||||
This module provides a useful debugging framework that supports
|
This module provides a useful debugging framework that supports
|
||||||
@@ -217,20 +221,22 @@ class Logger:
|
|||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
from wxPython.wx import *
|
import sys
|
||||||
wxLog_SetActiveTarget( wxLogStderr() )
|
import wx
|
||||||
|
|
||||||
|
wx.Log_SetActiveTarget( wx.LogStderr() )
|
||||||
logger = Logger('module')
|
logger = Logger('module')
|
||||||
dbg = logger.dbg
|
dbg = logger.dbg
|
||||||
dbg(enable=1)
|
dbg(enable=1)
|
||||||
logger('test __call__ interface')
|
logger('test __call__ interface')
|
||||||
dbg('testing wxLog output to stderr:', wxlog=1, indent=1)
|
dbg('testing wxLog output to stderr:', wxlog=1, indent=1)
|
||||||
dbg('1,2,3...')
|
dbg('1,2,3...')
|
||||||
dbg('testing wxLogNull:')
|
dbg('testing wx.LogNull:')
|
||||||
devnull = wxLogNull()
|
devnull = wx.LogNull()
|
||||||
dbg('4,5,6...') # shouldn't print, according to doc...
|
dbg('4,5,6...') # shouldn't print, according to doc...
|
||||||
del devnull
|
del devnull
|
||||||
dbg('(resuming to wxLogStdErr)', '7,8,9...', indent=0)
|
dbg('(resuming to wx.LogStdErr)', '7,8,9...', indent=0)
|
||||||
dbg('disabling wxLog output, switching to stderr:')
|
dbg('disabling wx.Log output, switching to stderr:')
|
||||||
dbg(wxlog=0, stream=sys.stderr)
|
dbg(wxlog=0, stream=sys.stderr)
|
||||||
dbg(logger._outstream, 'switching back to stdout:')
|
dbg(logger._outstream, 'switching back to stdout:')
|
||||||
dbg(stream=None)
|
dbg(stream=None)
|
||||||
|
@@ -8,25 +8,31 @@
|
|||||||
# Copyright: (c) 2002 by Total Control Software
|
# Copyright: (c) 2002 by Total Control Software
|
||||||
# Licence: wxWindows license
|
# Licence: wxWindows license
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o V2.5 compatability update
|
||||||
|
#
|
||||||
|
|
||||||
|
import getopt
|
||||||
|
import glob
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
import sys, os, glob, getopt
|
import wx
|
||||||
from wxPython.wx import *
|
|
||||||
|
|
||||||
|
|
||||||
def convert(file, maskClr, outputDir, outputName, outType, outExt):
|
def convert(file, maskClr, outputDir, outputName, outType, outExt):
|
||||||
if os.path.splitext(file)[1].lower() == ".ico":
|
if os.path.splitext(file)[1].lower() == ".ico":
|
||||||
icon = wxIcon(file, wxBITMAP_TYPE_ICO)
|
icon = wx.Icon(file, wx.BITMAP_TYPE_ICO)
|
||||||
img = wxBitmapFromIcon(icon)
|
img = wx.BitmapFromIcon(icon)
|
||||||
else:
|
else:
|
||||||
img = wxBitmap(file, wxBITMAP_TYPE_ANY)
|
img = wx.Bitmap(file, wx.BITMAP_TYPE_ANY)
|
||||||
|
|
||||||
if not img.Ok():
|
if not img.Ok():
|
||||||
return 0, file + " failed to load!"
|
return 0, file + " failed to load!"
|
||||||
else:
|
else:
|
||||||
if maskClr:
|
if maskClr:
|
||||||
om = img.GetMask()
|
om = img.GetMask()
|
||||||
mask = wxMaskColour(img, maskClr)
|
mask = wx.MaskColour(img, maskClr)
|
||||||
img.SetMask(mask)
|
img.SetMask(mask)
|
||||||
if om is not None:
|
if om is not None:
|
||||||
om.Destroy()
|
om.Destroy()
|
||||||
@@ -38,7 +44,7 @@ def convert(file, maskClr, outputDir, outputName, outType, outExt):
|
|||||||
if img.SaveFile(newname, outType):
|
if img.SaveFile(newname, outType):
|
||||||
return 1, file + " converted to " + newname
|
return 1, file + " converted to " + newname
|
||||||
else:
|
else:
|
||||||
img = wxImageFromBitmap(img)
|
img = wx.ImageFromBitmap(img)
|
||||||
if img.SaveFile(newname, outType):
|
if img.SaveFile(newname, outType):
|
||||||
return 1, "ok"
|
return 1, "ok"
|
||||||
else:
|
else:
|
||||||
|
@@ -8,6 +8,10 @@
|
|||||||
# Copyright: (c) 2002 by Total Control Software
|
# Copyright: (c) 2002 by Total Control Software
|
||||||
# Licence: wxWindows license
|
# Licence: wxWindows license
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o V2.5 compatability update
|
||||||
|
#
|
||||||
|
|
||||||
"""
|
"""
|
||||||
img2png.py -- convert several image formats to PNG format
|
img2png.py -- convert several image formats to PNG format
|
||||||
@@ -32,15 +36,16 @@ Options:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import img2img
|
import wx
|
||||||
from wxPython import wx
|
import img2img
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# some bitmap related things need to have a wxApp initialized...
|
# some bitmap related things need to have a wxApp initialized...
|
||||||
if wx.wxGetApp() is None:
|
if wx.GetApp() is None:
|
||||||
app = wx.wxPySimpleApp()
|
app = wx.PySimpleApp()
|
||||||
img2img.main(sys.argv[1:], wx.wxBITMAP_TYPE_PNG, ".png", __doc__)
|
img2img.main(sys.argv[1:], wx.BITMAP_TYPE_PNG, ".png", __doc__)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
@@ -8,6 +8,10 @@
|
|||||||
# Copyright: (c) 2002 by Total Control Software
|
# Copyright: (c) 2002 by Total Control Software
|
||||||
# Licence: wxWindows license
|
# Licence: wxWindows license
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o V2.5 compatability update
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -54,12 +58,23 @@ Options:
|
|||||||
# - Cliff Wells <LogiplexSoftware@earthlink.net>
|
# - Cliff Wells <LogiplexSoftware@earthlink.net>
|
||||||
# 20021206: Added catalog (-c) option.
|
# 20021206: Added catalog (-c) option.
|
||||||
#
|
#
|
||||||
|
# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o V2.5 compatability update
|
||||||
|
#
|
||||||
|
|
||||||
|
import cPickle
|
||||||
|
import cStringIO
|
||||||
|
import getopt
|
||||||
|
import glob
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import tempfile
|
||||||
|
import zlib
|
||||||
|
|
||||||
import sys, os, glob, getopt, tempfile
|
import wx
|
||||||
import cPickle, cStringIO, zlib
|
|
||||||
import img2img
|
import img2img
|
||||||
from wxPython import wx
|
|
||||||
|
|
||||||
|
|
||||||
def crunch_data(data, compressed):
|
def crunch_data(data, compressed):
|
||||||
@@ -116,8 +131,8 @@ def main(args):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# some bitmap related things need to have a wxApp initialized...
|
# some bitmap related things need to have a wxApp initialized...
|
||||||
if wx.wxGetApp() is None:
|
if wx.GetApp() is None:
|
||||||
app = wx.wxPySimpleApp()
|
app = wx.PySimpleApp()
|
||||||
|
|
||||||
append = 0
|
append = 0
|
||||||
compressed = 1
|
compressed = 1
|
||||||
@@ -154,7 +169,7 @@ def main(args):
|
|||||||
|
|
||||||
# convert the image file to a temporary file
|
# convert the image file to a temporary file
|
||||||
tfname = tempfile.mktemp()
|
tfname = tempfile.mktemp()
|
||||||
ok, msg = img2img.convert(image_file, maskClr, None, tfname, wx.wxBITMAP_TYPE_PNG, ".png")
|
ok, msg = img2img.convert(image_file, maskClr, None, tfname, wx.BITMAP_TYPE_PNG, ".png")
|
||||||
if not ok:
|
if not ok:
|
||||||
print msg
|
print msg
|
||||||
return
|
return
|
||||||
@@ -198,9 +213,9 @@ def main(args):
|
|||||||
out.write("#" + "-" * 70 + "\n")
|
out.write("#" + "-" * 70 + "\n")
|
||||||
if not append:
|
if not append:
|
||||||
out.write("# This file was generated by %s\n#\n" % sys.argv[0])
|
out.write("# This file was generated by %s\n#\n" % sys.argv[0])
|
||||||
out.write("from wxPython.wx import wxImageFromStream, wxBitmapFromImage\n")
|
out.write("from wx import ImageFromStream, BitmapFromImage\n")
|
||||||
if icon:
|
if icon:
|
||||||
out.write("from wxPython.wx import wxEmptyIcon\n")
|
out.write("from wx import EmptyIcon\n")
|
||||||
if compressed:
|
if compressed:
|
||||||
out.write("import cStringIO, zlib\n\n\n")
|
out.write("import cStringIO, zlib\n\n\n")
|
||||||
else:
|
else:
|
||||||
@@ -222,14 +237,14 @@ def main(args):
|
|||||||
|
|
||||||
|
|
||||||
out.write("def get%sBitmap():\n"
|
out.write("def get%sBitmap():\n"
|
||||||
" return wxBitmapFromImage(get%sImage())\n\n"
|
" return BitmapFromImage(get%sImage())\n\n"
|
||||||
"def get%sImage():\n"
|
"def get%sImage():\n"
|
||||||
" stream = cStringIO.StringIO(get%sData())\n"
|
" stream = cStringIO.StringIO(get%sData())\n"
|
||||||
" return wxImageFromStream(stream)\n\n"
|
" return ImageFromStream(stream)\n\n"
|
||||||
% tuple([imgName] * 4))
|
% tuple([imgName] * 4))
|
||||||
if icon:
|
if icon:
|
||||||
out.write("def get%sIcon():\n"
|
out.write("def get%sIcon():\n"
|
||||||
" icon = wxEmptyIcon()\n"
|
" icon = EmptyIcon()\n"
|
||||||
" icon.CopyFromBitmap(get%sBitmap())\n"
|
" icon.CopyFromBitmap(get%sBitmap())\n"
|
||||||
" return icon\n\n"
|
" return icon\n\n"
|
||||||
% tuple([imgName] * 2))
|
% tuple([imgName] * 2))
|
||||||
|
@@ -8,6 +8,10 @@
|
|||||||
# Copyright: (c) 2002 by Total Control Software
|
# Copyright: (c) 2002 by Total Control Software
|
||||||
# Licence: wxWindows license
|
# Licence: wxWindows license
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o V2.5 compatability update
|
||||||
|
#
|
||||||
|
|
||||||
"""
|
"""
|
||||||
img2xpm.py -- convert several image formats to XPM
|
img2xpm.py -- convert several image formats to XPM
|
||||||
@@ -31,16 +35,17 @@ Options:
|
|||||||
the -o option.
|
the -o option.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
import sys
|
import wx
|
||||||
import img2img
|
|
||||||
from wxPython import wx
|
import img2img
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# some bitmap related things need to have a wxApp initialized...
|
# some bitmap related things need to have a wxApp initialized...
|
||||||
if wx.wxGetApp() is None:
|
if wx.GetApp() is None:
|
||||||
app = wx.wxPySimpleApp()
|
app = wx.PySimpleApp()
|
||||||
img2img.main(sys.argv[1:], wx.wxBITMAP_TYPE_XPM, ".xpm", __doc__)
|
img2img.main(sys.argv[1:], wx.BITMAP_TYPE_XPM, ".xpm", __doc__)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@@ -7,4 +7,4 @@ import wx.lib.colourchooser.pycolourchooser
|
|||||||
__doc__ = wx.lib.colourchooser.pycolourchooser.__doc__
|
__doc__ = wx.lib.colourchooser.pycolourchooser.__doc__
|
||||||
|
|
||||||
main = wx.lib.colourchooser.pycolourchooser.main
|
main = wx.lib.colourchooser.pycolourchooser.main
|
||||||
wxPyColourChooser = wx.lib.colourchooser.pycolourchooser.wxPyColourChooser
|
wxPyColourChooser = wx.lib.colourchooser.pycolourchooser.PyColourChooser
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
from editor import wxEditor
|
from editor import Editor
|
||||||
|
|
||||||
|
@@ -10,4 +10,4 @@ ForceBetween = wx.lib.editor.editor.ForceBetween
|
|||||||
LineSplitter = wx.lib.editor.editor.LineSplitter
|
LineSplitter = wx.lib.editor.editor.LineSplitter
|
||||||
LineTrimmer = wx.lib.editor.editor.LineTrimmer
|
LineTrimmer = wx.lib.editor.editor.LineTrimmer
|
||||||
Scroller = wx.lib.editor.editor.Scroller
|
Scroller = wx.lib.editor.editor.Scroller
|
||||||
wxEditor = wx.lib.editor.editor.wxEditor
|
wxEditor = wx.lib.editor.editor.Editor
|
||||||
|
@@ -6,5 +6,5 @@ import wx.lib.grids
|
|||||||
|
|
||||||
__doc__ = wx.lib.grids.__doc__
|
__doc__ = wx.lib.grids.__doc__
|
||||||
|
|
||||||
wxFlexGridSizer = wx.lib.grids.wxFlexGridSizer
|
wxFlexGridSizer = wx.lib.grids.PyFlexGridSizer
|
||||||
wxGridSizer = wx.lib.grids.wxGridSizer
|
wxGridSizer = wx.lib.grids.PyGridSizer
|
||||||
|
@@ -6,6 +6,6 @@ import wx.lib.infoframe
|
|||||||
|
|
||||||
__doc__ = wx.lib.infoframe.__doc__
|
__doc__ = wx.lib.infoframe.__doc__
|
||||||
|
|
||||||
Dummy_wxPyInformationalMessagesFrame = wx.lib.infoframe.Dummy_wxPyInformationalMessagesFrame
|
Dummy_wxPyInformationalMessagesFrame = wx.lib.infoframe.Dummy_PyInformationalMessagesFrame
|
||||||
_MyStatusBar = wx.lib.infoframe._MyStatusBar
|
_MyStatusBar = wx.lib.infoframe._MyStatusBar
|
||||||
wxPyInformationalMessagesFrame = wx.lib.infoframe.wxPyInformationalMessagesFrame
|
wxPyInformationalMessagesFrame = wx.lib.infoframe.PyInformationalMessagesFrame
|
||||||
|
@@ -7,6 +7,6 @@ import wx.lib.intctrl
|
|||||||
__doc__ = wx.lib.intctrl.__doc__
|
__doc__ = wx.lib.intctrl.__doc__
|
||||||
|
|
||||||
EVT_INT = wx.lib.intctrl.EVT_INT
|
EVT_INT = wx.lib.intctrl.EVT_INT
|
||||||
wxIntCtrl = wx.lib.intctrl.wxIntCtrl
|
wxIntCtrl = wx.lib.intctrl.IntCtrl
|
||||||
wxIntUpdatedEvent = wx.lib.intctrl.wxIntUpdatedEvent
|
wxIntUpdatedEvent = wx.lib.intctrl.IntUpdatedEvent
|
||||||
wxIntValidator = wx.lib.intctrl.wxIntValidator
|
wxIntValidator = wx.lib.intctrl.IntValidator
|
||||||
|
@@ -7,4 +7,4 @@ import wx.lib.maskedctrl
|
|||||||
__doc__ = wx.lib.maskedctrl.__doc__
|
__doc__ = wx.lib.maskedctrl.__doc__
|
||||||
|
|
||||||
controlTypes = wx.lib.maskedctrl.controlTypes
|
controlTypes = wx.lib.maskedctrl.controlTypes
|
||||||
wxMaskedCtrl = wx.lib.maskedctrl.wxMaskedCtrl
|
wxMaskedCtrl = wx.lib.maskedctrl.MaskedCtrl
|
||||||
|
@@ -9,8 +9,8 @@ __doc__ = wx.lib.maskededit.__doc__
|
|||||||
Field = wx.lib.maskededit.Field
|
Field = wx.lib.maskededit.Field
|
||||||
test = wx.lib.maskededit.test
|
test = wx.lib.maskededit.test
|
||||||
test2 = wx.lib.maskededit.test2
|
test2 = wx.lib.maskededit.test2
|
||||||
wxIpAddrCtrl = wx.lib.maskededit.wxIpAddrCtrl
|
wxIpAddrCtrl = wx.lib.maskededit.IpAddrCtrl
|
||||||
wxMaskedComboBox = wx.lib.maskededit.wxMaskedComboBox
|
wxMaskedComboBox = wx.lib.maskededit.MaskedComboBox
|
||||||
wxMaskedComboBoxSelectEvent = wx.lib.maskededit.wxMaskedComboBoxSelectEvent
|
wxMaskedComboBoxSelectEvent = wx.lib.maskededit.MaskedComboBoxSelectEvent
|
||||||
wxMaskedEditMixin = wx.lib.maskededit.wxMaskedEditMixin
|
wxMaskedEditMixin = wx.lib.maskededit.MaskedEditMixin
|
||||||
wxMaskedTextCtrl = wx.lib.maskededit.wxMaskedTextCtrl
|
wxMaskedTextCtrl = wx.lib.maskededit.MaskedTextCtrl
|
||||||
|
@@ -7,5 +7,5 @@ import wx.lib.maskednumctrl
|
|||||||
__doc__ = wx.lib.maskednumctrl.__doc__
|
__doc__ = wx.lib.maskednumctrl.__doc__
|
||||||
|
|
||||||
EVT_MASKEDNUM = wx.lib.maskednumctrl.EVT_MASKEDNUM
|
EVT_MASKEDNUM = wx.lib.maskednumctrl.EVT_MASKEDNUM
|
||||||
wxMaskedNumCtrl = wx.lib.maskednumctrl.wxMaskedNumCtrl
|
wxMaskedNumCtrl = wx.lib.maskednumctrl.MaskedNumCtrl
|
||||||
wxMaskedNumNumberUpdatedEvent = wx.lib.maskednumctrl.wxMaskedNumNumberUpdatedEvent
|
wxMaskedNumNumberUpdatedEvent = wx.lib.maskednumctrl.MaskedNumNumberUpdatedEvent
|
||||||
|
@@ -6,4 +6,4 @@ import wx.lib.mixins.grid
|
|||||||
|
|
||||||
__doc__ = wx.lib.mixins.grid.__doc__
|
__doc__ = wx.lib.mixins.grid.__doc__
|
||||||
|
|
||||||
wxGridAutoEditMixin = wx.lib.mixins.grid.wxGridAutoEditMixin
|
wxGridAutoEditMixin = wx.lib.mixins.grid.GridAutoEditMixin
|
||||||
|
@@ -9,6 +9,6 @@ __doc__ = wx.lib.mixins.listctrl.__doc__
|
|||||||
ListCtrlSelectionManagerMix = wx.lib.mixins.listctrl.ListCtrlSelectionManagerMix
|
ListCtrlSelectionManagerMix = wx.lib.mixins.listctrl.ListCtrlSelectionManagerMix
|
||||||
getListCtrlSelection = wx.lib.mixins.listctrl.getListCtrlSelection
|
getListCtrlSelection = wx.lib.mixins.listctrl.getListCtrlSelection
|
||||||
selectBeforePopup = wx.lib.mixins.listctrl.selectBeforePopup
|
selectBeforePopup = wx.lib.mixins.listctrl.selectBeforePopup
|
||||||
wxColumnSorterMixin = wx.lib.mixins.listctrl.wxColumnSorterMixin
|
wxColumnSorterMixin = wx.lib.mixins.listctrl.ColumnSorterMixin
|
||||||
wxListCtrlAutoWidthMixin = wx.lib.mixins.listctrl.wxListCtrlAutoWidthMixin
|
wxListCtrlAutoWidthMixin = wx.lib.mixins.listctrl.ListCtrlAutoWidthMixin
|
||||||
|
|
||||||
|
@@ -11,6 +11,6 @@ MultiClient = wx.lib.multisash.MultiClient
|
|||||||
MultiCloser = wx.lib.multisash.MultiCloser
|
MultiCloser = wx.lib.multisash.MultiCloser
|
||||||
MultiCreator = wx.lib.multisash.MultiCreator
|
MultiCreator = wx.lib.multisash.MultiCreator
|
||||||
MultiSizer = wx.lib.multisash.MultiSizer
|
MultiSizer = wx.lib.multisash.MultiSizer
|
||||||
wxMultiSash = wx.lib.multisash.wxMultiSash
|
wxMultiSash = wx.lib.multisash.MultiSash
|
||||||
wxMultiSplit = wx.lib.multisash.wxMultiSplit
|
wxMultiSplit = wx.lib.multisash.MultiSplit
|
||||||
wxMultiViewLeaf = wx.lib.multisash.wxMultiViewLeaf
|
wxMultiViewLeaf = wx.lib.multisash.MultiViewLeaf
|
||||||
|
@@ -35,7 +35,7 @@ TreeLayout = wx.lib.mvctree.TreeLayout
|
|||||||
TreeLinePainter = wx.lib.mvctree.TreeLinePainter
|
TreeLinePainter = wx.lib.mvctree.TreeLinePainter
|
||||||
TreeNodePainter = wx.lib.mvctree.TreeNodePainter
|
TreeNodePainter = wx.lib.mvctree.TreeNodePainter
|
||||||
TreePainter = wx.lib.mvctree.TreePainter
|
TreePainter = wx.lib.mvctree.TreePainter
|
||||||
wxMVCTree = wx.lib.mvctree.wxMVCTree
|
wxMVCTree = wx.lib.mvctree.MVCTree
|
||||||
wxMVCTreeEvent = wx.lib.mvctree.wxMVCTreeEvent
|
wxMVCTreeEvent = wx.lib.mvctree.MVCTreeEvent
|
||||||
wxMVCTreeNotifyEvent = wx.lib.mvctree.wxMVCTreeNotifyEvent
|
wxMVCTreeNotifyEvent = wx.lib.mvctree.MVCTreeNotifyEvent
|
||||||
wxTreeModel = wx.lib.mvctree.wxTreeModel
|
wxTreeModel = wx.lib.mvctree.TreeModel
|
||||||
|
22
wxPython/wxPython/lib/plot.py
Normal file
22
wxPython/wxPython/lib/plot.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
## This file imports items from the wx package into the wxPython package for
|
||||||
|
## backwards compatibility. Some names will also have a 'wx' added on if
|
||||||
|
## that is how they used to be named in the old wxPython package.
|
||||||
|
|
||||||
|
import wx.lib.plot
|
||||||
|
|
||||||
|
__doc__ = wx.lib.plot.__doc__
|
||||||
|
|
||||||
|
PolyPoints = wx.lib.plot.PolyPoints
|
||||||
|
PolyLine = wx.lib.plot.PolyLine
|
||||||
|
PolyMarker = wx.lib.plot.PolyMarker
|
||||||
|
PlotGraphics = wx.lib.plot.PlotGraphics
|
||||||
|
PlotCanvas = wx.lib.plot.PlotCanvas
|
||||||
|
PlotPrintout = wx.lib.plot.PlotPrintout
|
||||||
|
FloatDCWrapper = wx.lib.plot.FloatDCWrapper
|
||||||
|
_draw1Objects = wx.lib.plot._draw1Objects
|
||||||
|
_draw2Objects = wx.lib.plot._draw2Objects
|
||||||
|
_draw3Objects = wx.lib.plot._draw3Objects
|
||||||
|
_draw4Objects = wx.lib.plot._draw4Objects
|
||||||
|
_draw5Objects = wx.lib.plot._draw5Objects
|
||||||
|
__test = wx.lib.plot.__test
|
||||||
|
|
@@ -8,5 +8,6 @@ __doc__ = wx.lib.popupctl.__doc__
|
|||||||
|
|
||||||
PopButton = wx.lib.popupctl.PopButton
|
PopButton = wx.lib.popupctl.PopButton
|
||||||
wxPopupControl = wx.lib.popupctl.wxPopupControl
|
wxPopupControl = wx.lib.popupctl.wxPopupControl
|
||||||
wxPopupCtrl = wx.lib.popupctl.wxPopupCtrl
|
wxPopupCtrl = wx.lib.popupctl.PopupCtrl
|
||||||
wxPopupDialog = wx.lib.popupctl.wxPopupDialog
|
wxPopupControl = wx.lib.popupctl.PopupControl
|
||||||
|
wxPopupDialog = wx.lib.popupctl.PopupDialog
|
||||||
|
@@ -6,4 +6,4 @@ import wx.lib.rightalign
|
|||||||
|
|
||||||
__doc__ = wx.lib.rightalign.__doc__
|
__doc__ = wx.lib.rightalign.__doc__
|
||||||
|
|
||||||
wxRightTextCtrl = wx.lib.rightalign.wxRightTextCtrl
|
wxRightTextCtrl = wx.lib.rightalign.RightTextCtrl
|
||||||
|
@@ -6,4 +6,4 @@ import wx.lib.scrolledpanel
|
|||||||
|
|
||||||
__doc__ = wx.lib.scrolledpanel.__doc__
|
__doc__ = wx.lib.scrolledpanel.__doc__
|
||||||
|
|
||||||
wxScrolledPanel = wx.lib.scrolledpanel.wxScrolledPanel
|
wxScrolledPanel = wx.lib.scrolledpanel.ScrolledPanel
|
||||||
|
@@ -8,4 +8,4 @@ __doc__ = wx.lib.timectrl.__doc__
|
|||||||
|
|
||||||
EVT_TIMEUPDATE = wx.lib.timectrl.EVT_TIMEUPDATE
|
EVT_TIMEUPDATE = wx.lib.timectrl.EVT_TIMEUPDATE
|
||||||
TimeUpdatedEvent = wx.lib.timectrl.TimeUpdatedEvent
|
TimeUpdatedEvent = wx.lib.timectrl.TimeUpdatedEvent
|
||||||
wxTimeCtrl = wx.lib.timectrl.wxTimeCtrl
|
wxTimeCtrl = wx.lib.timectrl.TimeCtrl
|
||||||
|
13
wxPython/wxPython/lib/wxPlotCanvas.py
Normal file
13
wxPython/wxPython/lib/wxPlotCanvas.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
## This file imports items from the wx package into the wxPython package for
|
||||||
|
## backwards compatibility. Some names will also have a 'wx' added on if
|
||||||
|
## that is how they used to be named in the old wxPython package.
|
||||||
|
|
||||||
|
import wx.lib.wxPlotCanvas
|
||||||
|
|
||||||
|
__doc__ = wx.lib.wxPlotCanvas.__doc__
|
||||||
|
|
||||||
|
PolyPoints = wx.lib.wxPlotCanvas.PolyPoints
|
||||||
|
PolyLine = wx.lib.wxPlotCanvas.PolyLine
|
||||||
|
PolyMarker = wx.lib.wxPlotCanvas.PolyMarker
|
||||||
|
PlotGraphics = wx.lib.wxPlotCanvas.PlotGraphics
|
||||||
|
PlotCanvas = wx.lib.wxPlotCanvas.PlotCanvas
|
Reference in New Issue
Block a user