Load the frame icons from a .py file so I don't have to figure out how

to tell distutils to install the .ico in the right place...


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16759 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2002-08-25 03:39:00 +00:00
parent 03d9e55cc9
commit 7a5d2dc7e2
4 changed files with 89 additions and 18 deletions

View File

@@ -56,9 +56,8 @@ class CrustFrame(wxFrame, ShellMenu):
intro += '\nSponsored by Orbtech - Your source for Python programming expertise.' intro += '\nSponsored by Orbtech - Your source for Python programming expertise.'
self.CreateStatusBar() self.CreateStatusBar()
self.SetStatusText(intro.replace('\n', ', ')) self.SetStatusText(intro.replace('\n', ', '))
filename = os.path.join(os.path.dirname(__file__), 'PyCrust.ico') import images
icon = wxIcon(filename, wxBITMAP_TYPE_ICO) self.SetIcon(images.getPyCrustIcon())
self.SetIcon(icon)
self.crust = Crust(parent=self, intro=intro, \ self.crust = Crust(parent=self, intro=intro, \
rootObject=rootObject, \ rootObject=rootObject, \
rootLabel=rootLabel, \ rootLabel=rootLabel, \

View File

@@ -0,0 +1,71 @@
#----------------------------------------------------------------------
# This file was generated by ../scripts/img2py
#
from wxPython.wx import wxImageFromStream, wxBitmapFromImage
from wxPython.wx import wxEmptyIcon
import cStringIO
def getPyCrustData():
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\
\x95IDATx\x9c\xed\x97?lSG\x1c\xc7?\x97\x98\xd8Q\xa3\xdeY\xa2j\x06\xa4\xf7"QJ\
\xbb<3@\x01\xa9\xc2\x0c\xa8!\x1d\x1c6\xcaB\xa8D[uI2\xf4\x8f\xe8\x103\xb4\xa2\
,5\x0b\x03\x032C\xab\xc0\x92dh:t\xc0)*E\xcd@<Q\x01Rl\t\xd4D\xaa\xe4{R\xd0{&\
\xa5\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\
\xa0\xa2\xa0\x0e"\x14`\xb0Y\x85\x1b\x1f\x12\xaa7\x03)\xd9\x84\xa8\xccW\xb8{\
\xa7L\xe2\xde\x02\x94\xc6Gp_\xcf\x80\x90\x98\xd0g\xf4\xac\x82Pc\x82\x1a\xd5\
\x10\x08}&\xa7J\xcc\xde.1]m\x80\xf6+\xee\xfd\xae\x9bo\xc4\xf0;\x80\xef\x90\
\x0e\x04\x06`Q!\x02\x05\xc2 \xb5\xc2\x95\x15d\xb4C&[\xf7\xd2\x04\x80\xbb\xdb\
\x9e\xd1\x8e\x02\x90\xd8\xd4$ I\x87\x80\xf1\xf1\xdc!4\xc3\x88\x94}\xd8,TH\
\xbb.5m\xf0C\x9f3\x1f\r\x01\x96.\x82\x1a9\xe9Q\xb8\xd2\xf8\xf25\x0c\xbe\xe7#\
\x92\x12\x1d[\x03\t\x00E\xf4\xa6\t\xaaZ7`$\x18\x90\xf8\xf8\x80JK\x94\xa1\x01\
\x07\xb8\x0e~X\xc3\xed\x16\xf8)\xf8~j\x12B\rI\x89_\xf7!0 \x04\xf9Q\xc0\x18\
\x0c\xd1i\xea\x13\xb7\x04\xc0\x89\x93C\xabj\xb6\xf7@\x96\xd9_J|0:\x86R\n\xb7\
\xd7@\xaa%\x9d\xa3$\xba.\x90RA]\xe3\x87\x1a\x89\xdd\xefeR\xc2\x1a\'\xa8\x1f\
\x82\x0e-@m\xd1\xde\x076\xbc\x15\x97~(\x9a\x89b\x9e\xd9[s\xab!\xf7g\xd6\x1c\
\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

View File

@@ -50,7 +50,7 @@ else: # GTK
class ShellFacade: class ShellFacade:
"""Simplified interface to all shell-related functionality. """Simplified interface to all shell-related functionality.
This is a semi-transparent facade, in that all attributes of other are This is a semi-transparent facade, in that all attributes of other are
still accessible, even though only some are visible to the user.""" still accessible, even though only some are visible to the user."""
name = 'PyCrust Shell Interface' name = 'PyCrust Shell Interface'
@@ -574,7 +574,7 @@ class Shell(wxStyledTextCtrl):
# The user hit ENTER and we need to decide what to do. They could be # The user hit ENTER and we need to decide what to do. They could be
# sitting on any line in the shell. # sitting on any line in the shell.
thepos = self.GetCurrentPos() thepos = self.GetCurrentPos()
startpos = self.promptPosEnd startpos = self.promptPosEnd
endpos = self.GetTextLength() endpos = self.GetTextLength()
# If they hit RETURN inside the current command, execute the command. # If they hit RETURN inside the current command, execute the command.
@@ -661,7 +661,7 @@ class Shell(wxStyledTextCtrl):
elif text[:ps2size] == ps2: elif text[:ps2size] == ps2:
text = text[ps2size:] text = text[ps2size:]
return text return text
def push(self, command): def push(self, command):
"""Send command to the interpreter for execution.""" """Send command to the interpreter for execution."""
busy = wxBusyCursor() busy = wxBusyCursor()
@@ -766,11 +766,11 @@ class Shell(wxStyledTextCtrl):
>>> shell.run('print "this"') >>> shell.run('print "this"')
>>> print "this" >>> print "this"
this this
>>> >>>
""" """
# Go to the very bottom of the text. # Go to the very bottom of the text.
endpos = self.GetTextLength() endpos = self.GetTextLength()
self.SetCurrentPos(endpos) self.SetCurrentPos(endpos)
command = command.rstrip() command = command.rstrip()
if prompt: self.prompt() if prompt: self.prompt()
if verbose: self.write(command) if verbose: self.write(command)
@@ -791,9 +791,9 @@ class Shell(wxStyledTextCtrl):
def autoCompleteShow(self, command): def autoCompleteShow(self, command):
"""Display auto-completion popup list.""" """Display auto-completion popup list."""
list = self.interp.getAutoCompleteList(command, list = self.interp.getAutoCompleteList(command,
includeMagic=self.autoCompleteIncludeMagic, includeMagic=self.autoCompleteIncludeMagic,
includeSingle=self.autoCompleteIncludeSingle, includeSingle=self.autoCompleteIncludeSingle,
includeDouble=self.autoCompleteIncludeDouble) includeDouble=self.autoCompleteIncludeDouble)
if list: if list:
options = ' '.join(list) options = ' '.join(list)
@@ -957,7 +957,7 @@ class Shell(wxStyledTextCtrl):
command += '\n' command += '\n'
command += line command += line
commands.append(command) commands.append(command)
for command in commands: for command in commands:
command = command.replace('\n', os.linesep + sys.ps2) command = command.replace('\n', os.linesep + sys.ps2)
self.write(command) self.write(command)
self.processLine() self.processLine()
@@ -972,7 +972,7 @@ class Shell(wxStyledTextCtrl):
def zoom(self, points=0): def zoom(self, points=0):
"""Set the zoom level. """Set the zoom level.
This number of points is added to the size of all fonts. This number of points is added to the size of all fonts.
It may be positive to magnify or negative to reduce.""" It may be positive to magnify or negative to reduce."""
self.SetZoom(points) self.SetZoom(points)
@@ -1169,9 +1169,8 @@ class ShellFrame(wxFrame, ShellMenu):
intro += '\nSponsored by Orbtech - Your source for Python programming expertise.' intro += '\nSponsored by Orbtech - Your source for Python programming expertise.'
self.CreateStatusBar() self.CreateStatusBar()
self.SetStatusText(intro.replace('\n', ', ')) self.SetStatusText(intro.replace('\n', ', '))
filename = os.path.join(os.path.dirname(__file__), 'PyCrust.ico') import images
icon = wxIcon(filename, wxBITMAP_TYPE_ICO) self.SetIcon(images.getPyCrustIcon())
self.SetIcon(icon)
self.shell = Shell(parent=self, id=-1, introText=intro, \ self.shell = Shell(parent=self, id=-1, introText=intro, \
locals=locals, InterpClass=InterpClass, \ locals=locals, InterpClass=InterpClass, \
*args, **kwds) *args, **kwds)

View File

@@ -1000,8 +1000,10 @@ class Frame(wxFrame):
frame = self frame = self
wxFrame.__init__(self, None, -1, '', pos, size) wxFrame.__init__(self, None, -1, '', pos, size)
self.CreateStatusBar() self.CreateStatusBar()
progpath = os.path.split(__file__)[0] #progpath = os.path.split(__file__)[0]
icon = wxIcon(os.path.join(progpath, 'xrced.ico'), wxBITMAP_TYPE_ICO) #icon = wxIcon(os.path.join(progpath, 'xrced.ico'), wxBITMAP_TYPE_ICO)
icon = wxEmptyIcon()
icon.CopyFromBitmap(images.getIconBitmap())
self.SetIcon(icon) self.SetIcon(icon)
# Idle flag # Idle flag