- fixed the annotation plotting in the CNCJob object

- created a new InputDialog widget that has the buttons and the context menu translated and replaced the old widget throughout the app
- updated the translation strings
This commit is contained in:
Marius Stanciu
2020-11-05 16:36:41 +02:00
committed by Marius
parent a4c8737ab7
commit d4fec5ae60
27 changed files with 5318 additions and 5164 deletions

View File

@@ -2220,6 +2220,84 @@ class FCInputDialog(QtWidgets.QInputDialog):
pass
class FCInputDoubleSpinner(QtWidgets.QDialog):
def __init__(self, parent=None, title=None, text=None,
min=0.0, max=100.0000, step=1, decimals=4, init_val=None):
super(FCInputDoubleSpinner, self).__init__(parent)
self.val = 0.0
self.init_value = init_val if init_val else 0.0
self.setWindowTitle(title) if title else self.setWindowTitle('title')
self.text = text if text else 'text'
self.min = min
self.max = max
self.step = step
self.decimals = decimals
self.lbl = FCLabel(self.text)
if title is None:
self.title = 'title'
else:
self.title = title
if text is None:
self.text = 'text'
else:
self.text = text
self.wdg = FCDoubleSpinner()
self.wdg.set_value(self.init_value)
QBtn = QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel
self.buttonBox = QtWidgets.QDialogButtonBox(QBtn)
self.buttonBox.accepted.connect(self.accept)
self.buttonBox.rejected.connect(self.reject)
self.layout = QtWidgets.QVBoxLayout()
self.layout.addWidget(self.lbl)
self.layout.addWidget(self.wdg)
self.layout.addWidget(self.buttonBox)
self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setText(_("Ok"))
self.buttonBox.button(QtWidgets.QDialogButtonBox.Cancel).setText(_("Cancel"))
self.setLayout(self.layout)
def set_title(self, txt):
self.setWindowTitle(txt)
def set_text(self, txt):
self.lbl.set_value(txt)
def set_icon(self, icon):
self.setWindowIcon(icon)
def set_min(self, val):
self.wdg.setMinimum(val)
def set_max(self, val):
self.wdg.setMaximum(val)
def set_range(self, min, max):
self.wdg.set_range(min, max)
def set_step(self, val):
self.wdg.set_step(val)
def set_value(self, val):
self.wdg.set_value(val)
def get_value(self):
if self.exec_() == QtWidgets.QDialog.Accepted:
return self.wdg.get_value(), True
else:
return None, False
class FCInputSpinner(QtWidgets.QDialog):
def __init__(self, parent=None, title=None, text=None, min=None, max=None, decimals=4, step=1, init_val=None):
super().__init__(parent)
@@ -2253,6 +2331,9 @@ class FCInputSpinner(QtWidgets.QDialog):
self.buttonBox.accepted.connect(self.accept)
self.buttonBox.rejected.connect(self.reject)
self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setText(_("Ok"))
self.buttonBox.button(QtWidgets.QDialogButtonBox.Cancel).setText(_("Cancel"))
self.layout = QtWidgets.QVBoxLayout()
self.layout.addWidget(self.lbl)
self.layout.addWidget(self.wdg)
@@ -2311,6 +2392,9 @@ class FCInputDialogSlider(QtWidgets.QDialog):
self.buttonBox.accepted.connect(self.accept)
self.buttonBox.rejected.connect(self.reject)
self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setText(_("Ok"))
self.buttonBox.button(QtWidgets.QDialogButtonBox.Cancel).setText(_("Cancel"))
self.layout = QtWidgets.QVBoxLayout()
self.layout.addWidget(self.lbl)
self.layout.addWidget(self.wdg)
@@ -2372,6 +2456,9 @@ class FCInputDialogSpinnerButton(QtWidgets.QDialog):
self.buttonBox.accepted.connect(self.accept)
self.buttonBox.rejected.connect(self.reject)
self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setText(_("Ok"))
self.buttonBox.button(QtWidgets.QDialogButtonBox.Cancel).setText(_("Cancel"))
self.layout = QtWidgets.QVBoxLayout()
self.layout.addWidget(self.lbl)
self.layout.addWidget(self.wdg)
@@ -2384,6 +2471,9 @@ class FCInputDialogSpinnerButton(QtWidgets.QDialog):
def set_text(self, txt):
self.lbl.set_value(txt)
def set_icon(self, icon):
self.setWindowIcon(icon)
def set_min(self, val):
self.wdg.spinner.setMinimum(val)
@@ -3708,6 +3798,9 @@ class DialogBoxRadio(QtWidgets.QDialog):
orientation=Qt.Horizontal, parent=self)
self.form.addRow(self.button_box)
self.button_box.button(QtWidgets.QDialogButtonBox.Ok).setText(_("Ok"))
self.button_box.button(QtWidgets.QDialogButtonBox.Cancel).setText(_("Cancel"))
self.button_box.accepted.connect(self.accept)
self.button_box.rejected.connect(self.reject)

View File

@@ -3646,10 +3646,10 @@ class MainGUI(QtWidgets.QMainWindow):
self.app.exc_editor.launched_from_shortcuts = True
# ## Current application units in Upper Case
self.units = self.general_defaults_form.general_app_group.units_radio.get_value().upper()
tool_add_popup = FCInputDialog(title='%s ...' % _("New Tool"),
text='%s:' % _('Enter a Tool Diameter'),
min=0.0000, max=99.9999, decimals=4)
tool_add_popup.setWindowIcon(QtGui.QIcon(self.app.resource_location + '/letter_t_32.png'))
tool_add_popup = FCInputDoubleSpinner(title='%s ...' % _("New Tool"),
text='%s:' % _('Enter a Tool Diameter'),
min=0.0000, max=99.9999, decimals=self.decimals)
tool_add_popup.set_icon(QtGui.QIcon(self.app.resource_location + '/letter_t_32.png'))
val, ok = tool_add_popup.get_value()
if ok: