File: test_preferences.py

package info (click to toggle)
wxpython4.0 4.2.3%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 221,752 kB
  • sloc: cpp: 962,555; python: 230,573; ansic: 170,731; makefile: 51,756; sh: 9,342; perl: 1,564; javascript: 584; php: 326; xml: 200
file content (42 lines) | stat: -rw-r--r-- 1,356 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import unittest
from unittests import wtc
import wx

#---------------------------------------------------------------------------

class preferences_Tests(wtc.WidgetTestCase):

    def test_preferences1(self):

        class MyPrefsPanel(wx.Panel):
            def __init__(self, parent):
                wx.Panel.__init__(self, parent)
                cb1 = wx.CheckBox(self, -1, "Option 1")
                cb2 = wx.CheckBox(self, -1, "Option 2")
                box = wx.BoxSizer(wx.VERTICAL)
                box.Add(cb1, 0, wx.ALL, 5)
                box.Add(cb2, 0, wx.ALL, 5)
                self.Sizer = wx.BoxSizer()
                self.Sizer.Add(box, 0, wx.ALL, 10)

        class MyPrefsPage(wx.PreferencesPage):
            def GetName(self):
                return 'MyPrefsPage'
            def GetIcon(self):
                return wx.ArtProvider.GetBitmapBundle(wx.ART_HELP, wx.ART_TOOLBAR)
            def CreateWindow(self, parent):
                return MyPrefsPanel(parent)

        prefEd = wx.PreferencesEditor()
        page1 = MyPrefsPage()
        page2 = MyPrefsPage()
        prefEd.AddPage(page1)
        prefEd.AddPage(page2)
        wx.CallLater(250, prefEd.Dismiss)
        prefEd.Show(self.frame)


#---------------------------------------------------------------------------

if __name__ == '__main__':
    unittest.main()