Python xbmcgui.Dialog() Examples

The following are 30 code examples of xbmcgui.Dialog(). 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: default.py    From bugatsinho.github.io with GNU General Public License v3.0 6 votes vote down vote up
def instant_mix_album():
    menu_texts = []
    menu_texts.append("All Albums")
    dialog = xbmcgui.Dialog()
    if os.path.isfile(FAV_ALBUM):
        s = read_from_file(FAV_ALBUM)
        search_list = s.split('\n')
        for list in search_list:
            if list != '':
                list1 = list.split('<>')
                try:
                    plname = list1[3]
                    if not plname in menu_texts:
                        menu_texts.append(plname)
                except:
                    if not "Ungrouped" in menu_texts:
                        menu_texts.append("Ungrouped")
    menu_id = dialog.select('Select Group', menu_texts)
    if(menu_id < 0):
        return (None, None)
        dialog.close()
    groupname = menu_texts[menu_id]
    shuffleThread = ShuffleAlbumThread(groupname)
    shuffleThread.start() 
Example #2
Source File: program.py    From script.tvtime with GNU General Public License v2.0 6 votes vote down vote up
def Authorization(verification_url, user_code, device_code):
    pDialog = xbmcgui.DialogProgress()
    pDialog.create(__scriptname__, "%s: %s" % (__language__(33806), verification_url), "%s: %s" % (__language__(33807), user_code))
    for i in range(0, 100):
        pDialog.update(i)
        xbmc.sleep(5000)  
        if pDialog.iscanceled(): return
        _authorize = Authorize(device_code)
        if _authorize.is_authorized:
            __addon__.setSetting('token', _authorize.access_token)
            user = GetUserInformations(_authorize.access_token)
            if user.is_authenticated:
                if __welcome__ == 'true':
                    xbmcgui.Dialog().ok(__scriptname__, '%s %s' % (__language__(32902), user.username), __language__(33808))
                __addon__.setSetting('user', user.username)
            return
    pDialog.close() 
Example #3
Source File: program.py    From script.tvtime with GNU General Public License v2.0 6 votes vote down vote up
def start():
    menuitems = []
    if __token__ is '':
        menuitems.append(__language__(33801))
    else:
        menuitems.append(__language__(33803))
        menuitems.append(__language__(33802))
    startmenu = xbmcgui.Dialog().select(__scriptname__, menuitems)
    if startmenu < 0: return
    elif startmenu == 0 and __token__ is '':
        _login = GetCode()
        if _login.is_code:
            Authorization(_login.verification_url, _login.user_code, _login.device_code)
        else:
            xbmcgui.Dialog().ok(__scriptname__, __language__(33804))
    elif startmenu == 1:
        logout = xbmcgui.Dialog().yesno(__scriptname__, __language__(33805))
        if logout == True:
            __addon__.setSetting('token', '')
            __addon__.setSetting('user', '')
            return
        start()
    else:
        first_step() 
Example #4
Source File: cache.py    From bugatsinho.github.io with GNU General Public License v3.0 6 votes vote down vote up
def clear(table=None):
    try:
        execute('Dialog.Close(busydialog)')

        if table == None: table = ['rel_list', 'rel_lib']
        elif not type(table) == list: table = [table]

        yes = dialog.yesno(heading=xbmcaddon.Addon().getAddonInfo('name'), line1=xbmcaddon.Addon().getLocalizedString(30401).encode('utf-8'))
        if not yes: return

        dbcon = database.connect(os.path.join(dataPath, 'cache.db'))
        dbcur = dbcon.cursor()

        for t in table:
            try:
                dbcur.execute("DROP TABLE IF EXISTS %s" % t)
                dbcur.execute("VACUUM")
                dbcon.commit()
            except:
                pass

        dialog.notification(heading=xbmcaddon.Addon().getAddonInfo('name'), message=xbmcaddon.Addon().getLocalizedString(30402).encode('utf-8'), time=2000, sound=False)
    except:
        pass 
Example #5
Source File: editor.py    From script.tvguide.fullscreen with GNU General Public License v2.0 6 votes vote down vote up
def enter_credentials(is_change=False):
    global user, passw
    default_user = ''
    default_pass = ''
    if is_change:
        default_user = user
    keyb = xbmc.Keyboard(default_user, 'Enter Username')
    keyb.doModal()
    if keyb.isConfirmed():
        user = keyb.getText()
        keyb = xbmc.Keyboard(default_pass, 'Enter Password:', True)
        keyb.doModal()
        if keyb.isConfirmed():
            xbmcgui.Dialog().notification(ADDON.getAddonInfo('name'), 'Checking login...',
                                          os.path.join(PATH, 'icon.png'), 1500)
            passw = hashlib.sha1(keyb.getText().encode('utf-8')).hexdigest()
            sd = SdAPI(user=user, passw=passw)
            if sd.logged_in:
                save_setting('sd.username', user)
                save_setting('sd.password', passw)
                xbmcgui.Dialog().notification(ADDON.getAddonInfo('name'), 'Login saved',
                                              os.path.join(PATH, 'icon.png'), 2000)
                return True
    return False 
Example #6
Source File: dialogbase.py    From romcollectionbrowser with GNU General Public License v2.0 6 votes vote down vote up
def editPathWithFileMask(self, controlId, enterString, controlIdFilemask):

        dialog = xbmcgui.Dialog()

        #get new value
        pathValue = dialog.browse(0, enterString, 'files')

        control = self.getControlById(controlId)

        util.setLabel(pathValue, control)

        control = self.getControlById(controlIdFilemask)
        filemask = util.getLabel(control)
        pathComplete = os.path.join(pathValue, filemask.strip())

        return pathComplete 
Example #7
Source File: launcher.py    From romcollectionbrowser with GNU General Public License v2.0 6 votes vote down vote up
def __getNames7z(self, filepath):

        try:
            import py7zlib
        except ImportError as e:
            #32039 = Error launching .7z file.
            #32129 = Please check kodi.log for details.
            message = "%s[CR]%s" %(util.localize(32039), util.localize(32129))
            xbmcgui.Dialog().ok(util.SCRIPTNAME, message)
            msg = ("You have tried to launch a .7z file but you are missing required libraries to extract the file. "
                   "You can download the latest RCB version from RCBs project page. It contains all required libraries.")
            log.error(msg)
            log.error("Error: " + str(e))
            return None

        fp = open(str(filepath), 'rb')
        archive = py7zlib.Archive7z(fp)
        names = archive.getnames()
        fp.close()
        return names 
Example #8
Source File: cache.py    From bugatsinho.github.io with GNU General Public License v3.0 6 votes vote down vote up
def clear(table=None):
    try:
        execute('Dialog.Close(busydialog)')

        if table == None: table = ['rel_list', 'rel_lib']
        elif not type(table) == list: table = [table]

        yes = dialog.yesno(heading=xbmcaddon.Addon().getAddonInfo('name'), line1=xbmcaddon.Addon().getLocalizedString(30401).encode('utf-8'))
        if not yes: return

        dbcon = database.connect(os.path.join(dataPath, 'cache.db'))
        dbcur = dbcon.cursor()

        for t in table:
            try:
                dbcur.execute("DROP TABLE IF EXISTS %s" % t)
                dbcur.execute("VACUUM")
                dbcon.commit()
            except:
                pass

        dialog.notification(heading=xbmcaddon.Addon().getAddonInfo('name'), message=xbmcaddon.Addon().getLocalizedString(30402).encode('utf-8'), time=2000, sound=False)
    except:
        pass 
Example #9
Source File: xbmclibrary.py    From plugin.video.ustvvod with GNU General Public License v2.0 6 votes vote down vote up
def __init__( self ):
		sources = xbmc.translatePath('special://profile/sources.xml')
		file = open(sources, 'r')
		source_data = file.read()
		file.close()
		source_tree = BeautifulSoup(source_data, 'html.parser')
		tv_path = source_tree.find('path', text = TV_SHOWS_PATH)
		movie_path = source_tree.find('path', text = MOVIE_PATH)
		msg = ""
		if tv_path is None:
			msg = "No source for " + TV_SHOWS_PATH + "\n"
		if movie_path is None:
			msg = "No source for " + MOVIE_PATH + "\n"
		if msg != "":
			dialog = xbmcgui.Dialog()
			dialog.ok(addon.getLocalizedString(39042), msg)
		else:
			dialog = xbmcgui.Dialog()
			dialog.ok(addon.getLocalizedString(39042), "Sources OK") 
Example #10
Source File: contextmenu.py    From plugin.video.ustvvod with GNU General Public License v2.0 6 votes vote down vote up
def select_quality():
	show_title, season, episode, thumb, displayname, qmode, url = args.url.split('<join>')
	common.args = _Info(url.split('?')[1].replace('&', ' , '))
	network = common.get_network(common.args.mode)
	resultlist = getattr(network, qmode)()
	select = xbmcgui.Dialog()
	title = addon.getLocalizedString(39022)
	resultset = set(resultlist)
	resultlist = list(resultset)
	resultlist = sorted(resultlist)
	ret = select.select(title, [str(quality[0]) for quality in resultlist])
	bitrate = resultlist[ret][1]
	setattr(common.args, 'name', base64.b64decode(displayname))
	setattr(common.args, 'quality', bitrate)
	setattr(common.args, 'thumb', thumb)
	setattr(common.args, 'episode_number', int(episode))
	setattr(common.args, 'season_number', int(season))
	setattr(common.args, 'show_title', show_title)
	getattr(network, common.args.sitemode)() 
Example #11
Source File: contextmenu.py    From plugin.video.ustvvod with GNU General Public License v2.0 6 votes vote down vote up
def export_fav():
	print 'fav'
	dialog = xbmcgui.Dialog()
	print 'd'
	try:
		r = dialog.browse(3, 'Folder', 'files')
		print r
		path = os.path.join(r, 'favorites.txt')
		shows = common.fetch_showlist(1)
		sd = {}
		for show in shows:
			sd[show[0]] = show
		import json
		with open(path, 'w') as outfile:
			json.dump(sd, outfile)
		
	except Exception,e:
		print e 
Example #12
Source File: downloader.py    From bugatsinho.github.io with GNU General Public License v3.0 6 votes vote down vote up
def done(title, dest, downloaded):
    playing = xbmc.Player().isPlaying()

    text = xbmcgui.Window(10000).getProperty('GEN-DOWNLOADED')

    if len(text) > 0:
        text += '[CR]'

    if downloaded:
        text += '%s : %s' % (dest.rsplit(os.sep)[-1], '[COLOR forestgreen]Download succeeded[/COLOR]')
    else:
        text += '%s : %s' % (dest.rsplit(os.sep)[-1], '[COLOR red]Download failed[/COLOR]')

    xbmcgui.Window(10000).setProperty('GEN-DOWNLOADED', text)

    if (not downloaded) or (not playing):
        xbmcgui.Dialog().ok(title, text)
        xbmcgui.Window(10000).clearProperty('GEN-DOWNLOADED') 
Example #13
Source File: utils.py    From plugin.video.emby with GNU General Public License v3.0 6 votes vote down vote up
def dialog(dialog_type, *args, **kwargs):

    d = xbmcgui.Dialog()

    if "icon" in kwargs:
        kwargs['icon'] = kwargs['icon'].replace("{emby}",
                                                "special://home/addons/plugin.video.emby/icon.png")
    if "heading" in kwargs:
        kwargs['heading'] = kwargs['heading'].replace("{emby}", _('addon_name'))

    types = {
        'yesno': d.yesno,
        'ok': d.ok,
        'notification': d.notification,
        'input': d.input,
        'select': d.select,
        'numeric': d.numeric,
        'multi': d.multiselect,
        'textviewer': d.textviewer
    }
    return types[dialog_type](*args, **kwargs) 
Example #14
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 #15
Source File: contextmenu.py    From plugin.video.ustvvod with GNU General Public License v2.0 6 votes vote down vote up
def del_fav():
	print 'del fav'
	dialog = xbmcgui.Dialog()
	try:
		r = dialog.yesno('Delete All Favorites' ,'Are you sure?')
		if r:
			print 'Deleting favorites'
			common.del_favorites()
		# path = os.path.join(r, 'favorites.txt')
		# shows = common.fetch_showlist(1)
		# sd = {}
		# for show in shows:
			# sd[show[0]] = show
		# import json
		# with open(path, 'w') as outfile:
			# json.dump(sd, outfile)
		
	except Exception,e:
		print e 
Example #16
Source File: dialogcontextmenu.py    From romcollectionbrowser with GNU General Public License v2.0 6 votes vote down vote up
def rescrape_game(self):
        log.info("rescrape_game")
        if self.selectedGame is None:
            #32013 = Rescrape game error
            #32014 = Can't load selected Game
            message = "%s[CR]%s" %(util.localize(32013), util.localize(32014))
            xbmcgui.Dialog().ok(util.SCRIPTNAME, message)
            return

        romCollectionId = self.selectedGame.getProperty('romCollectionId')
        romCollection = self.gui.config.romCollections[str(romCollectionId)]
        files = File(self.gui.gdb).getRomsByGameId(self.selectedGame.getProperty('gameId'))
        filename = files[0][0]
        romCollection.romPaths = (filename,)

        romCollections = {}
        romCollections[romCollection.id] = romCollection

        self.gui.rescrapeGames(romCollections) 
Example #17
Source File: control.py    From bugatsinho.github.io with GNU General Public License v3.0 5 votes vote down vote up
def idle():

    if float(addon('xbmc.addon').getAddonInfo('version')[:4]) > 17.6:
        execute('Dialog.Close(busydialognocancel)')
    else:
        execute('Dialog.Close(busydialog)') 
Example #18
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 #19
Source File: wizardconfigxml.py    From romcollectionbrowser with GNU General Public License v2.0 5 votes vote down vote up
def promptArtworkPath(self, console, startingDirectory):
        """ Prompt the user to browse to the artwork path """
        dialog = xbmcgui.Dialog()
        # http://kodi.wiki/view/Add-on_unicode_paths
        artworkPath = util.convertToUnicodeString(dialog.browse(0, util.localize(32193) % console, 'files', '', False, False,
                                    startingDirectory))
        log.debug(u"artworkPath selected: {0}".format(artworkPath))

        return artworkPath 
Example #20
Source File: wizardconfigxml.py    From romcollectionbrowser with GNU General Public License v2.0 5 votes vote down vote up
def promptRomPath(self, consolename):
        """ Prompt the user to browse to the rompath """
        dialog = xbmcgui.Dialog()
        # http://kodi.wiki/view/Add-on_unicode_paths
        romPath = util.convertToUnicodeString(dialog.browse(0, util.localize(32180) % consolename, 'files'))
        log.debug(u"rompath selected: {0}".format(romPath))

        return romPath 
Example #21
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 #22
Source File: service.py    From plugin.video.sendtokodi with MIT License 5 votes vote down vote up
def showErrorNotification(message):
    xbmcgui.Dialog().notification("SendToKodi", message,
                                  xbmcgui.NOTIFICATION_ERROR, 5000)


# Get the plugin url in plugin:// notation. 
Example #23
Source File: control.py    From bugatsinho.github.io with GNU General Public License v3.0 5 votes vote down vote up
def __exit__(self, type, value, traceback):
        if self.wd is not None:
            self.wd.close()
        else:
            execute('Dialog.Close(busydialog)') 
Example #24
Source File: control.py    From bugatsinho.github.io with GNU General Public License v3.0 5 votes vote down vote up
def idle():
    return execute('Dialog.Close(busydialog)') 
Example #25
Source File: default.py    From bugatsinho.github.io with GNU General Public License v3.0 5 votes vote down vote up
def favourite_albums():
    menu_texts = []
    menu_texts.append("All Albums")
    dialog = xbmcgui.Dialog()
    if os.path.isfile(FAV_ALBUM):
        s = read_from_file(FAV_ALBUM)
        search_list = s.split('\n')
        for list in search_list:
            if list != '':
                list1 = list.split('<>')
                try:
                    plname = list1[3]
                    if not plname in menu_texts:
                        menu_texts.append(plname)
                except:
                    if not "Ungrouped" in menu_texts:
                        menu_texts.append("Ungrouped")
    menu_id = dialog.select('Select Group', menu_texts)
    if(menu_id < 0):
        return (None, None)
        dialog.close()
    groupname = menu_texts[menu_id]
    if os.path.isfile(FAV_ALBUM):
        s = read_from_file(FAV_ALBUM)
        search_list = s.split('\n')
        for list in search_list:
            if list != '':
                list1 = list.split('<>')
                title = list1[0]
                url = list1[1]
                thumb = list1[2]
                try:
                    plname = list1[3]
                except:
                    plname = "Ungrouped"
                if (plname == groupname) or groupname == "All Albums":
                    addDir(title.replace('&amp;', '&').upper(),url,5,thumb,plname + 'qqalbums') 
Example #26
Source File: default.py    From bugatsinho.github.io with GNU General Public License v3.0 5 votes vote down vote up
def favourite_songs():
    menu_texts = []
    menu_texts.append("All Songs")
    dialog = xbmcgui.Dialog()
    if os.path.isfile(FAV_SONG):
        s = read_from_file(FAV_SONG)
        search_list = s.split('\n')
        for list in search_list:
            if list != '':
                list1 = list.split('<>')
                try:
                    plname = list1[5]
                    if not plname in menu_texts:
                        menu_texts.append(plname)
                except:
                    if not "Ungrouped" in menu_texts:
                        menu_texts.append("Ungrouped")
    menu_id = dialog.select('Select Group', menu_texts)
    if(menu_id < 0):
        return (None, None)
        dialog.close()
    groupname = menu_texts[menu_id]
    if os.path.isfile(FAV_SONG):
        s = read_from_file(FAV_SONG)
        search_list = s.split('\n')
        for list in search_list:
            if list != '':
                list1 = list.split('<>')
                artist = list1[0]
                album = list1[1]
                title = list1[2]
                url = list1[3].replace('listen.musicmp3.ru', 'files.musicmp3.ru/lofi')
                iconimage = list1[4]
                try:
                    plname = list1[5]
                except:
                    plname = "Ungrouped"
                text = "%s - %s - %s" % (title, artist, album)
                if (plname == groupname) or groupname == "All Songs":
                    addDirAudio(text.upper(),url,10,iconimage,title,artist,album,'qq' + plname,'favsong') 
Example #27
Source File: control.py    From bugatsinho.github.io with GNU General Public License v3.0 5 votes vote down vote up
def idle():
    return execute('Dialog.Close(busydialog)') 
Example #28
Source File: cache.py    From bugatsinho.github.io with GNU General Public License v3.0 5 votes vote down vote up
def idle():

    if float(xbmcaddon.Addon('xbmc.addon').getAddonInfo('version')[:4]) > 17.6:
        xbmc.executebuiltin('Dialog.Close(busydialognocancel)')
    else:
        xbmc.executebuiltin('Dialog.Close(busydialog)') 
Example #29
Source File: main.py    From bugatsinho.github.io with GNU General Public License v3.0 5 votes vote down vote up
def idle():

    if float(xbmcaddon.Addon('xbmc.addon').getAddonInfo('version')[:4]) > 17.6:
        xbmc.executebuiltin('Dialog.Close(busydialognocancel)')
    else:
        xbmc.executebuiltin('Dialog.Close(busydialog)') 
Example #30
Source File: default.py    From bugatsinho.github.io with GNU General Public License v3.0 5 votes vote down vote up
def add_favourite_song(name, url, dir, text):
    menu_texts = []
    menu_texts.append("Add New Group")
    dialog = xbmcgui.Dialog()
    if os.path.isfile(FAV_SONG):
        s = read_from_file(FAV_SONG)
        search_list = s.split('\n')
        for list in search_list:
            if list != '':
                list1 = list.split('<>')
                try:
                    plname = list1[5]
                    if not plname in menu_texts:
                        menu_texts.append(plname)
                except:
                    pass
    menu_id = dialog.select('Select Group', menu_texts)
    if(menu_id < 0):
        return (None, None)
        dialog.close()
    if (menu_id == 0):
        keyboard = xbmc.Keyboard('', 'Create New Group', False)
        keyboard.doModal()
        if keyboard.isConfirmed():
            query = keyboard.getText()
            if len(query) > 0:
                plname = query
    else:
        plname = menu_texts[menu_id]
    splitdata = url.split('<>')
    artist = splitdata[0]
    album = splitdata[1]
    songname = splitdata[2]
    url1 = splitdata[3]
    iconimage = splitdata[4]
    url = "%s<>%s" % (url, plname)
    add_to_list(url, dir, False)
    notification(songname.upper(), "[COLOR lime]" + text + "[/COLOR]", '5000',iconimage)