def _updatePath(self, path): if path not in self.pathcombo: self.pathcombo[path] = 1 self.path.Append(path) wx.LogMessage(u'进入目录:' + path) self.path.SetValue(path) self.prep['path'] = path autil.dumpConfig()
def addservice(name, serv): httpd = BaseHTTPServer.HTTPServer(('', 40817), GetTokenHandler) url = autil.yuns[serv]['token_url']( autil.yuns[serv]['client_id'], 'http://127.0.0.1:40817/login_success') wx.LaunchDefaultBrowser(url, 1) httpd.running = True while httpd.running: httpd.handle_request() if 'token' not in httpd.__dict__: return for n in autil.Config: if 'token' not in autil.Config[n]: continue if httpd.token != autil.Config[n]['token']: continue wx.MessageBox( u'已经添加过此服务,其名字为:' + n, u'重复', wx.ICON_ERROR) return isnew = name not in autil.Config autil.Config[name] = {'name': serv, 'key': name, 'token': httpd.token, 'class': autil.yuns[serv]['class'], 'root': autil.yuns[serv]['root']} autil.dumpConfig() if isnew and autil.GuiFrame: autil.GuiFrame.file.servname.Append(name) autil.GuiFrame.file.changeService( autil.GuiFrame.file.servname.GetCount() - 1 )
def delservice(name): del autil.Config[name] autil.dumpConfig()