diff --git a/wxPython/wxPython/py/CHANGES.txt b/wxPython/wxPython/py/CHANGES.txt index 0252ab31f3..d8e7676f59 100644 --- a/wxPython/wxPython/py/CHANGES.txt +++ b/wxPython/wxPython/py/CHANGES.txt @@ -2,7 +2,7 @@ 0.9.2 (5/3/2003 to //2003) ----------------------------- -Changed to new "wx" package:: +Changed to the new prefix-less "wx" package:: import wx @@ -10,6 +10,15 @@ instead of:: from wxPython import wx +Fixed typo in ``PyWrap.py``:: + + if __name__ == '__main__': + main(sys.argv) + +should have been:: + + if __name__ == '__main__': + main() 0.9.1 (3/21/2003 to 5/2/2003) diff --git a/wxPython/wxPython/py/PyAlaCarte.py b/wxPython/wxPython/py/PyAlaCarte.py index 578ba12247..0f71bd447b 100755 --- a/wxPython/wxPython/py/PyAlaCarte.py +++ b/wxPython/wxPython/py/PyAlaCarte.py @@ -4,7 +4,7 @@ __author__ = "Patrick K. O'Brien " __cvsid__ = "$Id$" __revision__ = "$Revision$"[11:-2] -from wxPython import wx +import wx import os import sys @@ -17,15 +17,15 @@ except NameError: True = 1==1 False = 1==0 -class App(wx.wxApp): +class App(wx.App): """PyAlaCarte standalone application.""" def __init__(self, filename=None): self.filename = filename - wx.wxApp.__init__(self, redirect=False) + wx.App.__init__(self, redirect=False) def OnInit(self): - wx.wxInitAllImageHandlers() + wx.InitAllImageHandlers() self.frame = editor.EditorFrame(filename=self.filename) self.frame.Show() self.SetTopWindow(self.frame) diff --git a/wxPython/wxPython/py/PyAlaMode.py b/wxPython/wxPython/py/PyAlaMode.py index 24eaccedf4..d33243a36a 100755 --- a/wxPython/wxPython/py/PyAlaMode.py +++ b/wxPython/wxPython/py/PyAlaMode.py @@ -4,7 +4,7 @@ __author__ = "Patrick K. O'Brien " __cvsid__ = "$Id$" __revision__ = "$Revision$"[11:-2] -from wxPython import wx +import wx import os import sys @@ -17,15 +17,15 @@ except NameError: True = 1==1 False = 1==0 -class App(wx.wxApp): +class App(wx.App): """PyAlaMode standalone application.""" def __init__(self, filename=None): self.filename = filename - wx.wxApp.__init__(self, redirect=False) + wx.App.__init__(self, redirect=False) def OnInit(self): - wx.wxInitAllImageHandlers() + wx.InitAllImageHandlers() self.frame = editor.EditorNotebookFrame(filename=self.filename) self.frame.Show() self.SetTopWindow(self.frame) diff --git a/wxPython/wxPython/py/PyAlaModeTest.py b/wxPython/wxPython/py/PyAlaModeTest.py index d7946436d9..57b52e4524 100755 --- a/wxPython/wxPython/py/PyAlaModeTest.py +++ b/wxPython/wxPython/py/PyAlaModeTest.py @@ -4,7 +4,7 @@ __author__ = "Patrick K. O'Brien " __cvsid__ = "$Id$" __revision__ = "$Revision$"[11:-2] -from wxPython import wx +import wx import os import sys @@ -17,15 +17,15 @@ except NameError: True = 1==1 False = 1==0 -class App(wx.wxApp): +class App(wx.App): """PyAlaModeTest standalone application.""" def __init__(self, filename=None): self.filename = filename - wx.wxApp.__init__(self, redirect=False) + wx.App.__init__(self, redirect=False) def OnInit(self): - wx.wxInitAllImageHandlers() + wx.InitAllImageHandlers() self.frame = editor.EditorShellNotebookFrame(filename=self.filename) self.frame.Show() self.SetTopWindow(self.frame) diff --git a/wxPython/wxPython/py/PyCrust.py b/wxPython/wxPython/py/PyCrust.py index dd6d144c80..c48cb344df 100755 --- a/wxPython/wxPython/py/PyCrust.py +++ b/wxPython/wxPython/py/PyCrust.py @@ -11,7 +11,7 @@ __author__ = "Patrick K. O'Brien " __cvsid__ = "$Id$" __revision__ = "$Revision$"[11:-2] -from wxPython import wx +import wx try: True @@ -20,12 +20,12 @@ except NameError: False = 1==0 -class App(wx.wxApp): +class App(wx.App): """PyCrust standalone application.""" def OnInit(self): - from wxPython import wx - wx.wxInitAllImageHandlers() + import wx + wx.InitAllImageHandlers() locals = __main__.__dict__ from crust import CrustFrame self.frame = CrustFrame(locals=locals) diff --git a/wxPython/wxPython/py/PyFilling.py b/wxPython/wxPython/py/PyFilling.py index 19047a5a85..5331791f33 100755 --- a/wxPython/wxPython/py/PyFilling.py +++ b/wxPython/wxPython/py/PyFilling.py @@ -15,9 +15,8 @@ import interpreter import introspect import pseudo import shell - import sys -from wxPython import wx +import wx try: True diff --git a/wxPython/wxPython/py/PyShell.py b/wxPython/wxPython/py/PyShell.py index 845a17b977..39f3c103f9 100755 --- a/wxPython/wxPython/py/PyShell.py +++ b/wxPython/wxPython/py/PyShell.py @@ -11,7 +11,7 @@ __author__ = "Patrick K. O'Brien " __cvsid__ = "$Id$" __revision__ = "$Revision$"[11:-2] -from wxPython import wx +import wx try: True @@ -20,12 +20,12 @@ except NameError: False = 1==0 -class App(wx.wxApp): +class App(wx.App): """PyShell standalone application.""" def OnInit(self): - from wxPython import wx - wx.wxInitAllImageHandlers() + import wx + wx.InitAllImageHandlers() locals = __main__.__dict__ from shell import ShellFrame self.frame = ShellFrame(locals=locals) diff --git a/wxPython/wxPython/py/PyWrap.py b/wxPython/wxPython/py/PyWrap.py index 381bbe97f9..4911be1ae1 100755 --- a/wxPython/wxPython/py/PyWrap.py +++ b/wxPython/wxPython/py/PyWrap.py @@ -7,7 +7,7 @@ __revision__ = "$Revision$"[11:-2] import os import sys -from wxPython import wx +import wx from crust import CrustFrame as Frame try: @@ -18,7 +18,7 @@ except NameError: def wrap(app): - wx.wxInitAllImageHandlers() + wx.InitAllImageHandlers() frame = Frame() frame.SetSize((750, 525)) frame.Show(True) @@ -41,7 +41,7 @@ def main(modulename=None): d = module.__dict__ for item in d.keys(): try: - if issubclass(d[item], wx.wxApp): + if issubclass(d[item], wx.App): App = d[item] except (NameError, TypeError): pass @@ -53,4 +53,4 @@ def main(modulename=None): if __name__ == '__main__': - main(sys.argv) + main() diff --git a/wxPython/wxPython/py/crust.py b/wxPython/wxPython/py/crust.py index b06e6b6984..91454843e9 100644 --- a/wxPython/wxPython/py/crust.py +++ b/wxPython/wxPython/py/crust.py @@ -1,10 +1,10 @@ -"""PyCrust Crust combines the shell and filling into one control.""" +"""Crust combines the shell and filling into one control.""" __author__ = "Patrick K. O'Brien " __cvsid__ = "$Id$" __revision__ = "$Revision$"[11:-2] -from wxPython import wx +import wx import os import sys @@ -22,26 +22,26 @@ except NameError: False = 1==0 -class Crust(wx.wxSplitterWindow): - """PyCrust Crust based on wxSplitterWindow.""" +class Crust(wx.SplitterWindow): + """Crust based on SplitterWindow.""" - name = 'PyCrust Crust' + name = 'Crust' revision = __revision__ - def __init__(self, parent, id=-1, pos=wx.wxDefaultPosition, - size=wx.wxDefaultSize, style=wx.wxSP_3D, + def __init__(self, parent, id=-1, pos=wx.DefaultPosition, + size=wx.DefaultSize, style=wx.SP_3D, name='Crust Window', rootObject=None, rootLabel=None, rootIsNamespace=True, intro='', locals=None, InterpClass=None, *args, **kwds): - """Create a PyCrust Crust instance.""" - wx.wxSplitterWindow.__init__(self, parent, id, pos, size, style, name) + """Create Crust instance.""" + wx.SplitterWindow.__init__(self, parent, id, pos, size, style, name) self.shell = Shell(parent=self, introText=intro, locals=locals, InterpClass=InterpClass, *args, **kwds) self.editor = self.shell if rootObject is None: rootObject = self.shell.interp.locals - self.notebook = wx.wxNotebook(parent=self, id=-1) + self.notebook = wx.Notebook(parent=self, id=-1) self.shell.interp.locals['notebook'] = self.notebook self.filling = Filling(parent=self.notebook, rootObject=rootObject, @@ -74,13 +74,13 @@ class Crust(wx.wxSplitterWindow): self.SetMinimumPaneSize(1) -class Calltip(wx.wxTextCtrl): +class Calltip(wx.TextCtrl): """Text control containing the most recent shell calltip.""" def __init__(self, parent=None, id=-1): - style = wx.wxTE_MULTILINE | wx.wxTE_READONLY | wx.wxTE_RICH2 - wx.wxTextCtrl.__init__(self, parent=parent, id=id, style=style) - self.SetBackgroundColour(wx.wxColour(255, 255, 232)) + style = wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH2 + wx.TextCtrl.__init__(self, parent=parent, id=id, style=style) + self.SetBackgroundColour(wx.Colour(255, 255, 232)) dispatcher.connect(receiver=self.display, signal='Shell.calltip') def display(self, calltip): @@ -88,13 +88,13 @@ class Calltip(wx.wxTextCtrl): self.SetValue(calltip) -class SessionListing(wx.wxTextCtrl): +class SessionListing(wx.TextCtrl): """Text control containing all commands for session.""" def __init__(self, parent=None, id=-1): - style = wx.wxTE_MULTILINE | wx.wxTE_READONLY | \ - wx.wxTE_RICH2 | wx.wxTE_DONTWRAP - wx.wxTextCtrl.__init__(self, parent=parent, id=id, style=style) + style = wx.TE_MULTILINE | wx.TE_READONLY | \ + wx.TE_RICH2 | wx.TE_DONTWRAP + wx.TextCtrl.__init__(self, parent=parent, id=id, style=style) dispatcher.connect(receiver=self.push, signal='Interpreter.push') def push(self, command, more): @@ -107,13 +107,13 @@ class SessionListing(wx.wxTextCtrl): self.AppendText(command + '\n') -class DispatcherListing(wx.wxTextCtrl): +class DispatcherListing(wx.TextCtrl): """Text control containing all dispatches for session.""" def __init__(self, parent=None, id=-1): - style = wx.wxTE_MULTILINE | wx.wxTE_READONLY | \ - wx.wxTE_RICH2 | wx.wxTE_DONTWRAP - wx.wxTextCtrl.__init__(self, parent=parent, id=id, style=style) + style = wx.TE_MULTILINE | wx.TE_READONLY | \ + wx.TE_RICH2 | wx.TE_DONTWRAP + wx.TextCtrl.__init__(self, parent=parent, id=id, style=style) dispatcher.connect(receiver=self.spy) def spy(self, signal, sender): @@ -129,15 +129,15 @@ class DispatcherListing(wx.wxTextCtrl): class CrustFrame(frame.Frame): """Frame containing all the PyCrust components.""" - name = 'PyCrust Frame' + name = 'CrustFrame' revision = __revision__ def __init__(self, parent=None, id=-1, title='PyCrust', - pos=wx.wxDefaultPosition, size=wx.wxDefaultSize, - style=wx.wxDEFAULT_FRAME_STYLE, + pos=wx.DefaultPosition, size=wx.DefaultSize, + style=wx.DEFAULT_FRAME_STYLE, rootObject=None, rootLabel=None, rootIsNamespace=True, locals=None, InterpClass=None, *args, **kwds): - """Create a PyCrust CrustFrame instance.""" + """Create CrustFrame instance.""" frame.Frame.__init__(self, parent, id, title, pos, size, style) intro = 'PyCrust %s - The Flakiest Python Shell' % VERSION intro += '\nSponsored by Orbtech - ' @@ -176,7 +176,7 @@ class CrustFrame(frame.Frame): 'Python Version: %s\n' % sys.version.split()[0] + \ 'wxPython Version: %s\n' % wx.__version__ + \ 'Platform: %s\n' % sys.platform - dialog = wx.wxMessageDialog(self, text, title, - wx.wxOK | wx.wxICON_INFORMATION) + dialog = wx.MessageDialog(self, text, title, + wx.OK | wx.ICON_INFORMATION) dialog.ShowModal() dialog.Destroy() diff --git a/wxPython/wxPython/py/editor.py b/wxPython/wxPython/py/editor.py index 7114faf97d..72b356f31e 100644 --- a/wxPython/wxPython/py/editor.py +++ b/wxPython/wxPython/py/editor.py @@ -4,7 +4,7 @@ __author__ = "Patrick K. O'Brien " __cvsid__ = "$Id$" __revision__ = "$Revision$"[11:-2] -from wxPython import wx +import wx from buffer import Buffer import crust @@ -25,8 +25,8 @@ class EditorFrame(frame.Frame): """Frame containing one editor.""" def __init__(self, parent=None, id=-1, title='PyAlaCarte', - pos=wx.wxDefaultPosition, size=(800, 600), - style=wx.wxDEFAULT_FRAME_STYLE, filename=None): + pos=wx.DefaultPosition, size=(800, 600), + style=wx.DEFAULT_FRAME_STYLE, filename=None): """Create EditorFrame instance.""" frame.Frame.__init__(self, parent, id, title, pos, size, style) self.buffers = {} @@ -55,8 +55,8 @@ class EditorFrame(frame.Frame): """Display an About window.""" title = 'About PyAlaCarte' text = 'Another fine, flaky program.' - dialog = wx.wxMessageDialog(self, text, title, - wx.wxOK | wx.wxICON_INFORMATION) + dialog = wx.MessageDialog(self, text, title, + wx.OK | wx.ICON_INFORMATION) dialog.ShowModal() dialog.Destroy() @@ -141,11 +141,11 @@ class EditorFrame(frame.Frame): """Create new buffer.""" self.bufferDestroy() buffer = Buffer() - self.panel = panel = wx.wxPanel(parent=self, id=-1) + self.panel = panel = wx.Panel(parent=self, id=-1) editor = Editor(parent=panel) panel.editor = editor - sizer = wx.wxBoxSizer(wx.wxVERTICAL) - sizer.Add(editor.window, 1, wx.wxEXPAND) + sizer = wx.BoxSizer(wx.VERTICAL) + sizer.Add(editor.window, 1, wx.EXPAND) panel.SetSizer(sizer) panel.SetAutoLayout(True) sizer.Layout() @@ -255,8 +255,8 @@ class EditorNotebookFrame(EditorFrame): """Frame containing one or more editors in a notebook.""" def __init__(self, parent=None, id=-1, title='PyAlaMode', - pos=wx.wxDefaultPosition, size=(800, 600), - style=wx.wxDEFAULT_FRAME_STYLE, filename=None): + pos=wx.DefaultPosition, size=(800, 600), + style=wx.DEFAULT_FRAME_STYLE, filename=None): """Create EditorNotebookFrame instance.""" self.notebook = None EditorFrame.__init__(self, parent, id, title, pos, @@ -270,7 +270,7 @@ class EditorNotebookFrame(EditorFrame): Called automatically by base class during init.""" self.notebook = EditorNotebook(parent=self) - intro = 'PyCrust %s' % version.VERSION + intro = 'Py %s' % version.VERSION import imp module = imp.new_module('__main__') import __builtin__ @@ -284,7 +284,7 @@ class EditorNotebookFrame(EditorFrame): self.shell.setStatusText = self.SetStatusText # Fix a problem with the sash shrinking to nothing. self.crust.filling.SetSashPosition(200) - self.notebook.AddPage(page=self.crust, text='PyCrust', select=True) + self.notebook.AddPage(page=self.crust, text='*Shell*', select=True) self.setEditor(self.crust.editor) self.crust.editor.SetFocus() @@ -296,8 +296,8 @@ class EditorNotebookFrame(EditorFrame): """Display an About window.""" title = 'About PyAlaMode' text = 'Another fine, flaky program.' - dialog = wx.wxMessageDialog(self, text, title, - wx.wxOK | wx.wxICON_INFORMATION) + dialog = wx.MessageDialog(self, text, title, + wx.OK | wx.ICON_INFORMATION) dialog.ShowModal() dialog.Destroy() @@ -317,11 +317,11 @@ class EditorNotebookFrame(EditorFrame): def bufferCreate(self, filename=None): """Create new buffer.""" buffer = Buffer() - panel = wx.wxPanel(parent=self.notebook, id=-1) + panel = wx.Panel(parent=self.notebook, id=-1) editor = Editor(parent=panel) panel.editor = editor - sizer = wx.wxBoxSizer(wx.wxVERTICAL) - sizer.Add(editor.window, 1, wx.wxEXPAND) + sizer = wx.BoxSizer(wx.VERTICAL) + sizer.Add(editor.window, 1, wx.EXPAND) panel.SetSizer(sizer) panel.SetAutoLayout(True) sizer.Layout() @@ -359,12 +359,12 @@ class EditorNotebookFrame(EditorFrame): return cancel -class EditorNotebook(wx.wxNotebook): +class EditorNotebook(wx.Notebook): """A notebook containing a page for each editor.""" def __init__(self, parent): """Create EditorNotebook instance.""" - wx.wxNotebook.__init__(self, parent, id=-1) + wx.Notebook.__init__(self, parent, id=-1) wx.EVT_NOTEBOOK_PAGE_CHANGING(self, self.GetId(), self.OnPageChanging) wx.EVT_NOTEBOOK_PAGE_CHANGED(self, self.GetId(), @@ -430,8 +430,8 @@ class EditorShellNotebookFrame(EditorNotebookFrame): """Frame containing a notebook containing EditorShellNotebooks.""" def __init__(self, parent=None, id=-1, title='PyAlaModeTest', - pos=wx.wxDefaultPosition, size=(600, 400), - style=wx.wxDEFAULT_FRAME_STYLE, + pos=wx.DefaultPosition, size=(600, 400), + style=wx.DEFAULT_FRAME_STYLE, filename=None, singlefile=False): """Create EditorShellNotebookFrame instance.""" self._singlefile = singlefile @@ -449,8 +449,8 @@ class EditorShellNotebookFrame(EditorNotebookFrame): """Display an About window.""" title = 'About PyAlaModePlus' text = 'Another fine, flaky program.' - dialog = wx.wxMessageDialog(self, text, title, - wx.wxOK | wx.wxICON_INFORMATION) + dialog = wx.MessageDialog(self, text, title, + wx.OK | wx.ICON_INFORMATION) dialog.ShowModal() dialog.Destroy() @@ -515,16 +515,16 @@ class EditorShellNotebookFrame(EditorNotebookFrame): return cancel -class EditorShellNotebook(wx.wxNotebook): +class EditorShellNotebook(wx.Notebook): """A notebook containing an editor page and a shell page.""" def __init__(self, parent, filename=None): """Create EditorShellNotebook instance.""" - wx.wxNotebook.__init__(self, parent, id=-1) + wx.Notebook.__init__(self, parent, id=-1) usePanels = True if usePanels: - editorparent = editorpanel = wx.wxPanel(self, -1) - shellparent = shellpanel = wx.wxPanel(self, -1) + editorparent = editorpanel = wx.Panel(self, -1) + shellparent = shellpanel = wx.Panel(self, -1) else: editorparent = self shellparent = self @@ -533,18 +533,18 @@ class EditorShellNotebook(wx.wxNotebook): self.buffer.addEditor(self.editor) self.buffer.open(filename) self.shell = Shell(parent=shellparent, locals=self.buffer.interp.locals, - style=wx.wxCLIP_CHILDREN | wx.wxSUNKEN_BORDER) + style=wx.CLIP_CHILDREN | wx.SUNKEN_BORDER) self.buffer.interp.locals.clear() if usePanels: self.AddPage(page=editorpanel, text='Editor', select=True) self.AddPage(page=shellpanel, text='Shell') # Setup sizers - editorsizer = wx.wxBoxSizer(wx.wxVERTICAL) - editorsizer.Add(self.editor.window, 1, wx.wxEXPAND) + editorsizer = wx.BoxSizer(wx.VERTICAL) + editorsizer.Add(self.editor.window, 1, wx.EXPAND) editorpanel.SetSizer(editorsizer) editorpanel.SetAutoLayout(True) - shellsizer = wx.wxBoxSizer(wx.wxVERTICAL) - shellsizer.Add(self.shell, 1, wx.wxEXPAND) + shellsizer = wx.BoxSizer(wx.VERTICAL) + shellsizer.Add(self.shell, 1, wx.EXPAND) shellpanel.SetSizer(shellsizer) shellpanel.SetAutoLayout(True) else: @@ -563,7 +563,7 @@ class EditorShellNotebook(wx.wxNotebook): event.Skip() def SetFocus(self): - wx.wxNotebook.SetFocus(self) + wx.Notebook.SetFocus(self) selection = self.GetSelection() if selection == 0: self.editor.setFocus() @@ -574,9 +574,9 @@ class EditorShellNotebook(wx.wxNotebook): class Editor: """Editor having an EditWindow.""" - def __init__(self, parent, id=-1, pos=wx.wxDefaultPosition, - size=wx.wxDefaultSize, - style=wx.wxCLIP_CHILDREN | wx.wxSUNKEN_BORDER): + def __init__(self, parent, id=-1, pos=wx.DefaultPosition, + size=wx.DefaultSize, + style=wx.CLIP_CHILDREN | wx.SUNKEN_BORDER): """Create Editor instance.""" self.window = EditWindow(self, parent, id, pos, size, style) self.id = self.window.GetId() @@ -732,9 +732,9 @@ class Editor: class EditWindow(editwindow.EditWindow): """EditWindow based on StyledTextCtrl.""" - def __init__(self, editor, parent, id=-1, pos=wx.wxDefaultPosition, - size=wx.wxDefaultSize, - style=wx.wxCLIP_CHILDREN | wx.wxSUNKEN_BORDER): + def __init__(self, editor, parent, id=-1, pos=wx.DefaultPosition, + size=wx.DefaultSize, + style=wx.CLIP_CHILDREN | wx.SUNKEN_BORDER): """Create EditWindow instance.""" editwindow.EditWindow.__init__(self, parent, id, pos, size, style) self.editor = editor @@ -746,7 +746,7 @@ class DialogResults: def __init__(self, returned): """Create wrapper for results returned by dialog.""" self.returned = returned - self.positive = returned in (wx.wxID_OK, wx.wxID_YES) + self.positive = returned in (wx.ID_OK, wx.ID_YES) self.text = self._asString() @@ -755,22 +755,22 @@ class DialogResults: def _asString(self): returned = self.returned - if returned == wx.wxID_OK: + if returned == wx.ID_OK: return "Ok" - elif returned == wx.wxID_CANCEL: + elif returned == wx.ID_CANCEL: return "Cancel" - elif returned == wx.wxID_YES: + elif returned == wx.ID_YES: return "Yes" - elif returned == wx.wxID_NO: + elif returned == wx.ID_NO: return "No" def fileDialog(parent=None, title='Open', directory='', filename='', wildcard='All Files (*.*)|*.*', - style=wx.wxOPEN | wx.wxMULTIPLE): + style=wx.OPEN | wx.MULTIPLE): """File dialog wrapper function.""" - dialog = wx.wxFileDialog(parent, title, directory, filename, - wildcard, style) + dialog = wx.FileDialog(parent, title, directory, filename, + wildcard, style) result = DialogResults(dialog.ShowModal()) if result.positive: result.paths = dialog.GetPaths() @@ -781,10 +781,10 @@ def fileDialog(parent=None, title='Open', directory='', filename='', def openSingle(parent=None, title='Open', directory='', filename='', - wildcard='All Files (*.*)|*.*', style=wx.wxOPEN): + wildcard='All Files (*.*)|*.*', style=wx.OPEN): """File dialog wrapper function.""" - dialog = wx.wxFileDialog(parent, title, directory, filename, - wildcard, style) + dialog = wx.FileDialog(parent, title, directory, filename, + wildcard, style) result = DialogResults(dialog.ShowModal()) if result.positive: result.path = dialog.GetPath() @@ -796,17 +796,17 @@ def openSingle(parent=None, title='Open', directory='', filename='', def openMultiple(parent=None, title='Open', directory='', filename='', wildcard='All Files (*.*)|*.*', - style=wx.wxOPEN | wx.wxMULTIPLE): + style=wx.OPEN | wx.MULTIPLE): """File dialog wrapper function.""" return fileDialog(parent, title, directory, filename, wildcard, style) def saveSingle(parent=None, title='Save', directory='', filename='', wildcard='All Files (*.*)|*.*', - style=wx.wxSAVE | wx.wxHIDE_READONLY | wx.wxOVERWRITE_PROMPT): + style=wx.SAVE | wx.HIDE_READONLY | wx.OVERWRITE_PROMPT): """File dialog wrapper function.""" - dialog = wx.wxFileDialog(parent, title, directory, filename, - wildcard, style) + dialog = wx.FileDialog(parent, title, directory, filename, + wildcard, style) result = DialogResults(dialog.ShowModal()) if result.positive: result.path = dialog.GetPath() @@ -817,9 +817,9 @@ def saveSingle(parent=None, title='Save', directory='', filename='', def directory(parent=None, message='Choose a directory', path='', style=0, - pos=wx.wxDefaultPosition, size=wx.wxDefaultSize): + pos=wx.DefaultPosition, size=wx.DefaultSize): """Dir dialog wrapper function.""" - dialog = wx.wxDirDialog(parent, message, path, style, pos, size) + dialog = wx.DirDialog(parent, message, path, style, pos, size) result = DialogResults(dialog.ShowModal()) if result.positive: result.path = dialog.GetPath() @@ -830,10 +830,10 @@ def directory(parent=None, message='Choose a directory', path='', style=0, def messageDialog(parent=None, message='', title='Message box', - style=wx.wxYES_NO | wx.wxCANCEL | wx.wxCENTRE | wx.wxICON_QUESTION, - pos=wx.wxDefaultPosition): + style=wx.YES_NO | wx.CANCEL | wx.CENTRE | wx.ICON_QUESTION, + pos=wx.DefaultPosition): """Message dialog wrapper function.""" - dialog = wx.wxMessageDialog(parent, message, title, style, pos) + dialog = wx.MessageDialog(parent, message, title, style, pos) result = DialogResults(dialog.ShowModal()) dialog.Destroy() return result diff --git a/wxPython/wxPython/py/editwindow.py b/wxPython/wxPython/py/editwindow.py index 1427ec00d7..7e7c4bc8fe 100644 --- a/wxPython/wxPython/py/editwindow.py +++ b/wxPython/wxPython/py/editwindow.py @@ -4,8 +4,8 @@ __author__ = "Patrick K. O'Brien " __cvsid__ = "$Id$" __revision__ = "$Revision$"[11:-2] -from wxPython import wx -from wxPython import stc +import wx +from wx import stc import keyword import os @@ -21,7 +21,7 @@ except NameError: True = 1==1 False = 1==0 -if wx.wxPlatform == '__WXMSW__': +if wx.Platform == '__WXMSW__': FACES = { 'times' : 'Times New Roman', 'mono' : 'Courier New', 'helv' : 'Lucida Console', @@ -42,15 +42,15 @@ else: # GTK } -class EditWindow(stc.wxStyledTextCtrl): +class EditWindow(stc.StyledTextCtrl): """EditWindow based on StyledTextCtrl.""" revision = __revision__ - def __init__(self, parent, id=-1, pos=wx.wxDefaultPosition, - size=wx.wxDefaultSize, style=wx.wxCLIP_CHILDREN | wx.wxSUNKEN_BORDER): + def __init__(self, parent, id=-1, pos=wx.DefaultPosition, + size=wx.DefaultSize, style=wx.CLIP_CHILDREN | wx.SUNKEN_BORDER): """Create EditWindow instance.""" - stc.wxStyledTextCtrl.__init__(self, parent, id, pos, size, style) + stc.StyledTextCtrl.__init__(self, parent, id, pos, size, style) self.__config() stc.EVT_STC_UPDATEUI(self, id, self.OnUpdateUI) dispatcher.connect(receiver=self._fontsizer, signal='FontIncrease') @@ -70,10 +70,10 @@ class EditWindow(stc.wxStyledTextCtrl): def __config(self): """Configure shell based on user preferences.""" - self.SetMarginType(1, stc.wxSTC_MARGIN_NUMBER) + self.SetMarginType(1, stc.STC_MARGIN_NUMBER) self.SetMarginWidth(1, 40) - self.SetLexer(stc.wxSTC_LEX_PYTHON) + self.SetLexer(stc.STC_LEX_PYTHON) self.SetKeyWords(0, ' '.join(keyword.kwlist)) self.setStyles(FACES) @@ -91,7 +91,7 @@ class EditWindow(stc.wxStyledTextCtrl): self.AutoCompStops(' .,;:([)]}\'"\\<>%^&+-=*/|`') # Do we want to automatically pop up command argument help? self.autoCallTip = True - self.CallTipSetBackground(wx.wxColour(255, 255, 232)) + self.CallTipSetBackground(wx.Colour(255, 255, 232)) self.SetWrapMode(False) try: self.SetEndAtLastLine(False) @@ -102,50 +102,50 @@ class EditWindow(stc.wxStyledTextCtrl): """Configure font size, typeface and color for lexer.""" # Default style - self.StyleSetSpec(stc.wxSTC_STYLE_DEFAULT, + self.StyleSetSpec(stc.STC_STYLE_DEFAULT, "face:%(mono)s,size:%(size)d,back:%(backcol)s" % \ faces) self.StyleClearAll() # Built in styles - self.StyleSetSpec(stc.wxSTC_STYLE_LINENUMBER, + self.StyleSetSpec(stc.STC_STYLE_LINENUMBER, "back:#C0C0C0,face:%(mono)s,size:%(lnsize)d" % faces) - self.StyleSetSpec(stc.wxSTC_STYLE_CONTROLCHAR, + self.StyleSetSpec(stc.STC_STYLE_CONTROLCHAR, "face:%(mono)s" % faces) - self.StyleSetSpec(stc.wxSTC_STYLE_BRACELIGHT, + self.StyleSetSpec(stc.STC_STYLE_BRACELIGHT, "fore:#0000FF,back:#FFFF88") - self.StyleSetSpec(stc.wxSTC_STYLE_BRACEBAD, + self.StyleSetSpec(stc.STC_STYLE_BRACEBAD, "fore:#FF0000,back:#FFFF88") # Python styles - self.StyleSetSpec(stc.wxSTC_P_DEFAULT, + self.StyleSetSpec(stc.STC_P_DEFAULT, "face:%(mono)s" % faces) - self.StyleSetSpec(stc.wxSTC_P_COMMENTLINE, + self.StyleSetSpec(stc.STC_P_COMMENTLINE, "fore:#007F00,face:%(mono)s" % faces) - self.StyleSetSpec(stc.wxSTC_P_NUMBER, + self.StyleSetSpec(stc.STC_P_NUMBER, "") - self.StyleSetSpec(stc.wxSTC_P_STRING, + self.StyleSetSpec(stc.STC_P_STRING, "fore:#7F007F,face:%(mono)s" % faces) - self.StyleSetSpec(stc.wxSTC_P_CHARACTER, + self.StyleSetSpec(stc.STC_P_CHARACTER, "fore:#7F007F,face:%(mono)s" % faces) - self.StyleSetSpec(stc.wxSTC_P_WORD, + self.StyleSetSpec(stc.STC_P_WORD, "fore:#00007F,bold") - self.StyleSetSpec(stc.wxSTC_P_TRIPLE, + self.StyleSetSpec(stc.STC_P_TRIPLE, "fore:#7F0000") - self.StyleSetSpec(stc.wxSTC_P_TRIPLEDOUBLE, + self.StyleSetSpec(stc.STC_P_TRIPLEDOUBLE, "fore:#000033,back:#FFFFE8") - self.StyleSetSpec(stc.wxSTC_P_CLASSNAME, + self.StyleSetSpec(stc.STC_P_CLASSNAME, "fore:#0000FF,bold") - self.StyleSetSpec(stc.wxSTC_P_DEFNAME, + self.StyleSetSpec(stc.STC_P_DEFNAME, "fore:#007F7F,bold") - self.StyleSetSpec(stc.wxSTC_P_OPERATOR, + self.StyleSetSpec(stc.STC_P_OPERATOR, "") - self.StyleSetSpec(stc.wxSTC_P_IDENTIFIER, + self.StyleSetSpec(stc.STC_P_IDENTIFIER, "") - self.StyleSetSpec(stc.wxSTC_P_COMMENTBLOCK, + self.StyleSetSpec(stc.STC_P_COMMENTBLOCK, "fore:#7F7F7F") - self.StyleSetSpec(stc.wxSTC_P_STRINGEOL, + self.StyleSetSpec(stc.STC_P_STRINGEOL, "fore:#000000,face:%(mono)s,back:#E0C0E0,eolfilled" % faces) def OnUpdateUI(self, event): @@ -163,7 +163,7 @@ class EditWindow(stc.wxStyledTextCtrl): # Check before. if charBefore and chr(charBefore) in '[]{}()' \ - and styleBefore == stc.wxSTC_P_OPERATOR: + and styleBefore == stc.STC_P_OPERATOR: braceAtCaret = caretPos - 1 # Check after. @@ -171,7 +171,7 @@ class EditWindow(stc.wxStyledTextCtrl): charAfter = self.GetCharAt(caretPos) styleAfter = self.GetStyleAt(caretPos) if charAfter and chr(charAfter) in '[]{}()' \ - and styleAfter == stc.wxSTC_P_OPERATOR: + and styleAfter == stc.STC_P_OPERATOR: braceAtCaret = caretPos if braceAtCaret >= 0: diff --git a/wxPython/wxPython/py/filling.py b/wxPython/wxPython/py/filling.py index 5eb7949ca9..1cd83355c7 100644 --- a/wxPython/wxPython/py/filling.py +++ b/wxPython/wxPython/py/filling.py @@ -1,11 +1,11 @@ -"""PyCrust Filling is the gui tree control through which a user can -navigate the local namespace or any object.""" +"""Filling is the gui tree control through which a user can navigate +the local namespace or any object.""" __author__ = "Patrick K. O'Brien " __cvsid__ = "$Id$" __revision__ = "$Revision$"[11:-2] -from wxPython import wx +import wx import dispatcher import editwindow @@ -40,18 +40,18 @@ except AttributeError: pass -class FillingTree(wx.wxTreeCtrl): - """PyCrust FillingTree based on wxTreeCtrl.""" +class FillingTree(wx.TreeCtrl): + """FillingTree based on TreeCtrl.""" - name = 'PyCrust Filling Tree' + name = 'Filling Tree' revision = __revision__ - def __init__(self, parent, id=-1, pos=wx.wxDefaultPosition, - size=wx.wxDefaultSize, style=wx.wxTR_DEFAULT_STYLE, + def __init__(self, parent, id=-1, pos=wx.DefaultPosition, + size=wx.DefaultSize, style=wx.TR_DEFAULT_STYLE, rootObject=None, rootLabel=None, rootIsNamespace=False, static=False): - """Create a PyCrust FillingTree instance.""" - wx.wxTreeCtrl.__init__(self, parent, id, pos, size, style) + """Create FillingTree instance.""" + wx.TreeCtrl.__init__(self, parent, id, pos, size, style) self.rootIsNamespace = rootIsNamespace import __main__ if rootObject is None: @@ -61,7 +61,7 @@ class FillingTree(wx.wxTreeCtrl): rootLabel = 'locals()' if not rootLabel: rootLabel = 'Ingredients' - rootData = wx.wxTreeItemData(rootObject) + rootData = wx.TreeItemData(rootObject) self.item = self.root = self.AddRoot(rootLabel, -1, -1, rootData) self.SetItemHasChildren(self.root, self.objHasChildren(rootObject)) wx.EVT_TREE_ITEM_EXPANDING(self, self.GetId(), self.OnItemExpanding) @@ -77,7 +77,7 @@ class FillingTree(wx.wxTreeCtrl): def OnItemExpanding(self, event): """Add children to the item.""" - busy = wx.wxBusyCursor() + busy = wx.BusyCursor() item = event.GetItem() if self.IsExpanded(item): return @@ -86,7 +86,7 @@ class FillingTree(wx.wxTreeCtrl): def OnItemCollapsed(self, event): """Remove all children from the item.""" - busy = wx.wxBusyCursor() + busy = wx.BusyCursor() item = event.GetItem() # self.CollapseAndReset(item) # self.DeleteChildren(item) @@ -94,7 +94,7 @@ class FillingTree(wx.wxTreeCtrl): def OnSelChanged(self, event): """Display information about the item.""" - busy = wx.wxBusyCursor() + busy = wx.BusyCursor() self.item = event.GetItem() self.display() @@ -116,7 +116,7 @@ class FillingTree(wx.wxTreeCtrl): def objGetChildren(self, obj): """Return dictionary with attributes or contents of object.""" - busy = wx.wxBusyCursor() + busy = wx.BusyCursor() otype = type(obj) if otype is types.DictType \ or str(otype)[17:23] == 'BTrees' and hasattr(obj, 'keys'): @@ -156,7 +156,7 @@ class FillingTree(wx.wxTreeCtrl): or (item == self.root and not self.rootIsNamespace)): itemtext = repr(key) child = children[key] - data = wx.wxTreeItemData(child) + data = wx.TreeItemData(child) branch = self.AppendItem(parent=item, text=itemtext, data=data) self.SetItemHasChildren(branch, self.objHasChildren(child)) @@ -166,7 +166,7 @@ class FillingTree(wx.wxTreeCtrl): self.addChildren(item) self.setText('') obj = self.GetPyData(item) - if wx.wxPlatform == '__WXMSW__': + if wx.Platform == '__WXMSW__': if obj is None: # Windows bug fix. return self.SetItemHasChildren(item, self.objHasChildren(obj)) @@ -248,13 +248,13 @@ class FillingTree(wx.wxTreeCtrl): class FillingText(editwindow.EditWindow): """FillingText based on StyledTextCtrl.""" - name = 'PyFilling Text' + name = 'Filling Text' revision = __revision__ - def __init__(self, parent, id=-1, pos=wx.wxDefaultPosition, - size=wx.wxDefaultSize, style=wx.wxCLIP_CHILDREN, + def __init__(self, parent, id=-1, pos=wx.DefaultPosition, + size=wx.DefaultSize, style=wx.CLIP_CHILDREN, static=False): - """Create a FillingText instance.""" + """Create FillingText instance.""" editwindow.EditWindow.__init__(self, parent, id, pos, size, style) # Configure various defaults and user preferences. self.SetReadOnly(True) @@ -273,18 +273,18 @@ class FillingText(editwindow.EditWindow): self.SetReadOnly(True) -class Filling(wx.wxSplitterWindow): +class Filling(wx.SplitterWindow): """Filling based on wxSplitterWindow.""" - name = 'PyFilling' + name = 'Filling' revision = __revision__ - def __init__(self, parent, id=-1, pos=wx.wxDefaultPosition, - size=wx.wxDefaultSize, style=wx.wxSP_3D, + def __init__(self, parent, id=-1, pos=wx.DefaultPosition, + size=wx.DefaultSize, style=wx.SP_3D, name='Filling Window', rootObject=None, rootLabel=None, rootIsNamespace=False, static=False): """Create a Filling instance.""" - wx.wxSplitterWindow.__init__(self, parent, id, pos, size, style, name) + wx.SplitterWindow.__init__(self, parent, id, pos, size, style, name) self.tree = FillingTree(parent=self, rootObject=rootObject, rootLabel=rootLabel, rootIsNamespace=rootIsNamespace, @@ -299,23 +299,23 @@ class Filling(wx.wxSplitterWindow): self.tree.display() -class FillingFrame(wx.wxFrame): +class FillingFrame(wx.Frame): """Frame containing the namespace tree component.""" - name = 'PyFilling Frame' + name = 'Filling Frame' revision = __revision__ def __init__(self, parent=None, id=-1, title='PyFilling', - pos=wx.wxDefaultPosition, size=(600, 400), - style=wx.wxDEFAULT_FRAME_STYLE, rootObject=None, + pos=wx.DefaultPosition, size=(600, 400), + style=wx.DEFAULT_FRAME_STYLE, rootObject=None, rootLabel=None, rootIsNamespace=False, static=False): - """Create a FillingFrame instance.""" - wx.wxFrame.__init__(self, parent, id, title, pos, size, style) + """Create FillingFrame instance.""" + wx.Frame.__init__(self, parent, id, title, pos, size, style) intro = 'PyFilling - The Tastiest Namespace Inspector' self.CreateStatusBar() self.SetStatusText(intro) import images - self.SetIcon(images.getPyCrustIcon()) + self.SetIcon(images.getPyIcon()) self.filling = Filling(parent=self, rootObject=rootObject, rootLabel=rootLabel, rootIsNamespace=rootIsNamespace, @@ -324,11 +324,11 @@ class FillingFrame(wx.wxFrame): self.filling.tree.setStatusText = self.SetStatusText -class App(wx.wxApp): +class App(wx.App): """PyFilling standalone application.""" def OnInit(self): - wx.wxInitAllImageHandlers() + wx.InitAllImageHandlers() self.fillingFrame = FillingFrame() self.fillingFrame.Show(True) self.SetTopWindow(self.fillingFrame) diff --git a/wxPython/wxPython/py/frame.py b/wxPython/wxPython/py/frame.py index 2291004fd0..74b85b34fd 100644 --- a/wxPython/wxPython/py/frame.py +++ b/wxPython/wxPython/py/frame.py @@ -4,7 +4,7 @@ __author__ = "Patrick K. O'Brien " __cvsid__ = "$Id$" __revision__ = "$Revision$"[11:-2] -from wxPython import wx +import wx from version import VERSION try: @@ -13,49 +13,49 @@ except NameError: True = 1==1 False = 1==0 -ID_NEW = wx.wxID_NEW -ID_OPEN = wx.wxID_OPEN -ID_REVERT = wx.wxID_REVERT -ID_CLOSE = wx.wxID_CLOSE -ID_SAVE = wx.wxID_SAVE -ID_SAVEAS = wx.wxID_SAVEAS -ID_PRINT = wx.wxID_PRINT -ID_EXIT = wx.wxID_EXIT -ID_UNDO = wx.wxID_UNDO -ID_REDO = wx.wxID_REDO -ID_CUT = wx.wxID_CUT -ID_COPY = wx.wxID_COPY -ID_PASTE = wx.wxID_PASTE -ID_CLEAR = wx.wxID_CLEAR -ID_SELECTALL = wx.wxID_SELECTALL -ID_ABOUT = wx.wxID_ABOUT -ID_AUTOCOMP = wx.wxNewId() -ID_AUTOCOMP_SHOW = wx.wxNewId() -ID_AUTOCOMP_MAGIC = wx.wxNewId() -ID_AUTOCOMP_SINGLE = wx.wxNewId() -ID_AUTOCOMP_DOUBLE = wx.wxNewId() -ID_CALLTIPS = wx.wxNewId() -ID_CALLTIPS_SHOW = wx.wxNewId() -ID_COPY_PLUS = wx.wxNewId() -ID_NAMESPACE = wx.wxNewId() -ID_PASTE_PLUS = wx.wxNewId() -ID_WRAP = wx.wxNewId() +ID_NEW = wx.ID_NEW +ID_OPEN = wx.ID_OPEN +ID_REVERT = wx.ID_REVERT +ID_CLOSE = wx.ID_CLOSE +ID_SAVE = wx.ID_SAVE +ID_SAVEAS = wx.ID_SAVEAS +ID_PRINT = wx.ID_PRINT +ID_EXIT = wx.ID_EXIT +ID_UNDO = wx.ID_UNDO +ID_REDO = wx.ID_REDO +ID_CUT = wx.ID_CUT +ID_COPY = wx.ID_COPY +ID_PASTE = wx.ID_PASTE +ID_CLEAR = wx.ID_CLEAR +ID_SELECTALL = wx.ID_SELECTALL +ID_ABOUT = wx.ID_ABOUT +ID_AUTOCOMP = wx.NewId() +ID_AUTOCOMP_SHOW = wx.NewId() +ID_AUTOCOMP_MAGIC = wx.NewId() +ID_AUTOCOMP_SINGLE = wx.NewId() +ID_AUTOCOMP_DOUBLE = wx.NewId() +ID_CALLTIPS = wx.NewId() +ID_CALLTIPS_SHOW = wx.NewId() +ID_COPY_PLUS = wx.NewId() +ID_NAMESPACE = wx.NewId() +ID_PASTE_PLUS = wx.NewId() +ID_WRAP = wx.NewId() -class Frame(wx.wxFrame): +class Frame(wx.Frame): """Frame with standard menu items.""" revision = __revision__ def __init__(self, parent=None, id=-1, title='Editor', - pos=wx.wxDefaultPosition, size=wx.wxDefaultSize, - style=wx.wxDEFAULT_FRAME_STYLE): + pos=wx.DefaultPosition, size=wx.DefaultSize, + style=wx.DEFAULT_FRAME_STYLE): """Create a Frame instance.""" - wx.wxFrame.__init__(self, parent, id, title, pos, size, style) + wx.Frame.__init__(self, parent, id, title, pos, size, style) self.CreateStatusBar() self.SetStatusText('Frame') import images - self.SetIcon(images.getPyCrustIcon()) + self.SetIcon(images.getPyIcon()) self.__createMenus() wx.EVT_CLOSE(self, self.OnClose) @@ -64,7 +64,7 @@ class Frame(wx.wxFrame): self.Destroy() def __createMenus(self): - m = self.fileMenu = wx.wxMenu() + m = self.fileMenu = wx.Menu() m.Append(ID_NEW, '&New \tCtrl+N', 'New file') m.Append(ID_OPEN, '&Open... \tCtrl+O', @@ -88,7 +88,7 @@ class Frame(wx.wxFrame): m.AppendSeparator() m.Append(ID_EXIT, 'E&xit', 'Exit Program') - m = self.editMenu = wx.wxMenu() + m = self.editMenu = wx.Menu() m.Append(ID_UNDO, '&Undo \tCtrl+Z', 'Undo the last action') m.Append(ID_REDO, '&Redo \tCtrl+Y', @@ -109,7 +109,7 @@ class Frame(wx.wxFrame): m.Append(ID_SELECTALL, 'Select A&ll \tCtrl+A', 'Select all text') - m = self.autocompMenu = wx.wxMenu() + m = self.autocompMenu = wx.Menu() m.Append(ID_AUTOCOMP_SHOW, 'Show Auto Completion', 'Show auto completion list', 1) m.Append(ID_AUTOCOMP_MAGIC, 'Include Magic Attributes', @@ -120,11 +120,11 @@ class Frame(wx.wxFrame): m.Append(ID_AUTOCOMP_DOUBLE, 'Include Double Underscores', 'Include attibutes prefixed by a double underscore', 1) - m = self.calltipsMenu = wx.wxMenu() + m = self.calltipsMenu = wx.Menu() m.Append(ID_CALLTIPS_SHOW, 'Show Call Tips', 'Show call tips with argument signature and docstring', 1) - m = self.optionsMenu = wx.wxMenu() + m = self.optionsMenu = wx.Menu() m.AppendMenu(ID_AUTOCOMP, '&Auto Completion', self.autocompMenu, 'Auto Completion Options') m.AppendMenu(ID_CALLTIPS, '&Call Tips', self.calltipsMenu, @@ -132,11 +132,11 @@ class Frame(wx.wxFrame): m.Append(ID_WRAP, '&Wrap Lines', 'Wrap lines at right edge', 1) - m = self.helpMenu = wx.wxMenu() + m = self.helpMenu = wx.Menu() m.AppendSeparator() m.Append(ID_ABOUT, '&About...', 'About this program') - b = self.menuBar = wx.wxMenuBar() + b = self.menuBar = wx.MenuBar() b.Append(self.fileMenu, '&File') b.Append(self.editMenu, '&Edit') b.Append(self.optionsMenu, '&Options') @@ -221,77 +221,77 @@ class Frame(wx.wxFrame): self.Close(False) def OnUndo(self, event): - win = wx.wxWindow_FindFocus() + win = wx.Window_FindFocus() win.Undo() def OnRedo(self, event): - win = wx.wxWindow_FindFocus() + win = wx.Window_FindFocus() win.Redo() def OnCut(self, event): - win = wx.wxWindow_FindFocus() + win = wx.Window_FindFocus() win.Cut() def OnCopy(self, event): - win = wx.wxWindow_FindFocus() + win = wx.Window_FindFocus() win.Copy() def OnCopyPlus(self, event): - win = wx.wxWindow_FindFocus() + win = wx.Window_FindFocus() win.CopyWithPrompts() def OnPaste(self, event): - win = wx.wxWindow_FindFocus() + win = wx.Window_FindFocus() win.Paste() def OnPastePlus(self, event): - win = wx.wxWindow_FindFocus() + win = wx.Window_FindFocus() win.PasteAndRun() def OnClear(self, event): - win = wx.wxWindow_FindFocus() + win = wx.Window_FindFocus() win.Clear() def OnSelectAll(self, event): - win = wx.wxWindow_FindFocus() + win = wx.Window_FindFocus() win.SelectAll() def OnAbout(self, event): """Display an About window.""" title = 'About' text = 'Your message here.' - dialog = wx.wxMessageDialog(self, text, title, - wx.wxOK | wx.wxICON_INFORMATION) + dialog = wx.MessageDialog(self, text, title, + wx.OK | wx.ICON_INFORMATION) dialog.ShowModal() dialog.Destroy() def OnAutoCompleteShow(self, event): - win = wx.wxWindow_FindFocus() + win = wx.Window_FindFocus() win.autoComplete = event.IsChecked() def OnAutoCompleteMagic(self, event): - win = wx.wxWindow_FindFocus() + win = wx.Window_FindFocus() win.autoCompleteIncludeMagic = event.IsChecked() def OnAutoCompleteSingle(self, event): - win = wx.wxWindow_FindFocus() + win = wx.Window_FindFocus() win.autoCompleteIncludeSingle = event.IsChecked() def OnAutoCompleteDouble(self, event): - win = wx.wxWindow_FindFocus() + win = wx.Window_FindFocus() win.autoCompleteIncludeDouble = event.IsChecked() def OnCallTipsShow(self, event): - win = wx.wxWindow_FindFocus() + win = wx.Window_FindFocus() win.autoCallTip = event.IsChecked() def OnWrap(self, event): - win = wx.wxWindow_FindFocus() + win = wx.Window_FindFocus() win.SetWrapMode(event.IsChecked()) def OnUpdateMenu(self, event): """Update menu items based on current status and context.""" - win = wx.wxWindow_FindFocus() + win = wx.Window_FindFocus() id = event.GetId() event.Enable(True) try: diff --git a/wxPython/wxPython/py/images.py b/wxPython/wxPython/py/images.py index 375e2004fd..4eba169368 100644 --- a/wxPython/wxPython/py/images.py +++ b/wxPython/wxPython/py/images.py @@ -1,12 +1,26 @@ -#---------------------------------------------------------------------- -# This file was generated by ../scripts/img2py -# -from wxPython.wx import wxImageFromStream, wxBitmapFromImage -from wxPython.wx import wxEmptyIcon +"""Support for icons.""" + +__author__ = "Patrick K. O'Brien " +__cvsid__ = "$Id$" +__revision__ = "$Revision$"[11:-2] + +import wx import cStringIO -def getPyCrustData(): +def getPyIcon(): + icon = wx.EmptyIcon() + icon.CopyFromBitmap(getPyBitmap()) + return icon + +def getPyBitmap(): + return wx.BitmapFromImage(getPyImage()) + +def getPyImage(): + stream = cStringIO.StringIO(getPyData()) + return wx.ImageFromStream(stream) + +def getPyData(): return \ '\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00 \x00\x00\x00 \x08\x06\x00\ \x00\x00szz\xf4\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x88\x00\x00\x04\ @@ -56,16 +70,3 @@ N\xba\xb3\xab\x87\xfb\x8f\x97\xd8\xd9\xd5\x03\xc0\xfd\xc7K\xec\xd8\xd6\xdd\ \x8f\xdb\xbel\x8e\xa1S\xc7\xda\xc6\xe6\xee\xccs\xe9\xdcYnV\x95\xd8\xf2?&q+\ \x9c\x1b1\xf3\xbf\xcd3{\xfdJ\xdb\xf8\xde\xfd\x19.\\\xad\x08\x80\xbf\x01\xd1\ \x86\xfa\x8b\xc7\xc0\xc8\xb7\x00\x00\x00\x00IEND\xaeB`\x82' - -def getPyCrustBitmap(): - return wxBitmapFromImage(getPyCrustImage()) - -def getPyCrustImage(): - stream = cStringIO.StringIO(getPyCrustData()) - return wxImageFromStream(stream) - -def getPyCrustIcon(): - icon = wxEmptyIcon() - icon.CopyFromBitmap(getPyCrustBitmap()) - return icon - diff --git a/wxPython/wxPython/py/shell.py b/wxPython/wxPython/py/shell.py index a10964fff6..6c87ab6e76 100644 --- a/wxPython/wxPython/py/shell.py +++ b/wxPython/wxPython/py/shell.py @@ -1,8 +1,6 @@ -"""The PyCrust Shell is an interactive text control in which a user -types in commands to be sent to the interpreter. This particular shell -is based on wxPython's wxStyledTextCtrl. The latest files are always -available at the SourceForge project page at -http://sourceforge.net/projects/pycrust/. +"""Shell is an interactive text control in which a user types in +commands to be sent to the interpreter. This particular shell is +based on wxPython's wxStyledTextCtrl. Sponsored by Orbtech - Your source for Python programming expertise.""" @@ -13,6 +11,8 @@ __revision__ = "$Revision$"[11:-2] from wxd.d_wx import wx from wxd.d_stc import stc +import wx + import keyword import os import sys @@ -40,18 +40,18 @@ NAVKEYS = (wx.WXK_END, wx.WXK_LEFT, wx.WXK_RIGHT, class ShellFrame(frame.Frame): - """Frame containing the PyCrust shell component.""" + """Frame containing the shell component.""" - name = 'PyCrust Shell Frame' + name = 'Shell Frame' revision = __revision__ def __init__(self, parent=None, id=-1, title='PyShell', - pos=wx.wxDefaultPosition, size=wx.wxDefaultSize, - style=wx.wxDEFAULT_FRAME_STYLE, locals=None, + pos=wx.DefaultPosition, size=wx.DefaultSize, + style=wx.DEFAULT_FRAME_STYLE, locals=None, InterpClass=None, *args, **kwds): - """Create a PyCrust ShellFrame instance.""" + """Create ShellFrame instance.""" frame.Frame.__init__(self, parent, id, title, pos, size, style) - intro = 'PyCrust %s - The Flakiest Python Shell' % VERSION + intro = 'PyShell %s - The Flakiest Python Shell' % VERSION intro += '\nSponsored by Orbtech - ' + \ 'Your source for Python programming expertise.' self.SetStatusText(intro.replace('\n', ', ')) @@ -81,10 +81,10 @@ class ShellFrame(frame.Frame): 'Shell Revision: %s\n' % self.shell.revision + \ 'Interpreter Revision: %s\n\n' % self.shell.interp.revision + \ 'Python Version: %s\n' % sys.version.split()[0] + \ - 'wxPython Version: %s\n' % wx.__version__ + \ + 'wxPython Version: %s\n' % wx.VERSION_STRING + \ 'Platform: %s\n' % sys.platform - dialog = wx.wxMessageDialog(self, text, title, - wx.wxOK | wx.wxICON_INFORMATION) + dialog = wx.MessageDialog(self, text, title, + wx.OK | wx.ICON_INFORMATION) dialog.ShowModal() dialog.Destroy() @@ -95,7 +95,7 @@ class ShellFacade: This is a semi-transparent facade, in that all attributes of other are accessible, even though only some are visible to the user.""" - name = 'PyCrust Shell Interface' + name = 'Shell Interface' revision = __revision__ def __init__(self, other): @@ -174,15 +174,15 @@ Ctrl+= Default font size. class Shell(editwindow.EditWindow): - """PyCrust Shell based on StyledTextCtrl.""" + """Shell based on StyledTextCtrl.""" - name = 'PyCrust Shell' + name = 'Shell' revision = __revision__ - def __init__(self, parent, id=-1, pos=wx.wxDefaultPosition, - size=wx.wxDefaultSize, style=wx.wxCLIP_CHILDREN, + def __init__(self, parent, id=-1, pos=wx.DefaultPosition, + size=wx.DefaultSize, style=wx.CLIP_CHILDREN, introText='', locals=None, InterpClass=None, *args, **kwds): - """Create a PyCrust Shell instance.""" + """Create Shell instance.""" editwindow.EditWindow.__init__(self, parent, id, pos, size, style) self.wrap() if locals is None: @@ -240,7 +240,7 @@ class Shell(editwindow.EditWindow): # Do this last so the user has complete control over their # environment. They can override anything they want. self.execStartupScript(self.interp.startupScript) - wx.wxCallAfter(self.ScrollToLine, 0) + wx.CallAfter(self.ScrollToLine, 0) def destroy(self): del self.interp @@ -299,17 +299,17 @@ class Shell(editwindow.EditWindow): self.push('') def about(self): - """Display information about PyCrust.""" + """Display information about Py.""" text = """ Author: %r -PyCrust Version: %s -Shell Revision: %s -Interpreter Revision: %s +Py Version: %s +Py Shell Revision: %s +Py Interpreter Revision: %s Python Version: %s wxPython Version: %s Platform: %s""" % \ (__author__, VERSION, self.revision, self.interp.revision, - sys.version.split()[0], wx.__version__, sys.platform) + sys.version.split()[0], wx.VERSION_STRING, sys.platform) self.write(text.strip()) def OnChar(self, event): @@ -673,7 +673,7 @@ Platform: %s""" % \ def push(self, command): """Send command to the interpreter for execution.""" self.write(os.linesep) - busy = wx.wxBusyCursor() + busy = wx.BusyCursor() self.waiting = True self.more = self.interp.push(command) self.waiting = False @@ -751,7 +751,7 @@ Platform: %s""" % \ self.prompt() try: while not reader.input: - wx.wxYieldIfNeeded() + wx.YieldIfNeeded() input = reader.input finally: reader.input = '' @@ -774,10 +774,10 @@ Platform: %s""" % \ def ask(self, prompt='Please enter your response:'): """Get response from the user using a dialog box.""" - dialog = wx.wxTextEntryDialog(None, prompt, - 'Input Dialog (Raw)', '') + dialog = wx.TextEntryDialog(None, prompt, + 'Input Dialog (Raw)', '') try: - if dialog.ShowModal() == wx.wxID_OK: + if dialog.ShowModal() == wx.ID_OK: text = dialog.GetValue() return text finally: @@ -931,14 +931,14 @@ Platform: %s""" % \ command = command.replace(os.linesep + ps2, os.linesep) command = command.replace(os.linesep + ps1, os.linesep) command = self.lstripPrompt(text=command) - data = wx.wxTextDataObject(command) + data = wx.TextDataObject(command) self._clip(data) def CopyWithPrompts(self): """Copy selection, including prompts, and place it on the clipboard.""" if self.CanCopy(): command = self.GetSelectedText() - data = wx.wxTextDataObject(command) + data = wx.TextDataObject(command) self._clip(data) def CopyWithPromptsPrefixed(self): @@ -949,23 +949,23 @@ Platform: %s""" % \ spaces = ' ' * 4 command = spaces + command.replace(os.linesep, os.linesep + spaces) - data = wx.wxTextDataObject(command) + data = wx.TextDataObject(command) self._clip(data) def _clip(self, data): - if wx.wxTheClipboard.Open(): - wx.wxTheClipboard.UsePrimarySelection(False) - wx.wxTheClipboard.SetData(data) - wx.wxTheClipboard.Flush() - wx.wxTheClipboard.Close() + if wx.TheClipboard.Open(): + wx.TheClipboard.UsePrimarySelection(False) + wx.TheClipboard.SetData(data) + wx.TheClipboard.Flush() + wx.TheClipboard.Close() def Paste(self): """Replace selection with clipboard contents.""" - if self.CanPaste() and wx.wxTheClipboard.Open(): + if self.CanPaste() and wx.TheClipboard.Open(): ps2 = str(sys.ps2) - if wx.wxTheClipboard.IsSupported(wx.wxDataFormat(wx.wxDF_TEXT)): - data = wx.wxTextDataObject() - if wx.wxTheClipboard.GetData(data): + if wx.TheClipboard.IsSupported(wx.DataFormat(wx.DF_TEXT)): + data = wx.TextDataObject() + if wx.TheClipboard.GetData(data): self.ReplaceSelection('') command = data.GetText() command = command.rstrip() @@ -975,16 +975,16 @@ Platform: %s""" % \ command = command.replace(os.linesep, '\n') command = command.replace('\n', os.linesep + ps2) self.write(command) - wx.wxTheClipboard.Close() + wx.TheClipboard.Close() def PasteAndRun(self): """Replace selection with clipboard contents, run commands.""" - if wx.wxTheClipboard.Open(): + if wx.TheClipboard.Open(): ps1 = str(sys.ps1) ps2 = str(sys.ps2) - if wx.wxTheClipboard.IsSupported(wx.wxDataFormat(wx.wxDF_TEXT)): - data = wx.wxTextDataObject() - if wx.wxTheClipboard.GetData(data): + if wx.TheClipboard.IsSupported(wx.DataFormat(wx.DF_TEXT)): + data = wx.TextDataObject() + if wx.TheClipboard.GetData(data): endpos = self.GetTextLength() self.SetCurrentPos(endpos) startpos = self.promptPosEnd @@ -1022,14 +1022,14 @@ Platform: %s""" % \ command = command.replace('\n', os.linesep + ps2) self.write(command) self.processLine() - wx.wxTheClipboard.Close() + wx.TheClipboard.Close() def wrap(self, wrap=True): """Sets whether text is word wrapped.""" try: self.SetWrapMode(wrap) except AttributeError: - return 'Wrapping is not available in this version of PyCrust.' + return 'Wrapping is not available in this version.' def zoom(self, points=0): """Set the zoom level.