another merge from WX_2_6_BRANCH

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36730 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2006-01-06 07:05:15 +00:00
parent 2091f5e71a
commit 095315e20d
41 changed files with 3008 additions and 38638 deletions

View File

@@ -53,6 +53,7 @@ class TestWindow(wx.ScrolledWindow):
# Event handlers - moved here so events won't fire before init is
# finished.
self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
self.Bind(wx.EVT_PAINT, self.OnPaint)
self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)

View File

@@ -72,7 +72,7 @@ class TestPanel(wx.Panel):
sizer.Add(message0, 0, wx.ALIGN_CENTER | wx.ALL, 6)
sizer.Add(title2, 0, wx.ALIGN_CENTER | wx.LEFT | wx.TOP | wx.RIGHT, 16)
sizer.Add(message1, 0, wx.ALIGN_CENTER | wx.ALL, 6)
sizer.Add(buttonPanel, 0, wx.EXPAND | wx.LEFT | wx.BOTTOM | wx.RIGHT, 16)
sizer.Add(buttonPanel, 0, wx.EXPAND | wx.ALL, 16)
sizer.Add(title3, 0, wx.ALIGN_CENTER | wx.LEFT | wx.RIGHT, 16)
sizer.Add(message2, 0, wx.ALIGN_CENTER | wx.ALL, 6)
sizer.Add(targetPanel, 2, wx.EXPAND | wx.LEFT | wx.BOTTOM | wx.RIGHT, 16)
@@ -144,6 +144,7 @@ class InnerTile(wx.Window):
"""
def __init__(self, parent, log, factor, thingToWatch=None, bgColor=None):
wx.Window.__init__(self, parent, -1)
self.SetMinSize((20,20))
self.log=log
if bgColor:
self.SetBackgroundColour(bgColor)

View File

@@ -79,7 +79,7 @@ class TestPanel(wx.Panel):
def OnRightClick(self, evt):
self.PopupMenu(self.menu, evt.GetPosition())
self.PopupMenu(self.menu)
def OnFileOpenDialog(self, evt):

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,6 @@
import wx
from wx.lib import stattext
#---------------------------------------------------------------------------
@@ -11,7 +12,8 @@ class TestPanel(wx.Panel):
btn = wx.Button(self, -1, "Select Font")
self.Bind(wx.EVT_BUTTON, self.OnSelectFont, btn)
self.sampleText = wx.TextCtrl(self, -1, "Sample Text")
self.sampleText = stattext.GenStaticText(self, -1, "Sample Text")
self.sampleText.SetBackgroundColour(wx.WHITE)
self.curFont = self.sampleText.GetFont()
self.curClr = wx.BLACK
@@ -69,6 +71,7 @@ class TestPanel(wx.Panel):
def UpdateUI(self):
self.sampleText.SetFont(self.curFont)
self.sampleText.SetForegroundColour(self.curClr)
self.ps.SetLabel(str(self.curFont.GetPointSize()))
self.family.SetLabel(self.curFont.GetFamilyString())
self.style.SetLabel(self.curFont.GetStyleString())

View File

@@ -0,0 +1,130 @@
import wx
#----------------------------------------------------------------------
class TestPanel(wx.Panel):
def __init__(self, parent, log):
self.log = log
wx.Panel.__init__(self, parent, -1)
sizer = wx.BoxSizer(wx.VERTICAL)
self.SetSizer(sizer)
sizer.Add((25,25))
sizer.Add(wx.StaticText(
self, -1,
"Mouse and modifier state can be polled with wx.GetMouseState"),
0, wx.CENTER|wx.ALL, 10)
sizer.Add(wx.StaticLine(self), 0, wx.EXPAND|wx.TOP, 10)
row = wx.BoxSizer(wx.HORIZONTAL)
sizer.Add(row, 0, wx.CENTER)
fgs = wx.FlexGridSizer(cols=2, hgap=5, vgap=10)
row.Add(fgs, 0, wx.ALL, 30)
lbl = wx.StaticText(self, -1, "X pos:")
self.x = wx.StaticText(self, -1, "00000")
fgs.Add(lbl)
fgs.Add(self.x)
lbl = wx.StaticText(self, -1, "Y pos:")
self.y = wx.StaticText(self, -1, "00000")
fgs.Add(lbl)
fgs.Add(self.y)
lbl = wx.StaticText(self, -1, "Left down:")
self.lft = wx.StaticText(self, -1, "False")
fgs.Add(lbl)
fgs.Add(self.lft)
lbl = wx.StaticText(self, -1, "Middle Down:")
self.mid = wx.StaticText(self, -1, "False")
fgs.Add(lbl)
fgs.Add(self.mid)
lbl = wx.StaticText(self, -1, "Right down:")
self.rgt = wx.StaticText(self, -1, "False")
fgs.Add(lbl)
fgs.Add(self.rgt)
fgs = wx.FlexGridSizer(cols=2, hgap=5, vgap=10)
row.Add(fgs, 0, wx.ALL, 30)
lbl = wx.StaticText(self, -1, "Control down:")
self.ctrl = wx.StaticText(self, -1, "False")
fgs.Add(lbl)
fgs.Add(self.ctrl)
lbl = wx.StaticText(self, -1, "Shift down:")
self.shft = wx.StaticText(self, -1, "False")
fgs.Add(lbl)
fgs.Add(self.shft)
lbl = wx.StaticText(self, -1, "Alt down:")
self.alt = wx.StaticText(self, -1, "False")
fgs.Add(lbl)
fgs.Add(self.alt)
lbl = wx.StaticText(self, -1, "Meta down:")
self.meta = wx.StaticText(self, -1, "False")
fgs.Add(lbl)
fgs.Add(self.meta)
lbl = wx.StaticText(self, -1, "Cmd down:")
self.cmd = wx.StaticText(self, -1, "False")
fgs.Add(lbl)
fgs.Add(self.cmd)
self.timer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.OnTimer, self.timer)
self.timer.Start(100)
def OnTimer(self, evt):
ms = wx.GetMouseState()
self.x.SetLabel( str(ms.x) )
self.y.SetLabel( str(ms.y) )
self.lft.SetLabel( str(ms.leftDown) )
self.mid.SetLabel( str(ms.middleDown) )
self.rgt.SetLabel( str(ms.rightDown) )
self.ctrl.SetLabel( str(ms.controlDown) )
self.shft.SetLabel( str(ms.shiftDown) )
self.alt.SetLabel( str(ms.altDown) )
self.meta.SetLabel( str(ms.metaDown) )
self.cmd.SetLabel( str(ms.cmdDown) )
#----------------------------------------------------------------------
def runTest(frame, nb, log):
win = TestPanel(nb, log)
return win
#----------------------------------------------------------------------
overview = """<html><body>
<h2><center>wx.GetMouseState</center></h2>
The mouse and modifier state can be polled with the wx.GetMouseState
function. It returns an instance of a wx.MouseState object that
contains the current position of the mouse pointer in screen
coordinants, as well as boolean values indicating the up/down status
of the mouse buttons and the modifier keys.
</body></html>
"""
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])

View File

@@ -354,7 +354,7 @@ class MegaGrid(Grid.Grid):
self.Bind(wx.EVT_MENU, append, id=appendID)
self.Bind(wx.EVT_MENU, delete, id=deleteID)
self.PopupMenu(menu, (x, yo))
self.PopupMenu(menu)
menu.Destroy()
return
@@ -388,7 +388,7 @@ class MegaGrid(Grid.Grid):
if len(cols) == 1:
self.Bind(wx.EVT_MENU, sort, id=sortID)
self.PopupMenu(menu, (xo, 0))
self.PopupMenu(menu)
menu.Destroy()
return

View File

@@ -95,7 +95,7 @@ class TestPanel(wx.Panel):
ID_MENU_NO = wx.NewId()
menuPopUp.Append(ID_MENU_YES, "Yes, absolutely!")
menuPopUp.Append(ID_MENU_NO, "I've had better")
self.PopupMenu(menuPopUp, self._hyper3.GetPosition())
self.PopupMenu(menuPopUp)
menuPopUp.Destroy()

View File

@@ -75,8 +75,8 @@ class TestListBox(wx.Panel):
'twelve', 'thirteen', 'fourteen']
wx.StaticText(self, -1, "This example uses the wx.ListBox control.", (45, 10))
wx.StaticText(self, -1, "Select one:", (15, 50), (65, 18))
self.lb1 = wx.ListBox(self, 60, (80, 50), (90, 120), sampleList, wx.LB_SINGLE)
wx.StaticText(self, -1, "Select one:", (15, 50))
self.lb1 = wx.ListBox(self, 60, (100, 50), (90, 120), sampleList, wx.LB_SINGLE)
self.Bind(wx.EVT_LISTBOX, self.EvtListBox, self.lb1)
self.Bind(wx.EVT_LISTBOX_DCLICK, self.EvtListBoxDClick, self.lb1)
self.lb1.Bind(wx.EVT_RIGHT_UP, self.EvtRightButton)
@@ -85,8 +85,8 @@ class TestListBox(wx.Panel):
self.lb1.SetClientData(2, "This one has data");
wx.StaticText(self, -1, "Select many:", (200, 50), (65, 18))
self.lb2 = wx.ListBox(self, 70, (300, 50), (90, 120), sampleList, wx.LB_EXTENDED)
wx.StaticText(self, -1, "Select many:", (220, 50))
self.lb2 = wx.ListBox(self, 70, (320, 50), (90, 120), sampleList, wx.LB_EXTENDED)
self.Bind(wx.EVT_LISTBOX, self.EvtMultiListBox, self.lb2)
self.lb2.Bind(wx.EVT_RIGHT_UP, self.EvtRightButton)
self.lb2.SetSelection(0)
@@ -96,7 +96,7 @@ class TestListBox(wx.Panel):
'test abcd' ]
sampleList.sort()
wx.StaticText(self, -1, "Find Prefix:", (15, 250))
fp = FindPrefixListBox(self, -1, (80, 250), (90, 120), sampleList, wx.LB_SINGLE)
fp = FindPrefixListBox(self, -1, (100, 250), (90, 120), sampleList, wx.LB_SINGLE)
fp.SetSelection(0)

View File

@@ -200,10 +200,10 @@ class TestListCtrlPanel(wx.Panel, listmix.ColumnSorterMixin):
def OnRightDown(self, event):
self.x = event.GetX()
self.y = event.GetY()
self.log.WriteText("x, y = %s\n" % str((self.x, self.y)))
item, flags = self.list.HitTest((self.x, self.y))
x = event.GetX()
y = event.GetY()
self.log.WriteText("x, y = %s\n" % str((x, y)))
item, flags = self.list.HitTest((x, y))
if flags & wx.LIST_HITTEST_ONITEM:
self.list.Select(item)
@@ -313,7 +313,7 @@ class TestListCtrlPanel(wx.Panel, listmix.ColumnSorterMixin):
# Popup the menu. If an item is selected then its handler
# will be called before PopupMenu returns.
self.PopupMenu(menu, (self.x, self.y))
self.PopupMenu(menu)
menu.Destroy()

View File

@@ -28,12 +28,22 @@ class TestPanel(wx.Panel):
# some problems related to having regular frames and MDI frames in
# the same app.
def ShowMDIDemo(self, evt):
os.spawnl(os.P_NOWAIT, sys.executable, sys.executable, "MDIDemo.py")
exe, spawn = self.GetPyExecutable()
spawn(os.P_NOWAIT, exe, exe, "MDIDemo.py")
def ShowMDISashDemo(self, evt):
os.spawnl(os.P_NOWAIT, sys.executable, sys.executable, "MDISashDemo.py")
exe, spawn = self.GetPyExecutable()
spawn(os.P_NOWAIT, exe, exe, "MDISashDemo.py")
def GetPyExecutable(self):
if 'wxMac' in wx.PlatformInfo:
# sys.executable will be wrong if running the demo from
# an app bundle. Just find pythonw on the path instead.
return 'pythonw' + sys.version[:3], os.spawnlp
else:
return sys.executable, os.spawnl
#----------------------------------------------------------------------
def runTest(frame, nb, log):

View File

@@ -52,6 +52,7 @@ _treeList = [
'HyperLinkCtrl',
'MultiSplitterWindow',
'Throbber',
'GetMouseState',
]),
# managed windows == things with a (optional) caption you can close
@@ -82,7 +83,6 @@ _treeList = [
# dialogs from libraries
('More Dialogs', [
'ImageBrowser',
'MultipleChoiceDialog',
'ScrolledMessageDialog',
]),

View File

@@ -3,8 +3,6 @@ import wx
import wx.media
import os
from Main import opj
#----------------------------------------------------------------------
class TestPanel(wx.Panel):
@@ -34,6 +32,7 @@ class TestPanel(wx.Panel):
slider = wx.Slider(self, -1, 0, 0, 0)
self.slider = slider
slider.SetMinSize((150, -1))
self.Bind(wx.EVT_SLIDER, self.OnSeek, slider)
self.st_size = wx.StaticText(self, -1, size=(100,-1))
@@ -54,7 +53,7 @@ class TestPanel(wx.Panel):
sizer.Add(self.st_pos, (3, 5))
self.SetSizer(sizer)
self.DoLoadFile(opj("data/testmovie.mpg"))
self.DoLoadFile(os.path.abspath("data/testmovie.mpg"))
self.mc.Stop()
self.timer = wx.Timer(self)
@@ -81,8 +80,8 @@ class TestPanel(wx.Panel):
else:
self.mc.SetBestFittingSize()
self.GetSizer().Layout()
self.slider.SetRange(0, self.mc.Length())
self.mc.Play()
self.slider.SetRange(0, self.mc.Length())
def OnPlay(self, evt):

View File

@@ -97,7 +97,7 @@ class TestPanel(wx.Panel):
# Popup the menu. If an item is selected then its handler
# will be called before PopupMenu returns.
self.PopupMenu(menu, event.GetPosition())
self.PopupMenu(menu)
menu.Destroy()

View File

@@ -36,6 +36,8 @@ class TestToolBar(wx.Frame):
open_bmp = wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN, wx.ART_TOOLBAR, tsize)
copy_bmp = wx.ArtProvider.GetBitmap(wx.ART_COPY, wx.ART_TOOLBAR, tsize)
paste_bmp= wx.ArtProvider.GetBitmap(wx.ART_PASTE, wx.ART_TOOLBAR, tsize)
tb.SetToolBitmapSize(tsize)
tb.AddSimpleTool(10, new_bmp, "New", "Long help for 'New'")
#tb.AddLabelTool(10, "New", new_bmp, shortHelp="New", longHelp="Long help for 'New'")

File diff suppressed because it is too large Load Diff