class MainApp(MDApp): def __init__(self, **kwargs): self.title = "VPN server on demand" self.theme_cls.primary_palette = "BlueGray" super().__init__(**kwargs) self.store = JsonStore('rwar_vpn.json') self.store.store_load() def build(self): self.root = ExampleBackdrop() def store_kv(self, key: str, value): self.store.store_put(key, value) self.store.store_sync() def store_group(self, group, iden, state): if self.store.store_exists(group): data = self.store.store_get(group) else: data = {} data[iden] = state self.store_kv(group, data)
else: cmd = "echo %USERPROFILE%" out = run_syscall(cmd) REPOFILE = "%(out)s%(ps)s.kivyrepowatcher%(ps)srepowatcher" % {'out': out.rstrip(), 'ps': PATH_SEPERATOR} KIVY_VERSION = kivy.__version__ DB = JsonStore(REPOFILE) directory = os.path.dirname(REPOFILE) if not os.path.exists(directory): os.makedirs(directory) DB.store_put('repos', []) DB.store_put('theme', 'CUSTOM') DB.store_put('screen', 'Changes') if not DB.store_exists('repos') and not DB.store_exists('theme'): repos = DB.store_load() DB._data = {} DB.store_put('repos', repos if repos else []) DB.store_sync() if not DB.store_exists('repos'): DB.store_put('repos', []) if not DB.store_exists('theme'): DB.store_put('theme', 'CUSTOM') if not DB.store_exists('screen'): DB.store_put('screen', 'Changes') if not DB.store_exists('current_repo'): DB.store_put('current_repo', "") DB.store_sync() COLOR_SCHEMAS = [
if PATH_SEPERATOR == '/': cmd = "echo $HOME" else: cmd = "echo %USERPROFILE%" out, err = run_syscall(cmd) DATAFILE = "%(out)s%(ps)s.kivydeployapp%(ps)sdeployapp" % { 'out': out.rstrip(), 'ps': PATH_SEPERATOR } KIVY_VERSION = __version__ DB = JsonStore(DATAFILE) directory = path.dirname(DATAFILE) if not path.exists(directory): makedirs(directory) DB.store_put('servers', []) DB.store_put('username', "") DB.store_put('password', "") DB.store_sync() if not DB.store_exists('servers'): DB.store_put('servers', []) DB.store_sync() if not DB.store_exists('username'): DB.store_put('username', "") DB.store_sync() if not DB.store_exists('password'): DB.store_put('password', "") DB.store_sync()