示例#1
0
        setVPNMonitorState("Started")
        addon.setSetting("monitor_paused", "false")
        infoTrace("addon.py", "VPN monitor service restarted")
    xbmc.executebuiltin('Container.Refresh')
    return


if action == "display": 
    # Display the network status
    displayStatus()
elif action == "system":
    listSystem(addon)
elif action == "back" : 
    back()
    #listSystem()
elif not connectionValidated(addon) and action != "":
    # Haven't got a valid connection so force user into the wizard or the settings dialog
    if not addon.getSetting("vpn_wizard_run") == "true" : 
        wizard()
    else:
        if not action =="settings": xbmcgui.Dialog().ok(addon_name, "Please validate a primary VPN connection first.  You can do this using the VPN Configuration tab within the Settings dialog.")
    xbmc.executebuiltin("Addon.OpenSettings(service.vpn.manager)")
else:
    # User wants to see settings, list connections or they've selected to change something.  
    # If it's none of these things, we're at the top level and just need to show the menu
    if action == "settings" :
        debugTrace("Opening settings")
        xbmc.executebuiltin("Addon.OpenSettings(service.vpn.manager)")    
    elif action == "list" : listConnections()
    elif action == "disconnect" : disconnect()
    elif action == "change" : changeConnection()
示例#2
0
        setVPNMonitorState("Started")
        addon.setSetting("monitor_paused", "false")
        infoTrace("addon.py", "VPN monitor service restarted")
    xbmc.executebuiltin('Container.Refresh')
    return


if action == "display":
    # Display the network status
    displayStatus()
elif action == "system":
    listSystem(addon)
elif action == "back":
    back()
    #listSystem()
elif not connectionValidated(addon) and action != "":
    # Haven't got a valid connection so force user into the wizard or the settings dialog
    if not addon.getSetting("vpn_wizard_run") == "true":
        wizard()
    else:
        if not action == "settings":
            xbmcgui.Dialog().ok(
                addon_name,
                "Please validate a primary VPN connection first.  You can do this using the VPN Configuration and VPN Connections tabs within the Settings dialog."
            )
    xbmc.executebuiltin("Addon.OpenSettings(service.vpn.manager)")
else:
    # User wants to see settings, list connections or they've selected to change something.
    # If it's none of these things, we're at the top level and just need to show the menu
    if action == "settings":
        debugTrace("Opening settings")
示例#3
0
from libs.common import getVPNProfile, getVPNProfileFriendly, getVPNState, clearVPNCycle, getCycleLock, freeCycleLock, getAlternativeFriendlyProfileList
from libs.utility import debugTrace, errorTrace, infoTrace, newPrint, getID, getName

debugTrace("-- Entered table.py --")

if not getID() == "":
    # Get info about the addon that this script is pretending to be attached to
    addon = xbmcaddon.Addon(getID())
    addon_name = getName()

    cancel_text = "[I][COLOR grey]Cancel[/COLOR][/I]"
    disconnect_text = "[COLOR ffff0000]Disconnect[/COLOR]"
    disconnected_text = "[COLOR ffff0000](Disconnected)[/COLOR]"

    # Don't display the table if there's nothing been set up
    if connectionValidated(addon):
        if getCycleLock():
        
            vpn_provider = addon.getSetting("vpn_provider_validated")
        
            # Want to stop cycling whilst this menu is displayed, and clear any active cycle
            clearVPNCycle()
            if addon.getSetting("table_display_type") == "All connections":
                # Build a list of all ovpn files using the current active filter
                if not isAlternative(vpn_provider):
                    all_connections = getAddonList(addon.getSetting("vpn_provider_validated"), "*.ovpn")
                    location_connections = getFilteredProfileList(all_connections, addon.getSetting("vpn_protocol"), None)
                    location_connections.sort()
                else:
                    location_connections = getAlternativeLocations(vpn_provider, False)
                    connections = getAlternativeFriendlyLocations(vpn_provider, False)