Python xbmc.Keyboard() Examples

The following are 30 code examples of xbmc.Keyboard(). 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 xbmc , or try the search function .
Example #1
Source File: default.py    From kodi with GNU General Public License v3.0 6 votes vote down vote up
def getUserInput(self):
        kbd = xbmc.Keyboard()
        kbd.setDefault('')
        kbd.setHeading(self.language(4000))
        kbd.doModal()
        keyword = None

        if kbd.isConfirmed():
            if self.addon.getSetting('translit') == 'true':
                keyword = translit.rus(kbd.getText())
            else:
                keyword = kbd.getText()
            
            history.add_to_history(keyword)
           
        return keyword 
Example #2
Source File: default.py    From bugatsinho.github.io with GNU General Public License v3.0 6 votes vote down vote up
def Search_Anime():  # 29
    keyb = xbmc.Keyboard('', 'Search')
    keyb.doModal()
    if (keyb.isConfirmed()):
        search = urllib.quote_plus(keyb.getText())

        url = ANIME + "buscar?t=todo&q=" + search
        An_Todo(url)
    else:
        return


######################
######################
###   TOOLS MENU   ###
######################
###################### 
Example #3
Source File: XbmcHelpers.py    From ru with GNU General Public License v2.0 6 votes vote down vote up
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 
Example #4
Source File: dialogbase.py    From romcollectionbrowser with GNU General Public License v2.0 6 votes vote down vote up
def editFilemask(self, controlId, enterString, pathComplete):
        control = self.getControlById(controlId)
        filemask = util.getLabel(control)

        keyboard = xbmc.Keyboard()
        keyboard.setHeading(util.localize(32132) % enterString)
        keyboard.setDefault(filemask)
        keyboard.doModal()
        if keyboard.isConfirmed():
            filemask = keyboard.getText()

        util.setLabel(filemask, control)

        pathParts = os.path.split(pathComplete)
        path = pathParts[0]
        pathComplete = os.path.join(path, filemask.strip())

        return pathComplete 
Example #5
Source File: resolver.py    From program.plexus with GNU General Public License v2.0 6 votes vote down vote up
def go_to_id(p2p_type):
	if p2p_type=='ace':
		keyb = xbmc.Keyboard('', translate(30022))
		keyb.doModal()
		if (keyb.isConfirmed()):
			search = keyb.getText()
			if search=='': sys.exit(0)
			else:
				channel_id = search
				ace.acestreams(translate(30020) + ' ( ' + str(channel_id) + ')','',str(channel_id))
	elif p2p_type=='sop_id':
		channel_id = xbmcgui.Dialog().numeric(0, translate(30018))
		sop.sopstreams(translate(30020) + ' ( ' + str(channel_id) + ')','',str(channel_id))
	elif p2p_type=='sop_url':
		keyb = xbmc.Keyboard('sop://', translate(30019) + ' sop://')
		keyb.doModal()
		if (keyb.isConfirmed()):
			search = keyb.getText()
			if search=='': sys.exit(0)
			else:
				channel_id = search
				sop.sopstreams(translate(30021) + ' ( ' + str(channel_id) + ')','',str(channel_id)) 
Example #6
Source File: default.py    From xbmc-addons-chinese with GNU General Public License v2.0 6 votes vote down vote up
def searchSohu():
    result=''
    if (__addon__.getSetting('keyboard')=='0'):
        keyboard = xbmc.Keyboard('','请输入搜索内容')
    else:
        keyboard = ChineseKeyboard.Keyboard('','请输入搜索内容')
    xbmc.sleep( 1500 )
    keyboard.doModal()
    if (keyboard.isConfirmed()):
        keyword = keyboard.getText()
        p_url = 'http://so.tv.sohu.com/mts?chl=&tvType=-2&wd='
        url = p_url + urllib.quote_plus(keyword.decode('utf-8').encode('gb2312'))
        sohuSearchList(keyword,url,'1')
    else: return
        
##################################################################################
# Routine to search Sohu site based on user given keyword for:
# http://so.tv.sohu.com/mts?chl=&tvType=-2&wd=love&whole=1&m=1&box=1&c=100&o=1&p=2
# c: 类型:''=全部 100=电影 101=电视剧 106=综艺 121=音乐 122=新闻 112=娱乐 0=其它 
# o:排序方式: ''=相关程度 1=最多播放 3=最新发布
################################################################################## 
Example #7
Source File: default.py    From repository.guilouz with GNU General Public License v2.0 6 votes vote down vote up
def _edit_db_string( self,preset,type,label ):
        keyboard = xbmc.Keyboard(preset)
        keyboard.doModal()
        if (keyboard.isConfirmed()):
            try:
                InputLabel=keyboard.getText()
                conv=time.strptime(InputLabel,"%d/%m/%Y")
              #  InputLabel = Time.strftime('%Y-%m-%d')
                InputLabel = time.strftime("%Y-%m-%d",conv)
            except Exception:
                sys.exc_clear()
            if ((type == "Song") or (type == "Album") or (type == "Artist")):
                xbmc.executeJSONRPC('{"jsonrpc": "2.0", "id": 1, "method": "AudioLibrary.Set%sDetails", "params": { "%s": "%s", "%sid":%s }}' % (type,label,InputLabel,type.lower(),self.DBID))
            else:
                xbmc.executeJSONRPC('{"jsonrpc": "2.0", "id": 1, "method": "VideoLibrary.Set%sDetails", "params": { "%s": "%s", "%sid":%s }}' % (type,label,InputLabel,type.lower(),self.DBID))
        else:
            return "" 
Example #8
Source File: default.py    From xbmc-addons-chinese with GNU General Public License v2.0 6 votes vote down vote up
def searchChineseKeyboard(key=None, mode='all', pn=0):
    if key:
        url = make_param({"key":key, 'type':mode}, 'http://sou.kuwo.cn/ws/NSearch')
        processSearch(url)
    else:
        # Somehow, current chinese keyboard implementation works differently than the default keyboard.
        # The doModal doesn't prevent xbmcplugin from popping up the directory-scanning window, which
        # covers up the keyboard window.
        # A workaround is to terminate the directory, doModal, pass in keyboard input as new param of 
        # the container, then relaunch the container.
        xbmcplugin.endOfDirectory(int(sys.argv[1]))
        #中文输入法
        keyboard = ChineseKeyboard.Keyboard('', '搜索')
        keyboard.doModal()
        if keyboard.isConfirmed():
            keyword = keyboard.getText()
            if keyword:
                u = make_param({"url":'',"mode":'search("%s")' % keyword})
                xbmc.executebuiltin('Container.Update(%s,replace)' % u)

# Choose ChineseKeyboard if script.module.keyboard.chinese is installed. 
Example #9
Source File: default.py    From xbmc-addons-chinese with GNU General Public License v2.0 6 votes vote down vote up
def driller(tree, lCont):
    #global item
    global context_params
    if not isinstance(lCont, list):
        lCont = [lCont]
    for cont in lCont:
        result = None
        context_params = cont.get('context', {})
        items = tree.find_all(*cont['tag'])
        #print("to find:", cont)
        for item in items:
            #print('found')
            if cont.get('vect', None):
                try:
                    result = cont['vect'](item)
                except:
                    pass
            if result != 'DRILLER_NO_DEEPER':
                if cont.get('child', None):
                    driller(item, cont['child'])

#
# Keyboard for search
# 
Example #10
Source File: default.py    From xbmc-addons-chinese with GNU General Public License v2.0 6 votes vote down vote up
def searchPPS():
    result=''
    keyboard = Apps('','请输入搜索内容')
    xbmc.sleep( 1500 )
    keyboard.doModal()
    if (keyboard.isConfirmed()):
        keyword = keyboard.getText()

        # url='http://so.pps.tv/search?k='+urllib.quote(keyword)+'&from=1'
        url='http://so.iqiyi.com/pps/?q=%s' % urllib.quote(keyword)
        ppsSearchList(keyword,url,'1')
    else: return
        
##################################################################################
# Routine to search PPS site based on user given keyword for:
# a. video episode List for each found provider
# b. movie from each found provider
# c. ugc for each found provider
################################################################################## 
Example #11
Source File: context.py    From repository.evgen_dev.xbmc-addons with GNU General Public License v2.0 6 votes vote down vote up
def add_bookmark_in(self, params):
        response = self.get_bookmarks()[1]
        if(len(response['data']) == 0):
            return
        folders = [xbmcup.app.lang[30157]]
        hrefs = ['add_dir']
        for movie in response['data']:
            hrefs.append(movie['url'])
            folders.append(movie['name'])
        ret = xbmcup.gui.select(xbmcup.app.lang[30156], folders)
        if (ret != None):
            if(hrefs[ret] == 'add_dir'):
                keyboard = xbmc.Keyboard()
                keyboard.setHeading(xbmcup.app.lang[30112])
                keyboard.doModal()
                dirname = keyboard.getText(0)
                if not dirname: return False
                self.ajax('%s/users/profile/addbookmark?name=%s' % (SITE_URL, dirname))
                self.add_bookmark_in(params)
                return False
            else:
                self.add_bookmark({'id' : params['id'], 'dir' : hrefs[ret]}) 
Example #12
Source File: resolver.py    From program.plexus with GNU General Public License v2.0 6 votes vote down vote up
def go_to_id(p2p_type):
	if p2p_type=='ace':
		keyb = xbmc.Keyboard('', translate(30022))
		keyb.doModal()
		if (keyb.isConfirmed()):
			search = keyb.getText()
			if search=='': sys.exit(0)
			else:
				channel_id = search
				ace.acestreams(translate(30020) + ' ( ' + str(channel_id) + ')','',str(channel_id))
	elif p2p_type=='sop_id':
		channel_id = xbmcgui.Dialog().numeric(0, translate(30018))
		sop.sopstreams(translate(30020) + ' ( ' + str(channel_id) + ')','',str(channel_id))
	elif p2p_type=='sop_url':
		keyb = xbmc.Keyboard('sop://', translate(30019) + ' sop://')
		keyb.doModal()
		if (keyb.isConfirmed()):
			search = keyb.getText()
			if search=='': sys.exit(0)
			else:
				channel_id = search
				sop.sopstreams(translate(30021) + ' ( ' + str(channel_id) + ')','',str(channel_id)) 
Example #13
Source File: XbmcHelpers.py    From kodi with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #14
Source File: CommonFunctions.py    From ru with GNU General Public License v2.0 6 votes vote down vote up
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 
Example #15
Source File: default.py    From kodi with GNU General Public License v3.0 6 votes vote down vote up
def getUserInput(self):
        kbd = xbmc.Keyboard()
        kbd.setDefault('')
        kbd.setHeading(self.language(1000))
        kbd.doModal()
        keyword = None

        if kbd.isConfirmed():
            if self.addon.getSetting('translit') == 'true':
                keyword = transliterate.rus(kbd.getText())
            else:
                keyword = kbd.getText()

            history.add_to_history(keyword)
             
        return keyword 
Example #16
Source File: default.py    From ru with GNU General Public License v2.0 5 votes vote down vote up
def get_querry(params):
	import datetime
	if params.has_key("par"):
		iyear = __addon__.getSetting("year")
		if iyear == '':
			iyear = datetime.date.today().year
		
		iyear = xbmcgui.Dialog().numeric(int(iyear),'Год')
		
		if iyear == '':
			iyear = ""
		elif int(iyear) < 1900:
			iyear = 1900
		elif int(iyear) > int(datetime.date.today().year):
			showMessage('', '%s > %s' % (iyear, datetime.date.today().year))
			iyear = datetime.date.today().year
		__addon__.setSetting('year', str(iyear))
		
	else:	
		skbd = xbmc.Keyboard()
		skbd.setHeading('Поиск:')
		skbd.doModal()
		if skbd.isConfirmed():
			SearchStr = skbd.getText()
			params['search']=SearchStr.replace(' ','+').decode('utf-8').encode('cp1251')
		else:
			params['search']=''
		__addon__.setSetting('querry',str(SearchStr))
	xbmc.executebuiltin('Container.Refresh(%s?func=get_customsearch)' % sys.argv[0]) 
Example #17
Source File: ivi2xbmc.py    From ru with GNU General Public License v2.0 5 votes vote down vote up
def run_search(params):                # Поиск
	#track_page_view('search')
	#track_page_view('search',UATRACK=GATrack)
	kbd = xbmc.Keyboard()
	kbd.setDefault('')
	kbd.setHeading(language(30021))
	kbd.doModal()
	out=''
	if kbd.isConfirmed():
		out = kbd.getText()

	params['func'] = 'search'
	params['url'] = HOST+'search/?subsite=190&type=videos&q=%s'%out.replace(' ','%20')
	track_page_view('search=%s'%out)
	search(params) 
Example #18
Source File: launcher_plugin.py    From advanced-launcher with GNU General Public License v2.0 5 votes vote down vote up
def _modify_category(self, categoryID):
        dialog = xbmcgui.Dialog()
        type2 = dialog.select(__language__( 30344 ),[__language__( 30306 ) % self.categories[categoryID]["name"],__language__( 30310 ) % self.categories[categoryID]["genre"],__language__( 30328 ) % self.categories[categoryID]["plot"]])
        if (type2 == 0 ):
            # Edition of the category name
            keyboard = xbmc.Keyboard(self.categories[categoryID]["name"], __language__( 30037 ))
            keyboard.doModal()
            if (keyboard.isConfirmed()):
                title = keyboard.getText()
                if ( title == "" ):
                    title = self.categories[categoryID]["name"]
                self.categories[categoryID]["name"] = title.rstrip()
                self._save_launchers()
        if (type2 == 1 ):
            # Edition of the category genre
            keyboard = xbmc.Keyboard(self.categories[categoryID]["genre"], __language__( 30040 ))
            keyboard.doModal()
            if (keyboard.isConfirmed()):
                self.categories[categoryID]["genre"] = keyboard.getText()
                self._save_launchers()
        if (type2 == 2 ):
            # Import category description
            text_file = xbmcgui.Dialog().browse(1,__language__( 30080 ),"files",".txt|.dat", False, False)
            if ( os.path.isfile(text_file) == True ):
                text_plot = open(text_file, 'r')
                self.categories[categoryID]["plot"] = text_plot.read()
                text_plot.close()
                self._save_launchers() 
Example #19
Source File: launcher_plugin.py    From advanced-launcher with GNU General Public License v2.0 5 votes vote down vote up
def _full_scrap_rom(self, launcher, rom):
        # Edition of the rom name
        title=os.path.basename(self.launchers[launcher]["roms"][rom]["filename"]).split(".")[0]
        if ( self.launchers[launcher]["application"].lower().find('mame') > 0 ) or ( self.settings[ "datas_scraper" ] == 'arcadeHITS' ):
            keyboard = xbmc.Keyboard(title, __language__( 30079 ))
        else:
            keyboard = xbmc.Keyboard(self.launchers[launcher]["roms"][rom]["name"], __language__( 30036 ))
        keyboard.doModal()
        if (keyboard.isConfirmed()):
            self._scrap_rom_algo(launcher, rom, keyboard.getText())
            self._scrap_thumb_rom_algo(launcher, rom, keyboard.getText())
            self._scrap_fanart_rom_algo(launcher, rom, keyboard.getText())
            self._save_launchers()
            xbmc.executebuiltin("Container.Update") 
Example #20
Source File: launcher_plugin.py    From advanced-launcher with GNU General Public License v2.0 5 votes vote down vote up
def _scrap_rom(self, launcher, rom):
        # Edition of the rom name
        title=os.path.basename(self.launchers[launcher]["roms"][rom]["filename"]).split(".")[0]
        if ( self.launchers[launcher]["application"].lower().find('mame') > 0 ) or ( self.settings[ "datas_scraper" ] == 'arcadeHITS' ):
            keyboard = xbmc.Keyboard(title, __language__( 30079 ))
        else:
            keyboard = xbmc.Keyboard(self.launchers[launcher]["roms"][rom]["name"], __language__( 30036 ))
        keyboard.doModal()
        if (keyboard.isConfirmed()):
            self._scrap_rom_algo(launcher, rom, keyboard.getText())
            self._save_launchers()
        xbmc.executebuiltin("Container.Update") 
Example #21
Source File: launcher_plugin.py    From advanced-launcher with GNU General Public License v2.0 5 votes vote down vote up
def _scrap_fanart_launcher(self, launcherID):
        keyboard = xbmc.Keyboard(self.launchers[launcherID]["name"], __language__( 30036 ))
        keyboard.doModal()
        if (keyboard.isConfirmed()):
            self._scrap_fanart_launcher_algo(launcherID, keyboard.getText())
        xbmc.executebuiltin("Container.Update") 
Example #22
Source File: launcher_plugin.py    From advanced-launcher with GNU General Public License v2.0 5 votes vote down vote up
def _scrap_fanart_rom(self, launcher, rom):
        if ( self.launchers[launcher]["application"].lower().find('mame') > 0 ) or ( self.settings[ "fanarts_scraper" ] == 'arcadeHITS' ):
            title=os.path.basename(self.launchers[launcher]["roms"][rom]["filename"]).split(".")[0]
            keyboard = xbmc.Keyboard(title, __language__( 30079 ))
        else:
            keyboard = xbmc.Keyboard(self.launchers[launcher]["roms"][rom]["name"], __language__( 30036 ))
        keyboard.doModal()
        if (keyboard.isConfirmed()):
            self._scrap_fanart_rom_algo(launcher, rom, keyboard.getText())
        xbmc.executebuiltin("Container.Update") 
Example #23
Source File: launcher_plugin.py    From advanced-launcher with GNU General Public License v2.0 5 votes vote down vote up
def _scrap_thumb_category(self, categoryID):
        keyboard = xbmc.Keyboard(self.categories[categoryID]["name"], __language__( 30036 ))
        keyboard.doModal()
        if (keyboard.isConfirmed()):
            self._scrap_thumb_category_algo(categoryID, keyboard.getText())
        xbmc.executebuiltin("Container.Update") 
Example #24
Source File: launcher_plugin.py    From advanced-launcher with GNU General Public License v2.0 5 votes vote down vote up
def _scrap_thumb_launcher(self, launcherID):
        keyboard = xbmc.Keyboard(self.launchers[launcherID]["name"], __language__( 30036 ))
        keyboard.doModal()
        if (keyboard.isConfirmed()):
            self._scrap_thumb_launcher_algo(launcherID, keyboard.getText())
        xbmc.executebuiltin("Container.Update") 
Example #25
Source File: launcher_plugin.py    From advanced-launcher with GNU General Public License v2.0 5 votes vote down vote up
def _scrap_thumb_rom(self, launcher, rom):
        if ( self.launchers[launcher]["application"].lower().find('mame') > 0 ) or ( self.settings[ "thumbs_scraper" ] == 'arcadeHITS' ):
            title=os.path.basename(self.launchers[launcher]["roms"][rom]["filename"]).split(".")[0]
            keyboard = xbmc.Keyboard(title, __language__( 30079 ))
        else:
            keyboard = xbmc.Keyboard(self.launchers[launcher]["roms"][rom]["name"], __language__( 30036 ))
        keyboard.doModal()
        if (keyboard.isConfirmed()):
            self._scrap_thumb_rom_algo(launcher, rom, keyboard.getText())
        xbmc.executebuiltin("Container.Update") 
Example #26
Source File: megogo2xbmc.py    From ru with GNU General Public License v2.0 5 votes vote down vote up
def run_search(params):
    usearch = params.get('usearch', False)
    if not usearch:
        kbd = xbmc.Keyboard()
        kbd.setDefault('')
        kbd.setHeading('Поиск')
        kbd.doModal()
        out=''
        if kbd.isConfirmed():
            out = kbd.getText()
            params['text']=out
    params['offset']='0'
    params['limit']='10'
    search(params) 
Example #27
Source File: default.py    From kodi with GNU General Public License v3.0 5 votes vote down vote up
def edit_title(title):
    if check_is_edit(title) == True:
        kbd = xbmc.Keyboard()
        kbd.setDefault(title)
        kbd.setHeading('Edit title')
        kbd.doModal()
        if kbd.isConfirmed():
            title = kbd.getText()
        else: 
            title = ""
    return title 
Example #28
Source File: default.py    From kodi with GNU General Public License v3.0 5 votes vote down vote up
def get_user_input(self):
        kbd = xbmc.Keyboard()
        kbd.setDefault('')
        kbd.setHeading(self.language(2000))
        kbd.doModal()
        keyword = None
        if kbd.isConfirmed():
                keyword = kbd.getText()
        return keyword 
Example #29
Source File: default.py    From kodi with GNU General Public License v3.0 5 votes vote down vote up
def get_user_input(self):
        kbd = xbmc.Keyboard()
        kbd.setDefault('')
        kbd.setHeading(self.language(1000))
        kbd.doModal()
        keyword = None

        if kbd.isConfirmed():
            keyword = kbd.getText()

        return keyword 
Example #30
Source File: launcher_plugin.py    From advanced-launcher with GNU General Public License v2.0 5 votes vote down vote up
def _full_scrap_launcher(self, launcherID):
        # Edition of the launcher name
        keyboard = xbmc.Keyboard(self.launchers[launcherID]["name"], __language__( 30036 ))
        keyboard.doModal()
        if (keyboard.isConfirmed()):
            self._scrap_launcher_algo(launcherID, keyboard.getText())
            self._scrap_thumb_launcher_algo(launcherID, keyboard.getText())
            self._scrap_fanart_launcher_algo(launcherID, keyboard.getText())
            self._save_launchers()
            xbmc.executebuiltin("Container.Update")