def __init__(self): self.setCoordinateResolution(6) self.addControl(xbmcgui.ControlImage(245, 170, 235, 26, DCT)) self.img01 = xbmcgui.ControlImage(245, 195, 235, 235, DCM) self.addControl(self.img01) self.img02 = xbmcgui.ControlImage(245, 430, 235, 25, DCB) self.addControl(self.img02) self.list = xbmcgui.ControlList(267, 192, 200, 266, font="font13", textColor="0xFFFFFFFF", buttonFocusTexture=BTNF, buttonTexture=BTNNF, imageWidth=18, imageHeight=18, itemTextXOffset=5, alignmentY=0x00000004, itemHeight=32, space=3) self.addControl(self.list) self.list.setPageControlVisible(0) self.setFocus(self.list) self.selection = None self.items = []
def __init__(self, items=[]): gap = int(self.getHeight() / 100) w = int(self.getWidth() * 0.5) h = self.getHeight() - 30 * gap rw = self.getWidth() rh = self.getHeight() x = rw / 2 - w / 2 y = rh / 2 - h / 2 self.imgBg = xbmcgui.ControlImage(x + gap, 5 * gap + y, w - 2 * gap, h - 5 * gap, listBackground) self.addControl(self.imgBg) self.playlistControl = xbmcgui.ControlList(2 * gap + x, y + 3 * gap + 30, w - 4 * gap, h - 10 * gap, textColor='0xFFFFFFFF', selectedColor='0xFFFF4242') self.playlistControl.setItemHeight(50) self.addControl(self.playlistControl) self.lastPos = 0 self.isSelecting = False self.selected = -1 listitems = [] for playlist in items: listitems.append(xbmcgui.ListItem(playlist[0])) listitems.append(xbmcgui.ListItem(__language__(30011))) self.playlistControl.addItems(listitems) self.setFocus(self.playlistControl) self.playlistControl.selectItem(0) item = self.playlistControl.getListItem(self.lastPos) item.select(True)
def __init__(self): self.addControl(xbmcgui.ControlImage(0,0,720,576, 'background.png')) self.list = xbmcgui.ControlList(200, 100, 400, 400) self.strAction = xbmcgui.ControlLabel(50, 100, 100, 20, 'action', 'font13', '0xFFFF3300') self.strButton = xbmcgui.ControlLabel(50, 150, 100, 20, 'button', 'font13', '0xFFFFFFFF') self.addControl(self.list) self.addControl(self.strAction) self.addControl(self.strButton) self.button1 = xbmcgui.ControlButton(50, 200, 90, 30, "Button 1") self.button2 = xbmcgui.ControlButton(50, 240, 90, 30, "Button 2") self.addControl(self.button1) self.addControl(self.button2) self.button1.controlDown(self.button2) self.button1.controlRight(self.list) self.button2.controlUp(self.button1) self.button2.controlRight(self.list) self.list.controlLeft(self.button1) # add a few items to the list xbmcgui.lock() for i in range(50): self.list.addItem('item' + str(i)) xbmcgui.unlock() self.setFocus(self.button1)
def onInit(self): self.s = xbmcgui.ControlList(0, 240, 1120, 160) self.s.setItemHeight(40) self.addControl(self.s) self.s.addItem("Hello World") self.s.addItem("Bye World") self.s.addItem("Kodi == crap")
def __init__(self, window, leftpad, toppad): # @param window : The main window against which we should register our items # @param leftpad : The Leftmenu will top-left corner padding from left side # @param leftpad : The Leftmenu will top-left corner padding from top self.menu = xbmcgui.ControlList(10, 100, 150, 300) window.addControl(self.menu) for room in DB.list_rooms(): self.menu.addItem(room.name)
def onInit(self): if self.item_information: persistent_list = xbmcgui.ControlList(-100, -100, 0, 0) self.addControl(persistent_list) persistent_list.addItem( self.get_list_item_with_properties(self.item_information)) self.setFocusId(persistent_list.getId()) super(SingleItemWindow, self).onInit()
def create(self): self.ctl = xbmcgui.ControlList(50, 200, 400, 200) self.addControl(self.ctl) self.setFocus(self.ctl) labels = {0: 'zero', 1: 'one', 2: 'two', 3: 'three'} for k, v in labels.items(): self.ctl.addItem( xbmcgui.ListItem(label=str(k), label2=v, thumbnailImage="q:\\scripts\\test.png"))
def __init__(self): self.setCoordinateResolution(6) # # Menu # Build screen self.addControl(xbmcgui.ControlImage(0,0, 720,576, HOMEDIR+'images/background.png')) self.addControl(xbmcgui.ControlLabel(56,45, 200, 145, 'Arcade Browser v'+VERSION, 'special12', '0xFFFFFFFF')) self.addControl(xbmcgui.ControlImage(211, 29, 64, 43, HOMEDIR+"images/rednet.png")) self.addControl(xbmcgui.ControlLabel(280, 50, 200, 100, 'www.REDnet.nl', 'font101', '0xFFCCCCFF')) self.addControl(xbmcgui.ControlLabel(56,65, 200, 135, 'Emulators', 'special13', '0xFFFFFF00')) # Define controls self.lstMain = xbmcgui.ControlList(50, 110, 320, 450, buttonTexture=HOMEDIR+"images/btn.png", buttonFocusTexture=HOMEDIR+"images/btnHili.png") self.lblTotal = xbmcgui.ControlLabel(340,526, 200,35, '', 'font10', '0xFFFFFF00', alignment=1) self.lblTitle = xbmcgui.ControlLabel(400, 65, 400, 35, '', 'special13', '0xFFFFFF00') self.txtDesc = xbmcgui.ControlTextBox(400, 330, 290, 300, 'font101', '0xFFFFCC88') # Out of screen on purpose - no 1/1 in textfield self.lblDebug = xbmcgui.ControlLabel(4, 560, 0, 0, '', 'font10', '0xFFFF8800') self.imgPreview = xbmcgui.ControlImage(400, 115, 256, 192, "") self.btnView = xbmcgui.ControlButton(400, 504, 80, 30, "Favorites") self.btnInit = xbmcgui.ControlButton(496, 504, 80, 30, "Reload") self.btnHelp = xbmcgui.ControlButton(592, 504, 80, 30, "Help") # Add controls self.addControl(self.lstMain) self.addControl(self.lblTotal) self.addControl(self.lblTitle) self.addControl(self.txtDesc) self.addControl(self.imgPreview) self.addControl(self.lblDebug) # Add button controls self.addControl(self.btnView) self.addControl(self.btnInit) self.addControl(self.btnHelp) # Link control navigation self.lstMain.controlLeft(self.btnHelp) self.lstMain.controlRight(self.btnView) self.btnView.controlLeft(self.lstMain) self.btnView.controlRight(self.btnInit) self.btnInit.controlLeft(self.btnView) self.btnInit.controlRight(self.btnHelp) self.btnHelp.controlLeft(self.btnInit) self.btnHelp.controlRight(self.lstMain) self.setFocus(self.lstMain) self.getConfig(HOMEDIR+INIFILE) if not self.selRom < 0: self.listRoms(self.selEmu) else: self.listEmulators(self.selEmu)
def list(self, label="", values=[], onclick=None, height=None): if not height: height = self.__rowh if not onclick: onclick = self.__null height = len(values) * height elem = xbmcgui.ControlList(0, 0, 0, 0) for value in values: elem.addItem(value) self.__eid += 1 self.__elems[self.__eid] = ("list", label, onclick, None, height, elem) return self.__eid
def __init__(self, title, btns=[], items=[], width=100): w = int(self.getWidth() * width) pad = int(self.getHeight() / 100) hCnt = 30 yo = 30 self.selected = [-1, -1] h = self.getHeight() - 30 * pad self.btns = btns mediaDir = os.path.join(os.getcwd(), 'resources', 'skins', 'DefaultSkin', 'media') rw = self.getWidth() rh = self.getHeight() x = rw / 2 - w / 2 y = rh / 2 - h / 2 # Background #self.imgBg = xbmcgui.ControlImage(5+x,5+y,w,h, os.path.join(mediaDir,'popup-bg-shadow.png')) #self.addControl(self.imgBg) self.imgBg = xbmcgui.ControlImage( 0 + x - 30, 0 + y - 30, w + 60, h + 60, os.path.join(mediaDir, 'gs-bg-menu.png')) self.addControl(self.imgBg) self.imgBg = xbmcgui.ControlImage( 0 + x + pad, 5 * pad + y, w - 2 * pad, h - 5 * pad, os.path.join(mediaDir, 'list-bg2.png')) self.addControl(self.imgBg) # Title self.labelTitle = xbmcgui.ControlLabel(0 + x, 0 + y, w, hCnt, title, 'font14', '0xFFFFFFFF', alignment=2) self.addControl(self.labelTitle) self.cntList = xbmcgui.ControlList(2 * pad + x, yo + y + 3 * pad, w - 4 * pad, h - 10 * pad, buttonFocusTexture=os.path.join( mediaDir, 'button_focus.png'), font='font12', textColor='0xFFFFFFFF', space=0, itemHeight=7 * pad) self.addControl(self.cntList) for item in items: self.cntList.addItem(str(item)) self.setFocus(self.cntList)
def __init__(self): if Emulating: xbmcgui.Window.__init__(self) if not Emulating: self.setCoordinateResolution(PAL_4x3) self.bg = xbmcgui.ControlImage(0,0,720,576, imageDir + "background.png") self.addControl(self.bg) self.tekst = xbmcgui.ControlLabel(273,66,250,30, ": Zenderoverzicht") self.addControl(self.tekst) self.info = xbmcgui.ControlImage(50,122,27,26, imageDir + "x.png") self.addControl(self.info) self.infotekst = xbmcgui.ControlLabel(80,124,250,30, "Nu op TV") self.addControl(self.infotekst) self.loading = xbmcgui.ControlLabel(220, 140,250,30, "Een ogenblik...") self.addControl(self.loading) self.loading.setVisible(0) self.programmas = xbmcgui.ControlList(220, 140, 420 , 400,'font14','0xFFDDDDDD') self.addControl(self.programmas) self.zenders = xbmcgui.ControlList(220, 140, 420 , 400,'font14','0xFFDDDDDD') self.addControl(self.zenders) if not Emulating: self.zenders.setItemHeight(48) self.zenders.setImageDimensions(60,39) self.programmas.setItemHeight(48) self.programmas.setImageDimensions(60,39) self.programmaItems = [] self.zenderItems = [] self.state = 0 self.setFocus(self.zenders) self.Parsezenders()
def __init__(self): self.setCoordinateResolution(0) self.list = xbmcgui.ControlList(500, 161, 1420, 900, 'Size36', '0xFFDDDDDD', '' ,'images/contextbutton.png', '',60,60,10,0,81,0) self.addControl(self.list) for file in glob.glob(os.path.join(pluginpath, sys.argv[ 1 ]+'.*')): name=str(file).replace(pluginpath,'') iconimage=(os.path.join(file,'icon.png')) listitem = xbmcgui.ListItem(name,'','',iconimage) self.list.addItem(listitem) self.setFocus(self.list) self.strActionInfo = xbmcgui.ControlLabel(0, 80, 1920, 50, '', 'Size42B', '0xFFFFFFFF', alignment=2) self.addControl(self.strActionInfo) self.strActionInfo.setLabel(localtxt1)
def __init__(self): self.setCoordinateResolution(6) self.addControl(xbmcgui.ControlImage(95,95,520,420,BG1)) self.addControl(xbmcgui.ControlLabel(120,108,420,32,label[6],'special13','0xDDced8da')) self.fileList = xbmcgui.ControlList(120,140,480,370, imageWidth = 16, imageHeight = 16, itemTextXOffset = 3, itemHeight = 32) self.addControl(self.fileList) self.setFocus(self.fileList) self.fill()
def __init__(self): self.date = date.today() self.addControl(xbmcgui.ControlImage(50,70,800,600, 'special://home/addons/plugin.video.kg-ontv/resources/media/background.png')) self.strActionInfo = xbmcgui.ControlLabel(250, 80, 450, 200, '', 'font14', 'F0FF00FF') self.addControl(self.strActionInfo) self.strActionInfo.setLabel('Для выхода из меню нажмите НАЗАД') self.list = xbmcgui.ControlList(60, 150, 750, 500,'font14', 'FF11b500') self.addControl(self.list) self.previousDay = xbmcgui.ControlButton(105, 115, 250, 30, "Предыдущий день") self.addControl(self.previousDay) self.nextDay = xbmcgui.ControlButton(505, 115, 250, 30, "Следующий день") self.addControl(self.nextDay) self.player = xbmc.Player(xbmc.PLAYER_CORE_AUTO) self.playList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO) self.playListItem = self.playList[self.playList.getposition()] self.GetTransmissionsByChannelId({'channelID':self.playListItem.getProperty('channelID')}) self.setFocus(self.list)
def __init__(self,rootwin=None): try: self.rootwin = rootwin channel = rootwin.channel self.channel = channel self.programs = channel.programs # init scale values self.scaleX = ( float(self.getWidth()) / float(SIZE_WIDTH) ) self.scaleY = ( float(self.getHeight()) / float(SIZE_HEIGHT) ) # add the background self.addControl(xbmcgui.ControlImage(0, 0, self.getScX(SIZE_WIDTH), self.getScY(SIZE_HEIGHT), BACKGROUND2)) # add the channel image element self.addControl(xbmcgui.ControlImage(self.getScX(90), self.getScY(60), self.getScX(90), self.getScY(60), os.path.join(IMAGES,channel.imagelink))) # add the label of the channel self.strActionInfo = xbmcgui.ControlLabel(self.getScX(220), self.getScY(70), self.getScX(500), self.getScY(30), "", "font14", "0xDDDDDDFF") self.addControl(self.strActionInfo) if channel.description: self.strActionInfo.setLabel(channel.name + " : " + channel.description) else: self.strActionInfo.setLabel(channel.name ) # add the list of programs self.list = xbmcgui.ControlList(self.getScX(83), self.getScY(140), self.getScX(548), self.getScY(400), buttonTexture=LIST_SELECT_BG, buttonFocusTexture=LIST_SELECT_BG_FOCUS, textColor='0xFFFFFFFF', itemHeight=self.getScY(50), space=2, itemTextXOffset=self.getScX(20), imageWidth=self.getScX(150), imageHeight=self.getScY(28)) self.addControl(self.list) # add the programs into the list for program in channel.programs: self.list.addItem(xbmcgui.ListItem(program.name + ' ' + program.description, thumbnailImage=os.path.join(IMAGES,program.imagelink))) self.setFocus(self.list) except Exception, ex: outPrint('Unable to init the program list', ex) self.close()
def __init__(self): self.background = xbmcgui.ControlImage( 0, 0, 1280, 720, 'special://home/addons/script.habitica/resources/media/fanart.jpg') self.profile = xbmcgui.ControlLabel(450, 0, 700, 50, 'XP:0/0 HP:0/0 Gold:0 Silver:0') self.habitsButton = xbmcgui.ControlButton(0, 50, 200, 50, 'Habits', textOffsetX=70) self.dailiesButton = xbmcgui.ControlButton(200, 50, 200, 50, 'Dailies', textOffsetX=70) self.todoButton = xbmcgui.ControlButton(400, 50, 200, 50, 'TODO', textOffsetX=70) self.cList = xbmcgui.ControlList(0, 110, 800, 550, selectedColor="0xC0FF0000") self.avatar = xbmcgui.ControlImage( 900, 90, 350, 350, 'special://home/addons/script.habitica/resources/media/icon.png') self.addControl(self.background) self.addControl(self.profile) self.addControl(self.habitsButton) self.addControl(self.dailiesButton) self.addControl(self.todoButton) self.addControl(self.cList) self.addControl(self.avatar) self.API_Token = addon.getSetting("API_Token").decode("utf-8") self.ID = addon.getSetting("ID").decode("utf-8")
def __init__(self): self.setCoordinateResolution(0) self.strActionInfo = xbmcgui.ControlLabel(960, 80, 960, 50, '', 'Size42B', '0xFFFFFFFF', alignment=2) self.addControl(self.strActionInfo) self.strActionInfo.setLabel('VideoHelp') self.list = xbmcgui.ControlList(1000, 161, 890, 900, 'Size33', '0xFFDDDDDD', '', 'images/buttonselect.png', '0xFFFFFFFF', 0, 0, 20, 0, 81) self.addControl(self.list) req = urllib2.Request(howto) req.add_header( 'User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3' ) response = urllib2.urlopen(req) link = response.read() response.close() fanart = "" match = re.compile('i="(.+?)" n="(.+?)" u="(.+?)" d="(.+?)"').findall( link) for icon, name, youtube, description in match: if icon == 'none': iconimage = 'http://i.ytimg.com/vi/%s/0.jpg' % youtube else: iconimage = str(icon) fanart = str(fanart) url = 'plugin://plugin.video.youtube/?path=root/video&action=play_video&videoid=%s' % youtube url = str(url) listitem = xbmcgui.ListItem(name) listitem.setProperty('path', url) self.list.addItem(listitem) self.setFocus(self.list)
def __init__(self): # Устанавливаем фоновую картинку background = xbmcgui.ControlImage(1, 1, 1280, 720, background_img) self.addControl(background) # Основная надпись background = xbmcgui.ControlImage(30, 80, 300, 30, button_fo_img) self.addControl(background) self.strActionInfo = xbmcgui.ControlLabel(50, 80, 200, 30, '', 'font16', _color_head) self.addControl(self.strActionInfo) self.strActionInfo.setLabel(__language__(32103)) # Окно данных background = xbmcgui.ControlImage(650, 150, 600, 30, windows_header) self.addControl(background) background = xbmcgui.ControlImage(650, 180, 600, 355, background_windows) self.addControl(background) # Список расположений self.list = xbmcgui.ControlList(30, 150, 600, 420, 'font14', buttonTexture=button_nf_img, buttonFocusTexture=button_fo_img, textColor=_color_location, _itemHeight=60, _space=5, _alignmentY=0x00000004) self.addControl(self.list) for loc in rooms_obj: self.list.addItem(loc) self.setFocus(self.list)
def load_skin(window): #background image window.bg = xbmcgui.ControlImage(0, 0, 720, 576, imageDir + "background.png") window.addControl(window.bg) window.bg1 = xbmcgui.ControlImage(0, 0, 720, 576, imageDir + "background.png") window.addControl(window.bg1) #Navi-X logo at top-right position window.logo = xbmcgui.ControlImage(620, 20, 80, 80, imageDir + "logo.png") window.addControl(window.logo) #user logo above the buttons window.user_logo = xbmcgui.ControlImage(32, 120, 210, 172, imageDir + "logo.png") window.addControl(window.user_logo) window.user_logo.setVisible(0) #user thumb above the buttons (overlaps with the user logo) window.user_thumb = xbmcgui.ControlImage(32, 120, 210, 172, imageDir + "logo.png") window.addControl(window.user_thumb) window.user_thumb.setVisible(0) #downloading state at the bottom of screen window.download_logo = xbmcgui.ControlImage(40, 480, 30, 30, imageDir + "icon_download.png") window.addControl(window.download_logo) window.download_logo.setVisible(0) #URL label at top-center position window.urllbl = xbmcgui.ControlLabel(40, 80, 350, 40, "", "font14") window.addControl(window.urllbl) #Navi-X Version label at top-left position window.version = xbmcgui.ControlLabel( 40, 20, 155, 40, 'version: ' + Version + '.' + SubVersion, "font14") window.addControl(window.version) #"Loading..." text at down-left side window.infotekst = xbmcgui.ControlLabel(60, 520, 250, 30, "Loading...") window.addControl(window.infotekst) window.infotekst.setVisible(0) #"Download progress information..." text at down-left side window.dlinfotekst = xbmcgui.ControlLabel(80, 490, 250, 30, "") window.addControl(window.dlinfotekst) window.dlinfotekst.setVisible(0) #"Please wait..." text displayed on top of the main list window.loading = xbmcgui.ControlLabel(280, 130, 250, 30, "Please wait...") window.addControl(window.loading) window.loading.setVisible(0) #Main lists displaying playlist entries. #Large list 10 entries without text box on top. window.list1 = xbmcgui.ControlList(260, 120, 450, 435, 'font14', '0xFFDDDDDD', buttonFocusTexture=RootDir + 'images\\list-focus.png', imageWidth=32, imageHeight=32, itemHeight=38) window.addControl(window.list1) window.list1.setPageControlVisible(False) #Small list 8 entries with text box on top. window.list2 = xbmcgui.ControlList(260, 210, 450, 345, 'font14', '0xFFDDDDDD', buttonFocusTexture=RootDir + 'images\\list-focus.png', imageWidth=32, imageHeight=32, itemHeight=38) window.addControl(window.list2) window.list2.setPageControlVisible(False) #the text box above main list 2 window.list2tb = xbmcgui.ControlTextBox(270, 115, 420, 85) window.addControl(window.list2tb) window.list2tb.setVisible(0) #set the large list as default window.list = window.list1 #list cursor position label displayed at the bottom right of the screen window.listpos = xbmcgui.ControlLabel(640, 540, 250, 30, "") window.addControl(window.listpos) #buttons creation x = 50 y = 303 window.button_home = xbmcgui.ControlButton( x, y, 120, 32, ' Home', RootDir + "images\\button-focus1.png", RootDir + "images\\button-nofocus1.png") window.addControl(window.button_home) window.button_favorites = xbmcgui.ControlButton( x, y + 32, 120, 32, ' Favorites', RootDir + "images\\button-focus1.png", RootDir + "images\\button-nofocus1.png") window.addControl(window.button_favorites) window.button_downloads = xbmcgui.ControlButton( x, y + 64, 120, 32, ' View', RootDir + "images\\button-focus1.png", RootDir + "images\\button-nofocus1.png") window.addControl(window.button_downloads) window.button_url = xbmcgui.ControlButton( x, y + 96, 120, 32, ' Browse', RootDir + "images\\button-focus1.png", RootDir + "images\\button-nofocus1.png") window.addControl(window.button_url) window.button_about = xbmcgui.ControlButton( x, y + 128, 120, 32, ' About', RootDir + "images\\button-focus1.png", RootDir + "images\\button-nofocus1.png") window.addControl(window.button_about) #button behaviour window.list2tb.controlDown(window.list1) window.button_home.controlDown(window.button_favorites) window.button_favorites.controlDown(window.button_downloads) window.button_downloads.controlDown(window.button_url) window.button_url.controlDown(window.button_about) window.button_about.controlUp(window.button_url) window.button_url.controlUp(window.button_downloads) window.button_downloads.controlUp(window.button_favorites) window.button_favorites.controlUp(window.button_home) window.button_home.controlUp(window.list2tb) #window.button_home.controlRight(window.list1) #window.button_favorites.controlRight(window.list1) #window.button_downloads.controlRight(window.list1) #window.button_url.controlRight(window.list1) #window.button_about.controlRight(window.list1) window.list1.controlLeft(window.button_home) window.list2.controlLeft(window.button_home) window.list2tb.controlLeft(window.button_home)
def addCtl(self, control): try: if (control['type'] == 'image'): if (control.has_key('info')): if (control['info'][0] != ''): control['texture'] = xbmc.getInfoImage( control['info'][0]) self.win.controls[int(control['id'])] = (xbmcgui.ControlImage(x=int(control['posx']) + self.posx,\ y=int(control['posy']) + self.posy, width=int(control['width']), height=int(control['height']),\ filename=control['texture'], colorKey=control['colorkey'], aspectRatio=int(control['aspectratio'])))#,\ #colorDiffuse=control['colordiffuse'])) self.win.addControl(self.win.controls[int(control['id'])]) elif (control['type'] == 'label'): if (control.has_key('info')): if (control['info'][0] != ''): control['label'][0] = xbmc.getInfoLabel( control['info'][0]) self.win.controls[int(control['id'])] = (xbmcgui.ControlLabel(x=int(control['posx']) + self.posx,\ y=int(control['posy']) + self.posy, width=int(control['width']), height=int(control['height']), label=control['label'][0],\ font=control['font'], textColor=control['textcolor'], disabledColor=control['disabledcolor'], alignment=control['align'],\ hasPath=control['haspath'], angle=int(control['angle'])))#, shadowColor=control['shadowcolor'])) self.win.addControl(self.win.controls[int(control['id'])]) elif (control['type'] == 'button'): if (control.has_key('info')): if (control['info'][0] != ''): control['label'][0] = xbmc.getInfoLabel( control['info'][0]) self.win.controls[int(control['id'])] = (xbmcgui.ControlButton(x=int(control['posx']) + self.posx,\ y=int(control['posy']) + self.posy, width=int(control['width']), height=int(control['height']), label=control['label'][0],\ font=control['font'], textColor=control['textcolor'], disabledColor=control['disabledcolor'], alignment=control['align'],\ angle=int(control['angle']), shadowColor=control['shadowcolor'], focusTexture=control['texturefocus'],\ noFocusTexture=control['texturenofocus'], textXOffset=int(control['textoffsetx']), textYOffset=int(control['textoffsety']))) self.win.addControl(self.win.controls[int(control['id'])]) elif (control['type'] == 'checkmark'): if (control.has_key('info')): if (control['info'][0] != ''): control['label'][0] = xbmc.getInfoLabel( control['info'][0]) self.win.controls[int(control['id'])] = (xbmcgui.ControlCheckMark(x=int(control['posx']) + self.posx,\ y=int(control['posy']) + self.posy, width=int(control['width']), height=int(control['height']), label=control['label'][0],\ font=control['font'], textColor=control['textcolor'], disabledColor=control['disabledcolor'], alignment=control['align'],\ focusTexture=control['texturecheckmark'], noFocusTexture=control['texturecheckmarknofocus'],\ checkWidth=int(control['markwidth']), checkHeight=int(control['markheight']))) self.win.addControl(self.win.controls[int(control['id'])]) elif (control['type'] == 'textbox'): self.win.controls[int(control['id'])] = (xbmcgui.ControlTextBox(x=int(control['posx']) + self.posx,\ y=int(control['posy']) + self.posy, width=int(control['width']), height=int(control['height']), font=control['font'],\ textColor=control['textcolor'])) self.win.addControl(self.win.controls[int(control['id'])]) if (control.has_key('label')): self.win.controls[int(control['id'])].setText( control['label'][0]) elif (control['type'] == 'fadelabel'): self.win.controls[int(control['id'])] = (xbmcgui.ControlFadeLabel(x=int(control['posx']) + self.posx,\ y=int(control['posy']) + self.posy, width=int(control['width']), height=int(control['height']), font=control['font'],\ textColor=control['textcolor'], alignment=control['align']))#, shadowColor=control['shadowcolor'])) self.win.addControl(self.win.controls[int(control['id'])]) if (control.has_key('info')): for item in control['info']: if (item != ''): self.win.controls[int(control['id'])].addLabel( xbmc.getInfoLabel(item)) if (control.has_key('label')): for item in control['label']: if (item != ''): self.win.controls[int( control['id'])].addLabel(item) elif (control['type'] == 'listcontrol'): self.win.controls[int(control['id'])] = (xbmcgui.ControlList(x=int(control['posx']) + self.posx,\ y=int(control['posy']) + self.posy, width=int(control['width']), height=int(control['height']), font=control['font'],\ textColor=control['textcolor'], alignmentY=control['aligny'], buttonTexture=control['texturenofocus'],\ buttonFocusTexture=control['texturefocus'], selectedColor=control['selectedcolor'], imageWidth=int(control['itemwidth']),\ imageHeight=int(control['itemheight']), itemTextXOffset=int(control['textxoff']), itemTextYOffset=int(control['textyoff']),\ itemHeight=int(control['textureheight']), space=int(control['spacebetweenitems'])))#, shadowColor=control['shadowcolor'])) self.win.addControl(self.win.controls[int(control['id'])]) if (control.has_key('label')): for cnt, item in enumerate(control['label']): if (item != ''): if (cnt < len(control['label2'])): tmp = control['label2'][cnt] else: tmp = '' if (cnt < len(control['image'])): tmp2 = control['image'][cnt] elif control['image']: tmp2 = control['image'][len(control['image']) - 1] else: tmp2 = '' l = xbmcgui.ListItem(item, tmp, '', tmp2) self.win.controls[int(control['id'])].addItem(l) try: self.win.visibility[int(control['id'])] = control['visible'] self.win.positions[int(control['id'])] = (int(control['posx']), int(control['posy'])) #self.win.onclick[int(control['id'])] = control['onclick'] #self.win.onfocus[int(control['id'])] = control['onfocus'] self.navigation[int(control['id'])] = (int(control['onup']), int(control['ondown']), int(control['onleft']), int(control['onright'])) self.win.controls[int(control['id'])].setVisible( xbmc.getCondVisibility(control['visible'])) except: pass except: if (not self.fastMethod): self.dlg.close() self.win.SUCCEEDED = False self.controlsFailed += control['id'] + ', ' self.controlsFailedCnt += 1
def show_fullscreen_video(self): if not plugin.get_setting('is_info_fullscreenvideo'): return if xbmc.getCondVisibility('Window.IsActive(videoosd)'): if self.is_dlg: widht, height = self._get_skin_resolution() row = 20 if self.background is None: plugin.log('SKIN RESOLUTION WIDHT - %s HEIGHT %s' % (widht, height)) if widht == 1920 and height == 1440: # WIDHT - 1920 HEIGHT 1440 row = 26 pb = (100, 150, 200, 650) elif widht == 1920 and height == 1080: # SKIN RESOLUTION WIDHT - 1920 HEIGHT 1080 row = 28 pb = (100, 100, 200, 200) else: # SKIN RESOLUTION WIDHT - 1280 HEIGHT 720 row = 20 pb = (50, 50, 100, 100) self.background = xbmcgui.ControlImage( 1, 1, 1, 1, os.path.join(plugin.dir('media'), "background.png")) self.window.addControl(self.background) self.background.setPosition(pb[0], pb[1]) self.background.setWidth(widht - pb[2]) self.background.setHeight(height - pb[3]) if self.list_left is None and self.list_right is None: if widht == 1920 and height == 1440: # WIDHT - 1920 HEIGHT 1440 pll = (100, 170, 200, pb[3]) elif widht == 1920 and height == 1080: # SKIN RESOLUTION WIDHT - 1920 HEIGHT 1080 pll = (100, 110, 200, pb[3]) else: # SKIN RESOLUTION WIDHT - 1280 HEIGHT 720 pll = (50, 50, 100, pb[3]) # self.list_left.setItemHeight(5) self.list_left = xbmcgui.ControlList(pll[0], pll[1], int((widht - pll[2]) / 2), height - pll[3], font='font10') self.window.addControl(self.list_left) if self._id is None: status = [] else: status = plugin.get_labels_status_match(self._id) if widht == 1920 and height == 1440: # WIDHT - 1920 HEIGHT 1440 plr = (200, 150, 170, 200, pb[3]) elif widht == 1920 and height == 1080: # SKIN RESOLUTION WIDHT - 1920 HEIGHT 1080 plr = (200, 150, 110, 200, pb[3]) else: # SKIN RESOLUTION WIDHT - 1280 HEIGHT 720 plr = (100, 50, 50, 100, pb[3]) self.list_right = xbmcgui.ControlList( (widht - plr[0]) / 2 + plr[1], plr[2], (widht - plr[3]) / 2, height - plr[4], font='font10') self.window.addControl(self.list_right) live = plugin.get_labels_live() if len(status) <= row and len(live) <= row: self.list_left.addItems(status) self.list_right.addItems(live) else: if len(status) >= row: self.list_left.addItems(status[:row]) self.list_right.addItems(status[row:] + live) else: r = row - len(status) self.list_left.addItems(status + live[:r]) self.list_right.addItems(live[r:]) self.showing = True else: if self.showing == True and self.background: if self.background is not None: self.window.removeControl(self.background) self.background = None if self.list_left is not None: self.window.removeControl(self.list_left) self.list_left = None if self.list_right is not None: self.window.removeControl(self.list_right) self.list_right = None self.showing = False
def load_skin(window): #background image window.bg = xbmcgui.ControlImage(0,0,720,576, imageDir + "background.png") window.addControl(window.bg) window.bg1 = xbmcgui.ControlImage(0,0,720,576, imageDir + "background.png") window.addControl(window.bg1) #Navi-X logo at top-right position window.logo = xbmcgui.ControlImage(610,20,80,80, imageDir + "logo.png") window.addControl(window.logo) #user logo below the buttons window.user_logo = xbmcgui.ControlImage(32,120,210,172, imageDir + "logo.png") window.addControl(window.user_logo) window.user_logo.setVisible(0) #user thumb below the buttons (overlaps with the user logo) window.user_thumb = xbmcgui.ControlImage(32,120,210,172, imageDir + "logo.png") window.addControl(window.user_thumb) window.user_thumb.setVisible(0) #URL label at top-center position window.urllbl = xbmcgui.ControlLabel(40,80,350,40, "", "font14") window.addControl(window.urllbl) #Navi-X Version label at top-left position window.version = xbmcgui.ControlLabel(40,20,155,40, 'version: '+ Version+ '.' + SubVersion, "font14") window.addControl(window.version) #"Loading..." text at down-left side window.infotekst = xbmcgui.ControlLabel(80,500,250,30, "Loading...") window.addControl(window.infotekst) window.infotekst.setVisible(0) #"Please wait..." text displayed on top of the main list window.loading = xbmcgui.ControlLabel(280, 130, 250, 30, "Please wait...") window.addControl(window.loading) window.loading.setVisible(0) #main list displaying playlist entries window.list = xbmcgui.ControlList(260,120,450,440,'font14','0xFFDDDDDD', buttonFocusTexture=RootDir+'images\\list-focus.png', imageWidth=32, imageHeight=32, itemHeight=38) window.addControl(window.list) window.list.setPageControlVisible(False) #list cursor position label displayed at the bottom right of the screen window.listpos = xbmcgui.ControlLabel(640,540,250,30, "") window.addControl(window.listpos) #buttons creation x=50 y=303 window.button_home = xbmcgui.ControlButton(x,y,120,32,' Home', RootDir + "images\\button-focus1.png", RootDir + "images\\button-nofocus1.png") window.addControl(window.button_home) window.button_favorites = xbmcgui.ControlButton(x,y+32,120,32,' Favorites', RootDir + "images\\button-focus1.png", RootDir + "images\\button-nofocus1.png") window.addControl(window.button_favorites) window.button_downloads = xbmcgui.ControlButton(x,y+64,120,32,' Downloads', RootDir + "images\\button-focus1.png", RootDir + "images\\button-nofocus1.png") window.addControl(window.button_downloads) window.button_url = xbmcgui.ControlButton(x,y+96,120,32,' Browse', RootDir + "images\\button-focus1.png", RootDir + "images\\button-nofocus1.png") window.addControl(window.button_url) window.button_about = xbmcgui.ControlButton(x,y+128,120,32,' About', RootDir + "images\\button-focus1.png", RootDir + "images\\button-nofocus1.png") window.addControl(window.button_about) #button behaviour window.button_home.controlDown(window.button_favorites) window.button_favorites.controlDown(window.button_downloads) window.button_downloads.controlDown(window.button_url) window.button_url.controlDown(window.button_about) window.button_about.controlUp(window.button_url) window.button_url.controlUp(window.button_downloads) window.button_downloads.controlUp(window.button_favorites) window.button_favorites.controlUp(window.button_home) window.button_home.controlRight(window.list) window.button_favorites.controlRight(window.list) window.button_downloads.controlRight(window.list) window.button_url.controlRight(window.list) window.button_about.controlRight(window.list) window.list.controlLeft(window.button_home)
def set_controls(self): idw = __settings__.getSetting("idw") L = List_gr() # При первоначальном создании задаются фиктивные координаты и размеры: 1, 1, 1, 1. no_int_label = xbmcgui.ControlLabel(1, 1, 1, 1, 'Управление каналами:', alignment=ALIGN_CENTER) self.placeControl(no_int_label, -1, 0, 1, 7) no_int_label = xbmcgui.ControlLabel(1, 1, 1, 1, 'Группы:', alignment=ALIGN_CENTER) self.placeControl(no_int_label, 0, 0, 1, 2) no_int_label = xbmcgui.ControlLabel(1, 1, 1, 1, 'Каналы:', alignment=ALIGN_CENTER) self.placeControl(no_int_label, 0, 2, 1, 2) no_int_label = xbmcgui.ControlLabel(1, 1, 1, 1, 'Порядок:', alignment=ALIGN_CENTER) self.placeControl(no_int_label, 0, 4, 1, 2) # 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, 12, 6) self.button_addg = xbmcgui.ControlButton( 1, 1, 1, 1, u'+', focusTexture=self.button_bg_focus, noFocusTexture=self.button_bg_Nofocus, alignment=ALIGN_CENTER) self.placeControl(self.button_addg, 12, 0) self.button_remg = xbmcgui.ControlButton( 1, 1, 1, 1, u'-', focusTexture=self.button_bg_focus, noFocusTexture=self.button_bg_Nofocus, alignment=ALIGN_CENTER) self.placeControl(self.button_remg, 12, 1) # ControlList self.list = xbmcgui.ControlList(1, 1, 1, 1, buttonTexture=self.list_bg_Nofocus, buttonFocusTexture=self.list_bg_focus) self.placeControl(self.list, 1, 0, 11, 2) self.list.addItems(L) self.list2 = xbmcgui.ControlList(1, 1, 1, 1, buttonTexture=self.list_bg_Nofocus, buttonFocusTexture=self.list_bg_focus) self.placeControl(self.list2, 1, 2, 12, 2) self.list2.addItems(List_cn()) self.list3 = xbmcgui.ControlList(1, 1, 1, 1, buttonTexture=self.list_bg_Nofocus, buttonFocusTexture=self.list_bg_focus) self.placeControl(self.list3, 1, 4, 12, 2) self.list3.addItems(get_gr())
def __init__(self): if Emulating: xbmcgui.Window.__init__(self) self.X = (float(self.getWidth()) / float(720)) self.Y = (float(self.getHeight()) / float(480)) self.saves = [] self.status = "SAVE" if not os.path.exists(ROOT_DIR): os.makedirs(ROOT_DIR) if not os.path.exists(TRAINER_DIR): os.makedirs(ROOT_DIR) self.addControl( xbmcgui.ControlImage(0, 0, int(720 * self.X), int(480 * self.Y), "background.png")) self.list = xbmcgui.ControlList(int(211 * self.X), int(100 * self.Y), int(450 * self.X), int(350 * self.Y)) self.btnSearch = xbmcgui.ControlButton(int(60 * self.X), int(100 * self.Y), int(140 * self.X), int(30 * self.Y), "Search") self.btnRestore = xbmcgui.ControlButton(int(60 * self.X), int(132 * self.Y), int(140 * self.X), int(30 * self.Y), "Restore") self.btnClear = xbmcgui.ControlButton(int(60 * self.X), int(164 * self.Y), int(140 * self.X), int(30 * self.Y), "Clear Backup") self.btnTrainer = xbmcgui.ControlButton(int(60 * self.X), int(228 * self.Y), int(140 * self.X), int(30 * self.Y), "Trainers") self.btnOptions = xbmcgui.ControlButton(int(60 * self.X), int(260 * self.Y), int(140 * self.X), int(30 * self.Y), "Options") self.addControl(self.list) self.addControl(self.btnSearch) self.addControl(self.btnRestore) self.addControl(self.btnClear) self.addControl(self.btnTrainer) self.addControl(self.btnOptions) self.list.controlLeft(self.btnSearch) self.btnSearch.controlUp(self.btnOptions) self.btnSearch.controlDown(self.btnRestore) self.btnSearch.controlRight(self.list) self.btnRestore.controlUp(self.btnSearch) self.btnRestore.controlDown(self.btnClear) self.btnRestore.controlRight(self.list) self.btnClear.controlUp(self.btnRestore) self.btnClear.controlDown(self.btnTrainer) self.btnClear.controlRight(self.list) self.btnTrainer.controlUp(self.btnClear) self.btnTrainer.controlDown(self.btnOptions) self.btnTrainer.controlRight(self.list) self.btnOptions.controlUp(self.btnTrainer) self.btnOptions.controlDown(self.btnSearch) self.btnOptions.controlRight(self.list) self.setFocus(self.btnSearch)
def __init__(self): if Emulating: xbmcgui.Window.__init__(self) self.X = (float(self.getWidth()) / float(720)) self.Y = (float(self.getHeight()) / float(480)) self.DOWNLOAD = CONTROL_DOWNLOAD self.filename = "" self.addControl( xbmcgui.ControlImage(0, 0, int(720 * self.X), int(480 * self.Y), ROOT_DIR + "background.jpg")) self.list = xbmcgui.ControlList(int(206 * self.X), int(100 * self.Y), int(446 * self.X), int(350 * self.Y)) self.list2 = xbmcgui.ControlList(int(206 * self.X), int(100 * self.Y), int(446 * self.X), int(350 * self.Y)) self.btnBack = xbmcgui.ControlButton(int(60 * self.X), int(100 * self.Y), int(140 * self.X), int(30 * self.Y), "Back... ") self.btnFeatured = xbmcgui.ControlButton(int(60 * self.X), int(100 * self.Y), int(140 * self.X), int(30 * self.Y), "Featured ") self.btnNewest = xbmcgui.ControlButton(int(60 * self.X), int(132 * self.Y), int(140 * self.X), int(30 * self.Y), "Newest ") self.btnComing = xbmcgui.ControlButton(int(60 * self.X), int(164 * self.Y), int(140 * self.X), int(30 * self.Y), "Coming Soon ") self.btnPopular = xbmcgui.ControlButton(int(60 * self.X), int(196 * self.Y), int(140 * self.X), int(30 * self.Y), "Most Popular") self.btnListAll = xbmcgui.ControlButton(int(60 * self.X), int(228 * self.Y), int(140 * self.X), int(30 * self.Y), "List All ") self.btnOptions = xbmcgui.ControlButton(int(60 * self.X), int(292 * self.Y), int(140 * self.X), int(30 * self.Y), "Options ") self.btnPlayback = xbmcgui.ControlButton(int(60 * self.X), int(324 * self.Y), int(140 * self.X), int(30 * self.Y), "Playback D/L") self.btnSave = xbmcgui.ControlButton(int(60 * self.X), int(356 * self.Y), int(140 * self.X), int(30 * self.Y), "Save As.... ") self.loadmenu() ParseFeatured(ComingURL) if not Emulating: progress = xbmcgui.DialogProgress() progress.create("GameTrailers", "Downloading pictures...") for i in range(0, len(images)): self.downloadImg(images[i], ROOT_DIR + "temp" + str(i + 1) + ".jpg") self.addFeat() self.list.reset() if not Emulating: progress.close() self.setFocus(self.btnFeatured)
def get_n(self, name, name2): #from metahandler import metahandlers #mg = metahandlers.MetaData() nume, an = xbmc.getCleanMovieTitle(name) #nume = nume.replace(" ", "+") nume = nume.replace('ț', 't').replace('ă', 'a') nume = urllib.quote_plus(nume) info_url = 'http://www.omdbapi.com/?t=%s&y=%s&plot=full&r=json' % ( nume, an) met = self.get_data(info_url) meta = json.loads(met) data = [ 'Poster', 'Title', 'Plot', 'Genre', 'imdbRating', 'Year', 'Director', 'Writer', 'Actors', 'Country', 'Language' ] if ('Error' in meta) and not (name2 == ' filme online'): nume, an = xbmc.getCleanMovieTitle(name2) nume = urllib.quote_plus(nume) info_url = 'http://www.omdbapi.com/?t=%s&y=%s&plot=full&r=json' % ( nume, an) met = self.get_data(info_url) meta = json.loads(met) for dat in data: if not dat in meta: meta[dat] = 'Not Found' fundal = os.path.join(__cwd__, 'resources', 'media', 'ContentPanel.png') self.background = xbmcgui.ControlImage(180, 0, 1120, 720, fundal) self.addControl(self.background) self.fanart = xbmcgui.ControlImage(200, 100, 270, 380, meta['Poster'], aspectRatio=2) self.addControl(self.fanart) #self.glassoverlay = xbmcgui.ControlImage(204, 104, 200, 230, 'GlassOverlay.png', aspectRatio=2) #self.addControl(self.glassoverlay) self.title = xbmcgui.ControlLabel(500, 40, 1030, 30, ('Titlu: %s' % meta['Title'])) self.addControl(self.title) self.title = xbmcgui.ControlTextBox(210, 527, 1030, 120) self.addControl(self.title) self.title.setText('Plot: %s' % meta['Plot']) self.list = xbmcgui.ControlList(500, 90, 740, 390) self.addControl(self.list) self.list.addItem("genre: %s" % meta['Genre']) self.list.addItem("rating: %s" % meta['imdbRating']) self.list.addItem("year: %s" % meta['Year']) self.list.addItem("director: %s" % meta['Director']) self.list.addItem("writer: %s" % meta['Writer']) self.list.addItem("cast: %s" % meta['Actors']) self.list.addItem("country: %s" % meta['Country']) self.list.addItem("language: %s" % meta['Language'])
def __init__(self): self.setCoordinateResolution(6) self.startNewGame() self.addControl(xbmcgui.ControlImage(0, 0, 720, 576, BG00)) self.addControl(xbmcgui.ControlImage(-100, 95, 920, 360, BG01)) self.addControl( xbmcgui.ControlLabel(200, 63, 0, 0, "xbox media center", 'special12', alignment=0x00000001)) self.addControl( xbmcgui.ControlLabel(207, 63, 0, 0, __script__, 'special13')) self.logo = xbmcgui.ControlImage(550, 40, 74, 74, BG04) self.addControl(self.logo) self.countMaxRolling = xbmcgui.ControlLabel(115, 472, 90, 0, "", 'special12', alignment=0x00000002 + 0x00000004) self.addControl(self.countMaxRolling) self.countMaxRolling.setLabel( str(self.score.maxRolling) + "[CR]/[CR]16") # EXTRA BUTTON DICE self.addControl( xbmcgui.ControlLabel(50, 415, 90, 0, ROLL, 'special13', '0xeeFF0000', alignment=0x00000002 + 0x00000004)) self.btn_dice_ex = xbmcgui.ControlButton(50, 430, 90, 90, "", font="font13", textColor='0xeeFF0000', focusTexture=BG02, noFocusTexture=BG03, alignment=0x00000002 + 0x00000004) self.addControl(self.btn_dice_ex) self.dummy = xbmcgui.ControlButton(50, 430, 90, 90, "", focusTexture="", noFocusTexture="") self.addControl(self.dummy) # GROUP OF RADIO BUTTON ROLL (EXTRA BUTTON DICE) self.roll_1 = xbmcgui.ControlImage(59, 520, 22, 22, BGRADIO) self.addControl(self.roll_1) self.roll_2 = xbmcgui.ControlImage(84, 520, 22, 22, BGRADIO) self.addControl(self.roll_2) self.roll_3 = xbmcgui.ControlImage(109, 520, 22, 22, BGRADIO) self.addControl(self.roll_3) # GROUP OF BUTTON DICE self.btn_dice_1 = xbmcgui.ControlButton(180, 430, 90, 90, "", font="font13", focusTexture=BG02, noFocusTexture=BG03, alignment=0x00000002 + 0x00000004) self.addControl(self.btn_dice_1) self.btn_dice_2 = xbmcgui.ControlButton(275, 430, 90, 90, "", font="font13", focusTexture=BG02, noFocusTexture=BG03, alignment=0x00000002 + 0x00000004) self.addControl(self.btn_dice_2) self.btn_dice_3 = xbmcgui.ControlButton(370, 430, 90, 90, "", font="font13", focusTexture=BG02, noFocusTexture=BG03, alignment=0x00000002 + 0x00000004) self.addControl(self.btn_dice_3) self.btn_dice_4 = xbmcgui.ControlButton(465, 430, 90, 90, "", font="font13", focusTexture=BG02, noFocusTexture=BG03, alignment=0x00000002 + 0x00000004) self.addControl(self.btn_dice_4) self.btn_dice_5 = xbmcgui.ControlButton(560, 430, 90, 90, "", font="font13", focusTexture=BG02, noFocusTexture=BG03, alignment=0x00000002 + 0x00000004) self.addControl(self.btn_dice_5) # GROUP OF RADIO BUTTON DICE self.dice_1Hold = xbmcgui.ControlImage(214, 520, 22, 22, BGNORADIO) self.addControl(self.dice_1Hold) self.dice_2Hold = xbmcgui.ControlImage(309, 520, 22, 22, BGNORADIO) self.addControl(self.dice_2Hold) self.dice_3Hold = xbmcgui.ControlImage(404, 520, 22, 22, BGNORADIO) self.addControl(self.dice_3Hold) self.dice_4Hold = xbmcgui.ControlImage(499, 520, 22, 22, BGNORADIO) self.addControl(self.dice_4Hold) self.dice_5Hold = xbmcgui.ControlImage(594, 520, 22, 22, BGNORADIO) self.addControl(self.dice_5Hold) # GROUP OF BUTTON SCORE self.upperScore = xbmcgui.ControlList(87, 120, 270, 350, font="font13", textColor="0xFFFFFFFF", selectedColor="0xFFFF9600", buttonFocusTexture=BG05, buttonTexture=BG06, itemTextXOffset=-10, itemHeight=28) self.addControl(self.upperScore) self.lowerScore = xbmcgui.ControlList(363, 120, 270, 350, font="font13", textColor="0xFFFFFFFF", selectedColor="0xFFFF9600", buttonFocusTexture=BG05, buttonTexture=BG06, itemTextXOffset=-10, itemHeight=28) self.addControl(self.lowerScore) # EXTRA DICE self.dice_ex = xbmcgui.ControlImage(CHEXDICE[0], CHEXDICE[1], CHEXDICE[2], CHEXDICE[3], DICEBG % self.dice.ex) self.addControl(self.dice_ex) # GROUP OF DICE self.dice_1 = xbmcgui.ControlImage(CH01DICE[0], CH01DICE[1], CH01DICE[2], CH01DICE[3], DICEBG % self.dice.d1) self.addControl(self.dice_1) self.dice_2 = xbmcgui.ControlImage(CH02DICE[0], CH02DICE[1], CH02DICE[2], CH02DICE[3], DICEBG % self.dice.d2) self.addControl(self.dice_2) self.dice_3 = xbmcgui.ControlImage(CH03DICE[0], CH03DICE[1], CH03DICE[2], CH03DICE[3], DICEBG % self.dice.d3) self.addControl(self.dice_3) self.dice_4 = xbmcgui.ControlImage(CH04DICE[0], CH04DICE[1], CH04DICE[2], CH04DICE[3], DICEBG % self.dice.d4) self.addControl(self.dice_4) self.dice_5 = xbmcgui.ControlImage(CH05DICE[0], CH05DICE[1], CH05DICE[2], CH05DICE[3], DICEBG % self.dice.d5) self.addControl(self.dice_5) self.setNavigationOnDice() self.setHoldForNewGame() self.setScoreSection() self.setColorDice()
def define_controls(self): global SW_LISTS global ALL_BUTTONS #control ids self.control_btn_close_id = 10 self.control_btn_call_to_id = 5001 self.control_btn_answer_id = 5002 self.control_btn_contacts_id = 5006 self.control_btn_hangup_id = 5004 self.control_btn_settings_id = 5005 self.control_btn_recent_id = 5003 self.control_list_contacts_id = 5008 self.control_btn_scaler_id = 5010 self.control_btn_add_contact_id = 5011 self.control_btn_self_view_id = 5012 self.control_label_status_id = 5051 self.control_btn_context_id = 5019 self.control_btn_bright_plus_id = 5031 self.control_btn_bright_minus_id = 5032 #controls self.btn_hangup = self.getControl(self.control_btn_hangup_id) self.btn_contacts = self.getControl(self.control_btn_contacts_id) #self.slider = self.getControl(self.control_slider_id) self.btn_scaler = self.getControl(self.control_btn_scaler_id) self.btn_self_view = self.getControl(self.control_btn_self_view_id) self.btn_close = self.getControl(self.control_btn_close_id) self.btn_call_to = self.getControl(self.control_btn_call_to_id) self.btn_answer = self.getControl(self.control_btn_answer_id) self.btn_settings = self.getControl(self.control_btn_settings_id) self.btn_recent = self.getControl(self.control_btn_recent_id) #self.list_contacts = self.getControl(self.control_list_contacts_id) self.btn_add_contact = self.getControl(self.control_btn_add_contact_id) self.label_status = self.getControl(self.control_label_status_id) self.btn_context = self.getControl(self.control_btn_context_id) self.btn_bright_plus = self.getControl(self.control_btn_bright_plus_id) self.btn_bright_minus = self.getControl( self.control_btn_bright_minus_id) list_top_pos = int(HEIGHT / 720) + 90 self.addControl( xbmcgui.ControlImage( 970, list_top_pos - 3, 306, 306, __cwd__ + '/resources/skins/Default/media/list_bg.png')) self.list_contacts = xbmcgui.ControlList(973, list_top_pos, 300, 330, 'font12', '0xFFFFFFFF', 'button-nofocus.png', 'button-focus.png', "0xFF000000", 0, 0, 0, 0, 25, 2) self.addControl(self.list_contacts) self.control_list_contacts_id = self.list_contacts.getId() self.list_contacts.controlUp(self.btn_contacts) self.list_contacts.controlDown(self.btn_call_to) self.list_contacts.controlLeft(self.btn_contacts) self.list_contacts.controlRight(self.btn_context) if __is_full_ver__ > 0: self.btn_scaler.setVisible(True) self.btn_self_view.setVisible(True) else: self.btn_scaler.setVisible(False) self.btn_self_view.setVisible(False) self.btn_recent.controlDown(self.list_contacts) self.btn_contacts.controlDown(self.list_contacts) self.btn_call_to.controlUp(self.list_contacts) self.sttus = xbmcgui.ControlTextBox(973, 460, 300, 200, textColor='0xFFFFFFFF') self.addControl(self.sttus) #self.sttus.setText("H:" + str(HEIGHT) + " W:" + str(WIDTH)) if os.path.exists('/usr/bin/v4l2-ctl'): self.btn_bright_plus.setVisible(True) self.btn_bright_minus.setVisible(True) set_r = self.control_btn_bright_plus_id else: self.btn_bright_plus.setVisible(False) self.btn_bright_minus.setVisible(False) set_r = self.control_btn_settings_id b_list = self.control_list_contacts_id b_callto = self.control_btn_call_to_id b_addcont = self.control_btn_add_contact_id b_up = self.control_btn_answer_id b_down = self.control_btn_hangup_id b_size = self.control_btn_scaler_id b_self = self.control_btn_self_view_id b_sett = self.control_btn_settings_id b_close = self.control_btn_close_id b_bplus = self.control_btn_bright_plus_id # b_list, b_callto, b_addcont, b_up, b_down, b_size, b_self, b_sett, b_close ALL_BUTTONS = { 'b_list': b_list, 'b_callto': b_callto, 'b_addcont': b_addcont, 'b_up': b_up, 'b_down': b_down, 'b_size': b_size, 'b_self': b_self, 'b_sett': b_sett, 'b_close': b_close } b_lite = { 'end': { 'b_list': [0, 0, b_callto, 0], 'b_callto': [b_list, b_addcont, b_sett, b_addcont], 'b_addcont': [b_list, b_callto, b_sett, b_callto], 'b_sett': [b_callto, set_r, b_close, b_sett], 'b_close': [b_sett, 0, 0, 0] }, 'ringing': { 'b_list': [0, 0, b_up, 0], 'b_up': [b_list, b_down, b_close, b_down], 'b_down': [b_list, b_up, b_close, b_up], 'b_close': [b_up, 0, 0, 0] }, 'calling': { 'b_list': [0, 0, b_down, 0], 'b_down': [b_list, b_down, b_close, b_down], 'b_close': [b_down, 0, 0, 0] }, 'active': { 'b_list': [0, 0, b_down, 0], 'b_down': [b_list, b_down, b_close, b_down], 'b_close': [b_down, 0, 0, 0] }, } b_full = { 'end': { 'b_list': [0, 0, b_callto, 0], 'b_callto': [b_list, b_addcont, b_size, b_addcont], 'b_addcont': [b_list, b_callto, b_size, b_callto], 'b_size': [b_addcont, b_size, b_sett, b_size], 'b_sett': [b_size, set_r, b_close, b_sett], 'b_close': [b_sett, 0, 0, 0] }, 'ringing': { 'b_list': [0, 0, b_up, 0], 'b_up': [b_list, b_down, b_close, b_down], 'b_down': [b_list, b_up, b_close, b_up], 'b_close': [b_up, 0, 0, 0] }, 'calling': { 'b_list': [0, 0, b_down, 0], 'b_down': [b_list, b_down, b_close, b_down], 'b_close': [b_down, 0, 0, 0] }, 'active': { 'b_list': [0, 0, b_down, 0], 'b_down': [b_list, b_down, b_size, b_down], 'b_size': [b_down, b_self, b_close, b_self], 'b_self': [b_down, b_size, b_close, b_size], 'b_close': [b_size, 0, 0, 0] }, } SW_LISTS = b_full if __is_full_ver__ else b_lite
def create(self): """ internal: creates the control and adds it to the page assumes width/height etc are already set does not do navigation """ # get generic stuff, position, type, etc id = string.lower(self.getoption("id")) t = string.lower(self.getoption("type")) x = int(self.getvalue(self.getoption("posx"))) y = int(self.getvalue(self.getoption("posy"))) c=None # 0 means auto (afaik) w = 0 h = 0 t1 = self.getoption("width") if t1 != "": w = int(self.getvalue(t1)) t1 = self.getoption("height") if t1 != "": h = int(self.getvalue(t1)) l = self.getoption("label") try: t1 = int(l) l = self.translator.get(t1) except: pass help = self.getoption("help") try: t1 = int(help) help = self.translator.get(t1) except: pass self.options['help'] = help tx = self.getoption("texture") if tx != "": tx = util.findMediaFile( tx ) # if it didn't find the script skin file then use the xbmc skin file if tx == None: tx = self.getoption("texture") tx1 = self.getoption("texturefocus") if tx1 != "": tx1 = util.findMediaFile( tx1 ) tx2 = self.getoption("texturenofocus") if tx2 != "": tx2 = util.findMediaFile( tx2 ) ck = self.getoption("colorkey") aspectRatio = self.getoption("aspectratio") fnt = self.getvalue(self.getoption("font")) tcol = self.getoption("textcolor") log.debug( "id=[%s] x=[%d] y=[%d] w=[%d] h=[%d] font=[%s]"%(id,x,y,w,h,fnt) ) c = None if t == "image": try: if ck == "" and aspectRatio == "": c = xbmcgui.ControlImage(x,y,w,h,tx) elif aspectRatio != "": c = xbmcgui.ControlImage(x,y,w,h,tx, aspectRatio=int(aspectRatio)) else: c = xbmcgui.ControlImage(x,y,w,h,tx,ck) except Exception: log.exception("Unable to load image id:%s filename:%s" %(id, tx)) elif t == "button": try: tox = int(self.getvalue(self.getoption("offsetx"))) except: tox = 17 try: toy = int(self.getvalue(self.getoption("offsety"))) except: toy = 2 try: align = int(self.getvalue(self.getoption("alignment"))) except: align = 0 # left log.debug( "font=[%s] tox=[%d] toy=[%d] align=[%d]"%(fnt,tox,toy,align) ) if tx1 == "": if fnt == "": c = xbmcgui.ControlButton( x,y,w,h,l, textXOffset=int(tox),textYOffset=int(toy), alignment=align) else: c = xbmcgui.ControlButton( x,y,w,h,l,font=str(fnt), textXOffset=int(tox),textYOffset=int(toy), alignment=align) elif tx2 == "": if fnt == "": c = xbmcgui.ControlButton( x,y,w,h,l,tx1, textXOffset=int(tox),textYOffset=int(toy), alignment=align) else: c = xbmcgui.ControlButton( x,y,w,h,l,tx1,font=fnt, textXOffset=int(tox),textYOffset=int(toy), alignment=align) else: if fnt == "": c = xbmcgui.ControlButton( x, y, w, h, l, tx1, tx2, textXOffset=int(tox), textYOffset=int(toy), alignment=align) else: c = xbmcgui.ControlButton( x, y, w, h, l, tx1, tx2, font=fnt, textXOffset=int(tox), textYOffset=int(toy), alignment=align) elif t == "fadelabel": try: align = int(self.getvalue(self.getoption("alignment"))) except Exception: ## traceback.print_exc() ## print ( "XBMCMYTHTV: %s " % str(ex) ) align = 6 # left c = xbmcgui.ControlFadeLabel(x,y,w,h,str(fnt),tcol,alignment=align) elif t == "label": try: align = int(self.getvalue(self.getoption("alignment"))) except: align = 0 # left c = xbmcgui.ControlLabel(x,y,w,h,l,str(fnt),tcol,alignment=align) elif t == "listcontrol": try: tox = int(self.getvalue(self.getoption("offsetx"))) except: tox = 17 try: spc = int(self.getvalue(self.getoption("space"))) except: spc = 1 try: ih = int(self.getvalue(self.getoption( "itemheight" ))) except: ih = 20 # ALIGN_LEFT = 0 # ALIGN_RIGHT = 1 # ALIGN_CENTER_X = 2 # ALIGN_CENTER_Y = 4 # ALIGN_TRUNCATED = 8 bt = util.findMediaFile('button-focus.png') aly = ui.ALIGN_TRUNCATED | ui.ALIGN_CENTER_Y log.debug( "font=[%s] tox=[%d] ih=[%d]"%(fnt,tox,ih) ) if tx1 == "": if fnt == "": c = xbmcgui.ControlList(x,y,w,h,itemTextXOffset=int(tox),space=int(spc),itemHeight=int(ih), alignmentY = aly, buttonFocusTexture=bt) else: c = xbmcgui.ControlList(x,y,w,h,font=fnt,itemTextXOffset=int(tox),space=int(spc),itemHeight=int(ih), alignmentY = aly, buttonFocusTexture=bt) log.debug( "xbmcgui.ControlList(x,y,w,h)" ) elif tx2 == "": if fnt == "": c = xbmcgui.ControlList(x,y,w,h,tx1,itemTextXOffset=int(tox),space=int(spc),itemHeight=int(ih), alignmentY = aly, buttonFocusTexture=bt) else: c = xbmcgui.ControlList(x, y, w, h, tx1, font=fnt, itemTextXOffset=int(tox), space=int(spc), itemHeight=int(ih), alignmentY = aly, buttonFocusTexture=bt) log.debug( "xbmcgui.ControlList(x,y,w,h,tx1)" ) else: if fnt == "": c = xbmcgui.ControlList(x,y,w,h,tx1,tx2,itemTextXOffset=int(tox),space=int(spc),itemHeight=int(ih), alignmentY = aly, buttonFocusTexture=bt) else: c = xbmcgui.ControlList(x,y,w,h,tx1,tx2,font=fnt,itemTextXOffset=int(tox),space=int(spc),itemHeight=int(ih), alignmentY = aly, buttonFocusTexture=bt) log.debug( "xbmcgui.ControlList(x,y,w,h,tx1,tx2)" ) elif t == "textbox": c = xbmcgui.ControlTextBox(x,y,w,h,fnt,tcol) # c.setText() elif t == "checkmark": try: cw = int(self.getoption( "checkwidth" )) except: cw = 30 try: ch = int(self.getoption( "checkheight" )) except: ch = 30 try: align = int(self.getvalue(self.getoption("alignment"))) except: align = 1 # right if tx1 == "": c = xbmcgui.ControlCheckMark( x,y,w,h,l, checkWidth=cw, checkHeight=ch, alignment=align, textColor=tcol) elif tx2 == "": c = xbmcgui.ControlCheckMark( x,y,w,h,l,tx1, checkWidth=cw, checkHeight=ch, alignment=align, textColor=tcol) else: c = xbmcgui.ControlCheckMark( x,y,w,h,l,tx1,tx2,cw,ch,align,textColor=tcol) log.debug( "created '%s' control"%t ) # TODO: Remove OS specific checks if c != None: if os.name != "nt": self.owner.addControl(c) else: # lists are acting funny. trying remove instead of hide t1 = self.owner.getoption("defaultgroup") if t1 == self.getoption("group") or \ self.getoption("group") == "": self.owner.addControl(c) self.control = c
except Exception, ex: outPrint('Unable to init the channel list', ex) return self.addControl(xbmcgui.ControlImage(0, 0, self.getScX(SIZE_WIDTH), self.getScY(SIZE_HEIGHT), BACKGROUND)) self.strVersionInfo = xbmcgui.ControlLabel(self.getScX(315), self.getScY(110), self.getScX(200), self.getScY(200), "", "font12", "0xCCCCCCFF") self.addControl(self.strVersionInfo) self.strVersionInfo.setLabel('Version %s'%(VERSION) ) self.list = xbmcgui.ControlList(self.getScX(83), self.getScY(140), self.getScX(548), self.getScY(400), buttonTexture=LIST_SELECT_BG, buttonFocusTexture=LIST_SELECT_BG_FOCUS, textColor='0xFFFFFFFF', itemHeight=self.getScY(70), space=5, itemTextXOffset=self.getScX(40), imageWidth=self.getScX(74), imageHeight=self.getScY(50) ) self.addControl(self.list) #the stack of all entered elements, category or channel self.listElements = [] elements = [] # add the root categories, no parent, and also the channels without a category for category in self.categories: if category.parentid == None: self.list.addItem(xbmcgui.ListItem(category.name , thumbnailImage=os.path.join(IMAGES, category.imagelink))) elements.append(category)