def __init__(self): logger.debug("Setting up UI") super(Window, self).__init__() self.ui = MainWindowGenerated.Ui_MainWindow() self.ui.setupUi(self) # set tabWidget self.ui.tabWidget.setCurrentIndex(0) # set icon icon = QtGui.QIcon() icon.addPixmap( QtGui.QPixmap(os.path.join(THIS_PATH, "img", "icon.png"))) self.setWindowIcon(icon) logger.verbose("Initialising GUI logger") self.init_GUI_logger(logger) logger.verbose("Initialising signals") self.init_signals() self.config = get_configs() self.t = None self.ui.lineEdit_c_path.setText(self.config["PATHS"]["last_c_file"]) self.ui.lineEdit_a_path.setText(self.config["PATHS"]["last_a_file"]) self.c_buttons = [ self.ui.pushButton_select_c_path, self.ui.pushButton_compile, self.ui.pushButton_load_c, ] self.a_buttons = [ self.ui.pushButton_select_c_path, self.ui.pushButton_assemble, self.ui.pushButton_load_a, ] self.enforce_buttons_block() logger.info("GUI initialised")
def save_log_level(self, level): config = get_configs() config["COMMON"]["log_level"] = str(level) overwrite_config(config) logger.debug("Log level saved")
from qtgui.logger import set_logger_level, init_console_logger logger = init_console_logger(name="gui") version_id = 2.0 def print_pretty_name(): print(" ***************************************************" + "\n" " Exemplar Qt5 Program - VERSION %s " % str(version_id) + "\n" " ***************************************************") if __name__ == '__main__': print_pretty_name() # set log level config = get_configs() set_logger_level(int(config["COMMON"]["log_level"]), name="gui") # start GUI logger.info("Starting GUI...") app = QApplication(sys.argv) controller = Controller() controller.show_main() app.exec_() # exit sys.exit(0)
def create_config(): shutil.copyfile(os.path.join(THIS_PATH, "qtgui", "default_configs.ini"), os.path.join(THIS_PATH, "qtgui", "configs.ini")) return get_configs()