def set_info_controls(self): self.textbox = pyxbmct.Label('',textColor='0xFFFFFFFF',font='font24',alignment=pyxbmct.ALIGN_CENTER) self.placeControl(self.textbox, 40, 28, 40, 15) self.Hello = pyxbmct.Label('', textColor='0xFFF44248', font='font60', alignment=pyxbmct.ALIGN_CENTER) self.DATE = pyxbmct.Label('',textColor='0xFFFFFF00', font='font18') self.placeControl(self.Hello, -4, 1, 1, 50) self.placeControl(self.DATE, -9, 41, 12, 15)
def set_controls(self): self.header_image = pyxbmct.Image(GOOGLE_SIGN_IN_BUTTON, aspectRatio=2) self.placeControl(self.header_image, 2, 18, rowspan=9, columnspan=37) # create instructions here so verification_url is updated self.instructions = pyxbmct.Label( self.context.i18n('Go to %s and enter the following code:') % bold(self.verification_url), font='font14', alignment=2 ) self.placeControl(self.instructions, 14, 2, columnspan=69) # create instructions here so user_code is updated self.user_code_label = pyxbmct.Label( self.user_code, font='font_MainMenu', alignment=2 ) self.placeControl(self.user_code_label, 21, 2, columnspan=69, rowspan=10) self.developed_with_youtube = pyxbmct.Image(DEVELOPED_WITH_YOUTUBE, aspectRatio=2) self.placeControl(self.developed_with_youtube, 28, 14, rowspan=16, columnspan=45) self.client_id = pyxbmct.Label( self.context.i18n('Client ID: %s') % bold(str(CREDENTIALS.ID)), font='font10', alignment=2 ) self.placeControl(self.client_id, 41, 2, columnspan=69)
def set_info_controls(self): #SET THE PYXBMCT LABLES THAT DISPLAY TEXT ON SCREEN self.TIME = pyxbmct.Label('',textColor='0xFF006400', font='font14') self.DATE = pyxbmct.Label('',textColor='0xFF006400') self.EPGNEXT = pyxbmct.Label('Now',textColor='0xFFFFFFFF') self.EPGLATER = pyxbmct.Label('Next',textColor='0xFFFFFFFF') self.DESCRIPTION = pyxbmct.TextBox(textColor='0xFF006400') #SIMPLE PLACE TO ENTER THE CHANNELS ICON FOR DISPLAYING IN THE FOOTER self.CHANNEL_LOGO_FOOTER = pyxbmct.Image('') self.tmdb_country = pyxbmct.Image('') self.Quality = pyxbmct.Image('') #PLACE THE PYXBMCT LABLES THAT DISPLAY TEXT ON SCREEN USING X, Y, H, W self.placeControl(self.DATE, 13, 1, 12, 15) self.placeControl(self.TIME, -9, 48, 12, 15) #self.placeControl(self.EPGNOW, 14, 7, 10,4) self.placeControl(self.EPGNEXT, 14, 19, 10,4) self.placeControl(self.EPGLATER, 14, 33, 10,4) self.placeControl(self.DESCRIPTION, 107, 13, 20,35) #PLACE THE PYXBMCT IMAGE THAT DISPLAYS THE CHANNELS LOGO IN FOOTER WITH X, Y, H, W self.placeControl(self.CHANNEL_LOGO_FOOTER, 102, 1, 29, 4) self.placeControl(self.tmdb_country, 107, 50, 5, 2) self.placeControl(self.Quality, 107, 48, 5, 2)
def set_controls(self): """Set up UI controls""" # Description Text self.description = pyxbmct.TextBox() self.placeControl(self.description, 2, 0, columnspan=4) # Username label self.name_label = pyxbmct.Label('[B]%s[/B]' % i18n('Username:'******'', aspectRatio=2) self.placeControl(self.thumb, 1, 15, rowspan=2, columnspan=2) # Email Label self.email_label = pyxbmct.Label('[B]%s[/B]' % i18n('Email:'), alignment=1) self.placeControl(self.email_label, 2, 3, columnspan=4) # Email fade label self.email_field = pyxbmct.FadeLabel() self.placeControl(self.email_field, 2, 7, columnspan=8) # plexpass Label self.plexpass_label = pyxbmct.Label('[B]%s[/B]' % i18n('Plex Pass:'******'[B]%s[/B]' % i18n('Joined:'), alignment=1) self.placeControl(self.membersince_label, 4, 3, columnspan=4) # Member since fade label self.membersince_field = pyxbmct.FadeLabel() self.placeControl(self.membersince_field, 4, 7, columnspan=8) # Cancel button self.cancel_button = pyxbmct.Button(i18n('Exit')) self.placeControl(self.cancel_button, 6, 4, columnspan=4, rowspan=2) # Cancel button closes window # Switch button self.switch_button = pyxbmct.Button(i18n('Switch User')) self.placeControl(self.switch_button, 6, 8, columnspan=5, rowspan=2) # Signout button self.signout_button = pyxbmct.Button(i18n('Sign Out')) self.placeControl(self.signout_button, 6, 13, columnspan=4, rowspan=2) # Submit button to get token self.connect(self.cancel_button, self.close) self.connect(self.switch_button, lambda: self.switch()) # pylint: disable=unnecessary-lambda self.connect(self.signout_button, lambda: self.signout()) # pylint: disable=unnecessary-lambda
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 set_controls(self): """Set up UI controls""" # Description Text self.description = pyxbmct.TextBox() self.placeControl(self.description, 2, 0, columnspan=4) # Username label self.name_label = pyxbmct.Label('Username:'******'', aspectRatio=2) self.placeControl(self.thumb, 1, 4) # Email Label self.email_label = pyxbmct.Label('Email:') self.placeControl(self.email_label, 2, 1) # Email text box self.email_field = pyxbmct.TextBox() self.placeControl(self.email_field, 2, 2, columnspan=2) # plexpass Label self.plexpass_label = pyxbmct.Label('Plexpass:'******'Joined:') self.placeControl(self.membersince_label, 4, 1) # Membersince text box self.membersince_field = pyxbmct.TextBox() self.placeControl(self.membersince_field, 4, 2, columnspan=2) # Cancel button self.cancel_button = pyxbmct.Button('Exit') self.placeControl(self.cancel_button, 5, 1) # Cancel button closes window # Switch button self.switch_button = pyxbmct.Button('Switch User') self.placeControl(self.switch_button, 5, 2, columnspan=2) # Signout button self.signout_button = pyxbmct.Button('Sign out') self.placeControl(self.signout_button, 5, 4) # Submit button to get token self.connect(self.cancel_button, self.close) self.connect(self.switch_button, lambda: self.switch()) self.connect(self.signout_button, lambda: self.signout())
def set_controls(self): self.placeControl(self.select_button, 12, 3, rowspan=50, columnspan=67) self.connect(self.select_button, self.selected) self.l_video_thumbnail = pyxbmct.Image( self.metadata.get('thumbnail', '')) self.placeControl(self.l_video_thumbnail, 12, 3, rowspan=50, columnspan=67) self.placeControl(self.spinner_image, 49, 57, rowspan=10, columnspan=10) self.l_video_title = pyxbmct.FadeLabel(font='font30_title', ) self.placeControl(self.l_video_title, 3, 3, columnspan=190) self.l_video_title.addLabel(self.metadata.get('title')) self.l_channel_name = pyxbmct.FadeLabel(font='font25_title', ) self.placeControl(self.l_channel_name, 12, 73, columnspan=95) self.l_channel_name.addLabel(self.metadata.get('channel_name')) self.l_premiered = pyxbmct.Label( self.metadata.get('premiered'), font='font20_title', alignment=3, ) self.placeControl(self.l_premiered, 12, 157, columnspan=27) self.l_video_statistics = pyxbmct.Label( '%s %s / %s %s / %s %s' % (int_to_shortform_string( self.metadata.get('like_count')), self.context.i18n('likes'), int_to_shortform_string(self.metadata.get('dislike_count')), self.context.i18n('dislikes'), int_to_shortform_string( self.metadata.get('view_count')), self.context.i18n('views')), font='font20_title', alignment=2, ) self.placeControl(self.l_video_statistics, 19, 73, columnspan=122) self.l_video_description = pyxbmct.TextBox(font='font10') self.l_video_description.setText(self.metadata.get('description')) self.placeControl(self.l_video_description, 26, 73, rowspan=35, columnspan=122) self.l_video_description.autoScroll(1000, 5500, 500)
def addLabel(self, label, column, columnspan=1, padX=0, alignment=None, bold=False): if bold: label = ts.bold(label) if alignment is not None: labelC = pyxbmct.Label(label, alignment=alignment) else: labelC = pyxbmct.Label(label) rowControl = self.addRowControl(labelC, column, columnspan, padX) return rowControl
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): # create instructions here so verification_url is updated self.intructions = pyxbmct.Label( self.context.i18n('Go to %s and enter the following code:') % bold(self.verification_url), font='font14', alignment=2 ) self.placeControl(self.intructions, 3, 2, columnspan=68) # create instructions here so user_code is updated self.user_code_label = pyxbmct.Label( self.user_code, font='font_MainMenu', alignment=2 ) self.placeControl(self.user_code_label, 12, 2, columnspan=68, rowspan=10)
def set_info_controls(self): self.placeControl( pyxbmct.Label('[B][COLOR gold]' + control.window.getProperty(property + '.name') + '[/COLOR][/B]', alignment=pyxbmct.ALIGN_CENTER), 0, 1, 1, 1) self.placeControl( pyxbmct.Label('Veličina datoteke', alignment=pyxbmct.ALIGN_CENTER), 1, 0) self.placeControl( pyxbmct.Label(control.window.getProperty(property + '.size'), alignment=pyxbmct.ALIGN_CENTER), 2, 0) self.placeControl( pyxbmct.Label('Preuzeto', alignment=pyxbmct.ALIGN_CENTER), 1, 1) self.placeControl( pyxbmct.Label(control.window.getProperty(property + '.percent'), alignment=pyxbmct.ALIGN_CENTER), 2, 1) self.placeControl( pyxbmct.Label('Brzina preuzimanja', alignment=pyxbmct.ALIGN_CENTER), 1, 2) self.placeControl( pyxbmct.Label(control.window.getProperty(property + '.speed'), alignment=pyxbmct.ALIGN_CENTER), 2, 2) self.placeControl( pyxbmct.Image(control.window.getProperty(property + '.image')), 3, 1, 6, 1)
def set_info_controls(self): self.placeControl( pyxbmct.Label('[B][COLOR gold]' + control.window.getProperty(property + '.name') + '[/COLOR][/B]', alignment=pyxbmct.ALIGN_CENTER), 0, 1, 1, 1) self.placeControl( pyxbmct.Label('Total File Size', alignment=pyxbmct.ALIGN_CENTER), 1, 0) self.placeControl( pyxbmct.Label(control.window.getProperty(property + '.size'), alignment=pyxbmct.ALIGN_CENTER), 2, 0) self.placeControl( pyxbmct.Label('Downloaded', alignment=pyxbmct.ALIGN_CENTER), 1, 1) self.placeControl( pyxbmct.Label(control.window.getProperty(property + '.percent'), alignment=pyxbmct.ALIGN_CENTER), 2, 1) self.placeControl( pyxbmct.Label('Download Speed', alignment=pyxbmct.ALIGN_CENTER), 1, 2) self.placeControl( pyxbmct.Label(control.window.getProperty(property + '.speed'), alignment=pyxbmct.ALIGN_CENTER), 2, 2) self.placeControl( pyxbmct.Image(control.window.getProperty(property + '.image')), 3, 1, 6, 1)
def set_info_controls(self): self.Hello = pyxbmct.Label('', textColor='0xFFF44248', font='font60', alignment=pyxbmct.ALIGN_CENTER) self.placeControl(self.Hello, -4, 1, 1, 50) self.textbox = pyxbmct.TextBox(textColor='0xFFFFFFFF') self.placeControl(self.textbox, 69, 31, 28, 13) self.Show_Logo = pyxbmct.Image('') self.placeControl(self.Show_Logo, 23, 40, 40, 8)
def set_info_controls(self, update): update_headline = 'Luna %s available' % update.update_version title_label = pyxbmct.Label(update_headline, alignment=pyxbmct.ALIGN_LEFT, font='XLarge', textColor=COLOR_HEADING) self.placeControl(title_label, 0, 0, 2, 3) changelog_label = pyxbmct.Label('Changelog', alignment=pyxbmct.ALIGN_LEFT, font='Med', textColor=COLOR_DETAILS) self.placeControl(changelog_label, 2, 0) self.changelog = pyxbmct.TextBox(font='Med') self.placeControl(self.changelog, 4, 0, 6, 6) self.changelog.setText(update.changelog) self.changelog.autoScroll(delay=5000, time=2000, repeat=10000)
def set_column(self, column=0, row_offset=0, header="", items=[]): if header is not "": typelabel = pyxbmct.Label(header, alignment=4) self.placeControl(typelabel, row_offset, column, rowspan=1, columnspan=1, pad_x=1, pad_y=1) #print items for i in range(0, len(items)): # btn = pyxbmct.Button(items[i], focusTexture="button-focus.png", noFocusTexture="button-nofocus.png") btn = pyxbmct.Button(items[i]) self.placeControl(btn, i + 1 + row_offset, column, rowspan=1, columnspan=1, pad_x=1, pad_y=1) self.column_items[column].append(btn)
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 set_info_controls(self): self.Hello = pyxbmct.Label('', textColor='0xFF00f72c', font='font60', alignment=pyxbmct.ALIGN_CENTER) self.placeControl(self.Hello, -4, 1, 1, 50) self.textbox = pyxbmct.TextBox(textColor='0xFFFFFFFF') self.placeControl(self.textbox, 76, 30, 28, 20) self.Show_Logo = pyxbmct.Image('') self.placeControl(self.Show_Logo, 7, 38, 40, 11)
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 set_info_controls(self, game): title_label = pyxbmct.Label(game.name, alignment=pyxbmct.ALIGN_LEFT, font='XLarge', textColor=COLOR_HEADING) self.placeControl(title_label, 0, 0, 2, 3) image_path = game.get_selected_poster() if image_path is None: image_path = '' self.image = pyxbmct.Image(image_path) self.placeControl(self.image, 2, 0, 6, 1) genre_label = pyxbmct.Label('Genre', alignment=pyxbmct.ALIGN_LEFT, font='Med', textColor=COLOR_DETAILS) self.placeControl(genre_label, 2, 2) self.genre = pyxbmct.FadeLabel(_alignment=pyxbmct.ALIGN_LEFT, font='Med') self.placeControl(self.genre, 2, 3, columnspan=3) self.genre.addLabel(game.get_genre_as_string()) year_label = pyxbmct.Label('Year', alignment=pyxbmct.ALIGN_LEFT, font='Med', textColor=COLOR_DETAILS) self.placeControl(year_label, 3, 2) self.year = pyxbmct.Label(game.year, alignment=pyxbmct.ALIGN_LEFT, font='Med') self.placeControl(self.year, 3, 3) self.plot = pyxbmct.TextBox() self.placeControl(self.plot, 4, 2, 6, 3) self.plot.setText(game.plot) self.plot.autoScroll(delay=5000, time=2000, repeat=10000)
def create_label(self, text, **kwargs): ''' Function create_label used to create a text label the label needs to be added to the window via self.add_label Parameters: text: string or unicode - text string. font: string - font used for label text. (e.g. 'font13') textColor: hexstring - color of enabled label's label. (e.g. '0xFFFFFFFF') disabledColor: hexstring - color of disabled label's label. (e.g. '0xFFFF3300') alignment: integer - alignment of label - *Note, see xbfont.h hasPath: bool - True=stores a path / False=no path. angle: integer - angle of control. (+ rotates CCW, - rotates CW) Example: label = self.create_label('The text is blah blah blah', font='font14') ''' return pyxbmct.Label(text, **kwargs)
def __init__(self, title=''): # You need to call base class' constructor. super(MyWindow, self).__init__(title) # Set the window width, height and the grid resolution: 2 rows, 3 columns. self.setGeometry(350, 150, 2, 3) # Create a text label. label = pyxbmct.Label('This is a PyXBMCt window.', alignment=pyxbmct.ALIGN_CENTER) # Place the label on the window grid. self.placeControl(label, 0, 0, columnspan=3) # Create a button. button = pyxbmct.Button('Close') # Place the button on the window grid. self.placeControl(button, 1, 1) # Set initial focus on the button. self.setFocus(button) # Connect the button to a function. self.connect(button, self.close) # Connect a key action to a function. self.connect(pyxbmct.ACTION_NAV_BACK, self.close)
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 set_sub_title(self, sub_title): # recipe sub title label = pyxbmct.Label(sub_title, alignment=pyxbmct.ALIGN_JUSTIFY) self.placeControl(label, 0, 0, columnspan=4)
def set_info_controls(self): self.Hello = pyxbmct.Label('', textColor='0xFFF44248', font='font60', alignment=pyxbmct.ALIGN_CENTER) self.placeControl(self.Hello, -4, 1, 1, 50)
def create_label(): return pyxbmct.Label('', alignment=pyxbmct.ALIGN_LEFT, font='Med', textColor=COLOR_DETAILS)
def set_controls(self): """Set up UI controls""" # Description Text self.description = pyxbmct.TextBox() self.placeControl(self.description, 1, 3, columnspan=15, rowspan=2) # success message self.success_message = pyxbmct.Label(i18n('Successfully signed in'), alignment=2) self.placeControl(self.success_message, 1, 3, columnspan=15, rowspan=2) # tick self.tick = pyxbmct.Image(MEDIA_PATH + 'tick.png', aspectRatio=2) self.placeControl(self.tick, 3, 9, columnspan=3, rowspan=3) # Username label self.name_label = pyxbmct.Label(i18n('Username:'******'') self.placeControl(self.name_field, 3, 7, columnspan=10) if CONFIG['kodi_version'] > 17: self.name_field.setType(xbmcgui.INPUT_TYPE_TEXT, i18n('Username:'******'Password:'******'kodi_version'] < 18: self.password_field = pyxbmct.Edit('', isPassword=True) else: self.password_field = pyxbmct.Edit('') self.placeControl(self.password_field, 4, 7, columnspan=10) if CONFIG['kodi_version'] > 17: # must be done after control is placed self.password_field.setType(xbmcgui.INPUT_TYPE_PASSWORD, i18n('Password:'******'Cancel')) self.placeControl(self.cancel_button, 6, 3, columnspan=5, rowspan=2) # Cancel button closes window self.connect(self.cancel_button, self.close) # Submit button self.submit_button = pyxbmct.Button(i18n('Submit')) self.placeControl(self.submit_button, 6, 8, columnspan=5, rowspan=2) # Submit button to get token # Manual button self.manual_button = pyxbmct.Button(i18n('Manual')) self.placeControl(self.manual_button, 6, 13, columnspan=5, rowspan=2) # PIN button self.pin_button = pyxbmct.Button(i18n('Use PIN')) self.placeControl(self.pin_button, 6, 13, columnspan=5, rowspan=2) # PIN button self.submit_pin_button = pyxbmct.Button(i18n('Done')) self.placeControl(self.submit_pin_button, 6, 8, columnspan=5, rowspan=2) # Submit button to get token self.connect(self.submit_button, lambda: self.submit()) # pylint: disable=unnecessary-lambda self.connect(self.manual_button, lambda: self.display_manual()) # pylint: disable=unnecessary-lambda self.connect(self.pin_button, lambda: self.display_pin()) # pylint: disable=unnecessary-lambda self.connect(self.submit_pin_button, lambda: self.submit_pin()) # pylint: disable=unnecessary-lambda # set up failure message self.error_cross = pyxbmct.Image(MEDIA_PATH + 'error.png', aspectRatio=2) self.placeControl(self.error_cross, 5, 6) self.error_message = pyxbmct.Label(i18n('Unable to sign in')) self.placeControl(self.error_message, 5, 7, columnspan=7, rowspan=1) self.error_cross.setVisible(False) self.error_message.setVisible(False) self.digit_one = pyxbmct.Image(MEDIA_PATH + '-.png', aspectRatio=2) self.digit_two = pyxbmct.Image(MEDIA_PATH + '-.png', aspectRatio=2) self.digit_three = pyxbmct.Image(MEDIA_PATH + '-.png', aspectRatio=2) self.digit_four = pyxbmct.Image(MEDIA_PATH + '-.png', aspectRatio=2) self.placeControl(self.digit_one, 3, 5, columnspan=2, rowspan=2) self.placeControl(self.digit_two, 3, 8, columnspan=2, rowspan=2) self.placeControl(self.digit_three, 3, 11, columnspan=2, rowspan=2) self.placeControl(self.digit_four, 3, 14, columnspan=2, rowspan=2)
def set_controls(self): """Set up UI controls""" # Description Text self.description = pyxbmct.TextBox() self.placeControl(self.description, 1, 1, columnspan=4) # Username label self.name_label = pyxbmct.Label('Username:'******'') self.placeControl(self.name_field, 2, 2, columnspan=2) # Password Label self.password_label = pyxbmct.Label('Password:'******'', isPassword=True) self.placeControl(self.password_field, 3, 2, columnspan=2) # Cancel button self.cancel_button = pyxbmct.Button('Cancel') self.placeControl(self.cancel_button, 5, 1) # Cancel button closes window self.connect(self.cancel_button, self.close) # Submit button self.submit_button = pyxbmct.Button('Submit') self.placeControl(self.submit_button, 5, 4) # Submit button to get token # Manual button self.manual_button = pyxbmct.Button('Manual') self.placeControl(self.manual_button, 5, 4) # PIN button self.pin_button = pyxbmct.Button('Use PIN') self.placeControl(self.pin_button, 5, 2, columnspan=2) # PIN button self.submit_pin_button = pyxbmct.Button('Done') self.placeControl(self.submit_pin_button, 5, 2, columnspan=2) # Submit button to get token self.connect(self.submit_button, lambda: self.submit()) self.connect(self.manual_button, lambda: self.display_manual()) self.connect(self.pin_button, lambda: self.display_pin()) self.connect(self.submit_pin_button, lambda: self.submit_pin()) # set up failure message self.error_cross = pyxbmct.Image("%s/resources/media/error.png" % GLOBAL_SETUP['__cwd__'], aspectRatio=2) self.placeControl(self.error_cross, 4, 2) self.error_message = pyxbmct.Label("Unable to Login") self.placeControl(self.error_message, 4, 3, columnspan=2, rowspan=2) self.error_cross.setVisible(False) self.error_message.setVisible(False) self.digit_one = pyxbmct.Image("%s/resources/media/-.png" % GLOBAL_SETUP['__cwd__'], aspectRatio=2) self.digit_two = pyxbmct.Image("%s/resources/media/-.png" % GLOBAL_SETUP['__cwd__'], aspectRatio=2) self.digit_three = pyxbmct.Image("%s/resources/media/-.png" % GLOBAL_SETUP['__cwd__'], aspectRatio=2) self.digit_four = pyxbmct.Image("%s/resources/media/-.png" % GLOBAL_SETUP['__cwd__'], aspectRatio=2) self.placeControl(self.digit_one, 3, 1) self.placeControl(self.digit_two, 3, 2) self.placeControl(self.digit_three, 3, 3) self.placeControl(self.digit_four, 3, 4)
def set_recipe_info(self, prep_time, cook_time, ing, diff, serv, star, source): # Prep time label self.label = pyxbmct.Label('Prep Time: ') self.placeControl(self.label, 0.7, 3) # self.label = pyxbmct.Label(prep_time, textColor='0xff808080') self.placeControl(self.label, 0.7, 3.4) # Cook time label self.label = pyxbmct.Label('Cook Time: ') self.placeControl(self.label, 1.1, 3) # self.label = pyxbmct.Label(cook_time, textColor='0xff808080') self.placeControl(self.label, 1.1, 3.4) # Ingred label self.label = pyxbmct.Label('Ingredients: ') self.placeControl(self.label, 1.5, 3) # self.label = pyxbmct.Label(ing, textColor='0xff808080') self.placeControl(self.label, 1.5, 3.4) # Diff label self.label = pyxbmct.Label('Difficulty: ') self.placeControl(self.label, 1.9, 3) # self.label = pyxbmct.Label(diff, textColor='0xff808080') self.placeControl(self.label, 1.9, 3.4) # Serve label self.label = pyxbmct.Label('Serves: ') self.placeControl(self.label, 2.3, 3) # self.label = pyxbmct.Label(serv, textColor='0xff808080') self.placeControl(self.label, 2.3, 3.4) # Star Rating label self.label = pyxbmct.Label('Stars: ') self.placeControl(self.label, 2.7, 3) # self.label = pyxbmct.Label(star, textColor='0xff808080') self.placeControl(self.label, 2.7, 3.4) # Source label self.label = pyxbmct.Label('Source: ') self.placeControl(self.label, 3.1, 3) # self.label = pyxbmct.Label(source, textColor='0xff808080') self.placeControl(self.label, 3.1, 3.4)