mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-09-19 12:23:07 +08:00
Moved tools to be a Python package in wxPython.tools, added scripts to
import and launch each tool. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16418 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
0.0.7
|
||||
-----
|
||||
|
||||
Some command-line arguments.
|
||||
|
||||
"Test window" command and toolbar button.
|
||||
|
||||
New panel interphace (wxHTMLWindow is not used anymore).
|
||||
|
||||
Toggling between embedded and detached panel.
|
||||
|
||||
Cache for already used windows.
|
||||
|
||||
Current top-level control is bold, if test window shown.
|
||||
|
||||
Undo/redo broken.
|
||||
|
||||
CheckListBox does not work unless wxXRC source fixed (in both wxPytnon and
|
||||
wxWin):
|
||||
|
||||
contrib/src/xrc/xmlrsall.cpp
|
||||
45,46c45,46
|
||||
< AddHandler(new wxListCtrlXmlHandler);
|
||||
< #if CHECKLISTBOX
|
||||
---
|
||||
> AddHandler(new wxListCtrlXmlHandler);
|
||||
> #if wxUSE_CHECKLISTBOX
|
||||
|
||||
|
||||
0.0.6
|
||||
-----
|
||||
|
||||
Toolbar, bitmap, icon support (no display yet).
|
||||
|
||||
Changed parameter objects, added support for multiple parameters (like
|
||||
`growablecols').
|
||||
|
||||
Fixed double-clicking problem with tree control on Windows.
|
||||
|
||||
Some performance improovements.
|
||||
|
||||
|
||||
0.0.5
|
||||
-----
|
||||
|
||||
Added notebook with properties page and style page. Fixed some problems
|
||||
on Windows.
|
||||
|
||||
|
||||
0.0.4
|
||||
-----
|
||||
|
||||
Some fixes suggested by RD
|
||||
|
||||
|
||||
0.0.3
|
||||
-----
|
||||
|
||||
Faster preview window refresh.
|
||||
|
||||
Cut/Paste works better.
|
||||
|
||||
Some tree icons.
|
||||
|
||||
Tree item names.
|
||||
|
||||
Bugfixes.
|
||||
|
||||
|
||||
0.0.2
|
||||
-----
|
||||
|
||||
The first release.
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
********************************************************************************
|
||||
|
||||
XRCed README
|
||||
|
||||
********************************************************************************
|
||||
|
||||
Installation on UNIX
|
||||
--------------------
|
||||
|
||||
XRCed requires wxGTK and wxPython greater than 2.3.2, and Python 2.2 (it may
|
||||
work with earlier version, but was not tested).
|
||||
|
||||
Of course wxGTK's XRC library (libwxxrc) must be installed.
|
||||
|
||||
Installation on Windows
|
||||
-----------------------
|
||||
|
||||
Works with wxPython 2.3.2 for Python 2.2.
|
||||
|
||||
Short manual
|
||||
------------
|
||||
|
||||
XRCed's idea is very straightforward: it is a visual tool for editing an XML
|
||||
file conforming to XRC format. Every operation performed in XRCed has direct
|
||||
correspondence to XML structure. So it is not really a usual point-and-click
|
||||
GUI builder, but don't let that scare you.
|
||||
|
||||
To start xrced, change to the directory where you installed it and run
|
||||
"python2.2 xrced.py".
|
||||
|
||||
On UNIX you can edit wrapper script "xrced.sh" to point to your installation
|
||||
directory.
|
||||
|
||||
To create an object, first you should select some object in the tree (or the
|
||||
root item if it's empty) then press the right mouse button and select an
|
||||
appropriate command. The pulldown menu is context-dependent on the selected
|
||||
object.
|
||||
|
||||
XRCed tries to guess if new object should be added as a next sibling or a
|
||||
child of current object, depending on the possibility of the object to have
|
||||
child objects and expanded state (if tree item is collapsed, new object will
|
||||
be sibling). You can change this behavior to create siblings by pressing and
|
||||
holding the Shift and Control keys before clicking the mouse.
|
||||
|
||||
Pressed Control key while pressing right button makes next item a sibling of
|
||||
selected item regardless of its expanded state.
|
||||
|
||||
Pressed Shift key changes the place for inserting new child to be before
|
||||
selected child, not after as by default.
|
||||
|
||||
Panel on the right contains object properties. Properties which are optional
|
||||
should be "checked" first. This panel can be made separate by unchecking
|
||||
"Embed Panel" in View menu.
|
||||
|
||||
All properties can be edited as text, and some are supplied with special
|
||||
editing controls.
|
||||
|
||||
The names of the properties are exactly as in XRC file, and it's usually not
|
||||
hard to guess what they do. XML ID is the name of the window, and must be
|
||||
present for top-level windows (though this is not enforced by XRCed).
|
||||
|
||||
To display the preview window double-click a top-level object (you should
|
||||
assign an XMLID to it first), press "Test" toolbar button or select command
|
||||
from View menu, or press F5. After that, if you select a child object, it
|
||||
becomes highlighted, and if you change it, preview is updated when you select
|
||||
another item or press Ctrl-R (refresh). To turn off automatic update, toggle
|
||||
"View->Auto-refresh" or toolbar auto-refresh button (to the right of the
|
||||
refresh button).
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Copyright 2001 Roman Rolinsky <rolinsky@mema.ucl.ac.be>
|
||||
@@ -0,0 +1,29 @@
|
||||
TODO for XRCed
|
||||
==============
|
||||
|
||||
- Undo/Redo
|
||||
|
||||
- menu - accel not displayed in preview
|
||||
|
||||
+ tree icons
|
||||
|
||||
- replace object with another, keeping children
|
||||
|
||||
+ write tmp file for current dialog/panel/etc.
|
||||
|
||||
+ XML indents
|
||||
|
||||
? select same notebook pages after update
|
||||
|
||||
- put some default values in tree ctrl etc.
|
||||
|
||||
- special (fast) update for some values: pos/size, value/content, sizeritem
|
||||
stuff (?), well, as much as possible
|
||||
|
||||
- highlighting with better method
|
||||
|
||||
- import XRC/WXR files
|
||||
|
||||
+ disable some window creation when it's not valid
|
||||
|
||||
- check for memory leaks from wx objects
|
||||
@@ -0,0 +1,4 @@
|
||||
#
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,368 @@
|
||||
#----------------------------------------------------------------------
|
||||
# This file was generated by img2py.py
|
||||
#
|
||||
from wxPython.wx import wxBitmapFromXPMData, wxImageFromBitmap
|
||||
import cPickle, zlib
|
||||
|
||||
|
||||
def getIconData():
|
||||
return cPickle.loads(zlib.decompress(
|
||||
'x\xda\x9d\x90\xbb\x0e\xc20\x0cEw\xbe\xc2\x12C\x91"Y-\xa2\x82\xd1\x80\xd45C\
|
||||
\x97\xac\x88\x11\xa4\xf0\xff\x13\xd7Nh\xa0\xcd\x00\xb8y\xf4\xe6\xf8\x95l\xee\
|
||||
\x8fn56\xdb\x1da\xec\xa9kV\x97\xb1\tt\xa5\xd3\xfdr\xbd\x99b\xa8\xf5\xf1\xa0\
|
||||
\x9fi\xa7\xba\x85\rI\xcb\x8bg\x1dU\xf7m\xbf\xeb[\xd3\xfe\xa53\'\xd5\xc3a8O\
|
||||
\xban_@\x0eL10\x07X\xc4iL[\x8e\x8c\x81 \xe1\xc3\xea\x17\xd4/NPct\x85{0N\xcc\
|
||||
\xa5f\xb4\x83\x94\xd6|\xde\x1b\xb2"\x9a\x16\x05\xe6\x10\x81\x08\xe5\x9cZ\x1d\
|
||||
K\xcd\xd4\xed\x04-}\xb9\n\n\x12\xdb\xb0\x99\x0e\xe8\x8f\x17\xf2N~\x81\xe2}"^\
|
||||
\x16\xd0;\x18\xce\x9c\xcb?oP\x9c\xc7t\xf0\xb1\xfd\x13Z&,9z\x0eS:\x04/\x1bB:\
|
||||
\x81Q\x15jM4Z\xaf\x99\xba\xf4\xf5n\xed\x9e\x92\xef)B\x7f\xbem\x81\xfc\x04\
|
||||
\x8f\xd5\x99\xcc' ))
|
||||
|
||||
def getIconBitmap():
|
||||
return wxBitmapFromXPMData(getIconData())
|
||||
|
||||
def getIconImage():
|
||||
return wxImageFromBitmap(getIconBitmap())
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getNewData():
|
||||
return cPickle.loads(zlib.decompress(
|
||||
"x\xda\xd3\xc8)0\xe4\nV72Q02V0Q0T\xe7J\x0cV\xd7SHVp\xcaIL\xce\x06\xf3\xf2\
|
||||
\x81<eK\x03\x10\x04\xf3\x15\x80|\xbf\xfc\xbcT0'\x02$\xe9f\xe1\xe6\xecf\x01\
|
||||
\x95\xc4\x0e\x06ZR\x0f\n\xb0KF\x80\x01B\x16\x9bd\x84\x1e>\x9d0\xbdX$A\xf2\
|
||||
\xf9\xc3Z\x12\x010%\x15\xf2\x11` S\x82\x1e\x00-\xd9\x8b\xfa" ))
|
||||
|
||||
def getNewBitmap():
|
||||
return wxBitmapFromXPMData(getNewData())
|
||||
|
||||
def getNewImage():
|
||||
return wxImageFromBitmap(getNewBitmap())
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getOpenData():
|
||||
return cPickle.loads(zlib.decompress(
|
||||
'x\xda\xcd\x92\xb1\n\xc3 \x10\x86\xf7<\xc5A\x07\x0b\x81#IK\xb1\xab\x01\xc7:d\
|
||||
\xb95\x84N\r\xbd\xbe\xff\xd4hb\xb5j\xbb\xb6\xbf\x08~|\xde)\xe2~~\xb4\xd5 \
|
||||
\xba#t\x078A+\xaaq\x10\x08\x13\xa8y\x9cn\x8e\xccB\xbbsc\x87c\xb2\xac\xa5\xee\
|
||||
\x9b\x95a\xe1\x0b\xdf\xaf\x0e\xd8K-\x1d\xd7\x96\x95Tas9\x7f"\x11\xf1\xa3D7\
|
||||
\xf1K[Leh\xe7\x97A"1\xe1\x9a\xfcB\xc8\xb4\r4\xb9\xf4\x8eJ\x92C\xdf\xf2\x99\
|
||||
\xb5\x8f\xab\x8e+9v\x89\xa4\xd4\xc52so\xf2\x95\xcd\xc5/dB~\xfb\x13\xf0\t\x81\
|
||||
T\x87G' ))
|
||||
|
||||
def getOpenBitmap():
|
||||
return wxBitmapFromXPMData(getOpenData())
|
||||
|
||||
def getOpenImage():
|
||||
return wxImageFromBitmap(getOpenBitmap())
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getSaveData():
|
||||
return cPickle.loads(zlib.decompress(
|
||||
'x\xda\xd3\xc8)0\xe4\nV72Q02V0U0T\xe7J\x0cV\xd7SHVp\xcaIL\xce\x06\xf3\xfc\
|
||||
\x81<eK\x03\x10\x04\xf3#@|\x0b\x03\x0b\x03\x03\x08_\x01\xc8\xf7\xcb\xcfK\x05\
|
||||
s\xf2A\x92n\x16n\xcen\x16PI\xec\x80\xe6\x92z(\x00]2B/\x1f\n\x80L\x7f\xdc\x92\
|
||||
z\xf8$#\xe8&\x19\x01\xf3G\x046I\x04\xc0\xa3\x13\x8f\xb1x\xed$Y\x125\xe4\xd1%\
|
||||
\x15\xfc\x91\x01]R\x02vI=\x00\xd8\x14\x96@' ))
|
||||
|
||||
def getSaveBitmap():
|
||||
return wxBitmapFromXPMData(getSaveData())
|
||||
|
||||
def getSaveImage():
|
||||
return wxImageFromBitmap(getSaveBitmap())
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getCutData():
|
||||
return cPickle.loads(zlib.decompress(
|
||||
'x\xda\xd3\xc8)0\xe4\nV72Q02V0Q0T\xe7J\x0cV\xd7SHVp\xcaIL\xce\x06\xf3\xf2\
|
||||
\x81<e\x03 \xb00\x00\xf3#@|K\x03\x10\x04\xf3\x15\x80|\xbf\xfc\xbcT(\x07;\xa0\
|
||||
\x96\xa4\x1e^\xc9\x08\x145h\x92z\x102\x02\xab\x9d a\xa0\x1c\x0eI=$9L\xc9\x08\
|
||||
\xb8\xa1\x98^\xd1C\xd2\x88U\x12W \xe4\xe7\xeb\xe5\xe7\xe3\x96\x8c\xc8\xcf\
|
||||
\x87K\xa3H\x82\xc4#\xc0\x08S\x12&\x03B\xe4H\x82\x0c\x8f\x88\xc0j\'H8\x02{\
|
||||
\xf0E \x02\x80\x9a)\x81DI=\x00\x12\xa5\x85\x9f' ))
|
||||
|
||||
def getCutBitmap():
|
||||
return wxBitmapFromXPMData(getCutData())
|
||||
|
||||
def getCutImage():
|
||||
return wxImageFromBitmap(getCutBitmap())
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getCopyData():
|
||||
return cPickle.loads(zlib.decompress(
|
||||
'x\xda\xc5\x92\xb1\n\xc20\x10\x86\xf7>\xc5\x81C\x9c\x8e\xb4*\xc4\xd5BF3t\xc9\
|
||||
Z\x8a\x93\xc5\xf3\xfd\'\xef.vP\xee\xe6\xfe\t\x81\x9f/\xdf\r!\xc7\xf5\xddwS\
|
||||
\x18\xce0\x9c\xe0\x02}\xe8\xe6) ,p[\xe7\xe5\xa9\x8d\xb8\x1d"\'E\xedE\xfa5\
|
||||
\xca\xd2\x0e\xdc\xef\xf4zh\xa9\x02s\xcacN_hg_\x88\x1a\x0fV\xce/\xfd\x87\x15\
|
||||
\x1d\x88\xbcIc\x9b\x95\xf4 \xcbDl\xb0\x92c\xf2\xf0m\xb2i\xca\xa5\xe2\x98(r1\
|
||||
\x1e\xc11\xa1H\x1c\xb3\xc53\x1b\xdcb\xc16\\\xb2\xdfO\xc0\x0f5t\x92\x06' ))
|
||||
|
||||
def getCopyBitmap():
|
||||
return wxBitmapFromXPMData(getCopyData())
|
||||
|
||||
def getCopyImage():
|
||||
return wxImageFromBitmap(getCopyBitmap())
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getPasteData():
|
||||
return cPickle.loads(zlib.decompress(
|
||||
'x\xda\xcd\x92\xb1\n\x830\x10\x86w\x9f\xe2\xa0\x83\x85\xc0\x11m\xa1\xe9\x16Z\
|
||||
p\xec\r.YE:U\x9a\xbe\xff\xe4]48x\xe9V\xe8\'\xc2\xfd|\xf7g\x88\x1e\xa7OS\xf5u\
|
||||
{\x86\xf6\x04\x17h\xeaj\xe8k\x84\x11n\xd30\xbeR2\x9c\x0e\x96q6e\x92|\xb5\xf2\
|
||||
\xa4\x1c$w\xae\xbb\xdb%G\xc9\xce\xba\xbc\x0f\x9c\x1f\xf1\xfdL\xc1\xe7\xe5\
|
||||
\xce\xadR\xe7\x0f$2\xaa\x14\x81!\xe0\xb6\xb0I\x8c1"\xab\x90\x86\xbd\xe4\x9e \
|
||||
\x13\xed\xe5\x8a*7ti\x16\n\xd2\x0b\xc6|\x93\xde\xe8\x92\x0f\x95\x97\x8aM\xee\
|
||||
R\xa9)]R\xae\xaf\xd0\x04 \xc6dH\xfbd\x94\xf9\xe9\x9f\x803\xb0L\x99\x05' ))
|
||||
|
||||
def getPasteBitmap():
|
||||
return wxBitmapFromXPMData(getPasteData())
|
||||
|
||||
def getPasteImage():
|
||||
return wxImageFromBitmap(getPasteBitmap())
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getTestData():
|
||||
return cPickle.loads(zlib.decompress(
|
||||
'x\xda\x95\xd2=\x0b\xc20\x10\x06\xe0\xbd\xbf\xe2\xc0\xa1N\xa1\x1f\n\xba*t\
|
||||
\xf4\x86.\xb7\x96\xe2d\xf1\xfc\xff\x93\xb9$\xcd5M\xa9xY\xf2\xf2\x10r$w\x9c>u\
|
||||
\xd1\x97\xcd\t\x9a\x16\xceP\x97\xc5\xd0\x97\x06F\xb8M\xc3\xf8r\x89l:\xb4\x95\
|
||||
,\x97Q\xf2\xb5\x92\xe52K\xee.\xdd\xbd\xf2\x19l~\xf0\xfb\x19\xc2v\xfd\x81Fj\
|
||||
\x1b\xcd\\9\x12\xd1\x8cD+$f\x0efw\xb4\x8b\xb8D\xb1\xa0nG\xbb\x88\x8a\xde,r@w\
|
||||
4A\x07\x8b\xa3\x01\xb5\x95\xd8V\x86Fm\x03M\xb4\x05\xaaF\xcb1\xb9R_h\xd5\x10f\
|
||||
\xc8\x1c\x15\xd3_\x89&\x8a+\x04$\xff\x14D\xe8-\x9d\x04\xcb\xa4\x94\xcd\x10\
|
||||
\xa2\xd2\xef\x013_\xba\x1d\xa3N' ))
|
||||
|
||||
def getTestBitmap():
|
||||
return wxBitmapFromXPMData(getTestData())
|
||||
|
||||
def getTestImage():
|
||||
return wxImageFromBitmap(getTestBitmap())
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getRefreshData():
|
||||
return cPickle.loads(zlib.decompress(
|
||||
'x\xda\xad\xd2\xbb\x0e\xc20\x0c\x05\xd0\xbd_q%\x860]\xf5\xc1\x00?\xc0\xc8\
|
||||
\xd2\xc5+Bl\xa8\xed\xffO\xcd\xab\xa9\x01\x17\t\x81\xb3\xc4:\x8a\x15;\xd9?\
|
||||
\xa6\xa6\xea]{@\xdb\xa1C\xe3\xaak\xef\x047\xecNuX1\x87\xcf/\xe3p\x8f\t\x03\
|
||||
\x9e\x8f\xb5\x8f\x8cv|\x83\x0c\xb1\x81^D\xa9BF\x13\xac\xaa1Y\xd8\x88\x89\xc4\
|
||||
\'d\xdal\x94\xd5u\x9f0\x91\x89\xc8d\xa3j\xf7\x9f\xb8t@\x1bY\xae\xfd^6\x9f\
|
||||
\xb0&\xb4\x1c\xa5\x8dQY\xaa\x9a\x8f]\x86\xf1\xda\x8a\x88\x14\xc3O\x1f\x8c3\
|
||||
\x1dNw\xdd' ))
|
||||
|
||||
def getRefreshBitmap():
|
||||
return wxBitmapFromXPMData(getRefreshData())
|
||||
|
||||
def getRefreshImage():
|
||||
return wxImageFromBitmap(getRefreshBitmap())
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getAutoRefreshData():
|
||||
return cPickle.loads(zlib.decompress(
|
||||
'x\xda\x95\xd2;\x0e\xc20\x0c\x06\xe0\xbd\xa7\xb0\xc4\x10&+-\x1d\xca\x05\x18Y\
|
||||
\xba\xfc+Bl\x08s\xff\x89<\x9c\x12\xc9I\xa5:Cc}\x95#;9\xbf\xbf\xe3\xb0\xbai\
|
||||
\xa6\xe9B3\x8dnx\xac\x0e\xf4\xa4\xd3\xd5\xc7\x95r\n\xf9]>\xaf\x94HD\xef\x97\
|
||||
\xc5g\xe4\x98\xdfB\xe6\xcb\xcf\xed8\x82\x1c\xa3\x83APi\x85\x9c\x0c\xf4\xd7\
|
||||
\x1a\xb3\xc5\r\x9a\xc8\xb4\x87\x9c7\x9d\xb2 \t\x01\x8b\x91\x82\x81U\xebV\x00\
|
||||
\xfd\xb4PC\xb6\xba\x16;ew1w \xed\xb2\xbc)DLY\x1dM\xea\t\x16u@\xe8\\\x19\x95\
|
||||
\xf1w.\xbb\x98i\x05z\xdc\xe17d\x90\x7f\x95\x07\x86\x9f' ))
|
||||
|
||||
def getAutoRefreshBitmap():
|
||||
return wxBitmapFromXPMData(getAutoRefreshData())
|
||||
|
||||
def getAutoRefreshImage():
|
||||
return wxImageFromBitmap(getAutoRefreshBitmap())
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getTreeDefaultData():
|
||||
return cPickle.loads(zlib.decompress(
|
||||
"x\xda\xd3\xc8)0\xe4\nV74S04Q0U0T\xe7J\x0cV\x8fPHVp\xcaIL\xce\x06\xf3\xfc\
|
||||
\x81<eK\x03K\x13K\x030_\x01\xc8\xf7\xcb\xcfK\x05s\xf4@\x92n\x16n\xcen\x16`~>\
|
||||
\x88\xefb\xe0b\xe2\x02S\x8c\n\xc8\x10\xd4\x83\x80\x08T\xc1|\x10\xf0\xa7\xae\
|
||||
\xa0?\x18\xa0\nF@\x01\x99\x8e'FP\x0f\x00\xdc\x1bL7" ))
|
||||
|
||||
def getTreeDefaultBitmap():
|
||||
return wxBitmapFromXPMData(getTreeDefaultData())
|
||||
|
||||
def getTreeDefaultImage():
|
||||
return wxImageFromBitmap(getTreeDefaultBitmap())
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getTreeRootData():
|
||||
return cPickle.loads(zlib.decompress(
|
||||
'x\xda\xd3\xc8)0\xe4\nV74S04Q0V0T\xe7J\x0cV\xd7SHVp\xcaIL\xce\x06\xf3"\x80<e\
|
||||
c\x0b\x10\x04\xf3\x15\x80|\xbf\xfc\xbcT(\x07\x15 \x04\xf5\x80\x00Y0\x02\x080\
|
||||
\x04\x15"\xb0i\x8f\x80\xe9\x87\xa8\x86\n\xc2\xf4\xa3\x08\x0e\xa8v\x9c~G\x15\
|
||||
\xd4\x03\x00\x87\xa5@\xc2' ))
|
||||
|
||||
def getTreeRootBitmap():
|
||||
return wxBitmapFromXPMData(getTreeRootData())
|
||||
|
||||
def getTreeRootImage():
|
||||
return wxImageFromBitmap(getTreeRootBitmap())
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getTreePanelData():
|
||||
return cPickle.loads(zlib.decompress(
|
||||
'x\xda\xd3\xc8)0\xe4\nV74S04Q0Q0T\xe7J\x0cV\xd7SHVp\xcaIL\xce\x06\xf3\xf2\
|
||||
\x81<eK\x03K\x13K\x030_\x01\xc4w\xb3psv\xb3\x00\xf3#@|\x17\x03\x17\x13\x17\
|
||||
\x98<\n\xd0\x83\x08F \x83\xfca+\x98\x8f\x02 \x82zh\x00(\xa8\x07\x00&\x96e\
|
||||
\x83' ))
|
||||
|
||||
def getTreePanelBitmap():
|
||||
return wxBitmapFromXPMData(getTreePanelData())
|
||||
|
||||
def getTreePanelImage():
|
||||
return wxImageFromBitmap(getTreePanelBitmap())
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getTreeDialogData():
|
||||
return cPickle.loads(zlib.decompress(
|
||||
'x\xda\xd3\xc8)0\xe4\nV74S\x00"\x13\x05Cu\xae\xc4`u\x05\x85d\x05\xa7\x9c\xc4\
|
||||
\xe4l0/\x1f\xc8S\xb64\xb04\xb14\x00\xf3\xf5@|\x03 p\xb3\x00\xf3#@|\x17\x03\
|
||||
\x17\x13\x17\x03\xa8nT\x00\x11\xd4C\x01$\x0bb53\x02\x05\x0c\x98`>1\x82\xf9`@\
|
||||
\xc8LLo\xea\x01\x00\xb5\x9cde' ))
|
||||
|
||||
def getTreeDialogBitmap():
|
||||
return wxBitmapFromXPMData(getTreeDialogData())
|
||||
|
||||
def getTreeDialogImage():
|
||||
return wxImageFromBitmap(getTreeDialogBitmap())
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getTreeFrameData():
|
||||
return cPickle.loads(zlib.decompress(
|
||||
'x\xda\xd3\xc8)0\xe4\nV74S\x00"c\x05Cu\xae\xc4`u\x05\x85d\x05\xa7\x9c\xc4\
|
||||
\xe4l0O\x0f\xc8S6\x00\x027\x0b0?\x02\xc4w1p1q1\x80\xaaF\x05\x10A=\x14@\xb2 V\
|
||||
3#P\xc0p\x10\xc4\xf4\xa6\x1e\x00\xe3\x8f`,' ))
|
||||
|
||||
def getTreeFrameBitmap():
|
||||
return wxBitmapFromXPMData(getTreeFrameData())
|
||||
|
||||
def getTreeFrameImage():
|
||||
return wxImageFromBitmap(getTreeFrameBitmap())
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getTreeMenuBarData():
|
||||
return cPickle.loads(zlib.decompress(
|
||||
'x\xda\xd3\xc8)0\xe4\nV74S\x00"S\x05Cu\xae\xc4`\xf5\x08\x85d\x05\xa7\x9c\xc4\
|
||||
\xe4l0\xcf\x1f\xc8S\xb64\xb04\xb14\x00\xf3\x15\x80|\xbf\xfc\xbcT0G\x0f$\xe9f\
|
||||
\xe1\xe6\xecf\x01\xe6\xe7\x83\xf8.\x06.&.0\xc5\xa8\x80\x1a\x82z\xa8 \x02"\
|
||||
\x98\x8f\x0c\xfca\x82\xfe \x00#I\x17\xc4b\xa6?*\x80\x08F\xa0\x01\x1a\xf9]\
|
||||
\x0f\x00\x9b\xde`\xb2' ))
|
||||
|
||||
def getTreeMenuBarBitmap():
|
||||
return wxBitmapFromXPMData(getTreeMenuBarData())
|
||||
|
||||
def getTreeMenuBarImage():
|
||||
return wxImageFromBitmap(getTreeMenuBarBitmap())
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getTreeToolBarData():
|
||||
return cPickle.loads(zlib.decompress(
|
||||
'x\xda\xd3\xc8)0\xe4\nV74S\x00"\x0b\x05Cu\xae\xc4`\xf5\x08\x85d\x05\xa7\x9c\
|
||||
\xc4\xe4l0\xcf\x1f\xc8S\xb64\xb04\xb14\x00\xf3\x1d@|7\x0b7g\x03\x08_\x19\xc4\
|
||||
70\x80\xf3\x15\x80|\xbf\xfc\xbcT0G\x0f\xa6\xd8\xcd\x02\xcc\xd7\x86\xf0\r\x0c\
|
||||
\xa0\x8a\xf3A|\x17\x03\x17\x13\x17\x98fT@\rA=T\x10\x01\x11\xccG\x06\xfe0Am\
|
||||
\xed\x88|\x07\x87\x88|e\xe5\x08\x02\x82\x11\x11\x11p\xec\x8f\xc7L\x7fT\x00\
|
||||
\x11\x8c@\x034\xf2\xbb\x1e\x00\x1c\x05j\x12' ))
|
||||
|
||||
def getTreeToolBarBitmap():
|
||||
return wxBitmapFromXPMData(getTreeToolBarData())
|
||||
|
||||
def getTreeToolBarImage():
|
||||
return wxImageFromBitmap(getTreeToolBarBitmap())
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getTreeMenuData():
|
||||
return cPickle.loads(zlib.decompress(
|
||||
'x\xda\xd3\xc8)0\xe4\nV74S\x00"S\x05Cu\xae\xc4`\xf5\x08\x85d\x05\xa7\x9c\xc4\
|
||||
\xe4l0\xcf\x1f\xc8S\xb64\xb04\xb14\x00\xf3\x15\x80|\xbf\xfc\xbcT0G\x0f$\xe9f\
|
||||
\xe1\xe6\xecf\x01\xe6\xe7\x83\xf8.\x06.&.0\xc5\nzp\x10\xa1\xa0\x00\x17\xcc\
|
||||
\x87\x02\x7f\x14A\x7f0 [p(\x9b\xe9\x0f\x03H\x82\x11\x08\x00\x16\xd4\x03\x00&\
|
||||
sj\xf9' ))
|
||||
|
||||
def getTreeMenuBitmap():
|
||||
return wxBitmapFromXPMData(getTreeMenuData())
|
||||
|
||||
def getTreeMenuImage():
|
||||
return wxImageFromBitmap(getTreeMenuBitmap())
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getTreeSizerHData():
|
||||
return cPickle.loads(zlib.decompress(
|
||||
'x\xda\xd3\xc8)0\xe4\nV74S\x00"#\x05Cu\xae\xc4`u=\x85d\x05e3\x033\x133\x030_\
|
||||
\x01\xc8\xf7\xcb\xcfK\x85rP\x01\xa9\x82z\xa8\x00*\x08Q\x01\xa3\x06\xaf 6\xc7\
|
||||
S\x12 z\x00\xf8\xc9>T' ))
|
||||
|
||||
def getTreeSizerHBitmap():
|
||||
return wxBitmapFromXPMData(getTreeSizerHData())
|
||||
|
||||
def getTreeSizerHImage():
|
||||
return wxImageFromBitmap(getTreeSizerHBitmap())
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getTreeSizerVData():
|
||||
return cPickle.loads(zlib.decompress(
|
||||
'x\xda\xd3\xc8)0\xe4\nV74S\x00"#\x05Cu\xae\xc4`u=\x85d\x05e3\x033\x133\x030_\
|
||||
\x01\xc8\xf7\xcb\xcfK\x85r\x14\x14\xf4`\x00\xc8F\x08*@\xc0\x00\t\x0e\x11\'!\
|
||||
\x03\xa0\xa0\x1e\x00\xfaC>*' ))
|
||||
|
||||
def getTreeSizerVBitmap():
|
||||
return wxBitmapFromXPMData(getTreeSizerVData())
|
||||
|
||||
def getTreeSizerVImage():
|
||||
return wxImageFromBitmap(getTreeSizerVBitmap())
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getTreeStaticBoxSizerHData():
|
||||
return cPickle.loads(zlib.decompress(
|
||||
'x\xda\xd3\xc8)0\xe4\nV74S\x00"c\x05Cu\xae\xc4`u=\x85d\x05\xa7\x9c\xc4\xe4l0\
|
||||
/\x02\xc8S630313\x00\xf3\x15\x80|\xbf\xfc\xbcT(\x07\x15\xc0\x05\xf5\xb0\x08\
|
||||
\xea!\x8bB\x04#\x14\xf4\xf4\xf4\x14"`\x00.\x08R\x19\x01Q\x08\x17\x84\xf0\x06\
|
||||
\x93 *\xc0\x1f \xc4\x08\xea\x01\x00\x0b\xa9Jm' ))
|
||||
|
||||
def getTreeStaticBoxSizerHBitmap():
|
||||
return wxBitmapFromXPMData(getTreeStaticBoxSizerHData())
|
||||
|
||||
def getTreeStaticBoxSizerHImage():
|
||||
return wxImageFromBitmap(getTreeStaticBoxSizerHBitmap())
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getTreeStaticBoxSizerVData():
|
||||
return cPickle.loads(zlib.decompress(
|
||||
'x\xda\xd3\xc8)0\xe4\nV74S\x00"c\x05Cu\xae\xc4`u=\x85d\x05\xa7\x9c\xc4\xe4l0\
|
||||
/\x02\xc8S630313\x00\xf3\x15\x80|\xbf\xfc\xbcT(\x07\x0c\xf4\xa0\xb4\x02\x92\
|
||||
\xa0\x1e\\\x14.\x18\xa1\xa0\xa7\xa7\xa7\x10\x11\x11\x81&\x08V\x89&\x08\x01\
|
||||
\xb4\x17\x84\x81\xc1`\xbb\x1e\x00U+IU' ))
|
||||
|
||||
def getTreeStaticBoxSizerVBitmap():
|
||||
return wxBitmapFromXPMData(getTreeStaticBoxSizerVData())
|
||||
|
||||
def getTreeStaticBoxSizerVImage():
|
||||
return wxImageFromBitmap(getTreeStaticBoxSizerVBitmap())
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getTreeSizerGridData():
|
||||
return cPickle.loads(zlib.decompress(
|
||||
'x\xda\xd3\xc8)0\xe4\nV74S\x00"#\x05Cu\xae\xc4`u=\x85d\x05e3\x033\x133\x030_\
|
||||
\x01\xc8\xf7\xcb\xcfK\x85p\xf4P\x01TP\x01\x0c`\x14\xbd\x05\x87\x88\x93\xd0\
|
||||
\x00PP\x0f\x00!\xb1?\xce' ))
|
||||
|
||||
def getTreeSizerGridBitmap():
|
||||
return wxBitmapFromXPMData(getTreeSizerGridData())
|
||||
|
||||
def getTreeSizerGridImage():
|
||||
return wxImageFromBitmap(getTreeSizerGridBitmap())
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getTreeSizerFlexGridData():
|
||||
return cPickle.loads(zlib.decompress(
|
||||
'x\xda\xd3\xc8)0\xe4\nV74S\x00"#\x05Cu\xae\xc4`u=\x85d\x05e3\x033\x133\x030_\
|
||||
\x01\xc8\xf7\xcb\xcfK\x85p\xf4P\x01TP\x01\x08\xc0\x04\x98A\x1dA\xbaYD/\xc7\
|
||||
\xa3\x01\xa0\xa0\x1e\x00>\x91?\xce' ))
|
||||
|
||||
def getTreeSizerFlexGridBitmap():
|
||||
return wxBitmapFromXPMData(getTreeSizerFlexGridData())
|
||||
|
||||
def getTreeSizerFlexGridImage():
|
||||
return wxImageFromBitmap(getTreeSizerFlexGridBitmap())
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
python2.2 YOUR_PATH_TO_XRCED/xrced.py $*
|
||||
@@ -0,0 +1,235 @@
|
||||
<?xml version="1.0" ?>
|
||||
<resource>
|
||||
<object class="wxDialog" name="DIALOG_CONTENT">
|
||||
<title>Content</title>
|
||||
<size>250,300</size>
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxVERTICAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxHORIZONTAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxListBox" name="LIST">
|
||||
<content/>
|
||||
</object>
|
||||
<option>1</option>
|
||||
<flag>wxTOP|wxBOTTOM|wxLEFT|wxEXPAND</flag>
|
||||
<border>5</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxVERTICAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_UP">
|
||||
<label>Move Up</label>
|
||||
</object>
|
||||
<flag>wxBOTTOM</flag>
|
||||
<border>5</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_DOWN">
|
||||
<label>Move Down</label>
|
||||
</object>
|
||||
</object>
|
||||
<object class="spacer">
|
||||
<size>10,20</size>
|
||||
<option>1</option>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_APPEND">
|
||||
<label>Append...</label>
|
||||
</object>
|
||||
<flag>wxBOTTOM</flag>
|
||||
<border>5</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_REMOVE">
|
||||
<label>Remove</label>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<flag>wxALL|wxEXPAND</flag>
|
||||
<border>5</border>
|
||||
</object>
|
||||
</object>
|
||||
<option>1</option>
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxStaticLine"/>
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxHORIZONTAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="wxID_OK">
|
||||
<label>OK</label>
|
||||
<default>1</default>
|
||||
</object>
|
||||
<flag>wxRIGHT</flag>
|
||||
<border>10</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="wxID_CANCEL">
|
||||
<label>Cancel</label>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<flag>wxALL|wxALIGN_CENTRE_HORIZONTAL</flag>
|
||||
<border>10</border>
|
||||
</object>
|
||||
</object>
|
||||
<style>wxRESIZE_BORDER</style>
|
||||
</object>
|
||||
<object class="wxDialog" name="DIALOG_CONTENT_CHECK_LIST">
|
||||
<title>Content</title>
|
||||
<size>250,300</size>
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxVERTICAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxHORIZONTAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxCheckList" name="CHECK_LIST">
|
||||
<content/>
|
||||
</object>
|
||||
<option>1</option>
|
||||
<flag>wxTOP|wxBOTTOM|wxLEFT|wxEXPAND</flag>
|
||||
<border>5</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxVERTICAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_UP">
|
||||
<label>Move Up</label>
|
||||
</object>
|
||||
<flag>wxBOTTOM</flag>
|
||||
<border>5</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_DOWN">
|
||||
<label>Move Down</label>
|
||||
</object>
|
||||
</object>
|
||||
<object class="spacer">
|
||||
<size>10,20</size>
|
||||
<option>1</option>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_APPEND">
|
||||
<label>Append...</label>
|
||||
</object>
|
||||
<flag>wxBOTTOM</flag>
|
||||
<border>5</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_REMOVE">
|
||||
<label>Remove</label>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<flag>wxALL|wxEXPAND</flag>
|
||||
<border>5</border>
|
||||
</object>
|
||||
</object>
|
||||
<option>1</option>
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxStaticLine"/>
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxHORIZONTAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="wxID_OK">
|
||||
<label>OK</label>
|
||||
<default>1</default>
|
||||
</object>
|
||||
<flag>wxRIGHT</flag>
|
||||
<border>10</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="wxID_CANCEL">
|
||||
<label>Cancel</label>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<flag>wxALL|wxALIGN_CENTRE_HORIZONTAL</flag>
|
||||
<border>10</border>
|
||||
</object>
|
||||
</object>
|
||||
<style>wxRESIZE_BORDER</style>
|
||||
</object>
|
||||
<object class="wxDialog" name="DIALOG_INTLIST">
|
||||
<title>Numbers</title>
|
||||
<size>100,300</size>
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxVERTICAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxVERTICAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxListBox" name="LIST">
|
||||
<content/>
|
||||
<size>80,100</size>
|
||||
<style>wxLB_SORT</style>
|
||||
</object>
|
||||
<option>1</option>
|
||||
<flag>wxALL|wxALIGN_CENTRE_HORIZONTAL</flag>
|
||||
<border>10</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxVERTICAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_ADD">
|
||||
<label>Add...</label>
|
||||
</object>
|
||||
<flag>wxBOTTOM</flag>
|
||||
<border>3</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_REMOVE">
|
||||
<label>Remove</label>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<flag>wxALL|wxALIGN_CENTRE_HORIZONTAL</flag>
|
||||
<border>5</border>
|
||||
</object>
|
||||
</object>
|
||||
<option>1</option>
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxStaticLine"/>
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxVERTICAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="wxID_OK">
|
||||
<label>OK</label>
|
||||
<default>1</default>
|
||||
</object>
|
||||
<flag>wxBOTTOM</flag>
|
||||
<border>5</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="wxID_CANCEL">
|
||||
<label>Cancel</label>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<flag>wxALL|wxALIGN_CENTRE_HORIZONTAL</flag>
|
||||
<border>10</border>
|
||||
</object>
|
||||
</object>
|
||||
<style>wxRESIZE_BORDER</style>
|
||||
</object>
|
||||
</resource>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,4 @@
|
||||
#
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
"""
|
||||
Common routines for the image converter utilities.
|
||||
"""
|
||||
import sys, os, glob, getopt, string
|
||||
from wxPython.wx import *
|
||||
|
||||
wxInitAllImageHandlers()
|
||||
|
||||
def convert(file, maskClr, outputDir, outputName, outType, outExt):
|
||||
if string.lower(os.path.splitext(file)[1]) == ".ico":
|
||||
icon = wxIcon(file, wxBITMAP_TYPE_ICO)
|
||||
img = wxBitmapFromIcon(icon)
|
||||
else:
|
||||
img = wxBitmap(file, wxBITMAP_TYPE_ANY)
|
||||
|
||||
if not img.Ok():
|
||||
return 0, file + " failed to load!"
|
||||
else:
|
||||
if maskClr:
|
||||
om = img.GetMask()
|
||||
mask = wxMaskColour(img, maskClr)
|
||||
img.SetMask(mask)
|
||||
if om is not None:
|
||||
om.Destroy()
|
||||
if outputName:
|
||||
newname = outputName
|
||||
else:
|
||||
newname = os.path.join(outputDir,
|
||||
os.path.basename(os.path.splitext(file)[0]) + outExt)
|
||||
if img.SaveFile(newname, outType):
|
||||
return 1, file + " converted to " + newname
|
||||
else:
|
||||
img = wxImageFromBitmap(img)
|
||||
if img.SaveFile(newname, outType):
|
||||
return 1, "ok"
|
||||
else:
|
||||
return 0, file + " failed to save!"
|
||||
|
||||
|
||||
|
||||
|
||||
def main(args, outType, outExt, doc):
|
||||
if not args or ("-h" in args):
|
||||
print doc
|
||||
return
|
||||
|
||||
outputDir = ""
|
||||
maskClr = None
|
||||
outputName = None
|
||||
|
||||
try:
|
||||
opts, fileArgs = getopt.getopt(args, "m:n:o:")
|
||||
except getopt.GetoptError:
|
||||
print __doc__
|
||||
return
|
||||
|
||||
for opt, val in opts:
|
||||
if opt == "-m":
|
||||
maskClr = val
|
||||
elif opt == "-n":
|
||||
outputName = val
|
||||
elif opt == "-o":
|
||||
outputDir = val
|
||||
|
||||
if not fileArgs:
|
||||
print doc
|
||||
return
|
||||
|
||||
for arg in fileArgs:
|
||||
for file in glob.glob(arg):
|
||||
if not os.path.isfile(file):
|
||||
continue
|
||||
ok, msg = convert(file, maskClr, outputDir, outputName,
|
||||
outType, outExt)
|
||||
print msg
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
img2png.py -- convert several image formats to PNG format
|
||||
|
||||
Usage:
|
||||
|
||||
img2png.py [options] image_files...
|
||||
|
||||
Options:
|
||||
|
||||
-o <dir> The directory to place the .png file(s), defaults to
|
||||
the current directory.
|
||||
|
||||
-m <#rrggbb> If the original image has a mask or transparency defined
|
||||
it will be used by default. You can use this option to
|
||||
override the default or provide a new mask by specifying
|
||||
a colour in the image to mark as transparent.
|
||||
|
||||
-n <name> A filename to write the .png data to. Defaults to the
|
||||
basename of the image file + '.png' This option overrides
|
||||
the -o option.
|
||||
"""
|
||||
|
||||
|
||||
import sys
|
||||
import img2img
|
||||
from wxPython import wx
|
||||
|
||||
def main():
|
||||
img2img.main(sys.argv[1:], wx.wxBITMAP_TYPE_PNG, ".png", __doc__)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,190 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
img2py.py -- Convert an image to PNG format and embed it in a Python
|
||||
module with appropriate code so it can be loaded into
|
||||
a program at runtime. The benefit is that since it is
|
||||
Python source code it can be delivered as a .pyc or
|
||||
'compiled' into the program using freeze, py2exe, etc.
|
||||
|
||||
Usage:
|
||||
|
||||
img2py.py [options] image_file python_file
|
||||
|
||||
Options:
|
||||
|
||||
-m <#rrggbb> If the original image has a mask or transparency defined
|
||||
it will be used by default. You can use this option to
|
||||
override the default or provide a new mask by specifying
|
||||
a colour in the image to mark as transparent.
|
||||
|
||||
-n <name> Normally generic names (getBitmap, etc.) are used for the
|
||||
image access functions. If you use this option you can
|
||||
specify a name that should be used to customize the access
|
||||
fucntions, (getNameBitmap, etc.)
|
||||
|
||||
-a This flag specifies that the python_file should be appended
|
||||
to instead of overwritten. This in combination with -n will
|
||||
allow you to put multiple images in one Python source file.
|
||||
|
||||
-u Don't use compression. Leaves the data uncompressed.
|
||||
|
||||
-i Also output a function to return the image as a wxIcon.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
|
||||
import sys, os, glob, getopt, tempfile, string
|
||||
import cPickle, cStringIO, zlib
|
||||
import img2img
|
||||
from wxPython import wx
|
||||
|
||||
|
||||
def crunch_data(data, compressed):
|
||||
# compress it?
|
||||
if compressed:
|
||||
data = zlib.compress(data, 9)
|
||||
|
||||
# convert to a printable format, so it can be in a Python source file
|
||||
data = repr(data)
|
||||
|
||||
# This next bit is borrowed from PIL. It is used to wrap the text intelligently.
|
||||
fp = cStringIO.StringIO()
|
||||
data = data + " " # buffer for the +1 test
|
||||
c = i = 0
|
||||
word = ""
|
||||
octdigits = "01234567"
|
||||
hexdigits = "0123456789abcdef"
|
||||
while i < len(data):
|
||||
if data[i] != "\\":
|
||||
word = data[i]
|
||||
i = i + 1
|
||||
else:
|
||||
if data[i+1] in octdigits:
|
||||
for n in range(2, 5):
|
||||
if data[i+n] not in octdigits:
|
||||
break
|
||||
word = data[i:i+n]
|
||||
i = i + n
|
||||
elif data[i+1] == 'x':
|
||||
for n in range(2, 5):
|
||||
if data[i+n] not in hexdigits:
|
||||
break
|
||||
word = data[i:i+n]
|
||||
i = i + n
|
||||
else:
|
||||
word = data[i:i+2]
|
||||
i = i + 2
|
||||
|
||||
l = len(word)
|
||||
if c + l >= 78-1:
|
||||
fp.write("\\\n")
|
||||
c = 0
|
||||
fp.write(word)
|
||||
c = c + l
|
||||
|
||||
# return the formatted compressed data
|
||||
return fp.getvalue()
|
||||
|
||||
|
||||
|
||||
def main(args):
|
||||
if not args or ("-h" in args):
|
||||
print __doc__
|
||||
return
|
||||
|
||||
append = 0
|
||||
compressed = 1
|
||||
maskClr = None
|
||||
imgName = ""
|
||||
icon = 0
|
||||
|
||||
try:
|
||||
opts, fileArgs = getopt.getopt(args, "auin:m:")
|
||||
except getopt.GetoptError:
|
||||
print __doc__
|
||||
return
|
||||
|
||||
for opt, val in opts:
|
||||
if opt == "-a":
|
||||
append = 1
|
||||
elif opt == "-u":
|
||||
compressed = 0
|
||||
elif opt == "-n":
|
||||
imgName = val
|
||||
elif opt == "-m":
|
||||
maskClr = val
|
||||
elif opt == "-i":
|
||||
icon = 1
|
||||
|
||||
if len(fileArgs) != 2:
|
||||
print __doc__
|
||||
return
|
||||
|
||||
image_file, python_file = fileArgs
|
||||
|
||||
# convert the image file to a temporary file
|
||||
tfname = tempfile.mktemp()
|
||||
ok, msg = img2img.convert(image_file, maskClr, None, tfname, wx.wxBITMAP_TYPE_PNG, ".png")
|
||||
if not ok:
|
||||
print msg
|
||||
return
|
||||
|
||||
data = open(tfname, "rb").read()
|
||||
data = crunch_data(data, compressed)
|
||||
os.unlink(tfname)
|
||||
|
||||
if append:
|
||||
out = open(python_file, "a")
|
||||
else:
|
||||
out = open(python_file, "w")
|
||||
|
||||
out.write("#" + "-" * 70 + "\n")
|
||||
if not append:
|
||||
out.write("# This file was generated by %s\n#\n" % sys.argv[0])
|
||||
out.write("from wxPython.wx import wxImageFromStream, wxBitmapFromImage\n")
|
||||
if icon:
|
||||
out.write("from wxPython.wx import wxEmptyIcon\n")
|
||||
if compressed:
|
||||
out.write("import cStringIO, zlib\n\n\n")
|
||||
else:
|
||||
out.write("import cStringIO\n\n\n")
|
||||
|
||||
if compressed:
|
||||
out.write("def get%sData():\n"
|
||||
" return zlib.decompress(\n%s)\n\n"
|
||||
% (imgName, data))
|
||||
else:
|
||||
out.write("def get%sData():\n"
|
||||
" return %s\n\n"
|
||||
% (imgName, data))
|
||||
|
||||
|
||||
out.write("def get%sBitmap():\n"
|
||||
" return wxBitmapFromImage(get%sImage())\n\n"
|
||||
"def get%sImage():\n"
|
||||
" stream = cStringIO.StringIO(get%sData())\n"
|
||||
" return wxImageFromStream(stream)\n\n"
|
||||
% tuple([imgName] * 4))
|
||||
if icon:
|
||||
out.write("def get%sIcon():\n"
|
||||
" icon = wxEmptyIcon()\n"
|
||||
" icon.CopyFromBitmap(get%sBitmap())\n"
|
||||
" return icon\n\n"
|
||||
% tuple([imgName] * 2))
|
||||
|
||||
|
||||
if imgName:
|
||||
n_msg = ' using "%s"' % imgName
|
||||
else:
|
||||
n_msg = ""
|
||||
if maskClr:
|
||||
m_msg = " with mask %s" % maskClr
|
||||
else:
|
||||
m_msg = ""
|
||||
print "Embedded %s%s into %s%s" % (image_file, n_msg, python_file, m_msg)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1:])
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
img2xpm.py -- convert several image formats to XPM
|
||||
|
||||
Usage:
|
||||
|
||||
img2xpm.py [options] image_files...
|
||||
|
||||
Options:
|
||||
|
||||
-o <dir> The directory to place the .xpm file(s), defaults to
|
||||
the current directory.
|
||||
|
||||
-m <#rrggbb> If the original image has a mask or transparency defined
|
||||
it will be used by default. You can use this option to
|
||||
override the default or provide a new mask by specifying
|
||||
a colour in the image to mark as transparent.
|
||||
|
||||
-n <name> A filename to write the .xpm data to. Defaults to the
|
||||
basename of the image file + '.xpm' This option overrides
|
||||
the -o option.
|
||||
"""
|
||||
|
||||
|
||||
import sys
|
||||
import img2img
|
||||
from wxPython import wx
|
||||
|
||||
def main():
|
||||
img2img.main(sys.argv[1:], wx.wxBITMAP_TYPE_XPM, ".xpm", __doc__)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user