From f51c146f71a9bcbff363c6c3309e18e7e3773909 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Mon, 11 Mar 2019 00:41:49 +0200 Subject: [PATCH] - fixed an issue created by the fact that I used the '_' char inside the app to designate unused info and that conflicted with the _() function used by gettext - made impossible to try to reapply current language that it's already applied (un-necessary) --- FlatCAMApp.py | 22 +++++++++++----------- FlatCAMTranslation.py | 13 +++++++++---- README.md | 2 ++ 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/FlatCAMApp.py b/FlatCAMApp.py index 7786ea59..0cbab671 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -5346,15 +5346,15 @@ class App(QtCore.QObject): "All Files (*.*)" try: - filenames, _ = QtWidgets.QFileDialog.getOpenFileNames(caption="Open Gerber", + filenames, _f = QtWidgets.QFileDialog.getOpenFileNames(caption="Open Gerber", directory=self.get_last_folder(), filter=_filter_) except TypeError: - filenames, _ = QtWidgets.QFileDialog.getOpenFileNames(caption="Open Gerber", filter=_filter_) + filenames, _f = QtWidgets.QFileDialog.getOpenFileNames(caption="Open Gerber", filter=_filter_) filenames = [str(filename) for filename in filenames] if len(filenames) == 0: - self.inform.emit(_("[WARNING_NOTCL]Open Gerber cancelled.")) + self.inform.emit(_("[WARNING_NOTCL] Open Gerber cancelled.")) else: for filename in filenames: if filename != '': @@ -5375,10 +5375,10 @@ class App(QtCore.QObject): "All Files (*.*)" try: - filenames, _ = QtWidgets.QFileDialog.getOpenFileNames(caption="Open Excellon", + filenames, _f = QtWidgets.QFileDialog.getOpenFileNames(caption="Open Excellon", directory=self.get_last_folder(), filter=_filter_) except TypeError: - filenames, _ = QtWidgets.QFileDialog.getOpenFileNames(caption="Open Excellon", filter=_filter_) + filenames, _f = QtWidgets.QFileDialog.getOpenFileNames(caption="Open Excellon", filter=_filter_) filenames = [str(filename) for filename in filenames] @@ -5405,10 +5405,10 @@ class App(QtCore.QObject): " *.din *.xpi *.hnc *.h *.i *.ncp *.min *.gcd *.rol *.mpr *.ply *.out *.eia *.plt *.sbp *.mpf);;" \ "All Files (*.*)" try: - filenames, _ = QtWidgets.QFileDialog.getOpenFileNames(caption="Open G-Code", + filenames, _f = QtWidgets.QFileDialog.getOpenFileNames(caption="Open G-Code", directory=self.get_last_folder(), filter=_filter_) except TypeError: - filenames, _ = QtWidgets.QFileDialog.getOpenFileNames(caption="Open G-Code", filter=_filter_) + filenames, _f = QtWidgets.QFileDialog.getOpenFileNames(caption="Open G-Code", filter=_filter_) filenames = [str(filename) for filename in filenames] @@ -5730,10 +5730,10 @@ class App(QtCore.QObject): filter = "SVG File (*.svg);;All Files (*.*)" try: - filenames, _ = QtWidgets.QFileDialog.getOpenFileNames(caption="Import SVG", + filenames, _f = QtWidgets.QFileDialog.getOpenFileNames(caption="Import SVG", directory=self.get_last_folder(), filter=filter) except TypeError: - filenames, _ = QtWidgets.QFileDialog.getOpenFileNames(caption="Import SVG", filter=filter) + filenames, _f = QtWidgets.QFileDialog.getOpenFileNames(caption="Import SVG", filter=filter) if type_of_obj is not "geometry" and type_of_obj is not "gerber": type_of_obj = "geometry" @@ -5760,10 +5760,10 @@ class App(QtCore.QObject): filter = "DXF File (*.DXF);;All Files (*.*)" try: - filenames, _ = QtWidgets.QFileDialog.getOpenFileNames(caption=_("Import DXF"), + filenames, _f = QtWidgets.QFileDialog.getOpenFileNames(caption=_("Import DXF"), directory=self.get_last_folder(), filter=filter) except TypeError: - filenames, _ = QtWidgets.QFileDialog.getOpenFileNames(caption=_("Import DXF"), filter=filter) + filenames, _f = QtWidgets.QFileDialog.getOpenFileNames(caption=_("Import DXF"), filter=filter) if type_of_obj is not "geometry" and type_of_obj is not "gerber": type_of_obj = "geometry" diff --git a/FlatCAMTranslation.py b/FlatCAMTranslation.py index 23cb12d6..8f1fdcb9 100644 --- a/FlatCAMTranslation.py +++ b/FlatCAMTranslation.py @@ -60,11 +60,17 @@ def on_language_apply_click(app, restart=False): """ name = app.ui.general_defaults_form.general_app_group.language_cb.currentText() + # do nothing if trying to apply the language that is the current language (already applied). + settings = QSettings("Open Source", "FlatCAM") + if settings.contains("language"): + current_language = settings.value('language', type=str) + if current_language == name: + return + if restart: msgbox = QtWidgets.QMessageBox() - - msgbox.setInformativeText("Are you sure do you want to change the current language to %s?\n\n" - "The application will restart." % name.capitalize()) + msgbox.setText("The application will restart.") + msgbox.setInformativeText("Are you sure do you want to change the current language to %s?" % name.capitalize()) msgbox.setWindowTitle("Apply Language ...") msgbox.setWindowIcon(QtGui.QIcon('share/save_as.png')) msgbox.setStandardButtons(QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.Cancel) @@ -83,7 +89,6 @@ def on_language_apply_click(app, restart=False): restart_program(app=app) - def apply_language(domain, lang=None): lang_code = '' diff --git a/README.md b/README.md index 18304c65..c7113ec8 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,8 @@ CAD program, and create G-Code for Isolation routing. - fixed bug in ToolCutOut where for each tool invocation the signals were reconnected - fixed some issues with ToolMeasurement due of above changes - updated the App.final_save() function +- fixed an issue created by the fact that I used the '_' char inside the app to designate unused info and that conflicted with the _() function used by gettext +- made impossible to try to reapply current language that it's already applied (un-necessary) 8.03.2019