-
Notifications
You must be signed in to change notification settings - Fork 439
Expand file tree
/
Copy pathinsuranceOptions.py
More file actions
46 lines (34 loc) · 1.41 KB
/
insuranceOptions.py
File metadata and controls
46 lines (34 loc) · 1.41 KB
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
import wx
import gui.mainFrame
from gui.contextMenu import ContextMenu
from service.settings import InsuranceMenuSettings
class InsuranceOptions(ContextMenu):
def __init__(self):
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
self.settings = InsuranceMenuSettings.getInstance()
self.optionList = ["Cost", "Payout", "Difference"]
def display(self, srcContext, selection):
return srcContext in ("insuranceViewFull")
def getText(self, itmContext, selection):
return "Column Display (Requires Restart)"
def addOption(self, menu, option):
label = option
id = ContextMenu.nextID()
self.optionIds[id] = option
menuItem = wx.MenuItem(menu, id, label, kind=wx.ITEM_CHECK)
menu.Bind(wx.EVT_MENU, self.handleMode, menuItem)
return menuItem
def getSubMenu(self, context, selection, rootMenu, i, pitem):
msw = True if "wxMSW" in wx.PlatformInfo else False
self.context = context
self.optionIds = {}
sub = wx.Menu()
for option in self.optionList:
menuItem = self.addOption(rootMenu if msw else sub, option)
sub.Append(menuItem)
menuItem.Check(self.settings.get(option.lower()))
return sub
def handleMode(self, event):
option = self.optionIds[event.Id]
self.settings.set(option.lower(), event.Int)
InsuranceOptions.register()