示例#1
0
 def run(self):
     self.count += 1
     message = Paragraph('IF1 run %i - running' % self.count)
     dispatcher.send(
         signal=DYNAMIC_MESSAGE_SIGNAL,
         sender=self,
         message=message)
示例#2
0
 def __init__(self):
     message = Message(SuccessParagraph('IF2 was initialised'))
     dispatcher.send(
         signal=DYNAMIC_MESSAGE_SIGNAL,
         sender=self,
         message=message)
     self.count = 0
示例#3
0
def send_message(message):
    """Send a message using the dispatcher.

    :param message: A Message object to be sent to a message viewer.
    :type message: Message
    """
    dispatcher.send(signal=DYNAMIC_MESSAGE_SIGNAL, sender=dispatcher.Anonymous, message=message)
示例#4
0
 def run(self):
     """Run
     """
     self.count += 1
     message = Paragraph('IF1 run %i - running' % self.count)
     dispatcher.send(signal=DYNAMIC_MESSAGE_SIGNAL,
                     sender=self,
                     message=message)
示例#5
0
def send_busy_signal(sender):
    """Send an busy signal to the listeners.

    .. versionadded:: 3.3

    :param sender: The sender.
    :type sender: object
    """
    dispatcher.send(signal=BUSY_SIGNAL, sender=sender, message='')
示例#6
0
def send_message(message):
    """Send a message using the dispatcher.

    :param message: A Message object to be sent to a message viewer.
    :type message: Message
    """
    dispatcher.send(signal=DYNAMIC_MESSAGE_SIGNAL,
                    sender=dispatcher.Anonymous,
                    message=message)
示例#7
0
def send_analysis_done_signal(sender):
    """Send an analysis done signal to the listeners.

    .. versionadded:: 3.3

    :param sender: The sender.
    :type sender: object
    """
    dispatcher.send(signal=ANALYSIS_DONE_SIGNAL, sender=sender, message='')
示例#8
0
def send_analysis_done_signal(sender):
    """Send an analysis done signal to the listeners.

    .. versionadded:: 3.3

    :param sender: The sender.
    :type sender: object
    """
    dispatcher.send(
        signal=ANALYSIS_DONE_SIGNAL,
        sender=sender,
        message='')
示例#9
0
def send_not_busy_signal(sender):
    """Send an busy signal to the listeners.

    .. versionadded:: 3.3

    :param sender: The sender.
    :type sender: object
    """
    dispatcher.send(
        signal=NOT_BUSY_SIGNAL,
        sender=sender,
        message='')
示例#10
0
    def show_error_message(self, error_message):
        """Send an error message to the message viewer.

        Error messages cause any previous content in the MessageViewer to be
        replaced with new content.

        .. note:: Copied from the dock

        :param error_message: An instance of our rich error message class.
        :type error_message: ErrorMessage
        """
        dispatcher.send(signal=ERROR_MESSAGE_SIGNAL,
                        sender=self,
                        message=error_message)
        self.hide_busy()
示例#11
0
    def show_static_message(self, message):
        """Send a static message to the message viewer.

        Static messages cause any previous content in the MessageViewer to be
        replaced with new content.

        .. note:: Copied from the dock

        :param message: An instance of our rich message class.
        :type message: Message

        """
        dispatcher.send(signal=STATIC_MESSAGE_SIGNAL,
                        sender=self,
                        message=message)
示例#12
0
    def run(self):
        message = Message(
            Text('This shows how you can create '),
            ImportantText('content inline when you create a message'), ' ',
            EmphasizedText('including different styles and so on.'))

        dispatcher.send(signal=STATIC_MESSAGE_SIGNAL,
                        sender=self,
                        message=message)

        impact_function1 = ImpactFunction1()
        # Run some tasks that will spawn dynamic messages
        for i in range(1, 10):
            _ = i
            impact_function1.run()
示例#13
0
    def run(self):
        message = Message(
            Text("This shows how you can create "),
            ImportantText("content inline when you create a message"),
            " ",
            EmphasizedText("including different styles and so on."),
        )

        dispatcher.send(signal=STATIC_MESSAGE_SIGNAL, sender=self, message=message)

        impact_function1 = ImpactFunction1()
        # Run some tasks that will spawn dynamic messages
        for i in range(1, 10):
            _ = i
            impact_function1.run()
示例#14
0
def send_analysis_done_signal(sender, zero_impact=False):
    """Send an analysis done signal to the listeners.

    .. versionadded:: 3.3

    :param sender: The sender.
    :type sender: object

    :param zero_impact: Flag for zero impact in the result
    :type zero_impact: bool
    """
    dispatcher.send(
        signal=ANALYSIS_DONE_SIGNAL,
        sender=sender,
        message='',
        zero_impact=zero_impact)
    def show_error_message(self, error_message):
        """Send an error message to the message viewer.

        Error messages cause any previous content in the MessageViewer to be
        replaced with new content.

        .. note:: Copied from the dock

        :param error_message: An instance of our rich error message class.
        :type error_message: ErrorMessage
        """
        dispatcher.send(
            signal=ERROR_MESSAGE_SIGNAL,
            sender=self,
            message=error_message)
        self.hide_busy()
    def show_static_message(self, message):
        """Send a static message to the message viewer.

        Static messages cause any previous content in the MessageViewer to be
        replaced with new content.

        .. note:: Copied from the dock

        :param message: An instance of our rich message class.
        :type message: Message

        """
        dispatcher.send(
            signal=STATIC_MESSAGE_SIGNAL,
            sender=self,
            message=message)
示例#17
0
    def run(self):
        """Run.
        """
        message = Message()
        message.add(Heading('Processing starting'))
        text = Text('This is an example application showing how the ')
        text.add(ImportantText('new Messaging system'))
        text.add(Text(' works in '))
        text.add(EmphasizedText('InaSAFE'))
        text.add(Text('.'))
        paragraph = Paragraph(text)
        message.add(paragraph)
        paragraph = Paragraph(
            'Sed ut perspiciatis unde omnis iste natus error sit voluptatem '
            'accusantium doloremque laudantium, totam rem aperiam, '
            'eaque ipsa quae ab illo inventore veritatis et quasi architecto '
            'beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem '
            'quia voluptas sit aspernatur aut odit aut fugit, sed quia '
            'consequuntur magni dolores eos qui ratione voluptatem sequi '
            'nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor '
            'sit amet, consectetur, adipisci velit, sed quia non numquam eius '
            'modi tempora incidunt ut labore et dolore magnam aliquam quaerat '
            'voluptatem. Ut enim ad minima veniam, quis nostrum '
            'exercitationem ullam corporis suscipit laboriosam, nisi ut '
            'aliquid ex ea commodi consequatur? Quis autem vel eum iure '
            'reprehenderit qui in ea voluptate velit esse quam nihil molestiae'
            ' consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla'
            ' pariatur?')
        message.add(paragraph)
        message.add(Message(
            Text('This shows how you can create '),
            ImportantText('content inline when you create a message'),
            ' ',
            EmphasizedText('including different styles and so on.')))

        dispatcher.send(
            signal=STATIC_MESSAGE_SIGNAL,
            sender=self,
            message=message)

        impact_function1 = ImpactFunction1()
        impact_function2 = ImpactFunction2()
        # Run some tasks that will spawn dynamic messages
        for i in range(1, 10):
            _ = i
            impact_function1.run()
            impact_function2.run()
示例#18
0
def send_error_message(sender, error_message):
    """Send an error message to the listeners.

    Error messages represents and error. It usually replace the previous
    message since an error has been happened.

    .. versionadded:: 3.3

    :param sender: The sender.
    :type sender: object

    :param error_message: An instance of our rich error message class.
    :type error_message: ErrorMessage
    """
    dispatcher.send(signal=ERROR_MESSAGE_SIGNAL,
                    sender=sender,
                    message=error_message)
示例#19
0
def send_static_message(sender, message):
    """Send a static message to the listeners.

    Static messages represents a whole new message. Usually it will
    replace the previous message.

    .. versionadded:: 3.3

    :param sender: The sender.
    :type sender: object

    :param message: An instance of our rich message class.
    :type message: safe.messaging.Message

    """
    dispatcher.send(signal=STATIC_MESSAGE_SIGNAL,
                    sender=sender,
                    message=message)
示例#20
0
def send_dynamic_message(sender, message):
    """Send a dynamic message to the listeners.

    Dynamic messages represents a progress. Usually it will be appended to
    the previous messages.

    .. versionadded:: 3.3

    :param sender: The sender.
    :type sender: object

    :param message: An instance of our rich message class.
    :type message: safe.messaging.Message

    """
    dispatcher.send(signal=DYNAMIC_MESSAGE_SIGNAL,
                    sender=sender,
                    message=message)
示例#21
0
def send_error_message(sender, error_message):
    """Send an error message to the listeners.

    Error messages represents and error. It usually replace the previous
    message since an error has been happened.

    .. versionadded:: 3.3

    :param sender: The sender.
    :type sender: object

    :param error_message: An instance of our rich error message class.
    :type error_message: ErrorMessage
    """
    dispatcher.send(
        signal=ERROR_MESSAGE_SIGNAL,
        sender=sender,
        message=error_message)
示例#22
0
def send_dynamic_message(sender, message):
    """Send a dynamic message to the listeners.

    Dynamic messages represents a progress. Usually it will be appended to
    the previous messages.

    .. versionadded:: 3.3

    :param sender: The sender.
    :type sender: object

    :param message: An instance of our rich message class.
    :type message: Message

    """
    dispatcher.send(
        signal=DYNAMIC_MESSAGE_SIGNAL,
        sender=sender,
        message=message)
示例#23
0
def send_static_message(sender, message):
    """Send a static message to the listeners.

    Static messages represents a whole new message. Usually it will
    replace the previous message.

    .. versionadded:: 3.3

    :param sender: The sender.
    :type sender: object

    :param message: An instance of our rich message class.
    :type message: Message

    """
    dispatcher.send(
        signal=STATIC_MESSAGE_SIGNAL,
        sender=sender,
        message=message)
示例#24
0
 def __init__(self):
     message = Message(SuccessParagraph('IF1 was initialised'))
     dispatcher.send(signal=DYNAMIC_MESSAGE_SIGNAL,
                     sender=self,
                     message=message)
     self.count = 0