Skip to content

Commit

Permalink
include tool name in tool editor window title
Browse files Browse the repository at this point in the history
  • Loading branch information
knipknap committed Aug 2, 2024
1 parent 36477d6 commit c165574
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions btl/ui/tooleditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@ def __init__(self, db, serializer, tool, tool_no=None, parent=None):
self.serializer = serializer
self.tool = tool
self.tool_no = tool_no
self.default_title = self.form.windowTitle()

nameWidget = QtGui.QLineEdit(tool.get_label())
label = translate('btl', 'Tool name')
nameWidget.setPlaceholderText(label)
self.form.vBox.insertWidget(0, nameWidget)
nameWidget.setFocus()
nameWidget.textChanged.connect(tool.set_label)
nameWidget.textChanged.connect(self._update)
self._update()

tool_tab_layout = self.form.toolTabLayout
widget = ShapeWidget(tool.shape)
Expand Down Expand Up @@ -60,6 +63,13 @@ def __init__(self, db, serializer, tool, tool_no=None, parent=None):
self.form.plainTextEditNotes.setPlainText(tool.get_notes())
self.form.plainTextEditNotes.textChanged.connect(self._on_notes_changed)

def _update(self):
title = self.default_title
tool_name = self.tool.get_label()
if tool_name:
title = '{} - {}'.format(tool_name, title)
self.form.setWindowTitle(title)

def _on_tab_switched(self, index):
if index == self.feeds_tab_idx:
self.feeds.update()
Expand Down

0 comments on commit c165574

Please sign in to comment.