- fix error in plotting Excellon when toggling units

- FlatCAM editors now are separated each in it's own file
- fixed TextTool in Geometry Editor so it will open the notebook on activation and close it after finishing text adding
- started to work on a Gerber Editor
This commit is contained in:
Marius Stanciu
2019-03-29 23:45:50 +02:00
parent c5a77841f8
commit 1c1d8bd637
8 changed files with 4718 additions and 2464 deletions

View File

@@ -16,7 +16,7 @@ from flatcamGUI.GUIElements import *
import platform
import webbrowser
from FlatCAMEditor import FCShapeTool
from flatcamEditors.FlatCAMGeoEditor import FCShapeTool
import gettext
import FlatCAMTranslation as fcTranslate

View File

@@ -1337,6 +1337,48 @@ class FCTable(QtWidgets.QTableWidget):
action.triggered.connect(call_function)
class SpinBoxDelegate(QtWidgets.QItemDelegate):
def __init__(self, units):
super(SpinBoxDelegate, self).__init__()
self.units = units
self.current_value = None
def createEditor(self, parent, option, index):
editor = QtWidgets.QDoubleSpinBox(parent)
editor.setMinimum(-999.9999)
editor.setMaximum(999.9999)
if self.units == 'MM':
editor.setDecimals(2)
else:
editor.setDecimals(3)
return editor
def setEditorData(self, spinBox, index):
try:
value = float(index.model().data(index, Qt.EditRole))
except ValueError:
value = self.current_value
# return
spinBox.setValue(value)
def setModelData(self, spinBox, model, index):
spinBox.interpretText()
value = spinBox.value()
self.current_value = value
model.setData(index, value, Qt.EditRole)
def updateEditorGeometry(self, editor, option, index):
editor.setGeometry(option.rect)
def setDecimals(self, spinbox, digits):
spinbox.setDecimals(digits)
class FCSpinner(QtWidgets.QSpinBox):
def __init__(self, parent=None):
super(FCSpinner, self).__init__(parent)