示例#1
0
    def callback_login_button(self, event):
        self.callback_save_login_account_booleanvar(
            None, lybconstant.LYB_DO_BOOLEAN_SAVE_LOGIN_ACCOUNT)

        user_id = self.option_dic[lybconstant.LYB_DO_BOOLEAN_SAVE_LOGIN_ACCOUNT
                                  + '_id'].get()
        user_password = self.option_dic[
            lybconstant.LYB_DO_BOOLEAN_SAVE_LOGIN_ACCOUNT + '_passwd'].get()
        # self.lybhttp = likeyoubot_http.LYBHttp(user_id, user_password)
        self.rest = likeyoubot_rest.LYBRest(self.configure.root_url, user_id,
                                            user_password)
        self.rest.login()

        # error_message = self.lybhttp.login()
        error_message = self.rest.login()
        self.logger.info('로그인:' + str(error_message))
        if error_message == '':
            # login_point = self.lybhttp.get_login_point()
            # login_point = self.rest.get_login_point()
            # if int(self.lybhttp.mb_point) < int(login_point):
            self.logger.info('DEBUG1')
            if self.rest.get_point() < self.rest.get_login_point():
                self.shake_frame()
                error_message = '포인트가 부족합니다.(현재: ' + str(
                    self.rest.get_point()) + '점, 필요: ' + str(
                        self.rest.get_login_point()) + '점)'
                self.option_dic[lybconstant.LYB_DO_STRING_LOGIN_MESSAGE].set(
                    error_message)
                return

            self.logger.info('DEBUG3')
            self.main_frame.pack_forget()

            # chat_id = self.lybhttp.get_chat_id()
            chat_id = self.rest.get_chat_id()

            if chat_id != None:
                self.configure.common_config[
                    lybconstant.LYB_DO_BOOLEAN_SAVE_LOGIN_ACCOUNT +
                    '_chat_id'] = chat_id

            if self.configure.common_config[
                    lybconstant.LYB_DO_BOOLEAN_AUTO_UPDATE] == True:
                self.auto_update()
            else:
                try:
                    likeyoubot_gui.LYBGUI(self.master, self.configure,
                                          self.rest)
                except:
                    self.logger.error(traceback.format_exc())
        else:
            self.shake_frame()
            self.option_dic[lybconstant.LYB_DO_STRING_LOGIN_MESSAGE].set(
                error_message)
示例#2
0
 def start_gui(self):
     self.main_frame.pack_forget()
     likeyoubot_gui.LYBGUI(self.master, self.configure, self.rest)