Beispiel #1
0
 def ToggleSolenoid(self, button: 'SolenoidButton'):
     index = self._solenoidButtons.index(button)
     AppGlobals.Rig().SetSolenoidState(
         self.device.startNumber + index,
         not AppGlobals.Rig().GetSolenoidState(self.device.startNumber +
                                               index))
     AppGlobals.Rig().FlushStates()
     self.Update()
Beispiel #2
0
 def closeEvent(self, event):
     if not self.CloseChip():
         event.ignore()
         return
     self.updateWorker.terminate()
     AppGlobals.Rig().SaveDevices()
     super().closeEvent(event)
Beispiel #3
0
    def UpdateList(self):
        for item in self._deviceItems:
            item.deleteLater()
        self._deviceItems = []
        for device in AppGlobals.Rig().savedDevices:
            if device.IsDeviceAvailable() and \
                    device not in [deviceItem.device for deviceItem in self._deviceItems]:
                newItem = DeviceItem(device)
                newItem.numberChanged.connect(self.SortList)
                self._deviceItems.append(newItem)
                self._deviceLayout.addWidget(newItem)

        self.SortList()
Beispiel #4
0
    def Update(self):
        text = self._valve.name + "\n(" + str(self._valve.solenoidNumber) + ")"
        if text != self.valveToggleButton.text():
            self.valveToggleButton.setText(text)

        lastState = self.valveToggleButton.property("valveState")
        newState = {
            True: "OPEN",
            False: "CLOSED"
        }[AppGlobals.Rig().GetSolenoidState(self._valve.solenoidNumber)]
        if lastState != newState:
            self.valveToggleButton.setProperty("valveState", newState)
            self.valveToggleButton.setStyle(self.valveToggleButton.style())
Beispiel #5
0
 def Rescan(self):
     AppGlobals.Rig().Rescan()
     self.UpdateList()
Beispiel #6
0
 def UpdateValveState(self):
     self._solenoidButton.setChecked(AppGlobals.Rig().GetSolenoidState(
         self._number))
Beispiel #7
0
 def TogglePolarity(self, button: 'SolenoidButton'):
     index = self._solenoidButtons.index(button)
     self.device.solenoidPolarities[
         index] = not self.device.solenoidPolarities[index]
     AppGlobals.Rig().FlushStates()
     self.Update()
Beispiel #8
0
 def Toggle(self):
     AppGlobals.Rig().SetSolenoidState(
         self._valve.solenoidNumber,
         not AppGlobals.Rig().GetSolenoidState(self._valve.solenoidNumber),
         True)