def startMonitor():
  camera = Camera()
  actionDict = ActionDict(camera)
  config = Config(
    actionDict,
    getButtons().keys(),
    getClickTypes())
  camera.setConfig(config)

  config.checkConfigFile()

  app = QApplication([])
  camera.initCamera()
  keys = QmKeys()
  buttonTimers = dict()
  for b in getButtons().values():
    buttonTimers[b] = ClickTimer(b, config)
  keys.keyEvent.connect(lambda k, s:
    (k in buttonTimers and buttonTimers[k].keyEvent(s)))
  config.dbusButton.setHandler(
    lambda button: dbusBtnClicked(config, button))
  config.dbusButton.connectButtonDbus()
  config.proximityButton.setHandler(
    lambda state: prxBtnClicked(config, state))
  config.proximityButton.connectProximityButton()
  app.exec_()
Example #2
0
  def __init__(self, actionDict):
    self.actionDict = actionDict

    self.buttonBox = self.makeComboBox(getButtons().keys())
    self.buttonParamBox = QLineEdit()
    self.clickTypeBox = self.makeComboBox(getClickTypes())
    self.actionNameBox = self.makeComboBox(
      self.actionDict.getActionLambdaDict().keys())
    self.actionParamBox = QLineEdit()
    self.conditionNameBox = self.makeComboBox(
      self.actionDict.getConditionLambdaDict().keys())
    self.conditionParamBox = QLineEdit()

    self.connectComboBox(self.buttonBox, self.setButtonIndex)
    self.connectComboBox(self.clickTypeBox, self.setClickTypeIndex)
    self.connectComboBox(self.actionNameBox, self.setActionNameIndex)
    self.connectComboBox(self.conditionNameBox, self.setConditionNameIndex)

    self.setButtonIndex(0)
    self.setClickTypeIndex(0)
    self.setActionNameIndex(0)
    self.setConditionNameIndex(0)
Example #3
0
 def __init__(self):
   self.actionDict = ActionDict(None)
   self.config = Config(self.actionDict, getButtons().keys(), getClickTypes())
   self.configPanel = ConfigPanel(self.actionDict)