mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Change the way history is shown in the buttons.
After using it for a bit it makes more sense to put the latest value into the combo box and show up to 4 older values in the buttons. This allows reusing the latest value by pressing return.
This commit is contained in:
parent
d693cb46fe
commit
78fec9b56d
@ -36,26 +36,22 @@ class MarkWithTextDialog(QDialog):
|
||||
textbox.initialize('mark_with_text')
|
||||
|
||||
history = textbox.all_items
|
||||
button_rows = min(4, len(history))
|
||||
button_rows = min(4, len(history)-1)
|
||||
for i in range(0, button_rows):
|
||||
if i == 0:
|
||||
layout.addWidget(QLabel(_('Recently used values:')), 0, 0, 1, 2)
|
||||
button = QPushButton()
|
||||
text = history[i]
|
||||
text = history[i+1]
|
||||
button.setText(text)
|
||||
button.clicked.connect(partial(self.button_pushed, text=text))
|
||||
row = i + 1
|
||||
layout.addWidget(button, row, 1)
|
||||
label = QLabel('&' + str(row))
|
||||
label = QLabel('&' + str(row+1))
|
||||
label.setBuddy(button)
|
||||
layout.addWidget(label, row, 0)
|
||||
if button_rows > 0:
|
||||
layout.addWidget(QLabel(_('Enter a value:')), button_rows+1, 0, 1, 2)
|
||||
label = QLabel('&' + str(button_rows+1))
|
||||
else:
|
||||
label = QLabel('')
|
||||
label.setBuddy(textbox)
|
||||
layout.addWidget(label, button_rows+2, 0, 1, 1)
|
||||
textbox.show_initial_value(history[0] if history else '')
|
||||
layout.addWidget(textbox, button_rows+2, 1)
|
||||
textbox.setFocus()
|
||||
button_box = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok |
|
||||
|
Loading…
x
Reference in New Issue
Block a user