MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / __init__

Method __init__

gui/preferenceDialog.py:29–80  ·  view source on GitHub ↗
(self, parent)

Source from the content-addressed store, hash-verified

27class PreferenceDialog(wx.Dialog):
28
29 def __init__(self, parent):
30 super().__init__(parent, id=wx.ID_ANY, size=wx.DefaultSize, style=wx.DEFAULT_DIALOG_STYLE)
31 self.SetTitle("pyfa - " + _t("Preferences"))
32 i = wx.Icon(BitmapLoader.getBitmap("preferences_small", "gui"))
33 self.SetIcon(i)
34 mainSizer = wx.BoxSizer(wx.VERTICAL)
35
36 self.listbook = wx.Listbook(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LB_DEFAULT)
37
38 self.listview = self.listbook.GetListView()
39 # self.listview.SetMinSize((500, -1))
40 # self.listview.SetSize((500, -1))
41
42 self.imageList = wx.ImageList(32, 32)
43 self.listbook.AssignImageList(self.imageList)
44
45 mainSizer.Add(self.listbook, 1, wx.EXPAND | wx.TOP | wx.BOTTOM | wx.LEFT, 5)
46
47 self.m_staticline2 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL)
48 mainSizer.Add(self.m_staticline2, 0, wx.EXPAND, 5)
49
50 btnSizer = wx.BoxSizer(wx.HORIZONTAL)
51 btnSizer.AddStretchSpacer()
52 # localization todo: "OK" button shoudl be a built in thing that is already localized...
53 self.btnOK = wx.Button(self, wx.ID_ANY, "OK", wx.DefaultPosition, wx.DefaultSize, 0)
54 btnSizer.Add(self.btnOK, 0, wx.ALL, 5)
55 mainSizer.Add(btnSizer, 0, wx.EXPAND, 5)
56 self.SetSizer(mainSizer)
57
58 self.Centre(wx.BOTH)
59
60 for prefView in PreferenceView.views:
61 page = wx.ScrolledWindow(self.listbook)
62 page.SetScrollRate(15, 15)
63 bmp = prefView.getImage()
64 if bmp:
65 imgID = self.imageList.Add(bmp)
66 else:
67 imgID = -1
68 prefView.populatePanel(page)
69
70 self.listbook.AddPage(page, prefView.title, imageId=imgID)
71
72 bestFit = self.GetBestVirtualSize()
73 width = max(bestFit[0], 800 if "wxGTK" in wx.PlatformInfo else 650)
74 height = max(bestFit[1], 550)
75 self.SetSize(width, height)
76
77 self.Layout()
78
79 self.Bind(wx.EVT_CHAR_HOOK, self.kbEvent)
80 self.btnOK.Bind(wx.EVT_BUTTON, self.OnBtnOK)
81
82 def OnBtnOK(self, event):
83 self.Close()

Callers

nothing calls this directly

Calls 6

SetSizeMethod · 0.80
_tFunction · 0.50
getBitmapMethod · 0.45
getImageMethod · 0.45
populatePanelMethod · 0.45
AddPageMethod · 0.45

Tested by

no test coverage detected