def __init__(self, mediator, mainpage_props): self.__feed_type = '' self.__date_field = '' self.props = mainpage_props self.load_settings() self.conn_attempted = False self.ver_check = VersionChecker() MainPageGui.__init__(self, mediator, self.props.gameprops.menu_args) if self.ver_check.is_uptodate(): options = self.props.opt_file user = options['settings']['xmpp']['usr'] password = options['settings']['xmpp']['pwd'] parser = argparse.ArgumentParser() parser.add_argument('--user') parser.add_argument('--pwd') parser.add_argument('--win_orig') args = parser.parse_args() if args.user and args.pwd: user = args.user password = args.pwd if user and password and not self.eng.xmpp.client: # if user: # if platform.startswith('linux'): set_keyring(Keyring()) # pwd = get_password('ya2_rog', user) # if not pwd: pwd = password # set_password('ya2_rog', user, pwd) # self.eng.xmpp.start(user, pwd) self.eng.xmpp.start(user, pwd, self.on_ok, self.on_ko, self.props.gameprops.xmpp_debug) if not (user and password): self.on_ko()
def __init__(self, mediator, mainpage_props): self.__feed_type = '' self.__date_field = '' self.props = mainpage_props self.load_settings() self.conn_attempted = False if not self.eng.client.netw_thr or \ not self.eng.client.netw_thr.is_running: self.eng.client.restart() self.ver_check = VersionChecker() MainPageGui.__init__(self, mediator, self.props.gameprops.menu_props) if self.ver_check.is_uptodate(): options = self.props.opt_file user = options['settings']['login']['usr'] password = options['settings']['login']['pwd'] parser = argparse.ArgumentParser() parser.add_argument('--user') parser.add_argument('--pwd') parser.add_argument('--win_orig') parser.add_argument('--optfile') args = parser.parse_args(EngineLogic.cmd_line()) if args.user and args.pwd: user = args.user password = args.pwd if user and password and self.eng.client.is_server_up: # if user: # if platform.startswith('linux'): set_keyring(Keyring()) # pwd = get_password('ya2_rog', user) # if not pwd: pwd = password # set_password('ya2_rog', user, pwd) # self.eng.xmpp.start(user, pwd) #self.eng.xmpp.start(user, pwd, self.on_ok, self.on_ko, self.props.gameprops.xmpp_debug) self.eng.client.register_rpc('login') while not self.eng.client.netw_thr: pass # wait for the thread ret_val = 'ok' if not self.eng.client.authenticated: ret_val = self.eng.client.login(user, password) if ret_val in [ 'invalid_nick', 'unregistered_nick', 'wrong_pwd' ]: self.on_ko(ret_val) #return self.on_ko(ret_val) taskMgr.doMethodLater(.1, lambda task: self.on_ok(), 'x') # otherwise the menu is not attached to the page yet if not (user and password): self.on_ko()
def __init__(self, mdt, menu, mainpage_props): self.menu = menu self.props = mainpage_props self.load_settings() MainPageGui.__init__(self, mdt, menu)