home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 February / maximum-cd-2011-02.iso / DiscContents / digsby_setup85.exe / lib / gui / pref / pg_text_conversations.pyo (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-11-24  |  7.1 KB  |  114 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.6)
  3.  
  4. from gui.uberwidgets.formattedinput2.formatprefsmixin import PrefInput
  5. from gui.uberwidgets.formattedinput2.fromattedinputevents import EVT_TEXT_FORMAT_CHANGED
  6. import operator
  7. from gui.pref.prefcontrols import *
  8. from gui.pref.prefstrings import text_conversations as _
  9. from gui.uberwidgets.PrefPanel import PrefCollection, PrefPanel
  10. from config import platformName
  11. from common import pref, setpref, delpref
  12. timestamp_options = (('%#I:%M', '5:43'), ('%#I:%M %p', '5:43 PM'), ('%#I:%M:%S', '5:43:20'), ('%#I:%M:%S %p', '5:43:20 PM'), ('%H:%M', '17:43'), ('%H:%M:%S', '17:43:20'))
  13. new_im_choices = [
  14.     ('stealfocus', _('automatically take focus')),
  15.     ('minimize', _('start minimized in taskbar')),
  16.     ('hide', _('start hidden (tray icon blinks)'))]
  17.  
  18. def panel(panel, sizer, newgroup, exithooks):
  19.     warncheck = Check('messaging.tabs.warn_on_close', 'Warn me when I attempt to close multiple conversations')(panel)
  20.     warncheck.Enabled = get_pref('messaging.tabs.enabled')
  21.     profile.prefs.link(('messaging.tabs.enabled',), (lambda val: wx.CallAfter(warncheck.Enable, val)), obj = warncheck)
  22.     window_options = [
  23.         Check('conversation_window.always_on_top', _('&Keep on top of other applications'))]
  24.     window_options.extend([
  25.         Check('messaging.tabs.enabled', _('Group multiple conversations into one tabbed window')),
  26.         warncheck])
  27.     if platformName != 'mac':
  28.         window_options.append(Choice('conversation_window.new_action', new_im_choices, caption = _('New conversation windows: ')))
  29.     
  30.     window_options.append(Choice('messaging.tabs.icon', (('buddy', _('buddy icon')), ('service', _('service icon')), ('status', _('status icon'))), _("Identify conversations with the contact's: ")))
  31.     winops = PrefPanel(panel, PrefCollection(*window_options), _('Window Options'))
  32.     conversation_entries = get_conversation_entries(panel, exithooks)
  33.     conops = PrefPanel(panel, PrefCollection(*conversation_entries), _('Conversation Options'))
  34.     textform = PrefPanel(panel, build_format_preview(panel, exithooks), _('Text Formatting'))
  35.     panel._conops = conops
  36.     sizer.AddMany([
  37.         (winops, 0, EXPAND | BOTTOM, 6),
  38.         (conops, 0, EXPAND | BOTTOM, 6),
  39.         (textform, 1, EXPAND | BOTTOM, 6)])
  40.     return panel
  41.  
  42.  
  43. def AspellMenuEntries(spellchecker):
  44.     dicts = spellchecker.dict_info
  45.     langs = (lambda .0: for key in .0:
  46. None if 'name_native' in dicts[key] else (key, dicts[key]['name_english']))(dicts)
  47.     return sorted(langs, key = (lambda x: x[1].upper()))
  48.  
  49.  
  50. def build_format_preview(parent, exithooks):
  51.     p = wx.Panel(parent)
  52.     s = p.Sizer = wx.BoxSizer(wx.VERTICAL)
  53.     input = PrefInput(p, value = _('Your messages will look like this.'), autosize = False, multiFormat = False, showFormattingBar = platformName != 'mac', skin = 'AppDefaults.FormattingBar', formatpref = 'messaging.default_style')
  54.     
  55.     def OnFormatChanged(event):
  56.         input.SaveStyle('messaging.default_style')
  57.  
  58.     input.Bind(EVT_TEXT_FORMAT_CHANGED, OnFormatChanged)
  59.     input.SetMinSize((300, 77))
  60.     s.Add(input, 1, wx.EXPAND | wx.ALL, 1)
  61.     if platformName == 'mac':
  62.         h = wx.BoxSizer(wx.HORIZONTAL)
  63.         h.AddStretchSpacer(1)
  64.         h.Add(input.CreateFontButton(p), 0, EXPAND | wx.ALL, 5)
  65.         s.Add(h, 0, wx.EXPAND)
  66.     
  67.     
  68.     def OnPaintWithOutline(event):
  69.         dc = wx.AutoBufferedPaintDC(p)
  70.         rect = wx.RectS(p.Size)
  71.         irect = wx.Rect(input.Rect)
  72.         irect.Inflate(1, 1)
  73.         dc.Brush = wx.WHITE_BRUSH
  74.         dc.Pen = wx.TRANSPARENT_PEN
  75.         dc.DrawRectangleRect(rect)
  76.         dc.Pen = wx.Pen(wx.Color(213, 213, 213))
  77.         dc.DrawRectangleRect(irect)
  78.  
  79.     p.Bind(wx.EVT_PAINT, OnPaintWithOutline)
  80.     return p
  81.  
  82.  
  83. def get_conversation_entries(panel, exithooks):
  84.     spellchecker = spellchecker
  85.     import common.spelling
  86.     history = Check('conversation_window.show_history', _('Show last %2(conversation_window.num_lines)d lines of history in conversation window'))(panel)
  87.     conversation_entries = [
  88.         CheckChoice('conversation_window.timestamp', 'conversation_window.timestamp_format', _('&Display timestamp: '), timestamp_options, allow_custom = True)]
  89.     if 'wxMac' not in wx.PlatformInfo:
  90.         conversation_entries.append(CheckChoice('messaging.spellcheck.enabled', 'messaging.spellcheck.engineoptions.lang', _('Enable spell checking in: '), AspellMenuEntries(spellchecker)))
  91.     
  92.     conversation_entries.extend([
  93.         emoticon_choice(),
  94.         Check('log.ims', _('Log IM conversations to hard drive'), callback = history.Enable),
  95.         (history, 0, LEFT, 18)])
  96.     history.Enable(pref('log.ims', type = bool, default = True))
  97.     if 'wxMac' not in wx.PlatformInfo:
  98.         exithooks += spellchecker.DownloadDict
  99.     
  100.     return conversation_entries
  101.  
  102.  
  103. def emoticon_checkbox():
  104.     return Check('appearance.conversations.emoticons.enabled', _('Show &emoticons in conversations'))
  105.  
  106.  
  107. def emoticon_choice():
  108.     emoticons = emoticons
  109.     import gui.imwin
  110.     emoticonchoices = _[1]
  111.     current_pack = pref('appearance.conversations.emoticons.pack', None)
  112.     return CheckChoice('appearance.conversations.emoticons.enabled', 'appearance.conversations.emoticons.pack', _('Enable &emoticons: '), emoticonchoices)
  113.  
  114.