Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions picard/ui/widgets/scripttextedit.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,15 @@ def highlightBlock(self, text):

class ScriptCompleter(QCompleter):
def __init__(self, parent=None):
super().__init__(sorted(self.choices), parent)
super().__init__(self.choices, parent)
self.setCompletionMode(QCompleter.CompletionMode.UnfilteredPopupCompletion)
self.highlighted.connect(self.set_highlighted)
self.last_selected = ''
self.highlighted.connect(self.set_highlighted)

@property
def choices(self):
yield from (f'${name}' for name in script_function_names())
yield from (f'%{name}%' for name in script_variable_tag_names())
yield from sorted(f'${name}' for name in script_function_names())
yield from sorted(f'%{name}%' for name in script_variable_tag_names())

def set_highlighted(self, text):
self.last_selected = text
Expand Down Expand Up @@ -312,7 +312,7 @@ def __init__(self, parent):
super().__init__(parent)
config = get_config()
self.highlighter = TaggerScriptSyntaxHighlighter(self.document())
self.enable_completer()
self.initialize_completer()
self.setFontFamily(FONT_FAMILY_MONOSPACE)
self.setMouseTracking(True)
self.setAcceptRichText(False)
Expand Down Expand Up @@ -414,7 +414,7 @@ def update_show_tooltips(self):
QToolTip.hideText()
self.setToolTip('')

def enable_completer(self):
def initialize_completer(self):
self.completer = ScriptCompleter()
self.completer.setWidget(self)
self.completer.activated.connect(self.insert_completion)
Expand Down
Loading