def DeselectItem(self, *evnt): index = self.selected.GetSelection() if index == -1: return if index == self.selected.GetCount() - 1 and self.has_default(): warn = SeriesRemoveWarningDlg(None) warn.ShowModal() if warn.choice == 0: return elif warn.choice == 1: # change to original filenames cfg = self.GetParent().config cfg['FilenameFormat']['Selection'] = 1 page = self.GetParent().prefDlg.pages['FilenameFormat'] page.UpdateFromConfig(cfg) self.selected.Delete(index) self.selected.Select(index - 1)
def test_on_change(self): dlg = SeriesRemoveWarningDlg(self.frame) dlg.OnChange() assert dlg.choice == 1
def test_on_cancel(self): dlg = SeriesRemoveWarningDlg(self.frame) dlg.OnCancel() assert dlg.choice == 0
def test_on_accept(self): dlg = SeriesRemoveWarningDlg(self.frame) dlg.OnAccept() assert dlg.choice == 2