home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2012 January / maximum-cd-2012-01.iso / DiscContents / digsby_setup.exe / lib / gui / browser / webkit / webkiteditsource.pyo (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2011-10-05  |  4.0 KB  |  73 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.6)
  3.  
  4. from __future__ import with_statement
  5.  
  6. def EditSource(self):
  7.     import wx
  8.     soupify = soupify
  9.     import util
  10.     StyledTextCtrl = StyledTextCtrl
  11.     STC_LEX_HTML = STC_LEX_HTML
  12.     import wx.stc
  13.     font = wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, 'Consolas')
  14.     f = wx.Frame(wx.GetTopLevelParent(self), -1, 'View Source', name = 'View Source', size = (640, 480))
  15.     s = wx.BoxSizer(wx.VERTICAL)
  16.     t = StyledTextCtrl(f, -1, wx.DefaultPosition, wx.DefaultSize, wx.NO_BORDER)
  17.     orightml = self.HTML
  18.     html = soupify(orightml).prettify()
  19.     t.SetText(html)
  20.     wx.CallAfter(t.SetSelection, 0, 0)
  21.     buttons = wx.Panel(f)
  22.     save = wx.Button(buttons, -1, '&Save')
  23.     None((save.Bind, wx.EVT_BUTTON), (lambda e: self.SetHTML(t.GetText())))
  24.     save_as_file = wx.Button(buttons, -1, 'Save &As File...')
  25.     
  26.     def onsaveasfile(e):
  27.         diag = wx.FileDialog(self, 'Save HTML', 'contents.html', style = wx.SAVE)
  28.  
  29.     save_as_file.Bind(wx.EVT_BUTTON, onsaveasfile)
  30.     copybutton = wx.Button(buttons, -1, _('&Copy'))
  31.     
  32.     def openinbrowser(e):
  33.         Popen = Popen
  34.         import subprocess
  35.         import os.path as os
  36.         import tempfile
  37.         (fdesc, fname) = tempfile.mkstemp()
  38.         
  39.         try:
  40.             f = _[1]
  41.             f.write(t.GetText().encode('utf-8'))
  42.         finally:
  43.             pass
  44.  
  45.  
  46.     openbutton = wx.Button(buttons, -1, _('&Open in Browser'))
  47.     openbutton.Bind(wx.EVT_BUTTON, openinbrowser)
  48.     openbutton.SetToolTipString(_('Launches browser in pref "debug.message_area.debug_browser"'))
  49.     
  50.     def docopy(e):
  51.         clip = wx.TheClipboard
  52.         if clip.Open():
  53.             clip.SetData(wx.TextDataObject(t.Value))
  54.             clip.Close()
  55.         
  56.  
  57.     copybutton.Bind(wx.EVT_BUTTON, docopy)
  58.     buttons.Sizer = wx.BoxSizer(wx.HORIZONTAL)
  59.     buttons.Sizer.AddMany([
  60.         save,
  61.         copybutton,
  62.         openbutton,
  63.         save_as_file])
  64.     s.Add(t, 1, wx.EXPAND)
  65.     s.Add(buttons, 0, wx.EXPAND)
  66.     f.SetSizer(s)
  67.     persist_window_pos = persist_window_pos
  68.     import gui.toolbox
  69.     persist_window_pos(f)
  70.     f.EnsureNotStacked()
  71.     f.Show()
  72.  
  73.