Пример #1
0
 def __init__(self):
     self.message_queue = ConsoleView()
     # Set up dispatcher for dynamic messages
     # Dynamic messages will not clear the message queue so will be appended
     # to existing user messages
     dispatcher.connect(
         self.message_queue.dynamic_message_event, signal=DYNAMIC_MESSAGE_SIGNAL, sender=dispatcher.Any
     )
     # Set up dispatcher for static messages
     # Static messages clear the message queue and so the display is 'reset'
     dispatcher.connect(self.message_queue.static_message_event, signal=STATIC_MESSAGE_SIGNAL, sender=dispatcher.Any)
Пример #2
0
 def __init__(self):
     self.message_queue = WebView()
     # Set up dispatcher for dynamic messages
     # Dynamic messages will not clear the message queue so will be appended
     # to existing user messages
     dispatcher.connect(self.message_queue.dynamic_message_event,
                        signal=DYNAMIC_MESSAGE_SIGNAL,
                        sender=dispatcher.Any)
     # Set up dispatcher for static messages
     # Static messages clear the message queue and so the display is 'reset'
     dispatcher.connect(self.message_queue.static_message_event,
                        signal=STATIC_MESSAGE_SIGNAL,
                        sender=dispatcher.Any)
Пример #3
0
def enable_messaging(message_viewer, sender=dispatcher.Any):
    """Set up the dispatcher for messaging.

    :param message_viewer: A message viewer to show the message.
    :type message_viewer: MessageViewer

    :param sender: Sender of the message signal. Default to Any object.
    :type sender: object
    """
    # Set up dispatcher for dynamic messages
    # Dynamic messages will not clear the message queue so will be appended
    # to existing user messages

    # noinspection PyArgumentEqualDefault
    dispatcher.connect(message_viewer.dynamic_message_event,
                       signal=DYNAMIC_MESSAGE_SIGNAL,
                       sender=sender)
    # Set up dispatcher for static messages
    # Static messages clear the message queue and so the display is 'reset'
    # noinspection PyArgumentEqualDefault
    dispatcher.connect(message_viewer.static_message_event,
                       signal=STATIC_MESSAGE_SIGNAL,
                       sender=sender)
    # Set up dispatcher for error messages
    # Error messages clear the message queue and so the display is 'reset'
    # noinspection PyArgumentEqualDefault
    dispatcher.connect(message_viewer.static_message_event,
                       signal=ERROR_MESSAGE_SIGNAL,
                       sender=sender)
Пример #4
0
def enable_messaging(message_viewer, sender=dispatcher.Any):
    """Set up the dispatcher for messaging.

    :param message_viewer: A message viewer to show the message.
    :type message_viewer: MessageViewer

    :param sender: Sender of the message signal. Default to Any object.
    :type sender: object
    """
    # Set up dispatcher for dynamic messages
    # Dynamic messages will not clear the message queue so will be appended
    # to existing user messages

    # noinspection PyArgumentEqualDefault
    dispatcher.connect(
        message_viewer.dynamic_message_event,
        signal=DYNAMIC_MESSAGE_SIGNAL,
        sender=sender)
    # Set up dispatcher for static messages
    # Static messages clear the message queue and so the display is 'reset'
    # noinspection PyArgumentEqualDefault
    dispatcher.connect(
        message_viewer.static_message_event,
        signal=STATIC_MESSAGE_SIGNAL,
        sender=sender)
    # Set up dispatcher for error messages
    # Error messages clear the message queue and so the display is 'reset'
    # noinspection PyArgumentEqualDefault
    dispatcher.connect(
        message_viewer.static_message_event,
        signal=ERROR_MESSAGE_SIGNAL,
        sender=sender)
Пример #5
0
 def setUp(self):
     """Fixture run before all tests"""
     os.environ["LANG"] = "en"
     self.message_viewer = MessageViewer(None)
     self.message_viewer.show()
     # Set up dispatcher for dynamic messages
     # Dynamic messages will not clear the message queue so will be appended
     # to existing user messages
     dispatcher.connect(self.message_viewer.dynamic_message_event, signal=DYNAMIC_MESSAGE_SIGNAL)
     # Set up dispatcher for static messages
     # Static messages clear the message queue and so the display is 'reset'
     dispatcher.connect(self.message_viewer.static_message_event, signal=STATIC_MESSAGE_SIGNAL)
     # Set up dispatcher for error messages
     # Static messages clear the message queue and so the display is 'reset'
     dispatcher.connect(self.message_viewer.error_message_event, signal=ERROR_MESSAGE_SIGNAL)
Пример #6
0
 def setUp(self):
     """Fixture run before all tests"""
     os.environ['LANG'] = 'en'
     self.message_viewer = MessageViewer(None)
     self.message_viewer.show()
     # Set up dispatcher for dynamic messages
     # Dynamic messages will not clear the message queue so will be appended
     # to existing user messages
     dispatcher.connect(self.message_viewer.dynamic_message_event,
                        signal=DYNAMIC_MESSAGE_SIGNAL)
     # Set up dispatcher for static messages
     # Static messages clear the message queue and so the display is 'reset'
     dispatcher.connect(self.message_viewer.static_message_event,
                        signal=STATIC_MESSAGE_SIGNAL)
     # Set up dispatcher for error messages
     # Static messages clear the message queue and so the display is 'reset'
     dispatcher.connect(self.message_viewer.error_message_event,
                        signal=ERROR_MESSAGE_SIGNAL)
Пример #7
0
    def enable_signal_receiver(self):
        """Setup dispatcher for all available signal from Analysis.

        .. note:: Adapted from the dock
        """
        dispatcher.connect(
            self.show_busy,
            signal=BUSY_SIGNAL)

        dispatcher.connect(
            self.hide_busy,
            signal=NOT_BUSY_SIGNAL)

        dispatcher.connect(
            self.completed,
            signal=ANALYSIS_DONE_SIGNAL)

        # noinspection PyArgumentEqualDefault
        dispatcher.connect(
            self.show_dynamic_message,
            signal=DYNAMIC_MESSAGE_SIGNAL)

        # noinspection PyArgumentEqualDefault
        dispatcher.connect(
            self.parent.wvResults.static_message_event,
            signal=STATIC_MESSAGE_SIGNAL,
            sender=dispatcher.Any)

        # noinspection PyArgumentEqualDefault
        dispatcher.connect(
            self.parent.wvResults.error_message_event,
            signal=ERROR_MESSAGE_SIGNAL,
            sender=dispatcher.Any)
Пример #8
0
    def enable_signal_receiver(self):
        """Setup dispatcher for all available signal from Analysis.

        .. note:: Adapted from the dock
        """
        dispatcher.connect(self.show_busy, signal=BUSY_SIGNAL)

        dispatcher.connect(self.hide_busy, signal=NOT_BUSY_SIGNAL)

        dispatcher.connect(self.completed, signal=ANALYSIS_DONE_SIGNAL)

        # noinspection PyArgumentEqualDefault
        dispatcher.connect(self.show_dynamic_message,
                           signal=DYNAMIC_MESSAGE_SIGNAL)

        # noinspection PyArgumentEqualDefault
        dispatcher.connect(self.parent.wvResults.static_message_event,
                           signal=STATIC_MESSAGE_SIGNAL,
                           sender=dispatcher.Any)

        # noinspection PyArgumentEqualDefault
        dispatcher.connect(self.parent.wvResults.error_message_event,
                           signal=ERROR_MESSAGE_SIGNAL,
                           sender=dispatcher.Any)