def __init__(self, title='[B]Game Update[/B]', sport='nba'): super(Scores, self).__init__(title) #Geometry(Width, Height, Rows, Columns) #New Addon Windows always have 1280x720 grid self.setGeometry(300, 155, 3, 5, pos_x=980, pos_y=565) main_bg = pyxbmct.Image(red) self.placeControl(main_bg, 0, 0, rowspan=3, columnspan=5, pad_x=-3, pad_y=-3) bottom_bg = pyxbmct.Image(blue) self.placeControl(bottom_bg, 2, 0, columnspan=3, pad_x=-3, pad_y=-3) if '.' in sport: self.logo = os.path.join( addon.getAddonInfo('path'), 'resources/soccer/%s.png' % sport.replace('.', '')) else: self.logo = os.path.join(addon.getAddonInfo('path'), 'resources/%s/logo.png' % sport) self.display_duration = int(addon.getSetting('Ntimeout')) * 1000 # Connect a key action (Backspace) to close the window. self.connect(pyxbmct.ACTION_NAV_BACK, self.close)
def __init__(self, msg): box = msg.find_parent('div', class_='a-box-inner a-padding-extra-large') if box is None: self.head = msg.find('title').get_text(strip=True) self.hint = msg.find('p', class_='a-last').get_text(strip=True) form = msg.find('form').find('div', class_='a-box-inner') self.task = form.h4.get_text(strip=True) self.img_url = pyxbmct.Image(form.find('img')['src'], aspectRatio=2) else: self.head = box.find('span', class_='a-size-large').get_text(strip=True) self.hint = box.find( 'span', class_='a-size-base a-color-secondary').get_text(strip=True) self.task = box.find('label', class_='a-form-label').get_text(strip=True) self.img_url = pyxbmct.Image(msg['src'], aspectRatio=2) super(_Challenge, self).__init__(self.head) self.setGeometry(500, 450, 8, 2) self.cap = '' self.tb_hint = pyxbmct.TextBox() self.fl_task = pyxbmct.FadeLabel(_alignment=pyxbmct.ALIGN_CENTER) self.ed_cap = pyxbmct.Edit('', _alignment=pyxbmct.ALIGN_LEFT | pyxbmct.ALIGN_CENTER_Y) self.btn_submit = pyxbmct.Button('OK') self.btn_cancel = pyxbmct.Button(getString(30123)) self.set_controls()
def setup(self, lineups_obj): team1name = pyxbmct.Label( '[B]%s\n%s[/B]' % (lineups_obj['Team1']['Name'], lineups_obj['Team1']['Record']), alignment=pyxbmct.ALIGN_CENTER) self.placeControl(team1name, 0, 0, columnspan=10, rowspan=3) team1logo = pyxbmct.Image(lineups_obj['Team1']['Logo'], aspectRatio=1) self.placeControl(team1logo, 0, 11, columnspan=2, rowspan=3) team1formation = pyxbmct.Label(lineups_obj['Team1']['Formation'][2:], alignment=pyxbmct.ALIGN_CENTER, textColor='0xFF000000') self.placeControl(team1formation, 3, 11, columnspan=2) versus = pyxbmct.Label('[B]VS[/B]', alignment=pyxbmct.ALIGN_CENTER) self.placeControl(versus, 0, 14, columnspan=2, rowspan=3) team2logo = pyxbmct.Image(lineups_obj['Team2']['Logo'], aspectRatio=1) self.placeControl(team2logo, 0, 17, columnspan=2, rowspan=3) team2name = pyxbmct.Label( '[B]%s\n%s[/B]' % (lineups_obj['Team2']['Name'], lineups_obj['Team2']['Record']), alignment=pyxbmct.ALIGN_CENTER) self.placeControl(team2name, 0, 19, columnspan=10, rowspan=3) team2formation = pyxbmct.Label(lineups_obj['Team2']['Formation'][2:], alignment=pyxbmct.ALIGN_CENTER, textColor='0xFF000000') self.placeControl(team2formation, 3, 17, columnspan=2) self.progress.update(33, ' It\'ll be worth it, I promise!') self.setFormation(lineups_obj['Team1']) self.progress.update(66, ' It\'ll be worth it, I promise!') self.setFormation(lineups_obj['Team2']) self.progress.update(100, 'Done') self.progress.close()
def set_controls(self): """Set up UI controls""" # Image control image = pyxbmct.Image(addonfolder + artsfolder + '/tnds82.png') self.placeControl(image, 0, 0, rowspan=8, columnspan=16) # Portugal self.portugal_button = pyxbmct.RadioButton('') self.placeControl(self.portugal_button, 9, 3, rowspan=2, columnspan=4) self.connect(self.portugal_button, self.portugal_button_update) if tools.return_data('TVHWIZARD', 'STRING', 'portugal', 2) == 1: self.portugal_button.setSelected(True) else: self.portugal_button.setSelected(False) portugal = pyxbmct.Image(addonfolder + artsfolder + '/portugal.png') self.placeControl(portugal, 9, 3, rowspan=2, columnspan=4) # Brasil self.brasil_button = pyxbmct.RadioButton('') self.placeControl(self.brasil_button, 9, 9, rowspan=2, columnspan=4) self.connect(self.brasil_button, self.brasil_button_update) if tools.return_data('TVHWIZARD', 'STRING', 'brasil', 2) == 1: self.brasil_button.setSelected(True) else: self.brasil_button.setSelected(False) brasil = pyxbmct.Image(addonfolder + artsfolder + '/brasil.png') self.placeControl(brasil, 9, 9, rowspan=2, columnspan=4) # Close button self.close_button = pyxbmct.Button('Exit') self.placeControl(self.close_button, 13, 15, rowspan=1, columnspan=1) self.connect(self.close_button, lambda: self.closepage())
def set_controls(self): """Set up UI controls""" # Image control image = pyxbmct.Image(addonfolder + artsfolder + '/tvh.png') self.placeControl(image, 0, 0, rowspan=9, columnspan=16) # Image control image = pyxbmct.Image(addonfolder + artsfolder + '/installaddons.png') self.placeControl(image, 8, 6, rowspan=4, columnspan=4) # Tvheadend button self.tvh_button = pyxbmct.Button('TVHEADEND') self.placeControl(self.tvh_button, 10, 11, rowspan=1, columnspan=3) self.connect( self.tvh_button, lambda: self.installaddons( 'service.tvheadend42', 'service.tvheadend43')) # Tvheadend HTSP Client button self.htsp_button = pyxbmct.Button('HTSP CLIENT') self.placeControl(self.htsp_button, 10, 2, rowspan=1, columnspan=3) self.connect(self.htsp_button, lambda: self.installaddon('pvr.hts')) # Start button self.start_button = pyxbmct.Button('START') self.placeControl(self.start_button, 12, 7, rowspan=1, columnspan=2) self.connect( self.start_button, lambda: self.page( 'service.tvheadend42', 'service.tvheadend43', 'pvr.hts')) # Close button self.close_button = pyxbmct.Button('Exit') self.placeControl(self.close_button, 13, 15, rowspan=1, columnspan=1) self.connect(self.close_button, lambda: self.closepage())
def set_controls(self): """Set up UI controls""" # Image control image = pyxbmct.Image(addonfolder + artsfolder + '/tvh.png') self.placeControl(image, 0, 0, rowspan=8, columnspan=16) # Label information image = pyxbmct.Image(addonfolder + artsfolder + '/recording.png') self.placeControl(image, 8, 1, rowspan=1, columnspan=14) # Browse information self.browse_label = pyxbmct.Edit('') self.placeControl(self.browse_label, 11, 2, rowspan=1, columnspan=6) if tools.return_data('RECORDS', 'ID', 1, 1) == '': self.browse_label.setText('') else: path = tools.return_data('RECORDS', 'ID', 1, 1) self.browse_label.setText(path) # Browse input self.browse_button = pyxbmct.Button('Browse') self.placeControl(self.browse_button, 11, 6, rowspan=1, columnspan=2) self.connect(self.browse_button, lambda: self.browse()) # Next button self.next_button = pyxbmct.Button('Next') self.placeControl(self.next_button, 13, 14, rowspan=1, columnspan=1) self.connect(self.next_button, lambda: self.page()) # Close button self.close_button = pyxbmct.Button('Exit') self.placeControl(self.close_button, 13, 15, rowspan=1, columnspan=1) self.connect(self.close_button, lambda: self.closepage())
def set_controls(self): """Set up UI controls""" # Image control image = pyxbmct.Image(addonfolder + artsfolder + '/tvh.png') self.placeControl(image, 0, 0, rowspan=8, columnspan=16) # Label information image = pyxbmct.Image(addonfolder + artsfolder + '/users.png') self.placeControl(image, 8, 1, rowspan=1, columnspan=14) # Username input image = pyxbmct.Image(addonfolder + artsfolder + '/username.png') self.placeControl(image, 10, 1, rowspan=1, columnspan=3) self.username_input = pyxbmct.Edit('') self.placeControl(self.username_input, 10, 4, rowspan=1, columnspan=4) # Password input image = pyxbmct.Image(addonfolder + artsfolder + '/password.png') self.placeControl(image, 11, 1, rowspan=1, columnspan=3) self.password_input = pyxbmct.Edit('', isPassword=True) self.placeControl(self.password_input, 11, 4, rowspan=1, columnspan=4) # Next button self.next_button = pyxbmct.Button('Next') self.placeControl(self.next_button, 13, 14, rowspan=1, columnspan=1) # Connect close button self.connect(self.next_button, lambda: self.page()) # Close button self.close_button = pyxbmct.Button('Exit') self.placeControl(self.close_button, 13, 15, rowspan=1, columnspan=1) self.connect(self.close_button, lambda: self.closepage())
def set_controls(self): """Set up UI controls""" image = pyxbmct.Image(addonfolder + artsfolder + '/dvb.png') self.placeControl(image, 0, 0, rowspan=8, columnspan=16) # DVB-C self.dvbc_button = pyxbmct.RadioButton('') self.placeControl(self.dvbc_button, 9, 3, rowspan=2, columnspan=4) self.connect(self.dvbc_button, self.dvbc_button_update) if tools.return_data('TVHWIZARD', 'STRING', 'wdvbc', 2) == 1: self.dvbc_button.setSelected(True) else: self.dvbc_button.setSelected(False) dvbc = pyxbmct.Image(addonfolder + artsfolder + '/dvbc.png') self.placeControl(dvbc, 9, 3, rowspan=2, columnspan=4) # DVB-S self.dvbs_button = pyxbmct.RadioButton('') self.placeControl(self.dvbs_button, 9, 10, rowspan=2, columnspan=4) self.connect(self.dvbs_button, self.dvbs_button_update) if tools.return_data('TVHWIZARD', 'STRING', 'wdvbs', 2) == 1: self.dvbs_button.setSelected(True) else: self.dvbs_button.setSelected(False) dvbs = pyxbmct.Image(addonfolder + artsfolder + '/dvbs2.png') self.placeControl(dvbs, 9, 10, rowspan=2, columnspan=4) # Close button self.close_button = pyxbmct.Button('Exit') self.placeControl(self.close_button, 13, 15, rowspan=1, columnspan=1) self.connect(self.close_button, lambda: self.closepage())
def set_controls(self): """Set up UI controls""" # Image control image = pyxbmct.Image(addonfolder + artsfolder + '/tvh.png') self.placeControl(image, 0, 0, rowspan=8, columnspan=16) # Wetek Button self.wetek_button = pyxbmct.RadioButton('') self.placeControl(self.wetek_button, 9, 3, rowspan=3, columnspan=3) self.connect(self.wetek_button, self.wetek_button_update) if tools.return_data('TVHWIZARD', 'STRING', 'wetek', 2) == 1: self.wetek_button.setSelected(True) else: self.wetek_button.setSelected(False) wetek = pyxbmct.Image(addonfolder + artsfolder + '/weteksmall.png') self.placeControl(wetek, 9, 3, rowspan=3, columnspan=3) # K Button self.k_button = pyxbmct.RadioButton('') self.placeControl(self.k_button, 9, 10, rowspan=3, columnspan=3) self.connect(self.k_button, self.k_button_update) if tools.return_data('TVHWIZARD', 'STRING', 'k', 2) == 1: self.k_button.setSelected(True) else: self.k_button.setSelected(False) k = pyxbmct.Image(addonfolder + artsfolder + '/ksmall.png') self.placeControl(k, 9, 10, rowspan=3, columnspan=3) # Close button self.close_button = pyxbmct.Button('Exit') self.placeControl(self.close_button, 13, 15, rowspan=1, columnspan=1) self.connect(self.close_button, lambda: self.closepage())
def set_controls(self): """Set up UI controls""" # Image control image = pyxbmct.Image(addonfolder + artsfolder + '/kbox.png') self.placeControl(image, 0, 0, rowspan=10, columnspan=16) # DVBC self.kdvbc_button = pyxbmct.RadioButton('') self.placeControl(self.kdvbc_button, 11, 3, rowspan=1, columnspan=3) self.connect(self.kdvbc_button, self.kdvbc_button_update) if tools.return_data('TVHWIZARD', 'STRING', 'kdvbc', 2) == 1: self.kdvbc_button.setSelected(True) else: self.kdvbc_button.setSelected(False) lnb1 = pyxbmct.Image(addonfolder + artsfolder + '/dvbc.png') self.placeControl(lnb1, 11, 3, rowspan=1, columnspan=3) # DVBS2 self.kdvbs_button = pyxbmct.RadioButton('') self.placeControl(self.kdvbs_button, 11, 10, rowspan=1, columnspan=3) self.connect(self.kdvbs_button, self.kdvbs_button_update) if tools.return_data('TVHWIZARD', 'STRING', 'kdvbs', 2) == 1: self.kdvbs_button.setSelected(True) else: self.kdvbs_button.setSelected(False) lnb2 = pyxbmct.Image(addonfolder + artsfolder + '/dvbs2.png') self.placeControl(lnb2, 11, 10, rowspan=1, columnspan=3) # Close button self.close_button = pyxbmct.Button('Exit') self.placeControl(self.close_button, 13, 15, rowspan=1, columnspan=1) self.connect(self.close_button, lambda: self.closepage())
def __init__(self, title=''): super(Scores, self).__init__(title) #Geometry(Width, Height, Rows, Columns) #New Addon Windows always have 1280x720 grid self.setGeometry(1280, 30, 3, 50, pos_x=1, pos_y=690) main_bg = pyxbmct.Image(blue) self.placeControl(main_bg, 0, 0, rowspan=4, columnspan=49, pad_x=-5, pad_y=-5) btn_bg = pyxbmct.Image(blue) self.placeControl(btn_bg, 0, 49, columnspan=2, rowspan=4, pad_x=-5, pad_y=-5) self.display_duration = int(addon.getSetting('Ttimeout')) * 1000 # Connect a key action (Backspace) to close the window. self.connect(pyxbmct.ACTION_NAV_BACK, self.close) self.close_button = pyxbmct.Button('X ')
def __init__(self, title='[B]NHL[/B]'): super(Score, self).__init__(title) #Geometry(Width, Height, Rows, Columns) #New Addon Windows always have 1280x720 grid self.setGeometry(450, 175, 4, 8) main_bg = pyxbmct.Image(red) self.placeControl(main_bg, 0, 0, rowspan=4, columnspan=8, pad_x=-3, pad_y=-3) bottom_bg = pyxbmct.Image(blue) self.placeControl(bottom_bg, 3, 0, columnspan=5, pad_x=-3, pad_y=-3) p1header = pyxbmct.Label('[B]1[/B]', alignment=pyxbmct.ALIGN_CENTER) self.placeControl(p1header, 0, 1) p2header = pyxbmct.Label('[B]2[/B]', alignment=pyxbmct.ALIGN_CENTER) self.placeControl(p2header, 0, 2) p3header = pyxbmct.Label('[B]3[/B]', alignment=pyxbmct.ALIGN_CENTER) self.placeControl(p3header, 0, 3) theader = pyxbmct.Label('[B]T[/B]', alignment=pyxbmct.ALIGN_CENTER) self.placeControl(theader, 0, 4) # Connect a key action (Backspace) to close the window. self.connect(pyxbmct.ACTION_NAV_BACK, self.close)
def set_active_controls(self): my_dynamic_functions = {} self.button = {} # List i = 0 j = 0 x = 0 for img in self.item: self.image = pyxbmct.Image(img) self.placeControl(self.image, i, j, rowspan=1, columnspan=1) self.button[x] = pyxbmct.Button('') my_dynamic_functions['button_' + str(x)] = self.function_builder(x) self.connect(self.button[x], my_dynamic_functions['button_' + str(x)]) self.placeControl(self.button[x], i, j) j += 1 if j > 4: j = 0 i += 1 #self.connect(self.image, self.close) x += 1 self.image = pyxbmct.Image( 'http://www.cling.co.il/wp-content/uploads/2016/06/%D7%A1%D7%92%D7%95%D7%A8.jpg' ) self.placeControl(self.image, i, j, rowspan=1, columnspan=1) self.button2 = pyxbmct.Button('') self.connect(self.button2, self.click_c) self.placeControl(self.button2, i, j)
def set_controls(self): """Set up UI controls""" # Image control image = pyxbmct.Image(addonfolder + artsfolder + '/k.png') self.placeControl(image, 0, 0, rowspan=8, columnspan=16) # KI Plus self.k1plus_button = pyxbmct.RadioButton('') self.placeControl(self.k1plus_button, 8, 1, rowspan=2, columnspan=4) self.connect(self.k1plus_button, self.k1plus_button_update) if tools.return_data('TVHWIZARD', 'STRING', 'k1plus', 2) == 1: self.k1plus_button.setSelected(True) else: self.k1plus_button.setSelected(False) k1plus = pyxbmct.Image(addonfolder + artsfolder + '/k1plus.png') self.placeControl(k1plus, 8, 1, rowspan=2, columnspan=4) # KI Pro self.k1pro_button = pyxbmct.RadioButton('') self.placeControl(self.k1pro_button, 11, 6, rowspan=2, columnspan=4) self.connect(self.k1pro_button, self.k1pro_button_update) if tools.return_data('TVHWIZARD', 'STRING', 'k1pro', 2) == 1: self.k1pro_button.setSelected(True) else: self.k1pro_button.setSelected(False) k1pro = pyxbmct.Image(addonfolder + artsfolder + '/k1pro.png') self.placeControl(k1pro, 11, 6, rowspan=2, columnspan=4) # KII Pro self.k2pro_button = pyxbmct.RadioButton('') self.placeControl(self.k2pro_button, 8, 6, rowspan=2, columnspan=4) self.connect(self.k2pro_button, self.k2pro_button_update) if tools.return_data('TVHWIZARD', 'STRING', 'k2pro', 2) == 1: self.k2pro_button.setSelected(True) else: self.k2pro_button.setSelected(False) k2pro = pyxbmct.Image(addonfolder + artsfolder + '/k2pro.png') self.placeControl(k2pro, 8, 6, rowspan=2, columnspan=4) # KIII Pro self.k3pro_button = pyxbmct.RadioButton('') self.placeControl(self.k3pro_button, 8, 11, rowspan=2, columnspan=4) self.connect(self.k3pro_button, self.k3pro_button_update) if tools.return_data('TVHWIZARD', 'STRING', 'k3pro', 2) == 1: self.k3pro_button.setSelected(True) else: self.k3pro_button.setSelected(False) k3pro = pyxbmct.Image(addonfolder + artsfolder + '/k3pro.png') self.placeControl(k3pro, 8, 11, rowspan=2, columnspan=4) # Close button self.close_button = pyxbmct.Button('Exit') self.placeControl(self.close_button, 13, 15, rowspan=1, columnspan=1) self.connect(self.close_button, lambda: self.closepage())
def setup(self, boxscore_obj): self.row_number = 3 + 4 # + 2 for the header & team total rows team1total = len(boxscore_obj['Team1']['Stats']['Hitting']['Players']) + 2 team1total += len(boxscore_obj['Team1']['Stats']['Hitting']['Extras'].keys()) # + 1 for the header row team1total += len(boxscore_obj['Team1']['Stats']['Fielding'].keys()) + 1 # + 2 for the header & team total rows team2total = len(boxscore_obj['Team2']['Stats']['Hitting']['Players']) + 2 team2total += len(boxscore_obj['Team2']['Stats']['Hitting']['Extras'].keys()) # + 1 for the header row team2total += len(boxscore_obj['Team2']['Stats']['Fielding'].keys()) + 1 if team1total > team2total: self.row_number += team1total else: self.row_number += team2total self.setGeometry(1280, 720, self.row_number, 24) #3 rows for top head-to-head banner #4 rows for team stats - team1, team1 percentages, team2, team2 percentages #Now add 1 row for each player on each team self.boxscore_obj = boxscore_obj hittingbtn = pyxbmct.Button('[B]Hitting[/B]', alignment=pyxbmct.ALIGN_CENTER) self.placeControl(hittingbtn, 0, 0, columnspan=3, rowspan=3) self.connect(hittingbtn, lambda: self.switch_stats('Hitting')) pitchingbtn = pyxbmct.Button('[B]Pitching[/B]', alignment=pyxbmct.ALIGN_CENTER) self.placeControl(pitchingbtn, 3, 0, columnspan=3, rowspan=3) self.connect(pitchingbtn, lambda: self.switch_stats('Pitching')) pitchingbtn.controlUp(hittingbtn) pitchingbtn.controlDown(hittingbtn) hittingbtn.controlUp(pitchingbtn) hittingbtn.controlDown(pitchingbtn) self.setFocus(hittingbtn) team1name = pyxbmct.Label('[B]%s\n%s[/B]' % (boxscore_obj['Team1']['Name'], boxscore_obj['Team1']['Record']), alignment=pyxbmct.ALIGN_CENTER) self.placeControl(team1name, 0, 3, columnspan=6, rowspan=6) team1logo = pyxbmct.Image(boxscore_obj['Team1']['Logo']) self.placeControl(team1logo, 0, 9, columnspan=2, rowspan=6) versus = pyxbmct.Label('[B]VS[/B]', alignment=pyxbmct.ALIGN_CENTER) self.placeControl(versus, 0, 11, columnspan=3, rowspan=6) team2logo = pyxbmct.Image(boxscore_obj['Team2']['Logo']) self.placeControl(team2logo, 0, 14, columnspan=2, rowspan=6) team2name = pyxbmct.Label('[B]%s\n%s[/B]' % (boxscore_obj['Team2']['Name'], boxscore_obj['Team2']['Record']), alignment=pyxbmct.ALIGN_CENTER) self.placeControl(team2name, 0, 16, columnspan=5, rowspan=6) self.init_stats()
def set_info_controls(self): self.image = pyxbmct.Image(self.bild) self.placeControl(self.image, 0, 0, columnspan=8, rowspan=4) if fehlen !="": self.textbox = pyxbmct.TextBox() self.placeControl(self.textbox, 4, 0, columnspan=8, rowspan=10) self.textbox.setText(self.text) self.textbox.autoScroll(5000, 1500, 2000) self.textbox2 = pyxbmct.TextBox() self.placeControl(self.textbox2, 14, 0, columnspan=8, rowspan=1) self.textbox2.setText("[COLOR FFFF5F00][B]Fehlende Folgen : [/B][/COLOR]"+self.fehlen) # R = 255|G = 95|B = 0 else: self.textbox = pyxbmct.TextBox() self.placeControl(self.textbox, 4, 0, columnspan=8, rowspan=11) self.textbox.setText(self.text) self.textbox.autoScroll(5000, 1500, 2000) self.textbox3 = pyxbmct.TextBox() self.placeControl(self.textbox3, 15, 0, columnspan=4, rowspan=1) self.textbox3.setText("[COLOR FFFFEB00][B]Zuletzt gesehen : [/B][/COLOR]"+self.lastplayd_title) # R = 255|G = 235|B = 0 self.textbox4 = pyxbmct.TextBox() self.placeControl(self.textbox4, 15, 5, columnspan=3 ,rowspan=1) self.textbox4.setText("[COLOR FF00F000][B]Vorhanden bis : [/B][/COLOR]"+self.lastepisode_name) # R = 0|G = 240|B = 0 self.connectEventList( [pyxbmct.ACTION_MOVE_UP, pyxbmct.ACTION_MOUSE_WHEEL_UP], self.hoch) self.connectEventList( [pyxbmct.ACTION_MOVE_DOWN, pyxbmct.ACTION_MOUSE_WHEEL_DOWN], self.runter) self.setFocus(self.textbox)
def set_controls(self): # Image object self.image = pyxbmct.Image( 'http://chart.apis.google.com/chart?cht=qr&chl={0}&chs=256'.format( quote(authorization_link())), aspectRatio=2) self.placeControl(self.image, 0, 0, 6) # Text box self.text_box = pyxbmct.TextBox() self.placeControl(self.text_box, 0, 1, 2) self.text_box.setText(control.lang(30064).format(get_ip())) self.text_box.autoScroll(1000, 1000, 1000) # Button capable of changing the local ip address self.address_button = pyxbmct.Button(control.lang(30056)) self.placeControl(self.address_button, 2, 1) self.connect(self.address_button, lambda: ip_address_set()) # Button capable of starting the server self.server_button = pyxbmct.Button(control.lang(30147)) self.placeControl(self.server_button, 3, 1) self.connect(self.server_button, lambda: reddit_server()) # Button displaying address for auth, and capable of opening it self.link_button = pyxbmct.Button(self.link) self.placeControl(self.link_button, 4, 1) self.connect(self.link_button, lambda: control.open_web_browser(self.link)) # Close button self.close_button = pyxbmct.Button(control.lang(30062)) self.placeControl(self.close_button, 5, 1) self.connect(self.close_button, self.close)
def set_controls(self): """ Set up UI controls """ # __ Movie title self.labelTitle = pyxbmct.Label(self.title, alignment=pyxbmct.ALIGN_CENTER) self.placeControl(self.labelTitle, 0, 0, 1, 2) # ___ Movie thumbnail self.thumnailImg = pyxbmct.Image(self.thumbnail, aspectRatio=2) self.placeControl(self.thumnailImg, 1, 0, 8, 2) # ___ OK button self.ok_button = pyxbmct.Button('OK') self.placeControl(self.ok_button, 9, 0) # Connect OK button self.connect(self.ok_button, self.closePopup) # ___ Search again button self.search_button = pyxbmct.Button( constant.__addon__.getLocalizedString(80021)) self.placeControl(self.search_button, 9, 1) # Connect Search again self.connect(self.search_button, self.searchAgain) # ___ Set initial focus. self.setFocus(self.ok_button)
def set_controls(self): image = pyxbmct.Image(control.fanart(), aspectRatio=2) self.placeControl(image, 0, 0, 5, 3) # Note self.description = pyxbmct.Label(control.lang(30328), alignment=2) self.placeControl(self.description, 5, 0, 2, 3) # Click to open label # self.external_label = pyxbmct.Label(control.lang(30131), alignment=pyxbmct.ALIGN_CENTER_Y | pyxbmct.ALIGN_CENTER_X) # self.placeControl(self.external_label, 6, 0, 1, 1) # Twitter button self.twitter_button = pyxbmct.Button('Twitter') self.placeControl(self.twitter_button, 6, 0) self.connect(self.twitter_button, lambda: control.open_web_browser(TWITTER)) # Website self.website_button = pyxbmct.Button(control.lang(30333)) self.placeControl(self.website_button, 6, 1) self.connect(self.website_button, lambda: control.open_web_browser(WEBSITE)) # Facebook button self.facebook_button = pyxbmct.Button('Facebook') self.placeControl(self.facebook_button, 6, 2) self.connect(self.facebook_button, lambda: control.open_web_browser(FACEBOOK)) # Close button self.close_button = pyxbmct.Button(control.lang(30329)) self.placeControl(self.close_button, 7, 1) self.connect(self.close_button, self.close) # Changelog button self.changelog_button = pyxbmct.Button(control.lang(30110)) self.placeControl(self.changelog_button, 7, 0) self.connect(self.changelog_button, lambda: changelog()) # Disclaimer button self.disclaimer_button = pyxbmct.Button(control.lang(30129)) self.placeControl(self.disclaimer_button, 7, 2) self.connect(self.disclaimer_button, lambda: disclaimer())
def __init__(self, title='', soup=None, email=None): super(Captcha, self).__init__(title) if 'ap_captcha_img_label' in unicode(soup): head = soup.find('div', attrs={'id': 'message_warning'}) if not head: head = soup.find('div', attrs={'id': 'message_error'}) title = soup.find('div', attrs={'id': 'ap_captcha_guess_alert'}) self.head = head.p.renderContents().strip() self.head = re.sub('(?i)<[^>]*>', '', self.head) self.picurl = soup.find('div', attrs={'id': 'ap_captcha_img'}).img.get('src') else: self.head = soup.find('span', attrs={'class': 'a-list-item'}).renderContents().strip() title = soup.find('div', attrs={'id': 'auth-guess-missing-alert'}).div.div self.picurl = soup.find('div', attrs={'id': 'auth-captcha-image-container'}).img.get('src') self.setGeometry(500, 550, 9, 2) self.email = email self.pwd = '' self.cap = '' self.title = title.renderContents().strip() self.image = pyxbmct.Image('', aspectRatio=2) self.tb_head = pyxbmct.TextBox() self.fl_title = pyxbmct.FadeLabel(_alignment=pyxbmct.ALIGN_CENTER) self.username = pyxbmct.Edit('', _alignment=pyxbmct.ALIGN_LEFT | pyxbmct.ALIGN_CENTER_Y) self.password = pyxbmct.Edit('', _alignment=pyxbmct.ALIGN_LEFT | pyxbmct.ALIGN_CENTER_Y) self.captcha = pyxbmct.Edit('', _alignment=pyxbmct.ALIGN_LEFT | pyxbmct.ALIGN_CENTER_Y) self.btn_submit = pyxbmct.Button(getString(30004).split('.')[0]) self.btn_cancel = pyxbmct.Button(getString(30223)) self.set_controls() self.set_navigation()
def set_info_controls(self): self.image = pyxbmct.Image(self.bild) self.placeControl(self.image, 0, 0, columnspan=8, rowspan=3) if not fehlen == "": x = 0 else: x = 1 self.textbox = pyxbmct.TextBox() self.placeControl(self.textbox, 3, 0, columnspan=8, rowspan=11 + x) self.textbox.setText(self.text) if not fehlen == "": self.textboxf = pyxbmct.TextBox() self.placeControl(self.textboxf, 14, 0, columnspan=8, rowspan=1) self.textboxf.setText("Fehlende Folgen : " + fehlen) self.textbox2 = pyxbmct.TextBox() self.placeControl(self.textbox2, 15, 0, columnspan=4, rowspan=1) self.textbox2.setText("Letze Gesehene : " + lastplayd_title) self.textbox3 = pyxbmct.TextBox() self.placeControl(self.textbox3, 15, 5, columnspan=3, rowspan=1) self.textbox3.setText("Vorhanden Bis : " + lastepisode_name) self.connectEventList( [pyxbmct.ACTION_MOVE_UP, pyxbmct.ACTION_MOUSE_WHEEL_UP], self.hoch) self.connectEventList( [pyxbmct.ACTION_MOVE_DOWN, pyxbmct.ACTION_MOUSE_WHEEL_DOWN], self.runter) self.setFocus(self.textbox)
def __init__(self, title='', soup=None, email=None): super(Captcha, self).__init__(title) head = soup.find('div', attrs={'id': 'message_warning'}) if not head: head = soup.find('div', attrs={'id': 'message_error'}) title = soup.find('div', attrs={'id': 'ap_captcha_guess_alert'}) url = soup.find('div', attrs={'id': 'ap_captcha_img'}).img.get('src') pic = xbmc.translatePath('special://temp/captcha%s.jpg' % randint(0, 99999999999999)).decode('utf-8') SaveFile(pic, getURL(url, retjson=False)) self.setGeometry(500, 550, 9, 2) self.email = email self.pwd = '' self.cap = '' self.head = head.p.renderContents().strip() self.head = re.sub('(?i)<[^>]*>', '', self.head) self.title = title.renderContents().strip() self.image = pyxbmct.Image(pic, aspectRatio=2) self.tb_head = pyxbmct.TextBox() self.fl_title = pyxbmct.FadeLabel(_alignment=pyxbmct.ALIGN_CENTER) self.username = pyxbmct.Edit('', _alignment=pyxbmct.ALIGN_LEFT | pyxbmct.ALIGN_CENTER_Y) self.password = pyxbmct.Edit('', _alignment=pyxbmct.ALIGN_LEFT | pyxbmct.ALIGN_CENTER_Y) self.captcha = pyxbmct.Edit('', _alignment=pyxbmct.ALIGN_LEFT | pyxbmct.ALIGN_CENTER_Y) self.btn_submit = pyxbmct.Button(getString(30008).split('.')[0]) self.btn_cancel = pyxbmct.Button(getString(30123)) self.set_controls() self.set_navigation() xbmcvfs.delete(pic)
def __init__(self, text, icon, icon_full_path=False, icon_pad_x=5, icon_pad_y=5, set_icon_colour_diffuse_on_set_enabled=True, *args, **kwargs): """:param text: text label for the button :param icon: either an icon filename or a :pyxbmct.Image: :param icon_full_path: if False icon filename is seen as a relative\ path from resources/media :param icon_pad_x: pixel gap between the right hand edge of the\ button and the icon :parm icon_pad_y: pixel gap between the top and bottom edges of the\ button and the icon """ # type: (str, Union[str, pyxbmct.Image], bool, int, int, bool, Any, Any) -> None super(ButtonWithIcon, self).__init__(1, 2, *args, **kwargs) self._set_icon_colour_diffuse_on_set_enabled = ( set_icon_colour_diffuse_on_set_enabled) if isinstance(icon, basestring): if not icon_full_path: icon = os.path.join(_addon_path, "resources", "media", icon) self._icon = pyxbmct.Image(icon, aspectRatio=2) else: self._icon = icon # type: pyxbmct.Image self._button = pyxbmct.Button(text) self._icon_pad_x = icon_pad_x self._icon_pad_y = icon_pad_y
def set_info_controls(self): # Demo for PyXBMCt UI controls. no_int_label = pyxbmct.Label('Information output', alignment=pyxbmct.ALIGN_CENTER) self.placeControl(no_int_label, 0, 0, 1, 2) # label_label = pyxbmct.Label('Label') self.placeControl(label_label, 1, 0) # Label self.label = pyxbmct.Label('Simple label') self.placeControl(self.label, 1, 1) # fadelabel_label = pyxbmct.Label('FadeLabel') self.placeControl(fadelabel_label, 2, 0) # FadeLabel self.fade_label = pyxbmct.FadeLabel() self.placeControl(self.fade_label, 2, 1) self.fade_label.addLabel('Very long string can be here.') # textbox_label = pyxbmct.Label('TextBox') self.placeControl(textbox_label, 3, 0) # TextBox self.textbox = pyxbmct.TextBox() self.placeControl(self.textbox, 3, 1, 2, 1) self.textbox.setText( 'It can display long text.\n' 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.') # Set auto-scrolling for long TexBox contents self.textbox.autoScroll(1000, 1000, 1000) # image_label = pyxbmct.Label('Image') self.placeControl(image_label, 5, 0) # Image self.image = pyxbmct.Image(os.path.join(_addon_path, 'bbb-splash.jpg')) self.placeControl(self.image, 5, 1, 2, 1)
def __init__(self): super(CacheDialog, self).__init__() self.setGeometry(650, 366, 20, 60) self.colors = themecontrol.ThemeColors() self.Background = pyxbmct.Image(themecontrol.bg_mdialog) self.placeControl(self.Background, 0, 0, rowspan=20, columnspan=60) self.TraktIcon = pyxbmct.Image(themecontrol.trakt_icon) self.placeControl(self.TraktIcon, 1, 1, rowspan=12, columnspan=20) self.traktCode = '' self.set_controls() self.set_navigation() self.connect(pyxbmct.ACTION_NAV_BACK, self.close)
def set_info_controls(self): Background = pyxbmct.Image(xbmc.translatePath(os.path.join('special://home/addons/script.xxxodus.artwork', 'resources/art/dialog/bg.jpg'))) self.placeControl(Background, 0, 0, 10, 30) self.textbox = pyxbmct.TextBox() self.placeControl(self.textbox, 0, 1, 9, 28) self.textbox.setText(msg_text) self.textbox.autoScroll(1000, 2000, 1000)
def set_controls(self): ''' Header Text Placement ''' self.header_text = '[B]Theme Selection[/B]' self.Header = pyxbmct.Label(self.header_text, alignment=pyxbmct.ALIGN_CENTER, textColor=self.colors.dh_color) self.placeControl(self.Header, 3, 0, rowspan=2, columnspan=60) ''' 58 characters per line ''' msg = 'Please select the artwork that you would like to use.\nThis is pulled from the selected Artwork Module. You can\nchange the Artwork Module used from the Tools\nMenu by selecting Artwork Module and typing the ID\nof the new module.' self.Description = pyxbmct.Label(msg) self.placeControl(self.Description, 6, 4, rowspan=12, columnspan=53) self.menu = pyxbmct.List(textColor=self.colors.mt_color) self.placeControl(self.menu, 24, 21, rowspan=30, columnspan=17) items = [] self.aModule_base = xbmcaddon.Addon( 'script.atreides.artwork').getSetting('artwork_module') self.aModule = os.path.join( xbmcaddon.Addon(self.aModule_base).getAddonInfo('path'), 'resources', 'media') for folder in glob.glob("%s/*" % (self.aModule)): folder = os.path.split(folder)[1].capitalize() items.append(folder) self.menu.addItems(items) self.connect(self.menu, self.menu_handler) self.Preview = pyxbmct.Image('%s/%s/tools.png' % (self.aModule, items[0])) self.placeControl(self.Preview, 24, 3, rowspan=17, columnspan=17) self.module_text = 'Current Module: %s' % (self.aModule_base) self.Module = pyxbmct.Label(self.module_text, alignment=pyxbmct.ALIGN_CENTER, textColor=self.colors.dh_color) self.placeControl(self.Module, 50, 0, rowspan=2, columnspan=60) self.OKButton = pyxbmct.Button('OK', textColor='0xFFFFFFFF', shadowColor='0xFF000000', focusedColor='0xFFbababa', focusTexture=themecontrol.btn_focus, noFocusTexture=themecontrol.btn_nofocus) self.placeControl(self.OKButton, 53, 35, rowspan=4, columnspan=10) self.connect(self.OKButton, self.save_theme) self.CancelButton = pyxbmct.Button( 'Cancel', textColor='0xFFFFFFFF', shadowColor='0xFF000000', focusedColor='0xFFbababa', focusTexture=themecontrol.btn_focus, noFocusTexture=themecontrol.btn_nofocus) self.placeControl(self.CancelButton, 53, 46, rowspan=4, columnspan=10) self.connect(self.CancelButton, self.close)
def set_controls(self): """Set up UI controls""" # Image tnds image = pyxbmct.Image(addonfolder+artsfolder+'/tnds82.png') self.placeControl(image, 0, 0, rowspan=7, columnspan=17) # Channel Manager self.cmanager_button = pyxbmct.Button('') self.placeControl(self.cmanager_button, 8, 2, rowspan=3, columnspan=3) self.connect(self.cmanager_button, self.cmanager_button_update) cmanager = pyxbmct.Image(addonfolder+artsfolder+'/cmanager.png') self.placeControl(cmanager, 8, 2, rowspan=3, columnspan=3) # Group Manager self.gmanager_button = pyxbmct.Button('') self.placeControl(self.gmanager_button, 12, 2, rowspan=3, columnspan=3) self.connect(self.gmanager_button, self.gmanager_button_update) gmanager = pyxbmct.Image(addonfolder+artsfolder+'/gmanager.png') self.placeControl(gmanager, 12, 2, rowspan=3, columnspan=3) # Fix Picons self.fixpicons_button = pyxbmct.Button('') self.placeControl(self.fixpicons_button, 8, 7, rowspan=3, columnspan=3) self.connect(self.fixpicons_button, self.fixpicons_button_update) fixpicons = pyxbmct.Image(addonfolder+artsfolder+'/fixpicons.png') self.placeControl(fixpicons, 8, 7, rowspan=3, columnspan=3) # Check update Channels self.upchannels_button = pyxbmct.Button('') self.placeControl(self.upchannels_button, 8, 12, rowspan=3, columnspan=3) self.connect(self.upchannels_button, self.upchannels_button_update) upchannels = pyxbmct.Image(addonfolder+artsfolder+'/upchannels.png') self.placeControl(upchannels, 8, 12, rowspan=3, columnspan=3) # Reset Config self.resetconfig_button = pyxbmct.Button('') self.placeControl(self.resetconfig_button, 12, 7, rowspan=3, columnspan=3) self.connect(self.resetconfig_button, self.resetconfig_button_update) resetconfig = pyxbmct.Image(addonfolder+artsfolder+'/resetconfig.png') self.placeControl(resetconfig, 12, 7, rowspan=3, columnspan=3) # Upload Channels self.uploadchannels_button = pyxbmct.Button('') self.placeControl(self.uploadchannels_button, 12, 12, rowspan=3, columnspan=3) self.connect(self.uploadchannels_button, self.uploadchannels_button_update) uploadchannels = pyxbmct.Image(addonfolder+artsfolder+'/uploadchannels.png') self.placeControl(uploadchannels, 12, 12, rowspan=3, columnspan=3) # Back button self.back_button = pyxbmct.Button('Back') self.placeControl(self.back_button, 16, 13, rowspan=1, columnspan=2) self.connect(self.back_button, lambda: self.back()) # Close button self.close_button = pyxbmct.Button('Exit') self.placeControl(self.close_button, 16, 15, rowspan=1, columnspan=2) # Connect close button self.connect(self.close_button, self.close)
def set_controls(self): """Set up UI controls""" # Image tnds image = pyxbmct.Image(addonfolder + artsfolder + '/tnds82.png') self.placeControl(image, 0, 0, rowspan=8, columnspan=16) # Image Welcome image = pyxbmct.Image(addonfolder + artsfolder + '/finish.png') self.placeControl(image, 8, 4, rowspan=2, columnspan=8) # Finish button self.start_button = pyxbmct.Button('FINISH') self.placeControl(self.start_button, 11, 7, rowspan=1, columnspan=2) self.connect(self.start_button, lambda: self.page()) # Close button self.close_button = pyxbmct.Button('Exit') self.placeControl(self.close_button, 13, 15, rowspan=1, columnspan=1) self.connect(self.close_button, lambda: self.closepage())
def set_info_controls(self): self.image = pyxbmct.Image(self.img) self.placeControl(self.image, 0, 0, 3, 2) self.textbox = pyxbmct.TextBox(font='Med') self.placeControl(self.textbox, 0, 2, 4, 2) self.textbox.setText(self.txt) # Set auto-scrolling for long TexBox contents self.textbox.autoScroll(3000, 3000, 3000)