previous button should be disabled when previous queue is empty

This commit is contained in:
Kovid Goyal 2024-05-28 10:06:01 +05:30
parent 4aebb5a6d4
commit 114cee2cd3
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -786,12 +786,23 @@ class CompareMany(QDialog):
return self.compare_widget.current_mi
def show_current_item(self):
self.setWindowTitle(self.window_title + _(' [%(num)d of %(tot)d]') % dict(
num=(self.total - len(self.ids) + 1), tot=self.total))
oldmi, newmi = self.get_metadata(self.ids[0])
self.compare_widget(oldmi, newmi)
self.update_back_button_state()
def update_back_button_state(self):
enabled = bool(self.previous_items)
self.back_action.setEnabled(enabled)
self.back_button.setEnabled(enabled)
def next_item(self, accept):
self.next_called = True
if not self.ids:
return self.accept()
if self.current_mi is not None:
changed = self.compare_widget.apply_changes()
if self.current_mi is not None:
@ -806,10 +817,7 @@ class CompareMany(QDialog):
self.accepted[old_id] = (changed, self.current_mi) if accept else (False, None)
if not self.ids:
return self.accept()
self.setWindowTitle(self.window_title + _(' [%(num)d of %(tot)d]') % dict(
num=(self.total - len(self.ids) + 1), tot=self.total))
oldmi, newmi = self.get_metadata(self.ids[0])
self.compare_widget(oldmi, newmi)
self.show_current_item()
def previous_item(self):
@ -828,12 +836,7 @@ class CompareMany(QDialog):
# move the last previous item to the begining of the pending list
self.ids.insert(0, last_previous_item)
# display the last previous item (from the ids list)
self.setWindowTitle(self.window_title + _(' [%(num)d of %(tot)d]') % dict(
num=(self.total - len(self.ids) + 1), tot=self.total))
oldmi, newmi = self.get_metadata(self.ids[0])
self.compare_widget(oldmi, newmi)
self.show_current_item()
def accept_all_remaining(self):