home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyo (Python 2.6)
-
- from gui.uberwidgets.formattedinput2.formatprefsmixin import PrefInput
- from gui.uberwidgets.formattedinput2.fromattedinputevents import EVT_TEXT_FORMAT_CHANGED
- import operator
- from gui.pref.prefcontrols import *
- from gui.pref.prefstrings import text_conversations as _
- from gui.uberwidgets.PrefPanel import PrefCollection, PrefPanel
- from config import platformName
- from common import pref, setpref, delpref
- 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'))
- new_im_choices = [
- ('stealfocus', _('automatically take focus')),
- ('minimize', _('start minimized in taskbar')),
- ('hide', _('start hidden (tray icon blinks)'))]
-
- def panel(panel, sizer, newgroup, exithooks):
- warncheck = Check('messaging.tabs.warn_on_close', 'Warn me when I attempt to close multiple conversations')(panel)
- warncheck.Enabled = get_pref('messaging.tabs.enabled')
- profile.prefs.link(('messaging.tabs.enabled',), (lambda val: wx.CallAfter(warncheck.Enable, val)), obj = warncheck)
- 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: ')))
-
- 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'))
- conversation_entries = get_conversation_entries(panel, exithooks)
- conops = PrefPanel(panel, PrefCollection(*conversation_entries), _('Conversation Options'))
- textform = PrefPanel(panel, build_format_preview(panel, exithooks), _('Text Formatting'))
- panel._conops = conops
- sizer.AddMany([
- (winops, 0, EXPAND | BOTTOM, 6),
- (conops, 0, EXPAND | BOTTOM, 6),
- (textform, 1, EXPAND | BOTTOM, 6)])
- return panel
-
-
- def AspellMenuEntries(spellchecker):
- dicts = spellchecker.dict_info
- langs = (lambda .0: for key in .0:
- None if 'name_native' in dicts[key] else (key, dicts[key]['name_english']))(dicts)
- return sorted(langs, key = (lambda x: x[1].upper()))
-
-
- def build_format_preview(parent, exithooks):
- p = wx.Panel(parent)
- s = p.Sizer = wx.BoxSizer(wx.VERTICAL)
- input = PrefInput(p, value = _('Your messages will look like this.'), autosize = False, multiFormat = False, showFormattingBar = platformName != 'mac', skin = 'AppDefaults.FormattingBar', formatpref = 'messaging.default_style')
-
- def OnFormatChanged(event):
- input.SaveStyle('messaging.default_style')
-
- input.Bind(EVT_TEXT_FORMAT_CHANGED, OnFormatChanged)
- input.SetMinSize((300, 77))
- s.Add(input, 1, wx.EXPAND | wx.ALL, 1)
- if platformName == 'mac':
- h = wx.BoxSizer(wx.HORIZONTAL)
- h.AddStretchSpacer(1)
- h.Add(input.CreateFontButton(p), 0, EXPAND | wx.ALL, 5)
- s.Add(h, 0, wx.EXPAND)
-
-
- def OnPaintWithOutline(event):
- dc = wx.AutoBufferedPaintDC(p)
- rect = wx.RectS(p.Size)
- irect = wx.Rect(input.Rect)
- irect.Inflate(1, 1)
- dc.Brush = wx.WHITE_BRUSH
- dc.Pen = wx.TRANSPARENT_PEN
- dc.DrawRectangleRect(rect)
- dc.Pen = wx.Pen(wx.Color(213, 213, 213))
- dc.DrawRectangleRect(irect)
-
- p.Bind(wx.EVT_PAINT, OnPaintWithOutline)
- return p
-
-
- def get_conversation_entries(panel, exithooks):
- spellchecker = spellchecker
- import common.spelling
- history = Check('conversation_window.show_history', _('Show last %2(conversation_window.num_lines)d lines of history in conversation window'))(panel)
- conversation_entries = [
- CheckChoice('conversation_window.timestamp', 'conversation_window.timestamp_format', _('&Display timestamp: '), timestamp_options, allow_custom = True)]
- if 'wxMac' not in wx.PlatformInfo:
- conversation_entries.append(CheckChoice('messaging.spellcheck.enabled', 'messaging.spellcheck.engineoptions.lang', _('Enable spell checking in: '), AspellMenuEntries(spellchecker)))
-
- conversation_entries.extend([
- emoticon_choice(),
- Check('log.ims', _('Log IM conversations to hard drive'), callback = history.Enable),
- (history, 0, LEFT, 18)])
- history.Enable(pref('log.ims', type = bool, default = True))
- if 'wxMac' not in wx.PlatformInfo:
- exithooks += spellchecker.DownloadDict
-
- return conversation_entries
-
-
- def emoticon_checkbox():
- return Check('appearance.conversations.emoticons.enabled', _('Show &emoticons in conversations'))
-
-
- def emoticon_choice():
- emoticons = emoticons
- import gui.imwin
- emoticonchoices = _[1]
- current_pack = pref('appearance.conversations.emoticons.pack', None)
- return CheckChoice('appearance.conversations.emoticons.enabled', 'appearance.conversations.emoticons.pack', _('Enable &emoticons: '), emoticonchoices)
-
-