예제 #1
0
class MoveMessageController(object):
    """Manage the case when its not trivial to move a message from a symbol to another one"""
    def __init__(self, vocabularyController, messages, targetSymbol):
        self.vocabularyController = vocabularyController
        self.log = logging.getLogger(__name__)
        self._view = MoveMessageView(self)
        self.messages = messages
        self.targetSymbol = targetSymbol

    @property
    def view(self):
        return self._view

    def run(self):
        self._view.run()

    def moveMessageCancelButton_clicked_cb(self, widget):
        """Callback executed when the user cancel
        the message moving"""
        self._view.moveMessageDialog.destroy()

    def moveMessageApplyButton_clicked_cb(self, widget):
        """Callback executed when the user request
        the execution of the ticked solution"""
        for message in self.messages:
            # retrieve which solution to execute
            if self._view.moveMessageMoveAndForgetRadioButton.get_active():
                self.forgetRegexAndMove(message)
            elif self._view.moveMessageMoveAndReComputeRadioButton.get_active(
            ):
                self.recomputeRegexAndMove(message)
            elif self._view.moveMessageMoveInTrashRadioButton.get_active():
                self.moveInTrash(message)

    def forgetRegexAndMove(self, message):
        """Move the requested message from its symbol
        to the defined other which's regex is reseted"""
        self.vocabularyController.moveMessage(message, self.targetSymbol)

        self.targetSymbol.getField().resetPartitioning()
        self._view.destroy()

    def recomputeRegexAndMove(self, message):
        """Move the requested message to the selected symbol
        which's regex is recomputed"""
        self.vocabularyController.moveMessage(message, self.targetSymbol)

        self._view.destroy()
        sequence_controller = SequenceAlignmentController(
            self.vocabularyController, [self.targetSymbol.getField()])
        sequence_controller.run()

    def moveInTrash(self, message):
        """Move the selected message in the trash symbol"""
        trashSymbol = self.vocabularyController.getCurrentProject(
        ).getVocabulary().getTrashSymbol()
        self.vocabularyController.moveMessage(message, trashSymbol)
        self._view.destroy()
예제 #2
0
class MoveMessageController(object):
    """Manage the case when its not trivial to move a message from a symbol to another one"""

    def __init__(self, vocabularyController, messages, targetSymbol):
        self.vocabularyController = vocabularyController
        self.log = logging.getLogger(__name__)
        self._view = MoveMessageView(self)
        self.messages = messages
        self.targetSymbol = targetSymbol

    @property
    def view(self):
        return self._view

    def run(self):
        self._view.run()

    def moveMessageCancelButton_clicked_cb(self, widget):
        """Callback executed when the user cancel
        the message moving"""
        self._view.moveMessageDialog.destroy()

    def moveMessageApplyButton_clicked_cb(self, widget):
        """Callback executed when the user request
        the execution of the ticked solution"""
        for message in self.messages:
            # retrieve which solution to execute
            if self._view.moveMessageMoveAndForgetRadioButton.get_active():
                self.forgetRegexAndMove(message)
            elif self._view.moveMessageMoveAndReComputeRadioButton.get_active():
                self.recomputeRegexAndMove(message)
            elif self._view.moveMessageMoveInTrashRadioButton.get_active():
                self.moveInTrash(message)

    def forgetRegexAndMove(self, message):
        """Move the requested message from its symbol
        to the defined other which's regex is reseted"""
        self.vocabularyController.moveMessage(message, self.targetSymbol)

        self.targetSymbol.getField().resetPartitioning()
        self._view.destroy()

    def recomputeRegexAndMove(self, message):
        """Move the requested message to the selected symbol
        which's regex is recomputed"""
        self.vocabularyController.moveMessage(message, self.targetSymbol)

        self._view.destroy()
        sequence_controller = SequenceAlignmentController(self.vocabularyController, [self.targetSymbol.getField()])
        sequence_controller.run()

    def moveInTrash(self, message):
        """Move the selected message in the trash symbol"""
        trashSymbol = self.vocabularyController.getCurrentProject().getVocabulary().getTrashSymbol()
        self.vocabularyController.moveMessage(message, trashSymbol)
        self._view.destroy()
예제 #3
0
 def __init__(self, vocabularyController, messages, targetSymbol):
     self.vocabularyController = vocabularyController
     self.log = logging.getLogger(__name__)
     self._view = MoveMessageView(self)
     self.messages = messages
     self.targetSymbol = targetSymbol
예제 #4
0
 def __init__(self, vocabularyController, messages, targetSymbol):
     self.vocabularyController = vocabularyController
     self.log = logging.getLogger(__name__)
     self._view = MoveMessageView(self)
     self.messages = messages
     self.targetSymbol = targetSymbol