mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
Add a context menu item to clear the template from a box
This commit is contained in:
parent
b8e12adf64
commit
dbdee0d46d
@ -39,10 +39,18 @@ class TemplateLineEditor(QLineEdit):
|
||||
menu = self.createStandardContextMenu()
|
||||
menu.addSeparator()
|
||||
|
||||
action_clear_field = menu.addAction(_('Remove any template from the box'))
|
||||
action_clear_field.triggered.connect(self.clear_field)
|
||||
action_open_editor = menu.addAction(_('Open Template Editor'))
|
||||
action_open_editor.triggered.connect(self.open_editor)
|
||||
menu.exec_(event.globalPos())
|
||||
|
||||
def clear_field(self):
|
||||
self.setText('')
|
||||
self.txt = None
|
||||
self.setReadOnly(False)
|
||||
self.setStyleSheet('TemplateLineEditor { color: black }')
|
||||
|
||||
def open_editor(self):
|
||||
if self.txt:
|
||||
t = TemplateDialog(self, self.txt, self.mi)
|
||||
|
Loading…
x
Reference in New Issue
Block a user