controllers.py
Go to the documentation of this file.
2 
3 class ControllerBase(object):
4  def __init__(self):
5  pass
6 
7 class GroupedCheckStateController(ControllerBase):
8  def __init__(self, server, menu_handler):
9  self._server = server
10  self._menu_handler = menu_handler
11  self._group_list = {}
12 
13  def add_group(self, group, entry):
14  self._group_list[entry] = group
15  self._menu_handler.setCheckState(entry, MenuHandler.UNCHECKED)
16 
17  def update_check_state(self, entry):
18  state = self._menu_handler.getCheckState(entry)
19  if state == MenuHandler.NO_CHECKBOX:
20  return
21  elif state == MenuHandler.CHECKED:
22  self._menu_handler.setCheckState(entry, MenuHandler.UNCHECKED)
23  else: # MenuHandler.UNCHECKED
24  self._menu_handler.setCheckState(entry, MenuHandler.CHECKED)
25  target_gr = self._group_list[entry]
26  for k, v in self._group_list.items():
27  if v == target_gr and k != entry:
28  self._menu_handler.setCheckState(k, MenuHandler.UNCHECKED)
29  self._menu_handler.reApply(self._server)
30  self._server.applyChanges()


ez_interactive_marker
Author(s):
autogenerated on Mon Jun 10 2019 13:15:06