Python xbmc 模块,Keyboard() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用xbmc.Keyboard()

项目:catchup4kodi    作者:catchup4kodi    | 项目源码 | 文件源码
def Search(search_entered):
    favs = ADDON.getSetting('favs').split(',')
    if not search_entered:
        keyboard = xbmc.Keyboard('', 'Search iPlayer')
        keyboard.doModal()
        if keyboard.isConfirmed():
            search_entered = keyboard.getText()

    search_entered = search_entered.replace(',', '')

    if len(search_entered) == 0:
        return

    if not search_entered in favs:
        favs.append(search_entered)
        ADDON.setSetting('favs', ','.join(favs))

    NEW_URL ='http://vschedules.uktv.co.uk/mobile/v2/search?q=%s&platform=ios&app_ver=4.1.0' % (search_entered.replace(' ','%20'))


    FindSearch(NEW_URL)
项目:catchup4kodi    作者:catchup4kodi    | 项目源码 | 文件源码
def Search(search_entered):
    favs = ADDON.getSetting('favs').split(',')
    if not search_entered:
        keyboard = xbmc.Keyboard('', 'Search iPlayer')
        keyboard.doModal()
        if keyboard.isConfirmed():
            search_entered = keyboard.getText()

    search_entered = search_entered.replace(',', '')

    if len(search_entered) == 0:
        return

    if not search_entered in favs:
        favs.append(search_entered)
        ADDON.setSetting('favs', ','.join(favs))

    search_entered = search_entered.replace(' ','%20')

    NEW_URL='http://www.bbc.co.uk/iplayer/search?q=%s' % search_entered

    NextPageGenre(NEW_URL)
项目:kodi-vk.inpos.ru    作者:inpos    | 项目源码 | 文件源码
def _login_form(self):
        login_window = xbmc.Keyboard()
        login_window.setHeading(self._string(400500))
        login_window.setHiddenInput(False)
        login_window.setDefault(_addon.getSetting(_USERNAME))
        login_window.doModal()
        if login_window.isConfirmed():
            username = login_window.getText()
            password_window = xbmc.Keyboard()
            password_window.setHeading(self._string(400501))
            password_window.setHiddenInput(True)
            password_window.doModal()
            if password_window.isConfirmed():
                return username, password_window.getText()
            else:
                raise Exception("Password input was cancelled.")
        else:
            raise Exception("Login input was cancelled.")
项目:plugin.audio.tidal2    作者:arnesongit    | 项目源码 | 文件源码
def search_type(field):
    last_field = addon.getSetting('last_search_field').decode('utf-8')
    search_text = addon.getSetting('last_search_text').decode('utf-8')
    if last_field <> field or not search_text:
        addon.setSetting('last_search_field', field)
        keyboard = xbmc.Keyboard('', _T(30206))
        keyboard.doModal()
        if keyboard.isConfirmed():
            search_text = keyboard.getText()
        else:
            search_text = ''
    addon.setSetting('last_search_text', search_text)
    if search_text:
        searchresults = session.search(field, search_text)
        add_items(searchresults.artists, content=CONTENT_FOR_TYPE.get('files'), end=False)
        add_items(searchresults.albums, end=False)
        add_items(searchresults.playlists, end=False)
        add_items(searchresults.tracks, end=False)
        add_items(searchresults.videos, end=True)
    else:
        #xbmcplugin.setContent(plugin.handle, content='files')
        xbmcplugin.endOfDirectory(plugin.handle, succeeded=False, updateListing=False)
项目:kodi-turbofilm    作者:morsvox    | 项目源码 | 文件源码
def run_once():
    global USERNAME, USERPASS
    while (Get('/') == None):
        user_keyboard = xbmc.Keyboard()
        user_keyboard.setHeading(__language__(30001))
        user_keyboard.doModal()
        if (user_keyboard.isConfirmed()):
            USERNAME = user_keyboard.getText()
            pass_keyboard = xbmc.Keyboard()
            pass_keyboard.setHeading(__language__(30002))
            pass_keyboard.setHiddenInput(True)
            pass_keyboard.doModal()
            if (pass_keyboard.isConfirmed()):
                USERPASS = pass_keyboard.getText()
                __settings__.setSetting('username', USERNAME)
                __settings__.setSetting('password', USERPASS)
            else:
                return False
        else:
            return False
    return True
项目:plugin.video.streamondemand-pureita    作者:orione7    | 项目源码 | 文件源码
def GetTrailerbyKeyboard(titulo,category,solo="false"):
    print "[trailertools.py] Modulo: GetTrailerbyKeyboard(titulo = %s , category = %s)"  % (titulo,category)
    devuelve = []
    keyboard = xbmc.Keyboard('default','heading')
    keyboard.setDefault(titulo)
    if titulo == "":
        keyboard.setHeading(config.get_localized_string(30112)) #"Introduce el Titulo a buscar"
    else:
        keyboard.setHeading(config.get_localized_string(30113)) #'Puedes recortar el titulo  bien cambiar a otro idioma'
    keyboard.doModal()
    if (keyboard.isConfirmed()):
        tecleado = keyboard.getText()
        if len(tecleado)>0:
            devuelve = gettrailer(tecleado,category,solo)
            return devuelve
        else:return []
    else:return []
项目:script.reddit.reader    作者:gedisony    | 项目源码 | 文件源码
def getUserInput(title=u"Input", default=u"", hidden=False):
    log("", 5)
    result = None

    # Fix for when this functions is called with default=None
    if not default:
        default = u""

    keyboard = xbmc.Keyboard(default, title)
    keyboard.setHiddenInput(hidden)
    keyboard.doModal()

    if keyboard.isConfirmed():
        result = keyboard.getText()

    log(repr(result), 5)
    return result


# This function raises a keyboard numpad for user input
项目:plugin.video.youtube    作者:jdf76    | 项目源码 | 文件源码
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''

        # 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''
项目:plugin.video.youtube    作者:Kolifanes    | 项目源码 | 文件源码
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''
项目:vkkodi    作者:VkKodi    | 项目源码 | 文件源码
def _askLogin(self):
        user_keyboard = xbmc.Keyboard()
        user_keyboard.setHeading(__language__(30001))
        user_keyboard.setHiddenInput(False)
        user_keyboard.setDefault(__settings__.getSetting('username'))
        user_keyboard.doModal()
        if user_keyboard.isConfirmed():
            username = user_keyboard.getText()
            pass_keyboard = xbmc.Keyboard()
            pass_keyboard.setHeading(__language__(30002))
            pass_keyboard.setHiddenInput(True)
            pass_keyboard.doModal()
            if pass_keyboard.isConfirmed():
                return username, pass_keyboard.getText()
            else:
                raise Exception("Password input was cancelled.")
        else:
            raise Exception("Login input was cancelled.")
项目:kodi-bandcamp    作者:wallon-ines    | 项目源码 | 文件源码
def search(params, parts, route):
    if "query" not in params:
        kb = xbmc.Keyboard()
        kb.doModal()
        if kb.isConfirmed():
            return search(dict(query=kb.getText()), parts, route)
        else:
            return []
    else:
        results = bc.get_search_results(params["query"])
        # print results
        ret = []
        for item in results:
            if type(item) is bc.Album:
                ret.append(album_to_listitem(item))
            #if type(item) is bc.Track:
            #    ret.append(track_to_listitem(item))
            if type(item) is bc.Band:
                ret.append(band_to_listitem(item))

        # results = [item for item in ret if item is not None]
        # print ret
        return ret
项目:script.profilecleaner    作者:cibboy    | 项目源码 | 文件源码
def SearchAndDeleteThumbnail(self):
        keyboard = xbmc.Keyboard()
        keyboard.doModal()
        query = keyboard.getText()
        if query:
            lists = []; query = query.replace("'", "''")
            match = RawXBMC.Execute("SELECT url FROM texture WHERE url LIKE '%" + query + "%'")
            for base in match: lists.append(base[0])
            if len(lists) > 0:
                selected = xbmcgui.Dialog().multiselect(normalize(addonLanguage(32151)), lists)
                for sel in selected:
                    url = str(lists[sel])
                    url = url.replace("'", "''")
                    cachedUrl = RawXBMC.Execute("SELECT cachedurl FROM texture WHERE url='" + url + "'")
                    cachedUrlPath = os.path.join(thumbnailsFolder, cachedUrl[0][0])
                    try: shutil.move(cachedUrlPath, thumbnailBackupFolder)
                    except: pass
                    RawXBMC.Execute("DELETE FROM texture WHERE url='" + url + "'")
                if showGUI:
                    self.ShowStats()
            elif (addonSettings.getSetting("ShowNotifications") == "true"):
                xbmc.executebuiltin("Notification(%s,%s,2000,%s)" % (addonName, normalize(addonLanguage(32152)), addonIcon))
项目:plugin.audio.spotify    作者:marcelveldt    | 项目源码 | 文件源码
def add_track_to_playlist(self):
        xbmc.executebuiltin("ActivateWindow(busydialog)")

        if not self.trackid and xbmc.getInfoLabel("MusicPlayer.(1).Property(spotifytrackid)"):
            self.trackid = xbmc.getInfoLabel("MusicPlayer.(1).Property(spotifytrackid)")

        playlists = self.sp.user_playlists(self.userid, limit=50, offset=0)
        ownplaylists = []
        ownplaylistnames = []
        for playlist in playlists['items']:
            if playlist["owner"]["id"] == self.userid:
                ownplaylists.append(playlist)
                ownplaylistnames.append(playlist["name"])
        ownplaylistnames.append(xbmc.getLocalizedString(525))
        xbmc.executebuiltin("Dialog.Close(busydialog)")
        select = xbmcgui.Dialog().select(xbmc.getLocalizedString(524), ownplaylistnames)
        if select != -1 and ownplaylistnames[select] == xbmc.getLocalizedString(525):
            # create new playlist...
            kb = xbmc.Keyboard('', xbmc.getLocalizedString(21381))
            kb.setHiddenInput(False)
            kb.doModal()
            if kb.isConfirmed():
                name = kb.getText()
                playlist = self.sp.user_playlist_create(self.userid, name, False)
                self.sp.user_playlist_add_tracks(self.userid, playlist["id"], [self.trackid])
        elif select != -1:
            playlist = ownplaylists[select]
            self.sp.user_playlist_add_tracks(self.userid, playlist["id"], [self.trackid])
项目:context.youtube.download    作者:anxdpanic    | 项目源码 | 文件源码
def get_keyboard(heading, default=''):
    keyboard = xbmc.Keyboard()
    keyboard.setHeading(heading)
    if default: keyboard.setDefault(default)
    keyboard.doModal()
    if keyboard.isConfirmed():
        return keyboard.getText()
    else:
        return None
项目:weather.clue    作者:stefandmn    | 项目源码 | 文件源码
def execute(self, data=''):
        # evaluate input argument and depends on run add-on event/action
        if data.startswith('Location'):
            keyboard = xbmc.Keyboard('', xbmc.getLocalizedString(14024), False)
            keyboard.doModal()
            if keyboard.isConfirmed() and keyboard.getText() != '':
                text = keyboard.getText()
                locationNames, locationIds = self.provider.location(text)
                dialog = xbmcgui.Dialog()
                if locationNames != []:
                    selected = dialog.select(xbmc.getLocalizedString(396), locationNames)
                    if selected != -1:
                        commons.setSetting('Enabled', 'true')
                        commons.setSetting(data, locationNames[selected])
                        commons.debug('Selected location: %s' % locationNames[selected])
                        commons.setSetting(data + 'id', locationIds[selected])
                        commons.debug('Selected location id: %s' % locationIds[selected])
                else:
                    dialog.ok(commons.AddonName(), commons.translate(284))
        elif commons.setting('Enabled'):
            location = commons.setting('Location%s' % data)
            locationid = commons.setting('Location%sid' % data)
            if (locationid == '') and (data != '1'):
                location = commons.setting('Location1')
                locationid = commons.setting('Location1id')
                commons.debug('Trying first location instead: %s (%s)' % (location, locationid))
            if locationid == '':
                commons.debug('Fallback to GeoIP')
                location, locationid = self.provider.geoip()
            if not locationid == '':
                commons.debug('Call forecast for location %s (%s)' % (location, locationid))
                self.provider.forecast(location, locationid)
            else:
                commons.debug('No location found')
                self.provider.clear()
            self.provider.refresh()
        else:
            commons.debug('You need to enable weather retrieval in the weather underground add-on settings')
            self.provider.clear()
项目:tvalacarta    作者:tvalacarta    | 项目源码 | 文件源码
def keyboard_input(default_text="", title="", hidden=False):
    _log("keyboard_input default_text='"+default_text+"'")

    keyboard = xbmc.Keyboard(default_text,title,hidden)
    keyboard.doModal()

    if (keyboard.isConfirmed()):
        tecleado = keyboard.getText()
    else:
        tecleado = ""

    _log("keyboard_input ->'"+tecleado+"'")

    return tecleado
项目:tvalacarta    作者:tvalacarta    | 项目源码 | 文件源码
def keyboard_input(default_text="", title="", hidden=False):
    _log("keyboard_input default_text='"+default_text+"'")

    keyboard = xbmc.Keyboard(default_text,title,hidden)
    keyboard.doModal()

    if (keyboard.isConfirmed()):
        tecleado = keyboard.getText()
    else:
        tecleado = ""

    _log("keyboard_input ->'"+tecleado+"'")

    return tecleado
项目:forthelulz    作者:munchycool    | 项目源码 | 文件源码
def getusersearch(website):
    kb = xbmc.Keyboard('default', 'heading')
    kb.setDefault('Enter Search Word')
    kb.setHeading(website + 'Search')
    kb.setHiddenInput(False)
    kb.doModal()
    if (kb.isConfirmed()):
        search_term = kb.getText()
        return(search_term)
    else:
        return
项目:forthelulz    作者:munchycool    | 项目源码 | 文件源码
def getusersearch(language):
    kb = xbmc.Keyboard('default', 'heading')
    kb.setDefault('Enter Search Word')
    kb.setHeading(language + 'Search')
    kb.setHiddenInput(False)
    kb.doModal()
    if (kb.isConfirmed()):
        search_term  = kb.getText()
        return(search_term)
    else:
        return
项目:catchup4kodi    作者:catchup4kodi    | 项目源码 | 文件源码
def EmailPass():
    if ADDON.getSetting('email_pass_1')=='':
        search_entered = ''
        keyboard = xbmc.Keyboard(search_entered, 'Please Enter Email Password')
        keyboard.setHiddenInput(True)
        keyboard.doModal()
        if keyboard.isConfirmed():
            THEPASS = keyboard.getText()
        if dialog.yesno("USB BACKUP/RESTORE", "Do you Want To Save Your Password ?", 'Its Fully AES Encrypted','Just Enter Secret 4 Digit Number'):

            EncryptPass(THEPASS)

        return THEPASS    
    else:
        return DecryptPass()
项目:catchup4kodi    作者:catchup4kodi    | 项目源码 | 文件源码
def search_entered():
    favs = ADDON.getSetting('favs').split(',')
    keyboard = xbmc.Keyboard('', 'Email')
    keyboard.doModal()
    if keyboard.isConfirmed():
        search_entered = keyboard.getText()

    if not search_entered in favs:
        favs.append(search_entered)
        ADDON.setSetting('favs', ','.join(favs))

    return search_entered
项目:catchup4kodi    作者:catchup4kodi    | 项目源码 | 文件源码
def EmailPass():
    if ADDON.getSetting('email_pass_1')=='':
        search_entered = ''
        keyboard = xbmc.Keyboard(search_entered, 'Please Enter Email Password')
        keyboard.setHiddenInput(True)
        keyboard.doModal()
        if keyboard.isConfirmed():
            THEPASS = keyboard.getText()
        if dialog.yesno("USB BACKUP/RESTORE", "Do you Want To Save Your Password ?", 'Its Fully AES Encrypted','Just Enter Secret 4 Digit Number'):

            EncryptPass(THEPASS)

        return THEPASS    
    else:
        return DecryptPass()
项目:kodi-vk.inpos.ru    作者:inpos    | 项目源码 | 文件源码
def _video_search(self):
        page = int(self.root.params['page'])
        q = self.root.params['q']
        if q == 'none':
            s_win = xbmc.Keyboard()
            s_win.setHeading(self.root.gui._string(400515))
            s_win.setHiddenInput(False)
            s_win.doModal()
            if s_win.isConfirmed():
                q = s_win.getText()
            else:
                self.root.gui.notify(self.root.gui._string(400525), '')
                return
        else:
            q = pickle.loads(binascii.unhexlify(q))
        history = get_search_history(_FILE_VIDEO_SEARCH_HISTORY)
        try:
            del history[history.index(q)]
        except ValueError:
            pass
        history = [q] + history
        put_search_history(history, _FILE_VIDEO_SEARCH_HISTORY)
        query_hex = binascii.hexlify(pickle.dumps(q, -1))
        kwargs = {
                  'page': page,
                  'sort': _SETTINGS_VIDEO_SEARCH_SORT,
                  'hd'  : _SETTINGS_VIDEO_SEARCH_HD,
                  'adult': _SETTINGS_VIDEO_SEARCH_ADULT,
                  'q': q,
                  'extended': 1
                  }
        search_res = media_entries('video.search', self.root.conn, _NO_OWNER, **kwargs)
        if page < search_res['pages']:
            params = {'do': _DO_VIDEO_SEARCH, 'q': query_hex, 'page': page + 1}
            self.root.add_folder(self.root.gui._string(400602), params)
        self.__create_video_list_(search_res)
        if page < search_res['pages']:
            params = {'do': _DO_VIDEO_SEARCH, 'q': query_hex, 'page': page + 1}
            self.root.add_folder(self.root.gui._string(400602), params)
        xbmcplugin.endOfDirectory(_addon_id)
项目:kodi-vk.inpos.ru    作者:inpos    | 项目源码 | 文件源码
def _group_search(self):
        page = int(self.root.params['page'])
        q = self.root.params['q']
        if q == 'none':
            s_win = xbmc.Keyboard()
            s_win.setHeading(self._string(400515))
            s_win.setHiddenInput(False)
            s_win.doModal()
            if s_win.isConfirmed():
                q = s_win.getText()
            else:
                self.notify(self._string(400525), '')
                return
        else:
            q = pickle.loads(binascii.unhexlify(q))
        history = get_search_history(_FILE_GROUP_SEARCH_HISTORY)
        try:
            del history[history.index(q)]
        except ValueError:
            pass
        history = [q] + history
        put_search_history(history, _FILE_GROUP_SEARCH_HISTORY)
        query_hex = binascii.hexlify(pickle.dumps(q, -1))
        kwargs = {
                  'page': page,
                  'q': q
                  }
        u = User(self.root.u.id, self.root.conn)
        search_res = u.group_search(**kwargs)
        if page < search_res['pages']:
            params = {'do': _DO_VIDEO_SEARCH, 'q': query_hex, 'page': page + 1}
            self.root.add_folder(self.root.gui._string(400602), params)
        self.__create_group_list_(search_res)
        if page < search_res['pages']:
            params = {'do': _DO_VIDEO_SEARCH, 'q': query_hex, 'page': page + 1}
            self.root.add_folder(self.root.gui._string(400602), params)
        xbmcplugin.endOfDirectory(_addon_id)
项目:kodi-vk.inpos.ru    作者:inpos    | 项目源码 | 文件源码
def _user_search(self):
        page = int(self.root.params['page'])
        q = self.root.params['q']
        if q == 'none':
            s_win = xbmc.Keyboard()
            s_win.setHeading(self.root.gui._string(400515))
            s_win.setHiddenInput(False)
            s_win.doModal()
            if s_win.isConfirmed():
                q = s_win.getText()
            else:
                self.notify(self._string(400525), '')
                return
        else:
            q = pickle.loads(binascii.unhexlify(q))
        history = get_search_history(_FILE_USER_SEARCH_HISTORY)
        try:
            del history[history.index(q)]
        except ValueError:
            pass
        history = [q] + history
        put_search_history(history, _FILE_USER_SEARCH_HISTORY)
        query_hex = binascii.hexlify(pickle.dumps(q, -1))
        kwargs = {
                  'page': page,
                  'q': q
                  }
        u = User(self.root.u.id, self.root.conn)
        search_res = u.user_search(**kwargs)
        if page < search_res['pages']:
            params = {'do': _DO_VIDEO_SEARCH, 'q': query_hex, 'page': page + 1}
            self.root.add_folder(self.root.gui._string(400602), params)
        self.__create_user_list_(search_res)
        if page < search_res['pages']:
            params = {'do': _DO_VIDEO_SEARCH, 'q': query_hex, 'page': page + 1}
            self.root.add_folder(self.root.gui._string(400602), params)
        xbmcplugin.endOfDirectory(_addon_id)
项目:plugin.video.stream-cinema    作者:bbaronSVK    | 项目源码 | 文件源码
def keyboard(self, title, action):
        k = xbmc.Keyboard('', title);
        k.doModal()
        q = k.getText() if k.isConfirmed() else None
        if (q == None or q == ''): 
            return
        q = urllib.quote_plus(q)
        url = '%s?action=%s&q=%s' % (sys.argv[0], action, q)
        control.execute('Container.Update(%s)' % url)
项目:specto    作者:mrknow    | 项目源码 | 文件源码
def inputText(self, title=None, text=None):
        """Grab search text from user."""
        kbd = xbmc.Keyboard()
        if title:
            kbd.setHeading(title)
        if text:
            kbd.setDefault(text)
        kbd.doModal()
        if kbd.isConfirmed():
            return kbd.getText()
项目:google-photos-for-kodi    作者:nkanand4    | 项目源码 | 文件源码
def ShowKeyboard():
    user_input = ''
    exit = True
    while exit:
        kb = xbmc.Keyboard('default', 'heading', True)
        kb.setDefault('')
        kb.setHeading('Authentication')
        kb.setHiddenInput(False)
        kb.doModal()
        if kb.isConfirmed():
            user_input = kb.getText()
            exit = False
    return user_input
项目:pelisalacarta-ce    作者:pelisalacarta-ce    | 项目源码 | 文件源码
def dialog_input(default="", heading="", hidden=False):
    keyboard = xbmc.Keyboard(default, heading, hidden)
    keyboard.doModal()
    if keyboard.isConfirmed():
        return keyboard.getText()
    else:
        return None
项目:pelisalacarta-ce    作者:pelisalacarta-ce    | 项目源码 | 文件源码
def keyboard_input(default_text="", title="", hidden=False):
    _log("keyboard_input default_text='"+default_text+"'")

    keyboard = xbmc.Keyboard(default_text,title,hidden)
    keyboard.doModal()

    if (keyboard.isConfirmed()):
        tecleado = keyboard.getText()
    else:
        tecleado = ""

    _log("keyboard_input ->'"+tecleado+"'")

    return tecleado
项目:plugin.video.rrmj    作者:jindaxia    | 项目源码 | 文件源码
def input_keyword():
    keyboard = Keyboard('', '???????')
    xbmc.sleep(1500)
    keyboard.doModal()
    if (keyboard.isConfirmed()):
        keyword = keyboard.getText()
        url = plugin.url_for("search_title", title=keyword)
        plugin.redirect(url)
项目:plugin.video.streamondemand-pureita    作者:orione7    | 项目源码 | 文件源码
def keyboard_input(default_text="", title="", hidden=False):
    _log("keyboard_input default_text='"+default_text+"'")

    keyboard = xbmc.Keyboard(default_text,title,hidden)
    keyboard.doModal()

    if (keyboard.isConfirmed()):
        tecleado = keyboard.getText()
    else:
        tecleado = ""

    _log("keyboard_input ->'"+tecleado+"'")

    return tecleado
项目:plugin.video.streamondemand-pureita    作者:orione7    | 项目源码 | 文件源码
def dialog_input(default="", heading="", hidden=False):
    keyboard = xbmc.Keyboard(default, heading, hidden)
    keyboard.doModal()
    if keyboard.isConfirmed():
        return keyboard.getText()
    else:
        return None
项目:kodi-fsgo    作者:emilsvennesson    | 项目源码 | 文件源码
def get_user_input(heading):
    keyboard = xbmc.Keyboard('', heading)
    keyboard.doModal()
    if keyboard.isConfirmed():
        query = keyboard.getText()
        addon_log('User input string: %s' % query)
    else:
        query = None

    if query and len(query) > 0:
        return query
    else:
        return None
项目:plugin.video.amazon65    作者:phil65    | 项目源码 | 文件源码
def SEARCH_DB(searchString=False):
    if not searchString:
        keyboard = xbmc.Keyboard('')
        keyboard.doModal()
        if (keyboard.isConfirmed()):
            searchString = keyboard.getText()
            if searchString != '':
                common.addText('          ----=== ' + common.getString(30104) + ' ===----')
                if not listmovie.LIST_MOVIES('movietitle', searchString, search=True):
                    common.addText(common.getString(30202))
                common.addText('          ----=== ' + common.getString(30107) + ' ===----')
                if not listtv.LIST_TVSHOWS('seriestitle', searchString, search=True):
                    common.addText(common.getString(30202))
                common.SetView('tvshows')
项目:plugin.video.amazon65    作者:phil65    | 项目源码 | 文件源码
def dologin():
    email = addon.getSetting('login_name')
    password = decode(addon.getSetting('login_pass'))
    changed = False

    if addon.getSetting('save_login') == 'false' or email == '' or password == '':
        keyboard = xbmc.Keyboard(addon.getSetting('login_name'), getString(30002))
        keyboard.doModal()
        if keyboard.isConfirmed() and keyboard.getText():
            email = keyboard.getText()
            password = setLoginPW()
            if password:
                changed = True
    if password:
        if os.path.isfile(COOKIEFILE):
            os.remove(COOKIEFILE)
        cj = cookielib.LWPCookieJar()
        br = mechanize.Browser()
        br.set_handle_robots(False)
        br.set_cookiejar(cj)
        # br.set_debug_http(True)
        # br.set_debug_responses(True)
        br.addheaders = [('User-agent', UserAgent)]
        br.open(BASE_URL + "/gp/aw/si.html")
        br.select_form(name="signIn")
        br["email"] = email
        br["password"] = password
        logged_in = br.submit()
        error_str = "message error"
        if error_str in logged_in.read():
            Dialog.ok(getString(30200), getString(30201))
            return False
        else:
            if addon.getSetting('save_login') == 'true' and changed:
                addon.setSetting('login_name', email)
                addon.setSetting('login_pass', encode(password))
            if addon.getSetting('no_cookie') != 'true':
                cj.save(COOKIEFILE, ignore_discard=True, ignore_expires=True)
            gen_id()
            return cj
    return True
项目:plugin.video.amazon65    作者:phil65    | 项目源码 | 文件源码
def setLoginPW():
    keyboard = xbmc.Keyboard('', getString(30003), True)
    keyboard.doModal()
    if keyboard.isConfirmed() and keyboard.getText():
        password = keyboard.getText()
        return password
    return False
项目:plugin.program.indigo    作者:tvaddonsco    | 项目源码 | 文件源码
def _get_keyboard(default="", heading="", hidden=False):  # Start Ketboard Function
    keyboard = xbmc.Keyboard(default, heading, hidden)
    keyboard.doModal()
    if (keyboard.isConfirmed()):
        return unicode(keyboard.getText(), "utf-8")
    return default
项目:plugin.program.indigo    作者:tvaddonsco    | 项目源码 | 文件源码
def get_keyboard(default="", heading="", hidden=False):
    keyboard = xbmc.Keyboard(default, heading, hidden)
    keyboard.doModal()
    if keyboard.isConfirmed():
        return unicode(keyboard.getText(), "utf-8")
    return default


# #############  Backup  ############################################
项目:script.reddit.reader    作者:gedisony    | 项目源码 | 文件源码
def addSubreddit(subreddit, name, type_):
    from utils import colored_subreddit
    from reddit import this_is_a_multireddit, format_multihub
    alreadyIn = False
    with open(subredditsFile, 'r') as fh:
        content = fh.readlines()
    if subreddit:
        for line in content:
            if line.lower()==subreddit.lower():
                alreadyIn = True
        if not alreadyIn:
            with open(subredditsFile, 'a') as fh:
                fh.write(subreddit+'\n')

            get_subreddit_entry_info(subreddit)
        xbmc_notify(colored_subreddit(subreddit), translation(32019) )
    else:
        #dialog = xbmcgui.Dialog()
        #ok = dialog.ok('Add subreddit', 'Add a subreddit (videos)','or  Multiple subreddits (music+listentothis)','or  Multireddit (/user/.../m/video)')
        #would be great to have some sort of help to show first time user here

        keyboard = xbmc.Keyboard('', translation(32001))
        keyboard.doModal()
        if keyboard.isConfirmed() and keyboard.getText():
            subreddit = keyboard.getText()

            #cleanup user input. make sure /user/ and /m/ is lowercase
            if this_is_a_multireddit(subreddit):
                subreddit = format_multihub(subreddit)
            else:
                get_subreddit_entry_info(subreddit)

            for line in content:
                if line.lower()==subreddit.lower()+"\n":
                    alreadyIn = True

            if not alreadyIn:
                with open(subredditsFile, 'a') as fh:
                    fh.write(subreddit+'\n')

        xbmc.executebuiltin("Container.Refresh")
项目:script.reddit.reader    作者:gedisony    | 项目源码 | 文件源码
def editSubreddit(subreddit, name, type_):
    from reddit import this_is_a_multireddit, format_multihub
    log( 'editSubreddit ' + subreddit)

    with open(subredditsFile, 'r') as fh:
        content = fh.readlines()

    contentNew = ""

    keyboard = xbmc.Keyboard(subreddit, translation(32003))
    keyboard.doModal()
    if keyboard.isConfirmed() and keyboard.getText():
        newsubreddit = keyboard.getText()
        #cleanup user input. make sure /user/ and /m/ is lowercase
        if this_is_a_multireddit(newsubreddit):
            newsubreddit = format_multihub(newsubreddit)
        else:
            get_subreddit_entry_info(newsubreddit)

        for line in content:
            if line.strip()==subreddit.strip() :      #if matches the old subreddit,
                #log("adding: %s  %s  %s" %(line, subreddit, newsubreddit)  )
                contentNew+=newsubreddit+'\n'
            else:
                contentNew+=line

        with open(subredditsFile, 'w') as fh:
            fh.write(contentNew)

        xbmc.executebuiltin("Container.Refresh")
项目:script.reddit.reader    作者:gedisony    | 项目源码 | 文件源码
def searchReddits(url, subreddit, type_):
    from default import urlMain
    from main_listing import listSubReddit

    #reddit search only works with a single subreddit
    if subreddit:
        initial_search_string='restrict_sr=on&sort=relevance&t=all&q='
        initial_url=urlMain+'/r/'+subreddit
    else:
        initial_search_string='sort=relevance&t=year&q='
        initial_url=urlMain

    keyboard = xbmc.Keyboard(initial_search_string, translation(32073))
    keyboard.doModal()
    if keyboard.isConfirmed() and keyboard.getText():

        search_string=keyboard.getText()

        if search_string:
            search_string=urllib.quote_plus(search_string,safe='&=') #only &= are used because they're in the initial_search_string

    #    #this    https://www.reddit.com/r/Art/.json?&nsfw:no+&limit=10
    #    #becomes https://www.reddit.com/r/Art/search.json?&nsfw:no+&limit=10&q=SEARCHTERM&restrict_sr=on&sort=relevance&t=all
        url = initial_url +"/search.json?" +search_string    #+ '+' + nsfw  # + sites_filter skip the sites filter

        listSubReddit(url, 'Search', "")
项目:plugin.video.zdf_de_2016    作者:generia    | 项目源码 | 文件源码
def _getKeyboardInput(self):
        keyboard = xbmc.Keyboard('', self._(32005))
        keyboard.doModal()
        text = None
        if keyboard.isConfirmed() and keyboard.getText():
            text = keyboard.getText()
        return text
项目:plugin.video.giraffe.seasonvar    作者:weirdgiraffe    | 项目源码 | 文件源码
def read_input(self, header):
        keyboard = xbmc.Keyboard('', '??? ???????', False)
        keyboard.doModal()
        if keyboard.isConfirmed():
            return keyboard.getText()
项目:kodi-espnplayer    作者:emilsvennesson    | 项目源码 | 文件源码
def get_user_input(self, heading, hidden=False):
        keyboard = xbmc.Keyboard('', heading, hidden)
        keyboard.doModal()
        if keyboard.isConfirmed():
            query = keyboard.getText()
            self.log('User input string: %s' % query)
        else:
            query = None

        if query and len(query) > 0:
            return query
        else:
            return None
项目:plugin.video.areena    作者:hirsivaja    | 项目源码 | 文件源码
def new_search(search_type):
    """
    Creates a new search. Saves it to add-on settings
    :param search_type 'free' for free search, 'series' for searching series names
    :return: None
    """
    keyboard = xbmc.Keyboard()
    keyboard.doModal()
    if keyboard.isConfirmed() and keyboard.getText() != '':
        search_text = "{0}:{1}".format(search_type, keyboard.getText())
        search(search_text, 0)
    xbmcplugin.endOfDirectory(_handle)
项目:plugin.video.areena    作者:hirsivaja    | 项目源码 | 文件源码
def add_favourites_folder(fav_folder):
    keyboard = xbmc.Keyboard()
    keyboard.doModal()
    if keyboard.isConfirmed() and keyboard.getText() != '':
        folder_name = 'favFolder' + keyboard.getText()
        if favourite_folder_exists('favourites', folder_name):
            pass
        else:
            _addon.setSetting(folder_name, "")
            add_favourite('folder', '0', folder_name, fav_folder)
    xbmcplugin.endOfDirectory(_handle)
项目:vkkodi    作者:VkKodi    | 项目源码 | 文件源码
def Do_SEARCH(self):
        query = self.params.get("query")
        if not query:
            kb = xbmc.Keyboard()
            kb.setHiddenInput(False)
            kb.setHeading(self.locale["input"])
            history = self.GetSearchHistory(self.histId)
            if history:
                kb.setDefault(history[0])
            kb.doModal()
            if kb.isConfirmed():
                query = kb.getText()
            self.params["query"] = query
        self.Search(query)
项目:addon    作者:alfa-addon    | 项目源码 | 文件源码
def dialog_input(default="", heading="", hidden=False):
    keyboard = xbmc.Keyboard(default, heading, hidden)
    keyboard.doModal()
    if keyboard.isConfirmed():
        return keyboard.getText()
    else:
        return None
项目:plugin.video.9anime    作者:DxCx    | 项目源码 | 文件源码
def keyboard(text):
    keyboard = xbmc.Keyboard("", text, False)
    keyboard.doModal()
    if keyboard.isConfirmed():
        return keyboard.getText()
    return None