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
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
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
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
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()
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
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
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
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
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
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
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()
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
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
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