示例#1
0
def panel(panel, sizer, addgroup, exithooks):

    service_providers = ServiceMetaProviderPanel(sp.get_meta_service_providers(),
                                             40, 3, panel)

    two = PrefPanel(panel, service_providers, _('Add Accounts'))

    import services

    container = services.service_provider.ServiceProviderContainer(profile())
    provider_accts = observe.ObservableList(container.get_ordered() or [])

    def on_change(*a, **k):
        if not provider_accts.isflagged('being_set'):
            order = []
            for provider in provider_accts:
                for type_ in ('im', 'email', 'social'): #keep order! - no frozenset!
                    if type_ in provider.accounts:
                        order.append(provider.accounts[type_].id)
            container.set_order(order)

    def order_set(*a, **k):
        @wx.CallAfter
        def do_set():
            new = container.get_ordered()
            if new[:] != provider_accts[:]:
                with provider_accts.flagged('being_set'):
                    provider_accts[:] = new

    container.on_order_changed += order_set

    def unregister(*a, **k):
        if order_set in container.on_order_changed:
            container.on_order_changed -= order_set

    exithooks += unregister

    #hook this into on_data_changed

    accts = ProviderList(panel, provider_accts,
                            row_control = lambda *a, **k: ServiceProviderRow(use_checkbox = False, *a, **k),
                            edit_buttons = None)
    provider_accts.add_observer(on_change, obj = accts)

    three     = PrefPanel(panel, accts, _('My Accounts'))
    sizer.Add(two, 0, EXPAND)
    sizer.Add(three, 1, EXPAND | wx.TOP, 3)
    four = PrefPanel(panel,
        choices_sizer(panel, exithooks), _('Account Options'))
    sizer.Add(four, 0, EXPAND | wx.TOP, 3)
    return panel
示例#2
0
    def build_panel(self):
        AcctPrivacyPanel.build_panel(self)

        sz = VSizer()

        allow_chk = wx.CheckBox(
            self, -1, _('Allow only users on my buddy list to contact me'))
        allow_chk.Bind(wx.EVT_CHECKBOX, self.allow_changed)
        self.allow_chk = allow_chk

        hide_os_chk = wx.CheckBox(self, -1,
                                  _('Hide operating system from other users'))
        hide_os_chk.Bind(wx.EVT_CHECKBOX, self.cb_changed)
        self.hide_os_chk = hide_os_chk

        perms = PrefPanel(
            self,
            PrefCollection(allow_chk,
                           hide_os_chk,
                           layout=VSizer(),
                           itemoptions=(0, BOTTOM, 6)), _('Permissions'))

        sz.Add(perms, 0, wx.EXPAND | wx.ALL)

        sz.ShowItems(False)

        self.online_components = sz
示例#3
0
    def __init__(self):
        wx.Frame.__init__(self,
                          None,
                          -1,
                          "Hey! It's a combo title.",
                          pos=wx.Point(300, 300))

        self.Sizer = wx.BoxSizer(wx.VERTICAL)

        self.pp = pp = PrefPanel(self, [
            (FakeContent(self, wx.Colour(238, 238, 238)), 'grey'),
            (FakeContent(self, wx.Colour(238, 238, 255)), 'blue'),
            (FakeContent(self, wx.Colour(255, 238, 238)), 'red'),
            (FakeContent(self, wx.Colour(238, 255, 238)), 'green'),
            (FakeContent(self, wx.Colour(255, 255, 238)), 'yellow'),
        ])
        self.Sizer.Add(pp, 1, wx.EXPAND | wx.ALL, 5)

        button = wx.Button(self, -1, 'ZOMG Lazers')
        self.Sizer.Add(button, 0, wx.EXPAND | wx.ALL, 3)
        button.Bind(wx.EVT_BUTTON, self.OnLazers)

        self.SetBackgroundColour(wx.WHITE)

        self.Bind(wx.EVT_CLOSE, lambda e: wx.GetApp().ExitMainLoop())
示例#4
0
def panel(p, sizer, addgroup, exithooks):
    components = [o() for o in Support.supportoptions.get_enabled()]
    _supportpanel = Support.supportdialog.SupportPanel(components, p)
    outerpanel = PrefPanel(p, _supportpanel, _('Support Digsby'))
    exithooks += _supportpanel.OnClose

    sizer.Add(outerpanel, 1, wx.EXPAND)
    return p
示例#5
0
def panel(panel, sizer, addgroup, exithooks):
    collection = PrefCollection(Check(
        None, _('&Allow Digsby to conduct research during idle itme')),
                                layout=VSizer(),
                                itemoptions=(0, wx.BOTTOM, 6))

    help_group = PrefPanel(panel, collection, _('Help Digsby'))
    sizer.Add(help_group)
    return panel
示例#6
0
 def addgroup(titleortuple, *workers,
              **options):  # given as a shortcut to each pref page
     if isinstance(titleortuple, tuple):
         title, prefix = titleortuple
     else:
         title = titleortuple
         prefix = ''
     group = PrefCollection(*workers, **options)
     panel = PrefPanel(p, group, title, prefix=prefix)
     szAdd(panel, 0, EXPAND_ALL, 3)
     return panel
示例#7
0
def panel(panel, sizer, newgroup, exithooks):

    gprivops = PrefPanel(
        panel,
        PrefCollection(
            Check('send_typing_notifications',
                  _('&Let others know that I am typing')),
            Check(
                'www_auto_signin',
                _('&Automatically sign me into websites (e.g., Yahoo! Mail)')),
            layout=VSizer(),
            itemoptions=(0, BOTTOM, 6)),
        _('Global Privacy Options'),
        prefix='privacy')

    privacy_panel = PrefPanel(panel)
    PageFactory(privacy_panel, exithooks)
    sizer.Add(gprivops, 0, EXPAND | BOTTOM, 6)
    sizer.Add(privacy_panel, 1, EXPAND)

    return panel
示例#8
0
    def build_panel(self):
        AcctPrivacyPanel.build_panel(self)
        ### Online components

        acct = self.acct

        self.perm_rbs = perm_rbs = []

        def rb_callback(a):
            acct.connection.set_privacy(*a)
            silence_notifications(acct.connection)

        perms = PrefPanel(
            self,
            PrefCollection(layout=wx.GridBagSizer(hgap=6),
                           *CheckGridList(self, perm_rbs, self.perm_choices,
                                          acct, rb_callback,
                                          self.show_editor)), _('Permissions'))

        self.opts_rbs = opts_rbs = []

        opts = PrefPanel(
            self,
            PrefCollection(
                wx.StaticText(
                    self, -1,
                    _('Allow users who know my email address to find:')),
                layout=VSizer(),
                itemoptions=(0, BOTTOM, 6),
                *CheckVList(
                    self, opts_rbs, self.opts_choices,
                    lambda a: acct.connection.set_search_response(*a))),
            _('Options'))

        sz = VSizer()
        sz.Add(perms, 0, EXPAND)
        sz.Add(opts, 0, EXPAND)
        sz.ShowItems(False)

        self.online_components = sz
示例#9
0
def panel(panel, sizer, addgroup, exithooks):
    # disable skins on mac
    if config.platform != 'mac':
        addgroup(_('Application Skin'), lambda p, *a: skin_sizer(p))

    addgroup(_('Conversation Theme'),
             lambda p, *a: conversation_sizer(p, panel))

    convo_preview = PrefPanel(
        panel,
        lambda parent, _prefix: conversation_preview(parent, exithooks, panel),
        _('Conversation Preview'))
    sizer.Add(convo_preview, 1, EXPAND)

    return panel
示例#10
0
    def __init__(self):
        wx.Frame.__init__(self,
                          None,
                          -1,
                          "A simple test.",
                          pos=wx.Point(400, 550),
                          size=wx.Size(563, 294))

        self.Sizer = wx.BoxSizer(wx.VERTICAL)

        pp = PrefPanel(self, NoobContactLayoutPanel(self),
                       ' A test of noobish proportions ')
        self.Sizer.Add(pp, 1, wx.EXPAND | wx.ALL, 5)

        self.SetBackgroundColour(wx.WHITE)

        self.Bind(wx.EVT_CLOSE, lambda e: wx.GetApp().ExitMainLoop())
示例#11
0
    def __init__(self):
        wx.Frame.__init__(self,
                          None,
                          -1,
                          "A simple test.",
                          pos=wx.Point(50, 50))

        self.Sizer = wx.BoxSizer(wx.VERTICAL)

        pp = PrefPanel(self, FakeContent(self, wx.Colour(238, 238, 238)),
                       ' A test of silly proportions ', "A Button",
                       self.AButtonCB)
        self.Sizer.Add(pp, 1, wx.EXPAND | wx.ALL, 5)

        self.SetBackgroundColour(wx.WHITE)

        self.Bind(wx.EVT_CLOSE, lambda e: wx.GetApp().ExitMainLoop())
示例#12
0
    def build_panel(self):
        AcctPrivacyPanel.build_panel(self)

        self.rbs = rbs = []

        perms = PrefPanel(
            self,
            PrefCollection(layout=wx.GridBagSizer(hgap=6),
                           *CheckGridList(self, rbs, self.perm_choices,
                                          self.acct, self.rb_changed,
                                          self.show_editor)), _('Permissions'))

        sz = VSizer()
        sz.Add(perms, 0, EXPAND)
        sz.ShowItems(False)

        self.online_components = sz
示例#13
0
    def build_panel(self):
        AcctPrivacyPanel.build_panel(self)
        ### Online components

        #        p_box = wx.StaticBox(self,-1, 'Permissions')
        #        perm_sz = MakeEnabledSizer(wx.StaticBoxSizer)(p_box,wx.VERTICAL)

        check = wx.CheckBox(self,
                            1,
                            label=_("Allow unknown users to contact me"))
        check.Bind(wx.EVT_CHECKBOX, self.chk_changed)

        self.check = check

        perms = PrefPanel(
            self,
            PrefCollection(
                check,
                PrefCollection(
                    Label(_('Allow List')),
                    Button(_('Edit'),
                           lambda *a: self.show_editor(MSNAllowListEditor)),
                    Label(_('Block List')),
                    Button(_('Edit'),
                           lambda *a: self.show_editor(MSNBlockListEditor)),
                    layout=wx.GridSizer(cols=2, hgap=6),
                    itemoptions=(0, ALIGN_CENTER_VERTICAL | BOTTOM, 6)),
                layout=VSizer(),
                itemoptions=(0, BOTTOM, 6)), _('Permissions'))

        sz = VSizer()
        sz.Add(perms, 0, wx.EXPAND | wx.ALL, 3)
        sz.ShowItems(False)

        self.online_components = sz
        self.mobile_changed()
示例#14
0
    def build_panel(self):
        AcctPrivacyPanel.build_panel(self)

        block_unknowns = wx.CheckBox(
            self,
            -1,
            label=_('Allow only users on my buddy list to contact me'))
        req_auth = wx.CheckBox(
            self,
            -1,
            label=
            _('Require authorization before users can add me to their contact list'
              ))
        block_urls = wx.CheckBox(
            self,
            -1,
            label=_('Block authorization requests with URLs in them'))
        web_status = wx.CheckBox(
            self,
            -1,
            label=_('Allow others to view my online status from the web'))

        req_auth.Bind(wx.EVT_CHECKBOX, self.auth_changed)
        block_urls.Bind(wx.EVT_CHECKBOX, self.block_urls_changed)
        web_status.Bind(wx.EVT_CHECKBOX, self.webaware_changed)
        block_unknowns.Bind(wx.EVT_CHECKBOX, self.block_changed)

        lists = []

        for labelclass in ((_('Block List'), ICQBlockListEditor),
                           (_('Visible List'), ICQVisibleListEditor),
                           (_('Invisible List'), ICQInvisibleListEditor)):
            lists.append(Label(labelclass[0]))
            lists.append(
                Button(_('Edit'),
                       lambda b, cls=labelclass[1]: self.show_editor(cls)))

        perms = PrefPanel(
            self,
            PrefCollection(block_unknowns,
                           req_auth,
                           block_urls,
                           web_status,
                           PrefCollection(
                               layout=wx.GridSizer(cols=2, hgap=6),
                               itemoptions=(0, BOTTOM | ALIGN_CENTER_VERTICAL,
                                            3),
                               *lists),
                           layout=VSizer(),
                           itemoptions=(0, BOTTOM | ALIGN_CENTER_VERTICAL, 6)),
            _('Permissions'))

        self._web_status = web_status
        self._req_auth = req_auth
        self._block_urls = block_urls
        self._block_unknowns = block_unknowns

        sz = VSizer()
        sz.Add(perms, 0, wx.EXPAND | wx.ALL)
        sz.Enable(False)
        sz.ShowItems(False)

        self.online_components = sz
        self.get_check_values()
示例#15
0
    def __init__(self,parent):
        SimplePanel.__init__(self, parent, wx.FULL_REPAINT_ON_RESIZE)

        self.BackgroundColour = wx.WHITE

        self.Sizer = wx.BoxSizer(HORIZONTAL)
        sz = wx.BoxSizer(HORIZONTAL)

        self.Sizer.Add(sz,1,EXPAND|ALL,3)

        leftcol = wx.BoxSizer(VERTICAL)

        acctcombo = self.acctcombo = UberCombo(self, value='',skinkey='AppDefaults.PrefCombo')
        acctcont = PrefPanel(self,acctcombo,_('Account'))


        leftcol.Add(acctcont,0,EXPAND|ALL,3)

        buddylist = self.buddylist = ListOBuddies(self)
        self.buddies_panel = buddycont = PrefPanel(self, buddylist, _('Buddy'))
        leftcol.Add(buddycont, 1, EXPAND | TOPLESS, 3)

        style = wx.NO_BORDER | CAL_SUNDAY_FIRST | CAL_SEQUENTIAL_MONTH_SELECTION | CAL_SHOW_HOLIDAYS
        cal = self.cal = CalendarCtrl(self, -1, wx.DateTime.Now(), wx.DefaultPosition, wx.DefaultSize, style)

        cal.SetForegroundColour(wx.Color(160, 160, 160))
        cal.SetHolidayColours(wx.BLACK, wx.WHITE)
        cal.SetHeaderColours(Color(160, 160, 160), Color(239, 239, 239))

        calcont = PrefPanel(self,cal,_('Date'))
        leftcol.Add(calcont, 0, EXPAND | TOPLESS, 3)

        sz.Add(leftcol, 0, EXPAND)

        viewpanel = wx.Panel(self)

        viewer = self.viewer = PastBrowserWebkitWindow(viewpanel)
#        viewer.SetMouseWheelZooms(True)
        finder = self.finder = FindBar(viewpanel,viewer)

        menu = UMenu(viewer)
        menu.AddItem(_('Copy'),  id = wx.ID_COPY,  callback = lambda *a: viewer.Copy())

        viewer.BindWheel(self)
        viewer.BindScrollWin(self)
        viewer.Bind(wx.EVT_CONTEXT_MENU,
                    lambda e: (menu.GetItemById(wx.ID_COPY).Enable(viewer.CanCopy()),
                               menu.PopupMenu(event = e)))

        viewer.Bind(wx.EVT_KEY_DOWN,self.OnKeyDown)
        finder.TextControl.Bind(wx.EVT_KEY_DOWN,self.OnKeyDown)

        nav  = BoxSizer(wx.HORIZONTAL)

        prev = self.prev = UberButton(viewpanel, label = '<-', skin = BUTTON_SKIN)
        next = self.next = UberButton(viewpanel, label = '->', skin = BUTTON_SKIN)

        datelabel = wx.StaticText(viewpanel, -1, style = wx.ALIGN_CENTER| wx.ST_NO_AUTORESIZE)
        datelabel.SetMinSize((140, -1))


        prev.Bind(wx.EVT_BUTTON, lambda e: self.Flip(-1))
        next.Bind(wx.EVT_BUTTON, lambda e: self.Flip( 1))

        nav.AddStretchSpacer(1)
        nav.AddMany([(prev, 0, wx.EXPAND | wx.ALIGN_CENTER),
                     (datelabel, 0, wx.EXPAND | wx.ALIGN_CENTER),
                     (next, 0, wx.EXPAND | wx.ALIGN_CENTER)])
        nav.AddStretchSpacer(1)


        viewpanel.Sizer = wx.BoxSizer(wx.VERTICAL)
        viewpanel.Sizer.AddMany([ (nav,    0, EXPAND),
                                  (viewer, 1, EXPAND),
                                  (finder, 0, EXPAND) ])

        sz.Add(PrefPanel(self, viewpanel, _('Conversation Log')), 1, EXPAND | ALL, 3)

        Bind = self.Bind
        Bind(wx.EVT_PAINT, self.OnPaint)

        def OnAcct(*a):
            '''
            Handle selection of a new account from the Account drop down
            '''
            if self.GroupChatsSelected():
                from collections import defaultdict
                self.groupchats = defaultdict(list)
                for g in GetGroupChats():
                    d = g['time']
                    key = DateTimeFromDMY(d.day, d.month-1, d.year)
                    self.groupchats[key].append(g)

                #dates = sorted((g['date'], g) for g in
                self.dates = sorted(self.groupchats.keys())
                UpdateCal()
                self.buddies_panel.SetTitle(_('Chats'))
            else:
                buddylist.SetList(GetBuddies(acctcombo.Value.id), BuddyRenderer())
                OnBuddy()
                self.buddies_panel.SetTitle(_('Buddy'))

        def OnBuddy(*a):
            '''
            Handels selection of a buddy from the buddy pannel
            '''

            if not self.GroupChatsSelected():
                self.dates = GetDates(buddylist.SelectedBuddy.dir)
                UpdateCal()
            else:
                ViewLogForFile(buddylist.SelectedItem['file'], do_aliases=False)

        def UpdateCal():
            '''
            Switches the date to the last date conversed with the selected budy
            '''
            self.next.Enable(True)
            self.prev.Enable(True)
            if self.dates:
                self.cal.Date = self.dates[-1]

            self.cal.Enable(True)
            OnCalChange()

        def OnCalChange(*a):
            '''
            Update the Calendar UI to a new date
            '''
            caldate = cal.Date

            currentyear   = caldate.GetYear()
            currentmonth  = caldate.GetMonth()
            relevantdates = frozenset(date.GetDay() for date in self.dates
                                      if date.GetYear() == currentyear and
                                      date.GetMonth() == currentmonth and date.GetDay())
            SetHoliday, SetAttr = cal.SetHoliday, cal.SetAttr

            for i in xrange(1, 32):
                if i in relevantdates:
                    SetHoliday(i)
                else:
                    SetAttr(i, CalendarDateAttr(Color(160,160,160)))


            OnDayChange()

        self.OnCalChange = OnCalChange

        def ViewLogForDay(date):
            '''
            Load the log file for the specified date for the currently selected buddy
            '''
            logpath = logpath_for_date(buddylist.SelectedBuddy, date)
            ViewLogForFile(logpath)

        def ViewLogForFile(logpath, do_aliases=True):
            '''
            Update the log viewer with the file specified
            '''
            with viewer.Frozen():
                viewer.SetPageSource(logpath.text('utf-8', 'replace'), logpath.url())
                viewer.RunScript('window.scroll(0, 0);')

                if do_aliases:
                    substitue_aliases()

                import hooks
                hooks.notify('digsby.statistics.logviewer.log_viewed')

        def substitue_aliases():
            '''
            Swap out buddy names with their allies
            '''
            import gui
            with open(gui.skin.resourcedir() / 'html' / 'jquery-1.3.2.js', 'rb') as f:
                viewer.RunScript(f.read())
            buddy = buddylist.SelectedBuddy
            aliases = IAliasProvider(profile())
            import simplejson as json
            names = set(json.loads(viewer.RunScript("var foo = []; $('.buddy').each(function(){foo.push($(this).html())}); JSON.stringify(foo);")))
            for name in names:
                alias = aliases.get_alias(name, buddy.service, buddy.protocol) or name
                viewer.RunScript(SUBHTML % (json.dumps(name), json.dumps(alias)))

        def OnDayChange(*a):
            '''
            Show the log for the day selected in the clander
            '''
            date = cal.Date
            self.date = date

            datelabel.SetLabel(date.FormatDate())

            if cal.GetAttr(date.GetDay()).IsHoliday():
                if self.GroupChatsSelected():
                    chats = sorted(self.groupchats[date], key=lambda g: g['time'], reverse=True)
                    buddylist.SetList(chats, GroupChatRenderer())
                    if chats:
                        ViewLogForFile(chats[0]['file'], do_aliases=False)
                else:
                    ViewLogForDay(date)
            else:
                year  = str(date.GetYear())
                month = date.GetMonth()
                month = wx.DateTime.GetMonthName(int(month))
                day   = str(date.GetDay())

                specific_day_string = _('{month}, {day}, {year}').format(month=month, day=day, year=year)

                if self.GroupChatsSelected():
                    msg = _("There are no chat logs for {specific_day_string}.").format(specific_day_string=specific_day_string)
                else:
                    msg = _("There are no chat logs for {specific_day_string} with {name}.").format(specific_day_string=specific_day_string, name=buddylist.SelectedBuddy.name)

                viewer.SetPageSource(msg, 'file:///C:/')

            viewer.SetFocus()


            wx.CallAfter(cal.Refresh)
        self.OnDayChange = OnDayChange

        acctcombo.SetCallbacks(value = OnAcct)
        buddylist.Bind(wx.EVT_LISTBOX, OnBuddy)

        cBind = cal.Bind
        cBind(EVT_CALENDAR_YEAR, OnCalChange)
        cBind(EVT_CALENDAR_MONTH, OnCalChange)
        cBind(EVT_CALENDAR_SEL_CHANGED, OnDayChange)

        acctcombo.SetItems(MakeAccountItems(), 0)
示例#16
0
def panel(p, sizer, addgroup, exithooks):
    widgetlist = WidgetList(p, profile.widgets)

    browser = Browser(p)
    browser.SetMinSize((235, -1))

    preview = PrefPanel(p, browser, _('Widget Preview'))
    preview.SetMinSize((235, -1))

    embedpanel = wx.Panel(p)
    es = embedpanel.Sizer = VSizer()
    embedtext = wx.TextCtrl(embedpanel,
                            -1,
                            '',
                            style=wx.TE_MULTILINE | wx.TE_READONLY)
    embedtext.SetMinSize((-1, 60))

    copybutton = wx.Button(
        embedpanel,
        -1,
        _('&Copy To Clipboard'),
        style=wx.BU_EXACTFIT if platformName == 'mac' else 0)

    if platformName == 'mac':
        copybutton.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
        button_flags = 0, wx.ALIGN_RIGHT | RIGHT | TOP | BOTTOM, 3
    else:
        button_flags = 0, EXPAND | TOP, 3

    es.Add(embedtext, 1, EXPAND)
    es.Add(copybutton, *button_flags)

    def docopy(e):
        clip = wx.TheClipboard
        if clip.Open():
            clip.SetData(wx.TextDataObject(embedtext.Value))
            clip.Close()

    copybutton.Bind(wx.EVT_BUTTON, docopy)
    copybutton.Enable(False)

    def show_widget(widget_embed_text):
        browser.SetPage(widget_embed_text)

    def on_widget_selection(e):
        i = e.Int
        log.info('widget %d selected', i)
        if i != -1:
            widget = widgetlist.GetDataObject(i)
            embedtext.Value = widget.embed_tag
            copybutton.Enable(bool(embedtext.Value))

            wx.CallLater(150, show_widget, widget.embed_creator(*browser.Size))
        else:
            copybutton.Enable(False)

    widgetlist.Bind(wx.EVT_LIST_ITEM_SELECTED, on_widget_selection)

    widgets = PrefPanel(p, widgetlist, _('Widgets'), _('New Widget'),
                        lambda b: widgetlist.OnNew())

    embed = PrefPanel(p, embedpanel, _('Embed Tag'))

    top = HSizer()
    top.Add(widgets, 1, EXPAND)
    top.Add(preview, 0, EXPAND | LEFT, 6)

    sizer.Add(top, 1, EXPAND)
    sizer.Add(embed, 0, EXPAND | TOP, 6)

    p.on_close = widgetlist.on_close
    wx.CallLater(
        10, lambda: browser.SetPage(preview_placeholder % tuple(browser.Size)))
    return p
示例#17
0
def panel(panel, sizer, newgroup, exithooks):
    display_choices = [(n, str(n + 1)) for n in xrange(Monitor.GetCount())]

    dddict = {
        '{location_dropdown}': ('notifications.popups.location', popupchoices),
        '{monitor_dropdown}': ('notifications.popups.monitor', display_choices)
    }

    popup_panel = wx.Panel(panel)
    popup_sizer = popup_panel.Sizer = HSizer()

    popupposstr = _(
        'Enable &pop-up notifications in the {location_dropdown} on monitor {monitor_dropdown}'
    )

    pattern = re.compile('(.*?)(\{\w*\})(.*?)(\{\w*\})(.*)')

    m = pattern.search(popupposstr)
    startstr = m.group(1)
    dd1 = m.group(2)
    middlestr = m.group(3)
    dd2 = m.group(4)
    endstr = m.group(5)

    popup_sizer.Add(
        CheckChoice('notifications.enable_popup', dddict[dd1][0], startstr,
                    dddict[dd1][1])(popup_panel), 0,
        wx.ALIGN_CENTER_VERTICAL | wx.EXPAND)

    choice2 = Choice(dddict[dd2][0], dddict[dd2][1],
                     caption=middlestr)(popup_panel)
    choice2.Enable(get_pref('notifications.enable_popup'))
    profile.prefs.add_observer(
        lambda *a: choice2.Enable(get_pref('notifications.enable_popup')),
        'notifications.enable_popup',
        obj=panel)
    popup_sizer.Add(choice2, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND)

    if endstr:
        popup_sizer.Add(Label(endstr)(popup_panel), 0, 3)

    top = PrefPanel(panel,
                    PrefCollection(popup_panel,
                                   Check('enable_sound', _('Enable &sounds'))),
                    _('Notifications'),
                    prefix='notifications')

    notifications_view = build_notification_area(panel)
    notifications_view.SetFocus()

    bottom = PrefPanel(panel, notifications_view, _('Events'))

    restore_default_button = Button(
        panel, _('Restore Defaults'),
        lambda: restore_default_notifications(notifications_view))
    if platformName == 'mac':
        restore_default_button.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)

    sizer.AddMany([
        (top, 0, wx.EXPAND | wx.ALL, 3),
        (bottom, 1, wx.EXPAND | wx.ALL, 3),
        (restore_default_button, 0, wx.BOTTOM | wx.LEFT,
         4 if platformName == 'mac' else 0),
    ])

    return panel
示例#18
0
def panel(panel, sizer, addgroup, exithooks):

    startup = wx.CheckBox(panel,
                          label=_('&Launch Digsby when this computer starts'))
    try:
        startupval = bool(startup_shortcuts())
    except Exception:
        startupval = False
        startup.Disable()

    startup.Value = startupval
    startup.Bind(wx.EVT_CHECKBOX, lambda e: on_startup_change(startup.Value))

    # FIXME: Implement this for OS X (and GTK/Linux of course!)

    grp1 = PrefPanel(
        panel,
        PrefCollection(
            startup,
            #Check('startup.launch_on_login', _('&Launch Digsby when this computer starts')),
            #Check('startup.default_im_check', _('Check to see if &Digsby is the default IM client on this computer')),
            Check('digsby.updater.auto_download',
                  _("&Automatically download software updates")),
            Check(
                'login.reconnect.attempt',
                _('&If connection to IM service is lost, automatically attempt to reconnect'
                  )),
            Check(
                'social.feed_ads',
                _('Show trending news articles in social network feeds (powered by OneRiot)'
                  )),
            layout=VSizer(),
            itemoptions=(0, wx.BOTTOM | wx.TOP, 3)),
        _('General Options'))

    p, input, chk = build_profile_panel(panel)

    panel.get_profile = lambda: input.GetFormattedValue()
    panel.get_promote = lambda: chk.Value

    exithooks += lambda: save_profile(panel.get_profile())
    #exithooks += lambda: input.SaveStyle(input.formatpref)

    profile_grp = PrefPanel(panel, p, _('Profile (AIM Only)'))

    ico = build_buddy_icon_panel(panel, 'bicon')

    buddy_icon_grp = PrefPanel(panel, ico, _('Buddy Icon'))

    # Profile and Buddy Icon sizer
    innersz = wx.BoxSizer(wx.HORIZONTAL)
    innersz.Add(profile_grp, 1, wx.EXPAND)
    innersz.Add(buddy_icon_grp, 0, wx.LEFT, 6)

    lang_choices = [
        ('en', 'English'),
    ]

    #    langpanel = VSizer()
    langchoice = Choice('locale', lang_choices)(panel)
    #    langchoice.SetMinSize((200,-1))
    #    langpanel.Add(langchoice)

    lang_grp = PrefPanel(panel, langchoice, _('Language'))

    sizer.AddMany([
        (grp1, 0, wx.EXPAND | wx.ALL, 3),
        (innersz, 0, wx.EXPAND | wx.ALL, 3),
        (lang_grp, 0, wx.EXPAND | wx.ALL, 3),
    ])  #(40, 40)
    sizer.AddStretchSpacer()

    wx.CallAfter(input.SetFormattedValue, profile.profile)

    panel.Layout()

    return panel
示例#19
0
def panel(panel, sizer, addgroup, exithooks):

    try:
        import researchdriver.driver
    except ImportError:
        default_cpu_num = 75
        default_bandwidth_num = 90
    else:
        default_cpu_num = int(researchdriver.driver.get_cpu_percent())
        default_bandwidth_num = int(
            researchdriver.driver.get_bandwidth_percent())

    description = PrefPanel(
        panel,
        build_description_webview,
        _('Research Module'),
        prefix='',
    )
    options = PrefPanel(
        panel,
        PrefCollection(
            PrefCollection(
                PC.Check(
                    'local.research.enabled',
                    _('Allow Digsby to use CPU time to conduct research after %2(research.idle_time_min)d minutes of idle time'
                      )),
                layout=PC.VSizer(),
                itemoptions=(0, wx.ALL, 3),
            ),
            PrefCollection(
                lambda parent, prefix: PC.Slider(
                    PC.pname(prefix, 'local.research.cpu_percent'),
                    _('Maximum CPU Usage:'),
                    start=1,
                    stop=101,
                    step=1,
                    value=int(
                        PC.get_pref('local.research.cpu_percent',
                                    default=default_cpu_num)),
                    default=int(
                        PC.get_pref('local.research.cpu_percent',
                                    default=default_cpu_num)),
                    fireonslide=True,
                    unit=_('{val}%'))
                (parent)[
                    0
                ],  # Slider returns the sizer and the control, we just want the sizer
                lambda parent, prefix: PC.Slider(
                    PC.pname(prefix, 'local.research.bandwidth_percent'),
                    _('Maximum Bandwidth Usage:'),
                    start=1,
                    stop=101,
                    step=1,
                    value=int(
                        PC.get_pref('local.research.bandwidth_percent',
                                    default=default_bandwidth_num)),
                    default=int(
                        PC.get_pref('local.research.bandwidth_percent',
                                    default=default_bandwidth_num)),
                    fireonslide=True,
                    unit=_('{val}%'))
                (parent)[
                    0
                ],  # Slider returns the sizer and the control, we just want the sizer
                layout=PC.HSizer(),
                itemoptions=(0, wx.ALL, 3),
            ),
            layout=PC.VSizer(),
            itemoptions=(0, wx.BOTTOM | wx.TOP, 3)),
        _('Options'),
        prefix='',
    )

    sizer.Add(description, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 3)
    sizer.Add(options, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 3)

    return panel
示例#20
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
示例#21
0
def panel(p, sizer, addgroup, exithooks):

    #idle_panel = wx.Panel(p)

    # Idle message checkbox, minutes box, and status box
    addgroup(
        _('Status Options'),
        Check('digsby.status.promote_tag.enabled',
              _('Promote Digsby in my IM status messages'),
              default=True,
              help='http://wiki.digsby.com/doku.php?id=faq#q34'),
        #             Check('plugins.nowplaying.show_link',
        #                   _('Help Digsby by linking album when sharing "Listening to..." as status')),
        Check(
            'messaging.become_idle',
            _('Let others know that I am idle after '
              '%2(messaging.idle_after)d minutes of inactivity')),
    )

    bottom = HSizer()

    when_away = PrefPanel(
        p,
        PrefCollection(Check('autorespond',
                             _('Autorespond with status message')),
                       Check('disable_sound', _('Disable sounds')),
                       Check('disable_popup',
                             _('Disable pop-up notifications')),
                       layout=VSizer(),
                       itemoptions=(0, BOTTOM | TOP, 3)),
        _('When away...'),
        prefix='messaging.when_away',
    )
    bottom.Add(when_away, 1, EXPAND | ALL, 3)

    if config.platformName != 'mac':
        fullscreen = PrefPanel(
            p,
            PrefCollection(Check('hide_convos',
                                 _('&Hide new conversation windows')),
                           Check('disable_sounds', _('&Disable sounds')),
                           Check('disable_popups',
                                 _('Disable &pop-up notifications')),
                           layout=VSizer(),
                           itemoptions=(0, BOTTOM | TOP, 3)),
            _('When running full screen applications...'),
            prefix='fullscreen',
            #        Check('disable_alerts', _('Disable &alerts')),
        )
        bottom.Add(fullscreen, 1, EXPAND | ALL, 3)

    sizer.Add(bottom, 0, EXPAND | BOTTOM)

    statuses = StatusList(p, profile.statuses)
    msgs = PrefPanel(p,
                     statuses,
                     _('Status Messages'),
                     buttonlabel=_('New Status Message'),
                     buttoncb=lambda b: statuses.add_status_message())

    sizer.Add(msgs, 1, wx.EXPAND)
    return p
示例#22
0
    def __init__(self, parent):
        SimplePanel.__init__(self, parent, wx.FULL_REPAINT_ON_RESIZE)

        if platformName != 'mac':
            self.BackgroundColour = WHITE

        sz = self.Sizer = wx.BoxSizer(VERTICAL)

        top = wx.BoxSizer(HORIZONTAL)

        radpanel = wx.Panel(self)
        rs = radpanel.Sizer = wx.BoxSizer(VERTICAL)

        RADIO = wx.RadioButton

        overrads = self.overrads = dict(
            NONPROX=RADIO(radpanel,
                          ID_NONPROX,
                          _("&No proxy"),
                          style=wx.RB_GROUP,
                          name='override'),
            SYSPROX=RADIO(radpanel,
                          ID_SYSPROX,
                          _("Use &default system settings"),
                          name='override'),
            SETPROX=RADIO(radpanel,
                          ID_SETPROX,
                          _("&Specify proxy settings"),
                          name='override'))

        rs.Add(overrads["NONPROX"], 0, ALL, 2)
        rs.Add(overrads["SYSPROX"], 0, ALL, 2)
        rs.Add(overrads["SETPROX"], 0, ALL, 2)

        #-------------------------------------------------------------------------------
        proxyp = wx.Panel(self)
        ps = proxyp.Sizer = wx.FlexGridSizer(2, 2)

        TEXT = lambda s: wx.StaticText(proxyp, -1, s)
        INPUT = lambda d, v=wx.DefaultValidator: wx.TextCtrl(
            proxyp, -1, d, validator=v)

        hosti = self.hosti = INPUT('')
        porti = self.porti = INPUT('', NumericLimit(65535))

        ps.Add(TEXT(_("&Host:")), 0, ALIGN_RIGHT | ALIGN_CENTER_VERTICAL | ALL,
               2)
        ps.Add(hosti, 0, ALIGN_LEFT | ALIGN_CENTER_VERTICAL | EXPAND | ALL, 2)

        ps.Add(TEXT(_("P&ort:")), 0, ALIGN_RIGHT | ALIGN_CENTER_VERTICAL | ALL,
               2)
        ps.Add(porti, 0, ALIGN_LEFT | ALIGN_CENTER_VERTICAL | ALL, 2)
        ps.AddGrowableCol(1, 1)
        #-------------------------------------------------------------------------------
        protop = wx.Panel(self)
        prs = protop.Sizer = wx.BoxSizer(VERTICAL)

        protorads = self.protorads = dict(
            HTTP=RADIO(protop,
                       ID_HTTP,
                       "&HTTP",
                       style=wx.RB_GROUP,
                       name='proxytype'),
            #HTTPS  = RADIO(protop, ID_HTTPS, "HTTPS", name = 'proxytype'),
            SOCKS4=RADIO(protop, ID_SOCKS4, "SOCKS &4", name='proxytype'),
            SOCKS5=RADIO(protop, ID_SOCKS5, "SOCKS &5", name='proxytype'))

        prs.Add(protorads["HTTP"], 0, ALL, 2)
        #prs.Add(protorads["HTTPS"], 0, ALL, 2)
        prs.Add(protorads["SOCKS4"], 0, ALL, 2)
        prs.Add(protorads["SOCKS5"], 0, ALL, 2)

        #-------------------------------------------------------------------------------
        authp = wx.Panel(self)
        aus = authp.Sizer = wx.FlexGridSizer(2, 2)

        TEXT = lambda s: wx.StaticText(authp, -1, s)
        INPUT = lambda d, style=0: wx.TextCtrl(authp, -1, d, style=style)

        aus.Add(TEXT(_("&Username:"******"&Password:"******"Proxy Server")), 1, EXPAND | ALL, 2)
        top.Add(PrefPanel(self, protop, _("Protocol")), 0, EXPAND | ALL, 2)

        sz.Add(PrefPanel(self, radpanel, _("How to Connect")), 0, EXPAND | ALL,
               2)
        sz.Add(top, 1, EXPAND)
        sz.Add(PrefPanel(self, authp, _("Authentication")), 1, EXPAND | ALL, 2)

        pd = self.proxy_dict

        override = pd.get('override', "SYSPROX")

        try:
            override = int(override)
        except:
            pass
        else:
            override = ['SYSPROX', 'SETPROX'][override]

        self.override = override
        self.overrads[self.override].Value = True

        self.addr = pd.get('addr', '')
        self.port = pd.get('port', '')

        self.proxytype = pd.get('proxytype', 'HTTP')
        self.protorads[self.proxytype].Value = True

        self.username = pd.get('username', '')
        self.password = pd.get('password', '')

        self.Enablement()

        Bind = self.Bind
        Bind(wx.EVT_RADIOBUTTON, self.OnRadio)

        if platformName != 'mac':
            Bind(wx.EVT_PAINT, self.OnPaint)
示例#23
0
class ProfilePanel(SimplePanel):
    WRAP_WIDTH = 356

    def __init__(self, parent, validator=None):
        SimplePanel.__init__(self, parent, wx.FULL_REPAINT_ON_RESIZE)
        self.validator = validator

        if platformName != 'mac':
            self.BackgroundColour = WHITE

        sz = self.Sizer = wx.BoxSizer(VERTICAL)

        profile_type = wx.Panel(self)
        rs = profile_type.Sizer = wx.BoxSizer(VERTICAL)

        RADIO = wx.RadioButton
        overrads = self.overrads = dict(
            NEWPROFILE=RADIO(profile_type,
                             ID_NEWPROFILE,
                             _("&New Profile"),
                             style=wx.RB_GROUP),
            IMPORTPROFILE=RADIO(
                profile_type, ID_IMPORTPROFILE,
                _("&Import an existing profile from the Digsby servers")))

        rs.Add(overrads["NEWPROFILE"], 0, ALL, 2)
        rs.Add(overrads["IMPORTPROFILE"], 0, ALL, 2)

        #-------------------------------------------------------------------------------
        login_info = wx.Panel(self)

        ps = wx.FlexGridSizer(2, 2)

        TEXT = lambda s: wx.StaticText(login_info, -1, s)
        INPUT = lambda d, style=0, v=wx.DefaultValidator: wx.TextCtrl(
            login_info, -1, d, style=style, validator=v)

        digsby_username = self.digsby_username = INPUT('')
        digsby_password = self.digsby_password = INPUT('',
                                                       style=wx.TE_PASSWORD)

        ps.Add(TEXT(_("&Digsby Username:"******"Digsby &Password:"******"&Profile Name:")), 0,
                ALIGN_RIGHT | ALIGN_CENTER_VERTICAL | ALL, 2)
        aus.Add(profile_name, 0,
                ALIGN_LEFT | ALIGN_CENTER_VERTICAL | EXPAND | ALL, 2)

        aus.Add(TEXT(_("&Profile Password:"******"&Re-Enter Password:"******"Profile Info"))
        self.login_info_panel = PrefPanel(self, login_info, _("Login Info"))
        self.login_info_panel.Show(False)

        sz.Add(PrefPanel(self, profile_type, _("Profile Type")), 0,
               EXPAND | ALL, 2)
        sz.Add(self.profile_info_panel, 0, EXPAND | ALL, 2)
        sz.Add(self.login_info_panel, 0, EXPAND | ALL, 2)

        Bind = self.Bind
        Bind(wx.EVT_RADIOBUTTON, self.OnRadio)
        Bind(wx.EVT_TEXT, self.validate_form)

        if platformName != 'mac':
            Bind(wx.EVT_PAINT, self.OnPaint)

        self.validate_form()

    def SetImportStatusText(self, text, red=False):
        '''Sets the text below the "import account" section.'''

        self.login_status_text.SetLabel(text)
        self.login_status_text.Wrap(356)
        self.login_status_text.Show(bool(text))
        self.login_status_text.SetForegroundColour(wx.RED if red else wx.BLACK)
        self.Layout()

    def validate_form(self, evt=None):
        valid = True

        if self.is_new_profile:
            if not self.profile_name.Value:
                valid = False
            if not self.profile_password.Value:
                valid = False
        else:
            if not self.digsby_username.Value:
                valid = False
            if not self.digsby_password.Value:
                valid = False

        if self.validator:
            self.validator(valid)

    def passwords_match(self):
        if self.is_new_profile:
            return self.profile_password.Value and self.profile_password.Value == self.profile_password_2.Value
        else:
            return True

    def OnRadio(self, event):
        new = self.is_new_profile
        self.profile_info_panel.Show(new)
        self.login_info_panel.Show(not new)
        self.Layout()

    def OnPaint(self, event):
        dc = wx.PaintDC(self)
        rect = wx.RectS(self.ClientSize)
        dc.Brush = wx.WHITE_BRUSH
        dc.Pen = wx.TRANSPARENT_PEN
        dc.DrawRectangleRect(rect)

    @property
    def is_new_profile(self):
        return self.overrads['NEWPROFILE'].Value
示例#24
0
    def __init__(self, parent, validator=None):
        SimplePanel.__init__(self, parent, wx.FULL_REPAINT_ON_RESIZE)
        self.validator = validator

        if platformName != 'mac':
            self.BackgroundColour = WHITE

        sz = self.Sizer = wx.BoxSizer(VERTICAL)

        profile_type = wx.Panel(self)
        rs = profile_type.Sizer = wx.BoxSizer(VERTICAL)

        RADIO = wx.RadioButton
        overrads = self.overrads = dict(
            NEWPROFILE=RADIO(profile_type,
                             ID_NEWPROFILE,
                             _("&New Profile"),
                             style=wx.RB_GROUP),
            IMPORTPROFILE=RADIO(
                profile_type, ID_IMPORTPROFILE,
                _("&Import an existing profile from the Digsby servers")))

        rs.Add(overrads["NEWPROFILE"], 0, ALL, 2)
        rs.Add(overrads["IMPORTPROFILE"], 0, ALL, 2)

        #-------------------------------------------------------------------------------
        login_info = wx.Panel(self)

        ps = wx.FlexGridSizer(2, 2)

        TEXT = lambda s: wx.StaticText(login_info, -1, s)
        INPUT = lambda d, style=0, v=wx.DefaultValidator: wx.TextCtrl(
            login_info, -1, d, style=style, validator=v)

        digsby_username = self.digsby_username = INPUT('')
        digsby_password = self.digsby_password = INPUT('',
                                                       style=wx.TE_PASSWORD)

        ps.Add(TEXT(_("&Digsby Username:"******"Digsby &Password:"******"&Profile Name:")), 0,
                ALIGN_RIGHT | ALIGN_CENTER_VERTICAL | ALL, 2)
        aus.Add(profile_name, 0,
                ALIGN_LEFT | ALIGN_CENTER_VERTICAL | EXPAND | ALL, 2)

        aus.Add(TEXT(_("&Profile Password:"******"&Re-Enter Password:"******"Profile Info"))
        self.login_info_panel = PrefPanel(self, login_info, _("Login Info"))
        self.login_info_panel.Show(False)

        sz.Add(PrefPanel(self, profile_type, _("Profile Type")), 0,
               EXPAND | ALL, 2)
        sz.Add(self.profile_info_panel, 0, EXPAND | ALL, 2)
        sz.Add(self.login_info_panel, 0, EXPAND | ALL, 2)

        Bind = self.Bind
        Bind(wx.EVT_RADIOBUTTON, self.OnRadio)
        Bind(wx.EVT_TEXT, self.validate_form)

        if platformName != 'mac':
            Bind(wx.EVT_PAINT, self.OnPaint)

        self.validate_form()
示例#25
0
def panel(panel, sizer, newgroup, exithooks):
    warncheck = Check(
        'messaging.tabs.warn_on_close',
        'Warn me when I attempt to close multiple conversations')(panel)
    checkbox_enabled_when_pref(warncheck, 'messaging.tabs.enabled')

    window_options = [
        Check('conversation_window.always_on_top',
              _('&Keep on top of other applications'))
    ]

    window_options.extend([
        Check('messaging.tabs.enabled',
              _("Group multiple conversations into one tabbed window")),
        warncheck
    ])

    if platformName != 'mac':
        window_options.append((Choice('conversation_window.new_action',
                                      new_im_choices,
                                      caption=_('New conversation windows: ')),
                               0, wx.EXPAND | wx.BOTTOM, 3))
    window_options.append(
        Choice('messaging.tabs.icon',
               (('buddy', _("buddy icon")), ('service', _("service icon")),
                ('status', _("status icon"))),
               _("Identify conversations with the contact's: ")))

    winops = PrefPanel(panel, PrefCollection(*window_options),
                       _('Window Options'))

    conops = PrefPanel(panel, get_conversation_entries(panel, exithooks),
                       _('Conversation Options'))

    disable_flash = Check('imwin.ads_disable_flash',
                          _("Don't show flash ads"))(panel)
    checkbox_enabled_when_pref(disable_flash, 'imwin.ads')

    ad_options = PrefPanel(
        panel,
        PrefCollection(
            Label(
                _('Help keep Digsby free by showing an\nadvertisement in the IM window.'
                  )),
            Check('imwin.ads', _('Support Digsby development with an ad')),
            disable_flash,
            Choice('imwin.ads_position', ad_position_options,
                   _('Location of ad in IM window: ')),
            layout=wx.BoxSizer(wx.VERTICAL),
            itemoptions=(0, wx.EXPAND | wx.BOTTOM, 8),
        ), _('Ad Options'))

    hsizer = HSizer()
    hsizer.AddMany([(conops, 1, wx.EXPAND | wx.ALL, 3),
                    (ad_options, 0, wx.EXPAND | wx.ALL, 3)])

    textform = PrefPanel(panel, build_format_preview(panel, exithooks),
                         _('Text Formatting'))

    panel._conops = conops

    sizer.AddMany([(winops, 0, EXPAND | BOTTOM, 6),
                   (hsizer, 0, EXPAND | BOTTOM, 6),
                   (textform, 1, EXPAND | BOTTOM, 6)])

    return panel
示例#26
0
def panel(panel, sizer, addgroup, exithooks):
    two = PrefPanel(panel, sorting_sizer(panel, exithooks),
                    _('Sorting and Groups'))

    autohide_panel = wx.Panel(panel)
    aps = autohide_panel.Sizer = HSizer()

    if config.platform == 'win':
        # Setting autohide has to modify taskbar settings, so focus jumps to
        # the buddylist. This meant you wouldn't immediately see the effect
        # of checking the box if the blist was already docked, though.
        #
        # Now 50ms after checking it, the checkbox gets focus again, and the
        # buddylist will then slide away.
        def on_autohide_check(v):
            if v: wx.CallLater(50, autohide.SetFocus)
    else:

        def on_autohide_check(v):
            pass

    autohide = Check('local.buddylist.dock.autohide',
                     _('Autohide when not in &focus'),
                     callback=on_autohide_check)(autohide_panel)

    aps.Add(autohide, 0, LEFT, 18)

    dock = Check('local.buddylist.dock.enabled',
                 _('Automatically &dock when near edge of screen'),
                 callback=lambda v: autohide.Enable(v))(panel)
    autohide.Enable(dock.IsChecked())

    three = PrefPanel(
        panel,
        PrefCollection(Check('buddylist.always_on_top',
                             _('&Keep on top of other applications')),
                       Check('buddylist.show_in_taskbar',
                             _('Show in taskbar')),
                       dock,
                       autohide_panel,
                       layout=VSizer(),
                       itemoptions=(0, BOTTOM, 6)), _('Window Options'))

    # The autohide checkbox is slightly indented, and disabled when the "dock"
    # checkbox is unhecked.

    h = HSizer()
    h.Add(two, 1, EXPAND | RIGHT, 3)
    h.Add(three, 0, EXPAND | LEFT, 3)

    v = VSizer()
    v.Add(h, 0, EXPAND)

    from functools import partial
    four = PrefPanel(panel,
                     partial(contact_layout_panel, exithooks=exithooks),
                     _('Contact Layout'),
                     prefix='buddylist.layout')

    def AdvancedToggleCB(button):
        val = not pref('buddylist.layout.ez_layout', False)
        mark_pref('buddylist.layout.ez_layout', val)
        ezmode = val

        ez = four.content.ez_panel
        adv = four.content.adv_panel

        four.content.Sizer.Clear()

        four.content.Show(False)
        if ezmode:
            adv.Destroy()
            adv = None
            easy_layout_panel(four.content, 'buddylist.layout')
        else:
            ez.Destroy()
            ez = None
            advanced_layout_panel(four.content,
                                  'buddylist.layout',
                                  exithooks=exithooks)

        button.SetLabel(_('Advanced') if ezmode else _('Basic'))

        four.content.Layout()
        four.content.Show(True)
        panel.Layout()

    four.SetButton(
        _('Advanced') if four.content.ez_panel else _('Basic'),
        lambda button: wx.CallAfter(AdvancedToggleCB, button))

    v.Add(four, 0, EXPAND | TOP, 5)

    sizer.Add(v, 1, EXPAND)

    return panel