feat: default workflow batch filters to latest batch
This commit is contained in:
@@ -375,15 +375,20 @@ class CollectTab(QWidget):
|
||||
self._update_delete_batch_button()
|
||||
|
||||
def _populate_batch_filter(self, batches, selected_batch):
|
||||
batch_ids = {batch.id for batch in batches}
|
||||
previous = selected_batch if selected_batch in batch_ids else None
|
||||
had_previous_items = self.batch_filter.count() > 0
|
||||
self.batch_filter.blockSignals(True)
|
||||
self.batch_filter.clear()
|
||||
self.batch_filter.addItem("全部批次", None)
|
||||
for batch in batches:
|
||||
self.batch_filter.addItem(self._batch_label(batch), batch.id)
|
||||
index = self.batch_filter.findData(previous)
|
||||
self.batch_filter.setCurrentIndex(index if index >= 0 else 0)
|
||||
self.batch_filter.setCurrentIndex(
|
||||
_batch_filter_current_index(
|
||||
self.batch_filter,
|
||||
batches,
|
||||
selected_batch,
|
||||
had_previous_items,
|
||||
)
|
||||
)
|
||||
self.batch_filter.blockSignals(False)
|
||||
|
||||
def _batch_label(self, batch):
|
||||
|
||||
Reference in New Issue
Block a user