def init_logger(): config = global_obj.get_obj("config") file = None if "log" in config: file = config["log"] logger = CFileLog(file) global_obj.set_obj("logger", logger)
def init_mail(): config = global_obj.get_obj("config") mail_data = config["mail"] obj = CMailBox(mail_data["user"], mail_data["password"], mail_data["host"]) obj.SetSender(mail_data["user"]) for name in mail_data["to"]: obj.SetReceive(name) global_obj.set_obj("mail", obj)
def init_log_view(self): self.init_log_ui = CViewLog(self.centralwidget, self) global_obj.set_obj("ViewLog", self.init_log_ui)
def init_App(): app = QtWidgets.QApplication(sys.argv) global_obj.set_obj("App", app) mainwindow = Oui_MainWindow() global_obj.set_obj("MainWindow", mainwindow) return app, mainwindow
def init_db(): config = global_obj.get_obj("config") db_data = config["db"] obj = mongo_api.CMongodbManager(DB_NAME, db_data["addr"], db_data["port"], db_data["user"], db_data["password"]) global_obj.set_obj("dbobj", obj)
def init_config(config_file=None): file = config_file if config_file else CONFIG_FILE data = config_api.load_config(file) global_obj.set_obj("config", data)