diff --git a/cc3d/twedit5/EditorWindow.py b/cc3d/twedit5/EditorWindow.py
index c4c93e8..b6d4661 100644
--- a/cc3d/twedit5/EditorWindow.py
+++ b/cc3d/twedit5/EditorWindow.py
@@ -165,6 +165,7 @@ def __init__(self, _editor, _editorWindow):
def handleChangedText(self):
self.editorWindow.updateTextSizeLabel()
+ self.editorWindow.scheduleAutoSave(self.editor)
def handleModificationChanged(self, m):
@@ -454,6 +455,11 @@ def __init__(self, _startFileListener=True):
self.defaultEditor = None
self.textChangedHandlers = {}
+ self.autoSavePendingEditors = set()
+ self.autoSaveTimer = QTimer(self)
+ self.autoSaveTimer.setSingleShot(True)
+ self.autoSaveTimer.setInterval(self.configuration.setting("AutoSaveInterval"))
+ self.autoSaveTimer.timeout.connect(self.performAutoSave)
# class variables used in searches
@@ -1429,6 +1435,8 @@ def closeEvent(self, event):
openFilesToRestore = [{}, {}]
self.deactivateChangeSensing = True
+ self.autoSaveTimer.stop()
+ self.autoSavePendingEditors.clear()
# determining index of the current tab
@@ -4327,6 +4335,40 @@ def configureEnableQuickTextDecoding(self, _flag):
pass
+ def configureAutoPairCharacters(self, _flag):
+
+ """
+
+ fcn handling AutoPairCharacters configuration change
+
+ """
+
+ self.configuration.setSetting("AutoPairCharacters", _flag)
+
+ def configureEnableAutoSave(self, _flag):
+
+ """
+
+ fcn handling EnableAutoSave configuration change
+
+ """
+
+ self.configuration.setSetting("EnableAutoSave", _flag)
+ if not _flag:
+ self.autoSaveTimer.stop()
+ self.autoSavePendingEditors.clear()
+
+ def configureAutoSaveInterval(self, _value):
+
+ """
+
+ fcn handling AutoSaveInterval configuration change
+
+ """
+
+ self.configuration.setSetting("AutoSaveInterval", _value)
+ self.autoSaveTimer.setInterval(_value)
+
def configureAutocompletionThreshold(self, _value):
"""
@@ -5157,6 +5199,54 @@ def saveAll(self):
currentEditor.setFocus(Qt.MouseFocusReason)
+ def scheduleAutoSave(self, editor):
+
+ """
+
+ schedules autosave for a changed editor
+
+ """
+
+ if self.deactivateChangeSensing:
+ return
+
+ if not self.configuration.setting("EnableAutoSave"):
+ return
+
+ if editor is None or editor.isReadOnly():
+ return
+
+ file_name = self.getEditorFileName(editor)
+ if not file_name:
+ return
+
+ self.autoSavePendingEditors.add(editor)
+ self.autoSaveTimer.start(self.configuration.setting("AutoSaveInterval"))
+
+ def performAutoSave(self):
+
+ """
+
+ saves modified named documents after the configured autosave delay
+
+ """
+
+ if self.deactivateChangeSensing:
+ return
+
+ pending_editors = list(self.autoSavePendingEditors)
+ self.autoSavePendingEditors.clear()
+
+ for editor in pending_editors:
+ if editor is None or editor.isReadOnly() or not editor.isModified():
+ continue
+
+ file_name = self.getEditorFileName(editor)
+ if not file_name:
+ continue
+
+ self.saveFile(file_name, editor)
+
def about(self):
"""
diff --git a/cc3d/twedit5/QsciScintillaCustom.py b/cc3d/twedit5/QsciScintillaCustom.py
index 61e7a82..03cfd98 100644
--- a/cc3d/twedit5/QsciScintillaCustom.py
+++ b/cc3d/twedit5/QsciScintillaCustom.py
@@ -7,6 +7,14 @@
class QsciScintillaCustom(QsciScintilla):
+ AUTO_PAIR_CHARS = {
+ "'": "'",
+ '"': '"',
+ "(": ")",
+ "[": "]",
+ "{": "}"
+ }
+
def __init__(self, parent=None, _panel=None):
super(QsciScintillaCustom, self).__init__(parent)
@@ -88,9 +96,68 @@ def keyPressEvent(self, event):
elif event.modifiers() & Qt.ControlModifier and event.modifiers() & Qt.ShiftModifier:
self.handleScintillaDefaultShortcut('Ctrl+Shift', event)
+ elif self.handle_auto_pair_characters(event):
+ event.accept()
+
else:
super(QsciScintillaCustom, self).keyPressEvent(event)
+ def handle_auto_pair_characters(self, event):
+ """
+ Inserts matching closing characters or wraps selected text when enabled.
+
+ :param event: keyboard event
+ :return: True when this method handled the event
+ """
+ typed_text = event.text()
+ if len(typed_text) != 1:
+ return False
+
+ if not self.__auto_pair_characters_enabled():
+ return False
+
+ if event.modifiers() & (Qt.ControlModifier | Qt.AltModifier | Qt.MetaModifier):
+ return False
+
+ if typed_text in self.AUTO_PAIR_CHARS:
+ self.__insert_auto_pair(typed_text, self.AUTO_PAIR_CHARS[typed_text])
+ return True
+
+ if typed_text in self.AUTO_PAIR_CHARS.values() and self.__current_char() == typed_text:
+ line, index = self.getCursorPosition()
+ self.setCursorPosition(line, index + 1)
+ return True
+
+ return False
+
+ def __auto_pair_characters_enabled(self):
+ try:
+ return self.editorWindow.configuration.setting("AutoPairCharacters")
+ except AttributeError:
+ return True
+
+ def __insert_auto_pair(self, opening_char, closing_char):
+ if self.hasSelectedText():
+ selected_text = self.selectedText()
+ self.beginUndoAction()
+ self.replaceSelectedText(opening_char + selected_text + closing_char)
+ self.endUndoAction()
+ return
+
+ line, index = self.getCursorPosition()
+ self.beginUndoAction()
+ self.insert(opening_char + closing_char)
+ self.endUndoAction()
+ self.setCursorPosition(line, index + 1)
+
+ def __current_char(self):
+ line, index = self.getCursorPosition()
+ line_text = self.text(line)
+ if index < len(line_text):
+ return line_text[index]
+
+ return ''
+
def focusInEvent(self, event):
editor_tab = 0
diff --git a/cc3d/twedit5/configurationdlg.ui b/cc3d/twedit5/configurationdlg.ui
new file mode 100644
index 0000000..faabddb
--- /dev/null
+++ b/cc3d/twedit5/configurationdlg.ui
@@ -0,0 +1,738 @@
+
+
+ ConfigurationDlg
+
+
+
+ 0
+ 0
+ 579
+ 557
+
+
+
+ Configuration
+
+
+ -
+
+
+ 0
+
+
+
+ Editing
+
+
+
-
+
+
-
+
+
-
+
+
+ Use multiple spaces when Tab is pressed instead of a tab character. This is recommended for Python scripts.
+
+
+ Use spaces instead of tabs
+
+
+ true
+
+
+
+ -
+
+
+ Tab width
+
+
+
+ -
+
+
+ true
+
+
+ 1
+
+
+ 4
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
+ Display Line Number
+
+
+ true
+
+
+
+ -
+
+
+ Enable Text Folding
+
+
+ true
+
+
+
+ -
+
+
+ Display/hide vertical marks that help visualize indentation
+
+
+ Enable Tab Guidelines
+
+
+ true
+
+
+
+ -
+
+
+ Display/hide normally invisible white spaces
+
+
+ Display whitespaces
+
+
+
+ -
+
+
+ Display End of Line
+
+
+
+ -
+
+
+ Restore tabs on startup
+
+
+ true
+
+
+
+ -
+
+
+ Wrap Lines
+
+
+
+ -
+
+
+ Show Wrap Symbol
+
+
+
+ -
+
+
+ Automatically insert matching closing quotes, parentheses, brackets, and braces
+
+
+ Auto-pair quotes and brackets
+
+
+ true
+
+
+
+ -
+
+
+ Enable text decoding based on the first 1000 characters. This can be less accurate than full text scanning, but documents open faster.
+
+
+ Enable Quick Text Decoding
+
+
+ true
+
+
+
+ -
+
+
-
+
+
+ Automatically save modified named files after a short delay
+
+
+ Enable Auto-save
+
+
+ true
+
+
+
+ -
+
+
-
+
+
+
+ 210
+ 0
+
+
+
+ Delay in milliseconds after typing stops before autosave runs
+
+
+ Auto-save timeout (ms)
+
+
+
+ -
+
+
+
+ 90
+ 0
+
+
+
+ Delay in milliseconds after typing stops before autosave runs
+
+
+ 100
+
+
+ 600000
+
+
+ 100
+
+
+ 1000
+
+
+
+
+
+ -
+
+
+ Enable Autocompletion
+
+
+ true
+
+
+
+ -
+
+
-
+
+
+
+ 210
+ 0
+
+
+
+ Determines minimum number of characters after which autocompletion options will be displayed
+
+
+ Autocompletion threshold
+
+
+
+ -
+
+
+
+ 90
+ 0
+
+
+
+ 1
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 164
+ 20
+
+
+
+
+
+
+
+
+ Style Config
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
-
+
+
-
+
+
+ Editor Theme
+
+
+
-
+
+
+
+
+
+ -
+
+
+ Fonts
+
+
+
-
+
+
-
+
+
-
+
+
+ Font
+
+
+
+ -
+
+
+
+ Courier New
+ 10
+
+
+
+
+
+
+ -
+
+
-
+
+
+ Size
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
-
+
+ 8
+
+
+ -
+
+ 9
+
+
+ -
+
+ 10
+
+
+ -
+
+ 11
+
+
+ -
+
+ 12
+
+
+ -
+
+ 14
+
+
+ -
+
+ 16
+
+
+ -
+
+ 18
+
+
+ -
+
+ 20
+
+
+ -
+
+ 22
+
+
+ -
+
+ 24
+
+
+ -
+
+ 26
+
+
+ -
+
+ 28
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 17
+ 165
+
+
+
+
+
+
+
+
+ Plugins
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
-
+
+
+ -
+
+
-
+
+
+ true
+
+
+
+ -
+
+
-
+
+
+ Load
+
+
+
+ -
+
+
+ Unload
+
+
+
+ -
+
+
+ Load on startup
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
-
+
+
+ OK
+
+
+
+ -
+
+
+ Cancel
+
+
+
+
+
+
+
+
+
+
+
+
+ tabSpacesCheckBox
+ toggled(bool)
+ spacesSpinBox
+ setEnabled(bool)
+
+
+ 20
+ 20
+
+
+ 20
+ 20
+
+
+
+
+ cancelButton
+ clicked()
+ ConfigurationDlg
+ reject()
+
+
+ 20
+ 20
+
+
+ 20
+ 20
+
+
+
+
+ okButton
+ clicked()
+ ConfigurationDlg
+ accept()
+
+
+ 20
+ 20
+
+
+ 20
+ 20
+
+
+
+
+ wrapLinesCheckBox
+ toggled(bool)
+ showWrapSymbolCheckBox
+ setEnabled(bool)
+
+
+ 20
+ 20
+
+
+ 20
+ 20
+
+
+
+
+ autocompletionCheckBox
+ toggled(bool)
+ autocompletionSpinBox
+ setEnabled(bool)
+
+
+ 20
+ 20
+
+
+ 20
+ 20
+
+
+
+
+ autoSaveCheckBox
+ toggled(bool)
+ autoSaveIntervalLabel
+ setEnabled(bool)
+
+
+ 20
+ 20
+
+
+ 20
+ 20
+
+
+
+
+ autoSaveCheckBox
+ toggled(bool)
+ autoSaveIntervalSpinBox
+ setEnabled(bool)
+
+
+ 20
+ 20
+
+
+ 20
+ 20
+
+
+
+
+
diff --git a/cc3d/twedit5/twedit/editor/Configuration.py b/cc3d/twedit5/twedit/editor/Configuration.py
index f86a03e..4ebd3dc 100644
--- a/cc3d/twedit5/twedit/editor/Configuration.py
+++ b/cc3d/twedit5/twedit/editor/Configuration.py
@@ -70,6 +70,12 @@ def initialize_default_settings(self):
self.defaultConfigs["EnableAutocompletion"] = False
+ self.defaultConfigs["AutoPairCharacters"] = True
+
+ self.defaultConfigs["EnableAutoSave"] = True
+
+ self.defaultConfigs["AutoSaveInterval"] = 1000
+
self.defaultConfigs["EnableQuickTextDecoding"] = True
self.defaultConfigs["AutocompletionThreshold"] = 2
@@ -166,7 +172,8 @@ def setting(self, _key):
"RestoreTabsOnStartup", "EnableAutocompletion", "EnableQuickTextDecoding", "FRInSelection",
- "FRInAllSubfolders", "FRTransparencyEnable", "FROnLosingFocus", "FRAlways"]:
+ "AutoPairCharacters", "EnableAutoSave", "FRInAllSubfolders", "FRTransparencyEnable",
+ "FROnLosingFocus", "FRAlways"]:
variant = self.settings.value(_key)
if variant is not None:
@@ -189,7 +196,8 @@ def setting(self, _key):
elif _key in ["TabSpaces", "ZoomRange", "ZoomRangeFindDisplayWidget", "AutocompletionThreshold",
- "FRSyntaxIndex", "FROpacity", "CurrentTabIndex", "CurrentPanelIndex"]: # integer values
+ "AutoSaveInterval", "FRSyntaxIndex", "FROpacity", "CurrentTabIndex",
+ "CurrentPanelIndex"]: # integer values
variant = self.settings.value(_key)
if variant is not None:
@@ -263,13 +271,14 @@ def setSetting(self, _key, _value):
if _key in ["UseTabSpaces", "DisplayLineNumbers", "FoldText", "TabGuidelines", "DisplayWhitespace",
"DisplayEOL", "WrapLines", "ShowWrapSymbol", "DontShowWrapLinesWarning",
"RestoreTabsOnStartup", "EnableAutocompletion", "EnableQuickTextDecoding", "FRInSelection",
- "FRInAllSubfolders", "FRTransparencyEnable", "FROnLosingFocus", "FRAlways"]:
+ "AutoPairCharacters", "EnableAutoSave", "FRInAllSubfolders", "FRTransparencyEnable",
+ "FROnLosingFocus", "FRAlways"]:
self.settings.setValue(_key, QVariant(_value))
# integer values
elif _key in ["TabSpaces", "ZoomRange", "ZoomRangeFindDisplayWidget", "AutocompletionThreshold",
- "FRSyntaxIndex", "FROpacity", "CurrentTabIndex", "CurrentPanelIndex"]:
+ "AutoSaveInterval", "FRSyntaxIndex", "FROpacity", "CurrentTabIndex", "CurrentPanelIndex"]:
self.settings.setValue(_key, _value)
@@ -355,9 +364,9 @@ def initSyncSettings(self):
val = self.settings.value(key)
- # if not val.isValid():
-
- if not val:
+ # QSettings.value returns None only when the setting is missing.
+ # False, 0, empty lists, and empty strings are valid persisted values.
+ if val is None:
self.setSetting(key, self.defaultConfigs[key])
# initialize self.modifiedKeyboardShortcuts
diff --git a/cc3d/twedit5/twedit/editor/configurationdlg.py b/cc3d/twedit5/twedit/editor/configurationdlg.py
index e6f77d8..dd07f07 100644
--- a/cc3d/twedit5/twedit/editor/configurationdlg.py
+++ b/cc3d/twedit5/twedit/editor/configurationdlg.py
@@ -229,6 +229,15 @@ def findChangedConfigs(self):
if configuration.setting("EnableAutocompletion") != self.autocompletionCheckBox.isChecked():
configuration.updatedConfigs["EnableAutocompletion"] = self.autocompletionCheckBox.isChecked()
+ if configuration.setting("AutoPairCharacters") != self.autoPairCharactersCheckBox.isChecked():
+ configuration.updatedConfigs["AutoPairCharacters"] = self.autoPairCharactersCheckBox.isChecked()
+
+ if configuration.setting("EnableAutoSave") != self.autoSaveCheckBox.isChecked():
+ configuration.updatedConfigs["EnableAutoSave"] = self.autoSaveCheckBox.isChecked()
+
+ if configuration.setting("AutoSaveInterval") != self.autoSaveIntervalSpinBox.value():
+ configuration.updatedConfigs["AutoSaveInterval"] = self.autoSaveIntervalSpinBox.value()
+
if configuration.setting("EnableQuickTextDecoding") != self.quickTextDecodingCB.isChecked():
configuration.updatedConfigs["EnableQuickTextDecoding"] = self.quickTextDecodingCB.isChecked()
@@ -279,6 +288,12 @@ def updateUi(self):
self.autocompletionCheckBox.setChecked(configuration.setting("EnableAutocompletion"))
+ self.autoPairCharactersCheckBox.setChecked(configuration.setting("AutoPairCharacters"))
+
+ self.autoSaveCheckBox.setChecked(configuration.setting("EnableAutoSave"))
+
+ self.autoSaveIntervalSpinBox.setValue(configuration.setting("AutoSaveInterval"))
+
self.quickTextDecodingCB.setChecked(configuration.setting("EnableQuickTextDecoding"))
self.autocompletionSpinBox.setValue(configuration.setting("AutocompletionThreshold"))
diff --git a/cc3d/twedit5/ui_configurationdlg.py b/cc3d/twedit5/ui_configurationdlg.py
index 82bd2f3..a34ef4e 100644
--- a/cc3d/twedit5/ui_configurationdlg.py
+++ b/cc3d/twedit5/ui_configurationdlg.py
@@ -1,572 +1,308 @@
# -*- coding: utf-8 -*-
-
-
# Form implementation generated from reading ui file 'configurationdlg.ui'
-
#
-
-# Created by: PyQt5 UI code generator 5.6
-
+# Created by: PyQt5 UI code generator 5.15.9
#
-
-# WARNING! All changes made in this file will be lost!
-
+# WARNING: Any manual changes made to this file will be lost when pyuic5 is
+# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets
-
class Ui_ConfigurationDlg(object):
-
def setupUi(self, ConfigurationDlg):
-
ConfigurationDlg.setObjectName("ConfigurationDlg")
-
- ConfigurationDlg.resize(530, 446)
-
+ ConfigurationDlg.resize(579, 557)
self.verticalLayout_3 = QtWidgets.QVBoxLayout(ConfigurationDlg)
-
self.verticalLayout_3.setObjectName("verticalLayout_3")
-
self.tabWidget = QtWidgets.QTabWidget(ConfigurationDlg)
-
self.tabWidget.setObjectName("tabWidget")
-
self.editingTab = QtWidgets.QWidget()
-
self.editingTab.setObjectName("editingTab")
-
- self.gridLayout_2 = QtWidgets.QGridLayout(self.editingTab)
-
- self.gridLayout_2.setContentsMargins(0, 0, 0, 0)
-
- self.gridLayout_2.setObjectName("gridLayout_2")
-
+ self.horizontalLayout_10 = QtWidgets.QHBoxLayout(self.editingTab)
+ self.horizontalLayout_10.setObjectName("horizontalLayout_10")
self.verticalLayout_2 = QtWidgets.QVBoxLayout()
-
self.verticalLayout_2.setObjectName("verticalLayout_2")
-
self.gridLayout = QtWidgets.QGridLayout()
-
self.gridLayout.setObjectName("gridLayout")
-
self.tabSpacesCheckBox = QtWidgets.QCheckBox(self.editingTab)
-
self.tabSpacesCheckBox.setChecked(True)
-
self.tabSpacesCheckBox.setObjectName("tabSpacesCheckBox")
-
self.gridLayout.addWidget(self.tabSpacesCheckBox, 0, 0, 1, 3)
-
self.tabWidthLabel = QtWidgets.QLabel(self.editingTab)
-
self.tabWidthLabel.setObjectName("tabWidthLabel")
-
self.gridLayout.addWidget(self.tabWidthLabel, 1, 0, 1, 1)
-
self.spacesSpinBox = QtWidgets.QSpinBox(self.editingTab)
-
self.spacesSpinBox.setEnabled(True)
-
self.spacesSpinBox.setMinimum(1)
-
self.spacesSpinBox.setProperty("value", 4)
-
self.spacesSpinBox.setObjectName("spacesSpinBox")
-
self.gridLayout.addWidget(self.spacesSpinBox, 1, 1, 1, 1)
-
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
-
self.gridLayout.addItem(spacerItem, 1, 2, 1, 1)
-
self.verticalLayout_2.addLayout(self.gridLayout)
-
- self.verticalLayout = QtWidgets.QVBoxLayout()
-
- self.verticalLayout.setObjectName("verticalLayout")
-
self.lineNumberCheckBox = QtWidgets.QCheckBox(self.editingTab)
-
self.lineNumberCheckBox.setChecked(True)
-
self.lineNumberCheckBox.setObjectName("lineNumberCheckBox")
-
- self.verticalLayout.addWidget(self.lineNumberCheckBox)
-
+ self.verticalLayout_2.addWidget(self.lineNumberCheckBox)
self.foldTextCheckBox = QtWidgets.QCheckBox(self.editingTab)
-
self.foldTextCheckBox.setChecked(True)
-
self.foldTextCheckBox.setObjectName("foldTextCheckBox")
-
- self.verticalLayout.addWidget(self.foldTextCheckBox)
-
+ self.verticalLayout_2.addWidget(self.foldTextCheckBox)
self.tabGuidelinesCheckBox = QtWidgets.QCheckBox(self.editingTab)
-
self.tabGuidelinesCheckBox.setChecked(True)
-
self.tabGuidelinesCheckBox.setObjectName("tabGuidelinesCheckBox")
-
- self.verticalLayout.addWidget(self.tabGuidelinesCheckBox)
-
+ self.verticalLayout_2.addWidget(self.tabGuidelinesCheckBox)
self.whiteSpaceCheckBox = QtWidgets.QCheckBox(self.editingTab)
-
self.whiteSpaceCheckBox.setObjectName("whiteSpaceCheckBox")
-
- self.verticalLayout.addWidget(self.whiteSpaceCheckBox)
-
+ self.verticalLayout_2.addWidget(self.whiteSpaceCheckBox)
self.eolCheckBox = QtWidgets.QCheckBox(self.editingTab)
-
self.eolCheckBox.setObjectName("eolCheckBox")
-
- self.verticalLayout.addWidget(self.eolCheckBox)
-
+ self.verticalLayout_2.addWidget(self.eolCheckBox)
self.restoreTabsCheckBox = QtWidgets.QCheckBox(self.editingTab)
-
self.restoreTabsCheckBox.setChecked(True)
-
self.restoreTabsCheckBox.setObjectName("restoreTabsCheckBox")
-
- self.verticalLayout.addWidget(self.restoreTabsCheckBox)
-
+ self.verticalLayout_2.addWidget(self.restoreTabsCheckBox)
self.wrapLinesCheckBox = QtWidgets.QCheckBox(self.editingTab)
-
self.wrapLinesCheckBox.setObjectName("wrapLinesCheckBox")
-
- self.verticalLayout.addWidget(self.wrapLinesCheckBox)
-
+ self.verticalLayout_2.addWidget(self.wrapLinesCheckBox)
self.showWrapSymbolCheckBox = QtWidgets.QCheckBox(self.editingTab)
-
self.showWrapSymbolCheckBox.setObjectName("showWrapSymbolCheckBox")
-
- self.verticalLayout.addWidget(self.showWrapSymbolCheckBox)
-
- self.autocompletionCheckBox = QtWidgets.QCheckBox(self.editingTab)
-
- self.autocompletionCheckBox.setChecked(True)
-
- self.autocompletionCheckBox.setObjectName("autocompletionCheckBox")
-
- self.verticalLayout.addWidget(self.autocompletionCheckBox)
-
+ self.verticalLayout_2.addWidget(self.showWrapSymbolCheckBox)
+ self.autoPairCharactersCheckBox = QtWidgets.QCheckBox(self.editingTab)
+ self.autoPairCharactersCheckBox.setChecked(True)
+ self.autoPairCharactersCheckBox.setObjectName("autoPairCharactersCheckBox")
+ self.verticalLayout_2.addWidget(self.autoPairCharactersCheckBox)
self.quickTextDecodingCB = QtWidgets.QCheckBox(self.editingTab)
-
self.quickTextDecodingCB.setChecked(True)
-
self.quickTextDecodingCB.setObjectName("quickTextDecodingCB")
-
- self.verticalLayout.addWidget(self.quickTextDecodingCB)
-
+ self.verticalLayout_2.addWidget(self.quickTextDecodingCB)
+ self.verticalLayout = QtWidgets.QVBoxLayout()
+ self.verticalLayout.setObjectName("verticalLayout")
+ self.autoSaveCheckBox = QtWidgets.QCheckBox(self.editingTab)
+ self.autoSaveCheckBox.setChecked(True)
+ self.autoSaveCheckBox.setObjectName("autoSaveCheckBox")
+ self.verticalLayout.addWidget(self.autoSaveCheckBox)
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
-
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
-
+ self.autoSaveIntervalLabel = QtWidgets.QLabel(self.editingTab)
+ self.autoSaveIntervalLabel.setMinimumSize(QtCore.QSize(210, 0))
+ self.autoSaveIntervalLabel.setObjectName("autoSaveIntervalLabel")
+ self.horizontalLayout_3.addWidget(self.autoSaveIntervalLabel)
+ self.autoSaveIntervalSpinBox = QtWidgets.QSpinBox(self.editingTab)
+ self.autoSaveIntervalSpinBox.setMinimumSize(QtCore.QSize(90, 0))
+ self.autoSaveIntervalSpinBox.setMinimum(100)
+ self.autoSaveIntervalSpinBox.setMaximum(600000)
+ self.autoSaveIntervalSpinBox.setSingleStep(100)
+ self.autoSaveIntervalSpinBox.setProperty("value", 1000)
+ self.autoSaveIntervalSpinBox.setObjectName("autoSaveIntervalSpinBox")
+ self.horizontalLayout_3.addWidget(self.autoSaveIntervalSpinBox)
+ self.verticalLayout.addLayout(self.horizontalLayout_3)
+ self.autocompletionCheckBox = QtWidgets.QCheckBox(self.editingTab)
+ self.autocompletionCheckBox.setChecked(True)
+ self.autocompletionCheckBox.setObjectName("autocompletionCheckBox")
+ self.verticalLayout.addWidget(self.autocompletionCheckBox)
+ self.horizontalLayout_9 = QtWidgets.QHBoxLayout()
+ self.horizontalLayout_9.setObjectName("horizontalLayout_9")
self.autocompletionLabel = QtWidgets.QLabel(self.editingTab)
-
+ self.autocompletionLabel.setMinimumSize(QtCore.QSize(210, 0))
self.autocompletionLabel.setObjectName("autocompletionLabel")
-
- self.horizontalLayout_3.addWidget(self.autocompletionLabel)
-
+ self.horizontalLayout_9.addWidget(self.autocompletionLabel)
self.autocompletionSpinBox = QtWidgets.QSpinBox(self.editingTab)
-
+ self.autocompletionSpinBox.setMinimumSize(QtCore.QSize(90, 0))
self.autocompletionSpinBox.setMinimum(1)
-
self.autocompletionSpinBox.setProperty("value", 2)
-
self.autocompletionSpinBox.setObjectName("autocompletionSpinBox")
-
- self.horizontalLayout_3.addWidget(self.autocompletionSpinBox)
-
- self.verticalLayout.addLayout(self.horizontalLayout_3)
-
+ self.horizontalLayout_9.addWidget(self.autocompletionSpinBox)
+ self.verticalLayout.addLayout(self.horizontalLayout_9)
self.verticalLayout_2.addLayout(self.verticalLayout)
-
- self.gridLayout_2.addLayout(self.verticalLayout_2, 0, 0, 1, 1)
-
- spacerItem1 = QtWidgets.QSpacerItem(204, 291, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
-
- self.gridLayout_2.addItem(spacerItem1, 0, 1, 1, 1)
-
- spacerItem2 = QtWidgets.QSpacerItem(177, 10, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
-
- self.gridLayout_2.addItem(spacerItem2, 1, 0, 1, 1)
-
+ self.horizontalLayout_10.addLayout(self.verticalLayout_2)
+ spacerItem1 = QtWidgets.QSpacerItem(164, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.horizontalLayout_10.addItem(spacerItem1)
self.tabWidget.addTab(self.editingTab, "")
-
self.tab_2 = QtWidgets.QWidget()
-
self.tab_2.setObjectName("tab_2")
-
self.verticalLayout_9 = QtWidgets.QVBoxLayout(self.tab_2)
-
self.verticalLayout_9.setContentsMargins(0, 0, 0, 0)
-
self.verticalLayout_9.setObjectName("verticalLayout_9")
-
self.horizontalLayout_8 = QtWidgets.QHBoxLayout()
-
self.horizontalLayout_8.setObjectName("horizontalLayout_8")
-
self.verticalLayout_8 = QtWidgets.QVBoxLayout()
-
self.verticalLayout_8.setObjectName("verticalLayout_8")
-
self.groupBox = QtWidgets.QGroupBox(self.tab_2)
-
self.groupBox.setObjectName("groupBox")
-
self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.groupBox)
-
self.verticalLayout_5.setObjectName("verticalLayout_5")
-
self.themeCB = QtWidgets.QComboBox(self.groupBox)
-
self.themeCB.setObjectName("themeCB")
-
self.verticalLayout_5.addWidget(self.themeCB)
-
self.verticalLayout_8.addWidget(self.groupBox)
-
self.fontGroupBox = QtWidgets.QGroupBox(self.tab_2)
-
self.fontGroupBox.setObjectName("fontGroupBox")
-
self.verticalLayout_7 = QtWidgets.QVBoxLayout(self.fontGroupBox)
-
self.verticalLayout_7.setObjectName("verticalLayout_7")
-
self.verticalLayout_4 = QtWidgets.QVBoxLayout()
-
self.verticalLayout_4.setObjectName("verticalLayout_4")
-
self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
-
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
-
self.fontLabel = QtWidgets.QLabel(self.fontGroupBox)
-
self.fontLabel.setObjectName("fontLabel")
-
self.horizontalLayout_4.addWidget(self.fontLabel)
-
self.fontComboBox = QtWidgets.QFontComboBox(self.fontGroupBox)
-
font = QtGui.QFont()
-
font.setFamily("Courier New")
-
font.setPointSize(10)
-
self.fontComboBox.setCurrentFont(font)
-
self.fontComboBox.setObjectName("fontComboBox")
-
self.horizontalLayout_4.addWidget(self.fontComboBox)
-
self.verticalLayout_4.addLayout(self.horizontalLayout_4)
-
self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
-
self.horizontalLayout_5.setObjectName("horizontalLayout_5")
-
self.fontSizeLabel = QtWidgets.QLabel(self.fontGroupBox)
-
self.fontSizeLabel.setObjectName("fontSizeLabel")
-
self.horizontalLayout_5.addWidget(self.fontSizeLabel)
-
- spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
-
- self.horizontalLayout_5.addItem(spacerItem3)
-
+ spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.horizontalLayout_5.addItem(spacerItem2)
self.fontSizeComboBox = QtWidgets.QComboBox(self.fontGroupBox)
-
self.fontSizeComboBox.setObjectName("fontSizeComboBox")
-
self.fontSizeComboBox.addItem("")
-
self.fontSizeComboBox.addItem("")
-
self.fontSizeComboBox.addItem("")
-
self.fontSizeComboBox.addItem("")
-
self.fontSizeComboBox.addItem("")
-
self.fontSizeComboBox.addItem("")
-
self.fontSizeComboBox.addItem("")
-
self.fontSizeComboBox.addItem("")
-
self.fontSizeComboBox.addItem("")
-
self.fontSizeComboBox.addItem("")
-
self.fontSizeComboBox.addItem("")
-
self.fontSizeComboBox.addItem("")
-
self.fontSizeComboBox.addItem("")
-
self.horizontalLayout_5.addWidget(self.fontSizeComboBox)
-
self.verticalLayout_4.addLayout(self.horizontalLayout_5)
-
self.verticalLayout_7.addLayout(self.verticalLayout_4)
-
self.verticalLayout_8.addWidget(self.fontGroupBox)
-
self.horizontalLayout_8.addLayout(self.verticalLayout_8)
-
- spacerItem4 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
-
- self.horizontalLayout_8.addItem(spacerItem4)
-
+ spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.horizontalLayout_8.addItem(spacerItem3)
self.verticalLayout_9.addLayout(self.horizontalLayout_8)
-
- spacerItem5 = QtWidgets.QSpacerItem(17, 165, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
-
- self.verticalLayout_9.addItem(spacerItem5)
-
+ spacerItem4 = QtWidgets.QSpacerItem(17, 165, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.verticalLayout_9.addItem(spacerItem4)
self.tabWidget.addTab(self.tab_2, "")
-
self.tab = QtWidgets.QWidget()
-
self.tab.setObjectName("tab")
-
self.verticalLayout_10 = QtWidgets.QVBoxLayout(self.tab)
-
self.verticalLayout_10.setContentsMargins(0, 0, 0, 0)
-
self.verticalLayout_10.setObjectName("verticalLayout_10")
-
self.horizontalLayout_7 = QtWidgets.QHBoxLayout()
-
self.horizontalLayout_7.setObjectName("horizontalLayout_7")
-
self.pluginsLW = QtWidgets.QListWidget(self.tab)
-
self.pluginsLW.setObjectName("pluginsLW")
-
self.horizontalLayout_7.addWidget(self.pluginsLW)
-
self.verticalLayout_6 = QtWidgets.QVBoxLayout()
-
self.verticalLayout_6.setObjectName("verticalLayout_6")
-
self.pluginsTE = QtWidgets.QTextEdit(self.tab)
-
self.pluginsTE.setReadOnly(True)
-
self.pluginsTE.setObjectName("pluginsTE")
-
self.verticalLayout_6.addWidget(self.pluginsTE)
-
self.horizontalLayout_6 = QtWidgets.QHBoxLayout()
-
self.horizontalLayout_6.setObjectName("horizontalLayout_6")
-
self.loadPB = QtWidgets.QPushButton(self.tab)
-
self.loadPB.setObjectName("loadPB")
-
self.horizontalLayout_6.addWidget(self.loadPB)
-
self.unloadPB = QtWidgets.QPushButton(self.tab)
-
self.unloadPB.setObjectName("unloadPB")
-
self.horizontalLayout_6.addWidget(self.unloadPB)
-
self.loadOnStartupCHB = QtWidgets.QCheckBox(self.tab)
-
self.loadOnStartupCHB.setObjectName("loadOnStartupCHB")
-
self.horizontalLayout_6.addWidget(self.loadOnStartupCHB)
-
- spacerItem6 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
-
- self.horizontalLayout_6.addItem(spacerItem6)
-
+ spacerItem5 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.horizontalLayout_6.addItem(spacerItem5)
self.verticalLayout_6.addLayout(self.horizontalLayout_6)
-
- spacerItem7 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
-
- self.verticalLayout_6.addItem(spacerItem7)
-
+ spacerItem6 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.verticalLayout_6.addItem(spacerItem6)
self.horizontalLayout_7.addLayout(self.verticalLayout_6)
-
self.verticalLayout_10.addLayout(self.horizontalLayout_7)
-
self.tabWidget.addTab(self.tab, "")
-
self.verticalLayout_3.addWidget(self.tabWidget)
-
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
-
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
-
- spacerItem8 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
-
- self.horizontalLayout_2.addItem(spacerItem8)
-
+ spacerItem7 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.horizontalLayout_2.addItem(spacerItem7)
self.horizontalLayout = QtWidgets.QHBoxLayout()
-
self.horizontalLayout.setObjectName("horizontalLayout")
-
self.okButton = QtWidgets.QPushButton(ConfigurationDlg)
-
self.okButton.setObjectName("okButton")
-
self.horizontalLayout.addWidget(self.okButton)
-
self.cancelButton = QtWidgets.QPushButton(ConfigurationDlg)
-
self.cancelButton.setObjectName("cancelButton")
-
self.horizontalLayout.addWidget(self.cancelButton)
-
self.horizontalLayout_2.addLayout(self.horizontalLayout)
-
self.verticalLayout_3.addLayout(self.horizontalLayout_2)
-
-
self.retranslateUi(ConfigurationDlg)
-
self.tabWidget.setCurrentIndex(0)
-
- self.fontSizeComboBox.setCurrentIndex(2)
-
- self.tabSpacesCheckBox.toggled['bool'].connect(self.spacesSpinBox.setEnabled)
-
- self.cancelButton.clicked.connect(ConfigurationDlg.reject)
-
- self.okButton.clicked.connect(ConfigurationDlg.accept)
-
- self.wrapLinesCheckBox.toggled['bool'].connect(self.showWrapSymbolCheckBox.setEnabled)
-
- self.autocompletionCheckBox.toggled['bool'].connect(self.autocompletionSpinBox.setEnabled)
-
+ self.tabSpacesCheckBox.toggled['bool'].connect(self.spacesSpinBox.setEnabled) # type: ignore
+ self.cancelButton.clicked.connect(ConfigurationDlg.reject) # type: ignore
+ self.okButton.clicked.connect(ConfigurationDlg.accept) # type: ignore
+ self.wrapLinesCheckBox.toggled['bool'].connect(self.showWrapSymbolCheckBox.setEnabled) # type: ignore
+ self.autocompletionCheckBox.toggled['bool'].connect(self.autocompletionSpinBox.setEnabled) # type: ignore
+ self.autoSaveCheckBox.toggled['bool'].connect(self.autoSaveIntervalLabel.setEnabled) # type: ignore
+ self.autoSaveCheckBox.toggled['bool'].connect(self.autoSaveIntervalSpinBox.setEnabled) # type: ignore
QtCore.QMetaObject.connectSlotsByName(ConfigurationDlg)
-
-
def retranslateUi(self, ConfigurationDlg):
-
_translate = QtCore.QCoreApplication.translate
-
ConfigurationDlg.setWindowTitle(_translate("ConfigurationDlg", "Configuration"))
-
- self.tabSpacesCheckBox.setToolTip(_translate("ConfigurationDlg", "\n"
-
-"
\n"
-
-"Set this option if you want to use multiple spaces when Tab key is pressed instead of "\\t" character.
\n"
-
-"This is highly recommended when editing Python scripts (unwritten standard is 4 spaces per tab)
"))
-
+ self.tabSpacesCheckBox.setToolTip(_translate("ConfigurationDlg", "Use multiple spaces when Tab is pressed instead of a tab character. This is recommended for Python scripts."))
self.tabSpacesCheckBox.setText(_translate("ConfigurationDlg", "Use spaces instead of tabs"))
-
self.tabWidthLabel.setText(_translate("ConfigurationDlg", "Tab width"))
-
self.lineNumberCheckBox.setText(_translate("ConfigurationDlg", "Display Line Number"))
-
self.foldTextCheckBox.setText(_translate("ConfigurationDlg", "Enable Text Folding"))
-
self.tabGuidelinesCheckBox.setToolTip(_translate("ConfigurationDlg", "Display/hide vertical marks that help visualize indentation"))
-
self.tabGuidelinesCheckBox.setText(_translate("ConfigurationDlg", "Enable Tab Guidelines"))
-
self.whiteSpaceCheckBox.setToolTip(_translate("ConfigurationDlg", "Display/hide normally invisible white spaces"))
-
self.whiteSpaceCheckBox.setText(_translate("ConfigurationDlg", "Display whitespaces"))
-
self.eolCheckBox.setText(_translate("ConfigurationDlg", "Display End of Line"))
-
self.restoreTabsCheckBox.setText(_translate("ConfigurationDlg", "Restore tabs on startup"))
-
self.wrapLinesCheckBox.setText(_translate("ConfigurationDlg", "Wrap Lines"))
-
self.showWrapSymbolCheckBox.setText(_translate("ConfigurationDlg", "Show Wrap Symbol"))
-
- self.autocompletionCheckBox.setText(_translate("ConfigurationDlg", "Enable Autocompletion"))
-
- self.quickTextDecodingCB.setToolTip(_translate("ConfigurationDlg", "\n"
-
-"\n"
-
-"Enales text decoding to be based on first 1000 characters.
\n"
-
-"It can be less acurate then full text scanning but documents open faster
"))
-
+ self.autoPairCharactersCheckBox.setToolTip(_translate("ConfigurationDlg", "Automatically insert matching closing quotes, parentheses, brackets, and braces"))
+ self.autoPairCharactersCheckBox.setText(_translate("ConfigurationDlg", "Auto-pair quotes and brackets"))
+ self.quickTextDecodingCB.setToolTip(_translate("ConfigurationDlg", "Enable text decoding based on the first 1000 characters. This can be less accurate than full text scanning, but documents open faster."))
self.quickTextDecodingCB.setText(_translate("ConfigurationDlg", "Enable Quick Text Decoding"))
-
+ self.autoSaveCheckBox.setToolTip(_translate("ConfigurationDlg", "Automatically save modified named files after a short delay"))
+ self.autoSaveCheckBox.setText(_translate("ConfigurationDlg", "Enable Auto-save"))
+ self.autoSaveIntervalLabel.setToolTip(_translate("ConfigurationDlg", "Delay in milliseconds after typing stops before autosave runs"))
+ self.autoSaveIntervalLabel.setText(_translate("ConfigurationDlg", "Auto-save timeout (ms)"))
+ self.autoSaveIntervalSpinBox.setToolTip(_translate("ConfigurationDlg", "Delay in milliseconds after typing stops before autosave runs"))
+ self.autocompletionCheckBox.setText(_translate("ConfigurationDlg", "Enable Autocompletion"))
self.autocompletionLabel.setToolTip(_translate("ConfigurationDlg", "Determines minimum number of characters after which autocompletion options will be displayed"))
-
self.autocompletionLabel.setText(_translate("ConfigurationDlg", "Autocompletion threshold"))
-
self.tabWidget.setTabText(self.tabWidget.indexOf(self.editingTab), _translate("ConfigurationDlg", "Editing"))
-
self.groupBox.setTitle(_translate("ConfigurationDlg", "Editor Theme"))
-
self.fontGroupBox.setTitle(_translate("ConfigurationDlg", "Fonts"))
-
self.fontLabel.setText(_translate("ConfigurationDlg", "Font"))
-
self.fontSizeLabel.setText(_translate("ConfigurationDlg", "Size"))
-
self.fontSizeComboBox.setItemText(0, _translate("ConfigurationDlg", "8"))
-
self.fontSizeComboBox.setItemText(1, _translate("ConfigurationDlg", "9"))
-
self.fontSizeComboBox.setItemText(2, _translate("ConfigurationDlg", "10"))
-
self.fontSizeComboBox.setItemText(3, _translate("ConfigurationDlg", "11"))
-
self.fontSizeComboBox.setItemText(4, _translate("ConfigurationDlg", "12"))
-
self.fontSizeComboBox.setItemText(5, _translate("ConfigurationDlg", "14"))
-
self.fontSizeComboBox.setItemText(6, _translate("ConfigurationDlg", "16"))
-
self.fontSizeComboBox.setItemText(7, _translate("ConfigurationDlg", "18"))
-
self.fontSizeComboBox.setItemText(8, _translate("ConfigurationDlg", "20"))
-
self.fontSizeComboBox.setItemText(9, _translate("ConfigurationDlg", "22"))
-
self.fontSizeComboBox.setItemText(10, _translate("ConfigurationDlg", "24"))
-
self.fontSizeComboBox.setItemText(11, _translate("ConfigurationDlg", "26"))
-
self.fontSizeComboBox.setItemText(12, _translate("ConfigurationDlg", "28"))
-
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("ConfigurationDlg", "Style Config"))
-
self.loadPB.setText(_translate("ConfigurationDlg", "Load"))
-
self.unloadPB.setText(_translate("ConfigurationDlg", "Unload"))
-
self.loadOnStartupCHB.setText(_translate("ConfigurationDlg", "Load on startup"))
-
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("ConfigurationDlg", "Plugins"))
-
self.okButton.setText(_translate("ConfigurationDlg", "OK"))
-
self.cancelButton.setText(_translate("ConfigurationDlg", "Cancel"))
-
-
-