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

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.6)
  3.  
  4. import wx
  5. from gui.pref import pg_accounts
  6. from gui import skin
  7. from gui.native.win.winutil import is_vista
  8. import traceback
  9. import util.primitives.funcs as utilfuncs
  10.  
  11. def show():
  12.     if not AccountWizard.RaiseExisting():
  13.         w = AccountWizard()
  14.         w.CenterOnScreen()
  15.         w.Show()
  16.     
  17.  
  18.  
  19. def bind_paint(ctrl, paint):
  20.     
  21.     def on_paint(e):
  22.         dc = wx.AutoBufferedPaintDC(ctrl)
  23.         return paint(dc)
  24.  
  25.     ctrl.Bind(wx.EVT_PAINT, on_paint)
  26.  
  27.  
  28. class AccountWizard(wx.Frame):
  29.     MIN_SIZE = (567, 569)
  30.     
  31.     def __init__(self, parent = None):
  32.         wx.Frame.__init__(self, parent, -1, title = _('Digsby Setup Wizard'))
  33.         self.SetFrameIcon(skin.get('AppDefaults.TaskbarIcon'))
  34.         self.Bind(wx.EVT_CLOSE, self.on_close)
  35.         big_panel = wx.Panel(self)
  36.         header = wx.Panel(big_panel)
  37.         header.SetBackgroundColour(wx.Colour(244, 249, 251))
  38.         hdr1 = wx.StaticText(header, -1, _('Welcome to Digsby!'))
  39.         set_font(hdr1, 18, True)
  40.         elems = [
  41.             (False, 'All your '),
  42.             (True, 'IM'),
  43.             (False, ', '),
  44.             (True, 'Email'),
  45.             (False, ' and '),
  46.             (True, 'Social Network'),
  47.             (False, ' accounts under one roof.')]
  48.         txts = []
  49.         for emphasis, text in elems:
  50.             txt = wx.StaticText(header, -1, text)
  51.             set_font(txt, 12, bold = emphasis, underline = False)
  52.             txts.append(txt)
  53.         
  54.         txt_sizer = wx.BoxSizer(wx.HORIZONTAL)
  55.         txt_sizer.AddMany(txts)
  56.         icon = skin.get('AppDefaults.TaskBarIcon').PIL.Resized(48).WXB
  57.         bind_paint((header,), (lambda dc: dc.DrawBitmap(icon, 5, 3, True)))
  58.         icon_pad = icon.Width + 6
  59.         header.Sizer = sz = wx.BoxSizer(wx.VERTICAL)
  60.         sz.AddMany([
  61.             (hdr1, 0, wx.EXPAND | wx.LEFT, 6 + icon_pad),
  62.             (3, 3),
  63.             (txt_sizer, 0, wx.EXPAND | wx.LEFT, 6 + icon_pad)])
  64.         panel = wx.Panel(big_panel)
  65.         panel.BackgroundColour = wx.WHITE
  66.         panel.Sizer = sizer = wx.BoxSizer(wx.VERTICAL)
  67.         self.exithooks = utilfuncs.Delegate()
  68.         pg_accounts.panel(panel, sizer, None, self.exithooks)
  69.         
  70.         def paint(e):
  71.             dc = wx.AutoBufferedPaintDC(big_panel)
  72.             dc.Brush = wx.WHITE_BRUSH
  73.             dc.Pen = wx.TRANSPARENT_PEN
  74.             r = big_panel.ClientRect
  75.             dc.DrawRectangleRect(r)
  76.             dc.Brush = wx.Brush(header.BackgroundColour)
  77.             y = header.Size.height + 19
  78.             dc.DrawRectangle(0, 0, r.width, y)
  79.             dc.Brush = wx.Brush(wx.BLACK)
  80.             dc.DrawRectangle(0, y, r.width, 1)
  81.  
  82.         big_panel.BackgroundStyle = wx.BG_STYLE_CUSTOM
  83.         big_panel.Bind(wx.EVT_PAINT, paint)
  84.         sz.Add(header, 0, wx.EXPAND | wx.ALL, 8)
  85.         sz.Add((5, 5))
  86.         sz.Add(panel, 1, wx.EXPAND | wx.ALL, 12)
  87.         self.SetMinSize(self.MIN_SIZE)
  88.         self.SetSize(self.MIN_SIZE)
  89.  
  90.     
  91.     def on_close(self, e):
  92.         
  93.         def show_hint():
  94.             icons = wx.GetApp().buddy_frame.buddyListPanel.tray_icons
  95.             if icons:
  96.                 icon = icons[0][1]
  97.                 icon.ShowBalloon(_('Quick Access to Newsfeeds'), _('\nYou can access social network and email newsfeeds by clicking their icons in the tray.\n\nDouble click to update your status (social networks) or launch your inbox (email accounts).\n \n'), 0, wx.ICON_INFORMATION)
  98.             
  99.  
  100.         wx.CallLater(300, show_hint)
  101.         if getattr(self, 'exithooks', None) is not None:
  102.             self.exithooks()
  103.         
  104.         e.Skip(True)
  105.  
  106.  
  107.  
  108. def set_font(ctrl, size, bold = False, underline = False):
  109.     f = ctrl.Font
  110.     if is_vista():
  111.         f.SetFaceName('Segoe UI')
  112.     
  113.     f.PointSize = size
  114.     if bold:
  115.         f.Weight = wx.FONTWEIGHT_BOLD
  116.     
  117.     if underline:
  118.         f.SetUnderlined(True)
  119.     
  120.     ctrl.Font = f
  121.  
  122.