diff --git a/QuickPrint.py b/QuickPrint.py index f3ae0fe..3634fed 100644 --- a/QuickPrint.py +++ b/QuickPrint.py @@ -93,10 +93,15 @@ def __init__(self, iface : QgisInterface, parent : QtWidgets=None) -> None: self.dialog.paperFormatComboBox.currentIndexChanged.connect( self.create_composer) self.setup_rubberband() - if Config().setts['font_changed']: - self.set_font_quickprint(QSettings().value("qgis/stylesheet/fontPointSize")) + self.conf = Config() + if 'font_changed' in self.conf.setts.keys(): + if self.conf.setts['font_changed']: + self.set_font_quickprint(QSettings().value("qgis/stylesheet/fontPointSize")) + else: + self.conf.set_value('font_changed', False) + self.conf.save_config() - def set_font_quickprint(self, font_size): + def set_font_quickprint(self, font_size: str) -> None: attributes = [self.dialog.label_side, self.dialog.title_label, self.dialog.cancelPushButton, self.dialog.previewPushButton, self.dialog.savePushButton, self.dialog.calendar] diff --git a/giap_dynamic_layout.py b/giap_dynamic_layout.py index a8fb01d..7ea2920 100644 --- a/giap_dynamic_layout.py +++ b/giap_dynamic_layout.py @@ -151,7 +151,7 @@ def edit_session_toggle(self, ask: bool=False) -> None: self.edit_session = not self.edit_session if not hasattr(self, 'conf'): self.conf = Config() - if ask and self.conf.setts[ + if 'ribbons_config' in self.conf.setts and ask and self.conf.setts[ 'ribbons_config'] != self.generate_ribbon_config(): self.save = CustomMessageBox(None, tr( "Do you want to save your changes?")).button_yes_no() @@ -206,8 +206,11 @@ def _section_control(self, tabind: int) -> None: scrll = QScrollArea(self) scrll.setWidgetResizable(True) scrll.setWidget(self.instr) - value = QSettings().value("qgis/stylesheet/fontPointSize") if \ - self.conf.setts["font_changed"] else 9 + if 'font_changed' in self.conf.setts.keys(): + value = QSettings().value("qgis/stylesheet/fontPointSize") if \ + self.conf.setts["font_changed"] else 9 + else: + value = 9 self.instr.setStyleSheet( f"""QFrame, QLabel, QToolTip, QTextEdit{{ font:{value}pt}}""" @@ -1158,8 +1161,11 @@ def __init__(self, lab: str, parent: QtWidgets=None) -> None: self.setAttribute(Qt.WA_DeleteOnClose) self.setText(lab) self.conf = Config() - value = QSettings().value("qgis/stylesheet/fontPointSize") if \ - self.conf.setts["font_changed"] else 10 + if 'font_changed' in self.conf.setts.keys(): + value = QSettings().value("qgis/stylesheet/fontPointSize") if \ + self.conf.setts["font_changed"] else 10 + else: + value = 10 self.setStyleSheet( f'font:{value}pt "Segoe UI"; font-weight: normal; ' ) diff --git a/giap_layout.py b/giap_layout.py index befa2ed..8efc599 100644 --- a/giap_layout.py +++ b/giap_layout.py @@ -68,10 +68,16 @@ def __init__(self, iface: iface) -> None: self.style_manager_dlg = StyleManagerDialog(self.style_manager) self.font_size = QSettings().value("qgis/stylesheet/fontPointSize") self.kompozycje = CompositionsTool(self.iface, self) + if "font_changed" not in self.config.setts: + self.config.set_value('font_changed', False) + self.config.save_config() if self.config.setts['font_changed']: - CustomLabel(tr('New section')).setStyleSheet(f'font: {self.font_size}pt;') - self.kompozycje_widget.setStyleSheet(f'font: {self.font_size}pt;') - self.main_widget.pokaz_warstwy.setStyleSheet(f'font: {self.font_size}pt;') + CustomLabel(tr('New section')).setStyleSheet( + f'font: {self.font_size}pt;') + self.kompozycje_widget.setStyleSheet( + f'font: {self.font_size}pt;') + self.main_widget.pokaz_warstwy.setStyleSheet( + f'font: {self.font_size}pt;') self.setfont_settings_dialog() self.setfont_styles_dialog()