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 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 __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, 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 set_controls(self): recipient_label = pyxbmct.Label(_('recipient'), alignment=pyxbmct.ALIGN_RIGHT) self.placeControl(recipient_label, 0, 0) self._recipient_ctl = pyxbmct.Edit('recipient') self.placeControl(self._recipient_ctl, 0, 1) self._recipient_ctl.setText(self._recipient) subject_label = pyxbmct.Label(_('subject'), alignment=pyxbmct.ALIGN_RIGHT) self.placeControl(subject_label, 1, 0) self._subject_ctl = pyxbmct.Edit('subject') self.placeControl(self._subject_ctl, 1, 1) self._subject_ctl.setText(self._subject) body_label = pyxbmct.Label(_('body'), alignment=pyxbmct.ALIGN_RIGHT) self.placeControl(body_label, 2, 0) self._body_ctl = pyxbmct.Edit('body') self.placeControl(self._body_ctl, 2, 1) self._view_body_ctl = pyxbmct.TextBox('view_body') self.placeControl(self._view_body_ctl, 3, 0, 6, 2) self._ok_button = pyxbmct.Button(_('ok'), alignment=pyxbmct.ALIGN_CENTER) self.placeControl(self._ok_button, 9, 1) self._cancel_button = pyxbmct.Button(_('cancel'), alignment=pyxbmct.ALIGN_CENTER) self.placeControl(self._cancel_button, 9, 0)
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): # 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 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_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)
def set_info_controls(self): self.textbox0 = pyxbmct.TextBox() self.textbox1 = pyxbmct.TextBox() self.textbox2 = pyxbmct.TextBox() self.textbox3 = pyxbmct.TextBox() self.textbox4 = pyxbmct.TextBox() self.textbox5 = pyxbmct.TextBox() self.textbox6 = pyxbmct.TextBox() self.placeControl(self.textbox0, 0, 0) self.placeControl(self.textbox1, 0, 1) self.placeControl(self.textbox2, 0, 2) self.placeControl(self.textbox3, 0, 3) self.placeControl(self.textbox4, 0, 4) self.placeControl(self.textbox5, 0, 5) self.placeControl(self.textbox6, 0, 6) user = "" songs = "" series = "" folgen = "" movies = "" alben = "" ids = "" counter = 0 try: for zeile in self.text.split("\n"): debug("ZEILE" + zeile) elemente = zeile.split("##") user = user + elemente[0] + "\n" songs = songs + elemente[1] + "\n" series = series + elemente[2] + "\n" folgen = folgen + elemente[3] + "\n" try: movies = movies + elemente[4] + "\n" alben = alben + elemente[5] + "\n" except: pass if counter == 0: ids = ids + "Platz\n" else: ids = ids + str(counter) + "\n" counter = counter + 1 except: pass self.textbox0.setText(ids) self.textbox1.setText(user) self.textbox2.setText(songs) self.textbox3.setText(series) self.textbox4.setText(folgen) self.textbox5.setText(movies) self.textbox6.setText(alben) 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.textbox1)
def __init__(self, msg): super(_ProgressDialog, self).__init__('Amazon') self.sl_progress = pyxbmct.Slider(textureback=OSPJoin(g.PLUGIN_PATH, 'resources', 'art', 'transp.png')) self.btn_cancel = pyxbmct.Button(getString(30123)) self.tb_msg = pyxbmct.TextBox() self.iscanceled = False self.connect(self.btn_cancel, self.cancel) self.setGeometry(500, 400, 6, 3) self.placeControl(self.tb_msg, 0, 0, 4, 3) self.placeControl(self.sl_progress, 4, 0, 0, 3) self.placeControl(self.btn_cancel, 5, 1, 1, 1) self.tb_msg.setText(msg) self.sl_progress.setEnabled(False)
def set_controls(self): ''' Left Side Menu Top Section ''' self.Section1 = pyxbmct.Label('[B]Addon Information[/B]', alignment=pyxbmct.ALIGN_LEFT, textColor=self.colors.mh_color) self.placeControl(self.Section1, 3, 1, columnspan=17) self.menu = pyxbmct.List(textColor=self.colors.mt_color) self.placeControl(self.menu, 4, 1, rowspan=8, columnspan=17) self.menu.addItems(['News', 'Changes', 'Builds', 'Paypal']) ''' Left Side Menu Bottom Section, currently unused ''' self.Section2 = pyxbmct.Label('[B]Tips and Tricks[/B]', alignment=pyxbmct.ALIGN_LEFT, textColor=self.colors.mh_color) self.placeControl(self.Section2, 11, 1, rowspan=4, columnspan=17) self.menu2 = pyxbmct.List(textColor=self.colors.mt_color) self.placeControl(self.menu2, 12, 1, rowspan=12, columnspan=17) self.menu2.addItems(['Scraper Tips', 'Real Debrid', 'Torrents']) self.CloseButton = pyxbmct.Button( 'Close', textColor='0xFFFFFFFF', shadowColor='0xFF000000', focusedColor='0xFFbababa', focusTexture=themecontrol.btn_focus, noFocusTexture=themecontrol.btn_nofocus) self.placeControl(self.CloseButton, 17, 10, rowspan=2, columnspan=8) self.connect(self.CloseButton, self.close) ''' Right Side, to display stuff for the above menu items ''' self.newsheader = '[B]Latest News[/B]' self.Header = pyxbmct.Label(self.newsheader, alignment=pyxbmct.ALIGN_CENTER, textColor=self.colors.dh_color) self.placeControl(self.Header, 2, 20, rowspan=1, columnspan=40) self.Description = pyxbmct.TextBox(self.news) self.placeControl(self.Description, 3, 21, rowspan=16, columnspan=40) self.Description.setText(self.news) self.RDLink = pyxbmct.Label('Referral Debrid Link: ' + str(get_rd_link())) self.placeControl(self.RDLink, 17, 21, rowspan=2, columnspan=32) self.RDLink.setVisible(False) self.WatchButton = pyxbmct.Button( 'Watch', textColor='0xFFFFFFFF', shadowColor='0xFF000000', focusedColor='0xFFbababa', focusTexture=themecontrol.btn_focus, noFocusTexture=themecontrol.btn_nofocus) self.placeControl(self.WatchButton, 15, 36, rowspan=2, columnspan=8) self.WatchButton.setVisible(False) self.connect(self.WatchButton, self.watchVideo)
def set_controls(self): # Text box self.text_box = pyxbmct.TextBox() self.placeControl(self.text_box, 0, 0, 4, 5) self.text_box.setText(self.text) self.text_box.autoScroll(1000, 1000, 1000) # Allow self.allow_button = pyxbmct.Button(control.lang(30150)) self.placeControl(self.allow_button, 4, 1) self.connect(self.allow_button, lambda: self.authorize()) # Deny self.deny_button = pyxbmct.Button(control.lang(30151)) self.placeControl(self.deny_button, 4, 3) self.connect(self.deny_button, self.close)
def add_textboxes(self): self.help_textbox = pyxbmct.TextBox() self.placeControl(self.help_textbox, 3, 2, rowspan=6, columnspan=2) self.help_textbox.setText( """Replace the parts of the filename with the following strings: The name of the show: %n Season: %s Episode: %e Example: Regular.Show.S01.E01.mkv --> %n.S%s.E%e.mkv """) self.help_textbox.autoScroll(3000, 4000, 6000)
def set_info_controls(self): self.textbox = pyxbmct.TextBox() self.image = pyxbmct.Image(self.bild) if self.nur_bild == 0: self.placeControl(self.image, 0, 0, columnspan=2, rowspan=2) self.placeControl(self.textbox, 2, 0, columnspan=8, rowspan=6) else: self.placeControl(self.image, 0, 0, columnspan=8, rowspan=6) #self.placeControl(self.textbox, 6, 0,columnspan=8,rowspan=2) self.textbox.setText(self.text) 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, playlistFile, epgFile, iconsFolder, timezone): super(DialogEPG, self).__init__('IPTV') self.setGeometry(1150, 600, 3, 3) self.timezone = timezone self.channels = util.m3uChannels(playlistFile) self.epg = util.xmltvParse(epgFile, self.timezone) self.connect(pyxbmct.ACTION_NAV_BACK, self.close) self.connect(pyxbmct.ACTION_PREVIOUS_MENU, self.close) 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.handleEvent) ### Setup channels list ### self.listChannels = pyxbmct.List(_imageWidth=20, _imageHeight=20) self.placeControl(self.listChannels, 0, 0, rowspan=2, columnspan=1) for channel in self.channels: item = xbmcgui.ListItem(channel['name'], iconImage=iconsFolder + channel['tvg_logo']) self.listChannels.addItem(item) self.connect(self.listChannels, lambda: self.play()) ### Setup programs list ### self.listPrograms = pyxbmct.List() self.placeControl(self.listPrograms, 0, 1, rowspan=2, columnspan=2) ### Setup description textbox ### self.textboxDescription = pyxbmct.TextBox() self.placeControl(self.textboxDescription, 2, 0, rowspan=1, columnspan=3) self.textboxDescription.autoScroll(1000, 1000, 1000) ### Setup navigation ### self.listChannels.setNavigation(self.listPrograms, self.listPrograms, self.listPrograms, self.listPrograms) self.listPrograms.setNavigation(self.listChannels, self.listChannels, self.listChannels, self.listChannels) self.setFocus(self.listChannels) self.selectedChannel = None self.selectedProgram = None self.selectChannel()
def _set_controls(self): textbox = pyxbmct.TextBox() self.placeControl(textbox, 0, 0, 2, 5) textbox.setText( _('To authorize the addon open the link below[CR]' '[B]{confirm_url}[/B],[CR]' 'scan the QR-code or check your mailbox[CR]' '[B]{email}[/B]').format(confirm_url=self._confirm_url, email=self._email)) textbox.autoScroll(1000, 1000, 1000) qr_code = pyxbmct.Image(self._qrcode_path) self.placeControl(qr_code, 2, 1, 4, 3, pad_x=35) autoclose_label = pyxbmct.FadeLabel() self.placeControl(autoclose_label, 6, 0, columnspan=5) autoclose_label.addLabel( _('This window will close automatically after authorization.')) self._cancel_btn = pyxbmct.Button(_('Cancel')) self.placeControl(self._cancel_btn, 7, 2, pad_x=-10, pad_y=10) self.setFocus(self._cancel_btn)
def set_text(self, text): textbox = pyxbmct.TextBox() self.placeControl(textbox, 0, 5, rowspan=18, columnspan=5) textbox.setText(text) textbox.autoScroll(5000, 5000, 1000)
def init_stats(self): progress = xbmcgui.DialogProgressBG() progress.create("This might take a minute") team1pitchers = pyxbmct.Label('[B]Pitchers[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(team1pitchers) self.placeControl(team1pitchers, 6, 0, columnspan=2) ip1header = pyxbmct.Label('[B]IP[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(ip1header) self.placeControl(ip1header, 6, 2) ph1header = pyxbmct.Label('[B]H[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(ph1header) self.placeControl(ph1header, 6, 3) pr1header = pyxbmct.Label('[B]R[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pr1header) self.placeControl(pr1header, 6, 4) er1header = pyxbmct.Label('[B]ER[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(er1header) self.placeControl(er1header, 6, 5) pbb1header = pyxbmct.Label('[B]BB[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pbb1header) self.placeControl(pbb1header, 6, 6) pk1header = pyxbmct.Label('[B]K[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pk1header) self.placeControl(pk1header, 6, 7) hr1header = pyxbmct.Label('[B]HR[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(hr1header) self.placeControl(hr1header, 6, 8) pcst1header = pyxbmct.Label('[B]PC-ST[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pcst1header) self.placeControl(pcst1header, 6, 9, columnspan=2) era1header = pyxbmct.Label('[B]ERA[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(era1header) self.placeControl(era1header, 6, 11) nextline = 0 t1pitches = 0 t1strikes = 0 t1ks = 0 for p, player in enumerate( self.boxscore_obj['Team1']['Stats']['Pitching']['Players']): player1name = pyxbmct.Label('[B]%s[/B]' % player['Name'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player1name) self.placeControl(player1name, 7 + p, 0, columnspan=2) player1ip = pyxbmct.Label('[B]%s[/B]' % player['IP'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player1ip) self.placeControl(player1ip, 7 + p, 2) player1h = pyxbmct.Label('[B]%s[/B]' % player['H'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player1h) self.placeControl(player1h, 7 + p, 3) player1r = pyxbmct.Label('[B]%s[/B]' % player['R'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player1r) self.placeControl(player1r, 7 + p, 4) player1er = pyxbmct.Label('[B]%s[/B]' % player['ER'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player1er) self.placeControl(player1er, 7 + p, 5) player1bb = pyxbmct.Label('[B]%s[/B]' % player['BB'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player1bb) self.placeControl(player1bb, 7 + p, 6) player1k = pyxbmct.Label('[B]%s[/B]' % player['K'], alignment=pyxbmct.ALIGN_CENTER) t1ks += int(player['K']) self.pitching.append(player1k) self.placeControl(player1k, 7 + p, 7) player1hr = pyxbmct.Label('[B]%s[/B]' % player['HR'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player1hr) self.placeControl(player1hr, 7 + p, 8) player1pcst = pyxbmct.Label('[B]%s[/B]' % player['PC-ST'], alignment=pyxbmct.ALIGN_CENTER) t1pitches += int(player['PC-ST'].split('-')[0]) t1strikes += int(player['PC-ST'].split('-')[1]) self.pitching.append(player1pcst) self.placeControl(player1pcst, 7 + p, 9, columnspan=2) era = player['ERA'] if len(era) > 4: era = era[:-1] player1era = pyxbmct.Label('[B]%s[/B]' % era, alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player1era) self.placeControl(player1era, 7 + p, 11) nextline = 7 + p + 1 teamstats = self.boxscore_obj['Team1']['Stats']['Pitching'] pteam1lbl = pyxbmct.Label('[B]Team[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam1lbl) self.placeControl(pteam1lbl, nextline, 0, columnspan=2) #pteam1ip = pyxbmct.Label('[B]%s[/B]' % teamstats['IP'], alignment=pyxbmct.ALIGN_CENTER) #self.pitching.append(pteam1ip) #self.placeControl(pteam1ip, nextline, 2) pteam1h = pyxbmct.Label('[B]%s[/B]' % teamstats['H'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam1h) self.placeControl(pteam1h, nextline, 3) pteam1r = pyxbmct.Label('[B]%s[/B]' % teamstats['R'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam1r) self.placeControl(pteam1r, nextline, 4) pteam1er = pyxbmct.Label('[B]%s[/B]' % teamstats['ER'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam1er) self.placeControl(pteam1er, nextline, 5) pteam1bb = pyxbmct.Label('[B]%s[/B]' % teamstats['BB'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam1bb) self.placeControl(pteam1bb, nextline, 6) pteam1k = pyxbmct.Label('[B]%s[/B]' % str(t1ks), alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam1k) self.placeControl(pteam1k, nextline, 7) pteam1hr = pyxbmct.Label('[B]%s[/B]' % teamstats['HR'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam1hr) self.placeControl(pteam1hr, nextline, 8) pteam1pcst = pyxbmct.Label('[B]%s-%s[/B]' % (str(t1pitches), str(t1strikes)), alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam1pcst) self.placeControl(pteam1pcst, nextline, 9, columnspan=2) nextline += 2 result = '[B]Pitching[/B]\n' pitchingextras = self.boxscore_obj['Team1']['Stats']['Pitching'][ 'Extras'] for stat in list(pitchingextras.keys()): result += '[B]%s[/B]: \n %s\n' % ( stat, pitchingextras[stat].replace('; ', '\n ')) pextratextbox1 = pyxbmct.TextBox() whatsleft = self.row_number - nextline + 2 self.pitching.append(pextratextbox1) self.placeControl(pextratextbox1, nextline, 0, rowspan=whatsleft, columnspan=11) pextratextbox1.setText(result) pextratextbox1.autoScroll(3000, 2000, 2000) #Team 2 Pitching team2pitchers = pyxbmct.Label('[B]Pitchers[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(team2pitchers) self.placeControl(team2pitchers, 6, 12, columnspan=2) ip2header = pyxbmct.Label('[B]IP[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(ip2header) self.placeControl(ip2header, 6, 14) ph2header = pyxbmct.Label('[B]H[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(ph2header) self.placeControl(ph2header, 6, 15) pr2header = pyxbmct.Label('[B]R[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pr2header) self.placeControl(pr2header, 6, 16) er2header = pyxbmct.Label('[B]ER[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(er2header) self.placeControl(er2header, 6, 17) pbb2header = pyxbmct.Label('[B]BB[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pbb2header) self.placeControl(pbb2header, 6, 18) pk2header = pyxbmct.Label('[B]K[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pk2header) self.placeControl(pk2header, 6, 19) hr2header = pyxbmct.Label('[B]HR[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(hr2header) self.placeControl(hr2header, 6, 20) pcst2header = pyxbmct.Label('[B]PC-ST[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pcst2header) self.placeControl(pcst2header, 6, 21, columnspan=2) era2header = pyxbmct.Label('[B]ERA[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(era2header) self.placeControl(era2header, 6, 23) nextline = 0 t2pitches = 0 t2strikes = 0 t2ks = 0 for p, player in enumerate( self.boxscore_obj['Team2']['Stats']['Pitching']['Players']): player2name = pyxbmct.Label('[B]%s[/B]' % player['Name'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player2name) self.placeControl(player2name, 7 + p, 12, columnspan=2) player2ip = pyxbmct.Label('[B]%s[/B]' % player['IP'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player2ip) self.placeControl(player2ip, 7 + p, 14) player2h = pyxbmct.Label('[B]%s[/B]' % player['H'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player2h) self.placeControl(player2h, 7 + p, 15) player2r = pyxbmct.Label('[B]%s[/B]' % player['R'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player2r) self.placeControl(player2r, 7 + p, 16) player2er = pyxbmct.Label('[B]%s[/B]' % player['ER'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player2er) self.placeControl(player2er, 7 + p, 17) player2bb = pyxbmct.Label('[B]%s[/B]' % player['BB'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player2bb) self.placeControl(player2bb, 7 + p, 18) player2k = pyxbmct.Label('[B]%s[/B]' % player['K'], alignment=pyxbmct.ALIGN_CENTER) t2ks += int(player['K']) self.pitching.append(player2k) self.placeControl(player2k, 7 + p, 19) player2hr = pyxbmct.Label('[B]%s[/B]' % player['HR'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player2hr) self.placeControl(player2hr, 7 + p, 20) player2pcst = pyxbmct.Label('[B]%s[/B]' % player['PC-ST'], alignment=pyxbmct.ALIGN_CENTER) t2pitches += int(player['PC-ST'].split('-')[0]) t2strikes += int(player['PC-ST'].split('-')[1]) self.pitching.append(player2pcst) self.placeControl(player2pcst, 7 + p, 21, columnspan=2) era = player['ERA'] if len(era) > 4: era = era[:-1] player2era = pyxbmct.Label('[B]%s[/B]' % era, alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player2era) self.placeControl(player2era, 7 + p, 23) nextline = 7 + p + 1 teamstats = self.boxscore_obj['Team2']['Stats']['Pitching'] pteam2lbl = pyxbmct.Label('[B]Team[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam2lbl) self.placeControl(pteam2lbl, nextline, 12, columnspan=2) pteam2h = pyxbmct.Label('[B]%s[/B]' % teamstats['H'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam2h) self.placeControl(pteam2h, nextline, 15) pteam2r = pyxbmct.Label('[B]%s[/B]' % teamstats['R'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam2r) self.placeControl(pteam2r, nextline, 16) pteam2er = pyxbmct.Label('[B]%s[/B]' % teamstats['ER'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam2er) self.placeControl(pteam2er, nextline, 17) pteam2bb = pyxbmct.Label('[B]%s[/B]' % teamstats['BB'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam2bb) self.placeControl(pteam2bb, nextline, 18) pteam2k = pyxbmct.Label('[B]%s[/B]' % str(t2ks), alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam2k) self.placeControl(pteam2k, nextline, 19) pteam2hr = pyxbmct.Label('[B]%s[/B]' % teamstats['HR'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam2hr) self.placeControl(pteam2hr, nextline, 20) pteam2pcst = pyxbmct.Label('[B]%s-%s[/B]' % (str(t2pitches), str(t2strikes)), alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam2pcst) self.placeControl(pteam2pcst, nextline, 21, columnspan=2) nextline += 2 result = '[B]Pitching[/B]\n' pitchingextras = self.boxscore_obj['Team2']['Stats']['Pitching'][ 'Extras'] for stat in list(pitchingextras.keys()): result += '[B]%s[/B]: \n %s\n' % ( stat, pitchingextras[stat].replace('; ', '\n ')) pextratextbox2 = pyxbmct.TextBox() whatsleft = self.row_number - nextline + 2 self.pitching.append(pextratextbox2) self.placeControl(pextratextbox2, nextline, 12, rowspan=whatsleft, columnspan=11) pextratextbox2.setText(result) pextratextbox2.autoScroll(3000, 2000, 2000) #Now that we've covered up pitching stats #We can set up & show hitting stats progress.update(50, "Half-way there!") team1hitters = pyxbmct.Label('[B]Hitters[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team1hitters) self.placeControl(team1hitters, 6, 0, columnspan=3) ab1header = pyxbmct.Label('[B]AB[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(ab1header) self.placeControl(ab1header, 6, 3) r1header = pyxbmct.Label('[B]R[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(r1header) self.placeControl(r1header, 6, 4) h1header = pyxbmct.Label('[B]H[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(h1header) self.placeControl(h1header, 6, 5) rbi1header = pyxbmct.Label('[B]RBI[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(rbi1header) self.placeControl(rbi1header, 6, 6) bb1header = pyxbmct.Label('[B]BB[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(bb1header) self.placeControl(bb1header, 6, 7) k1header = pyxbmct.Label('[B]K[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(k1header) self.placeControl(k1header, 6, 8) avg1header = pyxbmct.Label('[B]AVG[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(avg1header) self.placeControl(avg1header, 6, 9) obp1header = pyxbmct.Label('[B]OBP[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(obp1header) self.placeControl(obp1header, 6, 10) slg1header = pyxbmct.Label('[B]SLG[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(slg1header) self.placeControl(slg1header, 6, 11) nextline = 0 for p, player in enumerate( self.boxscore_obj['Team1']['Stats']['Hitting']['Players']): player1name = pyxbmct.Label('[B]%s[/B]' % player['Name'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player1name) self.placeControl(player1name, 7 + p, 0, columnspan=3) player1ab = pyxbmct.Label('[B]%s[/B]' % player['AB'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player1ab) self.placeControl(player1ab, 7 + p, 3) player1r = pyxbmct.Label('[B]%s[/B]' % player['R'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player1r) self.placeControl(player1r, 7 + p, 4) player1h = pyxbmct.Label('[B]%s[/B]' % player['H'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player1h) self.placeControl(player1h, 7 + p, 5) player1rbi = pyxbmct.Label('[B]%s[/B]' % player['RBI'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player1rbi) self.placeControl(player1rbi, 7 + p, 6) player1bb = pyxbmct.Label('[B]%s[/B]' % player['BB'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player1bb) self.placeControl(player1bb, 7 + p, 7) player1k = pyxbmct.Label('[B]%s[/B]' % player['K'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player1k) self.placeControl(player1k, 7 + p, 8) player1avg = pyxbmct.Label('[B]%s[/B]' % player['AVG'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player1avg) self.placeControl(player1avg, 7 + p, 9) player1obp = pyxbmct.Label('[B]%s[/B]' % player['OBP'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player1obp) self.placeControl(player1obp, 7 + p, 10) slg = player['SLG'] if len(slg) > 4: slg = slg[:-1] player1slg = pyxbmct.Label('[B]%s[/B]' % slg, alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player1slg) self.placeControl(player1slg, 7 + p, 11) nextline = 7 + p + 1 teamstats = self.boxscore_obj['Team1']['Stats']['Hitting'] team1lbl = pyxbmct.Label('[B]Team[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team1lbl) self.placeControl(team1lbl, nextline, 0, columnspan=3) team1ab = pyxbmct.Label('[B]%s[/B]' % teamstats['AB'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team1ab) self.placeControl(team1ab, nextline, 3) team1r = pyxbmct.Label('[B]%s[/B]' % teamstats['R'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team1r) self.placeControl(team1r, nextline, 4) team1h = pyxbmct.Label('[B]%s[/B]' % teamstats['H'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team1h) self.placeControl(team1h, nextline, 5) team1rbi = pyxbmct.Label('[B]%s[/B]' % teamstats['RBI'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team1rbi) self.placeControl(team1rbi, nextline, 6) team1bb = pyxbmct.Label('[B]%s[/B]' % teamstats['BB'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team1bb) self.placeControl(team1bb, nextline, 7) team1k = pyxbmct.Label('[B]%s[/B]' % teamstats['K'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team1k) self.placeControl(team1k, nextline, 8) team1avg = pyxbmct.Label('[B]%s[/B]' % teamstats['AVG'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team1avg) self.placeControl(team1avg, nextline, 9) nextline += 2 result = '[B]Batting[/B]\n' battingextras = self.boxscore_obj['Team1']['Stats']['Hitting'][ 'Extras'] for stat in list(battingextras.keys()): result += '[B]%s[/B]: %s\n' % (stat, battingextras[stat]) result += '\n[B]Fielding[/B]\n' fieldingextras = self.boxscore_obj['Team1']['Stats']['Fielding'] for stat in list(fieldingextras.keys()): result += '[B]%s[/B]: %s\n' % (stat, fieldingextras[stat]) extratextbox1 = pyxbmct.TextBox() whatsleft = self.row_number - nextline + 2 self.hitting.append(extratextbox1) self.placeControl(extratextbox1, nextline, 0, rowspan=whatsleft, columnspan=11) extratextbox1.setText(result) extratextbox1.autoScroll(3000, 2000, 2000) #Start Team2 team2hitters = pyxbmct.Label('[B]Hitters[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team2hitters) self.placeControl(team2hitters, 6, 12, columnspan=3) ab2header = pyxbmct.Label('[B]AB[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(ab2header) self.placeControl(ab2header, 6, 15) r2header = pyxbmct.Label('[B]R[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(r2header) self.placeControl(r2header, 6, 16) h2header = pyxbmct.Label('[B]H[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(h2header) self.placeControl(h2header, 6, 17) rbi2header = pyxbmct.Label('[B]RBI[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(rbi2header) self.placeControl(rbi2header, 6, 18) bb2header = pyxbmct.Label('[B]BB[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(bb2header) self.placeControl(bb2header, 6, 19) k2header = pyxbmct.Label('[B]K[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(k2header) self.placeControl(k2header, 6, 20) avg2header = pyxbmct.Label('[B]AVG[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(avg2header) self.placeControl(avg2header, 6, 21) obp2header = pyxbmct.Label('[B]OBP[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(obp2header) self.placeControl(obp2header, 6, 22) slg2header = pyxbmct.Label('[B]SLG[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(slg2header) self.placeControl(slg2header, 6, 23) nextline = 0 for p, player in enumerate( self.boxscore_obj['Team2']['Stats']['Hitting']['Players']): player2name = pyxbmct.Label('[B]%s[/B]' % player['Name'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player2name) self.placeControl(player2name, 7 + p, 12, columnspan=3) player2ab = pyxbmct.Label('[B]%s[/B]' % player['AB'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player2ab) self.placeControl(player2ab, 7 + p, 15) player2r = pyxbmct.Label('[B]%s[/B]' % player['R'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player2r) self.placeControl(player2r, 7 + p, 16) player2h = pyxbmct.Label('[B]%s[/B]' % player['H'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player2h) self.placeControl(player2h, 7 + p, 17) player2rbi = pyxbmct.Label('[B]%s[/B]' % player['RBI'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player2rbi) self.placeControl(player2rbi, 7 + p, 18) player2bb = pyxbmct.Label('[B]%s[/B]' % player['BB'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player2bb) self.placeControl(player2bb, 7 + p, 19) player2k = pyxbmct.Label('[B]%s[/B]' % player['K'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player2k) self.placeControl(player2k, 7 + p, 20) player2avg = pyxbmct.Label('[B]%s[/B]' % player['AVG'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player2avg) self.placeControl(player2avg, 7 + p, 21) player2obp = pyxbmct.Label('[B]%s[/B]' % player['OBP'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player2obp) self.placeControl(player2obp, 7 + p, 22) slg = player['SLG'] if len(slg) > 4: slg = slg[:-1] player2slg = pyxbmct.Label('[B]%s[/B]' % slg, alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player2slg) self.placeControl(player2slg, 7 + p, 23) nextline = 7 + p + 1 teamstats = self.boxscore_obj['Team2']['Stats']['Hitting'] team2lbl = pyxbmct.Label('[B]Team[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team2lbl) self.placeControl(team2lbl, nextline, 12, columnspan=3) team2ab = pyxbmct.Label('[B]%s[/B]' % teamstats['AB'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team2ab) self.placeControl(team2ab, nextline, 15) team2r = pyxbmct.Label('[B]%s[/B]' % teamstats['R'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team2r) self.placeControl(team2r, nextline, 16) team2h = pyxbmct.Label('[B]%s[/B]' % teamstats['H'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team2h) self.placeControl(team2h, nextline, 17) team2rbi = pyxbmct.Label('[B]%s[/B]' % teamstats['RBI'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team2rbi) self.placeControl(team2rbi, nextline, 18) team2bb = pyxbmct.Label('[B]%s[/B]' % teamstats['BB'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team2bb) self.placeControl(team2bb, nextline, 19) team2k = pyxbmct.Label('[B]%s[/B]' % teamstats['K'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team2k) self.placeControl(team2k, nextline, 20) team2avg = pyxbmct.Label('[B]%s[/B]' % teamstats['AVG'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team2avg) self.placeControl(team2avg, nextline, 21) nextline += 2 result = '[B]Batting[/B]\n' battingextras = self.boxscore_obj['Team2']['Stats']['Hitting'][ 'Extras'] for stat in list(battingextras.keys()): result += '[B]%s[/B]: %s\n' % (stat, battingextras[stat]) result += '\n[B]Fielding[/B]\n' fieldingextras = self.boxscore_obj['Team2']['Stats']['Fielding'] for stat in list(fieldingextras.keys()): result += '[B]%s[/B]: %s\n' % (stat, fieldingextras[stat]) extratextbox2 = pyxbmct.TextBox() whatsleft = self.row_number - nextline + 2 self.hitting.append(extratextbox2) self.placeControl(extratextbox2, nextline, 12, rowspan=whatsleft, columnspan=11) extratextbox2.setText(result) extratextbox2.autoScroll(3000, 2000, 2000) progress.update(100, "Done") progress.close()
def set_info_controls(self): debug("set_info_controls start") self.ueberschrift = pyxbmct.Label(self.title, alignment=pyxbmct.ALIGN_CENTER) self.placeControl(self.ueberschrift, 0, 0, columnspan=10, rowspan=1) if not "<tbody>" in self.starttext: if self.image == "" and not self.trailer == "": self.image = "https://img.youtube.com/vi/" + self.trailer + "/hqdefault.jpg" self.image = pyxbmct.Image(self.image, aspectRatio=2) self.placeControl(self.image, 1, 1, columnspan=6, rowspan=6) self.beschreibung = pyxbmct.TextBox(font='font10') self.placeControl(self.beschreibung, 7, 0, columnspan=10, rowspan=14) self.beschreibung.setText(self.text) self.button = pyxbmct.Button('Trailer', font='font14') if not self.trailer == "": self.placeControl(self.button, 20, 0, columnspan=4, rowspan=2) self.connect(self.button, self.startv) self.raus = pyxbmct.Button('Exit', font='font14') self.placeControl(self.raus, 20, 6, columnspan=4, rowspan=2) self.connect(self.raus, self.close) self.setFocus(self.raus) else: self.image = pyxbmct.Image(self.image, aspectRatio=2) self.placeControl(self.image, 1, 4, columnspan=2, rowspan=2) self.beschreibung = pyxbmct.TextBox(font='font10') self.placeControl(self.beschreibung, 3, 0, columnspan=10, rowspan=7) self.beschreibung.setText(self.text) #self.sp1=pyxbmct.Label("16.-22.01.2017",font='font11') #self.placeControl(self.sp1, 9, 0,columnspan=3,rowspan=2) #self.sp2=pyxbmct.Label("Titel",font='font11') #self.placeControl(self.sp2, 9, 3,columnspan=3,rowspan=2) #self.sp3=pyxbmct.Label("Episode",font='font11') #self.placeControl(self.sp3, 9, 6,columnspan=3,rowspan=2) kurz_inhalt = self.starttext[self.starttext.find('<tbody>') + 1:] kurz_inhalt = kurz_inhalt[:kurz_inhalt.find('</tbody>')] kurz_inhalt = kurz_inhalt.replace("\n", "") starty = 9 startx = 0 counter = 0 counter2 = 0 spl = kurz_inhalt.split('</tr>') for i in range(0, len(spl), 1): entry = spl[i] entry = entry.replace("<br />", "###") match = re.compile('>(.+?)</td>', re.DOTALL).findall(entry) for feld in match: feld = ersetze(feld) kuerzen = re.compile('<(.+?)>', re.DOTALL).findall(feld) for kurz in kuerzen: feld = feld.replace("<" + kurz + ">", "") if len(feld) > 20: gr = 5 else: gr = 0 if "###" in feld: sp2 = feld.split('###') for i2 in range(0, len(sp2), 1): entry2 = sp2[i2] self.sp1 = pyxbmct.Label(entry2, font='font10') self.placeControl(self.sp1, starty, startx, columnspan=2 + gr, rowspan=2) starty = starty + 1 counter = counter + 1 starty = starty - counter if counter2 < counter: counter2 = counter - 1 counter = 0 startx = startx + 2 + gr else: self.sp1 = pyxbmct.Label(feld, font='font10') self.placeControl(self.sp1, starty, startx, columnspan=2 + gr, rowspan=2) startx = startx + 2 + gr starty = starty + 1 + counter2 counter2 = 0 startx = 0 #self.z1=pyxbmct.Label("AAAA") #self.placeControl(self.z1, 10, 0,columnspan=3,rowspan=2) #self.z1=pyxbmct.Label("BBBB") #self.placeControl(self.z1, 10, 3,columnspan=3,rowspan=2) #self.z1=pyxbmct.Label("CCCC") #self.placeControl(self.z1, 10, 6,columnspan=3,rowspan=2) self.connectEventList([ pyxbmct.ACTION_MOVE_LEFT, pyxbmct.ACTION_MOVE_RIGHT, pyxbmct.ACTION_MOUSE_DRAG, pyxbmct.ACTION_MOUSE_LEFT_CLICK ], self.leftright) 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)
def set_controls(self): self.text_box = pyxbmct.TextBox() self.placeControl(self.text_box, 0, 0) self.text_box.setText(self.text) self.text_box.autoScroll(5000, 1000, 1000)
def set_info_controls(self): debug("set_info_controls start") self.ueberschrift=pyxbmct.Label(self.ueberschrift,alignment=pyxbmct.ALIGN_CENTER) self.placeControl(self.ueberschrift, 0, 0,columnspan=10,rowspan=1) if not "<tbody>" in self.starttext: if self.image=="" and self.trailer !="" : self.image="https://img.youtube.com/vi/"+self.trailer+"/hqdefault.jpg" self.image = pyxbmct.Image(self.image,aspectRatio=4) self.placeControl(self.image, 1, 3,columnspan=4,rowspan=6) self.beschreibung=pyxbmct.TextBox() self.placeControl(self.beschreibung, 7, 0,columnspan=10,rowspan=15) self.beschreibung.setText(self.text) self.beschreibung.autoScroll(3000, 2000, 3000) if self.trailer !="": self.info_button = pyxbmct.Button('[B]Trailer[/B]', font='font14') self.placeControl(self.info_button, 22, 0,columnspan=3,rowspan=2) self.connect(self.info_button, self.startv) self.close_button = pyxbmct.Button('[B]Close[/B]', font='font14') self.placeControl(self.close_button, 22, 7,columnspan=3,rowspan=2) self.connect(self.close_button, self.close) self.setFocus(self.close_button) else: #self.image = pyxbmct.Image(self.image,aspectRatio=4) #self.placeControl(self.image, 1, 3,columnspan=4,rowspan=4) self.beschreibung = pyxbmct.FadeLabel() self.placeControl(self.beschreibung, 1, 0,columnspan=10,rowspan=1) self.beschreibung.addLabel(self.text) kurz_inhalt = self.starttext[self.starttext.find('<tbody>')+1:] kurz_inhalt = kurz_inhalt[:kurz_inhalt.find('</tbody>')] kurz_inhalt=kurz_inhalt.replace("\n","") starty=2 startx=0 counter=0 counter2=0 spl=kurz_inhalt.split('</tr>') for i in range(0,len(spl),1): entry=spl[i] entry=entry.replace("<br />","###") match=re.compile('>(.+?)</td>', re.DOTALL).findall(entry) for feld in match: feld=ersetze(feld) feld = re.sub(r'\<.*?\>', '', feld) if len(feld)>20: gr=5 else: gr=0 if "###" in feld: sp2=feld.split('###') for i2 in range(0,len(sp2),1): entry2=sp2[i2] self.sp1=pyxbmct.Label(entry2) self.placeControl(self.sp1, starty, startx,columnspan=2+gr,rowspan=2) starty=starty+1 counter=counter+1 starty=starty-counter if counter2<counter: counter2=counter-1 counter=0 startx=startx+2+gr else: self.sp1=pyxbmct.Label(feld) self.placeControl(self.sp1, starty, startx,columnspan=2+gr,rowspan=2) startx=startx+2+gr starty=starty+1+counter2 counter2=0 startx=0 self.close_button = pyxbmct.Button('[B]Close[/B]', font='font14') self.placeControl(self.close_button, 22, 7,columnspan=3,rowspan=2) self.connect(self.close_button, self.close) self.setFocus(self.close_button) self.connectEventList([pyxbmct.ACTION_MOVE_LEFT, pyxbmct.ACTION_MOVE_RIGHT, pyxbmct.ACTION_MOUSE_DRAG, pyxbmct.ACTION_MOUSE_LEFT_CLICK], self.leftright)
def __init__(self, title): super(MainWindow, self).__init__(title) self.setGeometry( WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_ROWS, WINDOW_COLUMNS ) self.history = "" self.history_box = pyxbmct.TextBox() self.placeControl( self.history_box, row=0, column=0, rowspan=WINDOW_ROWS-COMMAND_HEIGHT, columnspan=WINDOW_COLUMNS-ARROW_WIDTH ) self.history_shift = 0 self.scroll_up_button = pyxbmct.Button( label="", focusTexture=image("up_blue.png"), noFocusTexture=image("up_white.png") ) self.fake_button = pyxbmct.Button( label="", focusTexture="", noFocusTexture="" ) self.placeControl( self.fake_button, row=0, column=0, rowspan=WINDOW_ROWS, columnspan=WINDOW_COLUMNS ) self.placeControl( self.scroll_up_button, row=0, column=WINDOW_COLUMNS-ARROW_WIDTH, rowspan=1, columnspan=ARROW_WIDTH ) self.connect(self.scroll_up_button, self.scroll_up) self.scroll_down_button = pyxbmct.Button( label="", focusTexture=image("down_blue.png"), noFocusTexture=image("down_white.png") ) self.placeControl( self.scroll_down_button, row = WINDOW_ROWS-COMMAND_HEIGHT-1, column=WINDOW_COLUMNS-ARROW_WIDTH, rowspan=1, columnspan=ARROW_WIDTH ) self.connect(self.scroll_down_button, self.scroll_down) self.prompt = pyxbmct.Label(">>>") self.placeControl( self.prompt, row=WINDOW_ROWS-COMMAND_HEIGHT, column=0, rowspan=COMMAND_HEIGHT, columnspan=PROMPT_WIDTH ) self.command = pyxbmct.Edit("") self.placeControl( self.command, row=WINDOW_ROWS-COMMAND_HEIGHT, column=PROMPT_WIDTH, rowspan=COMMAND_HEIGHT, columnspan=WINDOW_COLUMNS-PROMPT_WIDTH-BUTTON_WIDTH ) self.command_history = CommandHistory() self.run_button = pyxbmct.Button("Run") self.placeControl( self.run_button, row=WINDOW_ROWS-COMMAND_HEIGHT, column=WINDOW_COLUMNS-BUTTON_WIDTH, rowspan=COMMAND_HEIGHT, columnspan=BUTTON_WIDTH ) self.connect(self.run_button, self.run_command) self.setFocus(self.command) self.globals = {}