Пример #1
0
def dialog_closed_callback(result):
    from util import Storage as S
    from time import time
    from common import pref, setpref
    result = S(result)
    invite_times = pref('usertrack.invite.dialog.results',
                        type=dict,
                        default={})

    num_email_accts = len(p.emailaccounts)
    num_webmail_accts = len(
        [e.protocol in webmail_types for e in p.emailaccounts[:]])

    track_data = dict(accts=len(result.accts),
                      web_accts=num_webmail_accts,
                      email_accts=num_email_accts,
                      background=result.background,
                      send=result.send)

    num_not_triggered = sum(
        t.get('background', False) for t in invite_times.values())
    if not result.background or num_not_triggered < 5:
        invite_times[int(time())] = track_data
        setpref('usertrack.invite.dialog.results', invite_times)

    if result.send:
        from pprint import pprint
        print 'would send:'
        pprint(result.accts)
Пример #2
0
def show_research_popup_once():
    from common import pref, setpref

    if not pref('research.showed_notification', default=False, type=bool):
        show_research_popup()

    setpref('research.showed_notification', True)
Пример #3
0
    def CloseAndSaveState(self, e):
        # Confirm multiple tab close
        tabcount = self.GetTabCount()

        if e.CanVeto() and tabcount > 1 and pref(WARN_PREF, True):
            with CloseTabsDialog(self, tabcount, True) as diag:
                diag.CenterOnParent()
                res = diag.ShowModal()

                if not diag.WarnMe:
                    setpref(WARN_PREF, False)

                if res == wx.ID_CANCEL:
                    return False

        self.Hide()
        saveWindowPos(self, uniqueId=self.posId)  # Save our window position

        # Call each IMWin's on_close method.
        if not config.nativeIMWindow:
            for page in self.notebook.Pages():
                page.Children[0].on_close()

        memory_event()
        return True
Пример #4
0
def dialog_closed_callback(result):
    from util import Storage as S
    from time import time
    from common import pref, setpref
    result = S(result)
    invite_times = pref('usertrack.invite.dialog.results', type=dict, default={})

    num_email_accts = len(p.emailaccounts)
    num_webmail_accts = len([e.protocol in webmail_types for e in p.emailaccounts[:]])

    track_data = dict(
         accts=len(result.accts),
         web_accts = num_webmail_accts,
         email_accts = num_email_accts,
         background=result.background,
         send=result.send
         )

    num_not_triggered = sum(t.get('background', False) for t in invite_times.values())
    if not result.background or num_not_triggered < 5:
        invite_times[int(time())] = track_data
        setpref('usertrack.invite.dialog.results', invite_times)

    if result.send:
        from pprint import pprint
        print 'would send:'
        pprint(result.accts)
Пример #5
0
    def CloseAndSaveState(self, e):
        # Confirm multiple tab close
        tabcount = self.GetTabCount()

        if e.CanVeto() and tabcount > 1 and pref(WARN_PREF, True):
            with CloseTabsDialog(self, tabcount, True) as diag:
                diag.CenterOnParent()
                res = diag.ShowModal()

                if not diag.WarnMe:
                    setpref(WARN_PREF, False)

                if res == wx.ID_CANCEL:
                    return False

        self.Hide()
        saveWindowPos(self, uniqueId = self.posId) # Save our window position

        # Call each IMWin's on_close method.
        if not config.nativeIMWindow:
            for page in self.notebook.Pages():
                page.Children[0].on_close()

        memory_event()
        return True
Пример #6
0
    def OnMouseMotion(self, event):
        """
            Selection gets update and infobox gets requested on mouse over item
        """

        mp = event.Position
        hit = self.HitTest(mp)
        dragging = event.Dragging()
        selection = self.Selection
        active = self.active

        if self.unlocked and event.LeftIsDown(
        ) and dragging and self.HasCapture() and -1 not in (
                selection, hit) and hit != selection:
            item = active[selection]
            active.pop(selection)
            active.insert(hit, item)

            sortorder = self.order
            sortorder.remove(item.id)
            i = sortorder.index(active[hit - 1].id) + 1 if hit > 0 else 0
            sortorder.insert(i, item.id)
            setpref(self.prefkey + '.order', sortorder)

            self.Refresh()

        self.Selection = hit
        self.TryShowInfobox(hit)
Пример #7
0
    def OnMouseMotion(self,event):
        """
            Selection gets update and infobox gets requested on mouse over item
        """

        mp = event.Position
        hit = self.HitTest(mp)
        dragging = event.Dragging()
        selection = self.Selection
        active = self.active

        if self.unlocked and event.LeftIsDown() and dragging and self.HasCapture() and -1 not in (selection, hit) and hit != selection:
            item = active[selection]
            active.pop(selection)
            active.insert(hit, item)

            sortorder = self.order
            sortorder.remove(item.id)
            i = sortorder.index(active[hit-1].id) + 1 if hit > 0 else 0
            sortorder.insert(i, item.id)
            setpref(self.prefkey + '.order', sortorder)

            self.Refresh()

        self.Selection = hit
        self.TryShowInfobox(hit)
Пример #8
0
    def do_check_accounts(self, *a, **k):
        with self.lock:
            if pref('digsby.status.promote_tag.upgrade_response',
                    default=None) is not None:
                return
            if len(self.profile.all_accounts) == 0:
                setpref('digsby.status.promote_tag.upgrade_response',
                        'skipped_ok')
            else:
                import wx

                @wx.CallAfter
                def after():
                    from gui.toast.toast import popup
                    popup(
                        header=_('Spread the Word!'),
                        icon=skin.get('appdefaults.taskbaricon', None),
                        major=None,
                        minor=
                        _("We've made it easier to spread the word about Digsby by adding a link to your IM status. You can disable this option in Preferences > Status."
                          ),
                        sticky=True,
                        max_lines=10,
                        onclose=self.response,
                        buttons=[(_('Close'), lambda *a, **k: None)])
Пример #9
0
        def on_install_cancel():
            log.info("Dictionary download cancelled by user.")

            self.currentDownloads.discard(need)

            lastlang = self.spellengine.lang
            if lastlang:
                setpref("messaging.spellcheck.engineoptions.lang", lastlang)
Пример #10
0
        def on_install_cancel():
            log.info('Dictionary download cancelled by user.')

            self.currentDownloads.discard(need)

            lastlang = self.spellengine.lang
            if lastlang:
                setpref('messaging.spellcheck.engineoptions.lang', lastlang)
Пример #11
0
    def delete(self):
        from common.search import searches
        s = searches[:]

        for e in s:
            if self.searchengine == e:
                e.enabled = False

        setpref('search.external', [e.dict() for e in s])
Пример #12
0
    def delete(self):
        from common.search import searches
        s = searches[:]

        for e in s:
            if self.searchengine == e:
                e.enabled = False

        setpref('search.external', [e.dict() for e in s])
Пример #13
0
    def OnSplitMove(self, event):
        'Invoked when the left mouse button is up on the splitter.'

        event.Skip()

        if self.side_tabs and self.IsSplit() and self.IsShownOnScreen():
            pos = self.SashPosition

            self.side_tabs_width = pos
            log.info("saving side tabs sash pos of %s", pos)
            setpref('tabs.side_tabs_width', pos)
Пример #14
0
    def OnSplitterSet(self,event):
        event.Skip()
        tc = self.tc

        baseh = min(tc.GetMaxHeight(), self.tc.GetCharHeight() * self.tc.GetNumLines() + self.tc.GetExtraHeight())
        h = tc.Size.height if tc.Size.height != baseh else 0

        log.info("input_base_height set to %s", h)

        setpref('conversation_window.input_base_height', h)
        tc.SetMinHeight(h)
Пример #15
0
    def OnSplitMove(self, event):
        'Invoked when the left mouse button is up on the splitter.'

        event.Skip()

        if self.side_tabs and self.IsSplit() and self.IsShownOnScreen():
            pos = self.SashPosition

            self.side_tabs_width = pos
            log.info("saving side tabs sash pos of %s", pos)
            setpref('tabs.side_tabs_width', pos)
Пример #16
0
    def BuildList(self, *__):
        """
            When the account list changes rebuild the list of items to display.
            Then it recalculates size needs.
        """

        try:
            self.__i += 1
        except:
            self.__i = 1

        accts = self.accts

        sortorder = pref(self.prefkey + '.order')
        self.order = sortorder[:]

        if not len(sortorder):
            sortorder = [acct.id for acct in accts]
        elif len(sortorder) != len(accts) or set(
                acct.id for acct in accts) != set(sortorder):
            for acct in accts:
                if acct.id not in sortorder:
                    i = accts.index(acct)
                    i = sortorder.index(self.accts[i -
                                                   1].id) + 1 if i > 0 else 0
                    sortorder.insert(i, acct.id)

        sortset = set(sortorder)
        if len(sortorder) != len(sortset):
            cleansortorder = []
            for i in sortorder:
                if i in sortset:
                    cleansortorder.append(i)
                    sortset.remove(i)
            sortorder = cleansortorder

        if self.order != sortorder:
            setpref(self.prefkey + '.order', sortorder)

        active = dict([(acct.id, acct) for acct in accts if acct.enabled])
        self.active = [active[id] for id in sortorder if id in active]

        with self.Frozen():
            self.ItemCount = len(self.active)
            self.Size = self.MinSize = wx.Size(
                -1, self.ItemCount * self.itemheight)
            self.Top.Layout()
            self.Top.Refresh()

        self.Refresh()
Пример #17
0
    def BuildList(self,*__):
        """
            When the account list changes rebuild the list of items to display.
            Then it recalculates size needs.
        """

        try: self.__i += 1
        except: self.__i = 1

        accts = self.accts

        sortorder = pref(self.prefkey + '.order')
        self.order = sortorder[:]

        if not len(sortorder):
            sortorder = [acct.id for acct in accts]
        elif len(sortorder) != len(accts) or set(acct.id for acct in accts) != set(sortorder):
            for acct in accts:
                if acct.id not in sortorder:
                    i = accts.index(acct)
                    i = sortorder.index(self.accts[i-1].id) + 1 if i > 0 else 0
                    sortorder.insert(i, acct.id)


        sortset = set(sortorder)
        if len(sortorder) != len(sortset):
            cleansortorder = []
            for i in sortorder:
                if i in sortset:
                    cleansortorder.append(i)
                    sortset.remove(i)
            sortorder = cleansortorder


        if self.order != sortorder:
            setpref(self.prefkey + '.order', sortorder)


        active = dict([(acct.id, acct) for acct in accts if acct.enabled])
        self.active = [active[id] for id in sortorder if id in active]

        with self.Frozen():
            self.ItemCount = len(self.active)
            self.Size = self.MinSize = wx.Size(-1, self.ItemCount * self.itemheight)
            self.Top.Layout()
            self.Top.Refresh()

        self.Refresh()
Пример #18
0
def do_background_check():
    from common import pref, setpref
    from time import time
    invite_times = pref('usertrack.invite.dialog.results', type=dict, default={})
    if invite_times:
        return
    if not any(e.protocol in webmail_types for e in p.emailaccounts[:]):
        return
    first_online = pref('usertrack.firstknownonline', type=int, default=-1)
    if not first_online > 0:
        setpref('usertrack.firstknownonline', int(time()))
        return
    elif int(time()) - first_online < 60 * 60 * 24 * 7:
        return
    else:
        make_invite_diag(background = True, success=dialog_closed_callback)
Пример #19
0
def on_popup(options):
    global _didshow
    if _didshow:
        return
    if pref(SHOWN_HELP_PREF, default=False, type=bool):
        _didshow = True
        return

    _didshow = True # A backup in case setpref fails, so you only get one per session.
    setpref(SHOWN_HELP_PREF, True)

    popup(header = _('TIP: Popup Notifications'),
          major  = None,
          minor  = _("You can right click popups to close them right away instead of waiting for them to fade out."),
          sticky = True,
          icon   = skin.get('appdefaults.notificationicons.error'),
          always_show=True)
Пример #20
0
    def OnSplitterSet(self, event):

        self.resizing = False

        event.Skip()
        tc = self.tc

        natHeight = tc.GetNatHeight()
        setHeight = tc.GetSize().height
        h = -1 if setHeight <= natHeight else setHeight

        #        log.info("input_base_height set to %s", h)

        if hasattr(self, 'heightpref') and self.heightpref is not None:
            setpref(self.heightpref, h)

        tc.SetMinHeight(h)
Пример #21
0
    def on_drop_search(self, entry, area, drop_to):
        'rearrange search web items'
        from common.search import searches
        from common import setpref
        entry = entry.searchengine.dict()
        drop_to = drop_to.searchengine.dict()
        engines = [s.dict() for s in searches[:]]

        i = engines.index(entry)
        j = engines.index(drop_to) + (1 if area == 'below' else 0)

        if j > i: j -= 1

        if i != len(engines):
            engines.pop(i)
        engines.insert(j, entry)

        setpref('search.external', engines)
Пример #22
0
    def on_drop_search(self, entry, area, drop_to):
        'rearrange search web items'
        from common.search import searches
        from common import setpref
        entry = entry.searchengine.dict()
        drop_to = drop_to.searchengine.dict()
        engines = [s.dict() for s in searches[:]]

        i = engines.index(entry)
        j = engines.index(drop_to) + (1 if area == 'below' else 0)

        if j > i: j -= 1

        if i != len(engines):
            engines.pop(i)
        engines.insert(j, entry)

        setpref('search.external', engines)
Пример #23
0
def do_background_check():
    from common import pref, setpref
    from time import time
    invite_times = pref('usertrack.invite.dialog.results',
                        type=dict,
                        default={})
    if invite_times:
        return
    if not any(e.protocol in webmail_types for e in p.emailaccounts[:]):
        return
    first_online = pref('usertrack.firstknownonline', type=int, default=-1)
    if not first_online > 0:
        setpref('usertrack.firstknownonline', int(time()))
        return
    elif int(time()) - first_online < 60 * 60 * 24 * 7:
        return
    else:
        make_invite_diag(background=True, success=dialog_closed_callback)
Пример #24
0
    def OnSplitterSet(self, event):

        self.resizing = False

        event.Skip()
        tc = self.tc


        natHeight = tc.GetNatHeight();
        setHeight = tc.GetSize().height;
        h = -1 if setHeight <= natHeight else setHeight

#        log.info("input_base_height set to %s", h)

        if hasattr(self, 'heightpref') and self.heightpref is not None:
            setpref(self.heightpref, h)

        tc.SetMinHeight(h)
Пример #25
0
 def do_check_accounts(self, *a, **k):
     with self.lock:
         if pref('digsby.status.promote_tag.upgrade_response', default=None) is not None:
             return
         if len(self.profile.all_accounts) == 0:
             setpref('digsby.status.promote_tag.upgrade_response', 'skipped_ok')
         else:
             import wx
             @wx.CallAfter
             def after():
                 from gui.toast.toast import popup
                 popup(header = _('Spread the Word!'),
                       icon   = skin.get('appdefaults.taskbaricon', None),
                       major  = None,
                       minor  = _("We've made it easier to spread the word about Digsby by adding a link to your IM status. You can disable this option in Preferences > Status."),
                       sticky = True,
                       max_lines=10,
                       onclose=self.response,
                       buttons=[(_('Close'), lambda *a, **k: None)])
Пример #26
0
def on_popup(options):
    global _didshow
    if _didshow:
        return
    if pref(SHOWN_HELP_PREF, default=False, type=bool):
        _didshow = True
        return

    _didshow = True  # A backup in case setpref fails, so you only get one per session.
    setpref(SHOWN_HELP_PREF, True)

    popup(
        header=_('TIP: Popup Notifications'),
        major=None,
        minor=
        _("You can right click popups to close them right away instead of waiting for them to fade out."
          ),
        sticky=True,
        icon=skin.get('appdefaults.notificationicons.error'),
        always_show=True)
Пример #27
0
def edit_buddylist_order(parent, *_a):
    # show an existing one if already on screen

    if VisualListEditor.RaiseExisting():
        return

    editor = VisualListEditor(parent, profile.prefs['buddylist.order'],
                              buddylist_panel_names,
                              lambda l: setpref('buddylist.order', l),
                              _('Arrange Panels'))
    editor.Show()
Пример #28
0
def edit_buddylist_order(parent, *_a):
    # show an existing one if already on screen

    if VisualListEditor.RaiseExisting():
        return

    editor = VisualListEditor(parent, profile.prefs['buddylist.order'],
                              buddylist_panel_names,
                              lambda l: setpref('buddylist.order', l),
                              _('Arrange Panels'))
    editor.Show()
Пример #29
0
def _show_research_popup():
    import wx
    assert wx.IsMainThread()
    import gui.skin
    from common import setpref
    from gui.toast.toast import popup

    def learnmore(*a, **k):
        import gui.pref.prefsdialog as prefsdialog
        prefsdialog.show('research')

    _didshowresearch = True
    setpref(SHOWN_RESEARCH_POPUP, True)
    popup(header = _('Help Digsby Stay Free'),
          major  = None,
          minor  = _("You are helping Digsby stay free by allowing Digsby to use your PC's idle time."),
          sticky = True,
          onclick = learnmore,
          icon = gui.skin.get('appdefaults.taskbaricon'),
          buttons = [(_('Learn More'), learnmore),
                     (_('Close'), lambda *a, **k: None)])
Пример #30
0
    def build_actionsbar_menu(self):
        m = UMenu(self, onshow=self.update_actionsbar_menu)

        c = self._actionsbar_checks = {}
        for name, label in [('icons', _('Icons Only')),
                            ('text', _('Text Only')),
                            ('next', _('Icons Next to Text')),
                            ('above', _('Icons Above Text'))]:

            def cb(name=name):
                with self.Frozen():
                    setpref(action_icons_key, name)

            c[name] = m.AddCheckItem(label, callback=cb)

        m.AddSep()
        m.AddItem(
            _('Hide Actions Bar'),
            callback=lambda: setpref('messaging.show_actions_bar', False))

        return m
Пример #31
0
def on_disable_trends_help(account_key, args):
    common.setpref(HELP_PREF, False)
    return True
Пример #32
0
 def cb(name=name):
     with self.Frozen():
         setpref(action_icons_key, name)
Пример #33
0
 def response(self):
     with self.lock:
         setpref('digsby.status.promote_tag.upgrade_response', 'ok')
         setpref('digsby.status.promote_tag.enabled', True)
Пример #34
0
 def ToggleOrderLock(self):
     self.unlocked = not self.unlocked
     setpref(self.prefkey + '.unlocked', self.unlocked)
Пример #35
0
def set_searches(engine_list, checked):
    engine_dicts = [
        e.dict(enabled=checked[n]) for n, e in enumerate(engine_list)
    ]
    setpref('search.external', engine_dicts)
Пример #36
0
    def DownloadDict(self):
        """
            Get everything set for, then call, DownloadAndInstall
        """

        # decide if we actualy need to get the language
        self._need_to_download, need = None, self._need_to_download
        if not need or need == self.lang:
            log.error('not downloading dictionary')
            return

        #set what langugae is expected next
        self.expectedNext = need
        if need in self.currentDownloads:
            log.info('Already downloading dictionary, returning')
            return

        #Get the full name of the language
        langInfo = self.dict_info[need]
        langName = langInfo[
            'name_english']  #'name_native' if 'name_native' in langInfo else

        #ask the user about downloading
        log.info('Download %s?', need)
        userResponse = wx.MessageBox(
            _('You need to download the {langname} dictionary to use it. Would you like to download this dictionary now?'
              ).format(langname=langName), _('Download Dictionary?'),
            wx.YES_NO)

        #if the user answered no, inform them of how to download and return
        if userResponse == wx.NO:

            lastlang = self.spellengine.lang
            if lastlang:
                setpref('messaging.spellcheck.engineoptions.lang', lastlang)

            dictcancel_hdr = _('Dictionary not downloaded.')
            dictcancel_msg = _(
                'To download it later, select it in the Conversation Preferences.'
            )

            wx.MessageBox(u'%s\n\n%s' % (dictcancel_hdr, dictcancel_msg),
                          _('Download Dictionary Canceled'), wx.OK)
            return

        #build URL
        remote_repo = pref('messaging.spellcheck.aspell_mirror',
                           type=str,
                           default='http://dict.digsby.com/')
        remote_path = remote_repo + langInfo['location']

        def on_install_success():
            log.info('%r has been installed.', need)

            #Swap out the language if the new language is still selected
            if self.expectedNext == need:
                #Attempt the swap and fire a notification on success
                if self.SwapEngine(shouldDownloadOnFail=False):
                    fire(
                        'dictionary.install',
                        title=_('Dictionary Set'),
                        msg=_('Spellcheck language has been set to {langname}.'
                              ).format(langname=langName),
                        popupid='dict_install_%s' % self.lang)
                #If successfull download and install, but fails to load, fire a error notification
                else:
                    fire(
                        'dictionary.install',
                        title=_('Spellcheck error'),
                        msg=
                        _('Failed setting up dictionary. Try reselecting desired language in the preferences.'
                          ),
                        popupid='dict_install_%s' % self.lang)

            #if no longer the set language announce the install was complete
            else:
                fire(
                    'dictionary.install',
                    title=_('Dictionary Installed'),
                    msg=
                    _('You can set this language in the conversation preferences.'
                      ),
                    popupid='dict_install_%s' % self.lang)

            #Remove the language from current downloads
            self.currentDownloads.discard(need)

        #if there's an error, log it
        def on_install_error():
            log.error('There was an error installing %s', need)

            self.currentDownloads.discard(need)

        def on_install_cancel():
            log.info('Dictionary download cancelled by user.')

            self.currentDownloads.discard(need)

            lastlang = self.spellengine.lang
            if lastlang:
                setpref('messaging.spellcheck.engineoptions.lang', lastlang)

        #add to the current downloads set to pervent duplicate downloads
        self.currentDownloads.add(need)

        #Start download
        log.info('Downloading %r from %r', need, remote_path)
        DownloadAndInstall(need,
                           langName,
                           remote_path,
                           cancel=on_install_cancel,
                           success=on_install_success,
                           error=on_install_error)
Пример #37
0
def panel(panel, sizer, addgroup, exithooks):
    top = HSizer()
    top_right = VSizer()

    debug = PrefPanel(panel,
            PrefCollection(Check('advanced_prefs',  _('Advanced Prefs')),
                           Check('console',         _('Enable Debug Console')),
                           Check('reenable_online', _('Allow Reconnect if --start-offline')),
                           layout = VSizer(),
                           itemoptions = (0, BOTTOM | TOP, 3)),
            _('Debug'),
            prefix = 'debug',
    )

    digsby = PrefPanel(panel,
            PrefCollection(Check('allow_add', _('Allow Adding\n Digsby Buddies')),
                           layout = VSizer(),
                           itemoptions = (0, BOTTOM | TOP, 3)),
            _('Digsby Protocol'),
            prefix = 'digsby',
    )

    top.Add(debug,          1, EXPAND | ALL, 3)
    top_right.Add(digsby,   1, EXPAND | ALL, 3)
    top.Add(top_right,      1, EXPAND | ALL, 0)

    email_value_text = Text(panel, 'email.signature.value',
                            style = wx.TE_MULTILINE | wx.TE_AUTO_SCROLL )#| wx.TE_PROCESS_ENTER)
    email_value_text.Enable(pref('email.signature.enabled', type = bool))
    email_value_text.SetMinSize((-1, 60))

    email = PrefPanel(panel,
                      PrefCollection(Check('email.signature.enabled', _('Append signature'),
                                           callback = email_value_text.Enable),
                                     (email_value_text, 1, wx.LEFT | wx.EXPAND, 18),
                                     layout = VSizer()),
                      _('Email'),
                      )

    bottom = VSizer()

    bottom.Add(email, -1, EXPAND | ALL, 3)
    #TODO: defaults for text fields.
    try:
        pref('research.percent')
    except KeyError:
        setpref('research.percent', 75)
    try:
        pref('research.revive_interval_seconds')
    except KeyError:
        setpref('research.revive_interval_seconds', 60*60)

    plura = PrefPanel(panel,
            PrefCollection(
                           PrefCollection(
                                          Check('local.research.enabled', _('Enabled'), default = True),
                                           Check('research.debug_output', _("Print debug output to console. (don't use pipes)"), default = False),
                                           Check('research.always_on',    _('Always On'), default = False),
                                           Check('research.battery_override', _('Run when on battery'), default = False),
                           layout = VSizer(),
                           itemoptions = (0, ALL, 3)),
                           PrefCollection(
                           Label('Percent:'),
                           lambda parent, prefix: Text(parent, pname(prefix, 'research.percent'),
                                                validator=NumericLimit(2, 100), _type=int),
                           Label('Revive in x seconds:'),
                           lambda parent, prefix: Text(parent, pname(prefix, 'research.revive_interval_seconds'), _type=int),
                           layout = VSizer(),
                           itemoptions = (0, ALL, 3)),
                           layout = HSizer(),
                           itemoptions = (0, BOTTOM | TOP, 3)),
            _('Plura'),
            prefix = '',
    )

    social = PrefPanel(panel,
                       PrefCollection(Check('social.use_global_status', _('Use Global Status Dialog (may require restart)'), default = False),
                                      Check('twitter.scan_urls', _('Scan tweets for URLs (for popup click action)'), default = False),
                                      layout = VSizer(),
                                      itemoptions = (0, BOTTOM | TOP, 3)
                                      ),
                       _('Social accounts'),
                       prefix = '',
                       )

    bottom.Add(top, 0, EXPAND | ALL, 0)
    bottom.Add(plura, 0, EXPAND | ALL, 3)
    bottom.Add(social, 0, EXPAND | ALL, 3)
    sizer.Add(bottom, 0, EXPAND | BOTTOM)

    return panel
Пример #38
0
 def SaveStyle(self):
     style = self.GetStyleAsDict()
     from pprint import pformat
     print 'saving style:\n%s' % pformat(style)
     setpref('profile.formatting' if self.aimprofile else 'messaging.default_style',style)
Пример #39
0
 def SaveStyle(self, prefname):
     style = StyleToDict(self.tc.GetStyle(0)[1])
     from pprint import pformat
     print 'saving style:\n%s' % pformat(style)
     setpref(prefname, style)
Пример #40
0
 def set_account_pref(self, name, value):
     from common import setpref
     value = simplejson.dumps(value)
     setpref(self.account_pref_key(name), value)
Пример #41
0
 def ToggleOrderLock(self):
     self.unlocked = not self.unlocked
     setpref(self.prefkey + '.unlocked', self.unlocked)
Пример #42
0
    def DownloadDict(self):
        """
            Get everything set for, then call, DownloadAndInstall
        """

        # decide if we actualy need to get the language
        self._need_to_download, need = None, self._need_to_download
        if not need or need == self.lang:
            log.error("not downloading dictionary")
            return

        # set what langugae is expected next
        self.expectedNext = need
        if need in self.currentDownloads:
            log.info("Already downloading dictionary, returning")
            return

        # Get the full name of the language
        langInfo = self.dict_info[need]
        langName = langInfo["name_english"]  #'name_native' if 'name_native' in langInfo else

        # ask the user about downloading
        log.info("Download %s?", need)
        userResponse = wx.MessageBox(
            _(
                "You need to download the {langname} dictionary to use it. Would you like to download this dictionary now?"
            ).format(langname=langName),
            _("Download Dictionary?"),
            wx.YES_NO,
        )

        # if the user answered no, inform them of how to download and return
        if userResponse == wx.NO:

            lastlang = self.spellengine.lang
            if lastlang:
                setpref("messaging.spellcheck.engineoptions.lang", lastlang)

            dictcancel_hdr = _("Dictionary not downloaded.")
            dictcancel_msg = _("To download it later, select it in the Conversation Preferences.")

            wx.MessageBox(u"%s\n\n%s" % (dictcancel_hdr, dictcancel_msg), _("Download Dictionary Canceled"), wx.OK)
            return

        # build URL
        remote_repo = pref("messaging.spellcheck.aspell_mirror", type=str, default="http://dict.digsby.com/")
        remote_path = remote_repo + langInfo["location"]

        def on_install_success():
            log.info("%r has been installed.", need)

            # Swap out the language if the new language is still selected
            if self.expectedNext == need:
                # Attempt the swap and fire a notification on success
                if self.SwapEngine(shouldDownloadOnFail=False):
                    fire(
                        "dictionary.install",
                        title=_("Dictionary Set"),
                        msg=_("Spellcheck language has been set to {langname}.").format(langname=langName),
                        popupid="dict_install_%s" % self.lang,
                    )
                # If successfull download and install, but fails to load, fire a error notification
                else:
                    fire(
                        "dictionary.install",
                        title=_("Spellcheck error"),
                        msg=_("Failed setting up dictionary. Try reselecting desired language in the preferences."),
                        popupid="dict_install_%s" % self.lang,
                    )

            # if no longer the set language announce the install was complete
            else:
                fire(
                    "dictionary.install",
                    title=_("Dictionary Installed"),
                    msg=_("You can set this language in the conversation preferences."),
                    popupid="dict_install_%s" % self.lang,
                )

            # Remove the language from current downloads
            self.currentDownloads.discard(need)

        # if there's an error, log it
        def on_install_error():
            log.error("There was an error installing %s", need)

            self.currentDownloads.discard(need)

        def on_install_cancel():
            log.info("Dictionary download cancelled by user.")

            self.currentDownloads.discard(need)

            lastlang = self.spellengine.lang
            if lastlang:
                setpref("messaging.spellcheck.engineoptions.lang", lastlang)

        # add to the current downloads set to pervent duplicate downloads
        self.currentDownloads.add(need)

        # Start download
        log.info("Downloading %r from %r", need, remote_path)
        DownloadAndInstall(
            need, langName, remote_path, cancel=on_install_cancel, success=on_install_success, error=on_install_error
        )
Пример #43
0
 def SaveStyle(self, prefname):
     style = StyleToDict(self.tc.GetStyle(0)[1])
     from pprint import pformat
     print 'saving style:\n%s' % pformat(style)
     setpref(prefname, style)
Пример #44
0
 def set_account_pref(self, name, value):
     from common import setpref
     value = simplejson.dumps(value)
     setpref(self.account_pref_key(name), value)
Пример #45
0
 def SearchThresholdReached(*a, **k):
     if pref('search.buddylist.show_hint', True):
         setpref('search.buddylist.show_hint', False)
Пример #46
0
 def _set_name(self, new_val):
     if pref(self.PREF, default=self.PREFDEFAULT) != new_val:
         # calling setpref triggers a notify; only do it if it's different
         from common import setpref
         setpref('buddylist.fakeroot_name', new_val)
Пример #47
0
 def _set_name(self, new_val):
     if pref(self.PREF, default=self.PREFDEFAULT) != new_val:
         # calling setpref triggers a notify; only do it if it's different
         from common import setpref
         setpref('buddylist.fakeroot_name', new_val)
Пример #48
0
def set_searches(engine_list, checked):
    engine_dicts = [e.dict(enabled=checked[n])
                    for n, e in enumerate(engine_list)]
    setpref('search.external', engine_dicts)
Пример #49
0
 def SearchThresholdReached(*a, **k):
     if pref('search.buddylist.show_hint', True):
         setpref('search.buddylist.show_hint', False)
Пример #50
0
def on_disable_trends_help(account_key, args):
    common.setpref(HELP_PREF, False)
    return True
Пример #51
0
 def response(self):
     with self.lock:
         setpref('digsby.status.promote_tag.upgrade_response', 'ok')
         setpref('digsby.status.promote_tag.enabled', True)