Exemplo n.º 1
0
def default_formatted_text(msg):
    'Returns a fmtstr object with the text of msg and the formatting from prefs'

    from util.primitives.fmtstr import fmtstr
    from gui.uberwidgets.formattedinput import get_default_format

    return fmtstr.singleformat(msg, get_default_format())
Exemplo n.º 2
0
def default_formatted_text(msg):
    'Returns a fmtstr object with the text of msg and the formatting from prefs'

    from util.primitives.fmtstr import fmtstr
    from gui.uberwidgets.formattedinput import get_default_format

    return fmtstr.singleformat(msg, get_default_format())
Exemplo n.º 3
0
            def gui_thread(st=acctstatus):
                from common import profile
                if profile and profile.prefs:
                    from gui.uberwidgets.formattedinput import get_default_format
                    st = st.copy(editable=None)
                    st.format = get_default_format()

                netcall(lambda: self.set_message_object(st))
Exemplo n.º 4
0
    def _incoming_blob_profile(self, profile_str_or_fmtstr):
        from util.primitives.fmtstr import fmtstr

        # self.profile used to be a string, but now it is a fmtstr, and goes out
        # over the wire as a JSON dict.
        #
        # assume that if we cannot parse the incoming profile blob as JSON, then
        # it must be an old-style string profile.
        if isinstance(profile_str_or_fmtstr, dict):
            fstr = fmtstr.fromDict(profile_str_or_fmtstr)
        else:
            from gui.uberwidgets.formattedinput import get_default_format
            fstr = fmtstr.singleformat(profile_str_or_fmtstr, format=get_default_format('profile.formatting'))

        self.profile = fstr
Exemplo n.º 5
0
def _get_format(win):
    '''
    returns the formatting dictionary for sending a message given an IM
    window that may or may not already be destroyed
    '''

    format = None

    if win:
        try:
            format = win.input_area.Format
        except wx.PyDeadObjectError:
            pass
        except Exception:
            print_exc()

    if format is None:
        format = get_default_format()

    return format
Exemplo n.º 6
0
    def set_formatted_profile(self, protocol, fstr=None):
        if fstr is None:
            fstr = self.profile

        # $$plugin setprofile
        import plugin_manager.plugin_hub as plugin_hub
        if not plugin_hub.act('digsby.im.setprofile.pre', protocol, fstr):
            return

        plugin_hub.act('digsby.im.setprofile.async', protocol, fstr)

        add_promo_string = self.prefs.get('profile.promote', True)
        if fstr.bestFormat == "rtf":
            if add_promo_string:
                fstr = fstr + PROMOTE_STRING_RTF
            format = None
        else:
            #legacy profile support
            if add_promo_string:
                fstr = fstr.format_as("plaintext").encode('xml') + PROMOTE_STRING_HTML
            from gui.uberwidgets.formattedinput import get_default_format
            format = get_default_format('profile.formatting')

        netcall(lambda: protocol.set_profile(fstr, format))