Example #1
0
    def __set_state(self):
        aktiv_button = self.getControl(160)
        is_active = self.scene.is_active()
        aktiv_button.setSelected(is_active)
        if hasattr(self, "imagecontrol"):
            self.removeControl(self.imagecontrol)

        if is_active:
            self.imagecontrol = xbmcgui.ControlImage(400, 100, 64, 64, szene_img)
        else:
            self.imagecontrol = xbmcgui.ControlImage(400, 100, 64, 64, szene_img_deact)

        fav_button = self.getControl(136)
        if self.use_local_favorites:
            favored_scenes = local_favorites.get_devices_as_set()
            if self.scene.get_id() in favored_scenes:
                fav_button.setSelected(True)
            else:
                fav_button.setSelected(False)
        else:
            fav_button.setSelected(self.scene.is_favored())

        xbmc.log("---scene_window.py-- update scene" + str(self.getFocusId()), level=xbmc.LOGNOTICE)

        if self.scene.is_executable() and hasattr(self, 'execcontrol'):
            self.execcontrol.setVisible(True)
        elif hasattr(self, 'execcontrol'):
            self.execcontrol.setVisible(False)
        self.addControl(self.imagecontrol)
Example #2
0
    def __set_state(self):
        aktiv_button = self.getControl(160)
        is_active = self.scene.is_active()
        aktiv_button.setSelected(is_active)
        if hasattr(self, "imagecontrol"):
            self.removeControl(self.imagecontrol)

        if is_active:
            self.imagecontrol = xbmcgui.ControlImage(400, 100, 64, 64,
                                                     szene_img)
        else:
            self.imagecontrol = xbmcgui.ControlImage(400, 100, 64, 64,
                                                     szene_img_deact)

        fav_button = self.getControl(136)
        if self.use_local_favorites:
            favored_scenes = local_favorites.get_devices_as_set()
            if self.scene.get_id() in favored_scenes:
                fav_button.setSelected(True)
            else:
                fav_button.setSelected(False)
        else:
            fav_button.setSelected(self.scene.is_favored())

        xbmc.log("---scene_window.py-- update scene" + str(self.getFocusId()),
                 level=xbmc.LOGNOTICE)

        if self.scene.is_executable() and hasattr(self, 'execcontrol'):
            self.execcontrol.setVisible(True)
        elif hasattr(self, 'execcontrol'):
            self.execcontrol.setVisible(False)
        self.addControl(self.imagecontrol)
Example #3
0
    def onClick(self, controlId):
        if controlId == 160:
            aktiv_button = self.getControl(160)
            button_is_akiv = aktiv_button.isSelected()

            if self.scene.is_active() and not button_is_akiv:
                self.client.set_scene_inactive(self.scene.get_id())
                self.removeControl(self.imagecontrol)
                self.imagecontrol = xbmcgui.ControlImage(400, 100, 64, 64, szene_img_deact)
                self.addControl(self.imagecontrol)
            elif not self.scene.is_active() and button_is_akiv:
                self.client.set_scene_active(self.scene.get_id())
                self.removeControl(self.imagecontrol)
                self.imagecontrol = xbmcgui.ControlImage(400, 100, 64, 64, szene_img)
                self.addControl(self.imagecontrol)
        elif controlId == 136:
            fav_button = self.getControl(136)
            button_is_faved = (fav_button.isSelected() == 1)
            if self.use_local_favorites:
                favored_scenes = local_favorites.get_devices_as_set()
                if button_is_faved and self.scene.get_id() not in favored_scenes:
                    local_favorites.add_scene(self.scene.get_id())
                elif not button_is_faved and self.scene.get_id() in favored_scenes:
                    local_favorites.remove_scene(self.scene.get_id())

            else:
                if self.scene.is_favored() and not button_is_faved:
                    self.client.unfavorize_scene(self.scene.get_id())
                elif not self.scene.is_favored() and button_is_faved:
                    self.client.favorize_scene(self.scene.get_id())


        elif controlId == self.execcontrol.getId():
            self.client.execute_scene(self.scene.get_id())
Example #4
0
 def __get_local_favorit_devices(self):
     device_ids = local_favorites.get_devices_as_set()
     all_devices = self.client.get_devices()
     favorite_devices = []
     for device in all_devices:
         if device.get_device_id() in device_ids:
             favorite_devices.append(device)
     return favorite_devices
 def __get_local_favorit_devices(self):
     device_ids = local_favorites.get_devices_as_set()
     all_devices = self.client.get_devices()
     favorite_devices = []
     for device in all_devices:
         if device.get_device_id() in device_ids:
             favorite_devices.append(device)
     return favorite_devices
 def handle_favorit(self, deviceId, is_selected, is_favorited, use_local_favorites):
     favored_devices = local_favorites.get_devices_as_set()
     if use_local_favorites:
         if is_selected and not deviceId in favored_devices:
             local_favorites.add_device(deviceId)
         elif not is_selected and deviceId in favored_devices:
             local_favorites.remove_device(deviceId)
     else:
         if is_selected and not is_favorited:
             self.client.favorize_device(deviceId)
         elif not is_selected and is_favorited:
             self.client.unfavorize_device(deviceId)
 def get_base_device_controls(self, device):
     control_dict = {}
     title = self.device.get_name()
     title_control = xbmcgui.ControlLabel(325, 55, 600, 75, title, font="font16", textColor="white")
     control_dict["title"] = title_control
     icon = self.device.get_icon()
     icon_img = os.path.join(_images, icon)
     image_control = xbmcgui.ControlImage(self.x + 80, self.y + 60, 50, 50, icon_img)
     control_dict["icon"] = image_control
     auto_control = self.getControl(132)
     auto_control.setSelected(device.is_automated())
     control_dict["auto"] = auto_control
     fav_control = self.getControl(136)
     if self.use_local_favorites:
         favored_devices = local_favorites.get_devices_as_set()
         if device.get_device_id() in favored_devices:
             fav_control.setSelected(True)
         else:
             fav_control.setSelected(False)
     else:
         fav_control.setSelected(device.is_favored())
     control_dict["favoriten"] = fav_control
     return control_dict
Example #8
0
    def onClick(self, controlId):
        if controlId == 160:
            aktiv_button = self.getControl(160)
            button_is_akiv = aktiv_button.isSelected()

            if self.scene.is_active() and not button_is_akiv:
                self.client.set_scene_inactive(self.scene.get_id())
                self.removeControl(self.imagecontrol)
                self.imagecontrol = xbmcgui.ControlImage(
                    400, 100, 64, 64, szene_img_deact)
                self.addControl(self.imagecontrol)
            elif not self.scene.is_active() and button_is_akiv:
                self.client.set_scene_active(self.scene.get_id())
                self.removeControl(self.imagecontrol)
                self.imagecontrol = xbmcgui.ControlImage(
                    400, 100, 64, 64, szene_img)
                self.addControl(self.imagecontrol)
        elif controlId == 136:
            fav_button = self.getControl(136)
            button_is_faved = (fav_button.isSelected() == 1)
            if self.use_local_favorites:
                favored_scenes = local_favorites.get_devices_as_set()
                if button_is_faved and self.scene.get_id(
                ) not in favored_scenes:
                    local_favorites.add_scene(self.scene.get_id())
                elif not button_is_faved and self.scene.get_id(
                ) in favored_scenes:
                    local_favorites.remove_scene(self.scene.get_id())

            else:
                if self.scene.is_favored() and not button_is_faved:
                    self.client.unfavorize_scene(self.scene.get_id())
                elif not self.scene.is_favored() and button_is_faved:
                    self.client.favorize_scene(self.scene.get_id())

        elif controlId == self.execcontrol.getId():
            self.client.execute_scene(self.scene.get_id())