- GUI Element FCLineEdit (and the inheritors) has now disabled cut/paste/delete context menu entries too
This commit is contained in:
@@ -14,6 +14,7 @@ CHANGELOG for FlatCAM beta
|
||||
- Tool Copper Thieving - changed the units for plated area from mm2 in cm2 when the app units are Metric
|
||||
- Calculator Tool - Electroplating Calculator - changing the area will update the current value
|
||||
- GUI Elements FCDoubleSpinner and FCSpinner: modified the context menu to not allow cut/paste/delete/step_up/step_down when the GUI element is set as Read Only
|
||||
- GUI Element FCLineEdit (and the inheritors) has now disabled cut/paste/delete context menu entries too
|
||||
|
||||
20.11.2020
|
||||
|
||||
|
||||
@@ -286,6 +286,11 @@ class FCLineEdit(QtWidgets.QLineEdit):
|
||||
def contextMenuEvent(self, event):
|
||||
self.menu = QtWidgets.QMenu()
|
||||
|
||||
if self.isReadOnly():
|
||||
undo_action = QAction('%s' % _("Read Only"), self)
|
||||
self.menu.addAction(undo_action)
|
||||
self.menu.addSeparator()
|
||||
|
||||
# UNDO
|
||||
undo_action = QAction('%s\t%s' % (_("Undo"), _('Ctrl+Z')), self)
|
||||
self.menu.addAction(undo_action)
|
||||
@@ -306,7 +311,7 @@ class FCLineEdit(QtWidgets.QLineEdit):
|
||||
cut_action = QAction('%s\t%s' % (_("Cut"), _('Ctrl+X')), self)
|
||||
self.menu.addAction(cut_action)
|
||||
cut_action.triggered.connect(self.cut_text)
|
||||
if not self.hasSelectedText():
|
||||
if not self.hasSelectedText() or self.isReadOnly():
|
||||
cut_action.setDisabled(True)
|
||||
|
||||
# COPY
|
||||
@@ -320,11 +325,15 @@ class FCLineEdit(QtWidgets.QLineEdit):
|
||||
paste_action = QAction('%s\t%s' % (_("Paste"), _('Ctrl+V')), self)
|
||||
self.menu.addAction(paste_action)
|
||||
paste_action.triggered.connect(self.paste_text)
|
||||
if self.isReadOnly():
|
||||
paste_action.setDisabled(True)
|
||||
|
||||
# DELETE
|
||||
delete_action = QAction('%s\t%s' % (_("Delete"), _('Del')), self)
|
||||
self.menu.addAction(delete_action)
|
||||
delete_action.triggered.connect(self.del_)
|
||||
if self.isReadOnly():
|
||||
delete_action.setDisabled(True)
|
||||
|
||||
self.menu.addSeparator()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user