diff --git a/GUI/ProjectViewModel.py b/GUI/ProjectViewModel.py index e61ea7d2..6dc88d3a 100644 --- a/GUI/ProjectViewModel.py +++ b/GUI/ProjectViewModel.py @@ -87,6 +87,16 @@ def GetLineItem(self, line_number, get_translated): if line_item.number == line_number: return line_item + def GetBatchNumbers(self): + """ + Get all batch numbers for the model + """ + batch_numbers = [] + for scene_item in self.model.values(): + for batch_item in scene_item.batches.values(): + batch_numbers.append((batch_item.scene, batch_item.number)) + return batch_numbers + def UpdateModel(self, update): """ Incrementally update the viewmodel diff --git a/GUI/Widgets/SubtitleListModel.py b/GUI/Widgets/SubtitleListModel.py index 52e9c2ab..1d08ca15 100644 --- a/GUI/Widgets/SubtitleListModel.py +++ b/GUI/Widgets/SubtitleListModel.py @@ -16,8 +16,10 @@ def __init__(self, show_translated, viewmodel=None, parent=None): def ShowSelection(self, selection : ProjectSelection): if selection.selected_batches: batch_numbers = [(batch.scene, batch.number) for batch in selection.selected_batches] - else: + elif selection.selected_scenes: batch_numbers = selection.batch_numbers + else: + batch_numbers = self.viewmodel.GetBatchNumbers() self.ShowSelectedBatches(batch_numbers) diff --git a/GUI/Widgets/SubtitleView.py b/GUI/Widgets/SubtitleView.py index edb084dd..73b10268 100644 --- a/GUI/Widgets/SubtitleView.py +++ b/GUI/Widgets/SubtitleView.py @@ -30,6 +30,7 @@ def __init__(self, show_translated, parent=None): def SetViewModel(self, viewmodel : ProjectViewModel): model = SubtitleListModel(self.show_translated, viewmodel) self.setModel(model) + self.ShowSelection(ProjectSelection()) def ShowSelection(self, selection : ProjectSelection): self.model().ShowSelection(selection)