Beispiel #1
0
    def info(self):
        # Allows all text fields in this dialog to be optional.
        #
        # If "title" isn't specified but message is, then title becomes
        # the first line of message.
        #
        # If message is blank and title is not, message becomes title.
        #
        # If both are blank, both become the status.
        #
        status = self.status.db_val

        if not self.is_exception:
            title = self.title.Value
            if not title or title.isspace():
                title = None

        message = self.message.Value
        if not message or message.isspace(): message = None

        if not self.is_exception:
            if title is None:
                title = message.split('\n')[0] if message is not None else status
        else:
            title = None

        if message is None:
            message = title if title is not None else _(status)

        s = Storage(message = message,
                    status = status,
                    format  = self.message.Format)

        if not self.is_exception:
            # while editing exceptions, there isn't a title.
            s.title = title
            s.exceptions = self.exceptions.Exceptions if self.diffcheck.IsChecked() else {}

        from pprint import pformat
        log.info(pformat(dict(s)))

        return s