home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyo (Python 2.6)
-
- from __future__ import with_statement
-
- def EditSource(self):
- import wx
- soupify = soupify
- import util
- StyledTextCtrl = StyledTextCtrl
- STC_LEX_HTML = STC_LEX_HTML
- import wx.stc
- font = wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, 'Consolas')
- f = wx.Frame(wx.GetTopLevelParent(self), -1, 'View Source', name = 'View Source', size = (640, 480))
- s = wx.BoxSizer(wx.VERTICAL)
- t = StyledTextCtrl(f, -1, wx.DefaultPosition, wx.DefaultSize, wx.NO_BORDER)
- orightml = self.HTML
- html = soupify(orightml).prettify()
- t.SetText(html)
- wx.CallAfter(t.SetSelection, 0, 0)
- buttons = wx.Panel(f)
- save = wx.Button(buttons, -1, '&Save')
- None((save.Bind, wx.EVT_BUTTON), (lambda e: self.SetHTML(t.GetText())))
- save_as_file = wx.Button(buttons, -1, 'Save &As File...')
-
- def onsaveasfile(e):
- diag = wx.FileDialog(self, 'Save HTML', 'contents.html', style = wx.SAVE)
-
- save_as_file.Bind(wx.EVT_BUTTON, onsaveasfile)
- copybutton = wx.Button(buttons, -1, _('&Copy'))
-
- def openinbrowser(e):
- Popen = Popen
- import subprocess
- import os.path as os
- import tempfile
- (fdesc, fname) = tempfile.mkstemp()
-
- try:
- f = _[1]
- f.write(t.GetText().encode('utf-8'))
- finally:
- pass
-
-
- openbutton = wx.Button(buttons, -1, _('&Open in Browser'))
- openbutton.Bind(wx.EVT_BUTTON, openinbrowser)
- openbutton.SetToolTipString(_('Launches browser in pref "debug.message_area.debug_browser"'))
-
- def docopy(e):
- clip = wx.TheClipboard
- if clip.Open():
- clip.SetData(wx.TextDataObject(t.Value))
- clip.Close()
-
-
- copybutton.Bind(wx.EVT_BUTTON, docopy)
- buttons.Sizer = wx.BoxSizer(wx.HORIZONTAL)
- buttons.Sizer.AddMany([
- save,
- copybutton,
- openbutton,
- save_as_file])
- s.Add(t, 1, wx.EXPAND)
- s.Add(buttons, 0, wx.EXPAND)
- f.SetSizer(s)
- persist_window_pos = persist_window_pos
- import gui.toolbox
- persist_window_pos(f)
- f.EnsureNotStacked()
- f.Show()
-
-