global_access.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:pysport 作者: sportorg 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号