File: test_propdlg.py

package info (click to toggle)
wxpython4.0 4.2.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 232,540 kB
  • sloc: cpp: 958,937; python: 233,059; ansic: 150,441; makefile: 51,662; sh: 8,687; perl: 1,563; javascript: 584; php: 326; xml: 200
file content (71 lines) | stat: -rw-r--r-- 2,097 bytes parent folder | download | duplicates (4)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import unittest
from unittests import wtc
import wx
import wx.adv

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

class propdlg_Tests(wtc.WidgetTestCase):

    def test_propdlg1(self):
        # Constants
        wx.adv.PROPSHEET_DEFAULT
        wx.adv.PROPSHEET_NOTEBOOK
        wx.adv.PROPSHEET_TOOLBOOK
        wx.adv.PROPSHEET_CHOICEBOOK
        wx.adv.PROPSHEET_LISTBOOK
        wx.adv.PROPSHEET_BUTTONTOOLBOOK
        wx.adv.PROPSHEET_TREEBOOK
        wx.adv.PROPSHEET_SHRINKTOFIT


    def test_propgrid2(self):
        # Normal, simple usage
        dlg = wx.adv.PropertySheetDialog(self.frame, title="Property Sheet")
        dlg.SetSheetStyle(wx.adv.PROPSHEET_NOTEBOOK)
        dlg.Destroy()


    def test_propgrid3(self):
        # 2-Phase create
        dlg = wx.adv.PropertySheetDialog()
        dlg.Create(self.frame, title="Property Sheet")
        dlg.SetSheetStyle(wx.adv.PROPSHEET_NOTEBOOK)
        dlg.Destroy()


    def test_propgrid4(self):
        # Derived class
        class MyPropSheetDlg(wx.adv.PropertySheetDialog):
            def __init__(self, parent, title):
                wx.adv.PropertySheetDialog.__init__(self) # 1st phase

                # Setup
                self.SetSheetStyle(wx.adv.PROPSHEET_NOTEBOOK)
                self.SetSheetInnerBorder(10)
                self.SetSheetOuterBorder(15)

                self.Create(parent, title=title) # 2nd phase create

                # Create the stock buttons
                self.CreateButtons(wx.OK|wx.CANCEL)

                # Add some pages
                notebook = self.GetBookCtrl()
                notebook.AddPage(wx.Panel(notebook), "Page1")
                notebook.AddPage(wx.Panel(notebook), "Page2")

                # Do the layout
                self.LayoutDialog()


        dlg = MyPropSheetDlg(self.frame, "Property Sheet Dlg")
        wx.CallLater(250, dlg.EndModal, wx.ID_OK)
        dlg.ShowModal()
        dlg.Destroy()


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

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