Exemplo n.º 1
0
    def event(self):
        if not Register.LIRC_EVENTS:
            return

        lirc_event = LircEvents.get_event()
        if lirc_event == LircEvents.KEY_BACK:
            DisplayRegister.set_menuWindow()

        if lirc_event == LircEvents.KEY_LEFT:
            self.selectedIndex = (self.selectedIndex - 1) % 6
        if lirc_event == LircEvents.KEY_RIGHT:
            self.selectedIndex = (self.selectedIndex + 1) % 6

        if lirc_event == LircEvents.KEY_OK:
            if self.selectedIndex == 0:
                self.selected_bottle = (self.selected_bottle - 1) % len(
                    self.bottles_on)
            if self.selectedIndex == 1:
                self.selected_bottle = (self.selected_bottle + 1) % len(
                    self.bottles_on)
            if self.selectedIndex == 2:
                BottleLogic.up_dose(1)
            if self.selectedIndex == 3:
                BottleLogic.down_dose(1)
            if self.selectedIndex == 4:
                BottleLogic.set_bottle(self.bottles_on[self.selected_bottle])
            if self.selectedIndex == 5:
                BottleLogic.refill_bottle(
                    self.bottles_on[self.selected_bottle])
Exemplo n.º 2
0
    def event(self):
        if not Register.LIRC_EVENTS:
            return

        lirc_event = LircEvents.get_event()
        if lirc_event == LircEvents.KEY_BACK:
            DisplayRegister.set_menuWindow()

        if lirc_event == LircEvents.KEY_LEFT:
            self.selectedIndex = (self.selectedIndex - 1) % 6
        if lirc_event == LircEvents.KEY_RIGHT:
            self.selectedIndex = (self.selectedIndex + 1) % 6

        if lirc_event == LircEvents.KEY_OK:
            if self.selectedIndex == 0:
                self.selected_bottle = (self.selected_bottle - 1) % len(self.bottles_on)
            if self.selectedIndex == 1:
                self.selected_bottle = (self.selected_bottle + 1) % len(self.bottles_on)
            if self.selectedIndex == 2:
                BottleLogic.up_dose(1)
            if self.selectedIndex == 3:
                BottleLogic.down_dose(1)
            if self.selectedIndex == 4:
                BottleLogic.set_bottle(self.bottles_on[self.selected_bottle])
            if self.selectedIndex == 5:
                BottleLogic.refill_bottle(self.bottles_on[self.selected_bottle])
Exemplo n.º 3
0
    def event(self):
        if not Register.LIRC_EVENTS:
            return

        lirc_event = LircEvents.get_event()
        if lirc_event == LircEvents.KEY_BACK:
            DisplayRegister.set_menuWindow()

        if lirc_event == LircEvents.KEY_RIGHT:
            self.selected_index = (self.selected_index + 1) % 6
            self.redraw = True

        if lirc_event == LircEvents.KEY_LEFT:
            self.selected_index = (self.selected_index - 1) % 6
            self.redraw = True

        if lirc_event == LircEvents.KEY_UP:
            if self.selected_index == 0:
                Light1Logic.block()
                Light1Logic.up_percent(5, 0)
                self.redraw = True
            if self.selected_index == 1:
                Light1Logic.block()
                Light1Logic.up_percent(5, 1)
                self.redraw = True
            if self.selected_index == 2:
                Light1Logic.block()
                Light1Logic.up_percent(5, 2)
                self.redraw = True
            if self.selected_index == 3:
                Light1Logic.block()
                Light1Logic.up_percent(5, 3)
                self.redraw = True

        if lirc_event == LircEvents.KEY_DOWN:
            if self.selected_index == 0:
                Light1Logic.block()
                Light1Logic.down_percent(5, 0)
                self.redraw = True
            if self.selected_index == 1:
                Light1Logic.block()
                Light1Logic.down_percent(5, 1)
                self.redraw = True
            if self.selected_index == 2:
                Light1Logic.block()
                Light1Logic.down_percent(5, 2)
                self.redraw = True
            if self.selected_index == 3:
                Light1Logic.block()
                Light1Logic.down_percent(5, 3)
                self.redraw = True

        if lirc_event == LircEvents.KEY_OK:

            if self.selected_index == 4:
                Light1Logic.unblock()

            if self.selected_index == 5:
                DisplayRegister.set_menuWindow()
Exemplo n.º 4
0
    def event(self):
        if not Register.LIRC_EVENTS:
            return

        lirc_event = LircEvents.get_event()
        if lirc_event == LircEvents.KEY_BACK:
            DisplayRegister.set_menuWindow()

        if lirc_event == LircEvents.KEY_RIGHT:
            self.selected_index = (self.selected_index + 1) % 6
            self.redraw = True

        if lirc_event == LircEvents.KEY_LEFT:
            self.selected_index = (self.selected_index - 1) % 6
            self.redraw = True

        if lirc_event == LircEvents.KEY_UP:
            if self.selected_index == 0:
                Light1Logic.block()
                Light1Logic.up_percent(5, 0)
                self.redraw = True
            if self.selected_index == 1:
                Light1Logic.block()
                Light1Logic.up_percent(5, 1)
                self.redraw = True
            if self.selected_index == 2:
                Light1Logic.block()
                Light1Logic.up_percent(5, 2)
                self.redraw = True
            if self.selected_index == 3:
                Light1Logic.block()
                Light1Logic.up_percent(5, 3)
                self.redraw = True

        if lirc_event == LircEvents.KEY_DOWN:
            if self.selected_index == 0:
                Light1Logic.block()
                Light1Logic.down_percent(5, 0)
                self.redraw = True
            if self.selected_index == 1:
                Light1Logic.block()
                Light1Logic.down_percent(5, 1)
                self.redraw = True
            if self.selected_index == 2:
                Light1Logic.block()
                Light1Logic.down_percent(5, 2)
                self.redraw = True
            if self.selected_index == 3:
                Light1Logic.block()
                Light1Logic.down_percent(5, 3)
                self.redraw = True

        if lirc_event == LircEvents.KEY_OK:

            if self.selected_index == 4:
                Light1Logic.unblock()

            if self.selected_index == 5:
                DisplayRegister.set_menuWindow()
Exemplo n.º 5
0
    def event(self):
        if not Register.LIRC_EVENTS:
            return

        lirc_event = LircEvents.get_event()
        if lirc_event == LircEvents.KEY_BACK:
            DisplayRegister.set_menuWindow()

        if lirc_event == LircEvents.KEY_RIGHT:
            self.selected_index = (self.selected_index + 1) % 8
            self.redraw = True

        if lirc_event == LircEvents.KEY_LEFT:
            self.selected_index = (self.selected_index - 1) % 8
            self.redraw = True

        if lirc_event == LircEvents.KEY_OK:
            if self.selected_index == 0:
                Filter1Logic.block_filter()
                Filter1Logic.toggle_filter()
                self.redraw = True

            if self.selected_index == 1:
                Filter2Logic.block_filter()
                Filter2Logic.toggle_filter()
                self.redraw = True

            if self.selected_index == 2:
                O2Logic.block_o2()
                O2Logic.toggle_o2()
                self.redraw = True

            if self.selected_index == 3:
                Co2Logic.block_co2()
                Co2Logic.toggle_co2()
                self.redraw = True

            if self.selected_index == 4:
                WaterTempLogic.block_heater()
                WaterTempLogic.toggle_heater()
                self.redraw = True

            if self.selected_index == 5:
                WaterTempLogic.block_heater_led()
                WaterTempLogic.toggle_heater_led()
                self.redraw = True

            if self.selected_index == 6:
                PowerModHelper.remove_override_switch(Register.I2C_POWERMOD_FILTER1)
                PowerModHelper.remove_override_switch(Register.I2C_POWERMOD_FILTER2)
                PowerModHelper.remove_override_switch(Register.I2C_POWERMOD_CO2)
                PowerModHelper.remove_override_switch(Register.I2C_POWERMOD_O2)
                PowerModHelper.remove_override_switch(Register.I2C_POWERMOD_HEATER)
                PowerModHelper.remove_override_switch(Register.I2C_POWERMOD_HEATER_LED)

            if self.selected_index == 7:
                DisplayRegister.set_menuWindow()
Exemplo n.º 6
0
    def event(self):
        if not Register.LIRC_EVENTS:
            return

        lirc_event = LircEvents.get_event()
        if lirc_event == LircEvents.KEY_0:
            settings.load_settings()

        if lirc_event == LircEvents.KEY_LEFT:
            self.i = self.i - 1 % 18
Exemplo n.º 7
0
    def event(self):
        if not Register.LIRC_EVENTS:
            return

        lirc_event = LircEvents.get_event()
        if lirc_event == LircEvents.KEY_0:
            settings.load_settings()

        if lirc_event == LircEvents.KEY_LEFT:
            self.i = self.i - 1 % 18
Exemplo n.º 8
0
    def event(self):
        if not Register.LIRC_EVENTS:
            return

        lirc_event = LircEvents.get_event()
        if lirc_event == LircEvents.KEY_BACK:
            self.tiles[self.selectedIndex].select()
            DisplayRegister.set_menuWindow()

        if lirc_event == LircEvents.KEY_RIGHT:
            self.tiles[self.selectedIndex].unselect()
            self.selectedIndex = (self.selectedIndex + 1) % 4
            self.tiles[self.selectedIndex].select()

        if lirc_event == LircEvents.KEY_LEFT:
            self.tiles[self.selectedIndex].unselect()
            self.selectedIndex = (self.selectedIndex - 1) % 4
            self.tiles[self.selectedIndex].select()

        if lirc_event == LircEvents.KEY_UP:
            self.tiles[self.selectedIndex].unselect()
            self.selectedIndex = (self.selectedIndex - 2) % 4
            self.tiles[self.selectedIndex].select()

        if lirc_event == LircEvents.KEY_DOWN:
            self.tiles[self.selectedIndex].unselect()
            self.selectedIndex = (self.selectedIndex + 2) % 4
            self.tiles[self.selectedIndex].select()

        if lirc_event == LircEvents.KEY_OK:
            if self.selectedIndex == 0:
                DisplayRegister.set_light1_settings_window()
            if self.selectedIndex == 1:
                DisplayRegister.set_bottle_settings_window()
            if self.selectedIndex == 2:
                DisplayRegister.set_light2_settings_window()
            if self.selectedIndex == 3:
                DisplayRegister .set_heater_settings_window()
Exemplo n.º 9
0
    def event(self):
        if not Register.LIRC_EVENTS:
            return

        lirc_event = LircEvents.get_event()
        if lirc_event == LircEvents.KEY_BACK:
            self.tiles[self.selectedIndex].select()
            DisplayRegister.set_menuWindow()

        if lirc_event == LircEvents.KEY_RIGHT:
            self.tiles[self.selectedIndex].unselect()
            self.selectedIndex = (self.selectedIndex + 1) % 4
            self.tiles[self.selectedIndex].select()

        if lirc_event == LircEvents.KEY_LEFT:
            self.tiles[self.selectedIndex].unselect()
            self.selectedIndex = (self.selectedIndex - 1) % 4
            self.tiles[self.selectedIndex].select()

        if lirc_event == LircEvents.KEY_UP:
            self.tiles[self.selectedIndex].unselect()
            self.selectedIndex = (self.selectedIndex - 2) % 4
            self.tiles[self.selectedIndex].select()

        if lirc_event == LircEvents.KEY_DOWN:
            self.tiles[self.selectedIndex].unselect()
            self.selectedIndex = (self.selectedIndex + 2) % 4
            self.tiles[self.selectedIndex].select()

        if lirc_event == LircEvents.KEY_OK:
            if self.selectedIndex == 0:
                DisplayRegister.set_light1_settings_window()
            if self.selectedIndex == 1:
                DisplayRegister.set_bottle_settings_window()
            if self.selectedIndex == 2:
                DisplayRegister.set_light2_settings_window()
            if self.selectedIndex == 3:
                DisplayRegister.set_heater_settings_window()
Exemplo n.º 10
0
    def event(self):
        if not Register.LIRC_EVENTS:
            return

        lirc_event = LircEvents.get_event()
        if lirc_event == LircEvents.KEY_BACK:
            DisplayRegister.set_settingsWindow()

        if lirc_event == LircEvents.KEY_RIGHT:
            self.selectedIndex = (self.selectedIndex + 1) % 8

        if lirc_event == LircEvents.KEY_LEFT:
            self.selectedIndex = (self.selectedIndex - 2) % 8

        if lirc_event == LircEvents.KEY_UP:
            self.selectedIndex = (self.selectedIndex - 2) % 8

        if lirc_event == LircEvents.KEY_DOWN:
            self.selectedIndex = (self.selectedIndex + 2) % 8

        if lirc_event == LircEvents.KEY_OK:
            if self.selectedIndex == 0:
                self.temp_set = (self.temp_set + 0.1) % 30
            if self.selectedIndex == 1:
                self.temp_set = (self.temp_set - 0.1) % 30
            if self.selectedIndex == 2:
                self.temp_alert_delta = (self.temp_alert_delta + 0.1) % 20
            if self.selectedIndex == 3:
                self.temp_alert_delta = (self.temp_alert_delta - 0.1) % 20
            if self.selectedIndex == 4:
                self.temp_on_off_delta = (self.temp_on_off_delta + 0.1) % 3
            if self.selectedIndex == 5:
                self.temp_on_off_delta = (self.temp_on_off_delta - 0.1) % 3
            if self.selectedIndex == 6:  #reset
                self.reset()
            if self.selectedIndex == 7:  #zapisz
                self.save()
                self.reset()
Exemplo n.º 11
0
    def event(self):
        if not Register.LIRC_EVENTS:
            return

        lirc_event = LircEvents.get_event()
        if lirc_event == LircEvents.KEY_BACK:
            DisplayRegister.set_settingsWindow()

        if lirc_event == LircEvents.KEY_RIGHT:
            self.selectedIndex = (self.selectedIndex + 1) % 8

        if lirc_event == LircEvents.KEY_LEFT:
            self.selectedIndex = (self.selectedIndex - 2) % 8

        if lirc_event == LircEvents.KEY_UP:
            self.selectedIndex = (self.selectedIndex - 2) % 8

        if lirc_event == LircEvents.KEY_DOWN:
            self.selectedIndex = (self.selectedIndex + 2) % 8

        if lirc_event == LircEvents.KEY_OK:
            if self.selectedIndex == 0:
                self.temp_set = (self.temp_set + 0.1) % 30
            if self.selectedIndex == 1:
                self.temp_set = (self.temp_set - 0.1) % 30
            if self.selectedIndex == 2:
                self.temp_alert_delta = (self.temp_alert_delta + 0.1) % 20
            if self.selectedIndex == 3:
                self.temp_alert_delta = (self.temp_alert_delta - 0.1) % 20
            if self.selectedIndex == 4:
                self.temp_on_off_delta = (self.temp_on_off_delta + 0.1) % 3
            if self.selectedIndex == 5:
                self.temp_on_off_delta = (self.temp_on_off_delta - 0.1) % 3
            if self.selectedIndex == 6:  #reset
                self.reset()
            if self.selectedIndex == 7:  #zapisz
                self.save()
                self.reset()
Exemplo n.º 12
0
    def event(self):
        if not Register.LIRC_EVENTS:
            return

        lirc_event = LircEvents.get_event()
        if lirc_event == LircEvents.KEY_BACK:
            DisplayRegister.set_settingsWindow()

        if lirc_event == LircEvents.KEY_RIGHT:
            self.selectedIndex = (self.selectedIndex + 1) % 38

        if lirc_event == LircEvents.KEY_LEFT:
            self.selectedIndex = (self.selectedIndex - 1) % 38

        if lirc_event == LircEvents.KEY_UP:
            self.selectedIndex = (self.selectedIndex - 9) % 38

        if lirc_event == LircEvents.KEY_DOWN:
            self.selectedIndex = (self.selectedIndex + 9) % 38

        if lirc_event == LircEvents.KEY_OK:

            if self.selectedIndex == 36:  #reset
                self.reset()
                return
            if self.selectedIndex == 37:  #zapisz
                self.save()
                self.reset()
                return

            i = 0
            if self.selectedIndex in range(0, 9):
                i = 0
            elif self.selectedIndex in range(9, 18):
                i = 1
            elif self.selectedIndex in range(18, 27):
                i = 2
            else:
                i = 3

            method = self.selectedIndex - (i * 9)

            if method == 0:
                self.bottles[self.bottles_names[i]]['ON'] = not self.bottles[self.bottles_names[i]]['ON']
            elif method == 1:
                self.bottles[self.bottles_names[i]]['DOSE'] += 1
            elif method == 2:
                self.bottles[self.bottles_names[i]]['DOSE'] -= 1
                if self.bottles[self.bottles_names[i]]['DOSE'] < 0:
                    self.bottles[self.bottles_names[i]]['DOSE'] = 0
            elif method == 3:
                self.bottles[self.bottles_names[i]]['SEC_PER_ML'] += 0.1
            elif method == 4:
                self.bottles[self.bottles_names[i]]['SEC_PER_ML'] -= 0.1
                if self.bottles[self.bottles_names[i]]['SEC_PER_ML'] < 0:
                    self.bottles[self.bottles_names[i]]['SEC_PER_ML'] = 0
            elif method == 5:
                self.bottles[self.bottles_names[i]]['HOUR'] = (self.bottles[self.bottles_names[i]]['HOUR'] + 1) % 24
            elif method == 6:
                self.bottles[self.bottles_names[i]]['HOUR'] = (self.bottles[self.bottles_names[i]]['HOUR'] - 1) % 24
            elif method == 7:
                self.bottles[self.bottles_names[i]]['MIN'] = (self.bottles[self.bottles_names[i]]['MIN'] + 1) % 60
            elif method == 8:
                self.bottles[self.bottles_names[i]]['MIN'] = (self.bottles[self.bottles_names[i]]['MIN'] - 1) % 60
Exemplo n.º 13
0
    def event(self):
        if not Register.LIRC_EVENTS:
            return

        lirc_event = LircEvents.get_event()
        if lirc_event == LircEvents.KEY_BACK:
            DisplayRegister.set_settingsWindow()

        if lirc_event == LircEvents.KEY_RIGHT:
            self.selectedIndex = (self.selectedIndex + 1) % 38

        if lirc_event == LircEvents.KEY_LEFT:
            self.selectedIndex = (self.selectedIndex - 1) % 38

        if lirc_event == LircEvents.KEY_UP:
            self.selectedIndex = (self.selectedIndex - 9) % 38

        if lirc_event == LircEvents.KEY_DOWN:
            self.selectedIndex = (self.selectedIndex + 9) % 38

        if lirc_event == LircEvents.KEY_OK:

            if self.selectedIndex == 36:  #reset
                self.reset()
                return
            if self.selectedIndex == 37:  #zapisz
                self.save()
                self.reset()
                return

            i = 0
            if self.selectedIndex in range(0, 9):
                i = 0
            elif self.selectedIndex in range(9, 18):
                i = 1
            elif self.selectedIndex in range(18, 27):
                i = 2
            else:
                i = 3

            method = self.selectedIndex - (i * 9)

            if method == 0:
                self.bottles[self.bottles_names[i]]['ON'] = not self.bottles[
                    self.bottles_names[i]]['ON']
            elif method == 1:
                self.bottles[self.bottles_names[i]]['DOSE'] += 1
            elif method == 2:
                self.bottles[self.bottles_names[i]]['DOSE'] -= 1
                if self.bottles[self.bottles_names[i]]['DOSE'] < 0:
                    self.bottles[self.bottles_names[i]]['DOSE'] = 0
            elif method == 3:
                self.bottles[self.bottles_names[i]]['SEC_PER_ML'] += 0.1
            elif method == 4:
                self.bottles[self.bottles_names[i]]['SEC_PER_ML'] -= 0.1
                if self.bottles[self.bottles_names[i]]['SEC_PER_ML'] < 0:
                    self.bottles[self.bottles_names[i]]['SEC_PER_ML'] = 0
            elif method == 5:
                self.bottles[self.bottles_names[i]]['HOUR'] = (
                    self.bottles[self.bottles_names[i]]['HOUR'] + 1) % 24
            elif method == 6:
                self.bottles[self.bottles_names[i]]['HOUR'] = (
                    self.bottles[self.bottles_names[i]]['HOUR'] - 1) % 24
            elif method == 7:
                self.bottles[self.bottles_names[i]]['MIN'] = (
                    self.bottles[self.bottles_names[i]]['MIN'] + 1) % 60
            elif method == 8:
                self.bottles[self.bottles_names[i]]['MIN'] = (
                    self.bottles[self.bottles_names[i]]['MIN'] - 1) % 60
Exemplo n.º 14
0
    def event(self):
        if not Register.LIRC_EVENTS:
            return

        lirc_event = LircEvents.get_event()
        if lirc_event == LircEvents.KEY_BACK:
            DisplayRegister.set_menuWindow()

        if lirc_event == LircEvents.KEY_RIGHT:
            self.selected_index = (self.selected_index + 1) % 8
            self.redraw = True

        if lirc_event == LircEvents.KEY_LEFT:
            self.selected_index = (self.selected_index - 1) % 8
            self.redraw = True

        if lirc_event == LircEvents.KEY_OK:
            if self.selected_index == 0:
                Filter1Logic.block_filter()
                Filter1Logic.toggle_filter()
                self.redraw = True

            if self.selected_index == 1:
                Filter2Logic.block_filter()
                Filter2Logic.toggle_filter()
                self.redraw = True

            if self.selected_index == 2:
                O2Logic.block_o2()
                O2Logic.toggle_o2()
                self.redraw = True

            if self.selected_index == 3:
                Co2Logic.block_co2()
                Co2Logic.toggle_co2()
                self.redraw = True

            if self.selected_index == 4:
                WaterTempLogic.block_heater()
                WaterTempLogic.toggle_heater()
                self.redraw = True

            if self.selected_index == 5:
                WaterTempLogic.block_heater_led()
                WaterTempLogic.toggle_heater_led()
                self.redraw = True

            if self.selected_index == 6:
                PowerModHelper.remove_override_switch(
                    Register.I2C_POWERMOD_FILTER1)
                PowerModHelper.remove_override_switch(
                    Register.I2C_POWERMOD_FILTER2)
                PowerModHelper.remove_override_switch(
                    Register.I2C_POWERMOD_CO2)
                PowerModHelper.remove_override_switch(Register.I2C_POWERMOD_O2)
                PowerModHelper.remove_override_switch(
                    Register.I2C_POWERMOD_HEATER)
                PowerModHelper.remove_override_switch(
                    Register.I2C_POWERMOD_HEATER_LED)

            if self.selected_index == 7:
                DisplayRegister.set_menuWindow()