Ejemplo n.º 1
0
    def add_control_text(self, c):
        if xbmcgui.ControlEdit == ControlEdit:
            control = xbmcgui.ControlEdit(0, -100, self.controls_width, self.height_control, c["label"],
                                         os.path.join(self.mediapath, 'Controls', 'MenuItemFO.png'),
                                         os.path.join(self.mediapath, 'Controls', 'MenuItemNF.png'), 0,
                                         textColor=c["color"], font=self.font, isPassword=c["hidden"], window=self)

        else:
            control = xbmcgui.ControlEdit(0, -100, self.controls_width - 5, self.height_control,
                                          c["label"], self.font, c["color"], '', 4, isPassword=c["hidden"],
                                          focusTexture=os.path.join(self.mediapath, 'Controls', 'MenuItemFO.png'),
                                          noFocusTexture=os.path.join(self.mediapath, 'Controls', 'MenuItemNF.png'))

        self.addControl(control)

        control.setVisible(False)
        control.setLabel(c["label"])
        # frodo fix
        s = self.values[c["id"]]
        if s is None:
            s = ''
        control.setText(s)
        # control.setText(self.values[c["id"]])
        control.setWidth(self.controls_width - 5)
        control.setHeight(self.height_control)

        c["control"] = control
Ejemplo n.º 2
0
 def __add_editcontrol(self, x, y, height, width):
     temp = xbmcgui.ControlEdit(0, 0, 0, 0, '', font='font12', textColor='0xFFFFFFFF', focusTexture='buttons/button-fo.png', noFocusTexture='buttons/button-nofo.png', _alignment=CENTER_Y | CENTER_X)
     temp.setPosition(x, y)
     temp.setHeight(height)
     temp.setWidth(width)
     self.addControl(temp)
     return temp
Ejemplo n.º 3
0
    def add_control_text(self, c):
        control = xbmcgui.ControlEdit(0, -100, self.controls_width, self.height_control,
                                    c["label"], self.font, c["color"], '', 1 | 4,
                                    focusTexture='',
                                    noFocusTexture='')

        image = xbmcgui.ControlImage(0, -100, self.controls_width + 10, self.height_control, os.path.join(self.mediapath, 'Controls', 'MenuItemFO.png'))

        self.addControl(image)
        self.addControl(control)
        image.setVisibleCondition('Control.HasFocus(%s)' % control.getId(), True) 

        control.setVisible(False)
        control.setLabel(c["label"])
        if c['hidden']: control.setType(xbmcgui.INPUT_TYPE_PASSWORD, c["label"])
        # frodo fix
        s = self.values[c["id"]]
        if s is None: s = c['default'] if 'default' in c else ''

        control.setText(s)
        control.setWidth(self.controls_width-10)
        control.setHeight(self.height_control)

        c["control"] = control
        c['image'] = image
Ejemplo n.º 4
0
    def onInit(self):
        logger.trace()
        if int(xbmcgui.__version__.replace('.', '')) <= 2250:
            self.setCoordinateResolution(5)
        # Control Edit del xml hace que se cierre Kodi al hacer getText() en android
        # Como alternativa añadimos un control por codigo encima de este para solucionar el problema
        self.EditControl = xbmcgui.ControlEdit(
            x=445,
            y=392,
            width=390,
            height=30,
            label='',
            _alignment=2,
            focusTexture=os.path.join(self.mediapath, 'Controls',
                                      'InputFO.png'),
            noFocusTexture=os.path.join(self.mediapath, 'Controls',
                                        'InputNF.png'))
        self.EditControl.setPosition(445, 392)
        self.EditControl.setWidth(390)
        self.EditControl.setHeight(30)
        self.addControl(self.EditControl)

        self.getControl(10004).setImage(self.path)
        # self.setFocusId(self.getControl(10004))
        self.setFocus(self.EditControl)
Ejemplo n.º 5
0
 def edit(self, label="", default="", height=None):
     if not height:
         height = self.__rowh
     elem = xbmcgui.ControlEdit(0, 0, 0, 0, default)
     self.__eid += 1
     self.__elems[self.__eid] = ("edit", label, self.__null, None, height,
                                 elem)
     return self.__eid
Ejemplo n.º 6
0
 def __add_editcontrol(self, x, y, height, width):
     media_path = os.path.join(__addon__.getAddonInfo('path'), 'resources', 'skins', 'Default', 'media')
     temp = xbmcgui.ControlEdit(0, 0, 0, 0, '', font='font12', textColor='0xFFFFFFFF', focusTexture=os.path.join(media_path, 'button-focus2.png'),
                                noFocusTexture=os.path.join(media_path, 'button-nofocus.png'), _alignment=CENTER_Y | CENTER_X)
     temp.setPosition(x, y)
     temp.setHeight(height)
     temp.setWidth(width)
     self.addControl(temp)
     return temp
Ejemplo n.º 7
0
    def _add_editcontrol(self, x, y, height, width):

        media = os.path.join(addon.getAddonInfo('path'), 'resources', 'skins', 'default', 'media')
        control = xbmcgui.ControlEdit(0, 0, 0, 0,
                                      label="User",
                                      font="font10",
                                      textColor="ffc2c2c2",
                                      focusTexture=os.path.join(media, "button-focus.png"),
                                      noFocusTexture=os.path.join(media, "button-focus.png"))
        control.setPosition(x, y)
        control.setHeight(height)
        control.setWidth(width)

        self.addControl(control)
        return control
Ejemplo n.º 8
0
    def _add_editcontrol(self, x, y, height, width):

        media = os.path.join(xbmcaddon.Addon(addon_id()).getAddonInfo('path'), 'resources', 'skins', 'default', 'media')
        control = xbmcgui.ControlEdit(0, 0, 0, 0,
                                      label="User",
                                      font="font13",
                                      textColor="FF00A4DC",
                                      disabledColor="FF888888",
                                      focusTexture="-",
                                      noFocusTexture="-")
        control.setPosition(x, y)
        control.setHeight(height)
        control.setWidth(width)

        self.addControl(control)
        return control
Ejemplo n.º 9
0
    def onInit(self):
        # Ponemos el título
        self.getControl(10002).setLabel(self.title)

        if self.custom_button is not None:
            if self.custom_button['method'] != "":
                self.getControl(10006).setLabel(self.custom_button['name'])
            else:
                self.getControl(10006).setVisible(False)
                self.getControl(10004).setPosition(
                    self.getControl(10004).getX() + 80,
                    self.getControl(10004).getY())
                self.getControl(10005).setPosition(
                    self.getControl(10005).getX() + 80,
                    self.getControl(10005).getY())

        # Obtenemos las dimensiones del area de controles
        self.controls_width = self.getControl(10007).getWidth() - 20
        self.controls_height = self.getControl(10007).getHeight()
        self.controls_pos_x = self.getControl(10007).getX() + self.getControl(
            10001).getX() + 10
        self.controls_pos_y = self.getControl(10007).getY() + self.getControl(
            10001).getY()
        self.height_control = 35
        font = "font12"

        # Creamos un listado de controles, para tenerlos en todo momento localizados y posicionados en la ventana
        self.controls = []

        x = 0
        for c in self.list_controls:
            # Posicion Y para cada control
            pos_y = self.controls_pos_y + x * self.height_control

            # Saltamos controles que no tengan los valores adecuados
            if "type" not in c:
                continue
            if "label" not in c:
                continue
            if c["type"] != "label" and "id" not in c:
                continue
            if c["type"] == "list" and "lvalues" not in c:
                continue
            if c["type"] == "list" and not type(c["lvalues"]) == list:
                continue
            if c["type"] == "list" and not len(c["lvalues"]) > 0:
                continue
            if c["type"] != "label" and c["id"] in [
                    control["id"] for control in self.controls
            ]:
                continue

            # Translation label y lvalues
            if c['label'].startswith('@') and unicode(
                    c['label'][1:]).isnumeric():
                c['label'] = config.get_localized_string(int(c['label'][1:]))
            if c['type'] == 'list':
                lvalues = []
                for li in c['lvalues']:
                    if li.startswith('@') and unicode(li[1:]).isnumeric():
                        lvalues.append(config.get_localized_string(int(
                            li[1:])))
                    else:
                        lvalues.append(li)
                c['lvalues'] = lvalues

            # Valores por defecto en caso de que el control no disponga de ellos
            if c["type"] == "bool" and "default" not in c:
                c["default"] = False
            if c["type"] == "text" and "default" not in c:
                c["default"] = ""
            if c["type"] == "text" and "hidden" not in c:
                c["hidden"] = False
            if c["type"] == "list" and "default" not in c:
                c["default"] = 0
            if c["type"] == "label" and "id" not in c:
                c["id"] = None
            if "color" not in c:
                c["color"] = "0xFF0066CC"
            if "visible" not in c:
                c["visible"] = True
            if "enabled" not in c:
                c["enabled"] = True

            # Para simplificar el codigo pasamos los campos a variables
            id = c["id"]
            label = c['label']
            ctype = c["type"]
            visible = c["visible"]
            enabled = c["enabled"]
            color = c["color"]
            if ctype == "list":
                lvalues = c["lvalues"]
            if ctype == "text":
                hidden = c["hidden"] if type(c["hidden"]) == bool else (
                    True if c["hidden"].lower() == 'true' else False)

            # Decidimos si usar el valor por defecto o el valor guardado
            if ctype in ["bool", "text", "list"]:
                default = c["default"]
                if id not in self.values:
                    if not self.callback:
                        self.values[id] = config.get_setting(id, self.channel)
                    else:
                        self.values[id] = default

                value = self.values[id]

            if ctype == "bool":
                c["default"] = bool(c["default"])
                self.values[id] = bool(self.values[id])

            # Control "bool"
            if ctype == "bool":
                # Creamos el control
                control = xbmcgui.ControlRadioButton(
                    self.controls_pos_x - 10,
                    -100,
                    self.controls_width + 10,
                    self.height_control,
                    label=label,
                    font=font,
                    textColor=color,
                    focusTexture=os.path.join(self.mediapath,
                                              'ChannelSettings',
                                              'MenuItemFO.png'),
                    noFocusTexture=os.path.join(self.mediapath,
                                                'ChannelSettings',
                                                'MenuItemNF.png'),
                    focusOnTexture=os.path.join(self.mediapath,
                                                'ChannelSettings',
                                                'radiobutton-focus.png'),
                    noFocusOnTexture=os.path.join(self.mediapath,
                                                  'ChannelSettings',
                                                  'radiobutton-focus.png'),
                    focusOffTexture=os.path.join(self.mediapath,
                                                 'ChannelSettings',
                                                 'radiobutton-nofocus.png'),
                    noFocusOffTexture=os.path.join(self.mediapath,
                                                   'ChannelSettings',
                                                   'radiobutton-nofocus.png'))
                # Lo añadimos a la ventana
                self.addControl(control)

                # Cambiamos las propiedades
                control.setRadioDimension(x=self.controls_width + 10 -
                                          (self.height_control - 5),
                                          y=0,
                                          width=self.height_control - 5,
                                          height=self.height_control - 5)
                control.setSelected(value)
                control.setVisible(False)

                # Lo añadimos al listado
                self.controls.append({
                    "id": id,
                    "type": ctype,
                    "control": control,
                    "x": self.controls_pos_x - 10,
                    "y": pos_y,
                    "default": default,
                    "enabled": enabled,
                    "visible": visible
                })

            # Control "text"
            elif ctype == 'text':
                # Creamos el control
                control = xbmcgui.ControlEdit(
                    self.controls_pos_x,
                    -100,
                    self.controls_width - 5,
                    self.height_control,
                    label,
                    font=font,
                    isPassword=hidden,
                    textColor=color,
                    focusTexture=os.path.join(self.mediapath,
                                              'ChannelSettings',
                                              'MenuItemFO.png'),
                    noFocusTexture=os.path.join(self.mediapath,
                                                'ChannelSettings',
                                                'MenuItemNF.png'))
                # Lo añadimos a la ventana
                self.addControl(control)

                # Cambiamos las propiedades
                control.setVisible(False)
                control.setLabel(label)
                control.setText(value)
                control.setPosition(self.controls_pos_x, pos_y)
                control.setWidth(self.controls_width - 5)
                control.setHeight(self.height_control)

                # Lo añadimos al listado
                self.controls.append({
                    "id": id,
                    "type": ctype,
                    "control": control,
                    "x": self.controls_pos_x,
                    "y": pos_y,
                    "default": default,
                    "enabled": enabled,
                    "visible": visible
                })

            # Control "list"
            elif ctype == 'list':
                # Creamos los controles el list se forma de 3 controles
                control = xbmcgui.ControlButton(
                    self.controls_pos_x,
                    -100,
                    self.controls_width,
                    self.height_control,
                    label,
                    font=font,
                    textOffsetX=0,
                    textColor=color,
                    focusTexture=os.path.join(self.mediapath,
                                              'ChannelSettings',
                                              'MenuItemFO.png'),
                    noFocusTexture=os.path.join(self.mediapath,
                                                'ChannelSettings',
                                                'MenuItemNF.png'))

                label = xbmcgui.ControlLabel(self.controls_pos_x,
                                             -100,
                                             self.controls_width - 30,
                                             self.height_control,
                                             lvalues[value],
                                             font=font,
                                             textColor=color,
                                             alignment=4 | 1)

                upBtn = xbmcgui.ControlButton(
                    self.controls_pos_x + self.controls_width - 25,
                    -100,
                    20,
                    15,
                    '',
                    focusTexture=os.path.join(self.mediapath,
                                              'ChannelSettings',
                                              'spinUp-Focus.png'),
                    noFocusTexture=os.path.join(self.mediapath,
                                                'ChannelSettings',
                                                'spinUp-noFocus.png'))

                downBtn = xbmcgui.ControlButton(
                    self.controls_pos_x + self.controls_width - 25,
                    -100 + 15,
                    20,
                    15,
                    '',
                    focusTexture=os.path.join(self.mediapath,
                                              'ChannelSettings',
                                              'spinDown-Focus.png'),
                    noFocusTexture=os.path.join(self.mediapath,
                                                'ChannelSettings',
                                                'spinDown-noFocus.png'))

                # Los añadimos a la ventana
                self.addControl(control)
                self.addControl(label)
                self.addControl(upBtn)
                self.addControl(downBtn)

                # Cambiamos las propiedades
                control.setVisible(False)
                label.setVisible(False)
                upBtn.setVisible(False)
                downBtn.setVisible(False)

                # Lo añadimos al listado
                self.controls.append({
                    "id": id,
                    "type": ctype,
                    "control": control,
                    "label": label,
                    "downBtn": downBtn,
                    "upBtn": upBtn,
                    "x": self.controls_pos_x,
                    "y": pos_y,
                    "lvalues": c["lvalues"],
                    "default": default,
                    "enabled": enabled,
                    "visible": visible
                })

            # Control "label"
            elif ctype == 'label':
                # Creamos el control
                control = xbmcgui.ControlLabel(self.controls_pos_x,
                                               -100,
                                               self.controls_width,
                                               height=30,
                                               label=label,
                                               alignment=4,
                                               font=font,
                                               textColor=color)

                # Lo añadimos a la ventana
                self.addControl(control)

                # Cambiamos las propiedades
                control.setVisible(False)

                # Lo añadimos al listado
                self.controls.append({
                    "id": None,
                    "type": ctype,
                    "control": control,
                    "x": self.controls_pos_x,
                    "y": pos_y,
                    "enabled": enabled,
                    "visible": visible
                })

            # Esto es para reposicionar el control en la ventana
            self.scroll(1)

            x += 1

        # Ponemos el foco en el primer control
        self.setFocus(self.controls[0]["control"])
        self.evaluate_conditions()
        self.check_default()
        self.check_ok(self.values)
Ejemplo n.º 10
0
        def onInit(self, *args, **kwargs):
            try:
                # listado temporada / episodios
                pos_y = self.controls_bg.getY() + 10

                # eliminamos los componentes al repintar la ventana
                for linea in self.controls:
                    self.removeControls(linea.list_elements())

                # mostramos el scroll si hay más de 5 elementos
                if len(self.data) > 5:
                    self.controls_bg.setWidth(545)
                    self.scroll_bg.setVisible(True)
                    self.scroll2_bg.setVisible(True)
                else:
                    self.controls_bg.setWidth(562)
                    self.scroll_bg.setVisible(False)
                    self.scroll2_bg.setVisible(False)

                self.controls = []
                # cambiamos el orden para que se vea en orden ascendente
                self.data.sort(key=lambda el: int(el[0]), reverse=False)

                for index, e in enumerate(self.data):
                    pos_x = self.controls_bg.getX() + 15
                    label_season_w = 100
                    label_season = xbmcgui.ControlLabel(pos_x, pos_y + 3, label_season_w, 34,
                                                        "Temporada:", font=self.font, textColor="0xFF2E64FE")
                    self.addControl(label_season)
                    label_season.setVisible(False)

                    pos_x += label_season_w + 5

                    # TODO mirar retro-compatilibidad
                    # if xbmcgui.ControlEdit == ControlEdit:
                    #       edit_season = xbmcgui.ControlEdit(0, 0, 0, 0, '', font=self.font, isPassword=False,
                    #                                         textColor='',
                    #                                         focusTexture=os.path.join(self.mediapath, 'Controls',
                    #                                                                   'MenuItemFO.png'),
                    #                                         noFocusTexture=os.path.join(self.mediapath, 'Controls',
                    #                                                                     'MenuItemNF.png'), window=self)
                    # else:

                    # control bugeado se tiene que usar metodos sets para que se cree correctamente.
                    edit_season = xbmcgui.ControlEdit(0, 0, 0, 0, "", self.font, "", '', 4, isPassword=False,
                                                      focusTexture=os.path.join(self.mediapath, 'Controls',
                                                                                'MenuItemFO.png'),
                                                      noFocusTexture=os.path.join(self.mediapath, 'Controls',
                                                                                  'MenuItemNF.png'))
                    self.addControl(edit_season)
                    edit_season.setText(str(e[0]))
                    # edit_season.setLabel("Temporada:", font=self.font, textColor="0xFF2E64FE")
                    edit_season.setPosition(pos_x, pos_y - 2)
                    edit_season.setWidth(25)
                    edit_season.setHeight(35)
                    edit_season.setVisible(False)

                    label_episode_w = 90
                    pos_x += edit_season.getWidth() + 60
                    label_episode = xbmcgui.ControlLabel(pos_x, pos_y + 3, label_episode_w, 34, "Episodios:",
                                                         font=self.font, textColor="0xFF2E64FE")
                    self.addControl(label_episode)
                    label_episode.setVisible(False)

                    pos_x += label_episode_w + 5
                    # control bugeado se tiene que usar metodos sets para que se cree correctamente.
                    edit_episode = xbmcgui.ControlEdit(0, 0, 0, 0, "", self.font, "", '', 4, isPassword=False,
                                                       focusTexture=os.path.join(self.mediapath, 'Controls',
                                                                                 'MenuItemFO.png'),
                                                       noFocusTexture=os.path.join(self.mediapath, 'Controls',
                                                                                   'MenuItemNF.png'))
                    self.addControl(edit_episode)
                    edit_episode.setText(str(e[1]))
                    # edit_episode.setLabel("Episodios:", font=self.font, textColor="0xFF2E64FE")
                    edit_episode.setPosition(pos_x, pos_y - 2)
                    edit_episode.setWidth(40)
                    edit_episode.setHeight(35)
                    edit_episode.setVisible(False)

                    btn_delete_season_w = 120
                    btn_delete_season = xbmcgui.ControlButton(self.controls_bg.getX() + self.controls_bg.getWidth() -
                                                              btn_delete_season_w - 14, pos_y, btn_delete_season_w, 30,
                                                              'Eliminar', font=self.font,
                                                              focusTexture=os.path.join(self.mediapath, 'Controls',
                                                                                        'KeyboardKey.png'),
                                                              noFocusTexture=os.path.join(self.mediapath, 'Controls',
                                                                                          'KeyboardKeyNF.png'),
                                                              alignment=ALIGN_CENTER)
                    self.addControl(btn_delete_season)
                    btn_delete_season.setVisible(False)

                    hb_bg = xbmcgui.ControlImage(self.controls_bg.getX() + 10, pos_y + 40,
                                                 self.controls_bg.getWidth() - 20,
                                                 2, os.path.join(self.mediapath, 'Controls', 'ScrollBack.png'))
                    self.addControl(hb_bg)
                    hb_bg.setVisible(False)

                    group = ControlGroup(label_season=label_season, edit_season=edit_season,
                                         label_episode=label_episode,
                                         edit_episode=edit_episode, btn_delete_season=btn_delete_season, hb=hb_bg)

                    pos_y += 50

                    if index < 5:
                        group.set_visible(True)

                    self.controls.append(group)

                if len(self.data) > 5:
                    self.move_scroll()

            except Exception as Ex:
                logger.error("HA HABIDO UNA HOSTIA %s" % Ex)
Ejemplo n.º 11
0
    def __add_controles(self, list_controls, pos_ini):

        pos_x = self.screen_x + 20
        width_control = self.screen_w - 75
        pagina = 1
        pos_y = pos_ini
        num_control = 0

        for c in list_controls:
            # Fijar valores por defecto para cada control
            if not c.has_key('enabled') or c['enabled'] is None:
                c['enabled'] = True
            if not c.has_key('visible') or c['visible'] is None:
                c['visible'] = True
            if self.dict_values.has_key(c['id']):
                c['value'] = self.dict_values[c['id']]
            else:
                c['value'] = c['default']

            c['pagina'] = pagina
            if c['type'] == 'bool':
                control = xbmcgui.ControlRadioButton(
                    pos_x,
                    pos_y,
                    width_control,
                    height=30,
                    label=c['label'],
                    font='font14',
                    focusTexture=os.path.join(_path_imagen, 'Controls',
                                              'MenuItemFO.png'),
                    noFocusTexture=os.path.join(_path_imagen, 'Controls',
                                                'MenuItemNF.png'),
                    focusOnTexture=os.path.join(_path_imagen, 'Controls',
                                                'radiobutton-focus.png'),
                    noFocusOnTexture=os.path.join(_path_imagen, 'Controls',
                                                  'radiobutton-focus.png'),
                    focusOffTexture=os.path.join(_path_imagen, 'Controls',
                                                 'radiobutton-nofocus.png'),
                    noFocusOffTexture=os.path.join(_path_imagen, 'Controls',
                                                   'radiobutton-nofocus.png'))
                self.addControl(control)
                control.setRadioDimension(x=width_control - 30,
                                          y=0,
                                          width=30,
                                          height=30)
                control.setSelected(c['value'])
                c['control'] = control

                self.controles[control.getId()] = c

            elif c['type'] == 'text':
                control = xbmcgui.ControlEdit(
                    -10,
                    -10,
                    width_control,
                    30,
                    c['label'],
                    font='font14',
                    focusTexture=os.path.join(_path_imagen, 'Controls',
                                              'MenuItemFO.png'),
                    noFocusTexture=os.path.join(_path_imagen, 'Controls',
                                                'MenuItemNF.png'))

                self.addControl(control)
                control.setLabel(c['label'])
                control.setText(c['value'])
                control.setPosition(pos_x + 10, pos_y)
                control.setWidth(width_control - 10)
                control.setHeight(30)
                c['control'] = control
                self.controles[control.getId()] = c

            elif c['type'] == 'list':
                control = ListControl(self, pos_x + 10, pos_y, width_control,
                                      30, c['label'], c['lvalues'], c['value'])
                self.addControl(control)
                c['control'] = control
                self.controles[control.getId() - 1] = c  # Boton up
                self.controles[control.getId() - 2] = c  # Boton down

            elif c['type'] == 'label':
                if c['default'].startswith('0x'):
                    control = xbmcgui.ControlFadeLabel(pos_x + 10,
                                                       pos_y,
                                                       width_control,
                                                       height=30,
                                                       font='font24_title',
                                                       textColor=c['default'])
                else:
                    control = xbmcgui.ControlFadeLabel(pos_x + 10,
                                                       pos_y,
                                                       width_control,
                                                       height=30,
                                                       font='font24_title',
                                                       textColor='0xFF0066CC')
                self.addControl(control)
                control.addLabel(c['label'])
                c['control'] = control
                self.controles[control.getId()] = c

            else:
                # Control no soportado
                return

            # Comun para todos los controles
            control.setEnabled(c['enabled'])

            if c['visible']:
                pos_y += 30
                control.setVisible(pagina == 1)
                num_control += 1
            else:
                control.setVisible(False)

            if (num_control % self.num_controles_x_page) == 0:
                pos_y = pos_ini
                pagina += 1

        return
Ejemplo n.º 12
0
 def set_controls(self):
     # Демонстрация основных контролов XBMC UI.
     # При первоначальном создании задаются фиктивные координаты и размеры: 1, 1, 1, 1.
     no_int_label = xbmcgui.ControlLabel(1,
                                         1,
                                         1,
                                         1,
                                         'Вывод информации',
                                         alignment=ALIGN_CENTER)
     self.placeControl(no_int_label, 0, 0, 1, 2)
     label_label = xbmcgui.ControlLabel(1, 1, 1, 1, 'ControlLabel')
     self.placeControl(label_label, 1, 0)
     # ControlLabel
     self.label = xbmcgui.ControlLabel(1, 1, 1, 1, u'Простая надпись')
     self.placeControl(self.label, 1, 1)
     fadelabel_label = xbmcgui.ControlLabel(1, 1, 1, 1, 'ControlFadeLabel')
     self.placeControl(fadelabel_label, 2, 0)
     # ControlFadeLabel
     self.fade_label = xbmcgui.ControlFadeLabel(1, 1, 1, 1)
     self.placeControl(self.fade_label, 2, 1)
     # Дополнительные свойства определяем после (!!!) отображения контрола.
     self.fade_label.addLabel(u'Здесь может быть очень длинная строка.')
     textbox_label = xbmcgui.ControlLabel(1, 1, 1, 1, 'ControlTextBox')
     self.placeControl(textbox_label, 3, 0)
     # ControlTextBox
     self.textbox = xbmcgui.ControlTextBox(1, 1, 1, 1)
     self.placeControl(self.textbox, 3, 1, 2, 1)
     self.textbox.setText(u'Текстовое окно.\n'
                          u'Здесь может быть несколько строк.\n')
     image_label = xbmcgui.ControlLabel(1, 1, 1, 1, 'ControlImage')
     self.placeControl(image_label, 5, 0)
     # ControlImage
     self.image = xbmcgui.ControlImage(1, 1, 1, 1,
                                       os.path.join(images, 'banner.jpg'))
     self.placeControl(self.image, 5, 1)
     no_int_label = xbmcgui.ControlLabel(1,
                                         1,
                                         1,
                                         1,
                                         'Интерактивные элементы',
                                         alignment=ALIGN_CENTER)
     self.placeControl(no_int_label, 6, 0, 1, 2)
     button_label = xbmcgui.ControlLabel(1, 1, 1, 1, 'ControlButton')
     self.placeControl(button_label, 7, 0)
     # ControlButton
     self.button = xbmcgui.ControlButton(
         1,
         1,
         1,
         1,
         u'Нажми меня',
         focusTexture=self.button_bg_focus,
         noFocusTexture=self.button_bg_Nofocus,
         alignment=ALIGN_CENTER)
     self.placeControl(self.button, 7, 1)
     radiobutton_label = xbmcgui.ControlLabel(1, 1, 1, 1,
                                              'ControlRadioButton')
     self.placeControl(radiobutton_label, 8, 0)
     # ControlRadioButton
     self.radiobutton = xbmcgui.ControlRadioButton(
         1,
         1,
         1,
         1,
         u'Радиокнопка',
         focusTexture=self.list_bg_focus,
         noFocusTexture=self.list_bg_Nofocus,
         TextureRadioFocus=self.radio_focus,
         TextureRadioNoFocus=self.radio_Nofocus)
     self.placeControl(self.radiobutton, 8, 1)
     edit_label = xbmcgui.ControlLabel(1, 1, 1, 1, 'ControlEdit')
     self.placeControl(edit_label, 9, 0)
     # ControlEdit
     self.edit = xbmcgui.ControlEdit(1,
                                     1,
                                     1,
                                     1,
                                     '',
                                     focusTexture=self.edit_focus,
                                     noFocusTexture=self.button_bg_Nofocus,
                                     _alignment=ALIGN_LEFT)
     self.placeControl(self.edit, 9, 1)
     self.edit.setText(u'Введите текст сюда')
     list_label = xbmcgui.ControlLabel(1, 1, 1, 1, 'ControlList')
     self.placeControl(list_label, 10, 0)
     # ControlList
     self.list = xbmcgui.ControlList(1,
                                     1,
                                     1,
                                     1,
                                     buttonTexture=self.list_bg_Nofocus,
                                     buttonFocusTexture=self.list_bg_focus)
     self.placeControl(self.list, 10, 1, 3, 1)
     self.list.addItems([u'Объект 1', u'Объект 2', u'Объект 3'])
     slider_label = xbmcgui.ControlLabel(1, 1, 1, 1, 'ControlSlider')
     self.placeControl(slider_label, 13, 0)
     # ControlSlider
     self.slider = xbmcgui.ControlSlider(1,
                                         1,
                                         1,
                                         1,
                                         textureback=self.slider_bg,
                                         texture=self.slider_nib_nf,
                                         texturefocus=self.slider_nib)
     self.placeControl(self.slider, 13, 1)
     self.slider.setPercent(25)
Ejemplo n.º 13
0
	def buildElements(self): 
		self.firstWindow  = []
		self.secondWindow = []
		self.formerror	= []
		### Build Window Elements
		## Images
		# Background
		self.imgbackground = xbmcgui.ControlImage(0, 0, self.screenx, self.screeny, self.image_background)
		self.addControl(self.imgbackground)
		#self.imgheaderbg = xbmcgui.ControlImage(0, 0, self.screenx, 90, self.image_header_bg)
		#self.addControl(self.imgheaderbg)
		# Main Window
		WINDOW_W = int((self.screenx/1.2))
		WINDOW_H = int((self.screeny/1.1))
		WINDOW_X = int((self.screenx/2)-(WINDOW_W/2))
		WINDOW_Y = int((self.screeny/2)-(WINDOW_H/2))
		#self.imgwindow = xbmcgui.ControlImage(WINDOW_X, WINDOW_Y, WINDOW_W, WINDOW_H, self.image_window)
		#self.addControl(self.imgwindow)
		#self.imgheader = xbmcgui.ControlImage(WINDOW_X, 0, WINDOW_W, 120, self.image_header)
		#self.addControl(self.imgheader)
		# Body Content
		BODY_W = int((WINDOW_W/1.2))
		BODY_H = int((WINDOW_H/1.2))
		BODY_X = int((self.screenx/2)-(BODY_W/2))
		BODY_Y = int((self.screeny/2)-(BODY_H/2))+40
		#self.imgbody = xbmcgui.ControlImage(BODY_X, BODY_Y, BODY_W, BODY_H, self.image_window)
		#self.imgbody.setColorDiffuse('0xC0CCCCCC')
		#self.addControl(self.imgbody)
		#self.firstWindow.append(self.imgbody)
		# Login Form
		FORM1_W = int((BODY_W/1.6))
		FORM1_H = 220
		FORM1_X = int((self.screenx/2)-(FORM1_W/2))
		FORM1_Y = int((self.screeny/2)-(FORM1_H/2))-100
		#self.imgloginform = xbmcgui.ControlImage(FORM1_X, FORM1_Y, FORM1_W, FORM1_H, self.image_form1_bg)
		#self.addControl(self.imgloginform)
		#self.firstWindow.append(self.imgloginform)
		# New Signup Form Button
		FORM2_W = int((BODY_W-60))
		FORM2_H = 265
		FORM2_X = int(BODY_X+30)
		FORM2_Y = int((self.screeny/2)-(FORM2_H/2))+155
		#self.imgnewsignupformbutton = xbmcgui.ControlImage(FORM2_X, FORM2_Y, FORM2_W, FORM2_H, self.image_form2_bg)
		#self.addControl(self.imgnewsignupformbutton)
		#self.firstWindow.append(self.imgnewsignupformbutton)
		# QR code image
		W = 180
		H = 180
		X = int(FORM2_X+(FORM2_W/4)+(FORM2_W/2)-(W/2))
		Y = int((FORM2_Y+65))
		#self.imgqrcode = xbmcgui.ControlImage(X, Y, W, H, self.image_form2_qrcode)
		#self.addControl(self.imgqrcode)
		#self.firstWindow.append(self.imgqrcode)
		# animate arrow left code image
		W = 40
		H = 40
		X = int(FORM2_X+(FORM2_W/4)-(W/2))-100
		Y = int((FORM2_Y+170))
		#self.imgpointright = xbmcgui.ControlImage(X, Y, W, H, self.image_point_right)
		#self.addControl(self.imgpointright)
		#self.imgpointright.setAnimations([
			#("conditional", "effect=fade start=%d end=%d time=500 delay=500 condition=Control.IsVisible(%d)" % (0, 100, self.imgpointright.getId())), 
			#("conditional", "effect=fade start=%d end=%d time=500 delay=500 condition=Control.IsEnabled(%d)" % (0, 100, self.imgpointright.getId())), 
			#("conditional", "effect=fade start=%d end=%d time=500 condition=!Control.IsEnabled(%d)" % (100, 0, self.imgpointright.getId())), 
			#("conditional", "effect=slide start=%d,%d time=500 tween=cubic easing=in delay=10 pulse=true condition=Control.IsVisible(%d)" % (35, 0, self.imgpointright.getId()))])
		#self.firstWindow.append(self.imgpointright)
		#upward arrow below signin
		W = 40
		H = 30
		X = int(FORM2_X+(FORM2_W/4)+(W/2))+190
		Y = int((FORM2_Y+130))
		self.imgpointUp = xbmcgui.ControlImage(X, Y, W, H, self.image_point_up)
		self.addControl(self.imgpointUp)
		self.firstWindow.append(self.imgpointUp)
		W = 200
		H = 40
		X = int(FORM2_X+(FORM2_W/4)+(W/2))+30
		Y = int((FORM2_Y+170))
		self.free_signup_label = xbmcgui.ControlLabel(X, Y, W, H, '', textColor='0xFFEEEEEE', alignment=2|4)
		self.addControl(self.free_signup_label)
		self.free_signup_label.setLabel(xbmcaddon.Addon(id=gd.addon_id).getLocalizedString(8022))
		self.firstWindow.append(self.free_signup_label)
		
		# animate arrow right code image
		#W = 40
		#H = 40
		#X = int(FORM2_X+(FORM2_W/4)+(W/2))+120
		#Y = int((FORM2_Y+170))
		#self.imgpointleft = xbmcgui.ControlImage(X, Y, W, H, self.image_point_left)
		#self.addControl(self.imgpointleft)
		#self.imgpointleft.setAnimations([
			#("conditional", "effect=fade start=%d end=%d time=500 delay=500 condition=Control.IsVisible(%d)" % (0, 100, self.imgpointleft.getId())), 
			#("conditional", "effect=fade start=%d end=%d time=500 delay=500 condition=Control.IsEnabled(%d)" % (0, 100, self.imgpointleft.getId())), 
			#("conditional", "effect=fade start=%d end=%d time=500 condition=!Control.IsEnabled(%d)" % (100, 0, self.imgpointleft.getId())), 
			#("conditional", "effect=slide start=%d,%d time=500 tween=cubic easing=in delay=10 pulse=true condition=Control.IsVisible(%d)" % (-35, 0, self.imgpointleft.getId()))])
		#self.firstWindow.append(self.imgpointleft)
		#self.imgpointright.setVisible(False)
		#self.imgpointleft.setVisible(False)
		#self.imgpointright.setVisible(True)
		#self.imgpointleft.setVisible(True)
		# # Body Content2
		# BODY2_W = int((WINDOW_W/1.17))
		# BODY2_H = int((WINDOW_H/1.16))
		# BODY2_X = int((self.screenx/2)-(BODY2_W/2))
		# BODY2_Y = int((self.screeny/2)-(BODY2_H/2))+40
		# self.imgbody2 = xbmcgui.ControlImage(BODY2_X, BODY2_Y, BODY2_W, BODY2_H, self.image_window)
		# self.imgbody2.setColorDiffuse('0xC0CCCCCC')
		# self.addControl(self.imgbody2)
		# self.imgbody2.setVisible(False)
		# self.secondWindow.append(self.imgbody2)
		# Signup Form
		FORM3_W = int((WINDOW_W/1.2))
		FORM3_H = int((WINDOW_H/1.2))
		FORM3_X = int((self.screenx/2)-(FORM3_W/2))
		FORM3_Y = int((self.screeny/2)-(FORM3_H/2))+40
		#self.imgsignup = xbmcgui.ControlImage(FORM3_X, FORM3_Y, FORM3_W, FORM3_H, self.image_signup_form_bg)
		#self.addControl(self.imgsignup)
		#self.secondWindow.append(self.imgsignup)
		# Busy
		W = 100
		H = 100
		X = self.screenx-100
		Y = self.screeny-100
		self.imgBusyOuter = xbmcgui.ControlImage(X, Y, W, H, self.image_busy1, aspectRatio=0)
		self.addControl(self.imgBusyOuter)
		self.imgBusyOuter.setAnimations([
			('conditional', 'effect=fade start=%d end=%d time=500 condition=Control.IsVisible(%d)' % (0, 100, self.imgBusyOuter.getId())), 
			('conditional', 'effect=fade start=%d end=%d time=500 condition=Control.IsEnabled(%d)' % (0, 100, self.imgBusyOuter.getId())), 
			('conditional', 'effect=fade start=%d end=%d time=500 condition=!Control.IsEnabled(%d)' % (100, 0, self.imgBusyOuter.getId())), 
			('conditional', 'effect=rotate start=%d end=%d center=auto time=2500 loop=true condition=Control.IsVisible(%d)' % (0, 360, self.imgBusyOuter.getId()))])
		self.imgBusyOuter.setVisible(False)

		## Text Boxes
		# Form1 Label
		W = FORM1_W
		H = 45
		X = int((self.screenx/2)-(W/2))
		Y = int((FORM1_Y))
		#old code
		#self.form1_header = xbmcgui.ControlLabel(X, Y, W, H, '', textColor='0xFFEEEEEE', alignment=2|4)
		#self.addControl(self.form1_header)
		#self.form1_header.setLabel(xbmcaddon.Addon(id=gd.addon_id).getLocalizedString(7000), shadowColor='0xFF333333')
		#self.firstWindow.append(self.form1_header)
		#end
		# Username Text
		W = 150
		H = 45
		X = int((FORM1_X+40))
		Y = int((FORM1_Y+45))
		#self.username_label = xbmcgui.ControlTextBox(X, Y, W, H, textColor="0xFF777777")
		#self.addControl(self.username_label)
		#self.username_label.setText(xbmcaddon.Addon(id=gd.addon_id).getLocalizedString(7001))
		#self.firstWindow.append(self.username_label)
		# Password Text
		W = 150
		H = 45
		X = int((FORM1_X+40))
		Y = int((FORM1_Y+105))
		#self.password_label = xbmcgui.ControlTextBox(X, Y, W, H, textColor="0xFF777777")
		#self.addControl(self.password_label)
		#self.password_label.setText(xbmcaddon.Addon(id=gd.addon_id).getLocalizedString(7002))
		#self.firstWindow.append(self.password_label)
		# Form2 Label
		W = FORM2_W
		H = 45
		X = int(FORM2_X+(FORM2_W/2)-(W/2))
		Y = int((FORM2_Y)+2)
		#self.form2_header = xbmcgui.ControlLabel(X, Y, W, H, '', textColor='0xFFEEEEEE', alignment=2|4)
		#self.addControl(self.form2_header)
		#self.form2_header.setLabel(xbmcaddon.Addon(id=gd.addon_id).getLocalizedString(7003), shadowColor='0xFF333333')
		#self.firstWindow.append(self.form2_header)
		# Create new account
		W = 450
		H = 80
		X = int(FORM2_X+(FORM2_W/4)-(W/2))+30
		Y = int((FORM2_Y+70))
		#self.click_for_new_account_form_text = xbmcgui.ControlLabel(X, Y, W, H, '', textColor="0xFF777777", alignment=2|4)
		#self.addControl(self.click_for_new_account_form_text)
		#self.click_for_new_account_form_text.setLabel(xbmcaddon.Addon(id=gd.addon_id).getLocalizedString(7004))
		#self.firstWindow.append(self.click_for_new_account_form_text)
		# Create free account
		#W = 300
		#H = 80
		#X = int(FORM2_X+(FORM2_W/4)-(W/2))+430
		#Y = int((FORM2_Y+120))
		#self.click_for_new_accounttrial_form_text = xbmcgui.ControlLabel(X, Y, W, H, '', textColor="0xFF777777", alignment=2|4)
		#self.addControl(self.click_for_new_accounttrial_form_text)
		#self.click_for_new_accounttrial_form_text.setLabel(xbmcaddon.Addon(id=gd.addon_id).getLocalizedString(8012))
		#self.firstWindow.append(self.click_for_new_accounttrial_form_text)
		# Sign up url
		W = 450
		H = 45
		X = int(FORM2_X+(FORM2_W/4)-(W/2))+50
		Y = int((FORM2_Y+215))
		#self.signup_url_text = xbmcgui.ControlLabel(X, Y, W, H, '', textColor="0xFF777777", alignment=2|4)
		#self.addControl(self.signup_url_text)
		#self.signup_url_text.setLabel('[I]'+self.text_signup_url+'[/I]')
		#self.firstWindow.append(self.signup_url_text)
		# Unique code Text
		W = 370
		H = 45
		X = int((FORM3_X)+100)
		Y = int((FORM3_Y)+10)
		#self.unique_code_label = xbmcgui.ControlLabel(X, Y, W, H, '', textColor="0xFF777777", alignment=1)
		#self.addControl(self.unique_code_label)
		#self.unique_code_label.setLabel(xbmcaddon.Addon(id=gd.addon_id).getLocalizedString(7005))
		#self.secondWindow.append(self.unique_code_label)
		# First & Last name Text
		W = 370
		H = 45
		X = int((FORM3_X)+10)
		Y = int((FORM3_Y)+110)
		# old code
		#self.name_label = xbmcgui.ControlLabel(X, Y, W, H, '', textColor="0xFF777777", alignment=1)
		#self.addControl(self.name_label)
		#self.name_label.setLabel(xbmcaddon.Addon(id=gd.addon_id).getLocalizedString(7006))
		#self.secondWindow.append(self.name_label)
		#end
		# Email address Text
		W = 370
		H = 75
		X = int((FORM3_X)+10)
		Y = int((FORM3_Y)+152)
		#old code
		#self.email_label = xbmcgui.ControlLabel(X, Y, W, H, '', textColor="0xFF777777", alignment=1)
		#self.addControl(self.email_label)
		#self.email_label.setLabel(xbmcaddon.Addon(id=gd.addon_id).getLocalizedString(7007))
		#self.secondWindow.append(self.email_label)
		#end
		# Email address long text
		# W = 370
		# H = 50
		# X = int((FORM3_X)+10)
		# Y = int((FORM3_Y)+178)
		# self.email_long_text = xbmcgui.ControlTextBox(X, Y, W, H, textColor="0xFF777777")
		# self.addControl(self.email_long_text)
		# self.email_long_text.setText('(an email confirmation will be sent to this address)')
		# self.secondWindow.append(self.email_long_text)
		# Create username text
		W = 370
		H = 75
		X = int((FORM3_X)+10)
		Y = int((FORM3_Y)+270)
		#old
		#self.create_username_label = xbmcgui.ControlLabel(X, Y, W, H, '', textColor="0xFF777777", alignment=1)
		#self.addControl(self.create_username_label)
		#self.create_username_label.setLabel(xbmcaddon.Addon(id=gd.addon_id).getLocalizedString(7008))
		#self.secondWindow.append(self.create_username_label)
		#end
		# Create username long text
		# W = 370
		# H = 40
		# X = int((FORM3_X)+10)
		# Y = int((FORM3_Y)+295)
		# self.create_username_long_text = xbmcgui.ControlTextBox(X, Y, W, H, textColor="0xFF777777")
		# self.addControl(self.create_username_long_text)
		# self.create_username_long_text.setText('(should consist of more than 6 characters and may contain only letters, numbers and underscores)')
		# self.secondWindow.append(self.create_username_long_text)
		# # Create password text
		W = 370
		H = 45
		X = int((FORM3_X)+10)
		Y = int((FORM3_Y)+370)
		#old
		#self.create_password_label = xbmcgui.ControlLabel(X, Y, W, H, '', textColor="0xFF777777", alignment=1)
		#self.addControl(self.create_password_label)
		#self.create_password_label.setLabel(xbmcaddon.Addon(id=gd.addon_id).getLocalizedString(7009))
		#self.secondWindow.append(self.create_password_label)
		#end
		# Create password long text
		# W = 370
		# H = 75
		# X = int((FORM3_X)+10)
		# Y = int((FORM3_Y)+395)
		# self.create_password_long_text = xbmcgui.ControlTextBox(X, Y, W, H, textColor="0xFF777777")
		# self.addControl(self.create_password_long_text)
		# self.create_password_long_text.setText('(must consist of more than 6 characters)')
		# self.secondWindow.append(self.create_password_long_text)
		# Confirm new password text
		W = 370
		H = 20
		X = int((FORM3_X)+10)
		Y = int((FORM3_Y)+440)
		#old
		#self.confirm_password_label = xbmcgui.ControlLabel(X, Y, W, H, '', textColor="0xFF777777", alignment=1)
		#self.addControl(self.confirm_password_label)
		#self.confirm_password_label.setLabel(xbmcaddon.Addon(id=gd.addon_id).getLocalizedString(7010))
		#self.secondWindow.append(self.confirm_password_label)
		#end
		## Buttons
		# Auto login radiobutton
		W = 270
		H = 45
		X = int((FORM1_X+10))
		Y = int((FORM1_Y+165))
		#self.autologin_toggle_button = xbmcgui.ControlRadioButton(X, Y, W, H, label='', textColor="0xFF777777", _alignment=0|4, 
			#focusTexture=self.image_l_button_selc, 
			#noFocusTexture='', 
			#focusOnTexture=self.image_radio_on, 
			#noFocusOnTexture=self.image_radio_on, 
			#focusOffTexture=self.image_radio_off, 
			#noFocusOffTexture=self.image_radio_off, 
			#textOffsetX=17)
		#self.autologin_toggle_button.setLabel(xbmcaddon.Addon(id=gd.addon_id).getLocalizedString(7015))
		#self.addControl(self.autologin_toggle_button)
		#if self.autologin.lower() == "true":
			#self.autologin_toggle_button.setSelected(True)
		#self.firstWindow.append(self.autologin_toggle_button)
		# Login button
		#W = 100
		#H = 45
		#X = int((FORM1_X+400))
		#Y = int((FORM1_Y+165))

		W = 200
		H = 45
		X = int((FORM1_X+200))
		Y = int((FORM1_Y+250))
		# ControlButton(x, y, width, height, label[, focusTexture, noFocusTexture, textOffsetX, textOffsetY,
		#			   alignment, font, textColor, disabledColor, angle, shadowColor, focusedColor])
		#self.login_button = xbmcgui.ControlButton(X, Y, W, H, label='', textColor="0xFF777777", focusTexture=self.image_s_button_selc, noFocusTexture=self.image_s_button, alignment=2|4)
		#self.login_button.setLabel(xbmcaddon.Addon(id=gd.addon_id).getLocalizedString(7011))
		#self.addControl(self.login_button)
		#self.firstWindow.append(self.login_button)
		self.login_button = xbmcgui.ControlButton(X, Y, W, H, label='', textColor="0xFF777777", focusTexture=self.image_s_button_selc, noFocusTexture=self.image_s_button_selc, alignment=2|4)
		self.login_button.setLabel(xbmcaddon.Addon(id=gd.addon_id).getLocalizedString(7011))
		self.addControl(self.login_button)
		self.firstWindow.append(self.login_button)
		# New Account form button
		#old signup button
		#W = 130
		#H = 45
		#X = int(FORM2_X+(FORM2_W/2)-(W/2))
		#X = int(FORM2_X+(FORM2_W/4)-(W/2))+30
		#Y = int((FORM2_Y+170))
		#self.new_acct_button = xbmcgui.ControlButton(X, Y, W, H, label='', textColor="0xFF777777", focusTexture=self.image_s_button_selc, noFocusTexture=self.image_s_button, alignment=2|4)
		#self.new_acct_button.setLabel(xbmcaddon.Addon(id=gd.addon_id).getLocalizedString(7012))
		#self.addControl(self.new_acct_button)
		#self.firstWindow.append(self.new_acct_button)

		#new sign up button
		W = 200
		H = 45
		#X = int(FORM2_X+(FORM2_W/2)-(W/2))
		X = int((FORM1_X+200))
		Y = int((FORM1_Y+300))
		self.new_acct_button = xbmcgui.ControlButton(X, Y, W, H, label='', textColor="0xFF777777", focusTexture=self.image_s_button_signup, noFocusTexture=self.image_s_button_signup, alignment=2|4)
		self.new_acct_button.setLabel(xbmcaddon.Addon(id=gd.addon_id).getLocalizedString(7012))
		self.addControl(self.new_acct_button)
		self.firstWindow.append(self.new_acct_button)
		
		# cancel form button
		#old code
		#W = 110
		#H = 45
		#X = int((FORM3_X+10))
		#Y = int((FORM3_Y+492))
		#self.cancel_signup_button = xbmcgui.ControlButton(X, Y, W, H, label='', textColor="0xFF777777", focusTexture=self.image_s_button_selc, noFocusTexture=self.image_s_button, alignment=2|4)
		#self.cancel_signup_button.setLabel(xbmcaddon.Addon(id=gd.addon_id).getLocalizedString(7013))
		#self.addControl(self.cancel_signup_button)
		#self.secondWindow.append(self.cancel_signup_button)
		#end
		W = 300
		H = 45
		X = int((FORM3_X+300))
		Y = int((FORM3_Y+400))
		self.cancel_signup_button = xbmcgui.ControlButton(X, Y, W, H, label='', textColor="0xFF777777", focusTexture=self.image_s_button_selc, noFocusTexture=self.image_s_button_selc, alignment=2|4)
		self.cancel_signup_button.setLabel(xbmcaddon.Addon(id=gd.addon_id).getLocalizedString(7013))
		self.addControl(self.cancel_signup_button)
		self.secondWindow.append(self.cancel_signup_button)
		
		# submit form button
		#old code
		#W = 130
		#H = 45
		#X = int((self.screenx/2)-(W/2))
		#Y = int((FORM3_Y+492))
		#self.submit_signup_button = xbmcgui.ControlButton(X, Y, W, H, label='', textColor="0xFF777777", focusTexture=self.image_s_button_selc, noFocusTexture=self.image_s_button, alignment=2|4)
		#self.submit_signup_button.setLabel(xbmcaddon.Addon(id=gd.addon_id).getLocalizedString(7014))
		#self.addControl(self.submit_signup_button)
		#self.secondWindow.append(self.submit_signup_button)
		#end code
		W = 300
		H = 45
		X = int((FORM3_X+300))
		Y = int((FORM3_Y+350))
		self.submit_signup_button = xbmcgui.ControlButton(X, Y, W, H, label='', textColor="0xFF777777", focusTexture=self.image_s_button_signup, noFocusTexture=self.image_s_button_signup, alignment=2|4)
		#self.submit_signup_button.setLabel(xbmcaddon.Addon(id=gd.addon_id).getLocalizedString(7014))
		self.submit_signup_button.setLabel(xbmcaddon.Addon(id=gd.addon_id).getLocalizedString(7012))
		self.addControl(self.submit_signup_button)
		self.secondWindow.append(self.submit_signup_button)
		
		# free trial form button
		#W = 130
		#H = 45
		#X = int(FORM3_X+FORM3_W-W-10)
		#Y = int((FORM3_Y+492))
		#self.submit_signuptrial_button = xbmcgui.ControlButton(X, Y, W, H, label='', textColor="0xFF777777", focusTexture=self.image_s_button_selc, noFocusTexture=self.image_s_button, alignment=2|4)
		#self.submit_signuptrial_button.setLabel(xbmcaddon.Addon(id=gd.addon_id).getLocalizedString(8011))
		#self.addControl(self.submit_signuptrial_button)
		#self.secondWindow.append(self.submit_signuptrial_button)

		## TextEdit
		# Username entry
		# old user name text box
		#W = 300
		#H = 45
		#X = int((FORM1_X+200))
		#Y = int((FORM1_Y+50))
		#self.username_textbox = xbmcgui.ControlEdit(X, Y, W, H, '', textColor="0xFF777777", focusTexture=self.image_txt_input_selc, noFocusTexture=self.image_txt_input, _alignment=6|4)
		#self.username_textbox.setPosition(X, Y)
		#self.username_textbox.setHeight(H)
		#self.username_textbox.setWidth(W)
		#self.addControl(self.username_textbox)
		#self.username_textbox.setText(self.hqusername)
		#self.firstWindow.append(self.username_textbox)
		W = 300
		H = 45
		X = int((FORM1_X+150))
		Y = int((FORM1_Y+110))
		#self.user_text_field_image=xbmcgui.ControlImage (X, Y, 30, 30, self.user_image_for_text_box)

		self.username_textbox = xbmcgui.ControlEdit(X, Y, W, H, '', textColor="0xFF777777", focusTexture=self.image_txt_input_selc, noFocusTexture=self.image_txt_input_user, _alignment=6|4)
		self.username_textbox.setPosition(X, Y)
		self.username_textbox.setHeight(H)
		self.username_textbox.setWidth(W)
		self.addControl(self.username_textbox)
		self.username_textbox.setText(self.hqusername)
		self.firstWindow.append(self.username_textbox)
		# password entry
		#old password
		#W = 300
		#H = 45
		#X = int((FORM1_X+200))
		#Y = int((FORM1_Y+110))
		#self.password_textbox = xbmcgui.ControlEdit(X, Y, W, H, '', textColor="0xFF777777", focusTexture=self.image_txt_input_selc, noFocusTexture=self.image_txt_input, _alignment=6|4, isPassword=True)
		#self.password_textbox.setPosition(X, Y)
		#self.password_textbox.setHeight(H)
		#self.password_textbox.setWidth(W)
		#self.addControl(self.password_textbox)
		#self.password_textbox.setText(self.hqpassword)
		#self.firstWindow.append(self.password_textbox)

		W = 300
		H = 45
		X = int((FORM1_X+150))
		Y = int((FORM1_Y+180))
		self.password_textbox = xbmcgui.ControlEdit(X, Y, W, H, '', textColor="0xFF777777", focusTexture=self.image_txt_input_selc, noFocusTexture=self.image_txt_input_user_pass, _alignment=6|4, isPassword=True)
		self.password_textbox.setPosition(X, Y)
		self.password_textbox.setHeight(H)
		self.password_textbox.setWidth(W)
		self.addControl(self.password_textbox)
		self.password_textbox.setText(self.hqpassword)
		self.firstWindow.append(self.password_textbox)

		# unique code entry
		#W = 200
		#H = 45
		#X = int((FORM3_X)+400)
		#Y = int((FORM3_Y)+5)
		#self.unique_code_bg = self.image_txt_input
		#self.unique_code_textbox = xbmcgui.ControlEdit(X, Y, W, H, '', textColor="0xFF777777", focusTexture=self.image_txt_input_selc, noFocusTexture=self.unique_code_bg, _alignment=6|4)
		#self.unique_code_textbox.setPosition(X, Y)
		#self.unique_code_textbox.setHeight(H)
		#self.unique_code_textbox.setWidth(W)
		#self.addControl(self.unique_code_textbox)
		#self.secondWindow.append(self.unique_code_textbox)
		#X = int(X+W+10)
		#Y = int(Y+10)
		#self.error_unique_code = xbmcgui.ControlImage(X, Y, 10, 10, self.image_input_err_star)
		#self.addControl(self.error_unique_code)
		#self.error_unique_code.setVisible(False)
		#self.formerror.append(self.error_unique_code)
		# first name entry
		#old code
		#W = 200
		#H = 45
		#X = int((FORM3_X)+400)
		#Y = int((FORM3_Y)+100)
		#end
		W = 350
		H = 55
		X = int((FORM3_X)+80)
		Y = int((FORM3_Y)+100)
		
		self.first_name_textbox = xbmcgui.ControlEdit(X, Y, W, H, '', textColor="0xFF777777", focusTexture=self.image_txt_input_selc, noFocusTexture=self.image_txt_input_user, _alignment=6|4)
		self.first_name_textbox.setPosition(X, Y)
		self.first_name_textbox.setHeight(H)
		self.first_name_textbox.setWidth(W)

		self.addControl(self.first_name_textbox)

		self.first_name_textbox.setText("FIRST NAME")
		self.secondWindow.append(self.first_name_textbox)
		
		#self.secondWindow.append(self.confirm_password_label)
		# last name entry
		W = 350
		H = 55
		X = int((FORM3_X)+490)
		Y = int((FORM3_Y)+100)
		self.last_name_textbox = xbmcgui.ControlEdit(X, Y, W, H, '', textColor="0xFF777777", focusTexture=self.image_txt_input_selc, noFocusTexture=self.image_txt_input_user, _alignment=6|4)
		self.last_name_textbox.setPosition(X, Y)
		self.last_name_textbox.setHeight(H)
		self.last_name_textbox.setWidth(W)
		self.addControl(self.last_name_textbox)
		self.last_name_textbox.setText("LAST NAME")
		self.secondWindow.append(self.last_name_textbox)
		X = int(X+W+10)
		Y = int(Y+10)
		self.error_names = xbmcgui.ControlImage(X, Y, 10, 10, self.image_input_err_star)
		self.addControl(self.error_names)
		self.error_names.setVisible(False)
		self.formerror.append(self.error_names)
		# email entry
		#old code
		#W = 340
		#H = 45
		#X = int((FORM3_X)+400)
		#Y = int((FORM3_Y)+165)
		#end
		W = 350
		H = 55
		X = int((FORM3_X)+490)
		Y = int((FORM3_Y)+190)
		self.create_email_textbox = xbmcgui.ControlEdit(X, Y, W, H, '', textColor="0xFF777777", focusTexture=self.image_txt_input_selc, noFocusTexture=self.image_txt_input_user_email, _alignment=6|4)
		self.create_email_textbox.setPosition(X, Y)
		self.create_email_textbox.setHeight(H)
		self.create_email_textbox.setWidth(W)
		self.addControl(self.create_email_textbox)
		self.create_email_textbox.setText("YOUR EMAIL ADDRESS")
		self.secondWindow.append(self.create_email_textbox)
		X = int(X+W+10)
		Y = int(Y+10)
		self.error_email = xbmcgui.ControlImage(X, Y, 10, 10, self.image_input_err_star)
		self.addControl(self.error_email)
		self.error_email.setVisible(False)
		self.formerror.append(self.error_email)
		# username entry
		#old code
		#W = 340
		#H = 45
		#X = int((FORM3_X)+400)
		#Y = int((FORM3_Y)+285)
		#end
		W = 350
		H = 55
		X = int((FORM3_X)+80)
		Y = int((FORM3_Y)+190)
		self.create_username_textbox = xbmcgui.ControlEdit(X, Y, W, H, '', textColor="0xFF777777", focusTexture=self.image_txt_input_selc, noFocusTexture=self.image_txt_input_user, _alignment=6|4)
		self.create_username_textbox.setPosition(X, Y)
		self.create_username_textbox.setHeight(H)
		self.create_username_textbox.setWidth(W)
		self.addControl(self.create_username_textbox)
		self.create_username_textbox.setText("CHOOSE A USER NAME")
		self.secondWindow.append(self.create_username_textbox)
		X = int(X+W+10)
		Y = int(Y+10)
		self.error_username = xbmcgui.ControlImage(X, Y, 10, 10, self.image_input_err_star)
		self.addControl(self.error_username)
		self.error_username.setVisible(False)
		self.formerror.append(self.error_username)
		# password entry
		# old code
		#W = 340
		#H = 45
		#X = int((FORM3_X)+400)
		#Y = int((FORM3_Y)+377)
		#end

		#create password position
		W = 350
		H = 55
		X = int((FORM3_X)+80)
		Y = int((FORM3_Y)+275)
		self.create_password_textbox = xbmcgui.ControlEdit(X, Y, W, H, '', textColor="0xFF777777", focusTexture=self.image_txt_input_selc, noFocusTexture=self.image_txt_input_user_pass, _alignment=6|4, isPassword=True)
		#self.create_password_textbox = xbmcgui.ControlEdit(X, Y, W, H, '', textColor="0xFF777777", focusTexture=self.image_txt_input_selc, noFocusTexture=self.image_txt_input_user_pass, _alignment=6|4)
		self.create_password_textbox.setPosition(X, Y)
		self.create_password_textbox.setHeight(H)
		self.create_password_textbox.setWidth(W)
		self.addControl(self.create_password_textbox)
		#self.create_password_textbox.setText("PASSWORD")
		self.secondWindow.append(self.create_password_textbox)
		X = int(X+W+10)
		Y = int(Y+10)
		self.error_password = xbmcgui.ControlImage(X, Y, 10, 10, self.image_input_err_star)
		self.addControl(self.error_password)
		self.error_password.setVisible(False)
		self.formerror.append(self.error_password)
		# confirm password entry
		#old code
		#W = 340
		#H = 45
		#X = int((FORM3_X)+400)
		#Y = int((FORM3_Y)+435)
		#end
		# confirm password points
		W = 350
		H = 55
		X = int((FORM3_X)+490)
		Y = int((FORM3_Y)+275)
		
		self.confirm_password_textbox = xbmcgui.ControlEdit(X, Y, W, H, '', textColor="0xFF777777", focusTexture=self.image_txt_input_selc, noFocusTexture=self.image_txt_input_user_pass, _alignment=6|4, isPassword=True)
		#self.confirm_password_textbox = xbmcgui.ControlEdit(X, Y, W, H, '', textColor="0xFF777777", focusTexture=self.image_txt_input_selc, noFocusTexture=self.image_txt_input_user_pass, _alignment=6|4)
		self.confirm_password_textbox.setPosition(X, Y)
		self.confirm_password_textbox.setHeight(H)
		self.confirm_password_textbox.setWidth(W)
		self.addControl(self.confirm_password_textbox)
		#self.confirm_password_textbox.setText("      CONFIRM YOUR PASSWORD")
		self.secondWindow.append(self.confirm_password_textbox)
		X = int(X+W+10)
		Y = int(Y+10)
		self.error_passwordconfirm = xbmcgui.ControlImage(X, Y, 10, 10, self.image_input_err_star)
		self.addControl(self.error_passwordconfirm)
		self.error_passwordconfirm.setVisible(False)
		self.formerror.append(self.error_passwordconfirm)
Ejemplo n.º 14
0
    def __init__(self, message):
        offsetX = 300
        offsetY = 200
        self.background = xbmcgui.ControlImage(x=offsetX,
                                               y=offsetY,
                                               width=700,
                                               height=300,
                                               filename=MEDIA_URL +
                                               "background.jpg")

        self.login = xbmcgui.ControlEdit(x=0,
                                         y=0,
                                         width=400,
                                         height=35,
                                         label="")
        self.login.setPosition(offsetX + 200, offsetY + 100)
        self.login.setWidth(400)
        self.login.setHeight(35)

        self.password = xbmcgui.ControlEdit(x=0,
                                            y=0,
                                            width=400,
                                            height=35,
                                            label="",
                                            isPassword=1)
        self.password.setPosition(offsetX + 200, offsetY + 150)
        self.password.setWidth(400)
        self.password.setHeight(35)

        self.ok = xbmcgui.ControlButton(x=offsetX + 200,
                                        y=offsetY + 200,
                                        width=300,
                                        height=35,
                                        label=translation(30022))

        self.addControl(self.background)
        self.addControl(
            xbmcgui.ControlLabel(x=offsetX + 50,
                                 y=offsetY + 50,
                                 width=600,
                                 height=35,
                                 label=message))
        self.addControl(
            xbmcgui.ControlLabel(x=offsetX + 50,
                                 y=offsetY + 100,
                                 width=150,
                                 height=35,
                                 label=translation(30020)))
        self.addControl(
            xbmcgui.ControlLabel(x=offsetX + 50,
                                 y=offsetY + 150,
                                 width=150,
                                 height=35,
                                 label=translation(30021)))
        self.addControl(self.login)
        self.addControl(self.password)
        self.addControl(self.ok)

        self.setFocus(self.login)
        self.login.controlDown(self.password)
        self.password.controlUp(self.login)
        self.password.controlDown(self.ok)
        self.ok.controlUp(self.login)

        self.resultLogin = ""
        self.resultPassword = ""