Python xbmcgui.Window() Examples

The following are 30 code examples of xbmcgui.Window(). 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: common.py    From service.vpn.manager with GNU General Public License v2.0 6 votes vote down vote up
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 
Example #2
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 #3
Source File: common.py    From service.vpn.manager with GNU General Public License v2.0 6 votes vote down vote up
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 
Example #4
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 #5
Source File: ipinfo.py    From service.vpn.manager with GNU General Public License v2.0 6 votes vote down vote up
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] 
Example #6
Source File: playerMP3.py    From bugatsinho.github.io with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #7
Source File: common.py    From service.vpn.manager with GNU General Public License v2.0 5 votes vote down vote up
def resumeConfigUpdate():
    # This can be used to resume config updates
    xbmcgui.Window(10000).setProperty("VPN_Manager_Update_Suspend", "")
    updateService("resumeConfigUpdate") 
Example #8
Source File: common.py    From service.vpn.manager with GNU General Public License v2.0 5 votes vote down vote up
def ackStop():    
    # Routine for service to call to acknowledge service has stopped
    xbmcgui.Window(10000).setProperty("VPN_Manager_Service_Control", "stopped") 
Example #9
Source File: common.py    From service.vpn.manager with GNU General Public License v2.0 5 votes vote down vote up
def resumeStartStop(state):
    # This can be used to resume service checking, returning to a previous known state (or pass in an empty string)
    xbmcgui.Window(10000).setProperty("VPN_Manager_Service_Control", state) 
Example #10
Source File: common.py    From service.vpn.manager with GNU General Public License v2.0 5 votes vote down vote up
def suspendConfigUpdate():
    # This will stop any config updates from happening
    xbmcgui.Window(10000).setProperty("VPN_Manager_Update_Suspend", "true") 
Example #11
Source File: vpnapi.py    From service.vpn.manager with GNU General Public License v2.0 5 votes vote down vote up
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 
Example #12
Source File: common.py    From service.vpn.manager with GNU General Public License v2.0 5 votes vote down vote up
def setConnectChange():
    xbmcgui.Window(10000).setProperty("VPN_Manager_Last_Connection_Change", str(int(time.time()))) 
Example #13
Source File: common.py    From service.vpn.manager with GNU General Public License v2.0 5 votes vote down vote up
def forceReconnect(state):
    xbmcgui.Window(10000).setProperty("VPN_Manager_Force_Reconnect", state) 
Example #14
Source File: common.py    From service.vpn.manager with GNU General Public License v2.0 5 votes vote down vote up
def isVPNMonitorRunning():
    if xbmcgui.Window(10000).getProperty("VPN_Manager_Monitor_State") == "Started": return True
    else: return False 
Example #15
Source File: common.py    From service.vpn.manager with GNU General Public License v2.0 5 votes vote down vote up
def setVPNMonitorState(state):
    xbmcgui.Window(10000).setProperty("VPN_Manager_Monitor_State", state) 
Example #16
Source File: common.py    From service.vpn.manager with GNU General Public License v2.0 5 votes vote down vote up
def getVPNMonitorState():
    return xbmcgui.Window(10000).getProperty("VPN_Manager_Monitor_State") 
Example #17
Source File: vpnapi.py    From service.vpn.manager with GNU General Public License v2.0 5 votes vote down vote up
def getConnected(self):
        return xbmcgui.Window(10000).getProperty("VPN_Manager_Connected_Profile_Name") 
Example #18
Source File: common.py    From service.vpn.manager with GNU General Public License v2.0 5 votes vote down vote up
def forceCycleLock():
    # Loop until we get the lock, or have waited for 10 seconds
    i = 0
    while i < 10 and not xbmcgui.Window(10000).getProperty("VPN_Manager_Cycle_Lock") == "":
        xbmc.sleep(1000)
        i = i + 1
    xbmcgui.Window(10000).setProperty("VPN_Manager_Cycle_Lock", "Forced Locked") 
Example #19
Source File: common.py    From service.vpn.manager with GNU General Public License v2.0 5 votes vote down vote up
def stopRequested():
    # Routine for service to call in order to determine whether to stop
    if xbmcgui.Window(10000).getProperty("VPN_Manager_Service_Control") == "stop": return True
    return False 
Example #20
Source File: common.py    From service.vpn.manager with GNU General Public License v2.0 5 votes vote down vote up
def startRequested():
    # Service routine should call this to wait for permission to restart.  
    if xbmcgui.Window(10000).getProperty("VPN_Manager_Service_Control") == "start": return True
    return False 
Example #21
Source File: common.py    From service.vpn.manager with GNU General Public License v2.0 5 votes vote down vote up
def ackStart():
    # Routine for service to call to acknowledge service has started
    xbmcgui.Window(10000).setProperty("VPN_Manager_Service_Control", "started") 
Example #22
Source File: common.py    From service.vpn.manager with GNU General Public License v2.0 5 votes vote down vote up
def clearServiceState():
    # Clear the service state during initialisation.  It can get funky on an upgrade
	xbmcgui.Window(10000).setProperty("VPN_Manager_Service_Control", "start") 
Example #23
Source File: common.py    From service.vpn.manager with GNU General Public License v2.0 5 votes vote down vote up
def getVPNState():
	# Store current state
    return xbmcgui.Window(10000).getProperty("VPN_Manager_VPN_State") 
Example #24
Source File: common.py    From service.vpn.manager with GNU General Public License v2.0 5 votes vote down vote up
def setVPNState(state):
	# Store current state - "off" (deliberately), "stopped", "started", "" (at boot) or "unknown" (error)
    xbmcgui.Window(10000).setProperty("VPN_Manager_VPN_State", state)
    return 
Example #25
Source File: common.py    From service.vpn.manager with GNU General Public License v2.0 5 votes vote down vote up
def getConnectionErrorCount():
    # Return the number of times a connection retry has failed
    err = xbmcgui.Window(10000).getProperty("VPN_Manager_Connection_Errors")
    if err == "": return 0
    return int(xbmcgui.Window(10000).getProperty("VPN_Manager_Connection_Errors")) 
Example #26
Source File: common.py    From service.vpn.manager with GNU General Public License v2.0 5 votes vote down vote up
def setConnectionErrorCount(count):
    # Return the number of times a connection retry has failed
    xbmcgui.Window(10000).setProperty("VPN_Manager_Connection_Errors", str(count)) 
Example #27
Source File: common.py    From service.vpn.manager with GNU General Public License v2.0 5 votes vote down vote up
def setVPNRequestedServer(server_name):
    # Store server name
    xbmcgui.Window(10000).setProperty("VPN_Manager_Requested_Server_Name", server_name)
    return 
Example #28
Source File: common.py    From service.vpn.manager with GNU General Public License v2.0 5 votes vote down vote up
def getVPNServer():
    # Return server name
    return xbmcgui.Window(10000).getProperty("VPN_Manager_Connected_Server_Name") 
Example #29
Source File: common.py    From service.vpn.manager with GNU General Public License v2.0 5 votes vote down vote up
def setVPNServer(server_name):
    # Store server name
    xbmcgui.Window(10000).setProperty("VPN_Manager_Connected_Server_Name", server_name)
    return 
Example #30
Source File: common.py    From service.vpn.manager with GNU General Public License v2.0 5 votes vote down vote up
def getVPNProfileFriendly():
    # Return shortened profile name
    return xbmcgui.Window(10000).getProperty("VPN_Manager_Connected_Profile_Friendly_Name")