- 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)
This commit is contained in:
Marius Stanciu 2019-03-11 00:41:49 +02:00
parent 3c2cc96b62
commit f51c146f71
3 changed files with 22 additions and 15 deletions

View File

@ -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"

View File

@ -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 = ''

View File

@ -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