mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2025-07-21 12:41:10 +02: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")
|
||||
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())
|
||||
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
|
||||
buttonData = [
|
||||
("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, ""),
|
||||
("Larger Size", (0, 0, 255), (60, 60), ""),
|
||||
("With a Label", (127, 0, 255), wx.DefaultSize, "Colour..."),
|
||||
|
@@ -112,7 +112,7 @@ class TestPanel(wx.Panel):
|
||||
self.log = log
|
||||
wx.Panel.__init__(self, parent, -1)
|
||||
|
||||
comboCtrl = wx.ComboCtrl(self, wx.ID_ANY, "")
|
||||
comboCtrl = wx.ComboCtrl(self, wx.ID_ANY, "", (20,20))
|
||||
|
||||
popupCtrl = ListCtrlComboPopup()
|
||||
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
import wx
|
||||
import wx.adv
|
||||
from textwrap import dedent
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
@@ -10,14 +11,14 @@ class TestPanel(wx.Panel):
|
||||
self.log = log
|
||||
wx.Panel.__init__(self, parent, -1)
|
||||
|
||||
cmd = wx.adv.CommandLinkButton(self, -1,
|
||||
"wx.CommandLinkButton",
|
||||
"""\
|
||||
This type of button includes both a main label and a 'note' that is meant to
|
||||
contain a description of what the button does or what it is used for. On
|
||||
Windows 7 it is a new native widget type, on the other platforms it is
|
||||
implemented generically.""",
|
||||
pos=(25,25))
|
||||
cmd = wx.adv.CommandLinkButton(self, -1, "wx.CommandLinkButton",
|
||||
dedent("""\
|
||||
This type of button includes both a main label and a 'note' that
|
||||
is meant to contain a description of what the button does or
|
||||
what is used for. On Windows 7 it is a new native widget type,
|
||||
on the other platforms it is implemented generically.
|
||||
"""),
|
||||
pos=(25,25), size=(500,-1))
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
@@ -25,6 +25,7 @@ class TestPanel(wx.Panel):
|
||||
# Init the context help button.
|
||||
# And even include help text about the help button :-)
|
||||
cBtn = wx.ContextHelpButton(self)
|
||||
cBtn.Bind(wx.EVT_BUTTON, self.OnCtxHelpButton)
|
||||
cBtn.SetHelpText("wx.ContextHelpButton")
|
||||
|
||||
cBtnText = wx.StaticText(self, -1,
|
||||
@@ -63,7 +64,6 @@ class TestPanel(wx.Panel):
|
||||
sizer.Add(text)
|
||||
text.Bind(wx.EVT_HELP, self.OnCtxHelp2, text)
|
||||
|
||||
|
||||
border = wx.BoxSizer(wx.VERTICAL)
|
||||
border.Add(sizer, 0, wx.ALL, 25)
|
||||
|
||||
@@ -72,9 +72,16 @@ class TestPanel(wx.Panel):
|
||||
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
|
||||
# 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):
|
||||
self.log.write("OnCtxHelp: %s" % evt)
|
||||
evt.Skip()
|
||||
|
@@ -180,10 +180,10 @@ class ColourSelect(wx.lib.buttons.GenBitmapButton):
|
||||
if label:
|
||||
mdc = wx.MemoryDC(wx.Bitmap(1,1))
|
||||
w, h = mdc.GetTextExtent(label)
|
||||
w += 6
|
||||
h += 6
|
||||
w += 8
|
||||
h += 8
|
||||
else:
|
||||
w, h = 20, 20
|
||||
w, h = 22, 22
|
||||
|
||||
size.width = size.width if size.width != -1 else w
|
||||
size.height = size.height if size.height != -1 else h
|
||||
|
@@ -213,7 +213,7 @@ class BasePopupFrame(wx.Frame):
|
||||
def _layoutInterior(self):
|
||||
frameSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
frameSizer.Add(self._tree, flag=wx.EXPAND, proportion=1)
|
||||
self.SetSizerAndFit(frameSizer)
|
||||
self.SetSizerAndFit(frameSizer) #****
|
||||
|
||||
def _bindEventHandlers(self):
|
||||
self._tree.Bind(wx.EVT_CHAR, self.OnChar)
|
||||
@@ -870,21 +870,6 @@ class MSWComboTreeBox(NativeComboTreeBox):
|
||||
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):
|
||||
"""
|
||||
The ComboTreeBox widget for wxGTK. This is actually a work
|
||||
@@ -917,6 +902,26 @@ class GTKComboTreeBox(BaseComboTreeBox, wx.Panel):
|
||||
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