本文整理汇总了Python中xbmcgui.Window方法的典型用法代码示例。如果您正苦于以下问题:Python xbmcgui.Window方法的具体用法?Python xbmcgui.Window怎么用?Python xbmcgui.Window使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xbmcgui
的用法示例。
在下文中一共展示了xbmcgui.Window方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: done
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import Window [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')
示例2: stopDownloaders
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import Window [as 别名]
def stopDownloaders():
log('in STOPDOWNLOADERS')
#signal all downloaders to stop
for i in range(MAX_DOWNLOADERS):
state = xbmcgui.Window(10000).getProperty(PROPERTY % i)
if state:
xbmcgui.Window(10000).setProperty(PROPERTY % i, 'Signal')
#now wait for them to all stop
i = 0
while i < MAX_DOWNLOADERS:
state = xbmcgui.Window(10000).getProperty(PROPERTY % i)
if state:
xbmc.sleep(100)
i = 0
else:
i += 1
示例3: getAutoSource
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import Window [as 别名]
def getAutoSource():
# If the VPN has changed, then reset all the numbers
addon = xbmcaddon.Addon(getID())
last_vpn = addon.getSetting("ip_service_last_vpn")
current_vpn = addon.getSetting("vpn_provider_validated")
if (not last_vpn == current_vpn):
addon.setSetting("ip_service_last_vpn", current_vpn)
resetIPServices()
# Get the last source we tried to use from the home window or use the first if this is first time through
source = xbmcgui.Window(10000).getProperty("VPN_Manager_Last_IP_Service")
if source == "":
# Record that we're using the first one
xbmcgui.Window(10000).setProperty("VPN_Manager_Last_IP_Service", ip_sources[1])
return ip_sources[1]
else:
index = ip_sources.index(source)
if index > 1:
if getWorkingValue(index) >= getErrorValue(index - 1):
setWorkingValue(index, 0)
index = index - 1
return ip_sources[index]
示例4: stopService
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import Window [as 别名]
def stopService():
# Routine for config to call to request service stops and waits until that happens
# Return true if the check should be bypassed
if xbmcgui.Window(10000).getProperty("VPN_Manager_Service_Control") == "ignore": return True
# Check to see if the service has stopped previously
if xbmcgui.Window(10000).getProperty("VPN_Manager_Service_Control") == "stopped": return True
debugTrace("Requesting service stops")
# Update start property and wait for service to respond or timeout
xbmcgui.Window(10000).setProperty("VPN_Manager_Service_Control", "stop")
for i in range (0, 30):
xbmc.sleep(1000)
if xbmcgui.Window(10000).getProperty("VPN_Manager_Service_Control") == "stopped": return True
# Haven't had a response in 30 seconds which is badness
errorTrace("common.py", "Couldn't communicate with VPN monitor service, didn't acknowledge a stop")
return False
示例5: getCycleLock
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import Window [as 别名]
def getCycleLock():
# If the lock is forced, don't wait, just return (ie don't queue)
if xbmcgui.Window(10000).getProperty("VPN_Manager_Cycle_Lock") == "Forced Locked" : return False
# If there's already a queue on the lock, don't wait, just return
if not xbmcgui.Window(10000).getProperty("VPN_Manager_Cycle_Lock_Queued") == "" : return False
# Loop until we get the lock or time out after 5 seconds
xbmcgui.Window(10000).setProperty("VPN_Manager_Cycle_Lock_Queued", "Queued")
i = 0
while i < 5 and not xbmcgui.Window(10000).getProperty("VPN_Manager_Cycle_Lock") == "":
xbmc.sleep(1000)
i = i + 1
# Free the queue so another call can wait on it
xbmcgui.Window(10000).setProperty("VPN_Manager_Cycle_Lock_Queued", "")
# Return false if a forced lock happened whilst we were queuing
if xbmcgui.Window(10000).getProperty("VPN_Manager_Cycle_Lock") == "Forced Locked" : return False
# Return false if the lock wasn't obtained because of a time out
if i == 5 : return False
xbmcgui.Window(10000).setProperty("VPN_Manager_Cycle_Lock", "Locked")
return True
示例6: __init__
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import Window [as 别名]
def __init__(self, w, h, *args, **kwargs):
self.window = xbmcgui.Window(WINDOW_FULLSCREEN_VIDEO)
viewport_w, viewport_h = self._get_skin_resolution()
# Adjust size based on viewport, we are using 1080p coordinates
w = int(w * viewport_w / VIEWPORT_WIDTH)
h = int(h * viewport_h / VIEWPORT_HEIGHT)
x = (viewport_w - w) / 2
y = (viewport_h - h) / 2
self._shown = False
self._text = ""
self._label = xbmcgui.ControlLabel(x, y, w, h, self._text, *args, **kwargs)
self._background = xbmcgui.ControlImage(x, y, w, h, os.path.join(RESOURCES_PATH, "images", "black.png"))
self._background.setColorDiffuse("0xD0000000")
示例7: window
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import Window [as 别名]
def window(key, value=None, clear=False, window_id=10000):
''' Get or set window properties.
'''
window = xbmcgui.Window(window_id)
if clear:
LOG.debug("--[ window clear: %s ]", key)
window.clearProperty(key.replace('.json', "").replace('.bool', ""))
elif value is not None:
if key.endswith('.json'):
key = key.replace('.json', "")
value = json.dumps(value)
elif key.endswith('.bool'):
key = key.replace('.bool', "")
value = "true" if value else "false"
window.setProperty(key, value)
else:
result = window.getProperty(key.replace('.json', "").replace('.bool', ""))
if result:
if key.endswith('.json'):
result = json.loads(result)
elif key.endswith('.bool'):
result = result in ("true", "1")
return result
示例8: getConnected
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import Window [as 别名]
def getConnected(self):
return xbmcgui.Window(10000).getProperty("VPN_Manager_Connected_Profile_Name")
示例9: setAPICommand
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import Window [as 别名]
def setAPICommand(self, profile):
# Set up the API command for the main service to act upon
# Shouldn't need to call this directly
xbmcgui.Window(10000).setProperty("VPN_Manager_API_Command", profile)
示例10: getCurrent
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import Window [as 别名]
def getCurrent(self):
# Compare the current connected VPN to the list of primary VPNs to see if one of the possible
# filtered connections is in use. Used by isFiltered, shouldn't be called directly
found = -1
current = xbmcgui.Window(10000).getProperty("VPN_Manager_Connected_Profile_Name")
if current == "": return found
# Adjust 10 below if changing number of conn_max
for i in range (0, 10):
if not self.primary_vpns[i] == "" and current == self.primary_vpns[i]:
found = i+1
return found
示例11: refreshLists
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import Window [as 别名]
def refreshLists(self):
# This function will refresh the list of filters and VPNs being used. It doesn't need to be called
# directly as it will be called before an add-on/window is checked if the data has changed
try:
changed = int(xbmcgui.Window(10000).getProperty("VPN_Manager_Lists_Last_Refreshed"))
except:
# If there's no refreshed time stamp, force a refresh with whatever data is available
changed = self.last_updated
if self.last_updated > changed:
return
# Get a handle to the VPN Mgr add-on to read the settings data
addon = xbmcaddon.Addon("service.vpn.manager")
del self.filtered_addons[:]
del self.filtered_windows[:]
del self.primary_vpns[:]
# Adjust 11 below if changing number of conn_max
for i in range (0, 11):
# Load up the list of primary VPNs
if i>0: self.primary_vpns.append(addon.getSetting(str(i)+"_vpn_validated"))
# Load up the addon filter list
addon_string = ""
if i == 0 : addon_string = addon.getSetting("vpn_excluded_addons")
else : addon_string = addon.getSetting(str(i)+"_vpn_addons")
if not addon_string == "" : self.filtered_addons.append(addon_string.split(","))
else : self.filtered_addons.append(None)
# Load up the window filter list
window_string = ""
if i == 0 : window_string = addon.getSetting("vpn_excluded_windows")
else : window_string = addon.getSetting(str(i)+"_vpn_windows")
if not window_string == "" : self.filtered_windows.append(window_string.split(","))
else : self.filtered_windows.append(None)
# Store the time the filters were last updated
self.last_updated = int(time.time())
示例12: getCurrentViewId
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import Window [as 别名]
def getCurrentViewId():
win = xbmcgui.Window(xbmcgui.getCurrentWindowId())
return str(win.getFocusId())
# for compartmentalized theme addons
示例13: clear
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import Window [as 别名]
def clear():
log('Clearing MP3 Streams Service')
global COUNT
global STARTED
if xbmcgui.Window(10000).getProperty(RESOLVING) != RESOLVING:
stopDownloaders()
resetCache()
else:
log('Clearing cancelled due to RESOLVING property')
COUNT = 0
STARTED = False
示例14: verifyFileSize
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import Window [as 别名]
def verifyFileSize(filename):
if not filename:
return True
ADDONID = 'plugin.audio.mp3streams'
ADDON = xbmcaddon.Addon(ADDONID)
precache = int(ADDON.getSetting('pre-cache').replace('K', ''))
filename = xbmc.translatePath(filename)
log('VERIFYING %s' % filename)
count = 100
while count > 0:
if xbmcgui.Window(10000).getProperty(filename) == 'EXCEPTION':
xbmcgui.Window(10000).clearProperty(filename)
log('Exception downloading %s' % filename)
return False
log('verifyFileSize %d' % count)
if xbmcvfs.exists(filename):
size = xbmcvfs.File(filename).size()
log('CURRENT SIZE = %d' % size)
if size == 212 and unavailable(filename):
return False
if size > precache * 1024:
log(size)
log('FILE SIZE VERIFIED!!')
return True
count -= 1
xbmc.sleep(500)
return False
示例15: getNmrDownloaders
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import Window [as 别名]
def getNmrDownloaders():
count = 0
for i in range(MAX_DOWNLOADERS):
state = xbmcgui.Window(10000).getProperty(PROPERTY % i)
if state:
count += 1
return count