mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-04 19:10:09 +01:00
More demo tweaks and fixes
This commit is contained in:
@@ -36,7 +36,7 @@ class TestColourSelect(wx.Panel):
|
|||||||
"and wxColourDialog Classes. Click Button to get Colour Values")
|
"and wxColourDialog Classes. Click Button to get Colour Values")
|
||||||
mainSizer.Add(t, 0, wx.ALL, 3)
|
mainSizer.Add(t, 0, wx.ALL, 3)
|
||||||
|
|
||||||
b = wx.Button(self, -1, "Show All Colours")
|
b = wx.Button(self, -1, "Log All Current Colours")
|
||||||
self.Bind(wx.EVT_BUTTON, self.OnShowAll, id=b.GetId())
|
self.Bind(wx.EVT_BUTTON, self.OnShowAll, id=b.GetId())
|
||||||
mainSizer.Add(b, 0, wx.ALL, 3)
|
mainSizer.Add(b, 0, wx.ALL, 3)
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ class TestColourSelect(wx.Panel):
|
|||||||
# build several examples of buttons with different colours and sizes
|
# build several examples of buttons with different colours and sizes
|
||||||
buttonData = [
|
buttonData = [
|
||||||
("Default Size", (255, 255, 0), wx.DefaultSize, ""),
|
("Default Size", (255, 255, 0), wx.DefaultSize, ""),
|
||||||
("Another Size", (255, 0, 255), (60, 20), ""),
|
("Another Size", (255, 0, 255), (60, 22), ""),
|
||||||
("Another Colour", (0, 255, 0), wx.DefaultSize, ""),
|
("Another Colour", (0, 255, 0), wx.DefaultSize, ""),
|
||||||
("Larger Size", (0, 0, 255), (60, 60), ""),
|
("Larger Size", (0, 0, 255), (60, 60), ""),
|
||||||
("With a Label", (127, 0, 255), wx.DefaultSize, "Colour..."),
|
("With a Label", (127, 0, 255), wx.DefaultSize, "Colour..."),
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ class TestPanel(wx.Panel):
|
|||||||
self.log = log
|
self.log = log
|
||||||
wx.Panel.__init__(self, parent, -1)
|
wx.Panel.__init__(self, parent, -1)
|
||||||
|
|
||||||
comboCtrl = wx.ComboCtrl(self, wx.ID_ANY, "")
|
comboCtrl = wx.ComboCtrl(self, wx.ID_ANY, "", (20,20))
|
||||||
|
|
||||||
popupCtrl = ListCtrlComboPopup()
|
popupCtrl = ListCtrlComboPopup()
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import wx
|
import wx
|
||||||
import wx.adv
|
import wx.adv
|
||||||
|
from textwrap import dedent
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -10,14 +11,14 @@ class TestPanel(wx.Panel):
|
|||||||
self.log = log
|
self.log = log
|
||||||
wx.Panel.__init__(self, parent, -1)
|
wx.Panel.__init__(self, parent, -1)
|
||||||
|
|
||||||
cmd = wx.adv.CommandLinkButton(self, -1,
|
cmd = wx.adv.CommandLinkButton(self, -1, "wx.CommandLinkButton",
|
||||||
"wx.CommandLinkButton",
|
dedent("""\
|
||||||
"""\
|
This type of button includes both a main label and a 'note' that
|
||||||
This type of button includes both a main label and a 'note' that is meant to
|
is meant to contain a description of what the button does or
|
||||||
contain a description of what the button does or what it is used for. On
|
what is used for. On Windows 7 it is a new native widget type,
|
||||||
Windows 7 it is a new native widget type, on the other platforms it is
|
on the other platforms it is implemented generically.
|
||||||
implemented generically.""",
|
"""),
|
||||||
pos=(25,25))
|
pos=(25,25), size=(500,-1))
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ class TestPanel(wx.Panel):
|
|||||||
# Init the context help button.
|
# Init the context help button.
|
||||||
# And even include help text about the help button :-)
|
# And even include help text about the help button :-)
|
||||||
cBtn = wx.ContextHelpButton(self)
|
cBtn = wx.ContextHelpButton(self)
|
||||||
|
cBtn.Bind(wx.EVT_BUTTON, self.OnCtxHelpButton)
|
||||||
cBtn.SetHelpText("wx.ContextHelpButton")
|
cBtn.SetHelpText("wx.ContextHelpButton")
|
||||||
|
|
||||||
cBtnText = wx.StaticText(self, -1,
|
cBtnText = wx.StaticText(self, -1,
|
||||||
@@ -63,7 +64,6 @@ class TestPanel(wx.Panel):
|
|||||||
sizer.Add(text)
|
sizer.Add(text)
|
||||||
text.Bind(wx.EVT_HELP, self.OnCtxHelp2, text)
|
text.Bind(wx.EVT_HELP, self.OnCtxHelp2, text)
|
||||||
|
|
||||||
|
|
||||||
border = wx.BoxSizer(wx.VERTICAL)
|
border = wx.BoxSizer(wx.VERTICAL)
|
||||||
border.Add(sizer, 0, wx.ALL, 25)
|
border.Add(sizer, 0, wx.ALL, 25)
|
||||||
|
|
||||||
@@ -72,9 +72,16 @@ class TestPanel(wx.Panel):
|
|||||||
self.Layout()
|
self.Layout()
|
||||||
|
|
||||||
|
|
||||||
|
def OnCtxHelpButton(self, evt):
|
||||||
|
# This starts a nested event loop which exits when an item has been
|
||||||
|
# clicked on, its help message shown and dismissed.
|
||||||
|
cshelp = wx.ContextHelp(self)
|
||||||
|
|
||||||
|
|
||||||
# On the second text control above, we intercept the help event. This is where
|
# On the second text control above, we intercept the help event. This is where
|
||||||
# we process it. Anything could happen here. In this case we're just printing
|
# we process it. Anything could happen here. In this case we're just printing
|
||||||
# some stuff about it, then passing it on, at which point we see the help tip.
|
# some stuff about it, then passing it on with Skip(), at which point we
|
||||||
|
# see the help tip.
|
||||||
def OnCtxHelp(self, evt):
|
def OnCtxHelp(self, evt):
|
||||||
self.log.write("OnCtxHelp: %s" % evt)
|
self.log.write("OnCtxHelp: %s" % evt)
|
||||||
evt.Skip()
|
evt.Skip()
|
||||||
|
|||||||
@@ -180,10 +180,10 @@ class ColourSelect(wx.lib.buttons.GenBitmapButton):
|
|||||||
if label:
|
if label:
|
||||||
mdc = wx.MemoryDC(wx.Bitmap(1,1))
|
mdc = wx.MemoryDC(wx.Bitmap(1,1))
|
||||||
w, h = mdc.GetTextExtent(label)
|
w, h = mdc.GetTextExtent(label)
|
||||||
w += 6
|
w += 8
|
||||||
h += 6
|
h += 8
|
||||||
else:
|
else:
|
||||||
w, h = 20, 20
|
w, h = 22, 22
|
||||||
|
|
||||||
size.width = size.width if size.width != -1 else w
|
size.width = size.width if size.width != -1 else w
|
||||||
size.height = size.height if size.height != -1 else h
|
size.height = size.height if size.height != -1 else h
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ class BasePopupFrame(wx.Frame):
|
|||||||
def _layoutInterior(self):
|
def _layoutInterior(self):
|
||||||
frameSizer = wx.BoxSizer(wx.HORIZONTAL)
|
frameSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
frameSizer.Add(self._tree, flag=wx.EXPAND, proportion=1)
|
frameSizer.Add(self._tree, flag=wx.EXPAND, proportion=1)
|
||||||
self.SetSizerAndFit(frameSizer)
|
self.SetSizerAndFit(frameSizer) #****
|
||||||
|
|
||||||
def _bindEventHandlers(self):
|
def _bindEventHandlers(self):
|
||||||
self._tree.Bind(wx.EVT_CHAR, self.OnChar)
|
self._tree.Bind(wx.EVT_CHAR, self.OnChar)
|
||||||
@@ -870,21 +870,6 @@ class MSWComboTreeBox(NativeComboTreeBox):
|
|||||||
super(MSWComboTreeBox, self).NotifyNoItemSelected(*args, **kwargs)
|
super(MSWComboTreeBox, self).NotifyNoItemSelected(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class MACComboTreeBox(NativeComboTreeBox):
|
|
||||||
def _createPopupFrame(self):
|
|
||||||
return MACPopupFrame(self)
|
|
||||||
|
|
||||||
def _createButton(self):
|
|
||||||
return self.GetChildren()[0] # The choice button
|
|
||||||
|
|
||||||
def _keyShouldNavigate(self, keyEvent):
|
|
||||||
return False # No navigation with up and down on wxMac
|
|
||||||
|
|
||||||
def _keyShouldPopUpTree(self, keyEvent):
|
|
||||||
return super(MACComboTreeBox, self)._keyShouldPopUpTree(keyEvent) or \
|
|
||||||
keyEvent.GetKeyCode() == wx.WXK_DOWN
|
|
||||||
|
|
||||||
|
|
||||||
class GTKComboTreeBox(BaseComboTreeBox, wx.Panel):
|
class GTKComboTreeBox(BaseComboTreeBox, wx.Panel):
|
||||||
"""
|
"""
|
||||||
The ComboTreeBox widget for wxGTK. This is actually a work
|
The ComboTreeBox widget for wxGTK. This is actually a work
|
||||||
@@ -917,6 +902,26 @@ class GTKComboTreeBox(BaseComboTreeBox, wx.Panel):
|
|||||||
self.SetSizerAndFit(panelSizer)
|
self.SetSizerAndFit(panelSizer)
|
||||||
|
|
||||||
|
|
||||||
|
# class MACComboTreeBox(NativeComboTreeBox):
|
||||||
|
# def _createPopupFrame(self):
|
||||||
|
# return MACPopupFrame(self)
|
||||||
|
#
|
||||||
|
# def _createButton(self):
|
||||||
|
# return self.GetChildren()[0] # The choice button
|
||||||
|
#
|
||||||
|
# def _keyShouldNavigate(self, keyEvent):
|
||||||
|
# return False # No navigation with up and down on wxMac
|
||||||
|
#
|
||||||
|
# def _keyShouldPopUpTree(self, keyEvent):
|
||||||
|
# return super(MACComboTreeBox, self)._keyShouldPopUpTree(keyEvent) or \
|
||||||
|
# keyEvent.GetKeyCode() == wx.WXK_DOWN
|
||||||
|
|
||||||
|
|
||||||
|
# The MAC implementation based on the NativeComboTreeBox is no longer working,
|
||||||
|
# so let's use the GTKComboTreeBox instead.
|
||||||
|
MACComboTreeBox = GTKComboTreeBox
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user