- fix app crash for the case that there are no translation files
- fixed some forgotten strings to be prepared for internationalization in ToolCalculators - fixed Tools menu no longer working due of changes - added some test translation for the ToolCalculators (in Romanian) - fixed bug in ToolCutOut where for each tool invocation the signals were reconnected
This commit is contained in:
@@ -14,7 +14,11 @@ import math
|
||||
|
||||
import gettext
|
||||
import FlatCAMTranslation as fcTranslate
|
||||
|
||||
fcTranslate.apply_language('ToolCalculators')
|
||||
import builtins
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
|
||||
class ToolCalculator(FlatCAMTool):
|
||||
@@ -96,21 +100,21 @@ class ToolCalculator(FlatCAMTool):
|
||||
self.tipDia_label.setToolTip(_('This is the diameter of the tool tip.\n'
|
||||
'The manufacturer specifies it.'))
|
||||
|
||||
self.tipAngle_label = QtWidgets.QLabel("Tip Angle:")
|
||||
self.tipAngle_label = QtWidgets.QLabel(_("Tip Angle:"))
|
||||
self.tipAngle_entry = FCEntry()
|
||||
# self.tipAngle_entry.setFixedWidth(70)
|
||||
self.tipAngle_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
|
||||
self.tipAngle_label.setToolTip(_("This is the angle of the tip of the tool.\n"
|
||||
"It is specified by manufacturer."))
|
||||
|
||||
self.cutDepth_label = QtWidgets.QLabel("Cut Z:")
|
||||
self.cutDepth_label = QtWidgets.QLabel(_("Cut Z:"))
|
||||
self.cutDepth_entry = FCEntry()
|
||||
# self.cutDepth_entry.setFixedWidth(70)
|
||||
self.cutDepth_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
|
||||
self.cutDepth_label.setToolTip(_("This is the depth to cut into the material.\n"
|
||||
"In the CNCJob is the CutZ parameter."))
|
||||
|
||||
self.effectiveToolDia_label = QtWidgets.QLabel("Tool Diameter:")
|
||||
self.effectiveToolDia_label = QtWidgets.QLabel(_("Tool Diameter:"))
|
||||
self.effectiveToolDia_entry = FCEntry()
|
||||
# self.effectiveToolDia_entry.setFixedWidth(70)
|
||||
self.effectiveToolDia_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
|
||||
@@ -234,21 +238,11 @@ class ToolCalculator(FlatCAMTool):
|
||||
self.calculate_plate_button.clicked.connect(self.on_calculate_eplate)
|
||||
|
||||
|
||||
def run(self, toggle=False):
|
||||
def run(self, toggle=True):
|
||||
self.app.report_usage("ToolCalculators()")
|
||||
|
||||
if toggle:
|
||||
# if the splitter is hidden, display it, else hide it but only if the current widget is the same
|
||||
if self.app.ui.splitter.sizes()[0] == 0:
|
||||
self.app.ui.splitter.setSizes([1, 1])
|
||||
else:
|
||||
try:
|
||||
if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName:
|
||||
self.app.ui.splitter.setSizes([0, 1])
|
||||
except AttributeError:
|
||||
pass
|
||||
FlatCAMTool.run(self, toggle=toggle)
|
||||
|
||||
FlatCAMTool.run(self)
|
||||
self.set_tool_ui()
|
||||
|
||||
self.app.ui.notebook.setTabText(2, "Calc. Tool")
|
||||
|
||||
@@ -5,7 +5,11 @@ from shapely.geometry import box
|
||||
|
||||
import gettext
|
||||
import FlatCAMTranslation as fcTranslate
|
||||
|
||||
fcTranslate.apply_language('ToolCutOut')
|
||||
import builtins
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
|
||||
class CutOut(FlatCAMTool):
|
||||
@@ -262,26 +266,23 @@ class CutOut(FlatCAMTool):
|
||||
# true if we want to repeat the gap without clicking again on the button
|
||||
self.repeat_gap = False
|
||||
|
||||
## Signals
|
||||
self.ff_cutout_object_btn.clicked.connect(self.on_freeform_cutout)
|
||||
self.rect_cutout_object_btn.clicked.connect(self.on_rectangular_cutout)
|
||||
|
||||
self.type_obj_combo.currentIndexChanged.connect(self.on_type_obj_index_changed)
|
||||
self.man_geo_creation_btn.clicked.connect(self.on_manual_geo)
|
||||
self.man_gaps_creation_btn.clicked.connect(self.on_manual_gap_click)
|
||||
|
||||
def on_type_obj_index_changed(self, index):
|
||||
obj_type = self.type_obj_combo.currentIndex()
|
||||
self.obj_combo.setRootModelIndex(self.app.collection.index(obj_type, 0, QtCore.QModelIndex()))
|
||||
self.obj_combo.setCurrentIndex(0)
|
||||
|
||||
def run(self, toggle=False):
|
||||
def run(self, toggle=True):
|
||||
self.app.report_usage("ToolCutOut()")
|
||||
|
||||
if toggle:
|
||||
# if the splitter is hidden, display it, else hide it but only if the current widget is the same
|
||||
if self.app.ui.splitter.sizes()[0] == 0:
|
||||
self.app.ui.splitter.setSizes([1, 1])
|
||||
else:
|
||||
try:
|
||||
if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName:
|
||||
self.app.ui.splitter.setSizes([0, 1])
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
FlatCAMTool.run(self)
|
||||
FlatCAMTool.run(self, toggle=toggle)
|
||||
self.set_tool_ui()
|
||||
|
||||
self.app.ui.notebook.setTabText(2, "Cutout Tool")
|
||||
@@ -297,14 +298,6 @@ class CutOut(FlatCAMTool):
|
||||
self.gapsize.set_value(float(self.app.defaults["tools_cutoutgapsize"]))
|
||||
self.gaps.set_value(4)
|
||||
|
||||
## Signals
|
||||
self.ff_cutout_object_btn.clicked.connect(self.on_freeform_cutout)
|
||||
self.rect_cutout_object_btn.clicked.connect(self.on_rectangular_cutout)
|
||||
|
||||
self.type_obj_combo.currentIndexChanged.connect(self.on_type_obj_index_changed)
|
||||
self.man_geo_creation_btn.clicked.connect(self.on_manual_geo)
|
||||
self.man_gaps_creation_btn.clicked.connect(self.on_manual_gap_click)
|
||||
|
||||
self.gapFinished.connect(self.on_gap_finished)
|
||||
|
||||
def on_freeform_cutout(self):
|
||||
|
||||
@@ -8,7 +8,11 @@ from PyQt5 import QtCore
|
||||
|
||||
import gettext
|
||||
import FlatCAMTranslation as fcTranslate
|
||||
|
||||
fcTranslate.apply_language('ToolDblSided')
|
||||
import builtins
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
|
||||
class DblSidedTool(FlatCAMTool):
|
||||
@@ -267,21 +271,10 @@ class DblSidedTool(FlatCAMTool):
|
||||
def install(self, icon=None, separator=None, **kwargs):
|
||||
FlatCAMTool.install(self, icon, separator, shortcut='ALT+D', **kwargs)
|
||||
|
||||
def run(self, toggle=False):
|
||||
def run(self, toggle=True):
|
||||
self.app.report_usage("Tool2Sided()")
|
||||
|
||||
if toggle:
|
||||
# if the splitter is hidden, display it, else hide it but only if the current widget is the same
|
||||
if self.app.ui.splitter.sizes()[0] == 0:
|
||||
self.app.ui.splitter.setSizes([1, 1])
|
||||
else:
|
||||
try:
|
||||
if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName:
|
||||
self.app.ui.splitter.setSizes([0, 1])
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
FlatCAMTool.run(self)
|
||||
FlatCAMTool.run(self, toggle=toggle)
|
||||
self.set_tool_ui()
|
||||
|
||||
self.app.ui.notebook.setTabText(2, _("2-Sided Tool"))
|
||||
|
||||
@@ -13,7 +13,11 @@ from PyQt5 import QtGui, QtCore, QtWidgets
|
||||
|
||||
import gettext
|
||||
import FlatCAMTranslation as fcTranslate
|
||||
|
||||
fcTranslate.apply_language('ToolFilm')
|
||||
import builtins
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
|
||||
class Film(FlatCAMTool):
|
||||
@@ -176,21 +180,11 @@ class Film(FlatCAMTool):
|
||||
self.tf_box_combo.setRootModelIndex(self.app.collection.index(obj_type, 0, QtCore.QModelIndex()))
|
||||
self.tf_box_combo.setCurrentIndex(0)
|
||||
|
||||
def run(self, toggle=False):
|
||||
def run(self, toggle=True):
|
||||
self.app.report_usage("ToolFilm()")
|
||||
|
||||
if toggle:
|
||||
# if the splitter is hidden, display it, else hide it but only if the current widget is the same
|
||||
if self.app.ui.splitter.sizes()[0] == 0:
|
||||
self.app.ui.splitter.setSizes([1, 1])
|
||||
else:
|
||||
try:
|
||||
if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName:
|
||||
self.app.ui.splitter.setSizes([0, 1])
|
||||
except AttributeError:
|
||||
pass
|
||||
FlatCAMTool.run(self, toggle=toggle)
|
||||
|
||||
FlatCAMTool.run(self)
|
||||
self.set_tool_ui()
|
||||
|
||||
self.app.ui.notebook.setTabText(2, _("Film Tool"))
|
||||
|
||||
@@ -13,7 +13,11 @@ from PyQt5 import QtGui, QtCore, QtWidgets
|
||||
|
||||
import gettext
|
||||
import FlatCAMTranslation as fcTranslate
|
||||
|
||||
fcTranslate.apply_language('ToolImage')
|
||||
import builtins
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
|
||||
class ToolImage(FlatCAMTool):
|
||||
@@ -143,21 +147,10 @@ class ToolImage(FlatCAMTool):
|
||||
## Signals
|
||||
self.import_button.clicked.connect(self.on_file_importimage)
|
||||
|
||||
def run(self, toggle=False):
|
||||
def run(self, toggle=True):
|
||||
self.app.report_usage("ToolImage()")
|
||||
|
||||
if toggle:
|
||||
# if the splitter is hidden, display it, else hide it but only if the current widget is the same
|
||||
if self.app.ui.splitter.sizes()[0] == 0:
|
||||
self.app.ui.splitter.setSizes([1, 1])
|
||||
else:
|
||||
try:
|
||||
if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName:
|
||||
self.app.ui.splitter.setSizes([0, 1])
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
FlatCAMTool.run(self)
|
||||
FlatCAMTool.run(self, toggle=toggle)
|
||||
self.set_tool_ui()
|
||||
|
||||
self.app.ui.notebook.setTabText(2, _("Image Tool"))
|
||||
|
||||
@@ -16,7 +16,11 @@ from math import sqrt
|
||||
|
||||
import gettext
|
||||
import FlatCAMTranslation as fcTranslate
|
||||
|
||||
fcTranslate.apply_language('ToolMeasurement')
|
||||
import builtins
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
|
||||
class Measurement(FlatCAMTool):
|
||||
@@ -165,7 +169,7 @@ class Measurement(FlatCAMTool):
|
||||
|
||||
self.measure_btn.clicked.connect(self.toggle)
|
||||
|
||||
def run(self):
|
||||
def run(self, toggle):
|
||||
self.app.report_usage("ToolMeasurement()")
|
||||
|
||||
if self.app.tool_tab_locked is True:
|
||||
|
||||
@@ -15,7 +15,11 @@ from copy import copy
|
||||
|
||||
import gettext
|
||||
import FlatCAMTranslation as fcTranslate
|
||||
|
||||
fcTranslate.apply_language('ToolMove')
|
||||
import builtins
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
|
||||
class ToolMove(FlatCAMTool):
|
||||
@@ -45,7 +49,7 @@ class ToolMove(FlatCAMTool):
|
||||
def install(self, icon=None, separator=None, **kwargs):
|
||||
FlatCAMTool.install(self, icon, separator, shortcut='M', **kwargs)
|
||||
|
||||
def run(self):
|
||||
def run(self, toggle):
|
||||
self.app.report_usage("ToolMove()")
|
||||
|
||||
if self.app.tool_tab_locked is True:
|
||||
|
||||
@@ -13,7 +13,11 @@ import time
|
||||
|
||||
import gettext
|
||||
import FlatCAMTranslation as fcTranslate
|
||||
|
||||
fcTranslate.apply_language('ToolNonCopperClear')
|
||||
import builtins
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
|
||||
class NonCopperClear(FlatCAMTool, Gerber):
|
||||
@@ -255,20 +259,10 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
||||
def install(self, icon=None, separator=None, **kwargs):
|
||||
FlatCAMTool.install(self, icon, separator, shortcut='ALT+N', **kwargs)
|
||||
|
||||
def run(self, toggle=False):
|
||||
def run(self, toggle=True):
|
||||
self.app.report_usage("ToolNonCopperClear()")
|
||||
|
||||
if toggle:
|
||||
# if the splitter is hidden, display it, else hide it but only if the current widget is the same
|
||||
if self.app.ui.splitter.sizes()[0] == 0:
|
||||
self.app.ui.splitter.setSizes([1, 1])
|
||||
else:
|
||||
try:
|
||||
if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName:
|
||||
self.app.ui.splitter.setSizes([0, 1])
|
||||
except AttributeError:
|
||||
pass
|
||||
FlatCAMTool.run(self)
|
||||
FlatCAMTool.run(self, toggle=toggle)
|
||||
self.set_tool_ui()
|
||||
|
||||
self.build_ui()
|
||||
|
||||
@@ -12,7 +12,11 @@ from ObjectCollection import *
|
||||
|
||||
import gettext
|
||||
import FlatCAMTranslation as fcTranslate
|
||||
|
||||
fcTranslate.apply_language('ToolPaint')
|
||||
import builtins
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
|
||||
class ToolPaint(FlatCAMTool, Gerber):
|
||||
@@ -313,21 +317,10 @@ class ToolPaint(FlatCAMTool, Gerber):
|
||||
def install(self, icon=None, separator=None, **kwargs):
|
||||
FlatCAMTool.install(self, icon, separator, shortcut='ALT+P', **kwargs)
|
||||
|
||||
def run(self, toggle=False):
|
||||
def run(self, toggle=True):
|
||||
self.app.report_usage("ToolPaint()")
|
||||
|
||||
if toggle:
|
||||
# if the splitter is hidden, display it, else hide it but only if the current widget is the same
|
||||
if self.app.ui.splitter.sizes()[0] == 0:
|
||||
self.app.ui.splitter.setSizes([1, 1])
|
||||
else:
|
||||
try:
|
||||
if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName:
|
||||
self.app.ui.splitter.setSizes([0, 1])
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
FlatCAMTool.run(self)
|
||||
FlatCAMTool.run(self, toggle=toggle)
|
||||
self.set_tool_ui()
|
||||
|
||||
self.app.ui.notebook.setTabText(2, _("Paint Tool"))
|
||||
|
||||
@@ -13,7 +13,11 @@ import time
|
||||
|
||||
import gettext
|
||||
import FlatCAMTranslation as fcTranslate
|
||||
|
||||
fcTranslate.apply_language('ToolPanelize')
|
||||
import builtins
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
|
||||
class Panelize(FlatCAMTool):
|
||||
@@ -209,21 +213,10 @@ class Panelize(FlatCAMTool):
|
||||
# flag to signal the constrain was activated
|
||||
self.constrain_flag = False
|
||||
|
||||
def run(self, toggle=False):
|
||||
def run(self, toggle=True):
|
||||
self.app.report_usage("ToolPanelize()")
|
||||
|
||||
if toggle:
|
||||
# if the splitter is hidden, display it, else hide it but only if the current widget is the same
|
||||
if self.app.ui.splitter.sizes()[0] == 0:
|
||||
self.app.ui.splitter.setSizes([1, 1])
|
||||
else:
|
||||
try:
|
||||
if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName:
|
||||
self.app.ui.splitter.setSizes([0, 1])
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
FlatCAMTool.run(self)
|
||||
FlatCAMTool.run(self, toggle=toggle)
|
||||
self.set_tool_ui()
|
||||
|
||||
self.app.ui.notebook.setTabText(2, "Panel. Tool")
|
||||
|
||||
@@ -13,7 +13,11 @@ from FlatCAMObj import *
|
||||
|
||||
import gettext
|
||||
import FlatCAMTranslation as fcTranslate
|
||||
|
||||
fcTranslate.apply_language('ToolProperties')
|
||||
import builtins
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
|
||||
class Properties(FlatCAMTool):
|
||||
@@ -60,25 +64,14 @@ class Properties(FlatCAMTool):
|
||||
self.vlay.addWidget(self.treeWidget)
|
||||
self.vlay.setStretch(0,0)
|
||||
|
||||
def run(self, toggle=False):
|
||||
def run(self, toggle=True):
|
||||
self.app.report_usage("ToolProperties()")
|
||||
|
||||
if self.app.tool_tab_locked is True:
|
||||
return
|
||||
self.set_tool_ui()
|
||||
|
||||
if toggle:
|
||||
# if the splitter is hidden, display it, else hide it but only if the current widget is the same
|
||||
if self.app.ui.splitter.sizes()[0] == 0:
|
||||
self.app.ui.splitter.setSizes([1, 1])
|
||||
else:
|
||||
try:
|
||||
if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName:
|
||||
self.app.ui.splitter.setSizes([0, 1])
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
FlatCAMTool.run(self)
|
||||
FlatCAMTool.run(self, toggle=toggle)
|
||||
self.properties()
|
||||
|
||||
def install(self, icon=None, separator=None, **kwargs):
|
||||
|
||||
@@ -15,7 +15,11 @@ import html
|
||||
|
||||
import gettext
|
||||
import FlatCAMTranslation as fcTranslate
|
||||
|
||||
fcTranslate.apply_language('ToolShell')
|
||||
import builtins
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
|
||||
class TermWidget(QWidget):
|
||||
|
||||
@@ -27,7 +27,11 @@ from io import StringIO
|
||||
|
||||
import gettext
|
||||
import FlatCAMTranslation as fcTranslate
|
||||
|
||||
fcTranslate.apply_language('ToolSolderPaste')
|
||||
import builtins
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
|
||||
class SolderPaste(FlatCAMTool):
|
||||
@@ -423,21 +427,10 @@ class SolderPaste(FlatCAMTool):
|
||||
|
||||
self.app.object_status_changed.connect(self.update_comboboxes)
|
||||
|
||||
def run(self, toggle=False):
|
||||
def run(self, toggle=True):
|
||||
self.app.report_usage("ToolSolderPaste()")
|
||||
|
||||
if toggle:
|
||||
# if the splitter is hidden, display it, else hide it but only if the current widget is the same
|
||||
if self.app.ui.splitter.sizes()[0] == 0:
|
||||
self.app.ui.splitter.setSizes([1, 1])
|
||||
else:
|
||||
try:
|
||||
if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName:
|
||||
self.app.ui.splitter.setSizes([0, 1])
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
FlatCAMTool.run(self)
|
||||
FlatCAMTool.run(self, toggle=toggle)
|
||||
self.set_tool_ui()
|
||||
self.build_ui()
|
||||
|
||||
|
||||
@@ -14,7 +14,11 @@ from FlatCAMObj import *
|
||||
|
||||
import gettext
|
||||
import FlatCAMTranslation as fcTranslate
|
||||
|
||||
fcTranslate.apply_language('ToolTransform')
|
||||
import builtins
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
|
||||
class ToolTransform(FlatCAMTool):
|
||||
@@ -374,21 +378,10 @@ class ToolTransform(FlatCAMTool):
|
||||
self.offx_entry.returnPressed.connect(self.on_offx)
|
||||
self.offy_entry.returnPressed.connect(self.on_offy)
|
||||
|
||||
def run(self, toggle=False):
|
||||
def run(self, toggle=True):
|
||||
self.app.report_usage("ToolTransform()")
|
||||
|
||||
if toggle:
|
||||
# if the splitter is hidden, display it, else hide it but only if the current widget is the same
|
||||
if self.app.ui.splitter.sizes()[0] == 0:
|
||||
self.app.ui.splitter.setSizes([1, 1])
|
||||
else:
|
||||
try:
|
||||
if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName:
|
||||
self.app.ui.splitter.setSizes([0, 1])
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
FlatCAMTool.run(self)
|
||||
FlatCAMTool.run(self, toggle=toggle)
|
||||
self.set_tool_ui()
|
||||
|
||||
self.app.ui.notebook.setTabText(2, _("Transform Tool"))
|
||||
|
||||
Reference in New Issue
Block a user