本文整理汇总了Python中xbmcgui.Dialog方法的典型用法代码示例。如果您正苦于以下问题:Python xbmcgui.Dialog方法的具体用法?Python xbmcgui.Dialog怎么用?Python xbmcgui.Dialog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xbmcgui
的用法示例。
在下文中一共展示了xbmcgui.Dialog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dialog
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import Dialog [as 别名]
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)
示例2: export_fav
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import Dialog [as 别名]
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
示例3: del_fav
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import Dialog [as 别名]
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
示例4: select_quality
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import Dialog [as 别名]
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)()
示例5: __init__
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import Dialog [as 别名]
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")
示例6: enter_credentials
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import Dialog [as 别名]
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
示例7: done
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import Dialog [as 别名]
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')
示例8: instant_mix_album
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import Dialog [as 别名]
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()
示例9: clear
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import Dialog [as 别名]
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
示例10: start
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import Dialog [as 别名]
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()
示例11: Authorization
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import Dialog [as 别名]
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()
示例12: editPathWithFileMask
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import Dialog [as 别名]
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
示例13: __getNames7z
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import Dialog [as 别名]
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
示例14: rescrape_game
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import Dialog [as 别名]
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)
示例15: edit_game_command
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import Dialog [as 别名]
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()