Navigation Menu

Skip to content

Commit

Permalink
[processing] tiny improvements to the script editor
Browse files Browse the repository at this point in the history
- add a keyboard shortcut to toggle the find panel
- focus on the find text box when opening panel
- find text when hitting return
  • Loading branch information
nirvn committed May 19, 2018
1 parent 7464ca6 commit 6d067ba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions python/plugins/processing/script/ScriptEditorDialog.py
Expand Up @@ -106,6 +106,7 @@ def __init__(self, filePath=None, parent=None):
self.actionDecreaseFontSize.triggered.connect(self.editor.zoomOut)
self.editor.textChanged.connect(lambda: self.setHasChanged(True))

self.leFindText.returnPressed.connect(self.find)
self.btnFind.clicked.connect(self.find)
self.btnReplace.clicked.connect(self.replace)
self.lastSearch = None
Expand Down Expand Up @@ -257,6 +258,8 @@ def replace(self):

def toggleSearchBox(self, checked):
self.searchWidget.setVisible(checked)
if (checked):
self.leFindText.setFocus()

def _loadFile(self, filePath):
with codecs.open(filePath, "r", encoding="utf-8") as f:
Expand Down
3 changes: 3 additions & 0 deletions python/plugins/processing/ui/DlgScriptEditor.ui
Expand Up @@ -240,6 +240,9 @@
<property name="checkable">
<bool>true</bool>
</property>
<property name="shortcut">
<string>Ctrl+F</string>
</property>
<property name="text">
<string>Find &amp;&amp; &amp;Replace</string>
</property>
Expand Down

0 comments on commit 6d067ba

Please sign in to comment.