Пример #1
0
    def on_btn_ok_clicked(self):
        #default
        default = self.getDefaultSetting()
        printer = self.getPrinterSetting()

        if not Util.saveConfig('Default', default):
            QMessageBox.critical(self, 'Message', Util.lang('save_config_error', 'Save config.ini file failure.'), QMessageBox.Ok, QMessageBox.Ok) 
            return

        if not Util.saveConfig('Printer', printer):
            QMessageBox.critical(self, 'Message', Util.lang('save_config_error', 'Save config.ini file failure.'), QMessageBox.Ok, QMessageBox.Ok) 
            return

        if self.mainWindow:
            self.mainWindow.on_settingOK()

        self.parentWidget().close()
Пример #2
0
    def on_btn_apply_clicked(self):
        #default
        default = self.getDefaultSetting()
        printer = self.getPrinterSetting()

        if not Util.saveConfig('Default', default):
            QMessageBox.critical(self, 'Message', Util.lang('save_config_error', 'Save config.ini file failure.'), QMessageBox.Ok, QMessageBox.Ok) 
            return

        if not Util.saveConfig('Printer', printer):
            QMessageBox.critical(self, 'Message', Util.lang('save_config_error', 'Save config.ini file failure.'), QMessageBox.Ok, QMessageBox.Ok) 
            return

        if self.mainWindow:
            self.mainWindow.on_settingOK()
        else:
            Util.reloadConfig()
            Util.loadTheme()