Ejemplo n.º 1
0
    def add_control_bool(self, c):
        # Versiones antiguas no admite algunas texturas
        if xbmcgui.__version__ in ["1.2", "2.0"]:
            control = xbmcgui.ControlRadioButton(0 - 10, -100, self.controls_width + 10, self.height_control,
                                                 label=c["label"], font=self.font, textColor=c["color"],
                                                 focusTexture=os.path.join(self.mediapath, 'Controls',
                                                                           'MenuItemFO.png'),
                                                 noFocusTexture=os.path.join(self.mediapath, 'Controls',
                                                                             'MenuItemNF.png'))
        else:
            control = xbmcgui.ControlRadioButton(0 - 10, -100, self.controls_width + 10,
                                                 self.height_control, label=c["label"], font=self.font,
                                                 textColor=c["color"],
                                                 focusTexture=os.path.join(self.mediapath, 'Controls',
                                                                           'MenuItemFO.png'),
                                                 noFocusTexture=os.path.join(self.mediapath, 'Controls',
                                                                             'MenuItemNF.png'),
                                                 focusOnTexture=os.path.join(self.mediapath, 'Controls',
                                                                             'radiobutton-focus.png'),
                                                 noFocusOnTexture=os.path.join(self.mediapath, 'Controls',
                                                                               'radiobutton-focus.png'),
                                                 focusOffTexture=os.path.join(self.mediapath, 'Controls',
                                                                              'radiobutton-nofocus.png'),
                                                 noFocusOffTexture=os.path.join(self.mediapath, 'Controls',
                                                                                'radiobutton-nofocus.png'))

        self.addControl(control)

        control.setVisible(False)
        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(self.values[c["id"]])

        c["control"] = control
Ejemplo n.º 2
0
 def __init__(self):
     self.addControl(
         xbmcgui.ControlImage(
             400, 300, 500, 100,
             'special://home/addons/plugin.video.kg-ontv/resources/media/background.png'
         ))
     self.strActionInfo = xbmcgui.ControlLabel(450, 300, 450, 200, '',
                                               'font14', 'F0FF00FF')
     self.addControl(self.strActionInfo)
     self.strActionInfo.setLabel('Для выхода из меню нажмите НАЗАД')
     self.player = xbmc.Player(xbmc.PLAYER_CORE_AUTO)
     self.playList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
     self.playListItem = self.playList[self.playList.getposition()]
     self.rusbutton = xbmcgui.ControlRadioButton(550,
                                                 340,
                                                 80,
                                                 40,
                                                 'Rus',
                                                 font='font14')
     self.engbutton = xbmcgui.ControlRadioButton(650,
                                                 340,
                                                 80,
                                                 40,
                                                 'Eng',
                                                 font='font14')
     self.addControl(self.rusbutton)
     self.addControl(self.engbutton)
     self.rusbutton.setSelected(True)
     self.setFocus(self.rusbutton)
Ejemplo n.º 3
0
    def add_control_bool(self, c):
        # Old versions do not support some textures
        if xbmcgui.__version__ in ["1.2", "2.0"]:
            control = xbmcgui.ControlRadioButton(0, -100, self.controls_width + 20, self.height_control,
                                                 label=c["label"], font=self.font, textColor=c["color"],
                                                 focusTexture=os.path.join(self.mediapath, 'Controls', 'MenuItemFO.png'),
                                                 noFocusTexture=os.path.join(self.mediapath, 'Controls', 'MenuItemNF.png'))
        else:
            control = xbmcgui.ControlRadioButton(0, -100, self.controls_width + 20,
                                                 self.height_control, label=c["label"], font=self.font,
                                                 textColor=c["color"],
                                                 focusTexture=os.path.join(self.mediapath, 'Controls', 'MenuItemFO.png'),
                                                 noFocusTexture=os.path.join(self.mediapath, 'Controls', 'MenuItemNF.png'),
                                                 focusOnTexture=os.path.join(self.mediapath, 'Controls', 'radiobutton-focus.png'),
                                                 noFocusOnTexture=os.path.join(self.mediapath, 'Controls', 'radiobutton-focus.png'),
                                                 focusOffTexture=os.path.join(self.mediapath, 'Controls', 'radiobutton-nofocus.png'),
                                                 noFocusOffTexture=os.path.join(self.mediapath, 'Controls', 'radiobutton-nofocus.png'))
       
        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.setRadioDimension(x=self.controls_width - (self.height_control - 5), y=0, width=self.height_control - 5, height=self.height_control - 5)
        control.setSelected(self.values[c["id"]])

        c["control"] = control
        c['image'] = image
Ejemplo n.º 4
0
 def __init__(self, *kargs):
     self.addControl(
         xbmcgui.ControlRadioButton(100,
                                    250,
                                    200,
                                    50,
                                    'Status',
                                    font='font14'))
     self.addControl(xbmcgui.ControlGroup(200, 250, 125, 75))
     self.addControl(
         xbmcgui.ControlTextBox(300, 250, 300, 300, textColor='0xFFFFFFFF'))
     '''noFocus  = sys.modules[ "__main__"].__root__ + '/icons/bookmarks.png'
Ejemplo n.º 5
0
 def __get_radio_button(self, x, y, label):
     kwargs = {
         'font': 'font12',
         'focusTexture': 'button-focus2.png',
         'noFocusTexture': 'button-nofocus.png',
         'focusOnTexture': 'radiobutton-focus.png',
         'noFocusOnTexture': 'radiobutton-focus.png',
         'focusOffTexture': 'radiobutton-nofocus.png',
         'noFocusOffTexture': 'radiobutton-nofocus.png'
     }
     temp = xbmcgui.ControlRadioButton(x, y, 450, 30, label, **kwargs)
     return temp
	def addChoice(self, label, ID):
		button = xbmcgui.ControlRadioButton(50, 50 + 50 * len(self.choiceButton), 600, 40, label)
		self.addControl(button)
		button.setSelected(True)

		if len(self.choiceButton) > 0:
			last = self.choiceButton[-1]
			last.controlDown(button)
			button.controlUp(last)

		button.controlRight(self.gather)

		self.choiceID.append(ID)
		self.choiceButton.append(button)
Ejemplo n.º 7
0
 def bool(self, label="", onclick=None, height=None):
     if not height:
         height = self.__rowh
     if not onclick:
         onclick = self.__null
     elem = xbmcgui.ControlRadioButton(0,
                                       0,
                                       0,
                                       0,
                                       "",
                                       focusTexture=_red,
                                       noFocusTexture=_white)
     self.__eid += 1
     self.__elems[self.__eid] = ("bool", label, onclick, None, height, elem)
     return self.__eid
Ejemplo n.º 8
0
    def __init__(self, settings=[]):
        x = 100
        y = 100
        h = 350
        w = 400
        hCnt = 30
        self.settings = settings
        self.saved = False
        mediaDir = os.path.join(os.getcwd().replace(";", ""),
                                'skin/Boxee Skin NG/media')
        rw = 1280
        rh = 720
        x = 640 - 200  #=440
        y = 360 - 175  #=185

        #y = 0
        #x = 0

        # Background
        self.imgBg = xbmcgui.ControlImage(
            0 + x - 30, 0 + y - 30, w + 60, h + 60,
            os.path.join(mediaDir, 'gs-bg-menu.png'))
        self.addControl(self.imgBg)

        # Settings
        self.labelSettings = xbmcgui.ControlLabel(0 + x,
                                                  0 + y,
                                                  w,
                                                  hCnt,
                                                  'Settings',
                                                  'font14',
                                                  '0xFFFFFFFF',
                                                  alignment=2)
        self.addControl(self.labelSettings)

        # Search
        self.labelSearch = xbmcgui.ControlLabel(5 + x,
                                                40 + y,
                                                w - 5,
                                                hCnt,
                                                'Search:',
                                                'font13',
                                                '0xFFFFFFFF',
                                                alignment=0)
        self.addControl(self.labelSearch)
        self.radioAlbums = xbmcgui.ControlRadioButton(
            20 + x,
            70 + y,
            w - 40,
            hCnt,
            'Only verified albums (disabled in API)',
            'button_focus.png',
            '',
            font='font12',
            textColor='0xFFFFFFFF')
        self.addControl(self.radioAlbums)
        self.radioSongs = xbmcgui.ControlRadioButton(
            20 + x,
            100 + y,
            w - 40,
            hCnt,
            'Exact match for songs (unimplemented)',
            'button_focus.png',
            '',
            font='font12',
            textColor='0xFFFFFFFF')
        self.addControl(self.radioSongs)

        # Login
        self.labelLogin = xbmcgui.ControlLabel(5 + x,
                                               140 + y,
                                               w,
                                               hCnt,
                                               'Login:'******'font13',
                                               '0xFFFFFFFF',
                                               alignment=0)
        self.addControl(self.labelLogin)
        self.btnUsername = xbmcgui.ControlButton(20 + x,
                                                 170 + y,
                                                 w - 40,
                                                 hCnt,
                                                 '',
                                                 'button_focus.png',
                                                 '',
                                                 font='font12',
                                                 textColor='0xFFFFFFFF')
        self.addControl(self.btnUsername)
        self.btnPassword = xbmcgui.ControlButton(20 + x,
                                                 200 + y,
                                                 w - 40,
                                                 hCnt,
                                                 '',
                                                 'button_focus.png',
                                                 '',
                                                 font='font12',
                                                 textColor='0xFFFFFFFF')
        self.addControl(self.btnPassword)

        # Debug
        self.labelDebug = xbmcgui.ControlLabel(5 + x,
                                               240 + y,
                                               w - 5,
                                               hCnt,
                                               'Debug:',
                                               'font13',
                                               '0xFFFFFFFF',
                                               alignment=0)
        self.addControl(self.labelDebug)
        self.radioDebug = xbmcgui.ControlRadioButton(
            20 + x,
            270 + y,
            w - 40,
            hCnt,
            'Turn on debugging (restart script)',
            'button_focus.png',
            '',
            font='font12',
            textColor='0xFFFFFFFF')
        self.addControl(self.radioDebug)

        # Buttons
        self.btnSave = xbmcgui.ControlButton(150 + x,
                                             310 + y,
                                             100,
                                             hCnt,
                                             'Save',
                                             'button_focus.png',
                                             '',
                                             font='font12',
                                             textColor='0xFFFFFFFF',
                                             alignment=2)
        self.addControl(self.btnSave)

        self.setControls(self.settings)

        self.setFocus(self.radioAlbums)
Ejemplo n.º 9
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)
        def __init__(self,
                     msg='',
                     L=0,
                     T=0,
                     W=1280,
                     H=720,
                     TxtColor='0xFFFFFFFF',
                     Font='font12',
                     BorderWidth=10):
            buttonfocus, buttonnofocus = artwork('button')
            radiobgfocus, radiobgnofocus, radiofocus, radionofocus = artwork(
                'radio')
            slidernibfocus, slidernibnofocus, sliderfocus, slidernofocus = artwork(
                'slider')
            image_path = os.path.join(ART, 'ContentPanel.png')
            boxbg = os.path.join(ART, 'bgg2.png')
            self.border = xbmcgui.ControlImage(L, T, W, H, image_path)
            self.addControl(self.border)
            self.BG = xbmcgui.ControlImage(L + BorderWidth,
                                           T + BorderWidth,
                                           W - (BorderWidth * 2),
                                           H - (BorderWidth * 2),
                                           FANART,
                                           aspectRatio=0,
                                           colorDiffuse='0x5FFFFFFF')
            self.addControl(self.BG)
            top = T + BorderWidth
            leftside = L + BorderWidth
            rightside = L + (W / 2) - (BorderWidth * 2)
            firstrow = top + 30
            secondrow = firstrow + 275 + (BorderWidth / 2)
            currentwidth = ((W / 2) - (BorderWidth * 4)) / 2

            header = '[COLOR %s]Assistente de Configuracoes Avancadas[/COLOR]' % (
                COLOR2)
            self.Header = xbmcgui.ControlLabel(L,
                                               top,
                                               W,
                                               30,
                                               header,
                                               font='font13',
                                               textColor=TxtColor,
                                               alignment=0x00000002)
            self.addControl(self.Header)
            top += 30 + BorderWidth
            self.bgarea = xbmcgui.ControlImage(leftside,
                                               firstrow,
                                               rightside - L,
                                               275,
                                               boxbg,
                                               aspectRatio=0,
                                               colorDiffuse='0x5FFFFFFF')
            self.addControl(self.bgarea)
            self.bgarea2 = xbmcgui.ControlImage(rightside + BorderWidth +
                                                BorderWidth,
                                                firstrow,
                                                rightside - L,
                                                275,
                                                boxbg,
                                                aspectRatio=0,
                                                colorDiffuse='0x5FFFFFFF')
            self.addControl(self.bgarea2)
            self.bgarea3 = xbmcgui.ControlImage(leftside,
                                                secondrow,
                                                rightside - L,
                                                275,
                                                boxbg,
                                                aspectRatio=0,
                                                colorDiffuse='0x5FFFFFFF')
            self.addControl(self.bgarea3)
            self.bgarea4 = xbmcgui.ControlImage(rightside + BorderWidth +
                                                BorderWidth,
                                                secondrow,
                                                rightside - L,
                                                275,
                                                boxbg,
                                                aspectRatio=0,
                                                colorDiffuse='0x5FFFFFFF')
            self.addControl(self.bgarea4)

            header = '[COLOR %s]Tamanho do Cache de Video[/COLOR]' % (COLOR2)
            self.Header2 = xbmcgui.ControlLabel(leftside + BorderWidth,
                                                firstrow + 5,
                                                (W / 2) - (BorderWidth * 2),
                                                20,
                                                header,
                                                font='font13',
                                                textColor=TxtColor,
                                                alignment=0x00000002)
            self.addControl(self.Header2)
            freeMemory = int(
                float(wiz.getInfo('System.Memory(free)')[:-2]) * .33)
            recMemory = int(
                float(wiz.getInfo('System.Memory(free)')[:-2]) * .23)
            msg3 = "[COLOR %s]Numero de bytes usados para armazenar em buffer fluxos na memoria. Quando definido para [COLOR %s]0[/COLOR] O Cache Sera Gravado em Disco em Vez da RAM.  Nota: Para o Tamanho da Memoria Definido Aqui, o Kodi Exigira 3x a Quantidade de Memoria RAM  Livre. Configurar Isso Muito Alto Pode Fazer com que o Kodi Trave se Nao Conseguir Memoria RAM suficiente (1/3 da Memoria livre): [COLOR %s]%s[/COLOR])[/COLOR]" % (
                COLOR2, COLOR1, COLOR1, freeMemory)
            self.Support3 = xbmcgui.ControlTextBox(
                leftside + int(BorderWidth * 1.5),
                firstrow + 30 + BorderWidth, (W / 2) - (BorderWidth * 4),
                150,
                font='font12',
                textColor=TxtColor)
            self.addControl(self.Support3)
            self.Support3.setText(msg3)
            try:
                self.videoCacheSize = xbmcgui.ControlSlider(
                    leftside + int(BorderWidth * 1.5),
                    firstrow + 210, (W / 2) - (BorderWidth * 5),
                    20,
                    textureback=sliderfocus,
                    texture=slidernibnofocus,
                    texturefocus=slidernibfocus,
                    orientation=xbmcgui.HORIZONTAL)
            except:
                self.videoCacheSize = xbmcgui.ControlSlider(
                    leftside + int(BorderWidth * 1.5),
                    firstrow + 210, (W / 2) - (BorderWidth * 5),
                    20,
                    textureback=sliderfocus,
                    texture=slidernibnofocus,
                    texturefocus=slidernibfocus)
            self.addControl(self.videoCacheSize)
            self.videomin = 0
            self.videomax = freeMemory if freeMemory < 2000 else 2000
            self.recommendedVideo = recMemory if recMemory < 500 else 500
            self.currentVideo = self.recommendedVideo
            videopos = wiz.percentage(self.currentVideo, self.videomax)
            self.videoCacheSize.setPercent(videopos)
            current1 = '[COLOR %s]Atual:[/COLOR] [COLOR %s]%s MB[/COLOR]' % (
                COLOR1, COLOR2, self.currentVideo)
            recommended1 = '[COLOR %s]Recomendado:[/COLOR] [COLOR %s]%s MB[/COLOR]' % (
                COLOR1, COLOR2, self.recommendedVideo)
            self.currentVideo1 = xbmcgui.ControlTextBox(leftside + BorderWidth,
                                                        firstrow + 235,
                                                        currentwidth,
                                                        20,
                                                        font=Font,
                                                        textColor=TxtColor)
            self.addControl(self.currentVideo1)
            self.currentVideo1.setText(current1)
            self.recommendedVideo1 = xbmcgui.ControlTextBox(
                leftside + BorderWidth + currentwidth,
                firstrow + 235,
                currentwidth,
                20,
                font=Font,
                textColor=TxtColor)
            self.addControl(self.recommendedVideo1)
            self.recommendedVideo1.setText(recommended1)

            header = '[COLOR %s]CURL Timeout/CURL Low Speed[/COLOR]' % (COLOR2)
            self.Header3 = xbmcgui.ControlLabel(rightside + BorderWidth,
                                                firstrow + 5,
                                                (W / 2) - (BorderWidth * 2),
                                                20,
                                                header,
                                                font='font13',
                                                textColor=TxtColor,
                                                alignment=0x00000002)
            self.addControl(self.Header3)
            msg3 = "[COLOR %s][B]curlclienttimeout[/B] e o Tempo em Segundos Para Quanto Tempo Leva Para a Conexao Liberar, Sera Tempo Limite e [B]curllowspeedtime[/B] e o Tempo em Segundos Para o libcurl Considerar uma Conexao de Velocidade Baixa. Para Conexoes Mais Lentas, Defina-o como 20.[/COLOR]" % COLOR2
            self.Support3 = xbmcgui.ControlTextBox(
                rightside + int(BorderWidth * 3.5),
                firstrow + 30 + BorderWidth, (W / 2) - (BorderWidth * 4),
                150,
                font='font12',
                textColor=TxtColor)
            self.addControl(self.Support3)
            self.Support3.setText(msg3)
            try:
                self.CURLTimeout = xbmcgui.ControlSlider(
                    rightside + int(BorderWidth * 3.5),
                    firstrow + 210, (W / 2) - (BorderWidth * 5),
                    20,
                    textureback=sliderfocus,
                    texture=slidernibnofocus,
                    texturefocus=slidernibfocus,
                    orientation=xbmcgui.HORIZONTAL)
            except:
                self.CURLTimeout = xbmcgui.ControlSlider(
                    rightside + int(BorderWidth * 3.5),
                    firstrow + 210, (W / 2) - (BorderWidth * 5),
                    20,
                    textureback=sliderfocus,
                    texture=slidernibnofocus,
                    texturefocus=slidernibfocus)
            self.addControl(self.CURLTimeout)
            self.curlmin = 0
            self.curlmax = 20
            self.recommendedCurl = 10
            self.currentCurl = self.recommendedCurl
            curlpos = wiz.percentage(self.currentCurl, self.curlmax)
            self.CURLTimeout.setPercent(curlpos)
            current2 = '[COLOR %s]Atual:[/COLOR] [COLOR %s]%ss[/COLOR]' % (
                COLOR1, COLOR2, self.currentCurl)
            recommended2 = '[COLOR %s]Recomendado:[/COLOR] [COLOR %s]%ss[/COLOR]' % (
                COLOR1, COLOR2, self.recommendedCurl)
            self.currentCurl2 = xbmcgui.ControlTextBox(rightside +
                                                       (BorderWidth * 3),
                                                       firstrow + 235,
                                                       currentwidth,
                                                       20,
                                                       font=Font,
                                                       textColor=TxtColor)
            self.addControl(self.currentCurl2)
            self.currentCurl2.setText(current2)
            self.recommendedCurl2 = xbmcgui.ControlTextBox(
                rightside + (BorderWidth * 3) + currentwidth,
                firstrow + 235,
                currentwidth,
                20,
                font=Font,
                textColor=TxtColor)
            self.addControl(self.recommendedCurl2)
            self.recommendedCurl2.setText(recommended2)

            header = '[COLOR %s]Read Buffer Factor[/COLOR]' % (COLOR2)
            self.Header4 = xbmcgui.ControlLabel(leftside,
                                                secondrow + 5,
                                                (W / 2) - (BorderWidth * 2),
                                                20,
                                                header,
                                                font='font13',
                                                textColor=TxtColor,
                                                alignment=0x00000002)
            self.addControl(self.Header4)
            msg3 = "[COLOR %s]The value of this setting is a multiplier of the default limit. If Kodi is loading a typical bluray raw file at 36 Mbit/s, then a value of 2 will need at least 72 Mbit/s of network bandwidth. However, unlike with the RAM setting, you can safely increase this value however high you want, and Kodi won't crash.[/COLOR]" % COLOR2
            self.Support3 = xbmcgui.ControlTextBox(
                leftside + int(BorderWidth * 1.5),
                secondrow + 30 + BorderWidth, (W / 2) - (BorderWidth * 4),
                150,
                font='font12',
                textColor=TxtColor)
            self.addControl(self.Support3)
            self.Support3.setText(msg3)
            try:
                self.readBufferFactor = xbmcgui.ControlSlider(
                    leftside + int(BorderWidth * 1.5),
                    secondrow + 210, (W / 2) - (BorderWidth * 5),
                    20,
                    textureback=sliderfocus,
                    texture=slidernibnofocus,
                    texturefocus=slidernibfocus,
                    orientation=xbmcgui.HORIZONTAL)
            except:
                self.readBufferFactor = xbmcgui.ControlSlider(
                    leftside + int(BorderWidth * 1.5),
                    secondrow + 210, (W / 2) - (BorderWidth * 5),
                    20,
                    textureback=sliderfocus,
                    texture=slidernibnofocus,
                    texturefocus=slidernibfocus)
            self.addControl(self.readBufferFactor)
            self.readmin = 0
            self.readmax = 10
            self.recommendedRead = 5
            self.currentRead = self.recommendedRead
            readpos = wiz.percentage(self.currentRead, self.readmax)
            self.readBufferFactor.setPercent(readpos)
            current3 = '[COLOR %s]Current:[/COLOR] [COLOR %s]%s[/COLOR]' % (
                COLOR1, COLOR2, self.currentRead)
            recommended3 = '[COLOR %s]Recommended:[/COLOR] [COLOR %s]%s[/COLOR]' % (
                COLOR1, COLOR2, self.recommendedRead)
            self.currentRead3 = xbmcgui.ControlTextBox(leftside + BorderWidth,
                                                       secondrow + 235,
                                                       currentwidth,
                                                       20,
                                                       font=Font,
                                                       textColor=TxtColor)
            self.addControl(self.currentRead3)
            self.currentRead3.setText(current3)
            self.recommendedRead3 = xbmcgui.ControlTextBox(
                leftside + BorderWidth + currentwidth,
                secondrow + 235,
                currentwidth,
                20,
                font=Font,
                textColor=TxtColor)
            self.addControl(self.recommendedRead3)
            self.recommendedRead3.setText(recommended3)

            header = '[COLOR %s]Buffer Mode[/COLOR]' % (COLOR2)
            self.Header4 = xbmcgui.ControlLabel(rightside + BorderWidth,
                                                secondrow + 5,
                                                (W / 2) - (BorderWidth * 2),
                                                20,
                                                header,
                                                font='font13',
                                                textColor=TxtColor,
                                                alignment=0x00000002)
            self.addControl(self.Header4)
            msg4 = "[COLOR %s]This setting will force Kodi to use a cache for all video files, including local network, internet, and even the local hard drive. Default value is 0 and will only cache videos that use internet file paths/sources.[/COLOR]" % COLOR2
            self.Support4 = xbmcgui.ControlTextBox(
                rightside + int(BorderWidth * 3.5),
                secondrow + 30 + BorderWidth, (W / 2) - (BorderWidth * 4),
                110,
                font='font12',
                textColor=TxtColor)
            self.addControl(self.Support4)
            self.Support4.setText(msg4)
            B1 = secondrow + 130 + BorderWidth
            B2 = B1 + 30
            B3 = B2 + 30
            B4 = B3 + 30
            self.Button0 = xbmcgui.ControlRadioButton(
                rightside + (BorderWidth * 3),
                B1, (W / 2) - (BorderWidth * 4),
                30,
                '0: Buffer all internet filesystems',
                font='font12',
                focusTexture=radiobgfocus,
                noFocusTexture=radiobgnofocus,
                focusOnTexture=radiofocus,
                noFocusOnTexture=radiofocus,
                focusOffTexture=radionofocus,
                noFocusOffTexture=radionofocus)
            self.Button1 = xbmcgui.ControlRadioButton(
                rightside + (BorderWidth * 3),
                B2, (W / 2) - (BorderWidth * 4),
                30,
                '1: Buffer all filesystems',
                font='font12',
                focusTexture=radiobgfocus,
                noFocusTexture=radiobgnofocus,
                focusOnTexture=radiofocus,
                noFocusOnTexture=radiofocus,
                focusOffTexture=radionofocus,
                noFocusOffTexture=radionofocus)
            self.Button2 = xbmcgui.ControlRadioButton(
                rightside + (BorderWidth * 3),
                B3, (W / 2) - (BorderWidth * 4),
                30,
                '2: Only buffer true internet filesystems',
                font='font12',
                focusTexture=radiobgfocus,
                noFocusTexture=radiobgnofocus,
                focusOnTexture=radiofocus,
                noFocusOnTexture=radiofocus,
                focusOffTexture=radionofocus,
                noFocusOffTexture=radionofocus)
            self.Button3 = xbmcgui.ControlRadioButton(
                rightside + (BorderWidth * 3),
                B4, (W / 2) - (BorderWidth * 4),
                30,
                '3: No Buffer',
                font='font12',
                focusTexture=radiobgfocus,
                noFocusTexture=radiobgnofocus,
                focusOnTexture=radiofocus,
                noFocusOnTexture=radiofocus,
                focusOffTexture=radionofocus,
                noFocusOffTexture=radionofocus)
            self.addControl(self.Button0)
            self.addControl(self.Button1)
            self.addControl(self.Button2)
            self.addControl(self.Button3)
            self.Button0.setSelected(False)
            self.Button1.setSelected(False)
            self.Button2.setSelected(True)
            self.Button3.setSelected(False)

            self.buttonWrite = xbmcgui.ControlButton(
                leftside,
                T + H - 40 - BorderWidth, (W / 2) - (BorderWidth * 2),
                35,
                "Write File",
                textColor="0xFF000000",
                focusedColor="0xFF000000",
                alignment=2,
                focusTexture=buttonfocus,
                noFocusTexture=buttonnofocus)
            self.buttonCancel = xbmcgui.ControlButton(
                rightside + BorderWidth * 2,
                T + H - 40 - BorderWidth, (W / 2) - (BorderWidth * 2),
                35,
                "Cancelar",
                textColor="0xFF000000",
                focusedColor="0xFF000000",
                alignment=2,
                focusTexture=buttonfocus,
                noFocusTexture=buttonnofocus)
            self.addControl(self.buttonWrite)
            self.addControl(self.buttonCancel)

            self.buttonWrite.controlLeft(self.buttonCancel)
            self.buttonWrite.controlRight(self.buttonCancel)
            self.buttonWrite.controlUp(self.Button3)
            self.buttonWrite.controlDown(self.videoCacheSize)
            self.buttonCancel.controlLeft(self.buttonWrite)
            self.buttonCancel.controlRight(self.buttonWrite)
            self.buttonCancel.controlUp(self.Button3)
            self.buttonCancel.controlDown(self.videoCacheSize)
            self.videoCacheSize.controlUp(self.buttonWrite)
            self.videoCacheSize.controlDown(self.CURLTimeout)
            self.CURLTimeout.controlUp(self.videoCacheSize)
            self.CURLTimeout.controlDown(self.readBufferFactor)
            self.readBufferFactor.controlUp(self.CURLTimeout)
            self.readBufferFactor.controlDown(self.Button0)
            self.Button0.controlUp(self.CURLTimeout)
            self.Button0.controlDown(self.Button1)
            self.Button0.controlLeft(self.readBufferFactor)
            self.Button0.controlRight(self.readBufferFactor)
            self.Button1.controlUp(self.Button0)
            self.Button1.controlDown(self.Button2)
            self.Button1.controlLeft(self.readBufferFactor)
            self.Button1.controlRight(self.readBufferFactor)
            self.Button2.controlUp(self.Button1)
            self.Button2.controlDown(self.Button3)
            self.Button2.controlLeft(self.readBufferFactor)
            self.Button2.controlRight(self.readBufferFactor)
            self.Button3.controlUp(self.Button2)
            self.Button3.controlDown(self.buttonWrite)
            self.Button3.controlLeft(self.readBufferFactor)
            self.Button3.controlRight(self.readBufferFactor)
            self.setFocus(self.videoCacheSize)
Ejemplo n.º 11
0
    def __init__(self, control, coords=(0, 0), anim=[], **kwargs):
        self.controlXML = control
        self.id = self.controlXML.getId()
        self.label = xbmc.getInfoLabel("Control.GetLabel(%i)" % self.id)
        self.anim = anim

        try:
            extra = dict([k.split("=") for k in self.label.split(",")])
        except:
            extra = {}
        option = {}
        x, y, w, h = self.getCoords(coords)

        # ATTENTION: in Frodo from Oct. 26th 2012 type(self.controlXML) is always xbmcgui.Control!!!
        # Therefore the test for the ID of the control.

        if type(self.controlXML
                ) == xbmcgui.ControlImage or self.controlXML.getId() in [2001]:
            # http://passion-xbmc.org/gros_fichiers/XBMC%20Python%20Doc/xbmc_svn/xbmcgui.html#ControlImage
            texture = self.label
            valideOption = "colorKey, aspectRatio, colorDiffuse".split(", ")
            for key, value in extra.items():
                key, value = key.strip(), value.strip()
                if key == "texture": texture = value
                if key not in valideOption: continue
                option[key] = value
                if "color" in key.lower():
                    option[key] = '0x' + value
                elif key == "aspectRatio" and value.isdigit():
                    option[key] = int(value)
            texture = getTexture(texture)
            # ControlImage( x, y, width, height, filename[, colorKey, aspectRatio, colorDiffuse] )
            self.control = xbmcgui.ControlImage(x, y, w, h, texture, **option)

        elif type(self.controlXML
                  ) == xbmcgui.ControlLabel or self.controlXML.getId() in [
                      1999, 2002, 2003, 2045
                  ]:
            # http://passion-xbmc.org/gros_fichiers/XBMC%20Python%20Doc/xbmc_svn/xbmcgui.html#ControlLabel
            valideOption = "font, textColor, disabledColor, alignment, hasPath, angle".split(
                ", ")
            for key, value in extra.items():
                key, value = key.strip(), value.strip()
                if key not in valideOption: continue
                option[key] = value
                if "color" in key.lower():
                    option[key] = '0x' + value
                elif key == "alignment":
                    option[key] = self.getAlignment(value)
                elif key == "hasPath" and value == "true":
                    option[key] = True
                elif key == "angle" and value.isdigit():
                    option[key] = int(value)
            # ControlLabel(x, y, width, height, label[, font, textColor, disabledColor, alignment, hasPath, angle])
            self.control = xbmcgui.ControlLabel(x, y, w, h, "", **option)

        elif type(self.controlXML
                  ) == xbmcgui.ControlProgress or self.controlXML.getId() in [
                      2004, 2005
                  ]:
            # http://passion-xbmc.org/gros_fichiers/XBMC%20Python%20Doc/xbmc_svn/xbmcgui.html#ControlProgress
            valideOption = "texturebg, textureleft, texturemid, textureright, textureoverlay".split(
                ", ")
            for key, value in kwargs.items():
                key, value = key.strip(), value.strip()
                if key not in valideOption: continue
                option[key] = getTexture(value)
            # ControlProgress(x, y, width, height[, texturebg, textureleft, texturemid, textureright, textureoverlay])
            self.control = xbmcgui.ControlProgress(x, y, w, h, **option)

        elif type(self.controlXML) in [
                xbmcgui.ControlButton, xbmcgui.ControlRadioButton
        ] or self.controlXML.getId() == 2006:
            # http://passion-xbmc.org/gros_fichiers/XBMC%20Python%20Doc/xbmc_svn/xbmcgui.html#ControlRadioButton
            # ControlRadioButton(x, y, width, height, label[, focusTexture, noFocusTexture, textOffsetX, textOffsetY, alignment, font, textColor, disabledColor, angle, shadowColor, focusedColor, TextureRadioFocus, TextureRadioNoFocus])
            option = {"TextureRadioFocus": "", "TextureRadioNoFocus": ""}
            # http://passion-xbmc.org/gros_fichiers/XBMC%20Python%20Doc/xbmc_svn/xbmcgui.html#ControlButton
            # ControlButton(x, y, width, height, label[, focusTexture, noFocusTexture, textOffsetX, textOffsetY, alignment, font, textColor, disabledColor, angle, shadowColor, focusedColor])
            valideOption = "focusTexture, noFocusTexture, textOffsetX, textOffsetY, alignment, font, textColor, disabledColor, angle, shadowColor, focusedColor, TextureRadioFocus, TextureRadioNoFocus".split(
                ", ")
            for key, value in extra.items():
                key, value = key.strip(), value.strip()
                if key not in valideOption: continue
                option[key] = value
                if "color" in key.lower():
                    option[key] = '0x' + value
                elif key == "alignment":
                    option[key] = self.getAlignment(value)
                elif key in "focusTexture,noFocusTexture,TextureRadioFocus,TextureRadioNoFocus".split(
                        ","):
                    option[key] = getTexture(value)
                elif key in "angle,textOffsetX,textOffsetY".split(
                        ",") and value.isdigit():
                    option[key] = int(value)
            self.control = xbmcgui.ControlRadioButton(x, y, w, h, "", **option)
            # used for cancel scan ( iscanceled = self.control.isSelected() )
            self.control.setSelected(False)
Ejemplo n.º 12
0
        def __init__(self, *args, **kwargs):
            logger.debug()

            #### Compatibilidad con Kodi 18 ####
            if config.get_platform(True)['num_version'] < 18:
                if xbmcgui.__version__ == "1.2":
                    self.setCoordinateResolution(1)
                else:
                    self.setCoordinateResolution(5)

            self.show = kwargs.get("show")
            self.channel = kwargs.get("channel")
            self.data = kwargs.get("data")
            self.init = True

            self.mediapath = os.path.join(config.get_runtime_path(), 'resources', 'skins', 'Default', 'media')
            self.font = "font12"

            window_bg = xbmcgui.ControlImage(320, 130, 600, 440,
                                             os.path.join(self.mediapath, 'Windows', 'DialogBack.png'))
            self.addControl(window_bg)

            header_bg = xbmcgui.ControlImage(window_bg.getX(), window_bg.getY() + 8, window_bg.getWidth(), 35,
                                             os.path.join(self.mediapath, 'Windows', 'dialogheader.png'))
            self.addControl(header_bg)

            btn_close_w = 64
            self.btn_close = xbmcgui.ControlButton(window_bg.getX() + window_bg.getWidth() - btn_close_w - 13,
                                                   header_bg.getY() + 6, btn_close_w, 30, '',
                                                   focusTexture=os.path.join(self.mediapath, 'Controls',
                                                                             'DialogCloseButton-focus.png'),
                                                   noFocusTexture=os.path.join(self.mediapath, 'Controls',
                                                                               'DialogCloseButton.png'))
            self.addControl(self.btn_close)

            header_title_x = window_bg.getX() + 20
            header_title = xbmcgui.ControlFadeLabel(header_title_x, header_bg.getY() + 5, self.btn_close.getX() -
                                                    header_title_x, 30, font="font12_title", textColor="0xFFFFA500",
                                                    _alignment=ALIGN_CENTER)
            self.addControl(header_title)
            header_title.addLabel(self.show)

            self.controls_bg = xbmcgui.ControlImage(window_bg.getX() + 20, header_bg.getY() + header_bg.getHeight() + 6,
                                                    562, 260,
                                                    os.path.join(self.mediapath, 'Windows', 'BackControls.png'))
            self.addControl(self.controls_bg)

            self.scroll_bg = xbmcgui.ControlImage(window_bg.getX() + window_bg.getWidth() - 25, self.controls_bg.getY(),
                                                  10,
                                                  self.controls_bg.getHeight(), os.path.join(self.mediapath, 'Controls',
                                                                                             'ScrollBack.png'))
            self.addControl(self.scroll_bg)
            self.scroll_bg.setVisible(False)

            self.scroll2_bg = xbmcgui.ControlImage(window_bg.getX() + window_bg.getWidth() - 25,
                                                   self.controls_bg.getY(),
                                                   10, self.controls_bg.getHeight(), os.path.join(self.mediapath,
                                                                                                  'Controls',
                                                                                                  'ScrollBar.png'))
            self.addControl(self.scroll2_bg)
            self.scroll2_bg.setVisible(False)

            btn_add_season = xbmcgui.ControlButton(window_bg.getX() + 20, self.controls_bg.getY() +
                                                   self.controls_bg.getHeight() + 14, 165, 30, 'Añadir Temporada',
                                                   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_add_season)

            self.btn_info = xbmcgui.ControlButton(window_bg.getX() + 210, btn_add_season.getY(), 120, 30, 'Información',
                                                  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(self.btn_info)

            check_update_internet_w = 235
            # Versiones antiguas no admite algunas texturas
            if xbmcgui.__version__ in ["1.2", "2.0"]:
                self.check_update_internet = xbmcgui.ControlRadioButton(
                    window_bg.getX() + window_bg.getWidth() - check_update_internet_w - 20, btn_add_season.getY() - 3,
                    check_update_internet_w, 34, "Actualizar desde Internet:", font=self.font,
                    focusTexture=os.path.join(self.mediapath, 'Controls', 'MenuItemFO.png'),
                    noFocusTexture=os.path.join(self.mediapath, 'Controls', 'MenuItemNF.png'))
            else:
                self.check_update_internet = xbmcgui.ControlRadioButton(
                    window_bg.getX() + window_bg.getWidth() - check_update_internet_w - 20, btn_add_season.getY() - 3,
                    check_update_internet_w, 34, "Actualizar desde Internet:", font=self.font,
                    focusTexture=os.path.join(self.mediapath, 'Controls', 'MenuItemFO.png'),
                    noFocusTexture=os.path.join(self.mediapath, 'Controls', 'MenuItemNF.png'),
                    focusOnTexture=os.path.join(self.mediapath, 'Controls', 'radiobutton-focus.png'),
                    noFocusOnTexture=os.path.join(self.mediapath, 'Controls', 'radiobutton-focus.png'),
                    focusOffTexture=os.path.join(self.mediapath, 'Controls', 'radiobutton-nofocus.png'),
                    noFocusOffTexture=os.path.join(self.mediapath, 'Controls', 'radiobutton-nofocus.png'))

            self.addControl(self.check_update_internet)
            self.check_update_internet.setEnabled(False)

            hb_bg = xbmcgui.ControlImage(window_bg.getX() + 20, btn_add_season.getY() + btn_add_season.getHeight() + 13,
                                         window_bg.getWidth() - 40, 2,
                                         os.path.join(self.mediapath, 'Controls', 'ScrollBack.png'))
            self.addControl(hb_bg)

            self.btn_ok = xbmcgui.ControlButton(window_bg.getX() + 68, hb_bg.getY() + hb_bg.getHeight() + 13, 120, 30,
                                                'OK', 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(self.btn_ok)

            self.btn_cancel = xbmcgui.ControlButton(self.btn_info.getX() + 30, self.btn_ok.getY(), 120, 30, 'Cancelar',
                                                    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(self.btn_cancel)

            self.btn_delete = xbmcgui.ControlButton(self.btn_cancel.getX() + self.btn_cancel.getWidth() + 50,
                                                    self.btn_ok.getY(), 120, 30, 'Borrar', 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(self.btn_delete)

            self.controls = []
            self.onInit()
            self.setFocus(self.controls[0].edit_season)
            self.doModal()
Ejemplo n.º 13
0
		def __init__(self,msg='',L=0,T=0,W=1280,H=720,TxtColor='0xFFFFFFFF',Font='font12',BorderWidth=10):
			buttonfocus, buttonnofocus = artwork('button')
			radiobgfocus, radiobgnofocus, radiofocus, radionofocus = artwork('radio')
			slidernibfocus, slidernibnofocus, sliderfocus, slidernofocus = artwork('slider')
			image_path = os.path.join(ART, 'ContentPanel.png')
			boxbg = os.path.join(ART, 'bgg2.png')
			self.border = xbmcgui.ControlImage(L,T,W,H, image_path)
			self.addControl(self.border); 
			self.BG=xbmcgui.ControlImage(L+BorderWidth,T+BorderWidth,W-(BorderWidth*2),H-(BorderWidth*2), FANART, aspectRatio=0, colorDiffuse='0x5FFFFFFF')
			self.addControl(self.BG)
			top = T+BorderWidth
			leftside = L+BorderWidth
			rightside = L+(W/2)-(BorderWidth*2)
			firstrow = top+30
			secondrow = firstrow+275+(BorderWidth/2)
			currentwidth = ((W/2)-(BorderWidth*4))/2
			
			header = '[COLOR %s]Configurador de Advanced Settings[/COLOR]' % (COLOR2)
			self.Header=xbmcgui.ControlLabel(L, top, W, 30, header, font='font13', textColor=TxtColor, alignment=0x00000002)
			self.addControl(self.Header)
			top += 30+BorderWidth
			self.bgarea = xbmcgui.ControlImage(leftside, firstrow, rightside-L, 275, boxbg, aspectRatio=0, colorDiffuse='0x5FFFFFFF')
			self.addControl(self.bgarea)
			self.bgarea2 = xbmcgui.ControlImage(rightside+BorderWidth+BorderWidth, firstrow, rightside-L, 275, boxbg, aspectRatio=0, colorDiffuse='0x5FFFFFFF')
			self.addControl(self.bgarea2)
			self.bgarea3 = xbmcgui.ControlImage(leftside, secondrow, rightside-L, 275, boxbg, aspectRatio=0, colorDiffuse='0x5FFFFFFF')
			self.addControl(self.bgarea3)
			self.bgarea4 = xbmcgui.ControlImage(rightside+BorderWidth+BorderWidth, secondrow, rightside-L, 275, boxbg, aspectRatio=0, colorDiffuse='0x5FFFFFFF')
			self.addControl(self.bgarea4)
			
			header = '[COLOR %s]Tamano de Video Cache[/COLOR]' % (COLOR2)
			self.Header2=xbmcgui.ControlLabel(leftside+BorderWidth, firstrow+5, (W/2)-(BorderWidth*2), 20, header, font='font13', textColor=TxtColor, alignment=0x00000002)
			self.addControl(self.Header2)
			freeMemory = int(float(wiz.getInfo('System.Memory(free)')[:-2])*.33)
			recMemory = int(float(wiz.getInfo('System.Memory(free)')[:-2])*.23)
			msg3 = "[COLOR %s]Numero de bytes usados en el buffer.  Cuando esta puesto a [COLOR %s]0[/COLOR] la cache usa todo el disco en lugar de la RAM.  Nota: Normalmente Kodi requiere 1/3 veces la cantidad de RAM del equipo como cache. Poner este valor demasiado alto puede causar un crasheo de Kodi (1/3 de Memoria RAM libre: [COLOR %s]%s[/COLOR])[/COLOR]" % (COLOR2, COLOR1, COLOR1, freeMemory)
			self.Support3=xbmcgui.ControlTextBox(leftside+int(BorderWidth*1.5), firstrow+30+BorderWidth, (W/2)-(BorderWidth*4), 150, font='font12', textColor=TxtColor)
			self.addControl(self.Support3)
			self.Support3.setText(msg3)
			try: self.videoCacheSize=xbmcgui.ControlSlider(leftside+int(BorderWidth*1.5), firstrow+210,(W/2)-(BorderWidth*5),20, textureback=sliderfocus, texture=slidernibnofocus, texturefocus=slidernibfocus, orientation=xbmcgui.HORIZONTAL)
			except: self.videoCacheSize=xbmcgui.ControlSlider(leftside+int(BorderWidth*1.5), firstrow+210,(W/2)-(BorderWidth*5),20, textureback=sliderfocus, texture=slidernibnofocus, texturefocus=slidernibfocus)
			self.addControl(self.videoCacheSize)
			self.videomin = 0; self.videomax = freeMemory if freeMemory < 2000 else 2000
			self.recommendedVideo = recMemory if recMemory < 500 else 500; self.currentVideo = self.recommendedVideo
			videopos = wiz.percentage(self.currentVideo, self.videomax)
			self.videoCacheSize.setPercent(videopos)
			current1 = '[COLOR %s]Actual:[/COLOR] [COLOR %s]%s MB[/COLOR]' % (COLOR1, COLOR2, self.currentVideo)
			recommended1 = '[COLOR %s]Recomendado:[/COLOR] [COLOR %s]%s MB[/COLOR]' % (COLOR1, COLOR2, self.recommendedVideo)
			self.currentVideo1=xbmcgui.ControlTextBox(leftside+BorderWidth,firstrow+235,currentwidth,20,font=Font,textColor=TxtColor)
			self.addControl(self.currentVideo1)
			self.currentVideo1.setText(current1)
			self.recommendedVideo1=xbmcgui.ControlTextBox(leftside+BorderWidth+currentwidth,firstrow+235,currentwidth,20,font=Font,textColor=TxtColor)
			self.addControl(self.recommendedVideo1)
			self.recommendedVideo1.setText(recommended1)
			
			header = '[COLOR %s]CURL Timeout/CURL Velocidad baja[/COLOR]' % (COLOR2)
			self.Header3=xbmcgui.ControlLabel(rightside+BorderWidth, firstrow+5, (W/2)-(BorderWidth*2), 20, header, font='font13', textColor=TxtColor, alignment=0x00000002)
			self.addControl(self.Header3)
			msg3 = "[COLOR %s][B]curlclienttimeout[/B] tiempo en segundos que  libcurl tarda en dar un timeout, [B]curllowspeedtime[/B] es el tiempo que considera para dar conexion baja.  Valor recomendado en equipos poco potentes: 20.[/COLOR]" % COLOR2
			self.Support3=xbmcgui.ControlTextBox(rightside+int(BorderWidth*3.5), firstrow+30+BorderWidth, (W/2)-(BorderWidth*4), 150, font='font12', textColor=TxtColor)
			self.addControl(self.Support3)
			self.Support3.setText(msg3)
			try: self.CURLTimeout=xbmcgui.ControlSlider(rightside+int(BorderWidth*3.5),firstrow+210,(W/2)-(BorderWidth*5),20, textureback=sliderfocus, texture=slidernibnofocus, texturefocus=slidernibfocus, orientation=xbmcgui.HORIZONTAL)
			except: self.CURLTimeout=xbmcgui.ControlSlider(rightside+int(BorderWidth*3.5),firstrow+210,(W/2)-(BorderWidth*5),20, textureback=sliderfocus, texture=slidernibnofocus, texturefocus=slidernibfocus)
			self.addControl(self.CURLTimeout)
			self.curlmin = 0; self.curlmax = 20
			self.recommendedCurl = 10; self.currentCurl = self.recommendedCurl
			curlpos = wiz.percentage(self.currentCurl, self.curlmax)
			self.CURLTimeout.setPercent(curlpos)
			current2 = '[COLOR %s]Actual:[/COLOR] [COLOR %s]%ss[/COLOR]' % (COLOR1, COLOR2, self.currentCurl)
			recommended2 = '[COLOR %s]Recommendado:[/COLOR] [COLOR %s]%ss[/COLOR]' % (COLOR1, COLOR2, self.recommendedCurl)
			self.currentCurl2=xbmcgui.ControlTextBox(rightside+(BorderWidth*3),firstrow+235,currentwidth,20,font=Font,textColor=TxtColor)
			self.addControl(self.currentCurl2)
			self.currentCurl2.setText(current2)
			self.recommendedCurl2=xbmcgui.ControlTextBox(rightside+(BorderWidth*3)+currentwidth,firstrow+235,currentwidth,20,font=Font,textColor=TxtColor)
			self.addControl(self.recommendedCurl2)
			self.recommendedCurl2.setText(recommended2)
			
			header = '[COLOR %s]Read Buffer Factor[/COLOR]' % (COLOR2)
			self.Header4=xbmcgui.ControlLabel(leftside, secondrow+5, (W/2)-(BorderWidth*2), 20, header, font='font13', textColor=TxtColor, alignment=0x00000002)
			self.addControl(self.Header4)
			msg3 = "[COLOR %s]Es un valor que multiplica el de serie. Si Kodi esta cargando un archivo de 36 Mbit/s, entonces un valor de 2 hara necesario al menos 72 Mbit/s de banda ancha.[/COLOR]" % COLOR2
			self.Support3=xbmcgui.ControlTextBox(leftside+int(BorderWidth*1.5), secondrow+30+BorderWidth, (W/2)-(BorderWidth*4), 150, font='font12', textColor=TxtColor)
			self.addControl(self.Support3)
			self.Support3.setText(msg3)
			try: self.readBufferFactor=xbmcgui.ControlSlider(leftside+int(BorderWidth*1.5), secondrow+210,(W/2)-(BorderWidth*5),20, textureback=sliderfocus, texture=slidernibnofocus, texturefocus=slidernibfocus, orientation=xbmcgui.HORIZONTAL)
			except: self.readBufferFactor=xbmcgui.ControlSlider(leftside+int(BorderWidth*1.5), secondrow+210,(W/2)-(BorderWidth*5),20, textureback=sliderfocus, texture=slidernibnofocus, texturefocus=slidernibfocus)
			self.addControl(self.readBufferFactor)
			self.readmin = 0; self.readmax = 10
			self.recommendedRead = 5; self.currentRead = self.recommendedRead
			readpos = wiz.percentage(self.currentRead, self.readmax)
			self.readBufferFactor.setPercent(readpos)
			current3 = '[COLOR %s]Actual:[/COLOR] [COLOR %s]%s[/COLOR]' % (COLOR1, COLOR2, self.currentRead)
			recommended3 = '[COLOR %s]Recommendado:[/COLOR] [COLOR %s]%s[/COLOR]' % (COLOR1, COLOR2, self.recommendedRead)
			self.currentRead3=xbmcgui.ControlTextBox(leftside+BorderWidth,secondrow+235,currentwidth,20,font=Font,textColor=TxtColor)
			self.addControl(self.currentRead3)
			self.currentRead3.setText(current3)
			self.recommendedRead3=xbmcgui.ControlTextBox(leftside+BorderWidth+currentwidth,secondrow+235,currentwidth,20,font=Font,textColor=TxtColor)
			self.addControl(self.recommendedRead3)
			self.recommendedRead3.setText(recommended3)
			
			header = '[COLOR %s]Buffer Mode[/COLOR]' % (COLOR2)
			self.Header4=xbmcgui.ControlLabel(rightside+BorderWidth, secondrow+5, (W/2)-(BorderWidth*2), 20, header, font='font13', textColor=TxtColor, alignment=0x00000002)
			self.addControl(self.Header4)
			msg4 = "[COLOR %s]Este valor obliga a Kodi usar la cache para todos los videos, locales y online. Un valor de 0 hara que Kodi solo use la cache para los archivos online, no los locales[/COLOR]" % COLOR2
			self.Support4=xbmcgui.ControlTextBox(rightside+int(BorderWidth*3.5), secondrow+30+BorderWidth, (W/2)-(BorderWidth*4), 110, font='font12', textColor=TxtColor)
			self.addControl(self.Support4)
			self.Support4.setText(msg4)
			B1 = secondrow+130+BorderWidth; B2 = B1+30; B3 = B2+30; B4 = B3+30;
			self.Button0 = xbmcgui.ControlRadioButton(rightside+(BorderWidth*3), B1, (W/2)-(BorderWidth*4), 30, '0: Buffer todos los archivos de internet', font='font12', focusTexture=radiobgfocus, noFocusTexture=radiobgnofocus, focusOnTexture=radiofocus, noFocusOnTexture=radiofocus, focusOffTexture=radionofocus, noFocusOffTexture=radionofocus)
			self.Button1 = xbmcgui.ControlRadioButton(rightside+(BorderWidth*3), B2, (W/2)-(BorderWidth*4), 30, '1: Buffer todos los archivos', font='font12', focusTexture=radiobgfocus, noFocusTexture=radiobgnofocus, focusOnTexture=radiofocus, noFocusOnTexture=radiofocus, focusOffTexture=radionofocus, noFocusOffTexture=radionofocus)
			self.Button2 = xbmcgui.ControlRadioButton(rightside+(BorderWidth*3), B3, (W/2)-(BorderWidth*4), 30, '2: Buffer solo para los archivos de internet reales', font='font12', focusTexture=radiobgfocus, noFocusTexture=radiobgnofocus, focusOnTexture=radiofocus, noFocusOnTexture=radiofocus, focusOffTexture=radionofocus, noFocusOffTexture=radionofocus)
			self.Button3 = xbmcgui.ControlRadioButton(rightside+(BorderWidth*3), B4, (W/2)-(BorderWidth*4), 30, '3: Sin Buffer', font='font12', focusTexture=radiobgfocus, noFocusTexture=radiobgnofocus, focusOnTexture=radiofocus, noFocusOnTexture=radiofocus, focusOffTexture=radionofocus, noFocusOffTexture=radionofocus)
			self.addControl(self.Button0)
			self.addControl(self.Button1)
			self.addControl(self.Button2)
			self.addControl(self.Button3)
			self.Button0.setSelected(False)
			self.Button1.setSelected(False)
			self.Button2.setSelected(True)
			self.Button3.setSelected(False)
			
			self.buttonWrite=xbmcgui.ControlButton(leftside,T+H-40-BorderWidth,(W/2)-(BorderWidth*2),35,"Escritura de archivo",textColor="0xFF000000",focusedColor="0xFF000000",alignment=2,focusTexture=buttonfocus,noFocusTexture=buttonnofocus)
			self.buttonCancel=xbmcgui.ControlButton(rightside+BorderWidth*2,T+H-40-BorderWidth,(W/2)-(BorderWidth*2),35,"Cancelar",textColor="0xFF000000",focusedColor="0xFF000000",alignment=2,focusTexture=buttonfocus,noFocusTexture=buttonnofocus)
			self.addControl(self.buttonWrite); self.addControl(self.buttonCancel)
			
			self.buttonWrite.controlLeft(self.buttonCancel); self.buttonWrite.controlRight(self.buttonCancel); self.buttonWrite.controlUp(self.Button3); self.buttonWrite.controlDown(self.videoCacheSize)
			self.buttonCancel.controlLeft(self.buttonWrite); self.buttonCancel.controlRight(self.buttonWrite); self.buttonCancel.controlUp(self.Button3); self.buttonCancel.controlDown(self.videoCacheSize)
			self.videoCacheSize.controlUp(self.buttonWrite); self.videoCacheSize.controlDown(self.CURLTimeout)
			self.CURLTimeout.controlUp(self.videoCacheSize); self.CURLTimeout.controlDown(self.readBufferFactor)
			self.readBufferFactor.controlUp(self.CURLTimeout); self.readBufferFactor.controlDown(self.Button0)
			self.Button0.controlUp(self.CURLTimeout); self.Button0.controlDown(self.Button1); self.Button0.controlLeft(self.readBufferFactor); self.Button0.controlRight(self.readBufferFactor);
			self.Button1.controlUp(self.Button0); self.Button1.controlDown(self.Button2); self.Button1.controlLeft(self.readBufferFactor); self.Button1.controlRight(self.readBufferFactor);
			self.Button2.controlUp(self.Button1); self.Button2.controlDown(self.Button3); self.Button2.controlLeft(self.readBufferFactor); self.Button2.controlRight(self.readBufferFactor);
			self.Button3.controlUp(self.Button2); self.Button3.controlDown(self.buttonWrite); self.Button3.controlLeft(self.readBufferFactor); self.Button3.controlRight(self.readBufferFactor);
			self.setFocus(self.videoCacheSize)
Ejemplo n.º 14
0
		def __init__(self,msg='',L=0,T=0,W=1280,H=720,TxtColor='0xFFFFFFFF',Font='font12',BorderWidth=10):
			buttonfocus, buttonnofocus = artwork('button')
			radiobgfocus, radiobgnofocus, radiofocus, radionofocus = artwork('radio')
			slidernibfocus, slidernibnofocus, sliderfocus, slidernofocus = artwork('slider')
			image_path = os.path.join(ART, 'ContentPanel.png')
			boxbg = os.path.join(ART, 'bgg2.png')
			self.border = xbmcgui.ControlImage(L,T,W,H, image_path)
			self.addControl(self.border); 
			#self.BG=xbmcgui.ControlImage(L+BorderWidth,T+BorderWidth,W-(BorderWidth*2),H-(BorderWidth*2), FANART, aspectRatio=0, colorDiffuse='0x5FFFFFFF')
			self.BG=xbmcgui.ControlImage(L+BorderWidth,T+BorderWidth,W-(BorderWidth*2),H-(BorderWidth*2), ADVANCEDFANART, aspectRatio=0, colorDiffuse='0x5FFFFFFF')
			self.addControl(self.BG)
			top = T+BorderWidth
			leftside = L+BorderWidth
			rightside = L+(W/2)-(BorderWidth*2)
			firstrow = top+30
			secondrow = firstrow+275+(BorderWidth/2)
			currentwidth = ((W/2)-(BorderWidth*4))/2
			
			header = '[COLOR %s]Advanced Settings Configurator[/COLOR]' % (COLOR2)
			self.Header=xbmcgui.ControlLabel(L, top, W, 30, header, font='font13', textColor=TxtColor, alignment=0x00000002)
			self.addControl(self.Header)
			top += 30+BorderWidth
			self.bgarea = xbmcgui.ControlImage(leftside, firstrow, rightside-L, 275, boxbg, aspectRatio=0, colorDiffuse='0x5FFFFFFF')
			self.addControl(self.bgarea)
			self.bgarea2 = xbmcgui.ControlImage(rightside+BorderWidth+BorderWidth, firstrow, rightside-L, 275, boxbg, aspectRatio=0, colorDiffuse='0x5FFFFFFF')
			self.addControl(self.bgarea2)
			self.bgarea3 = xbmcgui.ControlImage(leftside, secondrow, rightside-L, 275, boxbg, aspectRatio=0, colorDiffuse='0x5FFFFFFF')
			self.addControl(self.bgarea3)
			self.bgarea4 = xbmcgui.ControlImage(rightside+BorderWidth+BorderWidth, secondrow, rightside-L, 275, boxbg, aspectRatio=0, colorDiffuse='0x5FFFFFFF')
			self.addControl(self.bgarea4)
			
			header = '[COLOR %s]Video Cache Size[/COLOR]' % (COLOR1)
			self.Header2=xbmcgui.ControlLabel(leftside+BorderWidth, firstrow+5, (W/2)-(BorderWidth*2), 20, header, font='font13', textColor=TxtColor, alignment=0x00000002)
			self.addControl(self.Header2)
			freeMemory = int(float(wiz.getInfo('System.Memory(free)')[:-2])*.33)
			recMemory = int(float(wiz.getInfo('System.Memory(free)')[:-2])*.23)
			msg3 = "[COLOR %s]Number of bytes used for buffering streams in memory.  When set to [COLOR %s]0[/COLOR] the cache will be written to disk instead of RAM.  Note: For the memory size set here, Kodi will require 3x the amount of RAM to be free. Setting this too high might cause Kodi to crash if it can't get enough RAM(1/3 of Free Memory: [COLOR %s]%s[/COLOR])[/COLOR]" % (COLOR2, COLOR1, COLOR1, freeMemory)
			self.Support3=xbmcgui.ControlTextBox(leftside+int(BorderWidth*1.5), firstrow+30+BorderWidth, (W/2)-(BorderWidth*4), 150, font='font12', textColor=TxtColor)
			self.addControl(self.Support3)
			self.Support3.setText(msg3)
			try: self.videoCacheSize=xbmcgui.ControlSlider(leftside+int(BorderWidth*1.5), firstrow+210,(W/2)-(BorderWidth*5),20, textureback=sliderfocus, texture=slidernibnofocus, texturefocus=slidernibfocus, orientation=xbmcgui.HORIZONTAL)
			except: self.videoCacheSize=xbmcgui.ControlSlider(leftside+int(BorderWidth*1.5), firstrow+210,(W/2)-(BorderWidth*5),20, textureback=sliderfocus, texture=slidernibnofocus, texturefocus=slidernibfocus)
			self.addControl(self.videoCacheSize)
			self.videomin = 0; self.videomax = freeMemory if freeMemory < 2000 else 2000
			self.recommendedVideo = recMemory if recMemory < 500 else 500; self.currentVideo = self.recommendedVideo
			videopos = wiz.percentage(self.currentVideo, self.videomax)
			self.videoCacheSize.setPercent(videopos)
			current1 = '[COLOR %s]Current:[/COLOR] [COLOR %s]%s MB[/COLOR]' % (COLOR1, COLOR2, self.currentVideo)
			recommended1 = '[COLOR %s]Recommended:[/COLOR] [COLOR %s]%s MB[/COLOR]' % (COLOR1, COLOR2, self.recommendedVideo)
			self.currentVideo1=xbmcgui.ControlTextBox(leftside+BorderWidth,firstrow+235,currentwidth,20,font=Font,textColor=TxtColor)
			self.addControl(self.currentVideo1)
			self.currentVideo1.setText(current1)
			self.recommendedVideo1=xbmcgui.ControlTextBox(leftside+BorderWidth+currentwidth,firstrow+235,currentwidth,20,font=Font,textColor=TxtColor)
			self.addControl(self.recommendedVideo1)
			self.recommendedVideo1.setText(recommended1)
			
			header = '[COLOR %s]CURL Timeout/CURL Low Speed[/COLOR]' % (COLOR1)
			self.Header3=xbmcgui.ControlLabel(rightside+BorderWidth, firstrow+5, (W/2)-(BorderWidth*2), 20, header, font='font13', textColor=TxtColor, alignment=0x00000002)
			self.addControl(self.Header3)
			msg3 = "[COLOR %s][B]curlclienttimeout[/B] is the time in seconds for how long it takes for libcurl connection will timeout and [B]curllowspeedtime[/B] is the time in seconds for libcurl to consider a connection lowspeed.  For slower connections set it to 20.[/COLOR]" % COLOR2
			self.Support3=xbmcgui.ControlTextBox(rightside+int(BorderWidth*3.5), firstrow+30+BorderWidth, (W/2)-(BorderWidth*4), 150, font='font12', textColor=TxtColor)
			self.addControl(self.Support3)
			self.Support3.setText(msg3)
			try: self.CURLTimeout=xbmcgui.ControlSlider(rightside+int(BorderWidth*3.5),firstrow+210,(W/2)-(BorderWidth*5),20, textureback=sliderfocus, texture=slidernibnofocus, texturefocus=slidernibfocus, orientation=xbmcgui.HORIZONTAL)
			except: self.CURLTimeout=xbmcgui.ControlSlider(rightside+int(BorderWidth*3.5),firstrow+210,(W/2)-(BorderWidth*5),20, textureback=sliderfocus, texture=slidernibnofocus, texturefocus=slidernibfocus)
			self.addControl(self.CURLTimeout)
			self.curlmin = 0; self.curlmax = 20
			self.recommendedCurl = 10; self.currentCurl = self.recommendedCurl
			curlpos = wiz.percentage(self.currentCurl, self.curlmax)
			self.CURLTimeout.setPercent(curlpos)
			current2 = '[COLOR %s]Current:[/COLOR] [COLOR %s]%ss[/COLOR]' % (COLOR1, COLOR2, self.currentCurl)
			recommended2 = '[COLOR %s]Recommended:[/COLOR] [COLOR %s]%ss[/COLOR]' % (COLOR1, COLOR2, self.recommendedCurl)
			self.currentCurl2=xbmcgui.ControlTextBox(rightside+(BorderWidth*3),firstrow+235,currentwidth,20,font=Font,textColor=TxtColor)
			self.addControl(self.currentCurl2)
			self.currentCurl2.setText(current2)
			self.recommendedCurl2=xbmcgui.ControlTextBox(rightside+(BorderWidth*3)+currentwidth,firstrow+235,currentwidth,20,font=Font,textColor=TxtColor)
			self.addControl(self.recommendedCurl2)
			self.recommendedCurl2.setText(recommended2)
			
			header = '[COLOR %s]Read Buffer Factor[/COLOR]' % (COLOR1)
			self.Header4=xbmcgui.ControlLabel(leftside, secondrow+5, (W/2)-(BorderWidth*2), 20, header, font='font13', textColor=TxtColor, alignment=0x00000002)
			self.addControl(self.Header4)
			msg3 = "[COLOR %s]The value of this setting is a multiplier of the default limit. If Kodi is loading a typical bluray raw file at 36 Mbit/s, then a value of 2 will need at least 72 Mbit/s of network bandwidth. However, unlike with the RAM setting, you can safely increase this value however high you want, and Kodi won't crash.[/COLOR]" % COLOR2
			self.Support3=xbmcgui.ControlTextBox(leftside+int(BorderWidth*1.5), secondrow+30+BorderWidth, (W/2)-(BorderWidth*4), 150, font='font12', textColor=TxtColor)
			self.addControl(self.Support3)
			self.Support3.setText(msg3)
			try: self.readBufferFactor=xbmcgui.ControlSlider(leftside+int(BorderWidth*1.5), secondrow+210,(W/2)-(BorderWidth*5),20, textureback=sliderfocus, texture=slidernibnofocus, texturefocus=slidernibfocus, orientation=xbmcgui.HORIZONTAL)
			except: self.readBufferFactor=xbmcgui.ControlSlider(leftside+int(BorderWidth*1.5), secondrow+210,(W/2)-(BorderWidth*5),20, textureback=sliderfocus, texture=slidernibnofocus, texturefocus=slidernibfocus)
			self.addControl(self.readBufferFactor)
			self.readmin = 0; self.readmax = 10
			self.recommendedRead = 5; self.currentRead = self.recommendedRead
			readpos = wiz.percentage(self.currentRead, self.readmax)
			self.readBufferFactor.setPercent(readpos)
			current3 = '[COLOR %s]Current:[/COLOR] [COLOR %s]%s[/COLOR]' % (COLOR1, COLOR2, self.currentRead)
			recommended3 = '[COLOR %s]Recommended:[/COLOR] [COLOR %s]%s[/COLOR]' % (COLOR1, COLOR2, self.recommendedRead)
			self.currentRead3=xbmcgui.ControlTextBox(leftside+BorderWidth,secondrow+235,currentwidth,20,font=Font,textColor=TxtColor)
			self.addControl(self.currentRead3)
			self.currentRead3.setText(current3)
			self.recommendedRead3=xbmcgui.ControlTextBox(leftside+BorderWidth+currentwidth,secondrow+235,currentwidth,20,font=Font,textColor=TxtColor)
			self.addControl(self.recommendedRead3)
			self.recommendedRead3.setText(recommended3)
			
			header = '[COLOR %s]Buffer Mode[/COLOR]' % (COLOR1)
			self.Header4=xbmcgui.ControlLabel(rightside+BorderWidth, secondrow+5, (W/2)-(BorderWidth*2), 20, header, font='font13', textColor=TxtColor, alignment=0x00000002)
			self.addControl(self.Header4)
			msg4 = "[COLOR %s]This setting will force Kodi to use a cache for all video files, including local network, internet, and even the local hard drive. Default value is 0 and will only cache videos that use internet file paths/sources.[/COLOR]" % COLOR2
			self.Support4=xbmcgui.ControlTextBox(rightside+int(BorderWidth*3.5), secondrow+30+BorderWidth, (W/2)-(BorderWidth*4), 110, font='font12', textColor=TxtColor)
			self.addControl(self.Support4)
			self.Support4.setText(msg4)
			B1 = secondrow+130+BorderWidth; B2 = B1+30; B3 = B2+30; B4 = B3+30;
			self.Button0 = xbmcgui.ControlRadioButton(rightside+(BorderWidth*3), B1, (W/2)-(BorderWidth*4), 30, '0: Buffer all internet filesystems', textColor="0xffff00ff", font='font12', focusTexture=radiobgfocus, noFocusTexture=radiobgnofocus, focusOnTexture=radiofocus, noFocusOnTexture=radiofocus, focusOffTexture=radionofocus, noFocusOffTexture=radionofocus)
			self.Button1 = xbmcgui.ControlRadioButton(rightside+(BorderWidth*3), B2, (W/2)-(BorderWidth*4), 30, '1: Buffer all filesystems', textColor="0xffff00ff", font='font12', focusTexture=radiobgfocus, noFocusTexture=radiobgnofocus, focusOnTexture=radiofocus, noFocusOnTexture=radiofocus, focusOffTexture=radionofocus, noFocusOffTexture=radionofocus)
			self.Button2 = xbmcgui.ControlRadioButton(rightside+(BorderWidth*3), B3, (W/2)-(BorderWidth*4), 30, '2: Only buffer true internet filesystems', textColor="0xffff00ff", font='font12', focusTexture=radiobgfocus, noFocusTexture=radiobgnofocus, focusOnTexture=radiofocus, noFocusOnTexture=radiofocus, focusOffTexture=radionofocus, noFocusOffTexture=radionofocus)
			self.Button3 = xbmcgui.ControlRadioButton(rightside+(BorderWidth*3), B4, (W/2)-(BorderWidth*4), 30, '3: No Buffer', textColor="0xffff00ff", font='font12', focusTexture=radiobgfocus, noFocusTexture=radiobgnofocus, focusOnTexture=radiofocus, noFocusOnTexture=radiofocus, focusOffTexture=radionofocus, noFocusOffTexture=radionofocus)
			self.addControl(self.Button0)
			self.addControl(self.Button1)
			self.addControl(self.Button2)
			self.addControl(self.Button3)
			self.Button0.setSelected(False)
			self.Button1.setSelected(False)
			self.Button2.setSelected(True)
			self.Button3.setSelected(False)
			
			self.buttonWrite=xbmcgui.ControlButton(leftside,T+H-40-BorderWidth,(W/2)-(BorderWidth*2),35,"Write File",textColor="0xFF000000",focusedColor="0xFF000000",alignment=2,focusTexture=buttonfocus,noFocusTexture=buttonnofocus)
			self.buttonCancel=xbmcgui.ControlButton(rightside+BorderWidth*2,T+H-40-BorderWidth,(W/2)-(BorderWidth*2),35,"Cancel",textColor="0xFF000000",focusedColor="0xFF000000",alignment=2,focusTexture=buttonfocus,noFocusTexture=buttonnofocus)
			self.addControl(self.buttonWrite); self.addControl(self.buttonCancel)
			
			self.buttonWrite.controlLeft(self.buttonCancel); self.buttonWrite.controlRight(self.buttonCancel); self.buttonWrite.controlUp(self.Button3); self.buttonWrite.controlDown(self.videoCacheSize)
			self.buttonCancel.controlLeft(self.buttonWrite); self.buttonCancel.controlRight(self.buttonWrite); self.buttonCancel.controlUp(self.Button3); self.buttonCancel.controlDown(self.videoCacheSize)
			self.videoCacheSize.controlUp(self.buttonWrite); self.videoCacheSize.controlDown(self.CURLTimeout)
			self.CURLTimeout.controlUp(self.videoCacheSize); self.CURLTimeout.controlDown(self.readBufferFactor)
			self.readBufferFactor.controlUp(self.CURLTimeout); self.readBufferFactor.controlDown(self.Button0)
			self.Button0.controlUp(self.CURLTimeout); self.Button0.controlDown(self.Button1); self.Button0.controlLeft(self.readBufferFactor); self.Button0.controlRight(self.readBufferFactor);
			self.Button1.controlUp(self.Button0); self.Button1.controlDown(self.Button2); self.Button1.controlLeft(self.readBufferFactor); self.Button1.controlRight(self.readBufferFactor);
			self.Button2.controlUp(self.Button1); self.Button2.controlDown(self.Button3); self.Button2.controlLeft(self.readBufferFactor); self.Button2.controlRight(self.readBufferFactor);
			self.Button3.controlUp(self.Button2); self.Button3.controlDown(self.buttonWrite); self.Button3.controlLeft(self.readBufferFactor); self.Button3.controlRight(self.readBufferFactor);
			self.setFocus(self.videoCacheSize)
Ejemplo n.º 15
0
        def __init__(self,
                     msg='',
                     L=0,
                     T=0,
                     W=1280,
                     H=720,
                     TxtColor='0xFFFFFFFF',
                     Font='font12',
                     BorderWidth=10):
            buttonfocus, buttonnofocus = artwork('button')
            radiobgfocus, radiobgnofocus, radiofocus, radionofocus = artwork(
                'radio')
            slidernibfocus, slidernibnofocus, sliderfocus, slidernofocus = artwork(
                'slider')
            image_path = os.path.join(ART, 'ContentPanel.png')
            boxbg = os.path.join(ART, 'bgg2.png')
            self.border = xbmcgui.ControlImage(L, T, W, H, image_path)
            self.addControl(self.border)
            self.BG = xbmcgui.ControlImage(L + BorderWidth,
                                           T + BorderWidth,
                                           W - (BorderWidth * 2),
                                           H - (BorderWidth * 2),
                                           FANART,
                                           aspectRatio=0,
                                           colorDiffuse='0x5FFFFFFF')
            self.addControl(self.BG)
            top = T + BorderWidth
            leftside = L + BorderWidth
            rightside = L + (W / 2) - (BorderWidth * 2)
            firstrow = top + 30
            secondrow = firstrow + 275 + (BorderWidth / 2)
            currentwidth = ((W / 2) - (BorderWidth * 4)) / 2

            header = '[COLOR %s][B]Advanced Settings Konfigurator[/B][/COLOR]' % (
                COLOR2)
            self.Header = xbmcgui.ControlLabel(L,
                                               top,
                                               W,
                                               30,
                                               header,
                                               font='font13',
                                               textColor=TxtColor,
                                               alignment=0x00000002)
            self.addControl(self.Header)
            top += 30 + BorderWidth
            self.bgarea = xbmcgui.ControlImage(leftside,
                                               firstrow,
                                               rightside - L,
                                               275,
                                               boxbg,
                                               aspectRatio=0,
                                               colorDiffuse='0x5FFFFFFF')
            self.addControl(self.bgarea)
            self.bgarea2 = xbmcgui.ControlImage(rightside + BorderWidth +
                                                BorderWidth,
                                                firstrow,
                                                rightside - L,
                                                275,
                                                boxbg,
                                                aspectRatio=0,
                                                colorDiffuse='0x5FFFFFFF')
            self.addControl(self.bgarea2)
            self.bgarea3 = xbmcgui.ControlImage(leftside,
                                                secondrow,
                                                rightside - L,
                                                275,
                                                boxbg,
                                                aspectRatio=0,
                                                colorDiffuse='0x5FFFFFFF')
            self.addControl(self.bgarea3)
            self.bgarea4 = xbmcgui.ControlImage(rightside + BorderWidth +
                                                BorderWidth,
                                                secondrow,
                                                rightside - L,
                                                275,
                                                boxbg,
                                                aspectRatio=0,
                                                colorDiffuse='0x5FFFFFFF')
            self.addControl(self.bgarea4)

            header = '[COLOR %s]Video Cache Groesse[/COLOR]' % (COLOR2)
            self.Header2 = xbmcgui.ControlLabel(leftside + BorderWidth,
                                                firstrow + 5,
                                                (W / 2) - (BorderWidth * 2),
                                                20,
                                                header,
                                                font='font13',
                                                textColor=TxtColor,
                                                alignment=0x00000002)
            self.addControl(self.Header2)
            freeMemory = int(
                float(wiz.getInfo('System.Memory(free)')[:-2]) * .33)
            recMemory = int(
                float(wiz.getInfo('System.Memory(free)')[:-2]) * .23)
            msg3 = "[COLOR %s]Anzahl der Bytes zum Puffern im RAM.  Wird dies auf [COLOR %s]0[/COLOR] gesetzt, wird der Cache auf die Disk geschrieben anstatt in den RAM.  Info: Storm braucht 3x soviel an freiem RAM des hier gewaehlten Wertes. Das kann bei falscher Einstellung zum Absturz von Storm fuehren. (1/3 of Freier RAM: [COLOR %s]%s[/COLOR])[/COLOR]" % (
                COLOR2, COLOR1, COLOR1, freeMemory)
            self.Support3 = xbmcgui.ControlTextBox(
                leftside + int(BorderWidth * 1.5),
                firstrow + 30 + BorderWidth, (W / 2) - (BorderWidth * 4),
                150,
                font='font12',
                textColor=TxtColor)
            self.addControl(self.Support3)
            self.Support3.setText(msg3)
            try:
                self.videoCacheSize = xbmcgui.ControlSlider(
                    leftside + int(BorderWidth * 1.5),
                    firstrow + 210, (W / 2) - (BorderWidth * 5),
                    20,
                    textureback=sliderfocus,
                    texture=slidernibnofocus,
                    texturefocus=slidernibfocus,
                    orientation=xbmcgui.HORIZONTAL)
            except:
                self.videoCacheSize = xbmcgui.ControlSlider(
                    leftside + int(BorderWidth * 1.5),
                    firstrow + 210, (W / 2) - (BorderWidth * 5),
                    20,
                    textureback=sliderfocus,
                    texture=slidernibnofocus,
                    texturefocus=slidernibfocus)
            self.addControl(self.videoCacheSize)
            self.videomin = 0
            self.videomax = freeMemory if freeMemory < 2000 else 2000
            self.recommendedVideo = recMemory if recMemory < 500 else 500
            self.currentVideo = self.recommendedVideo
            videopos = wiz.percentage(self.currentVideo, self.videomax)
            self.videoCacheSize.setPercent(videopos)
            current1 = '[COLOR %s]Aktuell:[/COLOR] [COLOR %s]%s MB[/COLOR]' % (
                COLOR1, COLOR2, self.currentVideo)
            recommended1 = '[COLOR %s]Empfohlen:[/COLOR] [COLOR %s]%s MB[/COLOR]' % (
                COLOR1, COLOR2, self.recommendedVideo)
            self.currentVideo1 = xbmcgui.ControlTextBox(leftside + BorderWidth,
                                                        firstrow + 235,
                                                        currentwidth,
                                                        20,
                                                        font=Font,
                                                        textColor=TxtColor)
            self.addControl(self.currentVideo1)
            self.currentVideo1.setText(current1)
            self.recommendedVideo1 = xbmcgui.ControlTextBox(
                leftside + BorderWidth + currentwidth,
                firstrow + 235,
                currentwidth,
                20,
                font=Font,
                textColor=TxtColor)
            self.addControl(self.recommendedVideo1)
            self.recommendedVideo1.setText(recommended1)

            header = '[COLOR %s]CURL Timeout/CURL Low Speed[/COLOR]' % (COLOR2)
            self.Header3 = xbmcgui.ControlLabel(rightside + BorderWidth,
                                                firstrow + 5,
                                                (W / 2) - (BorderWidth * 2),
                                                20,
                                                header,
                                                font='font13',
                                                textColor=TxtColor,
                                                alignment=0x00000002)
            self.addControl(self.Header3)
            msg3 = "[COLOR %s][B]curlclienttimeout[/B] ist die Zeit in Sekunden bis libcurl Verbindungen in den timeout gehen und [B]curllowspeedtime[/B] ist die Zeit in Sekunden, die libcurl benoetigt um eine Verbindung mit niedriger Geschwindigkeit zu pruefen.  Bei einer langsamen Verbindung auf 20 setzten.[/COLOR]" % COLOR2
            self.Support3 = xbmcgui.ControlTextBox(
                rightside + int(BorderWidth * 3.5),
                firstrow + 30 + BorderWidth, (W / 2) - (BorderWidth * 4),
                150,
                font='font12',
                textColor=TxtColor)
            self.addControl(self.Support3)
            self.Support3.setText(msg3)
            try:
                self.CURLTimeout = xbmcgui.ControlSlider(
                    rightside + int(BorderWidth * 3.5),
                    firstrow + 210, (W / 2) - (BorderWidth * 5),
                    20,
                    textureback=sliderfocus,
                    texture=slidernibnofocus,
                    texturefocus=slidernibfocus,
                    orientation=xbmcgui.HORIZONTAL)
            except:
                self.CURLTimeout = xbmcgui.ControlSlider(
                    rightside + int(BorderWidth * 3.5),
                    firstrow + 210, (W / 2) - (BorderWidth * 5),
                    20,
                    textureback=sliderfocus,
                    texture=slidernibnofocus,
                    texturefocus=slidernibfocus)
            self.addControl(self.CURLTimeout)
            self.curlmin = 0
            self.curlmax = 20
            self.recommendedCurl = 10
            self.currentCurl = self.recommendedCurl
            curlpos = wiz.percentage(self.currentCurl, self.curlmax)
            self.CURLTimeout.setPercent(curlpos)
            current2 = '[COLOR %s]Aktuell:[/COLOR] [COLOR %s]%ss[/COLOR]' % (
                COLOR1, COLOR2, self.currentCurl)
            recommended2 = '[COLOR %s]Empfohlen:[/COLOR] [COLOR %s]%ss[/COLOR]' % (
                COLOR1, COLOR2, self.recommendedCurl)
            self.currentCurl2 = xbmcgui.ControlTextBox(rightside +
                                                       (BorderWidth * 3),
                                                       firstrow + 235,
                                                       currentwidth,
                                                       20,
                                                       font=Font,
                                                       textColor=TxtColor)
            self.addControl(self.currentCurl2)
            self.currentCurl2.setText(current2)
            self.recommendedCurl2 = xbmcgui.ControlTextBox(
                rightside + (BorderWidth * 3) + currentwidth,
                firstrow + 235,
                currentwidth,
                20,
                font=Font,
                textColor=TxtColor)
            self.addControl(self.recommendedCurl2)
            self.recommendedCurl2.setText(recommended2)

            header = '[COLOR %s]Read Buffer Faktor[/COLOR]' % (COLOR2)
            self.Header4 = xbmcgui.ControlLabel(leftside,
                                                secondrow + 5,
                                                (W / 2) - (BorderWidth * 2),
                                                20,
                                                header,
                                                font='font13',
                                                textColor=TxtColor,
                                                alignment=0x00000002)
            self.addControl(self.Header4)
            msg3 = "[COLOR %s]Der Wert dieser Einstellung ist ein Multiplikator der standard Einstellung. Wen KODI eine normale Bluray Raw Datei mit 36 Mbit/s laed, benoetigt ein Wert von 2 eine Bandbreite von 72 Mbit/s. Hier kann im Vergleich zum RAM ein zu hoher Wert Storm nicht zum Absturz bringen.[/COLOR]" % COLOR2
            self.Support3 = xbmcgui.ControlTextBox(
                leftside + int(BorderWidth * 1.5),
                secondrow + 30 + BorderWidth, (W / 2) - (BorderWidth * 4),
                150,
                font='font12',
                textColor=TxtColor)
            self.addControl(self.Support3)
            self.Support3.setText(msg3)
            try:
                self.readBufferFactor = xbmcgui.ControlSlider(
                    leftside + int(BorderWidth * 1.5),
                    secondrow + 210, (W / 2) - (BorderWidth * 5),
                    20,
                    textureback=sliderfocus,
                    texture=slidernibnofocus,
                    texturefocus=slidernibfocus,
                    orientation=xbmcgui.HORIZONTAL)
            except:
                self.readBufferFactor = xbmcgui.ControlSlider(
                    leftside + int(BorderWidth * 1.5),
                    secondrow + 210, (W / 2) - (BorderWidth * 5),
                    20,
                    textureback=sliderfocus,
                    texture=slidernibnofocus,
                    texturefocus=slidernibfocus)
            self.addControl(self.readBufferFactor)
            self.readmin = 0
            self.readmax = 10
            self.recommendedRead = 5
            self.currentRead = self.recommendedRead
            readpos = wiz.percentage(self.currentRead, self.readmax)
            self.readBufferFactor.setPercent(readpos)
            current3 = '[COLOR %s]Aktuell:[/COLOR] [COLOR %s]%s[/COLOR]' % (
                COLOR1, COLOR2, self.currentRead)
            recommended3 = '[COLOR %s]Empfohlen:[/COLOR] [COLOR %s]%s[/COLOR]' % (
                COLOR1, COLOR2, self.recommendedRead)
            self.currentRead3 = xbmcgui.ControlTextBox(leftside + BorderWidth,
                                                       secondrow + 235,
                                                       currentwidth,
                                                       20,
                                                       font=Font,
                                                       textColor=TxtColor)
            self.addControl(self.currentRead3)
            self.currentRead3.setText(current3)
            self.recommendedRead3 = xbmcgui.ControlTextBox(
                leftside + BorderWidth + currentwidth,
                secondrow + 235,
                currentwidth,
                20,
                font=Font,
                textColor=TxtColor)
            self.addControl(self.recommendedRead3)
            self.recommendedRead3.setText(recommended3)

            header = '[COLOR %s]Buffer Mode[/COLOR]' % (COLOR2)
            self.Header4 = xbmcgui.ControlLabel(rightside + BorderWidth,
                                                secondrow + 5,
                                                (W / 2) - (BorderWidth * 2),
                                                20,
                                                header,
                                                font='font13',
                                                textColor=TxtColor,
                                                alignment=0x00000002)
            self.addControl(self.Header4)
            msg4 = "[COLOR %s]Diese Einstellung zwingt Storm einen Cache fur alle Video Dateien (inklusive lokales Netzwerk, Internet und lokalen Festplatten) zu verwenden. Der standard Wert ist 0 und buffert nur Internet Quellen.[/COLOR]" % COLOR2
            self.Support4 = xbmcgui.ControlTextBox(
                rightside + int(BorderWidth * 3.5),
                secondrow + 30 + BorderWidth, (W / 2) - (BorderWidth * 4),
                110,
                font='font12',
                textColor=TxtColor)
            self.addControl(self.Support4)
            self.Support4.setText(msg4)
            B1 = secondrow + 130 + BorderWidth
            B2 = B1 + 30
            B3 = B2 + 30
            B4 = B3 + 30
            self.Button0 = xbmcgui.ControlRadioButton(
                rightside + (BorderWidth * 3),
                B1, (W / 2) - (BorderWidth * 4),
                30,
                '0: Buffer alle Internet Quellen',
                font='font12',
                focusTexture=radiobgfocus,
                noFocusTexture=radiobgnofocus,
                focusOnTexture=radiofocus,
                noFocusOnTexture=radiofocus,
                focusOffTexture=radionofocus,
                noFocusOffTexture=radionofocus)
            self.Button1 = xbmcgui.ControlRadioButton(
                rightside + (BorderWidth * 3),
                B2, (W / 2) - (BorderWidth * 4),
                30,
                '1: Buffer alle Quellen',
                font='font12',
                focusTexture=radiobgfocus,
                noFocusTexture=radiobgnofocus,
                focusOnTexture=radiofocus,
                noFocusOnTexture=radiofocus,
                focusOffTexture=radionofocus,
                noFocusOffTexture=radionofocus)
            self.Button2 = xbmcgui.ControlRadioButton(
                rightside + (BorderWidth * 3),
                B3, (W / 2) - (BorderWidth * 4),
                30,
                '2: Buffer nur richtige Internet Quellen',
                font='font12',
                focusTexture=radiobgfocus,
                noFocusTexture=radiobgnofocus,
                focusOnTexture=radiofocus,
                noFocusOnTexture=radiofocus,
                focusOffTexture=radionofocus,
                noFocusOffTexture=radionofocus)
            self.Button3 = xbmcgui.ControlRadioButton(
                rightside + (BorderWidth * 3),
                B4, (W / 2) - (BorderWidth * 4),
                30,
                '3: Kein Buffer',
                font='font12',
                focusTexture=radiobgfocus,
                noFocusTexture=radiobgnofocus,
                focusOnTexture=radiofocus,
                noFocusOnTexture=radiofocus,
                focusOffTexture=radionofocus,
                noFocusOffTexture=radionofocus)
            self.addControl(self.Button0)
            self.addControl(self.Button1)
            self.addControl(self.Button2)
            self.addControl(self.Button3)
            self.Button0.setSelected(False)
            self.Button1.setSelected(False)
            self.Button2.setSelected(True)
            self.Button3.setSelected(False)

            self.buttonWrite = xbmcgui.ControlButton(
                leftside,
                T + H - 40 - BorderWidth, (W / 2) - (BorderWidth * 2),
                35,
                "Schreibe Datei",
                textColor="0xFF000000",
                focusedColor="0xFF000000",
                alignment=2,
                focusTexture=buttonfocus,
                noFocusTexture=buttonnofocus)
            self.buttonCancel = xbmcgui.ControlButton(
                rightside + BorderWidth * 2,
                T + H - 40 - BorderWidth, (W / 2) - (BorderWidth * 2),
                35,
                "Schliessen",
                textColor="0xFF000000",
                focusedColor="0xFF000000",
                alignment=2,
                focusTexture=buttonfocus,
                noFocusTexture=buttonnofocus)
            self.addControl(self.buttonWrite)
            self.addControl(self.buttonCancel)

            self.buttonWrite.controlLeft(self.buttonCancel)
            self.buttonWrite.controlRight(self.buttonCancel)
            self.buttonWrite.controlUp(self.Button3)
            self.buttonWrite.controlDown(self.videoCacheSize)
            self.buttonCancel.controlLeft(self.buttonWrite)
            self.buttonCancel.controlRight(self.buttonWrite)
            self.buttonCancel.controlUp(self.Button3)
            self.buttonCancel.controlDown(self.videoCacheSize)
            self.videoCacheSize.controlUp(self.buttonWrite)
            self.videoCacheSize.controlDown(self.CURLTimeout)
            self.CURLTimeout.controlUp(self.videoCacheSize)
            self.CURLTimeout.controlDown(self.readBufferFactor)
            self.readBufferFactor.controlUp(self.CURLTimeout)
            self.readBufferFactor.controlDown(self.Button0)
            self.Button0.controlUp(self.CURLTimeout)
            self.Button0.controlDown(self.Button1)
            self.Button0.controlLeft(self.readBufferFactor)
            self.Button0.controlRight(self.readBufferFactor)
            self.Button1.controlUp(self.Button0)
            self.Button1.controlDown(self.Button2)
            self.Button1.controlLeft(self.readBufferFactor)
            self.Button1.controlRight(self.readBufferFactor)
            self.Button2.controlUp(self.Button1)
            self.Button2.controlDown(self.Button3)
            self.Button2.controlLeft(self.readBufferFactor)
            self.Button2.controlRight(self.readBufferFactor)
            self.Button3.controlUp(self.Button2)
            self.Button3.controlDown(self.buttonWrite)
            self.Button3.controlLeft(self.readBufferFactor)
            self.Button3.controlRight(self.readBufferFactor)
            self.setFocus(self.videoCacheSize)
Ejemplo n.º 16
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.º 17
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.º 18
0
        def __init__(self,
                     msg='',
                     L=0,
                     T=0,
                     W=1280,
                     H=720,
                     TxtColor='0xFFFFFFFF',
                     Font='font12',
                     BorderWidth=10):
            buttonfocus, buttonnofocus = artwork('button')
            radiobgfocus, radiobgnofocus, radiofocus, radionofocus = artwork(
                'radio')
            slidernibfocus, slidernibnofocus = artwork('slider')
            image_path = FANART
            boxbg = os.path.join(SKINFOLD, 'Background', 'Fenetre.png')
            self.border = xbmcgui.ControlImage(L, T, W, H, image_path)
            self.addControl(self.border)
            self.BG = xbmcgui.ControlImage(L + BorderWidth,
                                           T + BorderWidth,
                                           W - (BorderWidth * 2),
                                           H - (BorderWidth * 2),
                                           FANART,
                                           aspectRatio=0,
                                           colorDiffuse='0xFFFFFFFF')
            self.addControl(self.BG)
            top = T  #+BorderWidth
            leftside = L  #+BorderWidth
            rightside = L + (W / 2)  #-(BorderWidth*2)
            firstrow = top + 30
            secondrow = firstrow + 300 + (BorderWidth / 2)
            currentwidth = ((W / 2) - (BorderWidth * 4)) / 2

            header = '[COLOR %s][B]Configuration des paramètres Avancés de Kodi[/B][/COLOR]' % (
                COLOR2)
            self.Header = xbmcgui.ControlLabel(L,
                                               top,
                                               W,
                                               30,
                                               header,
                                               font='font13',
                                               textColor=TxtColor,
                                               alignment=0x00000002)
            self.addControl(self.Header)
            top += 30 + BorderWidth
            self.bgarea = xbmcgui.ControlImage(leftside,
                                               firstrow,
                                               rightside - L,
                                               300,
                                               boxbg,
                                               aspectRatio=0,
                                               colorDiffuse='0xFFFFFFFF')
            self.addControl(self.bgarea)
            self.bgarea2 = xbmcgui.ControlImage(rightside,
                                                firstrow,
                                                rightside - L,
                                                300,
                                                boxbg,
                                                aspectRatio=0,
                                                colorDiffuse='0xFFFFFFFF')
            self.addControl(self.bgarea2)
            self.bgarea3 = xbmcgui.ControlImage(leftside,
                                                secondrow,
                                                rightside - L,
                                                300,
                                                boxbg,
                                                aspectRatio=0,
                                                colorDiffuse='0xFFFFFFFF')
            self.addControl(self.bgarea3)
            self.bgarea4 = xbmcgui.ControlImage(rightside,
                                                secondrow,
                                                rightside - L,
                                                300,
                                                boxbg,
                                                aspectRatio=0,
                                                colorDiffuse='0xFFFFFFFF')
            self.addControl(self.bgarea4)

            header = '[COLOR %s]Taille de la mémoire video[/COLOR]' % (COLOR2)
            self.Header2 = xbmcgui.ControlLabel(leftside + BorderWidth,
                                                firstrow + 5,
                                                (W / 2) - (BorderWidth * 2),
                                                20,
                                                header,
                                                font='font13',
                                                textColor=TxtColor,
                                                alignment=0x00000002)
            self.addControl(self.Header2)
            freeMemory = int(
                float(xbmc.getInfoLabel('System.Memory(free)')[:-2]) * .33)
            recMemory = int(
                float(xbmc.getInfoLabel('System.Memory(free)')[:-2]) * .23)
            msg3 = "[COLOR %s]Taille de la mémoire tampon de kodi. Si on le met à [COLOR %s]0[/COLOR] la mémoire tampon est mise sur le disque dur et pas sur la RAM.  Note: Pour la taille de mémoire définie ici, Kodi nécessitera 3 fois la quantité de RAM libre. Si ce paramètre est trop élevé, Kodi risque de se bloquer s'il ne dispose pas de suffisamment de RAM (mémoire libre: [COLOR %s]%s[/COLOR])[/COLOR]" % (
                COLOR2, COLOR1, COLOR1, freeMemory)
            self.Support3 = xbmcgui.ControlTextBox(
                leftside + int(BorderWidth * 2),
                firstrow + 30 + BorderWidth, (W / 2) - (BorderWidth * 4),
                220,
                font='font12',
                textColor=TxtColor)
            self.addControl(self.Support3)
            self.Support3.setText(msg3)
            try:
                self.videoCacheSize = xbmcgui.ControlSlider(
                    leftside + int(BorderWidth * 2.5),
                    firstrow + 240, (W / 2) - (BorderWidth * 5),
                    20,
                    texture=slidernibnofocus,
                    texturefocus=slidernibfocus,
                    orientation=xbmcgui.HORIZONTAL)
            except:
                self.videoCacheSize = xbmcgui.ControlSlider(
                    leftside + int(BorderWidth * 2.5),
                    firstrow + 240, (W / 2) - (BorderWidth * 5),
                    20,
                    texture=slidernibnofocus,
                    texturefocus=slidernibfocus)
            self.addControl(self.videoCacheSize)
            self.videomin = 0
            self.videomax = freeMemory if freeMemory < 2000 else 2000
            self.recommendedVideo = recMemory if recMemory < 500 else 500
            self.currentVideo = self.recommendedVideo
            videopos = 100 * float(self.currentVideo) / float(self.videomax)
            self.videoCacheSize.setPercent(videopos)
            current1 = '[COLOR %s]Votre Choix:[/COLOR] [COLOR %s]%s MB[/COLOR]' % (
                COLOR1, COLOR2, self.currentVideo)
            recommended1 = '[COLOR %s]Recommandé:[/COLOR] [COLOR %s]%s MB[/COLOR]' % (
                COLOR1, COLOR2, self.recommendedVideo)
            self.currentVideo1 = xbmcgui.ControlTextBox(leftside +
                                                        BorderWidth + 20,
                                                        firstrow + 260,
                                                        currentwidth,
                                                        20,
                                                        font=Font,
                                                        textColor=TxtColor)
            self.addControl(self.currentVideo1)
            self.currentVideo1.setText(current1)
            self.recommendedVideo1 = xbmcgui.ControlTextBox(
                leftside + BorderWidth + currentwidth,
                firstrow + 260,
                currentwidth,
                20,
                font=Font,
                textColor=TxtColor)
            self.addControl(self.recommendedVideo1)
            self.recommendedVideo1.setText(recommended1)

            header = '[COLOR %s]Temps avant la déconnexion au site[/COLOR]' % (
                COLOR2)
            self.Header3 = xbmcgui.ControlLabel(rightside,
                                                firstrow + 5,
                                                (W / 2) - (BorderWidth * 2),
                                                20,
                                                header,
                                                font='font13',
                                                textColor=TxtColor,
                                                alignment=0x00000002)
            self.addControl(self.Header3)
            msg3 = "[COLOR %s][B]curlclienttimeout[/B] est le temps en seconde pour arrêter la connexion au site internet sur dépassement du temps. \n[B]curllowspeedtime[/B] est le temps en seconde pour que le site soit considéré comme trop lent.\n\nPour les connexion lentes mettre 20s.[/COLOR]" % COLOR2
            self.Support3 = xbmcgui.ControlTextBox(
                rightside + int(BorderWidth * 2.5),
                firstrow + 50 + BorderWidth, (W / 2) - (BorderWidth * 4),
                220,
                font='font12',
                textColor=TxtColor)
            self.addControl(self.Support3)
            self.Support3.setText(msg3)
            try:
                self.CURLTimeout = xbmcgui.ControlSlider(
                    rightside + int(BorderWidth * 2.5),
                    firstrow + 240, (W / 2) - (BorderWidth * 5),
                    20,
                    texture=slidernibnofocus,
                    texturefocus=slidernibfocus,
                    orientation=xbmcgui.HORIZONTAL)
            except:
                self.CURLTimeout = xbmcgui.ControlSlider(
                    rightside + int(BorderWidth * 2.5),
                    firstrow + 240, (W / 2) - (BorderWidth * 5),
                    20,
                    texture=slidernibnofocus,
                    texturefocus=slidernibfocus)
            self.addControl(self.CURLTimeout)
            self.curlmin = 0
            self.curlmax = 20
            self.recommendedCurl = 10
            self.currentCurl = self.recommendedCurl
            curlpos = 100 * float(self.currentCurl) / float(self.curlmax)
            self.CURLTimeout.setPercent(curlpos)
            current2 = '[COLOR %s]Votre Choix:[/COLOR] [COLOR %s]%ss[/COLOR]' % (
                COLOR1, COLOR2, self.currentCurl)
            recommended2 = '[COLOR %s]Recommandé:[/COLOR] [COLOR %s]%ss[/COLOR]' % (
                COLOR1, COLOR2, self.recommendedCurl)
            self.currentCurl2 = xbmcgui.ControlTextBox(rightside +
                                                       (BorderWidth * 3),
                                                       firstrow + 260,
                                                       currentwidth,
                                                       20,
                                                       font=Font,
                                                       textColor=TxtColor)
            self.addControl(self.currentCurl2)
            self.currentCurl2.setText(current2)
            self.recommendedCurl2 = xbmcgui.ControlTextBox(
                rightside + (BorderWidth * 3) + currentwidth,
                firstrow + 260,
                currentwidth,
                20,
                font=Font,
                textColor=TxtColor)
            self.addControl(self.recommendedCurl2)
            self.recommendedCurl2.setText(recommended2)

            header = '[COLOR %s]Facteur de lecture de la mémoire tampon[/COLOR]' % (
                COLOR2)
            self.Header4 = xbmcgui.ControlLabel(leftside,
                                                secondrow + 5,
                                                (W / 2) - (BorderWidth * 2),
                                                20,
                                                header,
                                                font='font13',
                                                textColor=TxtColor,
                                                alignment=0x00000002)
            self.addControl(self.Header4)
            msg3 = "[COLOR %s]Par défaut 4, Kodi remplira la mémoire tampon un peu au-dessus de ce qui est nécessaire pour la lecture. En augmentant cette valeur kodi prendra de l'avance sur le téléchargement et remplira la mémoire tampon! Donc en augmentant cette valeur la connexion internet sera monopoliser par kodi avec une augmentation de l'utilisation du processeur...[/COLOR]" % COLOR2
            self.Support3 = xbmcgui.ControlTextBox(
                leftside + int(BorderWidth * 2),
                secondrow + 30 + BorderWidth, (W / 2) - (BorderWidth * 4),
                240,
                font='font12',
                textColor=TxtColor)
            self.addControl(self.Support3)
            self.Support3.setText(msg3)
            try:
                self.readBufferFactor = xbmcgui.ControlSlider(
                    leftside + int(BorderWidth * 2.5),
                    secondrow + 240, (W / 2) - (BorderWidth * 5),
                    20,
                    texture=slidernibnofocus,
                    texturefocus=slidernibfocus,
                    orientation=xbmcgui.HORIZONTAL)
            except:
                self.readBufferFactor = xbmcgui.ControlSlider(
                    leftside + int(BorderWidth * 2.5),
                    secondrow + 240, (W / 2) - (BorderWidth * 5),
                    20,
                    texture=slidernibnofocus,
                    texturefocus=slidernibfocus)
            self.addControl(self.readBufferFactor)
            self.readmin = 0
            self.readmax = 30
            self.recommendedRead = 5
            self.currentRead = self.recommendedRead
            readpos = 100 * float(self.currentRead) / float(self.readmax)
            self.readBufferFactor.setPercent(readpos)
            current3 = '[COLOR %s]Votre Choix:[/COLOR] [COLOR %s]%s[/COLOR]' % (
                COLOR1, COLOR2, self.currentRead)
            recommended3 = '[COLOR %s]Recommandé:[/COLOR] [COLOR %s]%s[/COLOR]' % (
                COLOR1, COLOR2, self.recommendedRead)
            self.currentRead3 = xbmcgui.ControlTextBox(leftside + BorderWidth +
                                                       30,
                                                       secondrow + 260,
                                                       currentwidth,
                                                       20,
                                                       font=Font,
                                                       textColor=TxtColor)
            self.addControl(self.currentRead3)
            self.currentRead3.setText(current3)
            self.recommendedRead3 = xbmcgui.ControlTextBox(
                leftside + BorderWidth + currentwidth,
                secondrow + 260,
                currentwidth,
                20,
                font=Font,
                textColor=TxtColor)
            self.addControl(self.recommendedRead3)
            self.recommendedRead3.setText(recommended3)

            header = '[COLOR %s]Mode mémoire tampon[/COLOR]' % (COLOR2)
            self.Header4 = xbmcgui.ControlLabel(rightside,
                                                secondrow + 5,
                                                (W / 2) - (BorderWidth * 2),
                                                20,
                                                header,
                                                font='font13',
                                                textColor=TxtColor,
                                                alignment=0x00000002)
            self.addControl(self.Header4)
            msg4 = "[COLOR %s]Ce paramètre permet de choisir quels types de fichiers seront mis en mémoire tampon. La valeur  par défaut et 0, Cela permet de mettre et mémoire tampon tous les fichiers distants.[/COLOR]" % COLOR2
            self.Support4 = xbmcgui.ControlTextBox(
                rightside + int(BorderWidth * 2),
                secondrow + 30 + BorderWidth, (W / 2) - (BorderWidth * 4),
                110,
                font='font12',
                textColor=TxtColor)
            self.addControl(self.Support4)
            self.Support4.setText(msg4)
            B1 = secondrow + 140 + BorderWidth
            B2 = B1 + 35
            B3 = B2 + 35
            B4 = B3 + 35
            self.Button0 = xbmcgui.ControlRadioButton(
                rightside + (BorderWidth * 3) - 22,
                B1, (W / 2) - (BorderWidth * 4) + 20,
                30,
                "0: Mémoriser les fichier d'internet et réseau local",
                font='font12',
                focusTexture=radiobgfocus,
                noFocusTexture=radiobgnofocus,
                focusOnTexture=radiofocus,
                noFocusOnTexture=radiofocus,
                focusOffTexture=radionofocus,
                noFocusOffTexture=radionofocus)
            self.Button1 = xbmcgui.ControlRadioButton(
                rightside + (BorderWidth * 3) - 22,
                B2, (W / 2) - (BorderWidth * 4) + 20,
                30,
                '1: Mémoriser tous les fichier',
                font='font12',
                focusTexture=radiobgfocus,
                noFocusTexture=radiobgnofocus,
                focusOnTexture=radiofocus,
                noFocusOnTexture=radiofocus,
                focusOffTexture=radionofocus,
                noFocusOffTexture=radionofocus)
            self.Button2 = xbmcgui.ControlRadioButton(
                rightside + (BorderWidth * 3) - 22,
                B3, (W / 2) - (BorderWidth * 4) + 20,
                30,
                "2: Mémoriser que les fichiers en streaming",
                font='font12',
                focusTexture=radiobgfocus,
                noFocusTexture=radiobgnofocus,
                focusOnTexture=radiofocus,
                noFocusOnTexture=radiofocus,
                focusOffTexture=radionofocus,
                noFocusOffTexture=radionofocus)
            self.Button3 = xbmcgui.ControlRadioButton(
                rightside + (BorderWidth * 3) - 22,
                B4, (W / 2) - (BorderWidth * 4) + 20,
                30,
                '3: Pas de mémoire tampon',
                font='font12',
                focusTexture=radiobgfocus,
                noFocusTexture=radiobgnofocus,
                focusOnTexture=radiofocus,
                noFocusOnTexture=radiofocus,
                focusOffTexture=radionofocus,
                noFocusOffTexture=radionofocus)
            self.addControl(self.Button0)
            self.addControl(self.Button1)
            self.addControl(self.Button2)
            self.addControl(self.Button3)
            self.Button0.setSelected(False)
            self.Button1.setSelected(False)
            self.Button2.setSelected(True)
            self.Button3.setSelected(False)

            self.buttonWrite = xbmcgui.ControlButton(
                leftside,
                T + H - BorderWidth, (W / 2) - (BorderWidth * 2),
                35,
                "Ecrire le fichier de configuration",
                textColor="0xFFFFFFFF",
                focusedColor="0xFFFFFFFF",
                alignment=2,
                focusTexture=buttonfocus,
                noFocusTexture=buttonnofocus)
            self.buttonCancel = xbmcgui.ControlButton(
                rightside + BorderWidth * 2,
                T + H - BorderWidth, (W / 2) - (BorderWidth * 2),
                35,
                "Annuler",
                textColor="0xFFFFFFFF",
                focusedColor="0xFFFFFFFF",
                alignment=2,
                focusTexture=buttonfocus,
                noFocusTexture=buttonnofocus)
            self.addControl(self.buttonWrite)
            self.addControl(self.buttonCancel)

            self.buttonWrite.controlLeft(self.buttonCancel)
            self.buttonWrite.controlRight(self.buttonCancel)
            self.buttonWrite.controlUp(self.Button3)
            self.buttonWrite.controlDown(self.videoCacheSize)
            self.buttonCancel.controlLeft(self.buttonWrite)
            self.buttonCancel.controlRight(self.buttonWrite)
            self.buttonCancel.controlUp(self.Button3)
            self.buttonCancel.controlDown(self.videoCacheSize)
            self.currentVideo1.controlUp(self.buttonWrite)
            self.currentVideo1.controlDown(self.CURLTimeout)
            self.videoCacheSize.controlUp(self.buttonWrite)
            self.videoCacheSize.controlDown(self.CURLTimeout)
            self.CURLTimeout.controlUp(self.videoCacheSize)
            self.CURLTimeout.controlDown(self.readBufferFactor)
            self.readBufferFactor.controlUp(self.CURLTimeout)
            self.readBufferFactor.controlDown(self.Button0)
            self.Button0.controlUp(self.CURLTimeout)
            self.Button0.controlDown(self.Button1)
            self.Button0.controlLeft(self.readBufferFactor)
            self.Button0.controlRight(self.readBufferFactor)
            self.Button1.controlUp(self.Button0)
            self.Button1.controlDown(self.Button2)
            self.Button1.controlLeft(self.readBufferFactor)
            self.Button1.controlRight(self.readBufferFactor)
            self.Button2.controlUp(self.Button1)
            self.Button2.controlDown(self.Button3)
            self.Button2.controlLeft(self.readBufferFactor)
            self.Button2.controlRight(self.readBufferFactor)
            self.Button3.controlUp(self.Button2)
            self.Button3.controlDown(self.buttonWrite)
            self.Button3.controlLeft(self.readBufferFactor)
            self.Button3.controlRight(self.readBufferFactor)
            self.setFocus(self.videoCacheSize)
Ejemplo n.º 19
0
		def __init__(self,msg='',L=0,T=0,W=1280,H=720,TxtColor='0xFFFFFFFF',Font='font10',BorderWidth=10):
			buttonfocus, buttonnofocus = artwork('button')
			radiobgfocus, radiobgnofocus, radiofocus, radionofocus = artwork('radio')
			slidernibfocus, slidernibnofocus, sliderfocus, slidernofocus = artwork('slider')
			image_path = os.path.join(ART, 'ContentPanel.png')
			boxbg = os.path.join(ART, 'bgg2.png')
			self.border = xbmcgui.ControlImage(L,T,W,H, image_path)
			self.addControl(self.border); 
			self.BG=xbmcgui.ControlImage(L+BorderWidth,T+BorderWidth,W-(BorderWidth*2),H-(BorderWidth*2), FANART, aspectRatio=0, colorDiffuse='0x5FFFFFFF')
			self.addControl(self.BG)
			top = T+BorderWidth
			leftside = L+BorderWidth
			rightside = L+(W/2)-(BorderWidth*2)
			firstrow = top+30
			secondrow = firstrow+275+(BorderWidth/2)
			currentwidth = ((W/2)-(BorderWidth*4))/2
			
			header = '[COLOR lime]Konfigurator naprednih postavki[/COLOR]'
			self.Header=xbmcgui.ControlLabel(L, top, W, 30, header, font='font13', textColor=TxtColor, alignment=0x00000002)
			self.addControl(self.Header)
			top += 30+BorderWidth
			self.bgarea = xbmcgui.ControlImage(leftside, firstrow, rightside-L, 275, boxbg, aspectRatio=0, colorDiffuse='0x5FFFFFFF')
			self.addControl(self.bgarea)
			self.bgarea2 = xbmcgui.ControlImage(rightside+BorderWidth+BorderWidth, firstrow, rightside-L, 275, boxbg, aspectRatio=0, colorDiffuse='0x5FFFFFFF')
			self.addControl(self.bgarea2)
			self.bgarea3 = xbmcgui.ControlImage(leftside, secondrow, rightside-L, 275, boxbg, aspectRatio=0, colorDiffuse='0x5FFFFFFF')
			self.addControl(self.bgarea3)
			self.bgarea4 = xbmcgui.ControlImage(rightside+BorderWidth+BorderWidth, secondrow, rightside-L, 275, boxbg, aspectRatio=0, colorDiffuse='0x5FFFFFFF')
			self.addControl(self.bgarea4)
			
			header = '[COLOR white]Predmemorija videozapisa (Buffering)[/COLOR]'
			self.Header2=xbmcgui.ControlLabel(leftside+BorderWidth, firstrow+5, (W/2)-(BorderWidth*2), 20, header, font='font13', textColor=TxtColor, alignment=0x00000002)
			self.addControl(self.Header2)
			freeMemory = int(float(wiz.getInfo('System.Memory(free)')[:-2])*.33)
			recMemory = int(float(wiz.getInfo('System.Memory(free)')[:-2])*.23)
			msg3 = "[COLOR lime]Bajtovi koji se koriste za pohranu stream-ova. Postavkom na[/COLOR] [COLOR white]0[/COLOR] [COLOR lime]predmemorija ce se zapisivati na Hard disk umjesto u RAM.[/COLOR] [COLOR white]Napomena[/COLOR][COLOR lime]: Kodi zahtijeva 3x vise slobodne RAM memorije. Vrijednost ove postavke moze uzrokovati rusenje Kodi-a. 1/3 slobodne memorije[/COLOR] [COLOR white]%s[/COLOR]" % (freeMemory)
			self.Support3=xbmcgui.ControlTextBox(leftside+int(BorderWidth*1.5), firstrow+30+BorderWidth, (W/2)-(BorderWidth*4), 150, font='font12', textColor=TxtColor)
			self.addControl(self.Support3)
			self.Support3.setText(msg3)
			try: self.videoCacheSize=xbmcgui.ControlSlider(leftside+int(BorderWidth*1.5), firstrow+210,(W/2)-(BorderWidth*5),20, textureback=sliderfocus, texture=slidernibnofocus, texturefocus=slidernibfocus, orientation=xbmcgui.HORIZONTAL)
			except: self.videoCacheSize=xbmcgui.ControlSlider(leftside+int(BorderWidth*1.5), firstrow+210,(W/2)-(BorderWidth*5),20, textureback=sliderfocus, texture=slidernibnofocus, texturefocus=slidernibfocus)
			self.addControl(self.videoCacheSize)
			self.videomin = 0; self.videomax = freeMemory if freeMemory < 2000 else 2000
			self.recommendedVideo = recMemory if recMemory < 500 else 500; self.currentVideo = self.recommendedVideo
			videopos = wiz.percentage(self.currentVideo, self.videomax)
			self.videoCacheSize.setPercent(videopos)
			current1 = '[COLOR lime]Trenutno:[/COLOR] [COLOR white]%s MB[/COLOR]' % ( self.currentVideo)
			recommended1 = '[COLOR lime]Preporuceno:[/COLOR] [COLOR white]%s MB[/COLOR]' % ( self.recommendedVideo)
			self.currentVideo1=xbmcgui.ControlTextBox(leftside+BorderWidth,firstrow+235,currentwidth,20,font=Font,textColor=TxtColor)
			self.addControl(self.currentVideo1)
			self.currentVideo1.setText(current1)
			self.recommendedVideo1=xbmcgui.ControlTextBox(leftside+BorderWidth+currentwidth,firstrow+235,currentwidth,20,font=Font,textColor=TxtColor)
			self.addControl(self.recommendedVideo1)
			self.recommendedVideo1.setText(recommended1)
			
			header = '[COLOR white]CURL Timeout/CURL Mala brzina[/COLOR]'
			self.Header3=xbmcgui.ControlLabel(rightside+BorderWidth, firstrow+5, (W/2)-(BorderWidth*2), 20, header, font='font13', textColor=TxtColor, alignment=0x00000002)
			self.addControl(self.Header3)
			msg3 = "[COLOR white]CURL Timeout[/COLOR] [COLOR lime]je vrijeme u sekundama, potrebno da se prekine veza sa serverom - kad nema odgovora.[/COLOR] [COLOR white]CURL Mala brzina[/COLOR] [COLOR lime]je vrijeme u sekundama potrebno za utvrdivanje brzine veze. Za sporiju vezu postavite na[/COLOR] [COLOR white]20[/COLOR][COLOR lime].[/COLOR]"
			self.Support3=xbmcgui.ControlTextBox(rightside+int(BorderWidth*3.5), firstrow+30+BorderWidth, (W/2)-(BorderWidth*4), 150, font='font12', textColor=TxtColor)
			self.addControl(self.Support3)
			self.Support3.setText(msg3)
			try: self.CURLTimeout=xbmcgui.ControlSlider(rightside+int(BorderWidth*3.5),firstrow+210,(W/2)-(BorderWidth*5),20, textureback=sliderfocus, texture=slidernibnofocus, texturefocus=slidernibfocus, orientation=xbmcgui.HORIZONTAL)
			except: self.CURLTimeout=xbmcgui.ControlSlider(rightside+int(BorderWidth*3.5),firstrow+210,(W/2)-(BorderWidth*5),20, textureback=sliderfocus, texture=slidernibnofocus, texturefocus=slidernibfocus)
			self.addControl(self.CURLTimeout)
			self.curlmin = 0; self.curlmax = 20
			self.recommendedCurl = 10; self.currentCurl = self.recommendedCurl
			curlpos = wiz.percentage(self.currentCurl, self.curlmax)
			self.CURLTimeout.setPercent(curlpos)
			current2 = '[COLOR lime]Trenutno:[/COLOR] [COLOR white]%ss[/COLOR]' % (self.currentCurl)
			recommended2 = '[COLOR lime]Preporuceno:[/COLOR] [COLOR white]%ss[/COLOR]' % (self.recommendedCurl)
			self.currentCurl2=xbmcgui.ControlTextBox(rightside+(BorderWidth*3),firstrow+235,currentwidth,20,font=Font,textColor=TxtColor)
			self.addControl(self.currentCurl2)
			self.currentCurl2.setText(current2)
			self.recommendedCurl2=xbmcgui.ControlTextBox(rightside+(BorderWidth*3)+currentwidth,firstrow+235,currentwidth,20,font=Font,textColor=TxtColor)
			self.addControl(self.recommendedCurl2)
			self.recommendedCurl2.setText(recommended2)
			
			header = '[COLOR white]Faktor ucitavanja predmemorije[/COLOR]'
			self.Header4=xbmcgui.ControlLabel(leftside, secondrow+5, (W/2)-(BorderWidth*2), 20, header, font='font13', textColor=TxtColor, alignment=0x00000002)
			self.addControl(self.Header4)
			msg3 = "[COLOR lime]Vrijednost ove postavke je mnozitelj default-nog ogranicenja. Ako Kodi ucitava BlueRay datoteku na 36 Mbit/s, vrijednost od 2 ce trebati 72 Mbit/s propusnosti mreze.[/COLOR] [COLOR white]Napomena[/COLOR][COLOR lime]: Za razliku od RAM postavke, ovu postavku mozete sigurno povecati na zeljenu visinu i Kodi se nece srusiti.[/COLOR]"
			self.Support3=xbmcgui.ControlTextBox(leftside+int(BorderWidth*1.5), secondrow+30+BorderWidth, (W/2)-(BorderWidth*4), 150, font='font12', textColor=TxtColor)
			self.addControl(self.Support3)
			self.Support3.setText(msg3)
			try: self.readBufferFactor=xbmcgui.ControlSlider(leftside+int(BorderWidth*1.5), secondrow+210,(W/2)-(BorderWidth*5),20, textureback=sliderfocus, texture=slidernibnofocus, texturefocus=slidernibfocus, orientation=xbmcgui.HORIZONTAL)
			except: self.readBufferFactor=xbmcgui.ControlSlider(leftside+int(BorderWidth*1.5), secondrow+210,(W/2)-(BorderWidth*5),20, textureback=sliderfocus, texture=slidernibnofocus, texturefocus=slidernibfocus)
			self.addControl(self.readBufferFactor)
			self.readmin = 0; self.readmax = 10
			self.recommendedRead = 5; self.currentRead = self.recommendedRead
			readpos = wiz.percentage(self.currentRead, self.readmax)
			self.readBufferFactor.setPercent(readpos)
			current3 = '[COLOR lime]Trenutno:[/COLOR] [COLOR white]%s[/COLOR]' % ( self.currentRead)
			recommended3 = '[COLOR lime]Preporuceno:[/COLOR] [COLOR white]%s[/COLOR]' % (self.recommendedRead)
			self.currentRead3=xbmcgui.ControlTextBox(leftside+BorderWidth,secondrow+235,currentwidth,20,font=Font,textColor=TxtColor)
			self.addControl(self.currentRead3)
			self.currentRead3.setText(current3)
			self.recommendedRead3=xbmcgui.ControlTextBox(leftside+BorderWidth+currentwidth,secondrow+235,currentwidth,20,font=Font,textColor=TxtColor)
			self.addControl(self.recommendedRead3)
			self.recommendedRead3.setText(recommended3)
			
			header = '[COLOR white]Nacin rada predmemorije[/COLOR]'
			self.Header4=xbmcgui.ControlLabel(rightside+BorderWidth, secondrow+5, (W/2)-(BorderWidth*2), 20, header, font='font13', textColor=TxtColor, alignment=0x00000002)
			self.addControl(self.Header4)
			msg4 = "[COLOR lime]Ova postavka prisiljava Kodi da koristi predmemoriju za sav video, lokalnu mrezu, internet i Hard disk. Zadana vrijednost je[/COLOR] [COLOR white]0[/COLOR] [COLOR lime]i predmemorija ce se koristiti za videozapise koji se ucitavaju putem interneta.[/COLOR]"
			self.Support4=xbmcgui.ControlTextBox(rightside+int(BorderWidth*3.5), secondrow+30+BorderWidth, (W/2)-(BorderWidth*4), 110, font='font12', textColor=TxtColor)
			self.addControl(self.Support4)
			self.Support4.setText(msg4)
			B1 = secondrow+130+BorderWidth; B2 = B1+30; B3 = B2+30; B4 = B3+30;
			self.Button0 = xbmcgui.ControlRadioButton(rightside+(BorderWidth*3), B1, (W/2)-(BorderWidth*4), 30, '[COLOR white]Predmemorija svih internetskih sustava[/COLOR]', font='font10', focusTexture=radiobgfocus, noFocusTexture=radiobgnofocus, focusOnTexture=radiofocus, noFocusOnTexture=radiofocus, focusOffTexture=radionofocus, noFocusOffTexture=radionofocus)
			self.Button1 = xbmcgui.ControlRadioButton(rightside+(BorderWidth*3), B2, (W/2)-(BorderWidth*4), 30, '[COLOR white]Predmemorija svih sustava[/COLOR]', font='font10', focusTexture=radiobgfocus, noFocusTexture=radiobgnofocus, focusOnTexture=radiofocus, noFocusOnTexture=radiofocus, focusOffTexture=radionofocus, noFocusOffTexture=radionofocus)
			self.Button2 = xbmcgui.ControlRadioButton(rightside+(BorderWidth*3), B3, (W/2)-(BorderWidth*4), 30, '[COLOR white]Samo predmemorija internetskih sustava[/COLOR]', font='font10', focusTexture=radiobgfocus, noFocusTexture=radiobgnofocus, focusOnTexture=radiofocus, noFocusOnTexture=radiofocus, focusOffTexture=radionofocus, noFocusOffTexture=radionofocus)
			self.Button3 = xbmcgui.ControlRadioButton(rightside+(BorderWidth*3), B4, (W/2)-(BorderWidth*4), 30, '[COLOR white]Bez predmemorije[/COLOR]', font='font10', focusTexture=radiobgfocus, noFocusTexture=radiobgnofocus, focusOnTexture=radiofocus, noFocusOnTexture=radiofocus, focusOffTexture=radionofocus, noFocusOffTexture=radionofocus)
			self.addControl(self.Button0)
			self.addControl(self.Button1)
			self.addControl(self.Button2)
			self.addControl(self.Button3)
			self.Button0.setSelected(False)
			self.Button1.setSelected(False)
			self.Button2.setSelected(True)
			self.Button3.setSelected(False)
			
			self.buttonWrite=xbmcgui.ControlButton(leftside,T+H-40-BorderWidth,(W/2)-(BorderWidth*2),35,"Napravi datoteku",textColor="0xFFFFFFFF",focusedColor="0xFF04fc05",alignment=2,focusTexture=buttonfocus,noFocusTexture=buttonnofocus)
			self.buttonCancel=xbmcgui.ControlButton(rightside+BorderWidth*2,T+H-40-BorderWidth,(W/2)-(BorderWidth*2),35,"Odustani",textColor="0xFFFFFFFF",focusedColor="0xFF04fc05",alignment=2,focusTexture=buttonfocus,noFocusTexture=buttonnofocus)
			self.addControl(self.buttonWrite); self.addControl(self.buttonCancel)
			
			self.buttonWrite.controlLeft(self.buttonCancel); self.buttonWrite.controlRight(self.buttonCancel); self.buttonWrite.controlUp(self.Button3); self.buttonWrite.controlDown(self.videoCacheSize)
			self.buttonCancel.controlLeft(self.buttonWrite); self.buttonCancel.controlRight(self.buttonWrite); self.buttonCancel.controlUp(self.Button3); self.buttonCancel.controlDown(self.videoCacheSize)
			self.videoCacheSize.controlUp(self.buttonWrite); self.videoCacheSize.controlDown(self.CURLTimeout)
			self.CURLTimeout.controlUp(self.videoCacheSize); self.CURLTimeout.controlDown(self.readBufferFactor)
			self.readBufferFactor.controlUp(self.CURLTimeout); self.readBufferFactor.controlDown(self.Button0)
			self.Button0.controlUp(self.CURLTimeout); self.Button0.controlDown(self.Button1); self.Button0.controlLeft(self.readBufferFactor); self.Button0.controlRight(self.readBufferFactor);
			self.Button1.controlUp(self.Button0); self.Button1.controlDown(self.Button2); self.Button1.controlLeft(self.readBufferFactor); self.Button1.controlRight(self.readBufferFactor);
			self.Button2.controlUp(self.Button1); self.Button2.controlDown(self.Button3); self.Button2.controlLeft(self.readBufferFactor); self.Button2.controlRight(self.readBufferFactor);
			self.Button3.controlUp(self.Button2); self.Button3.controlDown(self.buttonWrite); self.Button3.controlLeft(self.readBufferFactor); self.Button3.controlRight(self.readBufferFactor);
			self.setFocus(self.videoCacheSize)
Ejemplo n.º 20
0
    def onInit(self):
        self.getControl(10004).setEnabled(False)
        self.getControl(10005).setEnabled(False)
        self.getControl(10006).setEnabled(False)
        self.ok_enabled = False
        self.default_enabled = False

        if xbmcgui.__version__ == "1.2":
            self.setCoordinateResolution(1)
        else:
            self.setCoordinateResolution(5)

        # Ponemos el título
        self.getControl(10002).setLabel(self.caption)

        if self.custom_button is not None:
            if self.custom_button['visible']:
                self.getControl(10006).setLabel(self.custom_button['label'])
            else:
                self.getControl(10006).setVisible(False)
                self.getControl(10004).setPosition(
                    self.getControl(10004).getPosition()[0] + 80,
                    self.getControl(10004).getPosition()[1])
                self.getControl(10005).setPosition(
                    self.getControl(10005).getPosition()[0] + 80,
                    self.getControl(10005).getPosition()[1])

        # 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).getPosition(
        )[0] + self.getControl(10001).getPosition()[0] + 10
        self.controls_pos_y = self.getControl(
            10007).getPosition()[1] + self.getControl(10001).getPosition()[1]
        self.height_control = 35
        self.font = "font12"

        # En versiones antiguas: creamos 5 controles, de lo conrtario al hacer click al segundo control,
        # automaticamente cambia el label del tercero a "Short By: Name" no se porque...
        if xbmcgui.ControlEdit == ControlEdit:
            for x in range(5):
                control = xbmcgui.ControlRadioButton(-500, 0, 0, 0, "")
                self.addControl(control)

        for c in self.list_controls:
            # 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 len([
                    control.get("id") for control in self.list_controls
                    if c["id"] == control.get("id")
            ]) > 1:
                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":
                default = False
            elif c["type"] == "list":
                default = 0
            else:
                # label or text
                default = ""

            c["default"] = c.get("default", default)
            c["color"] = c.get("color", "0xFF0066CC")
            c["visible"] = c.get("visible", True)
            c["enabled"] = c.get("enabled", True)

            if c["type"] == "label" and "id" not in c:
                c["id"] = None

            if c["type"] == "text":
                c["hidden"] = c.get("hidden", False)

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

            if c["type"] == "bool":
                self.add_control_bool(c)

            elif c["type"] == 'text':
                self.add_control_text(c)

            elif c["type"] == 'list':
                self.add_control_list(c)

            elif c["type"] == 'label':
                self.add_control_label(c)

        self.list_controls = [c for c in self.list_controls if "control" in c]

        self.evaluate_conditions()
        self.index = -1
        self.dispose_controls(0)
        self.getControl(100010).setVisible(False)
        self.getControl(10004).setEnabled(True)
        self.getControl(10005).setEnabled(True)
        self.getControl(10006).setEnabled(True)
        self.ok_enabled = True
        self.default_enabled = True
        self.check_default()
        self.check_ok(self.values)
Ejemplo n.º 21
0
        def __init__(self,
                     msg='',
                     L=0,
                     T=0,
                     W=1280,
                     H=720,
                     TxtColor='0xFFFFFFFF',
                     Font='font12',
                     BorderWidth=10):
            buttonfocus, buttonnofocus = artwork('button')
            radiobgfocus, radiobgnofocus, radiofocus, radionofocus = artwork(
                'radio')
            slidernibfocus, slidernibnofocus, sliderfocus, slidernofocus = artwork(
                'slider')
            image_path = os.path.join(ART, 'ContentPanel.png')
            boxbg = os.path.join(ART, 'bgg2.png')
            self.border = xbmcgui.ControlImage(L, T, W, H, image_path)
            self.addControl(self.border)
            self.BG = xbmcgui.ControlImage(L + BorderWidth,
                                           T + BorderWidth,
                                           W - (BorderWidth * 2),
                                           H - (BorderWidth * 2),
                                           FANART,
                                           aspectRatio=0,
                                           colorDiffuse='0x5FFFFFFF')
            self.addControl(self.BG)
            top = T + BorderWidth
            leftside = L + BorderWidth
            rightside = L + (W / 2) - (BorderWidth * 2)
            firstrow = top + 30
            secondrow = firstrow + 275 + (BorderWidth / 2)
            currentwidth = ((W / 2) - (BorderWidth * 4)) / 2

            header = '[COLOR %s]Advanced Settings Configuracion[/COLOR]' % (
                COLOR2)
            self.Header = xbmcgui.ControlLabel(L,
                                               top,
                                               W,
                                               30,
                                               header,
                                               font='font13',
                                               textColor=TxtColor,
                                               alignment=0x00000002)
            self.addControl(self.Header)
            top += 30 + BorderWidth
            self.bgarea = xbmcgui.ControlImage(leftside,
                                               firstrow,
                                               rightside - L,
                                               275,
                                               boxbg,
                                               aspectRatio=0,
                                               colorDiffuse='0x5FFFFFFF')
            self.addControl(self.bgarea)
            self.bgarea2 = xbmcgui.ControlImage(rightside + BorderWidth +
                                                BorderWidth,
                                                firstrow,
                                                rightside - L,
                                                275,
                                                boxbg,
                                                aspectRatio=0,
                                                colorDiffuse='0x5FFFFFFF')
            self.addControl(self.bgarea2)
            self.bgarea3 = xbmcgui.ControlImage(leftside,
                                                secondrow,
                                                rightside - L,
                                                275,
                                                boxbg,
                                                aspectRatio=0,
                                                colorDiffuse='0x5FFFFFFF')
            self.addControl(self.bgarea3)
            self.bgarea4 = xbmcgui.ControlImage(rightside + BorderWidth +
                                                BorderWidth,
                                                secondrow,
                                                rightside - L,
                                                275,
                                                boxbg,
                                                aspectRatio=0,
                                                colorDiffuse='0x5FFFFFFF')
            self.addControl(self.bgarea4)

            header = '[COLOR %s]Video Cache[/COLOR]' % (COLOR2)
            self.Header2 = xbmcgui.ControlLabel(leftside + BorderWidth,
                                                firstrow + 5,
                                                (W / 2) - (BorderWidth * 2),
                                                20,
                                                header,
                                                font='font13',
                                                textColor=TxtColor,
                                                alignment=0x00000002)
            self.addControl(self.Header2)
            freeMemory = int(
                float(wiz.getInfo('System.Memory(free)')[:-2]) * .33)
            recMemory = int(
                float(wiz.getInfo('System.Memory(free)')[:-2]) * .23)
            msg3 = "[COLOR %s]Numero de bytes utilizados para almacenar secuencias en la memoria. Cuando se establece en [COLOR %s]0[/COLOR] a cache se escribira en el disco en lugar de la RAM. Nota: Kodi requerira 3 veces la cantidad de RAM para ser libre. Establecer esto demasiado alto podria hacer que Kodi se bloquee si no puede obtener suficiente RAM (1/3 de memoria libre: [COLOR %s]%s[/COLOR])[/COLOR]" % (
                COLOR2, COLOR1, COLOR1, freeMemory)
            self.Support3 = xbmcgui.ControlTextBox(
                leftside + int(BorderWidth * 1.5),
                firstrow + 30 + BorderWidth, (W / 2) - (BorderWidth * 4),
                150,
                font='font10',
                textColor=TxtColor)
            self.addControl(self.Support3)
            self.Support3.setText(msg3)
            try:
                self.videoCacheSize = xbmcgui.ControlSlider(
                    leftside + int(BorderWidth * 1.5),
                    firstrow + 210, (W / 2) - (BorderWidth * 5),
                    20,
                    textureback=sliderfocus,
                    texture=slidernibnofocus,
                    texturefocus=slidernibfocus,
                    orientation=xbmcgui.HORIZONTAL)
            except:
                self.videoCacheSize = xbmcgui.ControlSlider(
                    leftside + int(BorderWidth * 1.5),
                    firstrow + 210, (W / 2) - (BorderWidth * 5),
                    20,
                    textureback=sliderfocus,
                    texture=slidernibnofocus,
                    texturefocus=slidernibfocus)
            self.addControl(self.videoCacheSize)
            self.videomin = 0
            self.videomax = freeMemory if freeMemory < 2000 else 2000
            self.recommendedVideo = recMemory if recMemory < 500 else 500
            self.currentVideo = self.recommendedVideo
            videopos = wiz.percentage(self.currentVideo, self.videomax)
            self.videoCacheSize.setPercent(videopos)
            current1 = '[COLOR %s]Presente:[/COLOR] [COLOR %s]%s MB[/COLOR]' % (
                COLOR1, COLOR2, self.currentVideo)
            recommended1 = '[COLOR %s]Recomendado:[/COLOR] [COLOR %s]%s MB[/COLOR]' % (
                COLOR1, COLOR2, self.recommendedVideo)
            self.currentVideo1 = xbmcgui.ControlTextBox(leftside + BorderWidth,
                                                        firstrow + 235,
                                                        currentwidth,
                                                        20,
                                                        font=Font,
                                                        textColor=TxtColor)
            self.addControl(self.currentVideo1)
            self.currentVideo1.setText(current1)
            self.recommendedVideo1 = xbmcgui.ControlTextBox(
                leftside + BorderWidth + currentwidth,
                firstrow + 235,
                currentwidth,
                20,
                font=Font,
                textColor=TxtColor)
            self.addControl(self.recommendedVideo1)
            self.recommendedVideo1.setText(recommended1)

            header = '[COLOR %s]CURL Tiempo de espera / CURL baja velocidad[/COLOR]' % (
                COLOR2)
            self.Header3 = xbmcgui.ControlLabel(rightside + BorderWidth,
                                                firstrow + 5,
                                                (W / 2) - (BorderWidth * 2),
                                                20,
                                                header,
                                                font='font13',
                                                textColor=TxtColor,
                                                alignment=0x00000002)
            self.addControl(self.Header3)
            msg3 = "[COLOR %s][B]tiempo de espera del cliente curl[/B] es el tiempo en segundos de cuanto tiempo tarda la conexion de libcurl en agotar el tiempo y [B]Tiempo de velocidad actual[/B] es el tiempo en segundos que libcurl considera una conexion a velocidad baja. Para conexiones mas lentas, configurelo en 20.[/COLOR]" % COLOR2
            self.Support3 = xbmcgui.ControlTextBox(
                rightside + int(BorderWidth * 3.5),
                firstrow + 30 + BorderWidth, (W / 2) - (BorderWidth * 4),
                150,
                font='font10',
                textColor=TxtColor)
            self.addControl(self.Support3)
            self.Support3.setText(msg3)
            try:
                self.CURLTimeout = xbmcgui.ControlSlider(
                    rightside + int(BorderWidth * 3.5),
                    firstrow + 210, (W / 2) - (BorderWidth * 5),
                    20,
                    textureback=sliderfocus,
                    texture=slidernibnofocus,
                    texturefocus=slidernibfocus,
                    orientation=xbmcgui.HORIZONTAL)
            except:
                self.CURLTimeout = xbmcgui.ControlSlider(
                    rightside + int(BorderWidth * 3.5),
                    firstrow + 210, (W / 2) - (BorderWidth * 5),
                    20,
                    textureback=sliderfocus,
                    texture=slidernibnofocus,
                    texturefocus=slidernibfocus)
            self.addControl(self.CURLTimeout)
            self.curlmin = 0
            self.curlmax = 20
            self.recommendedCurl = 10
            self.currentCurl = self.recommendedCurl
            curlpos = wiz.percentage(self.currentCurl, self.curlmax)
            self.CURLTimeout.setPercent(curlpos)
            current2 = '[COLOR %s]Presente:[/COLOR] [COLOR %s]%ss[/COLOR]' % (
                COLOR1, COLOR2, self.currentCurl)
            recommended2 = '[COLOR %s]Recomendado:[/COLOR] [COLOR %s]%ss[/COLOR]' % (
                COLOR1, COLOR2, self.recommendedCurl)
            self.currentCurl2 = xbmcgui.ControlTextBox(rightside +
                                                       (BorderWidth * 3),
                                                       firstrow + 235,
                                                       currentwidth,
                                                       20,
                                                       font=Font,
                                                       textColor=TxtColor)
            self.addControl(self.currentCurl2)
            self.currentCurl2.setText(current2)
            self.recommendedCurl2 = xbmcgui.ControlTextBox(
                rightside + (BorderWidth * 3) + currentwidth,
                firstrow + 235,
                currentwidth,
                20,
                font=Font,
                textColor=TxtColor)
            self.addControl(self.recommendedCurl2)
            self.recommendedCurl2.setText(recommended2)

            header = '[COLOR %s]Leer Factor de Buffer[/COLOR]' % (COLOR2)
            self.Header4 = xbmcgui.ControlLabel(leftside,
                                                secondrow + 5,
                                                (W / 2) - (BorderWidth * 2),
                                                20,
                                                header,
                                                font='font13',
                                                textColor=TxtColor,
                                                alignment=0x00000002)
            self.addControl(self.Header4)
            msg3 = "[COLOR %s]El valor de esta configuracion es un multiplicador del limite predeterminado. Si Kodi esta cargando un archivo raw bluray tipico a 36 Mbit / s, entonces un valor de 2 necesitara al menos 72 Mbit / s de ancho de banda de red. Sin embargo, a diferencia de la configuracion de la RAM, puede aumentar este valor de manera segura por alto que desee, y Kodi no se bloqueara.[/COLOR]" % COLOR2
            self.Support3 = xbmcgui.ControlTextBox(
                leftside + int(BorderWidth * 1.5),
                secondrow + 30 + BorderWidth, (W / 2) - (BorderWidth * 4),
                150,
                font='font10',
                textColor=TxtColor)
            self.addControl(self.Support3)
            self.Support3.setText(msg3)
            try:
                self.readBufferFactor = xbmcgui.ControlSlider(
                    leftside + int(BorderWidth * 1.5),
                    secondrow + 210, (W / 2) - (BorderWidth * 5),
                    20,
                    textureback=sliderfocus,
                    texture=slidernibnofocus,
                    texturefocus=slidernibfocus,
                    orientation=xbmcgui.HORIZONTAL)
            except:
                self.readBufferFactor = xbmcgui.ControlSlider(
                    leftside + int(BorderWidth * 1.5),
                    secondrow + 210, (W / 2) - (BorderWidth * 5),
                    20,
                    textureback=sliderfocus,
                    texture=slidernibnofocus,
                    texturefocus=slidernibfocus)
            self.addControl(self.readBufferFactor)
            self.readmin = 0
            self.readmax = 10
            self.recommendedRead = 5
            self.currentRead = self.recommendedRead
            readpos = wiz.percentage(self.currentRead, self.readmax)
            self.readBufferFactor.setPercent(readpos)
            current3 = '[COLOR %s]presente:[/COLOR] [COLOR %s]%s[/COLOR]' % (
                COLOR1, COLOR2, self.currentRead)
            recommended3 = '[COLOR %s]Recomendado:[/COLOR] [COLOR %s]%s[/COLOR]' % (
                COLOR1, COLOR2, self.recommendedRead)
            self.currentRead3 = xbmcgui.ControlTextBox(leftside + BorderWidth,
                                                       secondrow + 235,
                                                       currentwidth,
                                                       20,
                                                       font=Font,
                                                       textColor=TxtColor)
            self.addControl(self.currentRead3)
            self.currentRead3.setText(current3)
            self.recommendedRead3 = xbmcgui.ControlTextBox(
                leftside + BorderWidth + currentwidth,
                secondrow + 235,
                currentwidth,
                20,
                font=Font,
                textColor=TxtColor)
            self.addControl(self.recommendedRead3)
            self.recommendedRead3.setText(recommended3)

            header = '[COLOR %s]Modo Buffer[/COLOR]' % (COLOR2)
            self.Header4 = xbmcgui.ControlLabel(rightside + BorderWidth,
                                                secondrow + 5,
                                                (W / 2) - (BorderWidth * 2),
                                                20,
                                                header,
                                                font='font10',
                                                textColor=TxtColor,
                                                alignment=0x00000002)
            self.addControl(self.Header4)
            msg4 = "[COLOR %s]Esta configuracion obligara a Kodi a usar un cache para todos los archivos de video, incluida la red local, Internet e incluso el disco duro local. El valor predeterminado es 0 y solo almacenara en cache videos que usen rutas / fuentes de archivos de Internet.[/COLOR]" % COLOR2
            self.Support4 = xbmcgui.ControlTextBox(
                rightside + int(BorderWidth * 3.5),
                secondrow + 30 + BorderWidth, (W / 2) - (BorderWidth * 4),
                110,
                font='font10',
                textColor=TxtColor)
            self.addControl(self.Support4)
            self.Support4.setText(msg4)
            B1 = secondrow + 130 + BorderWidth
            B2 = B1 + 30
            B3 = B2 + 30
            B4 = B3 + 30
            self.Button0 = xbmcgui.ControlRadioButton(
                rightside + (BorderWidth * 3),
                B1, (W / 2) - (BorderWidth * 4),
                30,
                '0: Buffer todos los sistemas de archivos de internet',
                font='font12',
                focusTexture=radiobgfocus,
                noFocusTexture=radiobgnofocus,
                focusOnTexture=radiofocus,
                noFocusOnTexture=radiofocus,
                focusOffTexture=radionofocus,
                noFocusOffTexture=radionofocus)
            self.Button1 = xbmcgui.ControlRadioButton(
                rightside + (BorderWidth * 3),
                B2, (W / 2) - (BorderWidth * 4),
                30,
                '1: Buffer todos los sistemas de archivos',
                font='font12',
                focusTexture=radiobgfocus,
                noFocusTexture=radiobgnofocus,
                focusOnTexture=radiofocus,
                noFocusOnTexture=radiofocus,
                focusOffTexture=radionofocus,
                noFocusOffTexture=radionofocus)
            self.Button2 = xbmcgui.ControlRadioButton(
                rightside + (BorderWidth * 3),
                B3, (W / 2) - (BorderWidth * 4),
                30,
                '2: Solo almacenar en buffer los verdaderos sistemas de archivos de Internet',
                font='font12',
                focusTexture=radiobgfocus,
                noFocusTexture=radiobgnofocus,
                focusOnTexture=radiofocus,
                noFocusOnTexture=radiofocus,
                focusOffTexture=radionofocus,
                noFocusOffTexture=radionofocus)
            self.Button3 = xbmcgui.ControlRadioButton(
                rightside + (BorderWidth * 3),
                B4, (W / 2) - (BorderWidth * 4),
                30,
                '3: Sin configuracion del Buffer',
                font='font10',
                focusTexture=radiobgfocus,
                noFocusTexture=radiobgnofocus,
                focusOnTexture=radiofocus,
                noFocusOnTexture=radiofocus,
                focusOffTexture=radionofocus,
                noFocusOffTexture=radionofocus)
            self.addControl(self.Button0)
            self.addControl(self.Button1)
            self.addControl(self.Button2)
            self.addControl(self.Button3)
            self.Button0.setSelected(False)
            self.Button1.setSelected(False)
            self.Button2.setSelected(True)
            self.Button3.setSelected(False)

            self.buttonWrite = xbmcgui.ControlButton(
                leftside,
                T + H - 40 - BorderWidth, (W / 2) - (BorderWidth * 2),
                35,
                "Escribir archivo",
                textColor="0xFF000000",
                focusedColor="0xFF000000",
                alignment=2,
                focusTexture=buttonfocus,
                noFocusTexture=buttonnofocus)
            self.buttonCancel = xbmcgui.ControlButton(
                rightside + BorderWidth * 2,
                T + H - 40 - BorderWidth, (W / 2) - (BorderWidth * 2),
                35,
                "Cancelar",
                textColor="0xFF000000",
                focusedColor="0xFF000000",
                alignment=2,
                focusTexture=buttonfocus,
                noFocusTexture=buttonnofocus)
            self.addControl(self.buttonWrite)
            self.addControl(self.buttonCancel)

            self.buttonWrite.controlLeft(self.buttonCancel)
            self.buttonWrite.controlRight(self.buttonCancel)
            self.buttonWrite.controlUp(self.Button3)
            self.buttonWrite.controlDown(self.videoCacheSize)
            self.buttonCancel.controlLeft(self.buttonWrite)
            self.buttonCancel.controlRight(self.buttonWrite)
            self.buttonCancel.controlUp(self.Button3)
            self.buttonCancel.controlDown(self.videoCacheSize)
            self.videoCacheSize.controlUp(self.buttonWrite)
            self.videoCacheSize.controlDown(self.CURLTimeout)
            self.CURLTimeout.controlUp(self.videoCacheSize)
            self.CURLTimeout.controlDown(self.readBufferFactor)
            self.readBufferFactor.controlUp(self.CURLTimeout)
            self.readBufferFactor.controlDown(self.Button0)
            self.Button0.controlUp(self.CURLTimeout)
            self.Button0.controlDown(self.Button1)
            self.Button0.controlLeft(self.readBufferFactor)
            self.Button0.controlRight(self.readBufferFactor)
            self.Button1.controlUp(self.Button0)
            self.Button1.controlDown(self.Button2)
            self.Button1.controlLeft(self.readBufferFactor)
            self.Button1.controlRight(self.readBufferFactor)
            self.Button2.controlUp(self.Button1)
            self.Button2.controlDown(self.Button3)
            self.Button2.controlLeft(self.readBufferFactor)
            self.Button2.controlRight(self.readBufferFactor)
            self.Button3.controlUp(self.Button2)
            self.Button3.controlDown(self.buttonWrite)
            self.Button3.controlLeft(self.readBufferFactor)
            self.Button3.controlRight(self.readBufferFactor)
            self.setFocus(self.videoCacheSize)
Ejemplo n.º 22
0
    def onInit(self):
        self.getControl(10004).setEnabled(False)
        self.getControl(10005).setEnabled(False)
        self.getControl(10006).setEnabled(False)
        self.ok_enabled = False
        self.default_enabled = False

        # Kodi 18 compatibility
        if config.get_platform(True)['num_version'] < 18:
            if xbmcgui.__version__ == "1.2":
                self.setCoordinateResolution(1)
            else:
                self.setCoordinateResolution(5)

        # Title
        self.getControl(10002).setLabel(self.caption)

        if self.custom_button is not None:
            if self.custom_button['visible']:
                self.getControl(10006).setLabel(self.custom_button['label'])
            else:
                self.getControl(10006).setVisible(False)
                self.getControl(10004).setPosition(
                    self.getControl(10004).getPosition()[0] + 80,
                    self.getControl(10004).getPosition()[1])
                self.getControl(10005).setPosition(
                    self.getControl(10005).getPosition()[0] + 80,
                    self.getControl(10005).getPosition()[1])

        # Control Area Dimensions
        self.controls_width = self.getControl(10007).getWidth() - 30
        self.controls_height = self.getControl(10007).getHeight() - 100
        self.controls_pos_x = self.getControl(10007).getPosition(
        )[0] + self.getControl(10001).getPosition()[0] + 10
        self.controls_pos_y = self.getControl(
            10007).getPosition()[1] + self.getControl(10001).getPosition()[1]
        self.height_control = 60
        self.font = "font16"

        # In old versions: we create 5 controls, from the contrary when clicking the second control,
        # automatically change third party label to "Short By: Name" I don't know why ...
        if xbmcgui.ControlEdit == ControlEdit:
            for x in range(5):
                control = xbmcgui.ControlRadioButton(-500, 0, 0, 0, "")
                self.addControl(control)

        for c in self.list_controls:
            # Skip controls that do not have the appropriate values
            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 isinstance(c["lvalues"], list):
                continue
            if c["type"] == "list" and not len(c["lvalues"]) > 0: continue
            if c["type"] != "label" and len([
                    control.get("id") for control in self.list_controls
                    if c["id"] == control.get("id")
            ]) > 1:
                continue

            # Translation label and 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

            # Default values in case the control does not have them
            if c["type"] == "bool": default = False
            elif c["type"] == "list": default = 0
            else: default = ""  # label or text

            c["default"] = c.get("default", default)
            c["color"] = c.get("color", "0xFFFFFFFF")
            c["visible"] = c.get("visible", True)
            c["enabled"] = c.get("enabled", True)

            if c["type"] == "label" and "id" not in c: c["id"] = None
            if c["type"] == "text": c["hidden"] = c.get("hidden", False)

            # Decide whether to use the default value or the saved value
            if c["type"] in ["bool", "text", "list"]:
                if c["id"] not in self.values:
                    if not self.callback:
                        self.values[c["id"]] = config.get_setting(
                            c["id"], **self.kwargs)
                    else:
                        self.values[c["id"]] = c["default"]

            if c["type"] == "bool": self.add_control_bool(c)
            elif c["type"] == 'text': self.add_control_text(c)
            elif c["type"] == 'list': self.add_control_list(c)
            elif c["type"] == 'label': self.add_control_label(c)

        self.list_controls = [c for c in self.list_controls if "control" in c]

        self.evaluate_conditions()
        self.index = -1
        self.dispose_controls(0)
        self.getControl(100010).setVisible(False)
        self.getControl(10004).setEnabled(True)
        self.getControl(10005).setEnabled(True)
        self.getControl(10006).setEnabled(True)
        self.ok_enabled = True
        self.default_enabled = True
        self.check_default()
        self.check_ok(self.values)
Ejemplo n.º 23
0
        def __init__(self,
                     msg='',
                     L=0,
                     T=0,
                     W=1280,
                     H=720,
                     TxtColor='0xFFFFFFFF',
                     Font='font12',
                     BorderWidth=10):
            buttonfocus, buttonnofocus = artwork('button')
            radiobgfocus, radiobgnofocus, radiofocus, radionofocus = artwork(
                'radio')
            slidernibfocus, slidernibnofocus, sliderfocus, slidernofocus = artwork(
                'slider')
            image_path = os.path.join(ART, 'ContentPanel.png')
            boxbg = os.path.join(ART, 'bgg2.png')
            self.border = xbmcgui.ControlImage(L, T, W, H, image_path)
            self.addControl(self.border)
            self.BG = xbmcgui.ControlImage(L + BorderWidth,
                                           T + BorderWidth,
                                           W - (BorderWidth * 2),
                                           H - (BorderWidth * 2),
                                           FANART,
                                           aspectRatio=0,
                                           colorDiffuse='0x5FFFFFFF')
            self.addControl(self.BG)
            top = T + BorderWidth
            leftside = L + BorderWidth
            rightside = L + (W / 2) - (BorderWidth * 2)
            firstrow = top + 30
            secondrow = firstrow + 275 + (BorderWidth / 2)
            currentwidth = ((W / 2) - (BorderWidth * 4)) / 2

            header = '[B][COLOR %s]Configurador de Advanced Settings[/COLOR][/B]' % (
                COLOR2)
            self.Header = xbmcgui.ControlLabel(L,
                                               top,
                                               W,
                                               30,
                                               header,
                                               font='font12',
                                               textColor=TxtColor,
                                               alignment=0x00000002)
            self.addControl(self.Header)
            top += 30 + BorderWidth
            self.bgarea = xbmcgui.ControlImage(leftside,
                                               firstrow,
                                               rightside - L,
                                               275,
                                               boxbg,
                                               aspectRatio=0,
                                               colorDiffuse='0x5FFFFFFF')
            self.addControl(self.bgarea)
            self.bgarea2 = xbmcgui.ControlImage(rightside + BorderWidth +
                                                BorderWidth,
                                                firstrow,
                                                rightside - L,
                                                275,
                                                boxbg,
                                                aspectRatio=0,
                                                colorDiffuse='0x5FFFFFFF')
            self.addControl(self.bgarea2)
            self.bgarea3 = xbmcgui.ControlImage(leftside,
                                                secondrow,
                                                rightside - L,
                                                275,
                                                boxbg,
                                                aspectRatio=0,
                                                colorDiffuse='0x5FFFFFFF')
            self.addControl(self.bgarea3)
            self.bgarea4 = xbmcgui.ControlImage(rightside + BorderWidth +
                                                BorderWidth,
                                                secondrow,
                                                rightside - L,
                                                275,
                                                boxbg,
                                                aspectRatio=0,
                                                colorDiffuse='0x5FFFFFFF')
            self.addControl(self.bgarea4)

            header = '[B][COLOR %s]Valor de Cache Video[/COLOR][/B]' % (COLOR2)
            self.Header2 = xbmcgui.ControlLabel(leftside + BorderWidth,
                                                firstrow + 5,
                                                (W / 2) - (BorderWidth * 2),
                                                20,
                                                header,
                                                font='font12',
                                                textColor=TxtColor,
                                                alignment=0x00000002)
            self.addControl(self.Header2)
            freeMemory = int(
                float(wiz.getInfo('System.Memory(free)')[:-2]) * .33)
            recMemory = int(
                float(wiz.getInfo('System.Memory(free)')[:-2]) * .23)
            msg3 = "[B][COLOR %s]Numero de bytes usados para el buffer en memoria. Si se establece en [COLOR %s]0[/COLOR] se volcara al disco en lugar de en la RAM.  Aviso: Para el valor establecido aqui, Kodi necesitara el triple para funcionar bien. Una cifra demasiado alta puede provocar bloqueos si no existe suficiente RAM libre(1/3 de Memoria libre: [COLOR %s]%s[/COLOR])[/COLOR][/B]" % (
                COLOR2, COLOR1, COLOR1, freeMemory)
            self.Support3 = xbmcgui.ControlTextBox(
                leftside + int(BorderWidth * 1.5),
                firstrow + 30 + BorderWidth, (W / 2) - (BorderWidth * 4),
                150,
                font='font12',
                textColor=TxtColor)
            self.addControl(self.Support3)
            self.Support3.setText(msg3)
            try:
                self.videoCacheSize = xbmcgui.ControlSlider(
                    leftside + int(BorderWidth * 1.5),
                    firstrow + 210, (W / 2) - (BorderWidth * 5),
                    20,
                    textureback=sliderfocus,
                    texture=slidernibnofocus,
                    texturefocus=slidernibfocus,
                    orientation=xbmcgui.HORIZONTAL)
            except:
                self.videoCacheSize = xbmcgui.ControlSlider(
                    leftside + int(BorderWidth * 1.5),
                    firstrow + 210, (W / 2) - (BorderWidth * 5),
                    20,
                    textureback=sliderfocus,
                    texture=slidernibnofocus,
                    texturefocus=slidernibfocus)
            self.addControl(self.videoCacheSize)
            self.videomin = 0
            self.videomax = freeMemory if freeMemory < 2000 else 2000
            self.recommendedVideo = recMemory if recMemory < 500 else 500
            self.currentVideo = self.recommendedVideo
            videopos = wiz.percentage(self.currentVideo, self.videomax)
            self.videoCacheSize.setPercent(videopos)
            current1 = '[COLOR %s]Actual:[/COLOR] [COLOR %s]%s MB[/COLOR]' % (
                COLOR1, COLOR2, self.currentVideo)
            recommended1 = '[COLOR %s]Recomendado:[/COLOR] [COLOR %s]%s MB[/COLOR]' % (
                COLOR1, COLOR2, self.recommendedVideo)
            self.currentVideo1 = xbmcgui.ControlTextBox(leftside + BorderWidth,
                                                        firstrow + 235,
                                                        currentwidth,
                                                        20,
                                                        font=Font,
                                                        textColor=TxtColor)
            self.addControl(self.currentVideo1)
            self.currentVideo1.setText(current1)
            self.recommendedVideo1 = xbmcgui.ControlTextBox(
                leftside + BorderWidth + currentwidth,
                firstrow + 235,
                currentwidth,
                20,
                font=Font,
                textColor=TxtColor)
            self.addControl(self.recommendedVideo1)
            self.recommendedVideo1.setText(recommended1)

            header = '[B][COLOR %s]CURL Tiempo de espera/CURL Baja Velocidad[/COLOR][/B]' % (
                COLOR2)
            self.Header3 = xbmcgui.ControlLabel(rightside + BorderWidth,
                                                firstrow + 5,
                                                (W / 2) - (BorderWidth * 2),
                                                20,
                                                header,
                                                font='font12',
                                                textColor=TxtColor,
                                                alignment=0x00000002)
            self.addControl(self.Header3)
            msg3 = "[COLOR %s][B]curlclienttimeout[/B]  [B]- Es el tiempo de espera en segundos en que [I]libcurl  [/I] intentara conectar [/B] [B]curllowspeedtime[/B]  [B]- Es el tiempo en segundos que[I] libcurl   [/I]considera una conexion de baja velocidad.  Para conexiones mas lentas configurelo en 20.[/B][/COLOR]" % COLOR2
            self.Support3 = xbmcgui.ControlTextBox(
                rightside + int(BorderWidth * 3.5),
                firstrow + 30 + BorderWidth, (W / 2) - (BorderWidth * 4),
                150,
                font='font12',
                textColor=TxtColor)
            self.addControl(self.Support3)
            self.Support3.setText(msg3)
            try:
                self.CURLTimeout = xbmcgui.ControlSlider(
                    rightside + int(BorderWidth * 3.5),
                    firstrow + 210, (W / 2) - (BorderWidth * 5),
                    20,
                    textureback=sliderfocus,
                    texture=slidernibnofocus,
                    texturefocus=slidernibfocus,
                    orientation=xbmcgui.HORIZONTAL)
            except:
                self.CURLTimeout = xbmcgui.ControlSlider(
                    rightside + int(BorderWidth * 3.5),
                    firstrow + 210, (W / 2) - (BorderWidth * 5),
                    20,
                    textureback=sliderfocus,
                    texture=slidernibnofocus,
                    texturefocus=slidernibfocus)
            self.addControl(self.CURLTimeout)
            self.curlmin = 0
            self.curlmax = 20
            self.recommendedCurl = 10
            self.currentCurl = self.recommendedCurl
            curlpos = wiz.percentage(self.currentCurl, self.curlmax)
            self.CURLTimeout.setPercent(curlpos)
            current2 = '[COLOR %s]Actual:[/COLOR] [COLOR %s]%ss[/COLOR]' % (
                COLOR1, COLOR2, self.currentCurl)
            recommended2 = '[COLOR %s]Recomendado:[/COLOR] [COLOR %s]%ss[/COLOR]' % (
                COLOR1, COLOR2, self.recommendedCurl)
            self.currentCurl2 = xbmcgui.ControlTextBox(rightside +
                                                       (BorderWidth * 3),
                                                       firstrow + 235,
                                                       currentwidth,
                                                       20,
                                                       font=Font,
                                                       textColor=TxtColor)
            self.addControl(self.currentCurl2)
            self.currentCurl2.setText(current2)
            self.recommendedCurl2 = xbmcgui.ControlTextBox(
                rightside + (BorderWidth * 3) + currentwidth,
                firstrow + 235,
                currentwidth,
                20,
                font=Font,
                textColor=TxtColor)
            self.addControl(self.recommendedCurl2)
            self.recommendedCurl2.setText(recommended2)

            header = '[B][COLOR %s]Factor de lectura del Buffer[/COLOR][/B]' % (
                COLOR2)
            self.Header4 = xbmcgui.ControlLabel(leftside,
                                                secondrow + 5,
                                                (W / 2) - (BorderWidth * 2),
                                                20,
                                                header,
                                                font='font12',
                                                textColor=TxtColor,
                                                alignment=0x00000002)
            self.addControl(self.Header4)
            msg3 = "[B][COLOR %s]El valor de esta configuracion es un multiplicador del limite predeterminado. Si Kodi esta cargando un archivo bluray 36 Mbit/s, con un valor de 2 necesitara al menos  72 Mbit/s de ancho de banda. A diferencia de la configuracion de la RAM, puede aumentar este valor de manera segura y Kodi no se bloqueara.[/COLOR][/B]" % COLOR2
            self.Support3 = xbmcgui.ControlTextBox(
                leftside + int(BorderWidth * 1.5),
                secondrow + 30 + BorderWidth, (W / 2) - (BorderWidth * 4),
                150,
                font='font12',
                textColor=TxtColor)
            self.addControl(self.Support3)
            self.Support3.setText(msg3)
            try:
                self.readBufferFactor = xbmcgui.ControlSlider(
                    leftside + int(BorderWidth * 1.5),
                    secondrow + 210, (W / 2) - (BorderWidth * 5),
                    20,
                    textureback=sliderfocus,
                    texture=slidernibnofocus,
                    texturefocus=slidernibfocus,
                    orientation=xbmcgui.HORIZONTAL)
            except:
                self.readBufferFactor = xbmcgui.ControlSlider(
                    leftside + int(BorderWidth * 1.5),
                    secondrow + 210, (W / 2) - (BorderWidth * 5),
                    20,
                    textureback=sliderfocus,
                    texture=slidernibnofocus,
                    texturefocus=slidernibfocus)
            self.addControl(self.readBufferFactor)
            self.readmin = 0
            self.readmax = 10
            self.recommendedRead = 5
            self.currentRead = self.recommendedRead
            readpos = wiz.percentage(self.currentRead, self.readmax)
            self.readBufferFactor.setPercent(readpos)
            current3 = '[COLOR %s]Actual:[/COLOR] [COLOR %s]%s[/COLOR]' % (
                COLOR1, COLOR2, self.currentRead)
            recommended3 = '[COLOR %s]Recomendado:[/COLOR] [COLOR %s]%s[/COLOR]' % (
                COLOR1, COLOR2, self.recommendedRead)
            self.currentRead3 = xbmcgui.ControlTextBox(leftside + BorderWidth,
                                                       secondrow + 235,
                                                       currentwidth,
                                                       20,
                                                       font=Font,
                                                       textColor=TxtColor)
            self.addControl(self.currentRead3)
            self.currentRead3.setText(current3)
            self.recommendedRead3 = xbmcgui.ControlTextBox(
                leftside + BorderWidth + currentwidth,
                secondrow + 235,
                currentwidth,
                20,
                font=Font,
                textColor=TxtColor)
            self.addControl(self.recommendedRead3)
            self.recommendedRead3.setText(recommended3)

            header = '[B][COLOR %s]Modo de Buffer[/COLOR][/B]' % (COLOR2)
            self.Header4 = xbmcgui.ControlLabel(rightside + BorderWidth,
                                                secondrow + 5,
                                                (W / 2) - (BorderWidth * 2),
                                                20,
                                                header,
                                                font='font12',
                                                textColor=TxtColor,
                                                alignment=0x00000002)
            self.addControl(self.Header4)
            msg4 = "[B][COLOR %s]Esta configuracion obligara a Kodi a usar cache para todos los archivos de video, red local, Internet e incluso el disco duro local. El valor predeterminado es 0 y solo almacenara en cache videos que usen fuentes de Internet.[/COLOR][/B]" % COLOR2
            self.Support4 = xbmcgui.ControlTextBox(
                rightside + int(BorderWidth * 3.5),
                secondrow + 30 + BorderWidth, (W / 2) - (BorderWidth * 4),
                110,
                font='font12',
                textColor=TxtColor)
            self.addControl(self.Support4)
            self.Support4.setText(msg4)
            B1 = secondrow + 130 + BorderWidth
            B2 = B1 + 30
            B3 = B2 + 30
            B4 = B3 + 30
            self.Button0 = xbmcgui.ControlRadioButton(
                rightside + (BorderWidth * 3),
                B1, (W / 2) - (BorderWidth * 4),
                30,
                '0: Buffer para ARCHIVOS E INTERNET',
                font='font12',
                focusTexture=radiobgfocus,
                noFocusTexture=radiobgnofocus,
                focusOnTexture=radiofocus,
                noFocusOnTexture=radiofocus,
                focusOffTexture=radionofocus,
                noFocusOffTexture=radionofocus)
            self.Button1 = xbmcgui.ControlRadioButton(
                rightside + (BorderWidth * 3),
                B2, (W / 2) - (BorderWidth * 4),
                30,
                '1: Buffer para ARCHIVOS DE SISTEMA',
                font='font12',
                focusTexture=radiobgfocus,
                noFocusTexture=radiobgnofocus,
                focusOnTexture=radiofocus,
                noFocusOnTexture=radiofocus,
                focusOffTexture=radionofocus,
                noFocusOffTexture=radionofocus)
            self.Button2 = xbmcgui.ControlRadioButton(
                rightside + (BorderWidth * 3),
                B3, (W / 2) - (BorderWidth * 4),
                30,
                '2: SOLO para INTERNET',
                font='font12',
                focusTexture=radiobgfocus,
                noFocusTexture=radiobgnofocus,
                focusOnTexture=radiofocus,
                noFocusOnTexture=radiofocus,
                focusOffTexture=radionofocus,
                noFocusOffTexture=radionofocus)
            self.Button3 = xbmcgui.ControlRadioButton(
                rightside + (BorderWidth * 3),
                B4, (W / 2) - (BorderWidth * 4),
                30,
                '3: SIN BUFFER',
                font='font12',
                focusTexture=radiobgfocus,
                noFocusTexture=radiobgnofocus,
                focusOnTexture=radiofocus,
                noFocusOnTexture=radiofocus,
                focusOffTexture=radionofocus,
                noFocusOffTexture=radionofocus)
            self.addControl(self.Button0)
            self.addControl(self.Button1)
            self.addControl(self.Button2)
            self.addControl(self.Button3)
            self.Button0.setSelected(False)
            self.Button1.setSelected(False)
            self.Button2.setSelected(True)
            self.Button3.setSelected(False)

            self.buttonWrite = xbmcgui.ControlButton(
                leftside,
                T + H - 40 - BorderWidth, (W / 2) - (BorderWidth * 2),
                35,
                "Crear Archivo",
                textColor="0xFF000000",
                focusedColor="0xFF000000",
                alignment=2,
                focusTexture=buttonfocus,
                noFocusTexture=buttonnofocus)
            self.buttonCancel = xbmcgui.ControlButton(
                rightside + BorderWidth * 2,
                T + H - 40 - BorderWidth, (W / 2) - (BorderWidth * 2),
                35,
                "Cancelar",
                textColor="0xFF000000",
                focusedColor="0xFF000000",
                alignment=2,
                focusTexture=buttonfocus,
                noFocusTexture=buttonnofocus)
            self.addControl(self.buttonWrite)
            self.addControl(self.buttonCancel)

            self.buttonWrite.controlLeft(self.buttonCancel)
            self.buttonWrite.controlRight(self.buttonCancel)
            self.buttonWrite.controlUp(self.Button3)
            self.buttonWrite.controlDown(self.videoCacheSize)
            self.buttonCancel.controlLeft(self.buttonWrite)
            self.buttonCancel.controlRight(self.buttonWrite)
            self.buttonCancel.controlUp(self.Button3)
            self.buttonCancel.controlDown(self.videoCacheSize)
            self.videoCacheSize.controlUp(self.buttonWrite)
            self.videoCacheSize.controlDown(self.CURLTimeout)
            self.CURLTimeout.controlUp(self.videoCacheSize)
            self.CURLTimeout.controlDown(self.readBufferFactor)
            self.readBufferFactor.controlUp(self.CURLTimeout)
            self.readBufferFactor.controlDown(self.Button0)
            self.Button0.controlUp(self.CURLTimeout)
            self.Button0.controlDown(self.Button1)
            self.Button0.controlLeft(self.readBufferFactor)
            self.Button0.controlRight(self.readBufferFactor)
            self.Button1.controlUp(self.Button0)
            self.Button1.controlDown(self.Button2)
            self.Button1.controlLeft(self.readBufferFactor)
            self.Button1.controlRight(self.readBufferFactor)
            self.Button2.controlUp(self.Button1)
            self.Button2.controlDown(self.Button3)
            self.Button2.controlLeft(self.readBufferFactor)
            self.Button2.controlRight(self.readBufferFactor)
            self.Button3.controlUp(self.Button2)
            self.Button3.controlDown(self.buttonWrite)
            self.Button3.controlLeft(self.readBufferFactor)
            self.Button3.controlRight(self.readBufferFactor)
            self.setFocus(self.videoCacheSize)