Python xbmcgui.INPUT_ALPHANUM Examples

The following are 23 code examples of xbmcgui.INPUT_ALPHANUM(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module xbmcgui , or try the search function .
Example #1
Source File: Dialogs.py    From plugin.video.netflix with MIT License 6 votes vote down vote up
def show_add_library_title_dialog(self, original_title):
        """
        Asks the user for an alternative title for the show/movie that
        gets exported to the local library

        :param original_title: Original title of the show
        :type original_title: str

        :returns: str - Title to persist
        """
        if self.custom_export_name == 'true':
            return original_title
        dlg = xbmcgui.Dialog()
        custom_title = dlg.input(
            heading=self.get_local_string(string_id=30031),
            defaultt=original_title,
            type=xbmcgui.INPUT_ALPHANUM) or original_title
        return original_title or custom_title 
Example #2
Source File: dialogcontextmenu.py    From romcollectionbrowser with GNU General Public License v2.0 6 votes vote down vote up
def edit_game_command(self):
        log.info("edit_game_command")
        if self.selectedGame == None:
            #32014 = Can't load selected Game
            #32015 = Edit Game Command Error
            message = "%s[CR]%s" % (util.localize(32015), util.localize(32014))
            xbmcgui.Dialog().ok(util.SCRIPTNAME, message)
            return

        origCommand = self.selectedGame.getProperty('gameCmd')
        command = xbmcgui.Dialog().input(util.localize(32135), defaultt=origCommand, type=xbmcgui.INPUT_ALPHANUM)

        if command != origCommand:
            log.info("Updating game '{0}' with command '{1}'".format(self.selectedGame.getLabel(), command))
            Game(self.gui.gdb).update(('gameCmd',), (command,), self.selectedGame.getProperty('gameId'), True)
            self.gui.gdb.commit() 
Example #3
Source File: skinsettings.py    From script.skin.helper.service with GNU General Public License v2.0 6 votes vote down vote up
def set_skinshortcuts_property(self, setting="", window_header="", property_name=""):
        '''allows the user to make a setting for skinshortcuts using the special skinsettings dialogs'''
        cur_value = xbmc.getInfoLabel(
            "$INFO[Container(211).ListItem.Property(%s)]" %
            property_name).decode("utf-8")
        cur_value_label = xbmc.getInfoLabel(
            "$INFO[Container(211).ListItem.Property(%s.name)]" %
            property_name).decode("utf-8")
        if setting == "||IMAGE||":
            # select image
            label, value = self.select_image(setting, allow_multi=True, windowheader=windowheader)
        if setting:
            # use skin settings select dialog
            value, label = self.set_skin_setting(
                setting, window_header=window_header, sublevel="", cur_value_label=cur_value_label,
                skip_skin_string=True, cur_value=cur_value)
        else:
            # manually input string
            if not cur_value:
                cur_value = "None"
            value = xbmcgui.Dialog().input(window_header, cur_value, type=xbmcgui.INPUT_ALPHANUM).decode("utf-8")
            label = value
        if label:
            from skinshortcuts import set_skinshortcuts_property
            set_skinshortcuts_property(property_name, value, label) 
Example #4
Source File: xbmc_context_ui.py    From plugin.video.youtube with GNU General Public License v2.0 6 votes vote down vote up
def on_keyboard_input(self, title, default='', hidden=False):
        # fallback for Frodo
        if self._context.get_system_version().get_version() <= (12, 3):
            keyboard = xbmc.Keyboard(default, title, hidden)
            keyboard.doModal()
            if keyboard.isConfirmed() and keyboard.getText():
                text = utils.to_unicode(keyboard.getText())
                return True, text
            else:
                return False, u''
            pass

        # Starting with Gotham (13.X > ...)
        dialog = xbmcgui.Dialog()
        result = dialog.input(title, utils.to_unicode(default), type=xbmcgui.INPUT_ALPHANUM)
        if result:
            text = utils.to_unicode(result)
            return True, text

        return False, u'' 
Example #5
Source File: default.py    From xbmc-addons-chinese with GNU General Public License v2.0 5 votes vote down vote up
def login_dialog():
    username = dialog.input(u'用户名:', type=xbmcgui.INPUT_ALPHANUM)
    password = dialog.input(u'密码:', type=xbmcgui.INPUT_ALPHANUM, option=xbmcgui.ALPHANUM_HIDE_INPUT)
    if username and password:
        cookie,tokens = get_auth.run(username,password)
        if tokens:
            save_user_info(username,password,cookie,tokens)
            homemenu = plugin.get_storage('homemenu')
            homemenu.clear()
            dialog.ok('',u'登录成功', u'点击返回首页并耐心等待')
            items = [{'label': u'<< 返回首页', 'path': plugin.url_for('main_menu')}]
            return plugin.finish(items, update_listing=True)
    else:
        dialog.ok('Error',u'用户名或密码不能为空')
    return None 
Example #6
Source File: Dialogs.py    From plugin.video.netflix with MIT License 5 votes vote down vote up
def show_email_dialog(self):
        """
        Asks the user for its Netflix account email

        :returns: str - Netflix account email
        """
        dlg = xbmcgui.Dialog()
        dialog = dlg.input(
            heading=self.get_local_string(string_id=30005),
            type=xbmcgui.INPUT_ALPHANUM)
        return dialog 
Example #7
Source File: Dialogs.py    From plugin.video.netflix with MIT License 5 votes vote down vote up
def show_password_dialog(self):
        """
        Asks the user for its Netflix password

        :returns: str - Netflix password
        """
        dlg = xbmcgui.Dialog()
        dialog = dlg.input(
            heading=self.get_local_string(string_id=30004),
            type=xbmcgui.INPUT_ALPHANUM,
            option=xbmcgui.ALPHANUM_HIDE_INPUT)
        return dialog 
Example #8
Source File: Dialogs.py    From plugin.video.netflix with MIT License 5 votes vote down vote up
def show_search_term_dialog(self):
        """
        Asks the user for a term to query the netflix search for

        :returns: str - Term to search for
        """
        dlg = xbmcgui.Dialog()
        term = dlg.input(
            heading=self.get_local_string(string_id=30003),
            type=xbmcgui.INPUT_ALPHANUM)
        if len(term) == 0:
            term = None
        return term 
Example #9
Source File: ipwww_common.py    From plugin.video.iplayerwww with GNU General Public License v2.0 5 votes vote down vote up
def KidsMode():
    dialog = xbmcgui.Dialog()
    old_password = ''
    try:
        old_password = ADDON.getSetting('kids_password')
        old_password = old_password.decode('base64', 'strict')
    except:
        pass
    password = ''
    if old_password:
        password = dialog.input(translation(30181), type=xbmcgui.INPUT_ALPHANUM)
    if old_password == password:
        new_password = dialog.input(translation(30182), type=xbmcgui.INPUT_ALPHANUM)
        ADDON.setSetting('kids_password',new_password.encode('base64','strict'))
    quit() 
Example #10
Source File: default.py    From plugin.video.bdyun with GNU General Public License v3.0 5 votes vote down vote up
def login_dialog():
    username = dialog.input(u'用户名:', type=xbmcgui.INPUT_ALPHANUM)
    password = dialog.input(u'密码:', type=xbmcgui.INPUT_ALPHANUM, option=xbmcgui.ALPHANUM_HIDE_INPUT)
    if username and password:
        cookie,tokens = get_auth.run(username,password)
        if tokens:
            save_user_info(username,password,cookie,tokens)
            homemenu = plugin.get_storage('homemenu')
            homemenu.clear()
            dialog.ok('',u'登录成功', u'点击返回首页并耐心等待')
            items = [{'label': u'<< 返回首页', 'path': plugin.url_for('main_menu')}]
            return plugin.finish(items, update_listing=True)
    else:
        dialog.ok('Error',u'用户名或密码不能为空')
    return None 
Example #11
Source File: ui.py    From plugin.git.browser with GNU General Public License v3.0 5 votes vote down vote up
def dialog_input(heading, default='', type=xbmcgui.INPUT_ALPHANUM, option=0, delay=0):
	if type not in [xbmcgui.INPUT_ALPHANUM, xbmcgui.INPUT_NUMERIC, xbmcgui.INPUT_DATE, xbmcgui.INPUT_TIME, xbmcgui.INPUT_IPADDRESS, xbmcgui.INPUT_PASSWORD]: type = xbmcgui.INPUT_ALPHANUM
	dialog = xbmcgui.Dialog()
	return dialog.input(heading, default, type, option, delay) 
Example #12
Source File: koditidal.py    From plugin.audio.tidal2 with GNU General Public License v3.0 5 votes vote down vote up
def newPlaylistDialog(self):
        dialog = xbmcgui.Dialog()
        title = dialog.input(_T(30233), type=xbmcgui.INPUT_ALPHANUM)
        item = None
        if title:
            description = dialog.input(_T(30234), type=xbmcgui.INPUT_ALPHANUM)
            item = self.create_playlist(title, description)
        return item 
Example #13
Source File: koditidal.py    From plugin.audio.tidal2 with GNU General Public License v3.0 5 votes vote down vote up
def renamePlaylistDialog(self, playlist):
        dialog = xbmcgui.Dialog()
        title = dialog.input(_T(30233), playlist.title, type=xbmcgui.INPUT_ALPHANUM)
        ok = False
        if title:
            description = dialog.input(_T(30234), playlist.description, type=xbmcgui.INPUT_ALPHANUM)
            ok = self.rename_playlist(playlist, title, description)
        return ok 
Example #14
Source File: container.py    From plugin.video.themoviedb.helper with GNU General Public License v3.0 5 votes vote down vote up
def list_search(self):
        self.updatelisting = True if self.params.pop('updatelisting', False) else False
        org_query = self.params.get('query')
        if not self.params.get('query'):
            self.params['query'] = self.set_searchhistory(
                query=utils.try_decode_string(xbmcgui.Dialog().input(self.addon.getLocalizedString(32044), type=xbmcgui.INPUT_ALPHANUM)),
                itemtype=self.params.get('type'))
        elif self.params.get('history', '').lower() == 'true':  # Param to force history save
            self.set_searchhistory(query=self.params.get('query'), itemtype=self.params.get('type'))
        if self.params.get('query'):
            self.list_tmdb(query=self.params.get('query'), year=self.params.get('year'))
            if not org_query:
                self.params['updatelisting'] = 'True'
                container_url = u'plugin://plugin.video.themoviedb.helper/?{}'.format(utils.urlencode_params(self.params))
                xbmc.executebuiltin('Container.Update({})'.format(container_url)) 
Example #15
Source File: dialogs.py    From plugin.video.netflix with MIT License 5 votes vote down vote up
def _ask_for_input(heading, default_text=None):
    return g.py2_decode(xbmcgui.Dialog().input(
        defaultt=default_text,
        heading=heading,
        type=xbmcgui.INPUT_ALPHANUM)) or None 
Example #16
Source File: dialogs.py    From plugin.video.netflix with MIT License 5 votes vote down vote up
def ask_for_password():
    """Ask the user for the password"""
    return g.py2_decode(xbmcgui.Dialog().input(
        heading=common.get_local_string(30004),
        type=xbmcgui.INPUT_ALPHANUM,
        option=xbmcgui.ALPHANUM_HIDE_INPUT)) or None 
Example #17
Source File: dialogs.py    From plugin.video.netflix with MIT License 5 votes vote down vote up
def ask_credentials():
    """
    Show some dialogs and ask the user for account credentials
    """
    email = g.py2_decode(xbmcgui.Dialog().input(
        heading=common.get_local_string(30005),
        type=xbmcgui.INPUT_ALPHANUM)) or None
    common.verify_credentials(email)
    password = ask_for_password()
    common.verify_credentials(password)
    common.set_credentials(email, password) 
Example #18
Source File: wizardconfigxml.py    From romcollectionbrowser with GNU General Public License v2.0 5 votes vote down vote up
def promptEmulatorFileMasks(self):
        fileMaskInput = xbmcgui.Dialog().input(util.localize(32181), type=xbmcgui.INPUT_ALPHANUM)
        if fileMaskInput == '':
            return []
        return fileMaskInput.split(',') 
Example #19
Source File: wizardconfigxml.py    From romcollectionbrowser with GNU General Public License v2.0 5 votes vote down vote up
def promptOtherConsoleName(self):
        """  Ask the user to enter a (other) console name """
        console = xbmcgui.Dialog().input(util.localize(32177), type=xbmcgui.INPUT_ALPHANUM)
        return console 
Example #20
Source File: wizardconfigxml.py    From romcollectionbrowser with GNU General Public License v2.0 5 votes vote down vote up
def promptEmulatorParams(self, defaultValue):
        """ Ask the user to enter emulator parameters """
        emuParams = xbmcgui.Dialog().input(util.localize(32179), defaultt=defaultValue, type=xbmcgui.INPUT_ALPHANUM)
        return emuParams 
Example #21
Source File: launcher.py    From romcollectionbrowser with GNU General Public License v2.0 4 votes vote down vote up
def __replacePlaceholdersInParams(self, emuParams, rom, gameRow):

        if self.escapeCmd:
            rom = re.escape(rom)

        # TODO: Wanted to do this with re.sub:
        # emuParams = re.sub(r'(?i)%rom%', rom, emuParams)
        # --> but this also replaces \r \n with linefeed and newline etc.

        # full rom path ("C:\Roms\rom.zip")
        emuParams = emuParams.replace('%rom%', rom)
        emuParams = emuParams.replace('%ROM%', rom)
        emuParams = emuParams.replace('%Rom%', rom)

        # romfile ("rom.zip")
        romfile = os.path.basename(rom)
        emuParams = emuParams.replace('%romfile%', romfile)
        emuParams = emuParams.replace('%ROMFILE%', romfile)
        emuParams = emuParams.replace('%Romfile%', romfile)

        # romname ("rom")
        romname = os.path.splitext(os.path.basename(rom))[0]
        emuParams = emuParams.replace('%romname%', romname)
        emuParams = emuParams.replace('%ROMNAME%', romname)
        emuParams = emuParams.replace('%Romname%', romname)

        # gamename
        gamename = str(gameRow[DataBaseObject.COL_NAME])
        emuParams = emuParams.replace('%game%', gamename)
        emuParams = emuParams.replace('%GAME%', gamename)
        emuParams = emuParams.replace('%Game%', gamename)

        # ask num
        if re.search('(?i)%ASKNUM%', emuParams):
            options = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
            number = str(xbmcgui.Dialog().select(util.localize(32167), options))
            emuParams = emuParams.replace('%asknum%', number)
            emuParams = emuParams.replace('%ASKNUM%', number)
            emuParams = emuParams.replace('%Asknum%', number)

        # ask text
        if re.search('(?i)%ASKTEXT%', emuParams):
            command = xbmcgui.Dialog().input(util.localize(32168), type=xbmcgui.INPUT_ALPHANUM)

            emuParams = emuParams.replace('%asktext%', command)
            emuParams = emuParams.replace('%ASKTEXT%', command)
            emuParams = emuParams.replace('%Asktext%', command)

        return emuParams 
Example #22
Source File: container.py    From plugin.video.themoviedb.helper with GNU General Public License v3.0 4 votes vote down vote up
def set_userdiscover_method_property(self):
        method = self.params.get('method')

        # Set Input Method
        affix = ''
        header = 'Search for '
        usedetails = False
        label = self.params.get('label')
        tmdbtype = self.params.get('type')
        inputtype = xbmcgui.INPUT_ALPHANUM
        if any(i in method for i in ['year', 'vote_', '_runtime', '_networks']):
            header = self.addon.getLocalizedString(32114) + ' '
            inputtype = xbmcgui.INPUT_NUMERIC
        elif '_date' in method:
            header = self.addon.getLocalizedString(32114) + ' '
            affix = ' YYYY-MM-DD\n' + self.addon.getLocalizedString(32113)
        elif '_genres' in method:
            label = xbmc.getLocalizedString(515)
            tmdbtype = 'genre'
        elif '_companies' in method:
            label = self.addon.getLocalizedString(32115)
            tmdbtype = 'company'
        elif '_networks' in method:
            label = self.addon.getLocalizedString(32116)
            tmdbtype = 'company'
        elif '_keywords' in method:
            label = self.addon.getLocalizedString(32117)
            tmdbtype = 'keyword'
        elif any(i in method for i in ['_cast', '_crew', '_people']):
            label = self.addon.getLocalizedString(32118)
            tmdbtype = 'person'
            usedetails = True
        header = '{0}{1}{2}'.format(header, label, affix)
        old_value = self.get_userdiscover_prop(method) or None
        old_label = self.get_userdiscover_prop(method, 'Label') or None

        # Route Method
        if method == 'with_separator':
            self.set_userdiscover_separator_property()
        elif '_genres' in method:
            self.set_userdiscover_genre_property()
        elif 'with_release_type' in method:
            self.set_userdiscover_selectlist_properties(constants.USER_DISCOVER_RELEASETYPES, header=self.addon.getLocalizedString(32119))
        elif 'region' in method:
            self.set_userdiscover_selectlist_properties(constants.USER_DISCOVER_REGIONS, header=self.addon.getLocalizedString(32120), multiselect=False)
        elif 'with_original_language' in method:
            self.set_userdiscover_selectlist_properties(constants.USER_DISCOVER_LANGUAGES, header=self.addon.getLocalizedString(32159), multiselect=False)
        elif 'with_runtime' not in method and 'with_networks' not in method and any(i in method for i in ['with_', 'without_']):
            self.add_userdiscover_method_property(header, tmdbtype, usedetails, old_label=old_label, old_value=old_value)
        else:
            self.new_property_label = self.new_property_value = utils.try_decode_string(
                xbmcgui.Dialog().input(header, type=inputtype, defaultt=old_value)) 
Example #23
Source File: controller.py    From plugin.video.crunchyroll with GNU Affero General Public License v3.0 4 votes vote down vote up
def searchAnime(args):
    """Search for anime
    """
    # ask for search string
    if not hasattr(args, "search"):
        d = xbmcgui.Dialog().input(args._addon.getLocalizedString(30041), type=xbmcgui.INPUT_ALPHANUM)
        if not d:
            return
    else:
        d = args.search

    # api request
    payload = {"media_types": "anime|drama",
               "q":           d,
               "limit":       30,
               "offset":      int(getattr(args, "offset", 0)),
               "fields":      "series.name,series.series_id,series.description,series.year,series.publisher_name, \
                               series.genres,series.portrait_image,series.landscape_image"}
    req = api.request(args, "autocomplete", payload)

    # check for error
    if req["error"]:
        view.add_item(args, {"title": args._addon.getLocalizedString(30061)})
        view.endofdirectory(args)
        return False

    # display media
    for item in req["data"]:
        # add to view
        view.add_item(args,
                      {"title":       item["name"],
                       "tvshowtitle": item["name"],
                       "series_id":   item["series_id"],
                       "plot":        item["description"],
                       "plotoutline": item["description"],
                       "genre":       ", ".join(item["genres"]),
                       "year":        item["year"],
                       "studio":      item["publisher_name"],
                       "thumb":       item["portrait_image"]["full_url"],
                       "fanart":      item["landscape_image"]["full_url"],
                       "mode":        "series"},
                      isFolder=True)

    # show next page button
    if len(req["data"]) >= 30:
        view.add_item(args,
                      {"title":  args._addon.getLocalizedString(30044),
                       "offset": int(getattr(args, "offset", 0)) + 30,
                       "search": d,
                       "mode":   args.mode},
                      isFolder=True)

    view.endofdirectory(args)
    return True