def sipc_auth_t_finished(self): kill_qthread(self.sipc_auth_t_killer) res_obj = self.sipc_auth_t.get_return() code = res_obj.code if code == SIPResponse.OK: self._retry_times = 0 i_update_user_after_sipc_auth_success(self.user, res_obj) self.show_contact_list_win() return elif code == SIPResponse.EXTENSION_REQUIRED: # login location changed self.verification = i_generate_verification_pic(self.user, res_obj) body = "%s<br />%s" % (self.verification.text, self.verification.tips) (btn_val, chars) = GetVerificationDialog.get_input(body = body, path = self.verification.picture_path) if btn_val: logger.info("(SIPC auth) Input recognise chars: %s" % chars) self.verification.chars = chars self.sipc_auth_t_run() else: self.verification = None self.user = None self.show_or_hide_login_widgets(show = True) return self.show_or_hide_login_widgets(show = True) popup_error(self, "SIPC authentication response code: %d" % code)
def sipc_auth_t_finished(self): kill_qthread(self.sipc_auth_t_killer) res_obj = self.sipc_auth_t.get_return() code = res_obj.code if code == SIPResponse.OK: self._retry_times = 0 i_update_user_after_sipc_auth_success(self.user, res_obj) self.show_contact_list_win() return elif code == SIPResponse.EXTENSION_REQUIRED: # login location changed self.verification = i_generate_verification_pic(self.user, res_obj) body = "%s<br />%s" % (self.verification.text, self.verification.tips) (btn_val, chars) = GetVerificationDialog.get_input( body=body, path=self.verification.picture_path) if btn_val: logger.info("(SIPC auth) Input recognise chars: %s" % chars) self.verification.chars = chars self.sipc_auth_t_run() else: self.verification = None self.user = None self.show_or_hide_login_widgets(show=True) return self.show_or_hide_login_widgets(show=True) popup_error(self, "SIPC authentication response code: %d" % code)
def sipc_auth_t_run(self): kill_qthread(self.sipc_auth_t) kill_qthread(self.sipc_auth_t_killer) self.sipc_auth_t = IThread(i_sipc_auth, user = self.user, verification = self.verification, debug = True) self.sipc_auth_t_killer = IThreadKiller(self.sipc_auth_t, timeout = 10) self.connect(self.sipc_auth_t, QtCore.SIGNAL("thread_finished()"), self.sipc_auth_t_finished) self.connect(self.sipc_auth_t_killer, QtCore.SIGNAL('kill_qthread()'), self.kill_sipc_auth_t) self.sipc_auth_t.start() self.sipc_auth_t_killer.start()
def kill_sipc_auth_t(self): kill_qthread(self.sipc_auth_t) if self._retry_times < MAX_RETRY_TIMES: self._retry_times += 1 logger.error("SIPC authentication failed, auto re-try ...") self.sipc_auth_t_run() return self.verification = None self.user = None self.show_or_hide_login_widgets(show = True) popup_error(self, u"连接超时(SIPC),请稍候再尝试")
def download_sys_config_t_run(self): kill_qthread(self.download_sys_config_t) kill_qthread(self.download_sys_config_t_killer) self.download_sys_config_t = IThread(i_download_sys_config, user = self.user, debug = True) self.download_sys_config_t_killer = IThreadKiller(self.download_sys_config_t, timeout = 20) self.connect(self.download_sys_config_t, QtCore.SIGNAL("thread_finished()"), self.download_sys_config_t_finished) self.connect(self.download_sys_config_t_killer, QtCore.SIGNAL("kill_qthread()"), self.kill_download_sys_config_t) self.download_sys_config_t.start() self.download_sys_config_t_killer.start()
def kill_download_sys_config_t(self): kill_qthread(self.download_sys_config_t) if self._retry_times < MAX_RETRY_TIMES: self._retry_times += 1 logger.error("Download configuration failed, auto re-try ...") self.download_sys_config_t_run() return self.verification = None self.user = None self.show_or_hide_login_widgets(show = True) popup_error(self, "Download configuration failed, try again later")
def kill_sipc_auth_t(self): kill_qthread(self.sipc_auth_t) if self._retry_times < MAX_RETRY_TIMES: self._retry_times += 1 logger.error("SIPC authentication failed, auto re-try ...") self.sipc_auth_t_run() return self.verification = None self.user = None self.show_or_hide_login_widgets(show=True) popup_error(self, u"连接超时(SIPC),请稍候再尝试")
def kill_download_sys_config_t(self): kill_qthread(self.download_sys_config_t) if self._retry_times < MAX_RETRY_TIMES: self._retry_times += 1 logger.error("Download configuration failed, auto re-try ...") self.download_sys_config_t_run() return self.verification = None self.user = None self.show_or_hide_login_widgets(show=True) popup_error(self, "Download configuration failed, try again later")
def sipc_auth_t_run(self): kill_qthread(self.sipc_auth_t) kill_qthread(self.sipc_auth_t_killer) self.sipc_auth_t = IThread(i_sipc_auth, user=self.user, verification=self.verification, debug=True) self.sipc_auth_t_killer = IThreadKiller(self.sipc_auth_t, timeout=10) self.connect(self.sipc_auth_t, QtCore.SIGNAL("thread_finished()"), self.sipc_auth_t_finished) self.connect(self.sipc_auth_t_killer, QtCore.SIGNAL('kill_qthread()'), self.kill_sipc_auth_t) self.sipc_auth_t.start() self.sipc_auth_t_killer.start()
def download_sys_config_t_finished(self): kill_qthread(self.download_sys_config_t_killer) res_obj = self.download_sys_config_t.get_return() code = res_obj.code if code == httplib.OK: self.download_sys_config_t = None self.download_sys_config_t_killer = None self._retry_times = 0 i_update_user_after_get_sys_config_success(self.user, res_obj.body) self.sipc_auth_t_run() return self.download_sys_config_t = None self.download_sys_config_t_killer = None self.show_or_hide_login_widgets(show = True) popup_error(self, "Download configuration response code: %d" % code)
def download_sys_config_t_finished(self): kill_qthread(self.download_sys_config_t_killer) res_obj = self.download_sys_config_t.get_return() code = res_obj.code if code == httplib.OK: self.download_sys_config_t = None self.download_sys_config_t_killer = None self._retry_times = 0 i_update_user_after_get_sys_config_success(self.user, res_obj.body) self.sipc_auth_t_run() return self.download_sys_config_t = None self.download_sys_config_t_killer = None self.show_or_hide_login_widgets(show=True) popup_error(self, "Download configuration response code: %d" % code)
def download_sys_config_t_run(self): kill_qthread(self.download_sys_config_t) kill_qthread(self.download_sys_config_t_killer) self.download_sys_config_t = IThread(i_download_sys_config, user=self.user, debug=True) self.download_sys_config_t_killer = IThreadKiller( self.download_sys_config_t, timeout=20) self.connect(self.download_sys_config_t, QtCore.SIGNAL("thread_finished()"), self.download_sys_config_t_finished) self.connect(self.download_sys_config_t_killer, QtCore.SIGNAL("kill_qthread()"), self.kill_download_sys_config_t) self.download_sys_config_t.start() self.download_sys_config_t_killer.start()
def ssi_auth_t_finished(self): # why not necessary to call disconnect(SIGNAL) here # http://doc.qt.nokia.com/4.7/qobject.html#disconnect-3 kill_qthread(self.ssi_auth_t_killer) res_obj = self.ssi_auth_t.get_return() code = res_obj.code if code == httplib.OK: i_update_user_after_ssi_auth_success(self.user, res_obj, self.get_if_remember_passwd()) self._retry_times = 0 self.download_sys_config_t_run() elif code == HTTPResponse.PASSWD_ERROR: self.user = None self.show_or_hide_login_widgets(show=True) popup_error(self, u"密码错误") elif code in (HTTPResponse.CCPS_CHECK_ERROR, HTTPResponse.NEED_VERIFY): self.verification = i_generate_verification_pic(self.user, res_obj) body = "%s<br />%s" % (self.verification.text, self.verification.tips) (btn_val, chars) = GetVerificationDialog.get_input( body=body, path=self.verification.picture_path) if btn_val: logger.info("(SSI auth)Input recognise chars: %s" % chars) self.verification.chars = chars self.ssi_auth_t_run() else: self.verification = None self.user = None self.show_or_hide_login_widgets(show=True) else: raise Exception("SSI authentication response code: %d" % code)
def ssi_auth_t_finished(self): # why not necessary to call disconnect(SIGNAL) here # http://doc.qt.nokia.com/4.7/qobject.html#disconnect-3 kill_qthread(self.ssi_auth_t_killer) res_obj = self.ssi_auth_t.get_return() code = res_obj.code if code == httplib.OK: i_update_user_after_ssi_auth_success(self.user, res_obj, self.get_if_remember_passwd()) self._retry_times = 0 self.download_sys_config_t_run() elif code == HTTPResponse.PASSWD_ERROR: self.user = None self.show_or_hide_login_widgets(show = True) popup_error(self, u"密码错误") elif code in (HTTPResponse.CCPS_CHECK_ERROR, HTTPResponse.NEED_VERIFY): self.verification = i_generate_verification_pic(self.user, res_obj) body = "%s<br />%s" % (self.verification.text, self.verification.tips) (btn_val, chars) = GetVerificationDialog.get_input(body = body, path = self.verification.picture_path) if btn_val: logger.info("(SSI auth)Input recognise chars: %s" % chars) self.verification.chars = chars self.ssi_auth_t_run() else: self.verification = None self.user = None self.show_or_hide_login_widgets(show = True) else: raise Exception("SSI authentication response code: %d" % code)