def __init__(self, parent=None): super().__init__() logging.info('init begin') self.parent = parent # 冗余 self.user_info = mine.get_value('user_info') self.set_data() self.setupUi()
def check(self): ''' 用于检测用户的登录状态 :return: ''' self.user_info = mine.get_value('user_info') logging.warning(self.user_info) ret = get_notes(self.user_info['username']) if not ret['status']: logging.error(ret['msg']) records = ret['records'] if 'records' in ret.keys() else list() if not records: table = 'Msg' dict = { 'message': 'Welcome', 'detail': 'Thanks\ you\ support', 'username': self.user_info['username'] } dict['message'] = cryptograph_text( dict['message'], 'message', user_name=self.user_info['username']) dict['detail'] = cryptograph_text( dict['detail'], 'detail', user_name=self.user_info['username']) sql = be_sql().ins_sql(table, dict) sqlite_db.transaction(sql) return self.user_info['username']
def __init__(self, parent=None): super().__init__() logging.info("mainwindow init") self.parent = parent self.user_info = mine.get_value('user_info') self.setData(username=self.user_info['username']) self.setupLayout() self.retranslateUi()
def set_data(self): ''' 设置data :return: ''' self.setObjectName('AirTray') mine.add_item('user_info', self.check()) self.__user_info = mine.get_value('user_info') self.set_icon()
def add_user_note(): username = mine.get_value('user_info')['username'] get_notes(config.LDB_FILENAME, username)