def set_info_controls(self): self.POSTER = pyxbmct.Image('') self.DESCRIPTION = pyxbmct.TextBox() self.SEARCH = pyxbmct.Edit('Search...', textColor='#000000', focusTexture=search_bg, noFocusTexture=search_bg, isPassword=False) self.placeControl(self.POSTER, 23, 38, 69, 10) self.placeControl(self.DESCRIPTION, 97, 35, 30, 17) self.placeControl(self.SEARCH, 11, 19, 9, 10)
def addInputEdit(self, label, column, current, default, saveCallback, columnspan=1, padX=0): editB = pyxbmct.Edit('') def init(): editB.setText(current) def onDefault(): editB.setText(default) def onSave(): value = editB.getText() if value != current: saveCallback(value) self.addRowControl(editB, column, columnspan, padX, onDefault=onDefault, onSave=onSave, init=init)
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 create_input(self, name, **kwargs): self.__put_object(name, pyxbmct.Edit('', **kwargs)) self.__get_object(name)._type = 'input'