def delete_object(self):
indexes = self.get_selected_rows()
if not len(indexes):
return
confirm = QMessageBox.question(self.get_main_window(),
_('Question'),
_('Please confirm'),
QMessageBox.Yes | QMessageBox.No)
if confirm == QMessageBox.No:
return
tab = self.get_current_tab_index()
if tab == 0:
race().delete_persons(indexes)
# recalculate places
ResultCalculation().process_results()
self.get_main_window().refresh()
elif tab == 1:
race().delete_results(indexes)
# recalculate places
ResultCalculation().process_results()
self.get_main_window().refresh()
elif tab == 2:
try:
race().delete_groups(indexes)
except NotEmptyException as e:
logging.warning(str(e))
QMessageBox.question(self.get_group_table(),
_('Error'),
_('Cannot remove group'))
self.get_main_window().refresh()
elif tab == 3:
try:
race().delete_courses(indexes)
except NotEmptyException as e:
logging.warning(str(e))
QMessageBox.question(self.get_course_table(),
_('Error'),
_('Cannot remove course'))
self.get_main_window().refresh()
elif tab == 4:
try:
race().delete_organizations(indexes)
except NotEmptyException as e:
logging.warning(str(e))
QMessageBox.question(self.get_organization_table(),
_('Error'),
_('Cannot remove organization'))
self.get_main_window().refresh()
评论列表
文章目录