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)
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)
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)
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)
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)
def set_controls(self): idw = __settings__.getSetting("idw") #__settings__.setSetting(id=idw, value=repr(L)) print __settings__.getSetting(idw) try: text = eval(__settings__.getSetting(idw)) except: text = ' ' __settings__.setSetting(id=idw, value=text) text = '123456789qwertyuiopasdfghjkl;zxcvbnm,.йцукенгшщзхъфывапролджэячсмитьбюбьтимсчяэждлорпавыфъхзщшгнекуцйmnbvcxz;lkjhggfdsaspouiytreww' # Демонстрация основных контролов XBMC UI. # При первоначальном создании задаются фиктивные координаты и размеры: 1, 1, 1, 1. self.no_int_label = xbmcgui.ControlLabel(1, 1, 1, 1, 'Диапазон:', alignment=ALIGN_CENTER) self.placeControl(self.no_int_label, 0, 0, 1, 5) self.no_int_label2 = xbmcgui.ControlLabel(1, 1, 1, 1, text, alignment=ALIGN_CENTER) self.placeControl(self.no_int_label2, 2, 0, 1, 5) #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, 4, 1) self.button2 = xbmcgui.ControlButton( 1, 1, 1, 1, u'Отмена', focusTexture=self.button_bg_focus, noFocusTexture=self.button_bg_Nofocus, alignment=ALIGN_CENTER) self.placeControl(self.button2, 4, 2) #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, 1, 5) #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 #slider_label = xbmcgui.ControlLabel(1, 1, 1, 1, 'ControlSlider') #self.placeControl(slider_label, 13, 0) # ControlSlider self.slider1 = xbmcgui.ControlSlider(1, 1, 1, 1, textureback=self.slider_bg, texture=self.slider_nib_nf, texturefocus=self.slider_nib) self.placeControl(self.slider1, 1, 0, 1, 5) self.slider1.setPercent(0) self.slider2 = xbmcgui.ControlSlider(1, 1, 1, 1, textureback=self.slider_bg, texture=self.slider_nib_nf, texturefocus=self.slider_nib) self.placeControl(self.slider2, 3, 0, 1, 5) self.slider2.setPercent(100)
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)
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][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)
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)