def __init__(self, context=None, window=None): self.title = i18n('Composite Playlist') self.description_label = i18n( 'Generate a playlist from the information below') super(CompositePlaylistWindow, self).__init__(self.title) # pylint: disable=super-with-arguments self._context = context self.window = window self.player = xbmc.Player() self.playlist_data = { 'content': 'tvshows', 'item_count': 50, 'servers': [(i18n('All Servers'), None)], 'source': (i18n('On Deck'), 'on_deck'), 'shuffle': False } self._servers = [] self._sources = [ (i18n('All'), 'all'), (i18n('On Deck'), 'on_deck'), (i18n('Recently Added'), 'recent_added'), (i18n('Recently Released'), 'recent_released'), ] self._item_counts = [ '1', '5', '10', '25', '50', '100', '250', '500', '1000' ] self.description = pyxbmct.Label(self.description_label, alignment=0) self.movies_radio = pyxbmct.RadioButton(self.bold(i18n('Movies'))) self.tvshows_radio = pyxbmct.RadioButton(self.bold(i18n('TV Shows'))) self.mixed_radio = pyxbmct.RadioButton(self.bold(i18n('Mixed'))) self.item_count_label = pyxbmct.Label(self.bold(i18n('Item Count')), alignment=0) self.item_count = pyxbmct.Label(str(self.playlist_data['item_count']), alignment=1) self.item_count_list = pyxbmct.List() self.server_label = pyxbmct.Label(self.bold(i18n('Server(s)')), alignment=0) self.server_choice_label = pyxbmct.FadeLabel() self.server_list = pyxbmct.List() self.source_label = pyxbmct.Label(self.bold(i18n('Source'))) self.source_choice_label = pyxbmct.FadeLabel() self.source_list = pyxbmct.List() self.shuffle_radio = pyxbmct.RadioButton(self.bold(i18n('Shuffle'))) self.cancel_button = pyxbmct.Button(i18n('Cancel')) self.play_button = pyxbmct.Button(i18n('Play')) self.generated = False
def __init__(self, title='', items=None, callback=None): super(DialogSelect, self).__init__(title) self.setGeometry(900, 600, rows_=len(items), columns_=1) self.list = pyxbmct.List(_itemHeight=64, _space=4, _itemTextXOffset=0, _itemTextYOffset=-2) self.placeControl(self.list, row=0, column=0, rowspan=len(items), columnspan=1, pad_x=0, pad_y=0) self.list.addItems(items) if callback: self.connect(self.list, lambda: callback(self.list.getSelectedPosition())) self.setFocus(self.list) self.connect(pyxbmct.ACTION_NAV_BACK, self.close)
def addTabs(self, tabs, bold=False, space=10, padX=-10, textXOffset=0): listC = pyxbmct.List(_space=space, _itemTextXOffset=textXOffset) if not self.hideTabs: self.window.placeControl(listC, 0, 0, 10, 2, pad_x=padX) index = 0 for tab in tabs: title = tab.title title = ts.color(TABS_COLOR, title) if bold: title = ts.bold(title) listC.addItem(title) tab.num = index self.tabs.append(tab) self.window.setGeometry(self.width, self.height, tab.numRows, tab.numColumns) self.placeTab(tab) index += 1 self.tabsListC = listC self.showTab(0) self.window.connect(listC, self.tabAction)
def set_controls(self): self.listing = pyxbmct.List(_imageWidth=15) self.placeControl(self.listing, 0, 0, rowspan=9, columnspan=4) self.ok_button = pyxbmct.Button("OK") self.placeControl(self.ok_button, 9, 1) self.cancel_button = pyxbmct.Button("Cancel") self.placeControl(self.cancel_button, 9, 2)
def START(): if 'Red' in button_quit: text = '0xffffffff' elif 'Mono' in button_quit: text = '0xffffffff' else: text = '0xFF000000' global List global Icon #create butttons List = pyxbmct.List(buttonFocusTexture=button_focus, buttonTexture=button_no_focus, _space=11, _itemTextYOffset=-7, textColor=text) Icon = pyxbmct.Image(icon, aspectRatio=2) Icon.setImage(icon) Quit = pyxbmct.Button(' ', noFocusTexture=button_quit, focusTexture=button_quit_focus) #place buttons window.placeControl(List, 10, 1, 110, 30) window.placeControl(Icon, 30, 32, 60, 18) window.placeControl(Quit, 110, 48, 10, 3) #capture mouse moves or up down arrows window.connectEventList([ pyxbmct.ACTION_MOVE_DOWN, pyxbmct.ACTION_MOVE_UP, pyxbmct.ACTION_MOUSE_MOVE ], LIST_UPDATE) #navigation List.controlRight(Quit) #button actions window.connect(List, PlayStream) window.connect(Quit, window.close) GETCHANNELS()
def show_files(self): if self.files: return self.files = pyxbmct.List('font14') self.placeControl(self.files, 0, 0) link = self.cursel_link() self.list.setVisible(False) path = self.download_torrent(link) if filesystem.exists(path): import base player = base.TorrentPlayer() player.AddTorrent(path) data = player.GetLastTorrentData() if data: for f in data['files']: try: li = xbmcgui.ListItem( str(f['size'] / 1024 / 1024) + u' МБ | ' + f['name']) except: li = xbmcgui.ListItem(f['name']) li.setProperty('index', str(f['index'])) self.files.addItem(li) self.setFocus(self.files) self.connect(self.files, self.select_file)
def set_method(self, METHOD_NAME, method_steps): # List list_label = pyxbmct.Label(METHOD_NAME) self.placeControl(list_label, 4, 1.65) # self.list_item_label = pyxbmct.TextBox() self.placeControl(self.list_item_label, 4.5, 1.95, 4, 2) # List self.list = pyxbmct.List() self.placeControl(self.list, 4.5, 1.4, 5, 0.6) # Add items to the list step_num = 1 for i in method_steps: items = ['{0}. '.format(step_num) + i['step']] self.list.addItems(items) step_num = step_num + 1 # Connect the list to a function to display which list is selected self.connect( self.list, lambda: xbmc.executebuiltin( 'Notification(Note!,{0} selected.)'.format( self.list.getListItem(self.list.getSelectedPosition()). getLabel()))) # Connect key and mouse events for the list navaigation feedback self.connectEventList([ pyxbmct.ACTION_MOVE_DOWN, pyxbmct.ACTION_MOVE_UP, pyxbmct.ACTION_MOUSE_WHEEL_DOWN, pyxbmct.ACTION_MOUSE_WHEEL_UP, pyxbmct.ACTION_MOUSE_MOVE ], self.list_update)
def set_controls(self): self.listing = pyxbmct.List(_imageWidth=15) self.placeControl(self.listing, row=0, column=0, rowspan=_rows-1, columnspan=_cols) self.ok_button = pyxbmct.Button("OK") self.placeControl(self.ok_button, row=_rows-1, column=(_cols/2)-1) self.cancel_button = pyxbmct.Button("Cancel") self.placeControl(self.cancel_button, row=_rows-1, column=(_cols/2))
def __init__(self, title, settings, links): # Вызываем конструктор базового класса. super(MyWindow, self).__init__(title) # Устанавливаем ширину и высоту окна, а также разрешение сетки (Grid): self.setGeometry(1280, 720, 1, 1) self.settings = settings self.files = None self.left_menu = None self.list = pyxbmct.List('font14', _itemHeight=120) self.placeControl(self.list, 0, 0) self.make_links = links self.fill_list() links.set_reload(self.reload) kodi_ver_major = int( xbmc.getInfoLabel('System.BuildVersion').split('.')[0]) if kodi_ver_major < 16: li = xbmcgui.ListItem(u'НАСТРОЙКИ...') li.setProperty( 'link', 'plugin://script.media.aggregator/?action=settings') self.list.addItem(li) li = xbmcgui.ListItem(u'СМОТРИТЕ ТАКЖЕ...') li.setProperty( 'link', 'plugin://script.media.aggregator/?action=show_similar') self.list.addItem(li) li = xbmcgui.ListItem(u'ПОИСК ИСТОЧНИКОВ...') li.setProperty( 'link', 'plugin://script.media.aggregator/?action=add_media') self.list.addItem(li) pathUnited = 'special://home/addons/plugin.video.united.search' pathUnited = xbmc.translatePath(pathUnited) if filesystem.exists(pathUnited.decode('utf-8')): li = xbmcgui.ListItem(u'UNITED SEARCH...') li.setProperty( 'link', 'plugin://script.media.aggregator/?action=united_search') self.list.addItem(li) self.setFocus(self.list) self.connect(self.list, self.make_choice) self.connect(pyxbmct.ACTION_MOVE_RIGHT, self.go_right) self.connect(pyxbmct.ACTION_MOVE_LEFT, self.go_left) # Связываем клавиатурное действие с методом. self.connect(pyxbmct.ACTION_NAV_BACK, self.close) self.has_choice = False self.has_select_file = False
def set_controls(self): # Text label label = pyxbmct.Label('Note: You can select mulltiple items! To delete click on "delete"') self.placeControl(label, 4, 0,columnspan=4) self.listing = pyxbmct.List(_imageWidth=20) self.placeControl(self.listing, 0,1, rowspan=4, columnspan=4) self.ok_button = pyxbmct.Button("Delete") self.placeControl(self.ok_button, 0, 0) self.cancel_button = pyxbmct.Button("Cancel") self.placeControl(self.cancel_button, 1, 0)
def addList(self, items, column, space=10, textOffsetX=0, columnspan=1, padX=0, rowspan=2, enabled=False): listC = pyxbmct.List(_space=space, _itemTextXOffset=textOffsetX) def init(): for item in items: listC.addItem(item) rowControl = self.addRowControl(listC, column, columnspan, padX, rowspan=rowspan, init=init, enabled=enabled) return rowControl
def set_active_controls(self): self.List = pyxbmct.List(buttonFocusTexture=Listbg,_space=12,_itemTextYOffset=-7,textColor='0xFFFFFFFF') self.placeControl(self.List, 25, 1, 80, 23) self.connectEventList( [pyxbmct.ACTION_MOVE_DOWN, pyxbmct.ACTION_MOVE_UP, pyxbmct.ACTION_MOUSE_WHEEL_DOWN, pyxbmct.ACTION_MOUSE_WHEEL_UP, pyxbmct.ACTION_MOUSE_MOVE], self.List_update)
def set_ingred(self, INGRED_NAME, ingred_list): # Label for ingredients self.label = pyxbmct.Label(INGRED_NAME) self.placeControl(self.label, .6, 0) # List of ingredients self.list = pyxbmct.List() self.placeControl(self.list, 1, 0, 8, 2) # Add items to the list step_num = 1 for i in ingred_list: items = ['- ' + i['ingred']] self.list.addItems(items) step_num = step_num + 1
def show_menu(self): if self.left_menu: return self.left_menu = pyxbmct.List('font14') self.placeControl(self.left_menu, 0, 0) link = self.cursel_link() self.list.setVisible(False) #path = self.download_torrent(link) #choice_path = path.replace('.torrent', '.choice') from downloader import TorrentDownloader import urllib torr_downloader = TorrentDownloader(urllib.unquote(link), None, self.settings) choice_path = filesystem.join( self.settings.torrents_path(), torr_downloader.get_subdir_name(), torr_downloader.get_post_index() + '.choice') # +++ if self.settings.copy_torrent_path: li = xbmcgui.ListItem(u'Копировать торрент') li.setProperty('link', link) #li.setProperty('path', path) li.setProperty('action', 'copy_torrent') self.left_menu.addItem(li) if filesystem.exists(choice_path): li = xbmcgui.ListItem(u'Отменить выбор') li.setProperty('link', link) li.setProperty('path', choice_path) li.setProperty('action', 'cancel_choice') else: li = xbmcgui.ListItem(u'Запомнить выбор') li.setProperty('link', link) li.setProperty('path', choice_path) li.setProperty('action', 'remember_choice') self.left_menu.addItem(li) # +++ self.setFocus(self.left_menu) self.connect(self.left_menu, self.select_menu_item)
def set_controls(self): Background = pyxbmct.Image( dialog_bg, aspectRatio=0) # set aspect ratio to stretch Background.setImage(dialog_bg) self.listing = pyxbmct.List(_imageWidth=15) self.placeControl(Background, 0, 0, rowspan=20, columnspan=20) Icon = pyxbmct.Image( images[0], aspectRatio=2) # set aspect ratio to keep original Icon.setImage(images[0]) self.placeControl(Icon, 0, 11, rowspan=8, columnspan=8, pad_x=10, pad_y=10) self.textbox = pyxbmct.TextBox() self.placeControl(self.textbox, 8, 11, rowspan=9, columnspan=9, pad_x=10, pad_y=10) self.textbox.setText(description[0]) self.textbox.autoScroll(5000, 2000, 8000) self.ok_button = pyxbmct.Button("OK") self.placeControl(self.ok_button, 17, 13, pad_x=10, pad_y=10, rowspan=2, columnspan=3) self.cancel_button = pyxbmct.Button("Cancel") self.placeControl(self.cancel_button, 17, 16, pad_x=10, pad_y=10, rowspan=2, columnspan=3) self.placeControl( self.listing, 0, 0, rowspan=20, columnspan=10, pad_y=10 ) # grid reference, start top left and span 9 boxes down and 5 across
def set_info_controls(self): self.Hello = pyxbmct.Label('', textColor='0xFFFFD700', font='font60', alignment=pyxbmct.ALIGN_CENTER) self.placeControl(self.Hello, -4, 1, 1, 50) self.List = pyxbmct.List(buttonFocusTexture=Listbg,_space=9,_itemTextYOffset=-7,textColor='0xFFFFD700') self.placeControl(self.List, 0, 2, 115, 10) self.textbox = pyxbmct.TextBox(textColor='0xFFFFD700') self.placeControl(self.textbox, 95, 18, 30, 30) self.Show_Logo = pyxbmct.Image('') self.placeControl(self.Show_Logo, 25, 18, 70, 30) self.connectEventList( [pyxbmct.ACTION_MOVE_DOWN, pyxbmct.ACTION_MOVE_UP, pyxbmct.ACTION_MOUSE_WHEEL_DOWN, pyxbmct.ACTION_MOUSE_WHEEL_UP, pyxbmct.ACTION_MOUSE_MOVE], self.List_update)
def create_list(self, name, **kwargs): self.__put_object(name, pyxbmct.List()) self.__get_object(name)._type = 'list'
def set_controls(self): self.listing = pyxbmct.List(_imageWidth=15) self.placeControl(self.listing, 0, 0, rowspan=5, columnspan=10) self.ok_button = pyxbmct.Button(__localize__(30051)) self.cancel_button = pyxbmct.Button(__localize__(30052))
def set_active_controls(self): ##SET THE PYXBMCT BUTTONS THAT USERS INTERACT WITH self.EVENTS = pyxbmct.Button(' EVENTS ', focusTexture=Focused_Button, noFocusTexture="", textColor='0xFF3E4349', focusedColor='0xFF3E4349') self.SearchButton = pyxbmct.Button('', focusTexture=Search_Button_Selected, noFocusTexture=Search_Button) self.GUIDE = pyxbmct.Button('', focusTexture=Guide_img_selected, noFocusTexture=Guide_img) self.VOD_MOVIES = pyxbmct.Button('', focusTexture=movies, noFocusTexture=movies_un) self.VOD_SHOWS = pyxbmct.Button('', focusTexture=tvshows, noFocusTexture=tvshows_un) self.CATCHUP_TV = pyxbmct.Button('', focusTexture=catchup, noFocusTexture=catchup_un) self.VOD_LIST = pyxbmct.List(buttonFocusTexture=List_vod_no, buttonTexture='', _imageWidth=20, _imageHeight=20, _space=-1, _itemHeight=71, _itemTextXOffset=4, _itemTextYOffset=-2, textColor='0xFFFFFFFF') self.LIST = pyxbmct.List(buttonFocusTexture=List_vod_Focused, buttonTexture='', _imageWidth=20, _imageHeight=20, _space=-1, _itemHeight=71, _itemTextXOffset=4, _itemTextYOffset=-2, textColor='0xFFFFFFFF') self.RAND_ONE = pyxbmct.Image(DEFAULT_POSTER) self.RAND_TWO = pyxbmct.Image(DEFAULT_POSTER) self.RAND_THREE = pyxbmct.Image(DEFAULT_POSTER) self.RAND_FOUR = pyxbmct.Image(DEFAULT_POSTER) self.RAND_FIVE = pyxbmct.Image(DEFAULT_POSTER) self.RAND_SIX = pyxbmct.Image(DEFAULT_POSTER) self.RAND_SEVEN = pyxbmct.Image(DEFAULT_POSTER) self.RAND_EIGHT = pyxbmct.Image(DEFAULT_POSTER) self.RAND_NINE = pyxbmct.Image(DEFAULT_POSTER) self.RAND_TEN = pyxbmct.Image(DEFAULT_POSTER) self.RAND_BUTTON_ONE = pyxbmct.Button('', focusTexture=PLAY_SEL, noFocusTexture=PLAY_IMG) self.RAND_BUTTON_TWO = pyxbmct.Button('', focusTexture=PLAY_SEL, noFocusTexture=PLAY_IMG) self.RAND_BUTTON_THREE = pyxbmct.Button('', focusTexture=PLAY_SEL, noFocusTexture=PLAY_IMG) self.RAND_BUTTON_FOUR = pyxbmct.Button('', focusTexture=PLAY_SEL, noFocusTexture=PLAY_IMG) self.RAND_BUTTON_FIVE = pyxbmct.Button('', focusTexture=PLAY_SEL, noFocusTexture=PLAY_IMG) self.RAND_BUTTON_SIX = pyxbmct.Button('', focusTexture=PLAY_SEL, noFocusTexture=PLAY_IMG) self.RAND_BUTTON_SEVEN = pyxbmct.Button('', focusTexture=PLAY_SEL, noFocusTexture=PLAY_IMG) self.RAND_BUTTON_EIGHT = pyxbmct.Button('', focusTexture=PLAY_SEL, noFocusTexture=PLAY_IMG) self.RAND_BUTTON_NINE = pyxbmct.Button('', focusTexture=PLAY_SEL, noFocusTexture=PLAY_IMG) self.RAND_BUTTON_TEN = pyxbmct.Button('', focusTexture=PLAY_SEL, noFocusTexture=PLAY_IMG) self.placeControl(self.RAND_ONE, 27, 12, 45, 6) self.placeControl(self.RAND_TWO, 27, 20, 45, 6) self.placeControl(self.RAND_THREE, 27, 28, 45, 6) self.placeControl(self.RAND_FOUR, 27, 36, 45, 6) self.placeControl(self.RAND_FIVE, 27, 44, 45, 6) self.placeControl(self.RAND_SIX, 78, 12, 45, 6) self.placeControl(self.RAND_SEVEN, 78, 20, 45, 6) self.placeControl(self.RAND_EIGHT, 78, 28, 45, 6) self.placeControl(self.RAND_NINE, 78, 36, 45, 6) self.placeControl(self.RAND_TEN, 78, 44, 45, 6) self.placeControl(self.RAND_BUTTON_ONE, 27, 12, 45, 6) self.placeControl(self.RAND_BUTTON_TWO, 27, 20, 45, 6) self.placeControl(self.RAND_BUTTON_THREE, 27, 28, 45, 6) self.placeControl(self.RAND_BUTTON_FOUR, 27, 36, 45, 6) self.placeControl(self.RAND_BUTTON_FIVE, 27, 44, 45, 6) self.placeControl(self.RAND_BUTTON_SIX, 78, 12, 45, 6) self.placeControl(self.RAND_BUTTON_SEVEN, 78, 20, 45, 6) self.placeControl(self.RAND_BUTTON_EIGHT, 78, 28, 45, 6) self.placeControl(self.RAND_BUTTON_NINE, 78, 36, 45, 6) self.placeControl(self.RAND_BUTTON_TEN, 78, 44, 45, 6) self.placeControl(self.SearchButton, 11, 27, 9, 7) self.placeControl(self.VOD_LIST, 20, 17, 122, 17) self.placeControl(self.LIST, 20, 8, 122, 11) self.placeControl(self.GUIDE, -11, 12, 12, 9) self.placeControl(self.VOD_MOVIES, 30, -1, 12, 10) self.placeControl(self.VOD_SHOWS, 40, -1, 12, 10) self.placeControl(self.CATCHUP_TV, 50, -1, 12, 10) #SET UP THE CONTROL LISTENER FOR MOUSE AND BUTTON CLICKS TO UPDATE LISTS self.connectEventList( [pyxbmct.ACTION_MOVE_DOWN, pyxbmct.ACTION_MOVE_UP, pyxbmct.ACTION_MOUSE_WHEEL_DOWN, pyxbmct.ACTION_MOUSE_WHEEL_UP, pyxbmct.ACTION_MOUSE_MOVE], self.list_update)
def START(): global Entertainment global Movies global Music global News global Sport global Docs global Kids global Food global USA global Religion global List global Icon #create butttons if 'Red' in button_quit:text='0xffffffff' elif 'Blue' in button_quit:text='0xffffffff' else:text='0xFF000000' Entertainment= pyxbmct.Button('1',focusTexture=button_focus,noFocusTexture=button_no_focus,textColor=text,focusedColor=text) Movies = pyxbmct.Button('2',focusTexture=button_focus,noFocusTexture=button_no_focus,textColor=text,focusedColor=text) Music = pyxbmct.Button('3',focusTexture=button_focus,noFocusTexture=button_no_focus,textColor=text,focusedColor=text) News = pyxbmct.Button('4',focusTexture=button_focus,noFocusTexture=button_no_focus,textColor=text,focusedColor=text) Sport = pyxbmct.Button('5',focusTexture=button_focus,noFocusTexture=button_no_focus,textColor=text,focusedColor=text) Docs = pyxbmct.Button('6',focusTexture=button_focus,noFocusTexture=button_no_focus,textColor=text,focusedColor=text) Kids= pyxbmct.Button('7',focusTexture=button_focus,noFocusTexture=button_no_focus,textColor=text,focusedColor=text) Food = pyxbmct.Button('8',focusTexture=button_focus,noFocusTexture=button_no_focus,textColor=text,focusedColor=text) USA = pyxbmct.Button('9',focusTexture=button_focus,noFocusTexture=button_no_focus,textColor=text,focusedColor=text) Religion = pyxbmct.Button('0',focusTexture=button_focus,noFocusTexture=button_no_focus,textColor=text) List = pyxbmct.List(buttonFocusTexture=button_focus1,buttonTexture=button_no_focus1,_space=11,_itemTextYOffset=-7,textColor=text) Icon=pyxbmct.Image(icon, aspectRatio=2) Icon.setImage(icon) Quit = pyxbmct.Button(' ',noFocusTexture=button_quit,focusTexture=button_quit_focus) #place buttons window.placeControl(Entertainment,52, 2, 8, 2) window.placeControl(Movies ,52, 4, 8, 2) window.placeControl(Music,52, 6, 8, 2) window.placeControl(News,61, 2, 8, 2) window.placeControl(Sport,61, 4, 8, 2) window.placeControl(Docs,61, 6, 8, 2) window.placeControl(Kids,70, 2, 8, 2) window.placeControl(Food,70, 4, 8, 2) window.placeControl(USA,70, 6, 8, 2) window.placeControl(Religion,79, 4, 8, 2) window.placeControl(List, 23, 12, 80, 18) window.placeControl(Icon, 61, 35, 20, 10) window.placeControl(Quit, 18, 6, 7, 2) #capture mouse moves or up down arrows window.connectEventList( [pyxbmct.ACTION_MOVE_DOWN, pyxbmct.ACTION_MOVE_UP, pyxbmct.ACTION_MOUSE_MOVE], LIST_UPDATE) #navigation Entertainment.controlRight(Movies) Entertainment.controlLeft(Quit) Entertainment.controlDown(List) Movies.controlRight(Music) Movies.controlLeft(Entertainment) Movies.controlDown(List) Music.controlRight(News) Music.controlLeft(Movies) Music.controlDown(List) News.controlRight(Sport) News.controlLeft(Music) News.controlDown(List) Sport.controlRight(Docs) Sport.controlLeft(News) Sport.controlDown(List) Docs.controlRight(Kids) Docs.controlLeft(Sport) Docs.controlDown(List) Kids.controlRight(Food) Kids.controlLeft(Docs) Kids.controlDown(List) Food.controlRight(USA) Food.controlLeft(Kids) Food.controlDown(List) USA.controlRight(Religion) USA.controlLeft(Food) USA.controlDown(List) Religion.controlRight(Quit) Religion.controlLeft(USA) Religion.controlDown(List) List.controlUp(Entertainment) List.controlLeft(Entertainment) List.controlRight(Quit) Quit.controlLeft(Religion) Quit.controlRight(Entertainment) Icon.setImage(icon) #button actions window.connect(Entertainment,ENT) window.connect(Movies,MOVIES) window.connect(Music,MUSIC) window.connect(News,NEWS) window.connect(Sport,SPORT) window.connect(Docs,DOCS) window.connect(Kids,KIDS) window.connect(Food,FOOD) window.connect(USA,USAMERICA) window.connect(Religion,RELIGION) window.connect(List, PlayStream) window.connect(Quit, window.close) secstore=selfAddon.getSetting('secstore') GetChannels(int(secstore)) if secstore=='1':window.setFocus(Entertainment) if secstore=='2':window.setFocus(Movies) if secstore=='3':window.setFocus(Music) if secstore=='4':window.setFocus(News) if secstore=='5':window.setFocus(Sport) if secstore=='6':window.setFocus(Docs) if secstore=='7':window.setFocus(Kids) if secstore=='8':window.setFocus(Food) if secstore=='9':window.setFocus(USA) if secstore=='10':window.setFocus(Religion)
def START(): global Entertainment global Movies global Music global News global Sport global Docs global Kids global Food global USA global Religion global List global Icon #create butttons if 'Red' in button_quit: text = '0xffffffff' elif 'Mono' in button_quit: text = '0xffffffff' else: text = '0xFF000000' Entertainment = pyxbmct.Button('Entertain', focusTexture=button_focus, noFocusTexture=button_no_focus, textColor=text, focusedColor=text) Movies = pyxbmct.Button('Movies', focusTexture=button_focus, noFocusTexture=button_no_focus, textColor=text, focusedColor=text) Music = pyxbmct.Button('Music', focusTexture=button_focus, noFocusTexture=button_no_focus, textColor=text, focusedColor=text) News = pyxbmct.Button('News', focusTexture=button_focus, noFocusTexture=button_no_focus, textColor=text, focusedColor=text) Sport = pyxbmct.Button('Sport', focusTexture=button_focus, noFocusTexture=button_no_focus, textColor=text, focusedColor=text) Docs = pyxbmct.Button('Documentary', focusTexture=button_focus, noFocusTexture=button_no_focus, textColor=text, focusedColor=text) Kids = pyxbmct.Button('Kids', focusTexture=button_focus, noFocusTexture=button_no_focus, textColor=text, focusedColor=text) Food = pyxbmct.Button('Food', focusTexture=button_focus, noFocusTexture=button_no_focus, textColor=text, focusedColor=text) USA = pyxbmct.Button('USA', focusTexture=button_focus, noFocusTexture=button_no_focus, textColor=text, focusedColor=text) Religion = pyxbmct.Button('Religion', focusTexture=button_focus, noFocusTexture=button_no_focus, textColor=text) List = pyxbmct.List(buttonFocusTexture=button_focus, buttonTexture=button_no_focus, _space=11, _itemTextYOffset=-7, textColor=text) Icon = pyxbmct.Image(icon, aspectRatio=2) Icon.setImage(icon) Quit = pyxbmct.Button(' ', noFocusTexture=button_quit, focusTexture=button_quit_focus) #place buttons window.placeControl(Entertainment, 20, 1, 8, 5) window.placeControl(Movies, 20, 6, 8, 5) window.placeControl(Music, 20, 11, 8, 5) window.placeControl(News, 20, 16, 8, 5) window.placeControl(Sport, 20, 21, 8, 5) window.placeControl(Docs, 20, 26, 8, 5) window.placeControl(Kids, 20, 31, 8, 5) window.placeControl(Food, 20, 36, 8, 5) window.placeControl(USA, 20, 41, 8, 5) window.placeControl(Religion, 20, 46, 8, 5) window.placeControl(List, 30, 1, 90, 30) window.placeControl(Icon, 45, 32, 60, 18) window.placeControl(Quit, 110, 48, 10, 3) #capture mouse moves or up down arrows window.connectEventList([ pyxbmct.ACTION_MOVE_DOWN, pyxbmct.ACTION_MOVE_UP, pyxbmct.ACTION_MOUSE_MOVE ], LIST_UPDATE) #navigation Entertainment.controlRight(Movies) Entertainment.controlLeft(Quit) Entertainment.controlDown(List) Movies.controlRight(Music) Movies.controlLeft(Entertainment) Movies.controlDown(List) Music.controlRight(News) Music.controlLeft(Movies) Music.controlDown(List) News.controlRight(Sport) News.controlLeft(Music) News.controlDown(List) Sport.controlRight(Docs) Sport.controlLeft(News) Sport.controlDown(List) Docs.controlRight(Kids) Docs.controlLeft(Sport) Docs.controlDown(List) Kids.controlRight(Food) Kids.controlLeft(Docs) Kids.controlDown(List) Food.controlRight(USA) Food.controlLeft(Kids) Food.controlDown(List) USA.controlRight(Religion) USA.controlLeft(Food) USA.controlDown(List) Religion.controlRight(Quit) Religion.controlLeft(USA) Religion.controlDown(List) List.controlUp(Entertainment) List.controlLeft(Entertainment) List.controlRight(Quit) Quit.controlLeft(Religion) Quit.controlRight(Entertainment) Icon.setImage(icon) #button actions window.connect(Entertainment, ENT) window.connect(Movies, MOVIES) window.connect(Music, MUSIC) window.connect(News, NEWS) window.connect(Sport, SPORT) window.connect(Docs, DOCS) window.connect(Kids, KIDS) window.connect(Food, FOOD) window.connect(USA, USAMERICA) window.connect(Religion, RELIGION) window.connect(List, PLAY_STREAM) window.connect(Quit, window.close) secstore = selfAddon.getSetting('secstore') GetChannels(int(secstore)) if secstore == '1': window.setFocus(Entertainment) if secstore == '2': window.setFocus(Movies) if secstore == '3': window.setFocus(Music) if secstore == '4': window.setFocus(News) if secstore == '5': window.setFocus(Sport) if secstore == '6': window.setFocus(Docs) if secstore == '7': window.setFocus(Kids) if secstore == '8': window.setFocus(Food) if secstore == '9': window.setFocus(Religion) if secstore == '10': window.setFocus(USA)
def set_active_controls(self): ##SET THE PYXBMCT BUTTONS THAT USERS INTERACT WITH self.UK = pyxbmct.TextBox(textColor='0xFF006400') ############## ############## GUIDE AND LISTS self.GUIDE = pyxbmct.Button('', focusTexture=Guide_img_selected, noFocusTexture=Guide_img) self.ONDEMAND = pyxbmct.Button('', focusTexture=od_img_selected, noFocusTexture=od_img) self.LIST = pyxbmct.List(buttonFocusTexture=List_Focused_default, buttonTexture=List_bg, _imageWidth=90, _imageHeight=90, _space=-1, _itemHeight=80, _itemTextXOffset=30, _itemTextYOffset=-2, textColor='0xFFFFFFFF') self.LEFTC = pyxbmct.List(buttonFocusTexture=List_Focused, buttonTexture=List_bg_catz, _space=-1, _itemHeight=80, _itemTextXOffset=5, _itemTextYOffset=-2, textColor='0xFFFFFFFF') self.EPG2 = pyxbmct.List(buttonFocusTexture=List_Focused_EPG, buttonTexture=List_bg, _space=-1, _itemHeight=80, _itemTextXOffset=10, _itemTextYOffset=-2, textColor='0xFFFFFFFF') #PLACE THE PYXBMCT BUTTONS THAT DISPLAY TEXT ON SCREEN USING X, Y, H, W self.placeControl(self.UK, -1, 0, 12, 53) ############ ############ GUIDE AND LISTS self.placeControl(self.ONDEMAND, -11, 19, 12, 9) self.placeControl(self.GUIDE, -11, 12, 12, 9) self.placeControl(self.EPG2, 21, 31, 90, 24) self.placeControl(self.LEFTC, 21, 0, 90, 12) self.placeControl(self.LIST, 21, 12, 90, 20) ##THERE IMAGES ARE PLACED HERE TO MAKE SURE THEY DISPLAY ABOVE OTHER ELIMENTS #Vert = pyxbmct.Image(Vert_Image) Hori = pyxbmct.Image(Hori_Image) Hori1 = pyxbmct.Image(Hori_Image) Hori2 = pyxbmct.Image(Hori_Image) Hori3 = pyxbmct.Image(Hori_Image) Hori4 = pyxbmct.Image(Hori_Image) Hori5 = pyxbmct.Image(Hori_Image) self.Arrow = pyxbmct.Image(Arrow_Image) self.Arrow1 = pyxbmct.Image(Arrow_Image) self.Arrow2 = pyxbmct.Image(Arrow_Image) #PLACE THE PYXBMCT IMAGES THAT DISPLAY TEXT ON SCREEN USING X, Y, H, W #self.placeControl(Vert, 21, 12, 90,5) self.placeControl(Hori, 100, 0, 5,60) self.placeControl(Hori1, 84, 0, 5,60) self.placeControl(Hori2, 69, 0, 5,60) self.placeControl(Hori3, 53, 0, 5,60) self.placeControl(Hori4, 37, 0, 5,60) self.placeControl(Hori5, 21, 0, 5,60) self.placeControl(self.Arrow, 13, 19, 10,4) self.placeControl(self.Arrow1, 13, 20, 10,4) self.placeControl(self.Arrow2, 13, 33, 10,4) #CALL FUNCTION TO GET LIVE CHANNEL LIST AND EPG INFORMATION #Get_Live(self, '') #SET THE BLUE ARROWS FOR NOW AND NEXT TO VISABLE = FALSE TO HIDE THEM ON START UP self.Arrow1.setVisible(False) self.Arrow2.setVisible(False) #SET UP THE CONTROL LISTENER FOR MOUSE AND BUTTON CLICKS TO UPDATE LISTS self.connectEventList( [pyxbmct.ACTION_MOVE_DOWN, pyxbmct.ACTION_MOVE_UP, pyxbmct.ACTION_MOUSE_WHEEL_DOWN, pyxbmct.ACTION_MOUSE_WHEEL_UP, pyxbmct.ACTION_MOUSE_MOVE], self.Multi_Update)