|
@@ -276,7 +276,89 @@ class FCTree(QtWidgets.QTreeWidget):
|
|
|
header.resizeSection(column, width)
|
|
header.resizeSection(column, width)
|
|
|
|
|
|
|
|
|
|
|
|
|
-class LengthEntry(QtWidgets.QLineEdit):
|
|
|
|
|
|
|
+class FCLineEdit(QtWidgets.QLineEdit):
|
|
|
|
|
+
|
|
|
|
|
+ def __init__(self, *args, **kwargs):
|
|
|
|
|
+ super(FCLineEdit, self).__init__(*args, **kwargs)
|
|
|
|
|
+
|
|
|
|
|
+ self.menu = None
|
|
|
|
|
+
|
|
|
|
|
+ def contextMenuEvent(self, event):
|
|
|
|
|
+ self.menu = QtWidgets.QMenu()
|
|
|
|
|
+
|
|
|
|
|
+ # UNDO
|
|
|
|
|
+ undo_action = QAction('%s\t%s' % (_("Undo"), _('Ctrl+Z')), self)
|
|
|
|
|
+ self.menu.addAction(undo_action)
|
|
|
|
|
+ undo_action.triggered.connect(self.undo)
|
|
|
|
|
+ if self.isUndoAvailable() is False:
|
|
|
|
|
+ undo_action.setDisabled(True)
|
|
|
|
|
+
|
|
|
|
|
+ # REDO
|
|
|
|
|
+ redo_action = QAction('%s\t%s' % (_("Redo"), _('Ctrl+Y')), self)
|
|
|
|
|
+ self.menu.addAction(redo_action)
|
|
|
|
|
+ redo_action.triggered.connect(self.redo)
|
|
|
|
|
+ if self.isRedoAvailable() is False:
|
|
|
|
|
+ redo_action.setDisabled(True)
|
|
|
|
|
+
|
|
|
|
|
+ self.menu.addSeparator()
|
|
|
|
|
+
|
|
|
|
|
+ # CUT
|
|
|
|
|
+ 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():
|
|
|
|
|
+ cut_action.setDisabled(True)
|
|
|
|
|
+
|
|
|
|
|
+ # COPY
|
|
|
|
|
+ copy_action = QAction('%s\t%s' % (_("Copy"), _('Ctrl+C')), self)
|
|
|
|
|
+ self.menu.addAction(copy_action)
|
|
|
|
|
+ copy_action.triggered.connect(self.copy_text)
|
|
|
|
|
+ if not self.hasSelectedText():
|
|
|
|
|
+ copy_action.setDisabled(True)
|
|
|
|
|
+
|
|
|
|
|
+ # PASTE
|
|
|
|
|
+ paste_action = QAction('%s\t%s' % (_("Paste"), _('Ctrl+V')), self)
|
|
|
|
|
+ self.menu.addAction(paste_action)
|
|
|
|
|
+ paste_action.triggered.connect(self.paste_text)
|
|
|
|
|
+
|
|
|
|
|
+ # DELETE
|
|
|
|
|
+ delete_action = QAction('%s\t%s' % (_("Delete"), _('Del')), self)
|
|
|
|
|
+ self.menu.addAction(delete_action)
|
|
|
|
|
+ delete_action.triggered.connect(self.del_)
|
|
|
|
|
+
|
|
|
|
|
+ self.menu.addSeparator()
|
|
|
|
|
+
|
|
|
|
|
+ # SELECT ALL
|
|
|
|
|
+ sel_all_action = QAction('%s\t%s' % (_("Select All"), _('Ctrl+A')), self)
|
|
|
|
|
+ self.menu.addAction(sel_all_action)
|
|
|
|
|
+ sel_all_action.triggered.connect(self.selectAll)
|
|
|
|
|
+
|
|
|
|
|
+ self.menu.exec_(event.globalPos())
|
|
|
|
|
+
|
|
|
|
|
+ def cut_text(self):
|
|
|
|
|
+ clipboard = QtWidgets.QApplication.clipboard()
|
|
|
|
|
+
|
|
|
|
|
+ txt = self.selectedText()
|
|
|
|
|
+ clipboard.clear()
|
|
|
|
|
+ clipboard.setText(txt)
|
|
|
|
|
+
|
|
|
|
|
+ self.del_()
|
|
|
|
|
+
|
|
|
|
|
+ def copy_text(self):
|
|
|
|
|
+ clipboard = QtWidgets.QApplication.clipboard()
|
|
|
|
|
+
|
|
|
|
|
+ txt = self.selectedText()
|
|
|
|
|
+ clipboard.clear()
|
|
|
|
|
+ clipboard.setText(txt)
|
|
|
|
|
+
|
|
|
|
|
+ def paste_text(self):
|
|
|
|
|
+ clipboard = QtWidgets.QApplication.clipboard()
|
|
|
|
|
+
|
|
|
|
|
+ txt = clipboard.text()
|
|
|
|
|
+ self.insert(txt)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+class LengthEntry(FCLineEdit):
|
|
|
def __init__(self, output_units='IN', decimals=None, parent=None):
|
|
def __init__(self, output_units='IN', decimals=None, parent=None):
|
|
|
super(LengthEntry, self).__init__(parent)
|
|
super(LengthEntry, self).__init__(parent)
|
|
|
|
|
|
|
@@ -345,7 +427,7 @@ class LengthEntry(QtWidgets.QLineEdit):
|
|
|
return QtCore.QSize(EDIT_SIZE_HINT, default_hint_size.height())
|
|
return QtCore.QSize(EDIT_SIZE_HINT, default_hint_size.height())
|
|
|
|
|
|
|
|
|
|
|
|
|
-class FloatEntry(QtWidgets.QLineEdit):
|
|
|
|
|
|
|
+class FloatEntry(FCLineEdit):
|
|
|
def __init__(self, decimals=None, parent=None):
|
|
def __init__(self, decimals=None, parent=None):
|
|
|
super(FloatEntry, self).__init__(parent)
|
|
super(FloatEntry, self).__init__(parent)
|
|
|
self.readyToEdit = True
|
|
self.readyToEdit = True
|
|
@@ -398,7 +480,7 @@ class FloatEntry(QtWidgets.QLineEdit):
|
|
|
return QtCore.QSize(EDIT_SIZE_HINT, default_hint_size.height())
|
|
return QtCore.QSize(EDIT_SIZE_HINT, default_hint_size.height())
|
|
|
|
|
|
|
|
|
|
|
|
|
-class FloatEntry2(QtWidgets.QLineEdit):
|
|
|
|
|
|
|
+class FloatEntry2(FCLineEdit):
|
|
|
def __init__(self, decimals=None, parent=None):
|
|
def __init__(self, decimals=None, parent=None):
|
|
|
super(FloatEntry2, self).__init__(parent)
|
|
super(FloatEntry2, self).__init__(parent)
|
|
|
self.readyToEdit = True
|
|
self.readyToEdit = True
|
|
@@ -441,7 +523,7 @@ class FloatEntry2(QtWidgets.QLineEdit):
|
|
|
return QtCore.QSize(EDIT_SIZE_HINT, default_hint_size.height())
|
|
return QtCore.QSize(EDIT_SIZE_HINT, default_hint_size.height())
|
|
|
|
|
|
|
|
|
|
|
|
|
-class IntEntry(QtWidgets.QLineEdit):
|
|
|
|
|
|
|
+class IntEntry(FCLineEdit):
|
|
|
|
|
|
|
|
def __init__(self, parent=None, allow_empty=False, empty_val=None):
|
|
def __init__(self, parent=None, allow_empty=False, empty_val=None):
|
|
|
super(IntEntry, self).__init__(parent)
|
|
super(IntEntry, self).__init__(parent)
|
|
@@ -490,7 +572,7 @@ class IntEntry(QtWidgets.QLineEdit):
|
|
|
return QtCore.QSize(EDIT_SIZE_HINT, default_hint_size.height())
|
|
return QtCore.QSize(EDIT_SIZE_HINT, default_hint_size.height())
|
|
|
|
|
|
|
|
|
|
|
|
|
-class FCEntry(QtWidgets.QLineEdit):
|
|
|
|
|
|
|
+class FCEntry(FCLineEdit):
|
|
|
def __init__(self, decimals=None, alignment=None, border_color=None, parent=None):
|
|
def __init__(self, decimals=None, alignment=None, border_color=None, parent=None):
|
|
|
super(FCEntry, self).__init__(parent)
|
|
super(FCEntry, self).__init__(parent)
|
|
|
self.readyToEdit = True
|
|
self.readyToEdit = True
|
|
@@ -509,8 +591,6 @@ class FCEntry(QtWidgets.QLineEdit):
|
|
|
align_val = QtCore.Qt.AlignLeft
|
|
align_val = QtCore.Qt.AlignLeft
|
|
|
self.setAlignment(align_val)
|
|
self.setAlignment(align_val)
|
|
|
|
|
|
|
|
- self.menu = None
|
|
|
|
|
-
|
|
|
|
|
def on_edit_finished(self):
|
|
def on_edit_finished(self):
|
|
|
self.clearFocus()
|
|
self.clearFocus()
|
|
|
|
|
|
|
@@ -526,80 +606,6 @@ class FCEntry(QtWidgets.QLineEdit):
|
|
|
self.deselect()
|
|
self.deselect()
|
|
|
self.readyToEdit = True
|
|
self.readyToEdit = True
|
|
|
|
|
|
|
|
- def contextMenuEvent(self, event):
|
|
|
|
|
- self.menu = QtWidgets.QMenu()
|
|
|
|
|
-
|
|
|
|
|
- # UNDO
|
|
|
|
|
- undo_action = QAction('%s\t%s' % (_("Undo"), _('Ctrl+Z')), self)
|
|
|
|
|
- self.menu.addAction(undo_action)
|
|
|
|
|
- undo_action.triggered.connect(self.undo)
|
|
|
|
|
- if self.isUndoAvailable() is False:
|
|
|
|
|
- undo_action.setDisabled(True)
|
|
|
|
|
-
|
|
|
|
|
- # REDO
|
|
|
|
|
- redo_action = QAction('%s\t%s' % (_("Redo"), _('Ctrl+Y')), self)
|
|
|
|
|
- self.menu.addAction(redo_action)
|
|
|
|
|
- redo_action.triggered.connect(self.redo)
|
|
|
|
|
- if self.isRedoAvailable() is False:
|
|
|
|
|
- redo_action.setDisabled(True)
|
|
|
|
|
-
|
|
|
|
|
- self.menu.addSeparator()
|
|
|
|
|
-
|
|
|
|
|
- # CUT
|
|
|
|
|
- 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():
|
|
|
|
|
- cut_action.setDisabled(True)
|
|
|
|
|
-
|
|
|
|
|
- # COPY
|
|
|
|
|
- copy_action = QAction('%s\t%s' % (_("Copy"), _('Ctrl+C')), self)
|
|
|
|
|
- self.menu.addAction(copy_action)
|
|
|
|
|
- copy_action.triggered.connect(self.copy_text)
|
|
|
|
|
- if not self.hasSelectedText():
|
|
|
|
|
- copy_action.setDisabled(True)
|
|
|
|
|
-
|
|
|
|
|
- # PASTE
|
|
|
|
|
- paste_action = QAction('%s\t%s' % (_("Paste"), _('Ctrl+V')), self)
|
|
|
|
|
- self.menu.addAction(paste_action)
|
|
|
|
|
- paste_action.triggered.connect(self.paste_text)
|
|
|
|
|
-
|
|
|
|
|
- # DELETE
|
|
|
|
|
- delete_action = QAction('%s\t%s' % (_("Delete"), _('Del')), self)
|
|
|
|
|
- self.menu.addAction(delete_action)
|
|
|
|
|
- delete_action.triggered.connect(self.del_)
|
|
|
|
|
-
|
|
|
|
|
- self.menu.addSeparator()
|
|
|
|
|
-
|
|
|
|
|
- # SELECT ALL
|
|
|
|
|
- sel_all_action = QAction('%s\t%s' % (_("Select All"), _('Ctrl+A')), self)
|
|
|
|
|
- self.menu.addAction(sel_all_action)
|
|
|
|
|
- sel_all_action.triggered.connect(self.selectAll)
|
|
|
|
|
-
|
|
|
|
|
- self.menu.exec_(event.globalPos())
|
|
|
|
|
-
|
|
|
|
|
- def cut_text(self):
|
|
|
|
|
- clipboard = QtWidgets.QApplication.clipboard()
|
|
|
|
|
-
|
|
|
|
|
- txt = self.selectedText()
|
|
|
|
|
- clipboard.clear()
|
|
|
|
|
- clipboard.setText(txt)
|
|
|
|
|
-
|
|
|
|
|
- self.del_()
|
|
|
|
|
-
|
|
|
|
|
- def copy_text(self):
|
|
|
|
|
- clipboard = QtWidgets.QApplication.clipboard()
|
|
|
|
|
-
|
|
|
|
|
- txt = self.selectedText()
|
|
|
|
|
- clipboard.clear()
|
|
|
|
|
- clipboard.setText(txt)
|
|
|
|
|
-
|
|
|
|
|
- def paste_text(self):
|
|
|
|
|
- clipboard = QtWidgets.QApplication.clipboard()
|
|
|
|
|
-
|
|
|
|
|
- txt = clipboard.text()
|
|
|
|
|
- self.insert(txt)
|
|
|
|
|
-
|
|
|
|
|
def get_value(self):
|
|
def get_value(self):
|
|
|
return str(self.text())
|
|
return str(self.text())
|
|
|
|
|
|
|
@@ -650,7 +656,7 @@ class FCEntry3(FCEntry):
|
|
|
return None
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
|
|
-class EvalEntry(QtWidgets.QLineEdit):
|
|
|
|
|
|
|
+class EvalEntry(FCLineEdit):
|
|
|
def __init__(self, border_color=None, parent=None):
|
|
def __init__(self, border_color=None, parent=None):
|
|
|
super(EvalEntry, self).__init__(parent)
|
|
super(EvalEntry, self).__init__(parent)
|
|
|
self.readyToEdit = True
|
|
self.readyToEdit = True
|
|
@@ -700,7 +706,7 @@ class EvalEntry(QtWidgets.QLineEdit):
|
|
|
return QtCore.QSize(EDIT_SIZE_HINT, default_hint_size.height())
|
|
return QtCore.QSize(EDIT_SIZE_HINT, default_hint_size.height())
|
|
|
|
|
|
|
|
|
|
|
|
|
-class EvalEntry2(QtWidgets.QLineEdit):
|
|
|
|
|
|
|
+class EvalEntry2(FCLineEdit):
|
|
|
def __init__(self, parent=None):
|
|
def __init__(self, parent=None):
|
|
|
super(EvalEntry2, self).__init__(parent)
|
|
super(EvalEntry2, self).__init__(parent)
|
|
|
self.readyToEdit = True
|
|
self.readyToEdit = True
|
|
@@ -1485,7 +1491,109 @@ class FCTextArea(QtWidgets.QPlainTextEdit):
|
|
|
return QtCore.QSize(custom_sizehint, default_hint_size.height())
|
|
return QtCore.QSize(custom_sizehint, default_hint_size.height())
|
|
|
|
|
|
|
|
|
|
|
|
|
-class FCTextAreaRich(QtWidgets.QTextEdit):
|
|
|
|
|
|
|
+class FCTextEdit(QtWidgets.QTextEdit):
|
|
|
|
|
+
|
|
|
|
|
+ def __init__(self, *args, **kwargs):
|
|
|
|
|
+ super(FCTextEdit, self).__init__(*args, **kwargs)
|
|
|
|
|
+
|
|
|
|
|
+ self.menu = None
|
|
|
|
|
+ self.undo_flag = False
|
|
|
|
|
+ self.redo_flag = False
|
|
|
|
|
+
|
|
|
|
|
+ self.undoAvailable.connect(self.on_undo_available)
|
|
|
|
|
+ self.redoAvailable.connect(self.on_redo_available)
|
|
|
|
|
+
|
|
|
|
|
+ def on_undo_available(self, val):
|
|
|
|
|
+ self.undo_flag = val
|
|
|
|
|
+
|
|
|
|
|
+ def on_redo_available(self, val):
|
|
|
|
|
+ self.redo_flag = val
|
|
|
|
|
+
|
|
|
|
|
+ def contextMenuEvent(self, event):
|
|
|
|
|
+ self.menu = QtWidgets.QMenu()
|
|
|
|
|
+ tcursor = self.textCursor()
|
|
|
|
|
+ txt = tcursor.selectedText()
|
|
|
|
|
+
|
|
|
|
|
+ # UNDO
|
|
|
|
|
+ undo_action = QAction('%s\t%s' % (_("Undo"), _('Ctrl+Z')), self)
|
|
|
|
|
+ self.menu.addAction(undo_action)
|
|
|
|
|
+ undo_action.triggered.connect(self.undo)
|
|
|
|
|
+ if self.undo_flag is False:
|
|
|
|
|
+ undo_action.setDisabled(True)
|
|
|
|
|
+
|
|
|
|
|
+ # REDO
|
|
|
|
|
+ redo_action = QAction('%s\t%s' % (_("Redo"), _('Ctrl+Y')), self)
|
|
|
|
|
+ self.menu.addAction(redo_action)
|
|
|
|
|
+ redo_action.triggered.connect(self.redo)
|
|
|
|
|
+ if self.redo_flag is False:
|
|
|
|
|
+ redo_action.setDisabled(True)
|
|
|
|
|
+
|
|
|
|
|
+ self.menu.addSeparator()
|
|
|
|
|
+
|
|
|
|
|
+ # CUT
|
|
|
|
|
+ cut_action = QAction('%s\t%s' % (_("Cut"), _('Ctrl+X')), self)
|
|
|
|
|
+ self.menu.addAction(cut_action)
|
|
|
|
|
+ cut_action.triggered.connect(self.cut_text)
|
|
|
|
|
+ if txt == '':
|
|
|
|
|
+ cut_action.setDisabled(True)
|
|
|
|
|
+
|
|
|
|
|
+ # COPY
|
|
|
|
|
+ copy_action = QAction('%s\t%s' % (_("Copy"), _('Ctrl+C')), self)
|
|
|
|
|
+ self.menu.addAction(copy_action)
|
|
|
|
|
+ copy_action.triggered.connect(self.copy_text)
|
|
|
|
|
+ if txt == '':
|
|
|
|
|
+ copy_action.setDisabled(True)
|
|
|
|
|
+
|
|
|
|
|
+ # PASTE
|
|
|
|
|
+ paste_action = QAction('%s\t%s' % (_("Paste"), _('Ctrl+V')), self)
|
|
|
|
|
+ self.menu.addAction(paste_action)
|
|
|
|
|
+ paste_action.triggered.connect(self.paste_text)
|
|
|
|
|
+
|
|
|
|
|
+ # DELETE
|
|
|
|
|
+ delete_action = QAction('%s\t%s' % (_("Delete"), _('Del')), self)
|
|
|
|
|
+ self.menu.addAction(delete_action)
|
|
|
|
|
+ delete_action.triggered.connect(self.delete_text)
|
|
|
|
|
+
|
|
|
|
|
+ self.menu.addSeparator()
|
|
|
|
|
+
|
|
|
|
|
+ # SELECT ALL
|
|
|
|
|
+ sel_all_action = QAction('%s\t%s' % (_("Select All"), _('Ctrl+A')), self)
|
|
|
|
|
+ self.menu.addAction(sel_all_action)
|
|
|
|
|
+ sel_all_action.triggered.connect(self.selectAll)
|
|
|
|
|
+
|
|
|
|
|
+ self.menu.exec_(event.globalPos())
|
|
|
|
|
+
|
|
|
|
|
+ def cut_text(self):
|
|
|
|
|
+ tcursor = self.textCursor()
|
|
|
|
|
+ clipboard = QtWidgets.QApplication.clipboard()
|
|
|
|
|
+
|
|
|
|
|
+ txt = tcursor.selectedText()
|
|
|
|
|
+ clipboard.clear()
|
|
|
|
|
+ clipboard.setText(txt)
|
|
|
|
|
+
|
|
|
|
|
+ tcursor.deleteChar()
|
|
|
|
|
+
|
|
|
|
|
+ def copy_text(self):
|
|
|
|
|
+ tcursor = self.textCursor()
|
|
|
|
|
+ clipboard = QtWidgets.QApplication.clipboard()
|
|
|
|
|
+
|
|
|
|
|
+ txt = tcursor.selectedText()
|
|
|
|
|
+ clipboard.clear()
|
|
|
|
|
+ clipboard.setText(txt)
|
|
|
|
|
+
|
|
|
|
|
+ def paste_text(self):
|
|
|
|
|
+ tcursor = self.textCursor()
|
|
|
|
|
+ clipboard = QtWidgets.QApplication.clipboard()
|
|
|
|
|
+
|
|
|
|
|
+ txt = clipboard.text()
|
|
|
|
|
+ tcursor.insertText(txt)
|
|
|
|
|
+
|
|
|
|
|
+ def delete_text(self):
|
|
|
|
|
+ tcursor = self.textCursor()
|
|
|
|
|
+ tcursor.deleteChar()
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+class FCTextAreaRich(FCTextEdit):
|
|
|
def __init__(self, parent=None):
|
|
def __init__(self, parent=None):
|
|
|
super(FCTextAreaRich, self).__init__(parent)
|
|
super(FCTextAreaRich, self).__init__(parent)
|
|
|
|
|
|
|
@@ -1500,7 +1608,7 @@ class FCTextAreaRich(QtWidgets.QTextEdit):
|
|
|
return QtCore.QSize(EDIT_SIZE_HINT, default_hint_size.height())
|
|
return QtCore.QSize(EDIT_SIZE_HINT, default_hint_size.height())
|
|
|
|
|
|
|
|
|
|
|
|
|
-class FCTextAreaExtended(QtWidgets.QTextEdit):
|
|
|
|
|
|
|
+class FCTextAreaExtended(FCTextEdit):
|
|
|
def __init__(self, parent=None):
|
|
def __init__(self, parent=None):
|
|
|
super().__init__(parent)
|
|
super().__init__(parent)
|
|
|
|
|
|
|
@@ -1514,19 +1622,6 @@ class FCTextAreaExtended(QtWidgets.QTextEdit):
|
|
|
|
|
|
|
|
self.completer_enable = False
|
|
self.completer_enable = False
|
|
|
|
|
|
|
|
- self.menu = None
|
|
|
|
|
- self.undo_flag = False
|
|
|
|
|
- self.redo_flag = False
|
|
|
|
|
-
|
|
|
|
|
- self.undoAvailable.connect(self.on_undo_available)
|
|
|
|
|
- self.redoAvailable.connect(self.on_redo_available)
|
|
|
|
|
-
|
|
|
|
|
- def on_undo_available(self, val):
|
|
|
|
|
- self.undo_flag = val
|
|
|
|
|
-
|
|
|
|
|
- def on_redo_available(self, val):
|
|
|
|
|
- self.redo_flag = val
|
|
|
|
|
-
|
|
|
|
|
def set_model_data(self, keyword_list):
|
|
def set_model_data(self, keyword_list):
|
|
|
self.model.setStringList(keyword_list)
|
|
self.model.setStringList(keyword_list)
|
|
|
|
|
|
|
@@ -1654,89 +1749,6 @@ class FCTextAreaExtended(QtWidgets.QTextEdit):
|
|
|
else:
|
|
else:
|
|
|
self.completer.popup().hide()
|
|
self.completer.popup().hide()
|
|
|
|
|
|
|
|
- def contextMenuEvent(self, event):
|
|
|
|
|
- self.menu = QtWidgets.QMenu()
|
|
|
|
|
- tcursor = self.textCursor()
|
|
|
|
|
- txt = tcursor.selectedText()
|
|
|
|
|
-
|
|
|
|
|
- # UNDO
|
|
|
|
|
- undo_action = QAction('%s\t%s' % (_("Undo"), _('Ctrl+Z')), self)
|
|
|
|
|
- self.menu.addAction(undo_action)
|
|
|
|
|
- undo_action.triggered.connect(self.undo)
|
|
|
|
|
- if self.undo_flag is False:
|
|
|
|
|
- undo_action.setDisabled(True)
|
|
|
|
|
-
|
|
|
|
|
- # REDO
|
|
|
|
|
- redo_action = QAction('%s\t%s' % (_("Redo"), _('Ctrl+Y')), self)
|
|
|
|
|
- self.menu.addAction(redo_action)
|
|
|
|
|
- redo_action.triggered.connect(self.redo)
|
|
|
|
|
- if self.redo_flag is False:
|
|
|
|
|
- redo_action.setDisabled(True)
|
|
|
|
|
-
|
|
|
|
|
- self.menu.addSeparator()
|
|
|
|
|
-
|
|
|
|
|
- # CUT
|
|
|
|
|
- cut_action = QAction('%s\t%s' % (_("Cut"), _('Ctrl+X')), self)
|
|
|
|
|
- self.menu.addAction(cut_action)
|
|
|
|
|
- cut_action.triggered.connect(self.cut_text)
|
|
|
|
|
- if txt == '':
|
|
|
|
|
- cut_action.setDisabled(True)
|
|
|
|
|
-
|
|
|
|
|
- # COPY
|
|
|
|
|
- copy_action = QAction('%s\t%s' % (_("Copy"), _('Ctrl+C')), self)
|
|
|
|
|
- self.menu.addAction(copy_action)
|
|
|
|
|
- copy_action.triggered.connect(self.copy_text)
|
|
|
|
|
- if txt == '':
|
|
|
|
|
- copy_action.setDisabled(True)
|
|
|
|
|
-
|
|
|
|
|
- # PASTE
|
|
|
|
|
- paste_action = QAction('%s\t%s' % (_("Paste"), _('Ctrl+V')), self)
|
|
|
|
|
- self.menu.addAction(paste_action)
|
|
|
|
|
- paste_action.triggered.connect(self.paste_text)
|
|
|
|
|
-
|
|
|
|
|
- # DELETE
|
|
|
|
|
- delete_action = QAction('%s\t%s' % (_("Delete"), _('Del')), self)
|
|
|
|
|
- self.menu.addAction(delete_action)
|
|
|
|
|
- delete_action.triggered.connect(self.delete_text)
|
|
|
|
|
-
|
|
|
|
|
- self.menu.addSeparator()
|
|
|
|
|
-
|
|
|
|
|
- # SELECT ALL
|
|
|
|
|
- sel_all_action = QAction('%s\t%s' % (_("Select All"), _('Ctrl+A')), self)
|
|
|
|
|
- self.menu.addAction(sel_all_action)
|
|
|
|
|
- sel_all_action.triggered.connect(self.selectAll)
|
|
|
|
|
-
|
|
|
|
|
- self.menu.exec_(event.globalPos())
|
|
|
|
|
-
|
|
|
|
|
- def cut_text(self):
|
|
|
|
|
- tcursor = self.textCursor()
|
|
|
|
|
- clipboard = QtWidgets.QApplication.clipboard()
|
|
|
|
|
-
|
|
|
|
|
- txt = tcursor.selectedText()
|
|
|
|
|
- clipboard.clear()
|
|
|
|
|
- clipboard.setText(txt)
|
|
|
|
|
-
|
|
|
|
|
- tcursor.deleteChar()
|
|
|
|
|
-
|
|
|
|
|
- def copy_text(self):
|
|
|
|
|
- tcursor = self.textCursor()
|
|
|
|
|
- clipboard = QtWidgets.QApplication.clipboard()
|
|
|
|
|
-
|
|
|
|
|
- txt = tcursor.selectedText()
|
|
|
|
|
- clipboard.clear()
|
|
|
|
|
- clipboard.setText(txt)
|
|
|
|
|
-
|
|
|
|
|
- def paste_text(self):
|
|
|
|
|
- tcursor = self.textCursor()
|
|
|
|
|
- clipboard = QtWidgets.QApplication.clipboard()
|
|
|
|
|
-
|
|
|
|
|
- txt = clipboard.text()
|
|
|
|
|
- tcursor.insertText(txt)
|
|
|
|
|
-
|
|
|
|
|
- def delete_text(self):
|
|
|
|
|
- tcursor = self.textCursor()
|
|
|
|
|
- tcursor.deleteChar()
|
|
|
|
|
-
|
|
|
|
|
def comment(self):
|
|
def comment(self):
|
|
|
"""
|
|
"""
|
|
|
Got it from here:
|
|
Got it from here:
|
|
@@ -3602,7 +3614,7 @@ class _BrowserTextEdit(QTextEdit):
|
|
|
app.save_to_file(content_to_save=html_content, txt_content=txt_content)
|
|
app.save_to_file(content_to_save=html_content, txt_content=txt_content)
|
|
|
|
|
|
|
|
|
|
|
|
|
-class _ExpandableTextEdit(QTextEdit):
|
|
|
|
|
|
|
+class _ExpandableTextEdit(FCTextEdit):
|
|
|
"""
|
|
"""
|
|
|
Class implements edit line, which expands themselves automatically
|
|
Class implements edit line, which expands themselves automatically
|
|
|
"""
|
|
"""
|
|
@@ -3611,7 +3623,7 @@ class _ExpandableTextEdit(QTextEdit):
|
|
|
historyPrev = QtCore.pyqtSignal()
|
|
historyPrev = QtCore.pyqtSignal()
|
|
|
|
|
|
|
|
def __init__(self, termwidget, *args):
|
|
def __init__(self, termwidget, *args):
|
|
|
- QTextEdit.__init__(self, *args)
|
|
|
|
|
|
|
+ FCTextEdit.__init__(self, *args)
|
|
|
self.setStyleSheet("font: 9pt \"Courier\";")
|
|
self.setStyleSheet("font: 9pt \"Courier\";")
|
|
|
self._fittedHeight = 1
|
|
self._fittedHeight = 1
|
|
|
self.textChanged.connect(self._fit_to_document)
|
|
self.textChanged.connect(self._fit_to_document)
|
|
@@ -3626,19 +3638,6 @@ class _ExpandableTextEdit(QTextEdit):
|
|
|
self.completer.insertText.connect(self.insertCompletion)
|
|
self.completer.insertText.connect(self.insertCompletion)
|
|
|
self.completer.popup().clicked.connect(self.insert_completion_click)
|
|
self.completer.popup().clicked.connect(self.insert_completion_click)
|
|
|
|
|
|
|
|
- self.menu = None
|
|
|
|
|
- self.undo_flag = False
|
|
|
|
|
- self.redo_flag = False
|
|
|
|
|
-
|
|
|
|
|
- self.undoAvailable.connect(self.on_undo_available)
|
|
|
|
|
- self.redoAvailable.connect(self.on_redo_available)
|
|
|
|
|
-
|
|
|
|
|
- def on_undo_available(self, val):
|
|
|
|
|
- self.undo_flag = val
|
|
|
|
|
-
|
|
|
|
|
- def on_redo_available(self, val):
|
|
|
|
|
- self.redo_flag = val
|
|
|
|
|
-
|
|
|
|
|
def set_model_data(self, keyword_list):
|
|
def set_model_data(self, keyword_list):
|
|
|
self.model.setStringList(keyword_list)
|
|
self.model.setStringList(keyword_list)
|
|
|
|
|
|
|
@@ -3725,89 +3724,6 @@ class _ExpandableTextEdit(QTextEdit):
|
|
|
else:
|
|
else:
|
|
|
self.completer.popup().hide()
|
|
self.completer.popup().hide()
|
|
|
|
|
|
|
|
- def contextMenuEvent(self, event):
|
|
|
|
|
- self.menu = QtWidgets.QMenu()
|
|
|
|
|
- tcursor = self.textCursor()
|
|
|
|
|
- txt = tcursor.selectedText()
|
|
|
|
|
-
|
|
|
|
|
- # UNDO
|
|
|
|
|
- undo_action = QAction('%s\t%s' % (_("Undo"), _('Ctrl+Z')), self)
|
|
|
|
|
- self.menu.addAction(undo_action)
|
|
|
|
|
- undo_action.triggered.connect(self.undo)
|
|
|
|
|
- if self.undo_flag is False:
|
|
|
|
|
- undo_action.setDisabled(True)
|
|
|
|
|
-
|
|
|
|
|
- # REDO
|
|
|
|
|
- redo_action = QAction('%s\t%s' % (_("Redo"), _('Ctrl+Y')), self)
|
|
|
|
|
- self.menu.addAction(redo_action)
|
|
|
|
|
- redo_action.triggered.connect(self.redo)
|
|
|
|
|
- if self.redo_flag is False:
|
|
|
|
|
- redo_action.setDisabled(True)
|
|
|
|
|
-
|
|
|
|
|
- self.menu.addSeparator()
|
|
|
|
|
-
|
|
|
|
|
- # CUT
|
|
|
|
|
- cut_action = QAction('%s\t%s' % (_("Cut"), _('Ctrl+X')), self)
|
|
|
|
|
- self.menu.addAction(cut_action)
|
|
|
|
|
- cut_action.triggered.connect(self.cut_text)
|
|
|
|
|
- if txt == '':
|
|
|
|
|
- cut_action.setDisabled(True)
|
|
|
|
|
-
|
|
|
|
|
- # COPY
|
|
|
|
|
- copy_action = QAction('%s\t%s' % (_("Copy"), _('Ctrl+C')), self)
|
|
|
|
|
- self.menu.addAction(copy_action)
|
|
|
|
|
- copy_action.triggered.connect(self.copy_text)
|
|
|
|
|
- if txt == '':
|
|
|
|
|
- copy_action.setDisabled(True)
|
|
|
|
|
-
|
|
|
|
|
- # PASTE
|
|
|
|
|
- paste_action = QAction('%s\t%s' % (_("Paste"), _('Ctrl+V')), self)
|
|
|
|
|
- self.menu.addAction(paste_action)
|
|
|
|
|
- paste_action.triggered.connect(self.paste_text)
|
|
|
|
|
-
|
|
|
|
|
- # DELETE
|
|
|
|
|
- delete_action = QAction('%s\t%s' % (_("Delete"), _('Del')), self)
|
|
|
|
|
- self.menu.addAction(delete_action)
|
|
|
|
|
- delete_action.triggered.connect(self.delete_text)
|
|
|
|
|
-
|
|
|
|
|
- self.menu.addSeparator()
|
|
|
|
|
-
|
|
|
|
|
- # SELECT ALL
|
|
|
|
|
- sel_all_action = QAction('%s\t%s' % (_("Select All"), _('Ctrl+A')), self)
|
|
|
|
|
- self.menu.addAction(sel_all_action)
|
|
|
|
|
- sel_all_action.triggered.connect(self.selectAll)
|
|
|
|
|
-
|
|
|
|
|
- self.menu.exec_(event.globalPos())
|
|
|
|
|
-
|
|
|
|
|
- def cut_text(self):
|
|
|
|
|
- tcursor = self.textCursor()
|
|
|
|
|
- clipboard = QtWidgets.QApplication.clipboard()
|
|
|
|
|
-
|
|
|
|
|
- txt = tcursor.selectedText()
|
|
|
|
|
- clipboard.clear()
|
|
|
|
|
- clipboard.setText(txt)
|
|
|
|
|
-
|
|
|
|
|
- tcursor.deleteChar()
|
|
|
|
|
-
|
|
|
|
|
- def copy_text(self):
|
|
|
|
|
- tcursor = self.textCursor()
|
|
|
|
|
- clipboard = QtWidgets.QApplication.clipboard()
|
|
|
|
|
-
|
|
|
|
|
- txt = tcursor.selectedText()
|
|
|
|
|
- clipboard.clear()
|
|
|
|
|
- clipboard.setText(txt)
|
|
|
|
|
-
|
|
|
|
|
- def paste_text(self):
|
|
|
|
|
- tcursor = self.textCursor()
|
|
|
|
|
- clipboard = QtWidgets.QApplication.clipboard()
|
|
|
|
|
-
|
|
|
|
|
- txt = clipboard.text()
|
|
|
|
|
- tcursor.insertText(txt)
|
|
|
|
|
-
|
|
|
|
|
- def delete_text(self):
|
|
|
|
|
- tcursor = self.textCursor()
|
|
|
|
|
- tcursor.deleteChar()
|
|
|
|
|
-
|
|
|
|
|
def sizeHint(self):
|
|
def sizeHint(self):
|
|
|
"""
|
|
"""
|
|
|
QWidget sizeHint impelemtation
|
|
QWidget sizeHint impelemtation
|