mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-05 11:30:06 +01:00
Add wx.RearrangeList, wx.RearrangeCtrl and wx.RearrangeDialog
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71863 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
1
TODO.txt
1
TODO.txt
@@ -133,7 +133,6 @@ other dev stuff
|
||||
* persist ?
|
||||
* quantize
|
||||
* rawbmp
|
||||
* rearrangectrl
|
||||
* renderer
|
||||
* richmsgdlg
|
||||
* textdlg
|
||||
|
||||
@@ -183,6 +183,7 @@ INCLUDES = [ # base and core stuff
|
||||
'fdrepdlg',
|
||||
'mdi',
|
||||
'fontdlg',
|
||||
'rearrangectrl',
|
||||
|
||||
# misc
|
||||
'power',
|
||||
|
||||
78
etg/rearrangectrl.py
Normal file
78
etg/rearrangectrl.py
Normal file
@@ -0,0 +1,78 @@
|
||||
#---------------------------------------------------------------------------
|
||||
# Name: etg/rearrangectrl.py
|
||||
# Author: Robin Dunn
|
||||
#
|
||||
# Created: 25-Jun-2012
|
||||
# Copyright: (c) 2012 by Total Control Software
|
||||
# License: wxWindows License
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
NAME = "rearrangectrl" # Base name of the file to generate to for this script
|
||||
DOCSTRING = ""
|
||||
|
||||
# The classes and/or the basename of the Doxygen XML files to be processed by
|
||||
# this script.
|
||||
ITEMS = [ "wxRearrangeList",
|
||||
"wxRearrangeCtrl",
|
||||
"wxRearrangeDialog",
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
# Parse the XML file(s) building a collection of Extractor objects
|
||||
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
|
||||
etgtools.parseDoxyXML(module, ITEMS)
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
module.addHeaderCode('#include <wx/rearrangectrl.h>')
|
||||
|
||||
c = module.find('wxRearrangeList')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
tools.fixWindowClass(c)
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
c.find('wxRearrangeList.order').default = 'wxArrayInt()'
|
||||
c.find('wxRearrangeList.items').default = 'wxArrayString()'
|
||||
c.find('Create.order').default = 'wxArrayInt()'
|
||||
c.find('Create.items').default = 'wxArrayString()'
|
||||
|
||||
module.addGlobalStr('wxRearrangeListNameStr', c)
|
||||
module.addGlobalStr('wxRearrangeDialogNameStr', c)
|
||||
|
||||
|
||||
c = module.find('wxRearrangeCtrl')
|
||||
tools.fixWindowClass(c)
|
||||
c.addPrivateCopyCtor()
|
||||
c.find('wxRearrangeCtrl.order').default = 'wxArrayInt()'
|
||||
c.find('wxRearrangeCtrl.items').default = 'wxArrayString()'
|
||||
c.find('Create.order').default = 'wxArrayInt()'
|
||||
c.find('Create.items').default = 'wxArrayString()'
|
||||
|
||||
|
||||
c = module.find('wxRearrangeDialog')
|
||||
tools.fixTopLevelWindowClass(c)
|
||||
c.addPrivateCopyCtor()
|
||||
c.find('wxRearrangeDialog.order').default = 'wxArrayInt()'
|
||||
c.find('wxRearrangeDialog.items').default = 'wxArrayString()'
|
||||
c.find('Create.order').default = 'wxArrayInt()'
|
||||
c.find('Create.items').default = 'wxArrayString()'
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
46
unittests/test_rearrangectrl.py
Normal file
46
unittests/test_rearrangectrl.py
Normal file
@@ -0,0 +1,46 @@
|
||||
import imp_unittest, unittest
|
||||
import wtc
|
||||
import wx
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class rearrangectrl_Tests(wtc.WidgetTestCase):
|
||||
|
||||
def test_rearrangectrl1(self):
|
||||
rl = wx.RearrangeList(self.frame, order=[0,1,2], items=['one', 'two', 'three'])
|
||||
|
||||
order1 = rl.GetCurrentOrder()
|
||||
self.assertTrue(isinstance(order1, list))
|
||||
rl.SetSelection(1)
|
||||
rl.MoveCurrentDown()
|
||||
order2 = rl.GetCurrentOrder()
|
||||
self.assertNotEqual(order1, order2)
|
||||
|
||||
def test_rearrangectrl2(self):
|
||||
rl = wx.RearrangeList()
|
||||
rl.Create(self.frame, order=[1,2,0], items=['one', 'two', 'three'])
|
||||
|
||||
|
||||
def test_rearrangectrl3(self):
|
||||
rc = wx.RearrangeCtrl(self.frame, order=[0,1,2], items=['one', 'two', 'three'])
|
||||
|
||||
def test_rearrangectrl4(self):
|
||||
rc = wx.RearrangeCtrl()
|
||||
rc.Create(self.frame, order=[1,2,0], items=['one', 'two', 'three'])
|
||||
|
||||
|
||||
def test_rearrangectrl5(self):
|
||||
rd = wx.RearrangeDialog(self.frame, 'message', 'title',
|
||||
order=[0,1,2], items=['one', 'two', 'three'])
|
||||
rd.Destroy()
|
||||
|
||||
def test_rearrangectrl6(self):
|
||||
rd = wx.RearrangeDialog()
|
||||
rd.Create(self.frame, 'message', 'title',
|
||||
order=[0,1,2], items=['one', 'two', 'three'])
|
||||
rd.Destroy()
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user