def killTaskButtonHandler(self): item = self.taskTable.currentItem() if item and item.isSelected(): row = self.taskTable.currentRow() id = int(self.taskTable.item(row, 0).text()) # @ReservedAssignment choice = yesNoBox(self, "Confirm", "Really kill task {:d}?".format(id)) if choice == QMessageBox.Yes: try: killTask(id) except socketerror as err: logger.debug(str(err)) aboutBox( self, "Error", "Task couldn't be killed because " "there was a problem communicating with the host running " "it.", ) except sqlerror as err: logger.debug(str(err)) aboutBox(self, "SQL Error", str(err))
def killTaskButtonHandler (self): item = self.taskTable.currentItem () if item and item.isSelected (): row = self.taskTable.currentRow () task_id = int(self.taskTable.item(row, 0).text()) choice = yesNoBox(self, "Confirm", "Really kill task {:d}?" .format(task_id)) if choice == QMessageBox.Yes: killed = None try: killed = killTask(task_id) if not killed: # TODO: make a better error message aboutBox(self, "Error", "Task couldn't be killed for " "some reason.") except socketerror as err: logger.debug(str(err)) aboutBox(self, "Error", "Task couldn't be killed because " "there was a problem communicating with the host running " "it.") except sqlerror as err: logger.debug(str(err)) aboutBox(self, "SQL Error", str(err))