class SystemPowerWidget(ScreenWithBackButton): def __init__(self, controller, mainWindow): self.controller = controller ScreenWithBackButton.__init__(self, "System Power", mainWindow) def makeContent(self): buttons = QHBoxLayout() self.btnOff = SvgButton(":icons/lightbulb_off", 128, 128) self.btnOff.setText("Off") self.btnOff.setToolButtonStyle( Qt.ToolButtonStyle.ToolButtonTextBesideIcon) self.btnOff.clicked.connect(self.powerOff) buttons.addWidget(self.btnOff) self.btnOn = SvgButton(":icons/lightbulb_on", 128, 128) self.btnOn.setText("On") self.btnOn.setToolButtonStyle( Qt.ToolButtonStyle.ToolButtonTextBesideIcon) self.btnOn.clicked.connect(self.powerOn) buttons.addWidget(self.btnOn) return buttons @handlePyroErrors def powerOn(self): self.controller.sequence( BroadcastEvent(MessageTypes.SHOW_POWER_ON, "Client", None), LogEvent(logging.INFO, "Turning system power on"), DeviceEvent("Power", "on", 1), SleepEvent(3), DeviceEvent("Power", "on", 2), SleepEvent(3), DeviceEvent("Power", "on", 3), SleepEvent(3), DeviceEvent("Power", "on", 4), ControllerEvent( "initialise" ), # By this time all things we care about to initialise will have been switched on BroadcastEvent(MessageTypes.HIDE_POWER, "Client", None), LogEvent(logging.INFO, "Power on sequence complete")) @handlePyroErrors def powerOff(self): self.controller.sequence( BroadcastEvent(MessageTypes.SHOW_POWER_OFF, "Client", None), LogEvent(logging.INFO, "Turning system power off"), CompositeEvent( *map(lambda deviceID: DeviceEvent(deviceID, "deinitialise"), [ d for d in _DEVICES_TO_DEINITIALISE if self.controller.hasDevice(d) ])), DeviceEvent("Power", "off", 4), SleepEvent(3), DeviceEvent("Power", "off", 3), SleepEvent(3), DeviceEvent("Power", "off", 2), SleepEvent(3), DeviceEvent("Power", "off", 1), BroadcastEvent(MessageTypes.HIDE_POWER, "Client", None), LogEvent(logging.INFO, "Power off sequence complete"))
def makeContent(self): buttons = QHBoxLayout() self.btnOff = SvgButton(":icons/lightbulb_off", 128, 128) self.btnOff.setText("Off") self.btnOff.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon) self.btnOff.clicked.connect(self.powerOff) buttons.addWidget(self.btnOff) self.btnOn = SvgButton(":icons/lightbulb_on", 128, 128) self.btnOn.setText("On") self.btnOn.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon) self.btnOn.clicked.connect(self.powerOn) buttons.addWidget(self.btnOn) return buttons
class SystemPowerWidget(ScreenWithBackButton): def __init__(self, controller, mainWindow): self.controller = controller ScreenWithBackButton.__init__(self, "System Power", mainWindow) def makeContent(self): buttons = QHBoxLayout() self.btnOff = SvgButton(":icons/lightbulb_off", 128, 128) self.btnOff.setText("Off") self.btnOff.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon) self.btnOff.clicked.connect(self.powerOff) buttons.addWidget(self.btnOff) self.btnOn = SvgButton(":icons/lightbulb_on", 128, 128) self.btnOn.setText("On") self.btnOn.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon) self.btnOn.clicked.connect(self.powerOn) buttons.addWidget(self.btnOn) return buttons @handlePyroErrors def powerOn(self): self.controller.sequence( ControllerEvent("showPowerOnDialogOnClients"), LogEvent(logging.INFO, "Turning system power on"), DeviceEvent("Power", "on", 1), SleepEvent(3), DeviceEvent("Power", "on", 2), SleepEvent(3), DeviceEvent("Power", "on", 3), SleepEvent(3), DeviceEvent("Power", "on", 4), ControllerEvent("initialise"), # By this time all things we care about to initialise will have been switched on ControllerEvent("hidePowerDialogOnClients"), LogEvent(logging.INFO, "Power on sequence complete") ) @handlePyroErrors def powerOff(self): self.controller.sequence( ControllerEvent("showPowerOffDialogOnClients"), LogEvent(logging.INFO, "Turning system power off"), DeviceEvent("Power", "off", 4), SleepEvent(3), DeviceEvent("Power", "off", 3), SleepEvent(3), DeviceEvent("Power", "off", 2), SleepEvent(3), DeviceEvent("Power", "off", 1), ControllerEvent("hidePowerDialogOnClients"), LogEvent(logging.INFO, "Power off sequence complete") )
def makeContent(self): buttons = QHBoxLayout() self.btnOff = SvgButton(":icons/lightbulb_off", 128, 128) self.btnOff.setText("Off") self.btnOff.setToolButtonStyle( Qt.ToolButtonStyle.ToolButtonTextBesideIcon) self.btnOff.clicked.connect(self.powerOff) buttons.addWidget(self.btnOff) self.btnOn = SvgButton(":icons/lightbulb_on", 128, 128) self.btnOn.setText("On") self.btnOn.setToolButtonStyle( Qt.ToolButtonStyle.ToolButtonTextBesideIcon) self.btnOn.clicked.connect(self.powerOn) buttons.addWidget(self.btnOn) return buttons
def makeContent(self): layout = QGridLayout() self.blinds = QButtonGroup() for i in range(1, 7): btn = IDedButton(i) btn.setText(str(i)) layout.addWidget(btn, 0, i - 1) btn.setCheckable(True) self.blinds.addButton(btn, i) btnAll = IDedButton(0) btnAll.setText("All") layout.addWidget(btnAll, 0, 6) btnAll.setCheckable(True) btnAll.setChecked(True) self.blinds.addButton(btnAll, 0) btnRaise = SvgButton(":icons/go-up", 96, 96) btnRaise.setText("Raise") btnRaise.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon) layout.addWidget(btnRaise, 1, 1, 1, 3) btnRaise.clicked.connect(self.raiseUp) btnLower = SvgButton(":icons/go-down", 96, 96) btnLower.setText("Lower") btnLower.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon) layout.addWidget(btnLower, 2, 1, 1, 3) btnLower.clicked.connect(self.lowerDown) btnStop = SvgButton(":icons/process-stop", 96, 96) btnStop.setText("Stop") btnStop.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextUnderIcon) layout.addWidget(btnStop, 1, 4, 2, 2) btnStop.clicked.connect(self.stop) return layout
def makeContent(self): layout = QGridLayout() self.blinds = QButtonGroup() for i in range(1, 7): btn = IDedButton(i) btn.setText(str(i)) layout.addWidget(btn, 0, i - 1) btn.setCheckable(True) self.blinds.addButton(btn, i) btnAll = IDedButton(0) btnAll.setText("All") layout.addWidget(btnAll, 0, 6) btnAll.setCheckable(True) btnAll.setChecked(True) self.blinds.addButton(btnAll, 0) btnRaise = SvgButton(":icons/go-up", 96, 96) btnRaise.setText("Raise") btnRaise.setToolButtonStyle( Qt.ToolButtonStyle.ToolButtonTextBesideIcon) layout.addWidget(btnRaise, 1, 1, 1, 3) btnRaise.clicked.connect(self.raiseUp) btnLower = SvgButton(":icons/go-down", 96, 96) btnLower.setText("Lower") btnLower.setToolButtonStyle( Qt.ToolButtonStyle.ToolButtonTextBesideIcon) layout.addWidget(btnLower, 2, 1, 1, 3) btnLower.clicked.connect(self.lowerDown) btnStop = SvgButton(":icons/process-stop", 96, 96) btnStop.setText("Stop") btnStop.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextUnderIcon) layout.addWidget(btnStop, 1, 4, 2, 2) btnStop.clicked.connect(self.stop) return layout
def makeContent(self): layout = QGridLayout() self.screens = QButtonGroup() btnLeft = IDedButton(1) btnLeft.setText("Left") layout.addWidget(btnLeft, 1, 0, 1, 2) btnLeft.setCheckable(True) self.screens.addButton(btnLeft, 1) btnAll = IDedButton(0) btnAll.setText("Both") layout.addWidget(btnAll, 1, 2, 1, 3) btnAll.setCheckable(True) btnAll.setChecked(True) self.screens.addButton(btnAll, 0) btnRight = IDedButton(2) btnRight.setText("Right") layout.addWidget(btnRight, 1, 5, 1, 2) btnRight.setCheckable(True) self.screens.addButton(btnRight, 2) btnRaise = SvgButton(":icons/go-up", 96, 96) btnRaise.setText("Raise") btnRaise.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon) layout.addWidget(btnRaise, 2, 1, 1, 3) btnRaise.clicked.connect(self.raiseUp) btnLower = SvgButton(":icons/go-down", 96, 96) btnLower.setText("Lower") btnLower.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon) layout.addWidget(btnLower, 3, 1, 1, 3) btnLower.clicked.connect(self.lowerDown) btnStop = SvgButton(":icons/process-stop", 96, 96) btnStop.setText("Stop") btnStop.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextUnderIcon) layout.addWidget(btnStop, 2, 4, 2, 2) btnStop.clicked.connect(self.stop) return layout
class SystemPowerWidget(ScreenWithBackButton): def __init__(self, controller, mainWindow): self.controller = controller ScreenWithBackButton.__init__(self, "System Power", mainWindow) def makeContent(self): buttons = QHBoxLayout() self.btnOff = SvgButton(":icons/lightbulb_off", 128, 128) self.btnOff.setText("Off") self.btnOff.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon) self.btnOff.clicked.connect(self.powerOff) buttons.addWidget(self.btnOff) self.btnOn = SvgButton(":icons/lightbulb_on", 128, 128) self.btnOn.setText("On") self.btnOn.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon) self.btnOn.clicked.connect(self.powerOn) buttons.addWidget(self.btnOn) return buttons @handlePyroErrors def powerOn(self): self.controller.sequence( BroadcastEvent(MessageTypes.SHOW_POWER_ON, "Client", None), LogEvent(logging.INFO, "Turning system power on"), DeviceEvent("Power", "on", 1), SleepEvent(3), DeviceEvent("Power", "on", 2), SleepEvent(3), DeviceEvent("Power", "on", 3), SleepEvent(3), DeviceEvent("Power", "on", 4), ControllerEvent("initialise"), # By this time all things we care about to initialise will have been switched on BroadcastEvent(MessageTypes.HIDE_POWER, "Client", None), LogEvent(logging.INFO, "Power on sequence complete") ) @handlePyroErrors def powerOff(self): self.controller.sequence( BroadcastEvent(MessageTypes.SHOW_POWER_OFF, "Client", None), LogEvent(logging.INFO, "Turning system power off"), CompositeEvent( *map( lambda deviceID: DeviceEvent(deviceID, "deinitialise"), [d for d in _DEVICES_TO_DEINITIALISE if self.controller.hasDevice(d)] ) ), DeviceEvent("Power", "off", 4), SleepEvent(3), DeviceEvent("Power", "off", 3), SleepEvent(3), DeviceEvent("Power", "off", 2), SleepEvent(3), DeviceEvent("Power", "off", 1), BroadcastEvent(MessageTypes.HIDE_POWER, "Client", None), LogEvent(logging.INFO, "Power off sequence complete") )