home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 June / maximum-cd-2009-06.iso / DiscContents / digsby_setup.exe / lib / gui / pref / pg_notifications.pyo (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-02-26  |  4.0 KB  |  65 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.5)
  3.  
  4. USE_TREE_VIEW = False
  5. import copy
  6. import wx
  7. from gui.pref.prefcontrols import *
  8. from gui.controls import Button
  9. from gui.uberwidgets.PrefPanel import PrefPanel, PrefCollection
  10. from gui.notifications.notificationlist import NotifyPanel
  11. from gui.toolbox import Monitor
  12. from common import pref
  13. from config import platformName
  14. popupchoices = [
  15.     ('lowerright', _('bottom right corner')),
  16.     ('lowerleft', _('bottom left corner')),
  17.     ('upperright', _('top right corner')),
  18.     ('upperleft', _('top left corner'))]
  19.  
  20. def panel(panel, sizer, newgroup, exithooks):
  21.     display_choices = [ (n, str(n + 1)) for n in xrange(Monitor.GetCount()) ]
  22.     popup_panel = wx.Panel(panel)
  23.     popup_sizer.Add(CheckChoice('notifications.enable_popup', 'notifications.popups.location', _('Enable &pop-up notifications in the '), popupchoices)(popup_panel), 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND)
  24.     top = PrefPanel(panel, PrefCollection(popup_panel, Check('enable_sound', _('Enable &sounds'))), _('Notifications'), prefix = 'notifications')
  25.     notifications_view = build_notification_area(panel)
  26.     notifications_view.SetFocus()
  27.     bottom = PrefPanel(panel, notifications_view, _('Events'))
  28.     restore_default_button = Button(panel, (_('Restore Defaults'),), (lambda : restore_default_notifications(notifications_view)))
  29.     if platformName == 'mac':
  30.         restore_default_button.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
  31.     
  32.     None([
  33.         sizer.AddMany,
  34.         (top, 0, wx.EXPAND | wx.ALL, 3),
  35.         ((bottom, 1, wx.EXPAND | wx.ALL, 3), restore_default_button, 0, wx.BOTTOM | wx.LEFT if platformName == 'mac' else 0)])
  36.     return panel
  37.  
  38.  
  39. def restore_default_notifications(ctrl):
  40.     if wx.YES == wx.MessageBox(_('Are you sure you want to restore the default notification set?\n\nAll of your notification settings will be lost.'), _('Restore Default Notifications'), wx.ICON_EXCLAMATION | wx.YES_NO):
  41.         import common.notifications as commnot
  42.         nots = profile.notifications
  43.         nots.clear()
  44.         nots.update(copy.deepcopy(commnot.default_notifications))
  45.         ctrl.Refresh()
  46.     
  47.  
  48.  
  49. def build_notification_area(parent):
  50.     notification_viewer = pref('notifications.editor.view', type = str, default = 'simple')
  51.     if notification_viewer == 'tree':
  52.         NotificationView = NotificationView
  53.         import gui.notificationview
  54.         return NotificationView(parent, profile.notifications)
  55.     else:
  56.         get_notification_info = get_notification_info
  57.         import common.notifications
  58.         notifypanel = NotifyPanel(parent)
  59.         n = notifypanel.NotifyView
  60.         n.SetNotificationInfo(get_notification_info())
  61.         n.SetUserNotifications(profile.notifications)
  62.         n.UpdateSkin()
  63.         return notifypanel
  64.  
  65.