This commit was manufactured by cvs2svn to create tag 'wxPy_2_5_3_1'.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/tags/wxPy_2_5_3_1@30405 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -39,8 +39,8 @@ import distutils.command.clean
|
||||
VER_MAJOR = 2 # The first three must match wxWidgets
|
||||
VER_MINOR = 5
|
||||
VER_RELEASE = 3
|
||||
VER_SUBREL = 0 # wxPython release num for x.y.z release of wxWidgets
|
||||
VER_FLAGS = "p" # release flags, such as prerelease num, unicode, etc.
|
||||
VER_SUBREL = 1 # wxPython release num for x.y.z release of wxWidgets
|
||||
VER_FLAGS = "" # release flags, such as prerelease num, unicode, etc.
|
||||
|
||||
DESCRIPTION = "Cross platform GUI toolkit for Python"
|
||||
AUTHOR = "Robin Dunn"
|
||||
@@ -135,9 +135,10 @@ INSTALL_MULTIVERSION = 1 # Install the packages such that multiple versions
|
||||
FLAVOUR = "" # Optional flavour string to be appended to VERSION
|
||||
# in MULTIVERSION installs
|
||||
|
||||
EP_ADD_OPTS = 0 # When doing MULTIVERSION installs the wx port and
|
||||
EP_ADD_OPTS = 1 # When doing MULTIVERSION installs the wx port and
|
||||
# ansi/unicode settings can optionally be added to the
|
||||
# subdir path used in site-packages
|
||||
# subdir path used in site-packages
|
||||
|
||||
|
||||
WX_CONFIG = None # Usually you shouldn't need to touch this, but you can set
|
||||
# it to pass an alternate version of wx-config or alternate
|
||||
@@ -567,8 +568,8 @@ def getExtraPath(shortVer=True, addOpts=False):
|
||||
ep = "wx-%d.%d" % (VER_MAJOR, VER_MINOR)
|
||||
|
||||
# plus release if minor is odd
|
||||
#if VER_MINOR % 2 == 1:
|
||||
# ep += ".%d" % VER_RELEASE
|
||||
if VER_MINOR % 2 == 1:
|
||||
ep += ".%d" % VER_RELEASE
|
||||
|
||||
else:
|
||||
# long version, full version
|
||||
@@ -605,7 +606,7 @@ if debug:
|
||||
if FINAL:
|
||||
HYBRID = 0
|
||||
|
||||
if UNICODE and WXPORT not in ['msw', 'gtk2']:
|
||||
if UNICODE and WXPORT not in ['msw', 'gtk2', 'mac']:
|
||||
raise SystemExit, "UNICODE mode not currently supported on this WXPORT: "+WXPORT
|
||||
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ cellpadding="0" border="1">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<h1>wxPython %s</h1>
|
||||
(%s)<br>
|
||||
Running on Python %s<br>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -29,7 +30,7 @@ sit back and enjoy. Be sure to take a peek at the source code for each
|
||||
demo item so you can learn how to use the classes yourself.</p>
|
||||
|
||||
<p><b>wxPython</b> is brought to you by <b>Robin Dunn</b> and<br>
|
||||
<b>Total Control Software,</b> Copyright (c) 1997-2003.</p>
|
||||
<b>Total Control Software,</b> Copyright (c) 1997-2004.</p>
|
||||
|
||||
<p>
|
||||
<font size="-1">Please see <i>license.txt</i> for licensing information.</font>
|
||||
@@ -49,7 +50,10 @@ demo item so you can learn how to use the classes yourself.</p>
|
||||
if "gtk2" in wx.PlatformInfo:
|
||||
html.SetStandardFonts()
|
||||
py_version = sys.version.split()[0]
|
||||
html.SetPage(self.text % (wx.VERSION_STRING, py_version))
|
||||
html.SetPage(self.text % (wx.VERSION_STRING,
|
||||
", ".join(wx.PlatformInfo[1:]),
|
||||
py_version
|
||||
))
|
||||
btn = html.FindWindowById(wx.ID_OK)
|
||||
ir = html.GetInternalRepresentation()
|
||||
html.SetSize( (ir.GetWidth()+25, ir.GetHeight()+25) )
|
||||
|
||||
@@ -68,10 +68,10 @@ def runTest(frame, nb, log):
|
||||
win = TestPanel(nb, log)
|
||||
return win
|
||||
else:
|
||||
dlg = wx.MessageDialog(frame, 'This demo only works on MSW.',
|
||||
'Sorry', wx.OK | wx.ICON_INFORMATION)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
from Main import MessagePanel
|
||||
win = MessagePanel(nb, 'This demo only works on Microsoft Windows.',
|
||||
'Sorry', wx.ICON_WARNING)
|
||||
return win
|
||||
|
||||
|
||||
overview = """\
|
||||
|
||||
@@ -191,10 +191,10 @@ def runTest(frame, nb, log):
|
||||
win = TestPanel(nb, log, frame)
|
||||
return win
|
||||
else:
|
||||
dlg = wx.MessageDialog(frame, 'This demo only works on Windows.',
|
||||
'Sorry', wx.OK | wx.ICON_INFORMATION)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
from Main import MessagePanel
|
||||
win = MessagePanel(nb, 'This demo only works on Microsoft Windows.',
|
||||
'Sorry', wx.ICON_WARNING)
|
||||
return win
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -67,10 +67,10 @@ def runTest(frame, nb, log):
|
||||
win = TestPanel(nb, log)
|
||||
return win
|
||||
else:
|
||||
dlg = wx.MessageDialog(frame, 'This demo only works on MSW.',
|
||||
'Sorry', wx.OK | wx.ICON_INFORMATION)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
from Main import MessagePanel
|
||||
win = MessagePanel(nb, 'This demo only works on Microsoft Windows.',
|
||||
'Sorry', wx.ICON_WARNING)
|
||||
return win
|
||||
|
||||
|
||||
overview = """\
|
||||
|
||||
@@ -92,8 +92,10 @@ class SimpleView(wx.Panel):
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
if wx.Platform == "__WXMAC__":
|
||||
wx.MessageBox("This demo currently fails on the Mac. The problem is being looked into...", "Sorry")
|
||||
return
|
||||
from Main import MessagePanel
|
||||
win = MessagePanel(nb, 'This demo currently fails on the Mac. The problem is being looked into...',
|
||||
'Sorry', wx.ICON_WARNING)
|
||||
return win
|
||||
|
||||
if 1:
|
||||
win = gizmos.DynamicSashWindow(nb, -1, style = wx.CLIP_CHILDREN
|
||||
|
||||
@@ -93,7 +93,7 @@ class TestPanel(wx.Panel):
|
||||
if wx.Platform == "__WXMAC__":
|
||||
dlg = wx.MessageDialog(
|
||||
self, 'FloatBar does not work well on this platform.',
|
||||
'Sorry', wx.OK | wx.ICON_INFORMATION
|
||||
'Sorry', wx.OK | wx.ICON_WARNING
|
||||
)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
|
||||
@@ -53,7 +53,7 @@ class ButtonPanel(wx.Panel):
|
||||
if not haveGLCanvas:
|
||||
dlg = wx.MessageDialog(self,
|
||||
'The GLCanvas class has not been included with this build of wxPython!',
|
||||
'Sorry', wx.OK | wx.ICON_INFORMATION)
|
||||
'Sorry', wx.OK | wx.ICON_WARNING)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
|
||||
@@ -61,7 +61,7 @@ class ButtonPanel(wx.Panel):
|
||||
dlg = wx.MessageDialog(self,
|
||||
'The OpenGL package was not found. You can get it at\n'
|
||||
'http://PyOpenGL.sourceforge.net/',
|
||||
'Sorry', wx.OK | wx.ICON_INFORMATION)
|
||||
'Sorry', wx.OK | wx.ICON_WARNING)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
|
||||
|
||||
@@ -12,7 +12,10 @@ static text is positioned at (0,0) and it spans 7 columns.
|
||||
class TestFrame(wx.Frame):
|
||||
def __init__(self):
|
||||
wx.Frame.__init__(self, None, -1, "wx.GridBagSizer")
|
||||
p = wx.Panel(self, -1)
|
||||
p = wx.Panel(self, -1, style = wx.TAB_TRAVERSAL
|
||||
| wx.CLIP_CHILDREN
|
||||
| wx.FULL_REPAINT_ON_RESIZE
|
||||
)
|
||||
p.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
|
||||
|
||||
gbs = self.gbs = wx.GridBagSizer(5, 5)
|
||||
|
||||
@@ -14,7 +14,7 @@ class SimpleGrid(gridlib.Grid): ##, mixins.GridAutoEditMixin):
|
||||
|
||||
self.Bind(wx.EVT_IDLE, self.OnIdle)
|
||||
|
||||
self.CreateGrid(25, 25) #, wxGrid.wxGridSelectRows)
|
||||
self.CreateGrid(25, 25)#, gridlib.Grid.SelectRows)
|
||||
##self.EnableEditing(False)
|
||||
|
||||
# simple cell formatting
|
||||
|
||||
@@ -994,12 +994,10 @@ def runTest(frame, nb, log):
|
||||
win = JoystickDemoPanel(nb, log)
|
||||
return win
|
||||
else:
|
||||
dlg = wx.MessageDialog(
|
||||
frame, 'wx.Joystick is not available on this platform.',
|
||||
'Sorry', wx.OK | wx.ICON_INFORMATION
|
||||
)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
from Main import MessagePanel
|
||||
win = MessagePanel(nb, 'wx.Joystick is not available on this platform.',
|
||||
'Sorry', wx.ICON_WARNING)
|
||||
return win
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
@@ -40,7 +40,8 @@ class AnchorsDemoFrame(wx.Frame):
|
||||
self.mainPanel = wx.Panel(
|
||||
size=(320, 160), parent=self,
|
||||
id=ID_ANCHORSDEMOFRAMEMAINPANEL, name='panel1',
|
||||
style=wx.TAB_TRAVERSAL | wx.CLIP_CHILDREN,
|
||||
style=wx.TAB_TRAVERSAL | wx.CLIP_CHILDREN
|
||||
| wx.FULL_REPAINT_ON_RESIZE,
|
||||
pos=(0, 0)
|
||||
)
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ class TestListCtrlPanel(wx.Panel, listmix.ColumnSorterMixin):
|
||||
self.PopulateList()
|
||||
|
||||
# Now that the list exists we can init the other base class,
|
||||
# see wxPython/lib/mixins/listctrl.py
|
||||
# see wx/lib/mixins/listctrl.py
|
||||
self.itemDataMap = musicdata
|
||||
listmix.ColumnSorterMixin.__init__(self, 3)
|
||||
#self.SortListItems(0, True)
|
||||
@@ -190,11 +190,11 @@ class TestListCtrlPanel(wx.Panel, listmix.ColumnSorterMixin):
|
||||
self.currentItem = 0
|
||||
|
||||
|
||||
# Used by the ColumnSorterMixin, see wxPython/lib/mixins/listctrl.py
|
||||
# Used by the ColumnSorterMixin, see wx/lib/mixins/listctrl.py
|
||||
def GetListCtrl(self):
|
||||
return self.list
|
||||
|
||||
# Used by the ColumnSorterMixin, see wxPython/lib/mixins/listctrl.py
|
||||
# Used by the ColumnSorterMixin, see wx/lib/mixins/listctrl.py
|
||||
def GetSortImages(self):
|
||||
return (self.sm_dn, self.sm_up)
|
||||
|
||||
|
||||
141
wxPython/demo/ListCtrl_edit.py
Normal file
141
wxPython/demo/ListCtrl_edit.py
Normal file
@@ -0,0 +1,141 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# Name: ListCtrl_edit.py
|
||||
# Purpose: Testing editing a ListCtrl
|
||||
#
|
||||
# Author: Pim van Heuven
|
||||
#
|
||||
# Created: 2004/10/15
|
||||
# Copyright: (c) Pim Van Heuven
|
||||
# Licence: wxWindows license
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
import sys
|
||||
import wx
|
||||
import wx.lib.mixins.listctrl as listmix
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
listctrldata = {
|
||||
1 : ("Hey!", "You can edit", "me!"),
|
||||
2 : ("Try changing the contents", "by", "clicking"),
|
||||
3 : ("in", "a", "cell"),
|
||||
4 : ("See how the length columns", "change", "?"),
|
||||
5 : ("You can use", "TAB,", "cursor down,"),
|
||||
6 : ("and cursor up", "to", "navigate"),
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class TestListCtrl(wx.ListCtrl,
|
||||
listmix.ListCtrlAutoWidthMixin,
|
||||
listmix.TextEditMixin):
|
||||
|
||||
def __init__(self, parent, ID, pos=wx.DefaultPosition,
|
||||
size=wx.DefaultSize, style=0):
|
||||
wx.ListCtrl.__init__(self, parent, ID, pos, size, style)
|
||||
|
||||
listmix.ListCtrlAutoWidthMixin.__init__(self)
|
||||
self.Populate()
|
||||
listmix.TextEditMixin.__init__(self)
|
||||
|
||||
def Populate(self):
|
||||
# for normal, simple columns, you can add them like this:
|
||||
self.InsertColumn(0, "Column 1")
|
||||
self.InsertColumn(1, "Column 2")
|
||||
self.InsertColumn(2, "Column 3")
|
||||
self.InsertColumn(3, "Len 1", wx.LIST_FORMAT_RIGHT)
|
||||
self.InsertColumn(4, "Len 2", wx.LIST_FORMAT_RIGHT)
|
||||
self.InsertColumn(5, "Len 3", wx.LIST_FORMAT_RIGHT)
|
||||
|
||||
items = listctrldata.items()
|
||||
for key, data in items:
|
||||
index = self.InsertStringItem(sys.maxint, data[0])
|
||||
self.SetStringItem(index, 0, data[0])
|
||||
self.SetStringItem(index, 1, data[1])
|
||||
self.SetStringItem(index, 2, data[2])
|
||||
self.SetItemData(index, key)
|
||||
|
||||
self.SetColumnWidth(0, wx.LIST_AUTOSIZE)
|
||||
self.SetColumnWidth(1, wx.LIST_AUTOSIZE)
|
||||
self.SetColumnWidth(2, 100)
|
||||
|
||||
self.currentItem = 0
|
||||
|
||||
|
||||
def SetStringItem(self, index, col, data):
|
||||
if col in range(3):
|
||||
wx.ListCtrl.SetStringItem(self, index, col, data)
|
||||
wx.ListCtrl.SetStringItem(self, index, 3+col, str(len(data)))
|
||||
else:
|
||||
try:
|
||||
datalen = int(data)
|
||||
except:
|
||||
return
|
||||
|
||||
wx.ListCtrl.SetStringItem(self, index, col, data)
|
||||
|
||||
data = self.GetItem(index, col-3).GetText()
|
||||
wx.ListCtrl.SetStringItem(self, index, col-3, data[0:datalen])
|
||||
|
||||
|
||||
|
||||
|
||||
class TestListCtrlPanel(wx.Panel):
|
||||
def __init__(self, parent, log):
|
||||
wx.Panel.__init__(self, parent, -1, style=wx.WANTS_CHARS)
|
||||
|
||||
self.log = log
|
||||
tID = wx.NewId()
|
||||
|
||||
self.list = TestListCtrl(self, tID,
|
||||
style=wx.LC_REPORT
|
||||
| wx.BORDER_NONE
|
||||
| wx.LC_SORT_ASCENDING
|
||||
)
|
||||
|
||||
self.Bind(wx.EVT_SIZE, self.OnSize)
|
||||
|
||||
|
||||
def OnSize(self, event):
|
||||
w,h = self.GetClientSizeTuple()
|
||||
self.list.SetDimensions(0, 0, w, h)
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
win = TestListCtrlPanel(nb, log)
|
||||
return win
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
overview = """\
|
||||
<html>
|
||||
<body>
|
||||
|
||||
This demo demonstrates direct editing of all cells of a ListCtrl. To
|
||||
enable it just include the <b>TextEditMixin</b>. The ListCtrl can be
|
||||
navigated with the TAB and up/down cursor keys.
|
||||
|
||||
<p>Another facet of this demo is that the remaining space of the
|
||||
ListCtrls is divided over the first three columns. This is achieved
|
||||
with the extended syntax of <b>ListCtrlAutoWidthMixin</b>:
|
||||
<code>listmix.ListCtrlAutoWidthMixin.__init__(self, startcol, endcol)</code>
|
||||
(Look at the general ListCtrl demo for more information about the
|
||||
ListCtrlAutoWidthMixin)
|
||||
|
||||
<p>Finally, the ListCtrl is automatically scrolled, if needed, when
|
||||
TAB is pressed consecutively (Windows only).
|
||||
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys,os
|
||||
import run
|
||||
run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
|
||||
|
||||
@@ -36,7 +36,7 @@ class TestLB(wx.Listbook):
|
||||
|
||||
# make an image list using the BlomXX images
|
||||
il = wx.ImageList(32, 32)
|
||||
for x in range(1, 15):
|
||||
for x in range(1, 16):
|
||||
f = getattr(images, 'getBlom%02dBitmap' % x)
|
||||
bmp = f()
|
||||
il.Add(bmp)
|
||||
|
||||
@@ -50,6 +50,7 @@ _treeList = [
|
||||
'StockButtons',
|
||||
'Ticker',
|
||||
'Choicebook',
|
||||
'ListCtrl_edit',
|
||||
]),
|
||||
|
||||
# managed windows == things with a (optional) caption you can close
|
||||
@@ -98,6 +99,7 @@ _treeList = [
|
||||
'ListBox',
|
||||
'ListCtrl',
|
||||
'ListCtrl_virtual',
|
||||
'ListCtrl_edit',
|
||||
'Listbook',
|
||||
'Menu',
|
||||
'Notebook',
|
||||
@@ -263,6 +265,60 @@ class MyTP(wx.PyTipProvider):
|
||||
def GetTip(self):
|
||||
return "This is my tip"
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# A class to be used to simply display a message in the demo pane
|
||||
# rather than running the sample itself.
|
||||
|
||||
class MessagePanel(wx.Panel):
|
||||
def __init__(self, parent, message, caption='', flags=0):
|
||||
wx.Panel.__init__(self, parent)
|
||||
|
||||
# Make widgets
|
||||
if flags:
|
||||
artid = None
|
||||
if flags & wx.ICON_EXCLAMATION:
|
||||
artid = wx.ART_WARNING
|
||||
elif flags & wx.ICON_ERROR:
|
||||
artid = wx.ART_ERROR
|
||||
elif flags & wx.ICON_QUESTION:
|
||||
artid = wx.ART_QUESTION
|
||||
elif flags & wx.ICON_INFORMATION:
|
||||
artid = wx.ART_INFORMATION
|
||||
|
||||
if artid is not None:
|
||||
bmp = wx.ArtProvider.GetBitmap(artid, wx.ART_MESSAGE_BOX, (32,32))
|
||||
icon = wx.StaticBitmap(self, -1, bmp)
|
||||
else:
|
||||
icon = (32,32) # make a spacer instead
|
||||
|
||||
if caption:
|
||||
caption = wx.StaticText(self, -1, caption)
|
||||
caption.SetFont(wx.Font(28, wx.SWISS, wx.NORMAL, wx.BOLD))
|
||||
|
||||
message = wx.StaticText(self, -1, message)
|
||||
|
||||
# add to sizers for layout
|
||||
tbox = wx.BoxSizer(wx.VERTICAL)
|
||||
if caption:
|
||||
tbox.Add(caption)
|
||||
tbox.Add((10,10))
|
||||
tbox.Add(message)
|
||||
|
||||
hbox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
hbox.Add((10,10), 1)
|
||||
hbox.Add(icon)
|
||||
hbox.Add((10,10))
|
||||
hbox.Add(tbox)
|
||||
hbox.Add((10,10), 1)
|
||||
|
||||
box = wx.BoxSizer(wx.VERTICAL)
|
||||
box.Add((10,10), 1)
|
||||
box.Add(hbox, 0, wx.EXPAND)
|
||||
box.Add((10,10), 2)
|
||||
|
||||
self.SetSizer(box)
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# A class to be used to display source code in the demo. Try using the
|
||||
@@ -959,8 +1015,9 @@ class DemoTaskBarIcon(wx.TaskBarIcon):
|
||||
self.frame = frame
|
||||
|
||||
# Set the image
|
||||
icon = self.MakeIcon(images.getMondrianImage())
|
||||
icon = self.MakeIcon(images.getWXPdemoImage())
|
||||
self.SetIcon(icon, "wxPython Demo")
|
||||
self.imgidx = 1
|
||||
|
||||
# bind some events
|
||||
self.Bind(wx.EVT_TASKBAR_LEFT_DCLICK, self.OnTaskBarActivate)
|
||||
@@ -992,10 +1049,10 @@ class DemoTaskBarIcon(wx.TaskBarIcon):
|
||||
icon size...
|
||||
"""
|
||||
if "wxMSW" in wx.PlatformInfo:
|
||||
img.Scale(16, 16)
|
||||
img = img.Scale(16, 16)
|
||||
elif "wxGTK" in wx.PlatformInfo:
|
||||
img.Scale(20, 20)
|
||||
# wxMac can be any size upto 128.128....
|
||||
img = img.Scale(22, 22)
|
||||
# wxMac can be any size upto 128x128, so leave the source img alone....
|
||||
icon = wx.IconFromBitmap(img.ConvertToBitmap() )
|
||||
return icon
|
||||
|
||||
@@ -1013,8 +1070,17 @@ class DemoTaskBarIcon(wx.TaskBarIcon):
|
||||
|
||||
|
||||
def OnTaskBarChange(self, evt):
|
||||
icon = self.MakeIcon(images.getBlom10MaskedImage())
|
||||
self.SetIcon(icon, "This is a new icon")
|
||||
names = [ "WXPdemo", "WXP", "Mondrian", "Test2m",
|
||||
"Blom08m", "Blom10m", "Blom15m" ]
|
||||
name = names[self.imgidx]
|
||||
|
||||
getFunc = getattr(images, "get%sImage" % name)
|
||||
self.imgidx += 1
|
||||
if self.imgidx >= len(names):
|
||||
self.imgidx = 0
|
||||
|
||||
icon = self.MakeIcon(getFunc())
|
||||
self.SetIcon(icon, "This is a new icon: " + name)
|
||||
|
||||
|
||||
def OnTaskBarRemove(self, evt):
|
||||
@@ -1029,6 +1095,8 @@ class wxPythonDemo(wx.Frame):
|
||||
wx.Frame.__init__(self, parent, -1, title, size = (950, 720),
|
||||
style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE)
|
||||
|
||||
self.SetMinSize((640,480))
|
||||
|
||||
self.loaded = False
|
||||
self.cwd = os.getcwd()
|
||||
self.curOverview = ""
|
||||
@@ -1037,7 +1105,7 @@ class wxPythonDemo(wx.Frame):
|
||||
self.shell = None
|
||||
self.firstTime = True
|
||||
|
||||
icon = images.getMondrianIcon()
|
||||
icon = images.getWXPdemoIcon()
|
||||
self.SetIcon(icon)
|
||||
|
||||
self.tbicon = DemoTaskBarIcon(self)
|
||||
@@ -1076,7 +1144,7 @@ class wxPythonDemo(wx.Frame):
|
||||
|
||||
item = menu.Append(-1, 'E&xit\tAlt-X', 'Get the heck outta here!')
|
||||
self.Bind(wx.EVT_MENU, self.OnFileExit, item)
|
||||
wx.App_SetMacExitMenuItemId(item.GetId())
|
||||
wx.App.SetMacExitMenuItemId(item.GetId())
|
||||
self.mainmenu.Append(menu, '&File')
|
||||
|
||||
# Make a Demo menu
|
||||
@@ -1116,7 +1184,7 @@ class wxPythonDemo(wx.Frame):
|
||||
'An interactive interpreter window with the demo app and frame objects in the namesapce')
|
||||
menu.AppendSeparator()
|
||||
helpItem = menu.Append(-1, '&About\tCtrl-H', 'wxPython RULES!!!')
|
||||
wx.App_SetMacAboutMenuItemId(helpItem.GetId())
|
||||
wx.App.SetMacAboutMenuItemId(helpItem.GetId())
|
||||
|
||||
self.Bind(wx.EVT_MENU, self.OnOpenShellWindow, shellItem)
|
||||
self.Bind(wx.EVT_MENU, self.OnHelpAbout, helpItem)
|
||||
@@ -1209,8 +1277,8 @@ class wxPythonDemo(wx.Frame):
|
||||
splitter2.SplitHorizontally(self.nb, self.log, -160)
|
||||
splitter.SplitVertically(self.tree, splitter2, 200)
|
||||
|
||||
splitter.SetMinimumPaneSize(20)
|
||||
splitter2.SetMinimumPaneSize(20)
|
||||
splitter.SetMinimumPaneSize(120)
|
||||
splitter2.SetMinimumPaneSize(60)
|
||||
|
||||
# Make the splitter on the right expand the top window when resized
|
||||
def SplitterOnSize(evt):
|
||||
|
||||
@@ -69,9 +69,10 @@ class TestPanel(wx.Panel):
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
if wx.Platform == "__WXMAC__":
|
||||
wx.MessageBox("This demo currently fails on the Mac.",
|
||||
"Sorry")
|
||||
return
|
||||
from Main import MessagePanel
|
||||
win = MessagePanel(nb, 'This demo currently fails on the Mac.',
|
||||
'Sorry', wx.ICON_WARNING)
|
||||
return win
|
||||
else:
|
||||
win = TestPanel(nb, log)
|
||||
return win
|
||||
|
||||
@@ -196,12 +196,10 @@ def runTest(frame, nb, log):
|
||||
win = TestPanel(nb, log)
|
||||
return win
|
||||
else:
|
||||
dlg = wx.MessageDialog(
|
||||
frame, 'wx.PopupWindow is not available on this platform.',
|
||||
'Sorry', wx.OK | wx.ICON_INFORMATION
|
||||
)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
from Main import MessagePanel
|
||||
win = MessagePanel(nb, 'wx.PopupWindow is not available on this platform.',
|
||||
'Sorry', wx.ICON_WARNING)
|
||||
return win
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ class TestPanel(wx.Panel):
|
||||
|
||||
self.log.write("before Play...\n")
|
||||
sound.Play(wx.SOUND_ASYNC)
|
||||
self.sound = sound # save a reference (This shoudln't be needed, but there seems to be a bug...)
|
||||
wx.YieldIfNeeded()
|
||||
self.log.write("...after Play\n")
|
||||
except NotImplementedError, v:
|
||||
@@ -54,11 +55,11 @@ class TestPanel(wx.Panel):
|
||||
style=wx.OPEN)
|
||||
if dlg.ShowModal() == wx.ID_OK:
|
||||
try:
|
||||
#sound = wx.Sound(dlg.GetPath())
|
||||
#sound = wx.Sound(dlg.GetPath(), wx.SOUND_SYNC)
|
||||
#sound.Play()
|
||||
|
||||
# another way to do it.
|
||||
wx.Sound.PlaySound(dlg.GetPath())
|
||||
wx.Sound.PlaySound(dlg.GetPath(), wx.SOUND_SYNC)
|
||||
|
||||
except NotImplementedError, v:
|
||||
wx.MessageBox(str(v), "Exception Message")
|
||||
|
||||
@@ -122,8 +122,10 @@ class TestPanel(wx.Panel):
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
if wx.Platform == "__WXMAC__":
|
||||
wx.MessageBox("This demo currently fails on the Mac. The problem is being looked into...", "Sorry")
|
||||
return
|
||||
from Main import MessagePanel
|
||||
win = MessagePanel(nb, 'This demo currently fails on the Mac. The problem is being looked into...',
|
||||
'Sorry', wx.ICON_WARNING)
|
||||
return win
|
||||
|
||||
win = TestPanel(nb, log)
|
||||
return win
|
||||
|
||||
@@ -185,6 +185,7 @@ def runTest(frame, nb, log):
|
||||
|
||||
ed.GotoPos(ed.GetLength())
|
||||
ed.AddText("\n\nwx.StyledTextCtrl can also do Unicode:\n")
|
||||
uniline = ed.GetCurrentLine()
|
||||
unitext, l = decode('\xd0\x9f\xd0\xb8\xd1\x82\xd0\xbe\xd0\xbd - '
|
||||
'\xd0\xbb\xd1\x83\xd1\x87\xd1\x88\xd0\xb8\xd0\xb9 '
|
||||
'\xd1\x8f\xd0\xb7\xd1\x8b\xd0\xba \xd0\xbf\xd1\x80\xd0\xbe\xd0\xb3\xd1\x80\xd0\xb0\xd0\xbc\xd0\xbc\xd0\xb8\xd1\x80\xd0\xbe\xd0\xb2\xd0\xb0\xd0\xbd\xd0\xb8\xd1\x8f!\n\n')
|
||||
@@ -268,6 +269,12 @@ def runTest(frame, nb, log):
|
||||
print "GetTextRange(25, 35): ", repr(ed.GetTextRange(25, 35))
|
||||
print "FindText(0, max, 'indicators'): ",
|
||||
print ed.FindText(0, ed.GetTextLength(), "indicators")
|
||||
if wx.USE_UNICODE:
|
||||
end = ed.GetLength()
|
||||
start = ed.PositionFromLine(uniline)
|
||||
print "GetTextRange(%d, %d): " % (start, end),
|
||||
print repr(ed.GetTextRange(start, end))
|
||||
|
||||
|
||||
wx.CallAfter(ed.GotoPos, 0)
|
||||
return p
|
||||
|
||||
@@ -161,13 +161,8 @@ class TestPanel(wx.Panel):
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
if wx.Platform == "__WXMAC__":
|
||||
wx.MessageBox("This demo currently fails on the Mac.",
|
||||
"Sorry")
|
||||
return
|
||||
else:
|
||||
win = TestPanel(nb, log)
|
||||
return win
|
||||
win = TestPanel(nb, log)
|
||||
return win
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -34,10 +34,10 @@ def runTest(frame, nb, log):
|
||||
win = TestPanel(nb, log)
|
||||
return win
|
||||
else:
|
||||
dlg = wx.MessageDialog(frame, 'wx.ToggleButton is not available on this platform.',
|
||||
'Sorry', wx.OK | wx.ICON_INFORMATION)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
from Main import MessagePanel
|
||||
win = MessagePanel(nb, 'wx.ToggleButton is not available on this platform.',
|
||||
'Sorry', wx.ICON_WARNING)
|
||||
return win
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
@@ -2,123 +2,99 @@
|
||||
import sys
|
||||
import wx
|
||||
|
||||
py2 = sys.version[0] == '2'
|
||||
|
||||
try:
|
||||
if py2:
|
||||
from xml.parsers import expat
|
||||
parsermodule = expat
|
||||
else:
|
||||
from xml.parsers import pyexpat
|
||||
parsermodule = pyexpat
|
||||
haveXML = True
|
||||
except ImportError:
|
||||
haveXML = False
|
||||
from xml.parsers import expat
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
if not haveXML:
|
||||
def runTest(frame, nb, log):
|
||||
dlg = wx.MessageDialog(
|
||||
frame, 'This demo requires the XML package. '
|
||||
'See http://www.python.org/sigs/xml-sig/',
|
||||
'Sorry', wx.OK | wx.ICON_INFORMATION
|
||||
)
|
||||
class XMLTree(wx.TreeCtrl):
|
||||
def __init__(self, parent, ID):
|
||||
wx.TreeCtrl.__init__(self, parent, ID)
|
||||
self._root = self.AddRoot("Root")
|
||||
self.nodeStack = [self._root]
|
||||
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
# Trees need an image list to do DnD...
|
||||
self.il = wx.ImageList(16,16)
|
||||
self.SetImageList(self.il)
|
||||
|
||||
else:
|
||||
|
||||
class XMLTree(wx.TreeCtrl):
|
||||
def __init__(self, parent, ID):
|
||||
wx.TreeCtrl.__init__(self, parent, ID)
|
||||
self._root = self.AddRoot("Root")
|
||||
self.nodeStack = [self._root]
|
||||
|
||||
# Trees need an image list to do DnD...
|
||||
self.il = wx.ImageList(16,16)
|
||||
self.SetImageList(self.il)
|
||||
|
||||
# event handlers for DnD
|
||||
self.Bind(wx.EVT_TREE_BEGIN_DRAG, self.OnBeginDrag)
|
||||
self.Bind(wx.EVT_TREE_END_DRAG, self.OnEndDrag)
|
||||
# event handlers for DnD
|
||||
self.Bind(wx.EVT_TREE_BEGIN_DRAG, self.OnBeginDrag)
|
||||
self.Bind(wx.EVT_TREE_END_DRAG, self.OnEndDrag)
|
||||
|
||||
|
||||
def OnBeginDrag(self, event):
|
||||
item = event.GetItem()
|
||||
def OnBeginDrag(self, event):
|
||||
item = event.GetItem()
|
||||
|
||||
if item != self.GetRootItem():
|
||||
self.draggingItem = item
|
||||
event.Allow() # if DnD of this item is okay Allow it.
|
||||
if item != self.GetRootItem():
|
||||
self.draggingItem = item
|
||||
event.Allow() # if DnD of this item is okay Allow it.
|
||||
|
||||
def IsDescendant(self, firstItem, secondItem):
|
||||
"Recursive check if firstItem is a descendant of a secondItem."
|
||||
if firstItem == self._root:
|
||||
return False
|
||||
parentItem = self.GetItemParent(firstItem)
|
||||
if parentItem == secondItem:
|
||||
return True
|
||||
else:
|
||||
return self.IsDescendant(parentItem, secondItem)
|
||||
def IsDescendant(self, firstItem, secondItem):
|
||||
"Recursive check if firstItem is a descendant of a secondItem."
|
||||
if firstItem == self._root:
|
||||
return False
|
||||
parentItem = self.GetItemParent(firstItem)
|
||||
if parentItem == secondItem:
|
||||
return True
|
||||
else:
|
||||
return self.IsDescendant(parentItem, secondItem)
|
||||
|
||||
def OnEndDrag(self, evt):
|
||||
itemSrc = self.draggingItem
|
||||
itemDst = evt.GetItem()
|
||||
self.draggingItem = None
|
||||
def OnEndDrag(self, evt):
|
||||
itemSrc = self.draggingItem
|
||||
itemDst = evt.GetItem()
|
||||
self.draggingItem = None
|
||||
|
||||
if not itemDst.IsOk():
|
||||
print "Can't drag to here..."
|
||||
return
|
||||
if not itemDst.IsOk():
|
||||
print "Can't drag to here..."
|
||||
return
|
||||
|
||||
if self.IsDescendant(itemDst, itemSrc):
|
||||
print "Can't move item to its descendant"
|
||||
return
|
||||
if self.IsDescendant(itemDst, itemSrc):
|
||||
print "Can't move item to its descendant"
|
||||
return
|
||||
|
||||
# For this simple example just take the text of the source item
|
||||
# and append it to the destination item. In real life you would
|
||||
# possibly want to copy subtrees...
|
||||
text = self.GetItemText(itemSrc)
|
||||
self.AppendItem(itemDst, text)
|
||||
self.Delete(itemSrc)
|
||||
# For this simple example just take the text of the source item
|
||||
# and append it to the destination item. In real life you would
|
||||
# possibly want to copy subtrees...
|
||||
text = self.GetItemText(itemSrc)
|
||||
self.AppendItem(itemDst, text)
|
||||
self.Delete(itemSrc)
|
||||
|
||||
|
||||
# Define a handler for start element events
|
||||
def StartElement(self, name, attrs ):
|
||||
# Define a handler for start element events
|
||||
def StartElement(self, name, attrs ):
|
||||
if py2:
|
||||
name = name.encode()
|
||||
|
||||
id = self.AppendItem(self.nodeStack[-1], name)
|
||||
self.nodeStack.append(id)
|
||||
|
||||
def EndElement(self, name ):
|
||||
self.nodeStack = self.nodeStack[:-1]
|
||||
|
||||
def CharacterData(self, data ):
|
||||
if data.strip():
|
||||
if py2:
|
||||
name = name.encode()
|
||||
data = data.encode()
|
||||
|
||||
id = self.AppendItem(self.nodeStack[-1], name)
|
||||
self.nodeStack.append(id)
|
||||
|
||||
def EndElement(self, name ):
|
||||
self.nodeStack = self.nodeStack[:-1]
|
||||
|
||||
def CharacterData(self, data ):
|
||||
if data.strip():
|
||||
if py2:
|
||||
data = data.encode()
|
||||
|
||||
self.AppendItem(self.nodeStack[-1], data)
|
||||
self.AppendItem(self.nodeStack[-1], data)
|
||||
|
||||
|
||||
def LoadTree(self, filename):
|
||||
# Create a parser
|
||||
Parser = parsermodule.ParserCreate()
|
||||
def LoadTree(self, filename):
|
||||
# Create a parser
|
||||
Parser = expat.ParserCreate()
|
||||
|
||||
# Tell the parser what the start element handler is
|
||||
Parser.StartElementHandler = self.StartElement
|
||||
Parser.EndElementHandler = self.EndElement
|
||||
Parser.CharacterDataHandler = self.CharacterData
|
||||
# Tell the parser what the start element handler is
|
||||
Parser.StartElementHandler = self.StartElement
|
||||
Parser.EndElementHandler = self.EndElement
|
||||
Parser.CharacterDataHandler = self.CharacterData
|
||||
|
||||
# Parse the XML File
|
||||
ParserStatus = Parser.Parse(open(filename,'r').read(), 1)
|
||||
# Parse the XML File
|
||||
ParserStatus = Parser.Parse(open(filename,'r').read(), 1)
|
||||
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
win = XMLTree(nb, -1)
|
||||
win.LoadTree("paper.xml")
|
||||
return win
|
||||
def runTest(frame, nb, log):
|
||||
win = XMLTree(nb, -1)
|
||||
win.LoadTree("paper.xml")
|
||||
return win
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
BIN
wxPython/demo/bmp_source/wxp.ico
Normal file
BIN
wxPython/demo/bmp_source/wxp.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 766 B |
BIN
wxPython/demo/bmp_source/wxpdemo.ico
Normal file
BIN
wxPython/demo/bmp_source/wxpdemo.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
@@ -31,7 +31,7 @@ Sonar tracking software Miscellaneous See Web site http://www.desertstar.com Dem
|
||||
Name Research software Platform Location Availability Description
|
||||
DisCo Research software N/A http://www.cs.tut.fi/laitos/DisCo/tool.fm.html N/A A tool for specification of reactive systems.
|
||||
CAFE Research software N/A cafe.htm N/A Cellular Analysis of Fire and Extinction
|
||||
CODA Research software See Web site http://www.ozemail.com.au/~mbedward/coda/coda.html See Web site CODA assists in the design of networks of nature reserves or protected areas. It has been used for major reserve planning studies, as a teaching resource and for research into conservation planning methods.<EFBFBD>
|
||||
CODA Research software See Web site http://www.ozemail.com.au/~mbedward/coda/coda.html See Web site CODA assists in the design of networks of nature reserves or protected areas. It has been used for major reserve planning studies, as a teaching resource and for research into conservation planning methods.
|
||||
EGRESS Research software N/A http://www.aiai.ed.ac.uk/~jimd/Egress2/projInfo_contents.html N/A An evacuation decision model.
|
||||
ACT Research software N/A none.htm N/A A general process and tracker and automator being built at NASA.
|
||||
Rectangular nesting program Research software N/A http://www.elec-eng.leeds.ac.uk/een5mpd/research.html N/A Optimized layout of rectangles on a page.
|
||||
|
||||
@@ -22,6 +22,7 @@ command_lines = [
|
||||
"-a -u -n TestMask bmp_source/testmask.bmp images.py",
|
||||
|
||||
"-a -u -n Test2 bmp_source/test2.bmp images.py",
|
||||
"-a -u -n Test2m -m #0000FF bmp_source/test2.bmp images.py",
|
||||
"-a -u -n Robin bmp_source/robin.jpg images.py",
|
||||
|
||||
"-a -u -n Bulb1 bmp_source/lb1.bmp images.py",
|
||||
@@ -78,9 +79,16 @@ command_lines = [
|
||||
"-a -u -n Blom13 bmp_source/toblom13.png images.py",
|
||||
"-a -u -n Blom14 bmp_source/toblom14.png images.py",
|
||||
"-a -u -n Blom15 bmp_source/toblom15.png images.py",
|
||||
"-a -u -n Blom10Masked -m #FFFFFF bmp_source/toblom10.png images.py",
|
||||
|
||||
"-a -u -n Blom08m -m #FFFFFF bmp_source/toblom08.png images.py",
|
||||
"-a -u -n Blom10m -m #FFFFFF bmp_source/toblom10.png images.py",
|
||||
"-a -u -n Blom15m -m #FFFFFF bmp_source/toblom15.png images.py",
|
||||
|
||||
"-a -u -n FloatCanvas bmp_source/floatcanvas.png images.py",
|
||||
|
||||
"-a -u -i -n WXP bmp_source/wxp.ico images.py",
|
||||
"-a -u -i -n WXPdemo bmp_source/wxpdemo.ico images.py",
|
||||
|
||||
|
||||
" -u -c bmp_source/001.png throbImages.py",
|
||||
"-a -u -c bmp_source/002.png throbImages.py",
|
||||
|
||||
@@ -2169,6 +2169,114 @@ def getTest2Image():
|
||||
stream = cStringIO.StringIO(getTest2Data())
|
||||
return ImageFromStream(stream)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getTest2mData():
|
||||
return \
|
||||
'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00@\x00\x00\x00@\x08\x06\x00\
|
||||
\x00\x00\xaaiq\xde\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x88\x00\x00\tzI\
|
||||
DATx\x9c\xe5\x9bMl\x1b\xc7\x15\xc7\x7f\xb3\xcb%%\x91\xa2$\xca\xfa\x8a-Uv\x12\
|
||||
I\x90\x12\xb7\xaa\x93\x1a\xa8Q4n\xe04(\xec\xc0\xb9\x14\x01|\xef\xd6E\xe1K\
|
||||
\xd0\x9b\x83"@r\nzL\x04\x19\x01zI\x80\xdc\x1a\xc4A\x114@\x9d\x1c\x9cC\x11[\
|
||||
\x01\x92\xc8j\xe2\x1a\xf2Ge\xc9RdK\xa2DY\xe4r{x\\qI-\x97\xcb/Y@\xff\x00\xb1+\
|
||||
r\xc9\x99\xf7\x7f\xffy3\xf3\xdeH)M\xe7\xff\x19\xa1F7\x90\x1d\xb7\xecZ\xbe\
|
||||
\xafM\xe9\xaa^}\xf1\x82r+ hgKu\xaaVc\xabm\xb7\x16TE\xc06\xbe,\xfa\xfb\x99:\
|
||||
\xf4(\x00\xeaI\xc46\x01U\x19\xaf~W\xf8\x9e}!\x7f\xbf\x0bd\xd4\x83\x88\xca\tp\
|
||||
\xbc^l|1\x1c2<\x88\xb0lH\xdbru#:\x15\xa8\x07;\xa0\xe9\xd5\x13\x11\x9c\x80\
|
||||
\xa0\x86\x17\xc3\xa5\x8a\xf5q\xb0\x80\xa4\x05\xcb\x16\xacg\x85\x84\x9f\xcf\
|
||||
\xc8\xe7_\xa8\x97\xb6\x9f\xd5\xd1\x88\x12"A\x84\x18\x06:\n\x1d\x85\x81\x86\
|
||||
\x8eV\xf8\xfb9\x92\xabQD0\x02\xbc\xe4^\x0c\xc7P\xd7s\x16Y6\xb1X%M\x9f\xfd^\
|
||||
\xa0\x0e\xbd\xa6\xc6\x010\xd0\xe8 B?1\x12D\x88\xa0\x13%D\'M\xc41hB\xcf\x13\
|
||||
\xe1"\xa1\x14J\x91S\x9e\x80r\xc6\x970\\\xb7\xdf\xf5\xefQ@\x9cSc\xc4r\x06w\
|
||||
\x10a\x90V\xfa\x89\xd2CK\x9e\x08\xfb\xdd\xc01\xa7\x98\x08\x7f\x02\x82z>\xf7L\
|
||||
=\r/\xc6\xcbj\x90(!zi\xa1\x9f(\x87\x88\x17\x10\x11\xb5\xffZ\x15\t\xf5[\x08\
|
||||
\xd9\x17h\xe4\x9a\xf2o\xf6,\x00\xa7\xd4\x00\xf3lp\x9b\xf5m"\x06\x88\xf1c$\
|
||||
\xb0\x1a\x15F\x01\xa54\xbd6\xef?"\x9cR\x03\xb4\x11\xa6\x97\x16\x06\x89\xf1G\
|
||||
\xfb\x0b\xe6\x0eC\x97\x11\x8c\x04G\x05Z\xb9\x07\xf7*.\xda\xb7\xb8G\x8a\x7f\
|
||||
\xf3\x80+,\x010\xbd\t\x8biQBPx\x13\xb0\xc7\xbd\xef\xe0\x1f\xf6\x7f\xd9 \xc3<\
|
||||
\x1b\x00|\xb9\x11\x9c\x04G\xf5\xd5\xc5\x00\x0f\xe3-\x0b\xd2i\xc8fA\xd3\xc00@\
|
||||
o`Pp\xda\xbb\xb8>\xc7o\xa2}\x00L\xa7\xf2\x9f\x8f\x12l8TN\x80\x87\xf1\xe94\
|
||||
\xdc\xbf\x0f\x8b\x8b\xb0\xb9\t\xd1(\xf4\xf4@[\x9b\x90Qod\xb3\xb0\xba\n\x0b\
|
||||
\x0b\xb0\xbe\x0eo\x7fs\x17\x80\x85\x0cP!\t\x95\x11Pd\xbcR\x93\xdb\xf7\x9f\
|
||||
\x7fn2=-\x1d;p\x00\x8e\x1c\x81\xe6fhj\xaa\xa8\x05_\xb8\xdb\x9b\x991\xb9z\x15\
|
||||
\xee\xdc\x81x\x1c~\xf8\x016,\xb8\x07\x15\x91\x10\x9c\x00\x1f\xe3\x01\xa6\xa7\
|
||||
\xe1\xca\x15Q@&\x03O>)\x9e*\x86#]\xcb\xf2nF\xd7\x83\r\x9f\x91\x91I\xde|\xd3\
|
||||
\xe4\xda\xb5<\xc9\x93\xff\x82?\x1c\x85\xc5\x8c\x0c\x07\x05\xe8\nB\n\xf6\x85@\
|
||||
\xf3 !\x18\x01\x01\x02\xde\xbd{\xb0\xb4\x04\xb6\r\xa9\x94\x18i\xbb\x02\x91e\
|
||||
\t9\xab\xab\xe2\xad\xf5\xf5\x9d$\xe8\xba\x0c\x9f\xceN\xf1jS\x93?\x11\xa9\x14\
|
||||
\xac\xadA2)\xed\xaf\xad\xc1\xdf\x17\xe0T\xaf\x900\xb3\tQ\r\x12\xba\\\xa3\x1e\
|
||||
\xbfU\xb7\x85\x90\x9fW\x8b\xd5R\x8c\xf3\xe7M@<\xdf\xd1\x01\x83\x8300\x00}}\
|
||||
\xf2\xb7a\x94\xfe\xae\xa32\xa7}\xdb\x86\xac\r[\xc0R\x06f\xb7\xe0G[\xd0m@\xb3\
|
||||
\xb6S\x05\xe5\t\xa8a\xba\x8b\xc5\xfc\rw\xf0\xc6\x1b\xf2\xdc\xe9\xd3&\xd1(\
|
||||
\xdc\xbc)$\x8c\x8d\xc1\xf00tu\xf9\x93P\x8cKkp\xbc\x15\x1efa>\r7\x1eB\x7f\x18\
|
||||
\xe2\x1e*hXN\xf0\xd8\xb1`\xc6\xbb\xf1\xe1\x87\x93\x9c8a\xb2\xb2\x92\x1f&\x00\
|
||||
\xa1\x10\xec\xdbWy\x1f,`\xc5\x82\xdbi\xb8\xbd\x05=\x1e*\xf0\x9f\xa4\xaa\xf4\
|
||||
\xbe\xe3\xd1j\xf0\xe9\xa7\x93\xa4R0?\x0f33\xf0\xed\xb7p\xf7\xae\x8c\xf7JpiM\
|
||||
\x86\x82[\x05\x0biH\xe5\x86L\xc1R\xb8\xd1\x99W7N\x9f69s\xc6\xf4}\xc60dL/-\
|
||||
\xc1\xec,\xdc\xba%\xc1\xb3\x1a\x14\xab`5+\xc48(\xad\x80\x1a\xc6\xbe\x13\xd4\
|
||||
\xdc\x98\x980y\xfdu\x93\xf1q8z\x14>\xfa\xc8dj\xca\x9b\x88O>\x99\xc40`kK\x94p\
|
||||
\xe3\x86,z*\x85[\x05\x0bi\xb8\xb9\x05\xcb\x19\xd8r\x11\xd0\xb0\x18p\xf9\xb2\
|
||||
\xc9\xe1\xc3\x10\x89\xe4W\x89\xc9\xa4|\xe6\x9e\xea\xd2i\x13\xc3\xd89d\xda\
|
||||
\xdbay\x19VV\xe0\xf6myU\x0b\x0bHf\xc5\xf8d\x16\xdc\xcb\x93m\x054&\xe7.r\xee\
|
||||
\xec\x84\xc7\x1f\x87\xa7\x9e\x92\xd7\x13O@w\xb7\x10\x11\n\x81m\xefT\xc2\x07\
|
||||
\x1fL\xa2\xeb\xf0\xf0\xa1x\xff\xe6\xcd\xea\xfb\x91\xb5!c\xc3fN\r\x19?\x05hS\
|
||||
\xba\xca\x92\xb1e\x1dU\x1f\xe8zu\x1b#\x87\x80dR\xd4P\x0b,;\x9f\x8cMZ`g\xb7l\
|
||||
\xa5\x85UA\x0c\xc8\xab`\xd7bb\xc3qiM\xae\x19\x1b\xee[pg\x0b\xf6\x7f\xfd\r\
|
||||
\xb2T\xda\xe3\t\x11\xcb\x12\x15\xc4b\x90H\xd4\xf8[\xe4\xe3\x00$q"\xc1\x9e \
|
||||
\xc0k\xa9\xfc\xca+&\x99\x8c\xc4\x88\x8e\x0e\xd9a\xd6\x82l\xae\x10\xf3\xe7\
|
||||
\xbb\xe7\x11:$\x10<r\x02J\xed\x13\x1e<\x90u~8,\x04tu5\xa6\xfdGJ\x80\xdf&)\
|
||||
\x9d\x96\x19$\x91\x80\xde^!\xa1V\\\\9\xb5\xe3\xbd\x86\x9f\x0f\xf0B\xb9\xdd\
|
||||
\xe1\xf3\xcf\x9b\x18\x86x}x\x18FF\xaa\xdb\x0b8\xf8,\xf9\\\xc9\xcfv\x9d\x80r\
|
||||
\xc6\xbf\xf0\x82I8,\x06\x8f\x8cHfix\xb8>\n\xf0\xc2\xae\x12P\xce\xf8\x17_4io\
|
||||
\x87\xc7\x1e\x83\x83\x07\xab\xdf\x0eW\x82]#\xc0\xcfx\xb7\xe4\x87\x86d\xb5x\
|
||||
\xf0`\xb0\x84Hph\x80\x0e\x18\xb9\xab\xacuv\x85\x80\xa0\xc6\x8f\x8e\x8a\xe4GF\
|
||||
$\xf8\x95K\x89U\x06\x1d\x88\x01\x89\xdcU\xe2\xbf\'\x01\x9a\xae\xab\xacU\xd9\
|
||||
\x89\x91\xe6fY\xb08\xf7\x86!{\x01?\x9c<i\xa2\x94\xec\x15\x9c\xf1>:\x1a\\\xf2\
|
||||
A\xdaT\xea\xb9\xdc]\x08\xe8\x00\x0e\xe4\xae\xe1\xedw\xeb\x82\xc1\xc1\xc2\xfb\
|
||||
x<_\x13\xb0ms\x87\n\xdez\xcb\xe4\xce\x1d\xd9-\xf6\xf7W7\xde\xfd\xda\xdc\x89B\
|
||||
\x05(-\xac\xa0\xe8\x90\x94\x1bA\x15\x90\xcd\xca\xa2en.\xbfaI$$\x90\xb5\xb7\
|
||||
\x17vH\xa9I66L\xe6\xe6\xe0\xfb\xefe\x97\x17\x8fK\x02\xf4\xc0\x01\xf9^\x10\
|
||||
\xe3-K\xda\x9a\x9b\x93\xed\xb2\xb3Z\xec\xed\xddY\x8c9\xde\n\x9f%\x7f\x05\xc4\
|
||||
\x81q\xe0\xd7\xc0\xd3(-^\x9f\xe2\xa8R"\xbfx\\\xb6\xb7\xd1\xa8\xdc77\xef\x94\
|
||||
\xe3\xd6\x96\xc9\xea\xaat\xda\xb2D\xbe\x9d\x9d\xb25\xae$\xd89\xb5\x05\xdb\
|
||||
\x96\xf6\xfa\xfa`\xff~hm\xf5V\xc0\x89\xd6\x7f\xe25\xfe\xc1g\x08\x04\x89\x03\
|
||||
\x8e\xac\x17\x16Lfg\xe1\xbb\xef\xe4\xfd\xa1!\t`\x91\x88\x90P,\xffw\xde1\x99\
|
||||
\x9f\x97\xce\x1e:$\x04x\x15Q\xfc\xda\xbb~]\xda\xb3m\xc9/D"B\xba\x1b\xc7[%\
|
||||
\x01\x1a\xd1\xe0\xd5\x9e\xf7\xf8\xcb\xc2os$\x84\xcb\x13\x10\xb43\x00==\x93LL\
|
||||
\x98|\xf5\x95\xfc\x9d\xc9\xc8BF\x94\xb0s\x06\xb8zU\xf2}N\xe0\x1a\x19)O@\xa9\
|
||||
\xf6\x9c\xe1\x00\xf9\xec\xb1[\x05:\xd0\xa6C\xbf\x01\xd0\x0f\xc4\xb7\xc7?\xf8\
|
||||
\x0c\x01{\xc2\xb2+9~\xb6\xbc,\xaf\xc5\xc5|\x95\xa6\x94QKK\xf2y*%d\x05\xf1~1\
|
||||
\xce\x9e\x9d\xdc\x8e\x03\xd7\xaf\xcb\xeb\xfe}\x19\x1aP\xe8\xfd^\x03\x0eE`\
|
||||
\xee\xf08P(\x13_\x05\xd8\x13\xc1\xa7\xc2DB\x02\xd0\xe6\xa6x\xc2\xaf*\xecHu\
|
||||
\xdf>\x91\x7f\xa9\xb1[\x0emm2\x04t\xdd{\xcau{\xdf)\x8c\xb8\xbd\x0f%\x08p\x1b\
|
||||
^*\x16\x14Om\xa3\xa3ru\xaa\xc3\xa5\xa6\xa4\xf7\xdf\x97x\x91\xc9\x88\xf1\xa3\
|
||||
\xa3BD8\xbc\xf3Y\xbf\xf6\x9cj\xf4\xf2\xb2\x90?4\x94\x0f\xa4^\xdew\x8a"\xc5(\
|
||||
\x1b\x03\xfcT\xe0$3\x9d\xf3\x01\x9d\x9d\xf9\xf3\x01\xdd\xddb\x94\xf3L6+\xd1\
|
||||
\x7faA\x82\x96m\xcb,\xd0\xd5%\x1d\x0f\xa2\x00\xaf\xf6R)Q\x94\xfbw4\x05\xe1\\\
|
||||
Ex0\x0c\x039\xef{U\x87=\xd7\x01^F\xdbeN\xcc\x049!R\\\x1a\x0fZ\n\xaf\xa4\xbd\
|
||||
\xe7\xe3b|W\x08\xc6\x9a\xe1gQ\x18k\xca\x97\xc7\x8b\xb3\xdf\x81g\x01u\xc1\x9f\
|
||||
\x84 \x99\xdfj\xb3\xc3A\x7f\xcbm\xfch3\x1ci\x81\xe1\x08t\x948\x1b\x00\x15.\
|
||||
\x84\xd4\xa3?\x17U\x12\xc5\xc6?\xd3\x02\xa3M\xe5\x8f\xc8T\x1c{\xf7"\tA\x8d\
|
||||
\xf7*\xfeT\xb5\x14\xdeK$T\xeby\x07U\xef\x05\xf6\x02\tJ\x9d\xa0%7\xd5\x8dUa<\
|
||||
\xd4\xb8\x19z\x94$(u\x12\xe8\xe6\xe3\x95W9\xd2"\xd1\xde\xcf\xf8R\xb5\xcf\xda\
|
||||
w\x83\x17v\x97\x88S\xed\xa0\xd4\x19`\x18x\x16\xf8%\xbf\x88\xc9TW\x89\xe7\x1d\
|
||||
\xd4-!\xa2.\x00Y\xb0\x7f_\xaf_,\xc4\xcb\x1dr\xd2k\xb8\t>^y\x168\x84lnz\xf8\
|
||||
\xc9\xb5$\x99\x9f\xc6\xa8\xa6\xbe\x1dx!T\x11\xeaH\xc4\xb9n\x88\xe9\xd0\xa4d>\
|
||||
\x1f\x0c\xc3K\xff\x99\x02z\x90$G\x13J\x8b(\xbf\xffx\xf1+\xfd\x97\xcc\x08\xd5\
|
||||
L\x02H\xfd1\rl\x82\xfd\xa7`_yM\x8e\xfdb\xe4\x0c\xee\x0f\xcb9\xbf\x88&\nxzz\
|
||||
\x0e\xb7\xe1\x05\xcd\x95 \xc1\x8f\x80\xc6f\x855 \x02\x18\xa0\xdeF\x089\xb7\
|
||||
\x82Tg\x97\x81u\xa4PY\x88\xcb\xc3\xc7\xd0U\xfe\x90\xe3\xfe\xafW\x90\xbd\x9d\
|
||||
\xa4\xb5\x8b\r\xf7\xedB\x99\x83\x1f\x8dU@)\x98\x19D\x1a%NVn\xa3r\x83\x8bUP5\
|
||||
\x01\xd0\x18\x12\xd4\xd9\xdd9\x91\x96\x1d\xb7\xec \xc7~v\xb5:\xbc[\xc6C\xf03\
|
||||
O\xbe\x04\xd4\xb3\xc3\xbbi|%\xf8\x1fg\xd4\x81\xf3?2\x98\xba\x00\x00\x00\x00I\
|
||||
END\xaeB`\x82'
|
||||
|
||||
def getTest2mBitmap():
|
||||
return BitmapFromImage(getTest2mImage())
|
||||
|
||||
def getTest2mImage():
|
||||
stream = cStringIO.StringIO(getTest2mData())
|
||||
return ImageFromStream(stream)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getRobinData():
|
||||
return \
|
||||
@@ -5888,7 +5996,39 @@ def getBlom15Image():
|
||||
return ImageFromStream(stream)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getBlom10MaskedData():
|
||||
def getBlom08mData():
|
||||
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\x01\
|
||||
\xd0IDATx\x9c\xb5W\xed\x15\x83 \x0cL\xd4\x8d\xca\n]\xa5\xcc\x84\xab\xb8\x02\
|
||||
\x8e\xa4\xe9\x8f\n\r_1X\x9b\xf7x\x15\x8b\xb93\xb9D@\x1cF\xd0\x1a\xed\x1b\x9d\
|
||||
\xad\xc1aD\xb5C\x00\x98z\x80\xe9\x14\x1e\x00q\xa3\x1e\x12(E\xa0\x078u\xaa\
|
||||
\x8fD\x93\x00\xed\x1b\xf5\x02\xe7$\x92y\x83\xd0\xf0\x0f\xf0\xe8\x87\xd8h\xe8\
|
||||
\'\x89\xc0\xd5\x90k\xad\x96\x9a\xe9n`\xc4>?\xd3]\xe1\x0e9\xef\xf5U\xd5\xc0U\
|
||||
\xe0+/\xf23\x01]o\x10\x08\xe00"_ -\xbeb\xb9&\xf2j\x98\x00>\xcaD\xfch\x81HGB\
|
||||
\x1bn\xee\xaf\xe6;\xb6\xe2\x1a\t\xf2\xaep\xb8\xae\xeb\xf1fsBDR\xbfD6\xf9\x16\
|
||||
p\x12-{<\x1e\x1f\xa7\xde\xc1\xba\xaeM"\xear\xc4a,\x06\x00P\x18\xde\xbd\xaa\
|
||||
\xd7\x00@\xe4]\x1c\xf1\x1e\xc9\x03\x00(\xc1\xaa\x81\xe7s\x0e\xd2"J\xde%\x04\
|
||||
\xb5\x04\xc4\xcf1\xed\x1b\xd5t\xc0\xa2\x87A\xd5h\xec\xf79\xd27&\xd5~\xe0\xcc\
|
||||
8I4\xb6P=\xd7Gn?7\xa2\xdc\xbc{\x15\xe0\x88)\x11\xde\x0b\xc4\x08\xe00"\x1a{\
|
||||
\xf9KQ\x8b@\xde\x0b\n\x02!\xaf\xe17\x94\x1b\x00\x80\xb1s\nP\xd1H(SN"\'\x94\
|
||||
\xe0\x89;\xa2\x8a\x00\x13\xb15\x04\x8a\xc6\x8a\xe2\xe3\xfb\x82n\x11JU\x11\
|
||||
\xcc\xbb\x17 \xce\xaa.yK\x15\xe4f\xec\x9c\xe4?\x0f=\xdf\x15\xfd\x85\x00@]p\
|
||||
\xb5\x8d\xa9\xba\x0c\xd1X@c\xa3 \xa5uR\xdd\x97DO\xce\x05\x9a\x9cs\xf0\xf8,\
|
||||
\xcb\xb9tN\xb8%\x05\x11x9n<\xf5\x1b\x1b1\x02\x00\xbar\xe4\xc0M\xa0F\x04TG\
|
||||
\xb3\xaa-\xec:\x07\xce\xfe\x93\x8eiM\x11F\xf0\xc3Yt\xb2T\xc0\xf9\x9c_\x1fs\
|
||||
\xe9E\xe4*X\xbe\xbf\xb4oT\x84:\x80?\xb3\xf5\x1d\xf6\x06\xb5\xbfg\x05\x93\xe5\
|
||||
\x9f7\x00\x00\x00\x00IEND\xaeB`\x82'
|
||||
|
||||
def getBlom08mBitmap():
|
||||
return BitmapFromImage(getBlom08mImage())
|
||||
|
||||
def getBlom08mImage():
|
||||
stream = cStringIO.StringIO(getBlom08mData())
|
||||
return ImageFromStream(stream)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getBlom10mData():
|
||||
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\x01iID\
|
||||
@@ -5908,11 +6048,42 @@ ATx\x9c\xbd\x97Q\xb2\xc3 \x08EA\xdf\x92XS]S\xb2&\xb7\x94\xd8/:\x84J@M\x1f3\
|
||||
\x08\x00{&|\xfd\xa0\xaa\x8c\xe5\xdb\xb1\x06\x89\x86\x9c\xacw\x10o\xea\r\xf9&\
|
||||
G\x80\r\xe3\x00\x00\x00\x00IEND\xaeB`\x82'
|
||||
|
||||
def getBlom10MaskedBitmap():
|
||||
return BitmapFromImage(getBlom10MaskedImage())
|
||||
def getBlom10mBitmap():
|
||||
return BitmapFromImage(getBlom10mImage())
|
||||
|
||||
def getBlom10MaskedImage():
|
||||
stream = cStringIO.StringIO(getBlom10MaskedData())
|
||||
def getBlom10mImage():
|
||||
stream = cStringIO.StringIO(getBlom10mData())
|
||||
return ImageFromStream(stream)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getBlom15mData():
|
||||
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\x01\
|
||||
\xadIDATx\x9c\xbdV\xd1m\xc40\x08\xc5I'\xe9\n\xe7\x99\xe2\x99\xb8\x99\xc8\x08\
|
||||
\x1d%\xa1\x1f-\x11qm\xc0\xd6]\x91N\xba\x04\x02\x0fx\xc6\xa4\xb4\xac0*|\x1e\
|
||||
\xac\x9f\xd3\xb2&\xfd^\x9e#\xf21\x13\x94\x88n\xba\x9c3\xeb\xf79g\x0e\x83H\
|
||||
\xcb\xea\xfe\x00\x80\x11\x91\x11\x91\x89\x88\x01\xc0\xfc!\xe2\xf5\xdf\xf5\
|
||||
\xef\xb5\xa0.\xf7\x8cX\xd5X\xde\x1d\xdc\xf3c\x02x\xa5\xf4@t\x01\xbc*{O\xdeV\
|
||||
\x01&\x04&\xbc\xbfk$\x15:\x86\xe2(\xe5\x12\xb6\x8dJx\x0e\xcc8\x8fH\xb3\x05\
|
||||
\xff\xd5\x7f\x80@\x05t\xd6\xfb\xbeC.\xcf\x90c\xc2\r\x1e\x8f\x87k\xd7\x1cD\
|
||||
\xba\x02\x1a@\x8b\x03\x16?Z\xbaz(\xf5\x8fa\xd5\xef\x08\x01k\xd1\xdf\xf4\xf83\
|
||||
DB/HK\xf6}7\xf5]\x00)\x17\x97\xf5\xba\xcf\x16\x10&\xec\xea\xcdA\xe4e\xa7If\
|
||||
\x81\x15?\xadK\xa9\t r\x97\x13n\x9e\xc9\xbdB\x1d\x9f\xe1Q\xac\x03\xd6\xa5\
|
||||
\x97\x0c{6\x96\x98\xfb\x00\x9f\x07{\xa5\x95\xa0V\xb0\x94K\xb7\x02\xa1\x85\
|
||||
\xa4\x07B2\xf7@N/$u\xa0Q}dv\xb8\x00\x04\xbd\xe5,-k\xaa\xf5\x16\xf3\x87\x00XN\
|
||||
\xe4\xce\xbf\xd6\xf1\x1aD\xe04\r-$\xbd*\x08\x07\xbe\x1c\xbbi\x00|\x1e\xfc\
|
||||
\xb3i\x1b6\x84\xf0\xa9\xc8\x88\xc8\xa1k}x%\x9b%\xe44\x00\x9d\x85Ta\x84\xf5^\
|
||||
\x15\xcc\xdb\x90\xcf\x83\xb7\x8d\xe0\xf9\xcc\xa1`5P\xedgx\x14\xd7\xc8KI\x7f\
|
||||
\x9c_\xa7\xe0\xb7\xf7\x88|\xe9\xc5~\xdb\xe8\xe2C\xab\x1a\xdd\x9dP>l\x89\x04\
|
||||
\xba\xcez\xa0\xef\x1a\x88\t\xa0\xc5\xf8\xfaYW#\xe5\xd2\xcc\xbc\xf5\x9d\x00\
|
||||
\xd1 \xbe\x01\xda\x18*\xbd\xb7\xee\xad%\x00\x00\x00\x00IEND\xaeB`\x82"
|
||||
|
||||
def getBlom15mBitmap():
|
||||
return BitmapFromImage(getBlom15mImage())
|
||||
|
||||
def getBlom15mImage():
|
||||
stream = cStringIO.StringIO(getBlom15mData())
|
||||
return ImageFromStream(stream)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@@ -7704,3 +7875,75 @@ def getFloatCanvasImage():
|
||||
stream = cStringIO.StringIO(getFloatCanvasData())
|
||||
return ImageFromStream(stream)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getWXPData():
|
||||
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\x01\
|
||||
\xd2IDATx\x9c\xadW[\x0e\xc4 \x08\x1c\x9a=X=\xb9{3\xf6Cq\x01\xf1\xd1\xc7$M\
|
||||
\xad\xad\xcc\x08\x8a\x94\x000\x16`f\x10\xd1\xea\xb3[\xf8`\xa0\x80\x00\xe4\\\
|
||||
\xdbD\xad\r\x00)\x15QOAD \x00\x9d\xa9\xd9\\E\xc8\x1b"\x88\xa8x \x82\xd8&\xb2\
|
||||
\n\x89`\xbc\xf1\x14C\x01\x85\x8c!\xfe(m`\xee\x9f\xeb8^\xb5\xf6\xb6\x00f2m\
|
||||
\xfd\x0c\xe0\x95\x9d\xd1\t\x10\x93D\xffxK[\xc7_\xef\x10\xb9\xee\xe0\xa3I\xb5\
|
||||
a,\xfa\xa2wwD\x10j\x1a\xb8\xb3\xb2\xd3Y,\xf8\xb1\xd1\x16-\xe2\xfa\r\x7f\\%O\
|
||||
\xa7\xbd\x83\x0b\xa1F\t\xdb\x9e7\xda\x1a\xd0F\xbcAC\xe8\xdaO\xd1\x04h/\x98\
|
||||
\xb4\xeb\x89\t[\xa9`\xd7\x0b\x87\x18\xf6\xae\rg,\xf6\x18\xc8_\xd5\xf7 #\x97\
|
||||
\xe1+\x03j"9;Ajl\x13U\xa1\x17\xe3\xc8\x1b\x87&\x10\x03\xe6\xae\xc7i\xa1j\x8c\
|
||||
\'\x1e\x81\x99\xcd\xd5\xe6\xe0\xcf\xfb(\xeb\xfb\x99\xb71\x17<\x10m\xcd.\x13z\
|
||||
\xf2\x9cK\xa7\'\xf7\xa43\xf2\x19\xcci\xd8\xc8\xeb"K\'\xd0vdUdb\xca\xe5\xfdn\
|
||||
\x08"\xb4\x10\xa0\x86\x80\xfad\xd5\x11\xb7\xa2\xe4\x8c\xc9G\x990\xea3\x15Q\
|
||||
\xb4N\xf5\xa0U\xccG\xe43\x01\x07\xe3/!Z\xa5\xf2\xe1\xf7k\xeb\xc2+\xe43\xd8\
|
||||
\x10\x84\x07\x08\x96\xb3\xde!\xf7\x1e\x10\xdb\x7f\x01\xc1\x00\x9f\x92g\xe4\
|
||||
\x1a\x11\x91\xee\x17\xdb)-jB\x9d\x8eg\xe4\xfe4\xd5\xa4Q\xbd\xa0\xfb\xc2\x92\
|
||||
\xcc/\xb6\xa1\xc0\x80\\\x13\xf8w9\x07b\x11\x84\xe0\x8a\xfb\xefB\xc26\x0c\xc1\
|
||||
\x9bg~[#j\xbfK*\xdf.\xcbG\x82VBS\x02 \xde$t\xa9\xfc\xd2.\xe8?\xaa\xf7\xd1\
|
||||
\xcf%\x14\xf9 ;N~\xcd\xe2\xd3\xaeUE\xb0\xbfo\x1d6\xeb\xcc\x87\xf5\xccs\xfc\
|
||||
\x00\x9b/\x1b?\x06U\xaa\xa2\x00\x00\x00\x00IEND\xaeB`\x82'
|
||||
|
||||
def getWXPBitmap():
|
||||
return BitmapFromImage(getWXPImage())
|
||||
|
||||
def getWXPImage():
|
||||
stream = cStringIO.StringIO(getWXPData())
|
||||
return ImageFromStream(stream)
|
||||
|
||||
def getWXPIcon():
|
||||
icon = EmptyIcon()
|
||||
icon.CopyFromBitmap(getWXPBitmap())
|
||||
return icon
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getWXPdemoData():
|
||||
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\x01\
|
||||
\x94IDATx\x9c\xb5WAn\xc4 \x0c\xf4@\x7f\xd2>\xa5y5}J\xbe\x92\xb8\x87\r\xac\
|
||||
\x01c\x02dGZiE\x103L\x06\x9b\x00\xce\x93\x05>\x0f\x8e\xff\xe1<\xcc\xc9\x13\
|
||||
\xf8\xea\x913\'~\x02\xc0O\x8bh\n(\xc9\x89\x88\x98\x99\x00d\x83\xab\x82T\x01\
|
||||
\x99\xed@"\x97B\xc4\xf3%W\\I\xcc\xe7\xc1\x14\xc4\x18s"\x04@\x9a+R\xf0(\x92\
|
||||
\x03%1\x05\x9d0\n\x89\xe4\xab0C\x18E\x94x\x828\x02p\xbe\xde\xbd\x85\xad\xca\
|
||||
\x00Qx\x8d\xcfd\xc1\xf5\xa7\x14\xb8\\\x89\xbf$<\xd0T\x16\x10\x0b\xd1\x90\x0b\
|
||||
-L\xb80\xee\x80\x85\t\x17\x92\x008\x0f\xda\x88h3f[\xcf&\x91\x9d\x028\x8f\xfd\
|
||||
<\xf8\xbbE\xb4\xfa\x8a\x14@6\xa3\xfd<\xf8\xc7x\x87\x99\xbd\x96\x18\x91\x85^3\
|
||||
K\x0e\xf4\xc8\xcb\x05x\xbb\x166\x84TUu;\xaa\xb2=\x1dB8\x8f\x94\x1bcN\x96+%\
|
||||
\xa4\x8e\xe8\xbd\xfb}0\xc1\xaf\x8e\xa9<\x10D=\xa1\xe8]H\xee\x92\xe3O\x99Tf!\
|
||||
\xd4\xe3\xcf\xd6\x01\x03-\x17\x86\x05\xc4\x96]Z\xcf\xbf\xca\xe4Va\x12\xe3\
|
||||
\xb7\x05hw\x85Qh.\xd8\xedX\x90\x7f\xa2\x08\x11\xddp\xe0\x93\xe4]\x01#\xe4\
|
||||
\xea)\x90\xeb\xcc\x08P1\xd3\x90B;C\xe6\xb5\xbc\xda\xbd8\xbf\xc0\xfb$X\xbb\
|
||||
\x97"4,\xd7\x01\x93\xbc\xe5V\xb6\x91F%l\xbe\x7fQ\xd7\xbb\xb8\x88\xca\x0c\xc8\
|
||||
\x86t\xeb\x18f\x18\xb8\xbc\xa6]\x1a]\xd6\xec\x05\xc3GPX~\xf7n\xd8mF\xc9\xbe\
|
||||
\x96\x90\t\xd2!\x01\x95\x90r\x81\xc5\x8f\xd3\x7f\xa5\x8a\t\xa7n\x17\xec.\x00\
|
||||
\x00\x00\x00IEND\xaeB`\x82'
|
||||
|
||||
def getWXPdemoBitmap():
|
||||
return BitmapFromImage(getWXPdemoImage())
|
||||
|
||||
def getWXPdemoImage():
|
||||
stream = cStringIO.StringIO(getWXPdemoData())
|
||||
return ImageFromStream(stream)
|
||||
|
||||
def getWXPdemoIcon():
|
||||
icon = EmptyIcon()
|
||||
icon.CopyFromBitmap(getWXPdemoBitmap())
|
||||
return icon
|
||||
|
||||
|
||||
31
wxPython/distrib/README.win32.txt
Normal file
31
wxPython/distrib/README.win32.txt
Normal file
@@ -0,0 +1,31 @@
|
||||
wxPython win32 README
|
||||
---------------------
|
||||
|
||||
The self-installer pacakge you have just installed contains the Python
|
||||
extension modules, python modules and pakcages needed to run wxPython
|
||||
applications. If you selected the "Make this install be the default
|
||||
wxPython" option in the installer then this version will be the one
|
||||
that is imported when apps do "import wx". See the following wiki
|
||||
page for more information about managing multiple installs:
|
||||
|
||||
http://wiki.wxpython.org/index.cgi/MultiVersionInstalls
|
||||
|
||||
In addition to the wxPython modules, several tools scripts (such as
|
||||
XRCed and PyShell) and batch file launchers have been installed to
|
||||
Python's Scripts directory. (For example, c:\Python23\Scripts.) IF
|
||||
you have multiple versions of wxPython installed these tool scripts
|
||||
will use whichever is the default install. If you would like to
|
||||
control which version is used then follow the directions at the wiki
|
||||
page for using wxversion.
|
||||
|
||||
This installer does *not* include the wxPython documentation, the
|
||||
wxPython demo and other sample applications are provided as part of
|
||||
wxPython. Those are available in a separate installer named
|
||||
wxPython2.5-win32-docs-demos-*.exe which should also be located from
|
||||
wherever you downloaded this package from. The Docs and Demos
|
||||
installer will also create Start Menu shortcuts for the tool scripts
|
||||
mentioned above.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
The collection of scripts in this directory are an attempt to fully
|
||||
automate the build of the wxPython source and binary packages on all
|
||||
build platforms. It does this through creative use of shared folders
|
||||
on network drives, and ssh commands to the remote machines. So this
|
||||
will likly only work in my somewhat unique environment.
|
||||
build platforms. It does this through creative use of ssh and scp
|
||||
commands to the remote build machines, so this will likely only work
|
||||
in my somewhat unique environment.
|
||||
|
||||
The goal here is to be able to start a build on one machine and have
|
||||
it take care of all the steps, including moving the source tarball to
|
||||
@@ -12,7 +12,7 @@ may be copied to a public server for others to play with.
|
||||
|
||||
Types of builds:
|
||||
|
||||
dry-run
|
||||
dryrun
|
||||
Nothing extra is done with the build, this is just for
|
||||
my own testing.
|
||||
|
||||
@@ -21,14 +21,17 @@ Types of builds:
|
||||
datestamp, and if the build is successful the results
|
||||
are copied to a daily build folder on starship.
|
||||
|
||||
release-cantidate
|
||||
release
|
||||
The results are uploaded to the previews foler on
|
||||
starship if the build is successful.
|
||||
|
||||
|
||||
The master script in this folder is "make-all" which will setup and
|
||||
control the whole process. The other scripts are what are run on each
|
||||
build machine, most of which will also call out to other scripts that
|
||||
already exist, etc.
|
||||
The master script in this folder is build-all (written in Python)
|
||||
which will setup and control the whole process. The other scripts
|
||||
(using bash) are launched from build-all either to do specific tasks
|
||||
locally, or to run on each individual build machine to manage the
|
||||
build process there, usually by calling out to other scripts that
|
||||
already exist. The build-all script uses the taskrunner.py and
|
||||
subprocess Python modules.
|
||||
|
||||
|
||||
|
||||
@@ -1,410 +1,256 @@
|
||||
#!/bin/bash
|
||||
# ---------------------------------------------------------------------------
|
||||
# Master build script for building all the installers and such on all the
|
||||
# build machines in my lab, and then distributing the results as needed.
|
||||
# ---------------------------------------------------------------------------
|
||||
#!/usr/bin/python
|
||||
#----------------------------------------------------------------------
|
||||
# Name: build-all.py
|
||||
# Purpose: Master build script for building all the installers and
|
||||
# such on all the build machines in my lab, and then
|
||||
# distributing the results as needed.
|
||||
#
|
||||
# This will replace the build-all bash script and is
|
||||
# needed because the needs of the build have outgrown
|
||||
# what I can do with bash.
|
||||
#
|
||||
# Author: Robin Dunn
|
||||
#
|
||||
# Created: 05-Nov-2004
|
||||
# RCS-ID: $Id$
|
||||
# Copyright: (c) 2004 by Total Control Software
|
||||
# Licence: wxWindows license
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
set -o errexit
|
||||
#set -o xtrace
|
||||
import sys
|
||||
import os
|
||||
import time
|
||||
from taskrunner import Job, Task, TaskRunner
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Some control variables...
|
||||
#----------------------------------------------------------------------
|
||||
# Configuration items
|
||||
|
||||
class Config:
|
||||
def write(self, filename="config", outfile=None):
|
||||
if outfile is None:
|
||||
f = file(filename, "w")
|
||||
else:
|
||||
f = outfile
|
||||
for k, v in self.__dict__.items():
|
||||
f.write('%s="%s"\n' % (k, v))
|
||||
|
||||
config = Config()
|
||||
|
||||
# the local spot that we put everything when done, before possibly copying
|
||||
# to remote hosts
|
||||
STAGING_DIR=./BUILD
|
||||
config.STAGING_DIR = "./BUILD"
|
||||
|
||||
|
||||
# host name of the machine to use for windows builds
|
||||
WIN_HOST=beast
|
||||
config.WIN_HOST = "beast"
|
||||
# Where is the build dir from the remote machine's perspective?
|
||||
WIN_BUILD=/c/BUILD
|
||||
config.WIN_BUILD = "/c/BUILD"
|
||||
|
||||
|
||||
# Just like the above
|
||||
OSX_HOST_panther=bigmac
|
||||
OSX_HOST_jaguar=whopper
|
||||
OSX_BUILD=/tmp/BUILD
|
||||
config.OSX_HOST_panther = "bigmac"
|
||||
config.OSX_HOST_jaguar = "whopper"
|
||||
config.OSX_BUILD = "/BUILD"
|
||||
|
||||
|
||||
# Alsmost the same... See below for hosts and other info
|
||||
LINUX_BUILD=/tmp/BUILD
|
||||
config.LINUX_BUILD = "/tmp/BUILD"
|
||||
|
||||
|
||||
# Upload server locations
|
||||
UPLOAD_HOST=starship.python.net
|
||||
UPLOAD_DAILY_ROOT=/home/crew/robind/public_html/wxPython/daily
|
||||
UPLOAD_PREVIEW_ROOT=/home/crew/robind/public_html/wxPython/preview
|
||||
config.UPLOAD_HOST = "starship.python.net"
|
||||
config.UPLOAD_DAILY_ROOT = "/home/crew/robind/public_html/wxPython/daily"
|
||||
config.UPLOAD_PREVIEW_ROOT = "/home/crew/robind/public_html/wxPython/preview"
|
||||
|
||||
# defaults for build options
|
||||
config.KIND = "dryrun"
|
||||
config.PYVER = "2.3"
|
||||
config.skipsource = "no"
|
||||
config.onlysource = "no"
|
||||
config.skipdocs = "no"
|
||||
config.skipwin = "no"
|
||||
config.skiposx = "no"
|
||||
config.skiplinux = "no"
|
||||
config.skipclean = "no"
|
||||
config.skipupload = "no"
|
||||
config.skipnewdocs = "no"
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Define all the build tasks
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# functions
|
||||
class Job(Job):
|
||||
LOGBASE = "./tmp"
|
||||
|
||||
function usage {
|
||||
echo ""
|
||||
echo "Usage: $0 [command flags...]"
|
||||
echo ""
|
||||
echo "build types:"
|
||||
echo " dryrun Do the build, but don't copy anywhere (default)"
|
||||
echo " daily Do a daily build, copy to starship"
|
||||
echo " release Do a normal release build, copy to starship"
|
||||
echo ""
|
||||
echo "optional command flags:"
|
||||
echo " 2.2 Build for Python 2.2 (default=off)"
|
||||
echo " 2.3 Build for Python 2.3 (default=on)"
|
||||
echo " all Build for all supported Python versions"
|
||||
echo ""
|
||||
echo " skipsource Don't build the source archives, use the ones"
|
||||
echo " already in the staging dir."
|
||||
echo " onlysource Exit after building the source archives"
|
||||
echo " skipwin Don't do the remote Windows build"
|
||||
echo " skiposx Don't do the remote OSX build"
|
||||
echo " skiplinux Don't do the remote Linux build"
|
||||
echo " skipclean Don't do the cleanup step on the remote builds"
|
||||
echo ""
|
||||
CFGFILE = "./tmp/config"
|
||||
|
||||
|
||||
}
|
||||
# Things that need to be done before any of the builds
|
||||
initialTask = Task([ Job("", ["distrib/all/build-setup", CFGFILE]),
|
||||
Job("", ["distrib/all/build-docs", CFGFILE]),
|
||||
Job("", ["distrib/all/build-sources", CFGFILE]),
|
||||
])
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Build tasks. Anything that can be done in parallel (depends greatly
|
||||
# on the nature of the build machine configurations...) is a separate
|
||||
# task.
|
||||
windowsTask = Task( Job("beast", ["distrib/all/build-windows", CFGFILE]) )
|
||||
|
||||
# Make sure we are running in the right directory. TODO: make this
|
||||
# test more robust. Currenly we just test for the presence of
|
||||
# 'wxPython' and 'wx' subdirs.
|
||||
if [ ! -d wxPython -o ! -d wx ]; then
|
||||
echo "Please run this script from the root wxPython directory."
|
||||
exit 1
|
||||
fi
|
||||
jaguarTask = Task( Job(config.OSX_HOST_jaguar,
|
||||
["distrib/all/build-osx", CFGFILE, config.OSX_HOST_jaguar, "jaguar"]) )
|
||||
|
||||
pantherTask = Task( Job(config.OSX_HOST_panther,
|
||||
["distrib/all/build-osx", CFGFILE, config.OSX_HOST_panther, "panther"]) )
|
||||
|
||||
rpmTask = Task([ Job("co-rh9", ["distrib/all/build-rpm", CFGFILE, "beast", "co-rh9", "rh9", "config"]),
|
||||
Job("co-fc2", ["distrib/all/build-rpm", CFGFILE, "beast", "co-fc2", "fc2", "2.3"]),
|
||||
Job("co-mdk92", ["distrib/all/build-rpm", CFGFILE, "beast", "co-mdk92", "mdk92", "2.3"]),
|
||||
Job("co-mdk101", ["distrib/all/build-rpm", CFGFILE, "beast", "co-mdk101","mdk101","2.3"]),
|
||||
])
|
||||
|
||||
buildTasks = [ windowsTask,
|
||||
jaguarTask,
|
||||
pantherTask,
|
||||
rpmTask,
|
||||
]
|
||||
|
||||
# Finalization. This is for things that must wait until all the
|
||||
# builds are done, such as copying the installers someplace, sending
|
||||
# emails, etc.
|
||||
finalizationTask = Task( Job("", ["distrib/all/build-finalize", CFGFILE]) )
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
# Set defaults and check the command line options
|
||||
KIND=dryrun
|
||||
PYVER=2.3
|
||||
skipsource=no
|
||||
onlysource=no
|
||||
skipwin=no
|
||||
skiposx=no
|
||||
skiplinux=no
|
||||
skipclean=no
|
||||
|
||||
for flag in $*; do
|
||||
case $flag in
|
||||
dryrun) KIND=dryrun ;;
|
||||
daily) KIND=daily ;;
|
||||
release) KIND=release ;;
|
||||
|
||||
2.2) PYVER=2.2 ;;
|
||||
2.3) PYVER=2.3 ;;
|
||||
all) PYVER="2.2 2.3" ;;
|
||||
|
||||
skipsource) skipsource=yes ;;
|
||||
onlysource) onlysource=yes ;;
|
||||
skipwin) skipwin=yes ;;
|
||||
skiposx) skiposx=yes ;;
|
||||
skiplinux) skiplinux=yes ;;
|
||||
skipclean) skipclean=yes ;;
|
||||
|
||||
help) usage; exit 1 ;;
|
||||
*) echo "Unknown flag \"$flag\""
|
||||
usage
|
||||
exit 1
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
# ensure the staging area exists
|
||||
if [ ! -d $STAGING_DIR ]; then
|
||||
mkdir -p $STAGING_DIR
|
||||
fi
|
||||
|
||||
# Figure out the wxPython version number, possibly adjusted for being a daily build
|
||||
if [ $KIND = daily ]; then
|
||||
DAILY=`date +%Y%m%d` # should it include the hour too? 2-digit year?
|
||||
echo $DAILY > DAILY_BUILD
|
||||
fi
|
||||
VERSION=`python -c "import setup;print setup.VERSION"`
|
||||
|
||||
|
||||
#echo VERSION=$VERSION
|
||||
#exit 0
|
||||
|
||||
echo "Getting started at " `date`
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Make the sources and other basic stuff.
|
||||
|
||||
if [ $skipsource != yes -o $onlysource = yes ]; then
|
||||
|
||||
# clean out the local dist dir
|
||||
rm -f dist/*
|
||||
|
||||
# Regenerate the reST docs
|
||||
echo "Regenerating the reST docs..."
|
||||
cd docs
|
||||
for x in *.txt; do
|
||||
docutils-html $x `basename $x .txt`.html
|
||||
done
|
||||
cd -
|
||||
|
||||
# build the doc and demo tarballs
|
||||
distrib/makedemo
|
||||
distrib/makedocs
|
||||
|
||||
# build the new docs too
|
||||
docs/bin/everything
|
||||
|
||||
# make the source tarball
|
||||
distrib/makerpm 2.3 skipclean skiprpm gtk2
|
||||
|
||||
# make the source RPMs
|
||||
for ver in $PYVER; do
|
||||
distrib/makerpm $ver skipclean skipcopy skiptar srpm
|
||||
distrib/makerpm $ver skipclean skipcopy skiptar srpm gtk2
|
||||
done
|
||||
|
||||
# Copy everything to the staging dir
|
||||
echo "Moving stuff to $STAGING_DIR..."
|
||||
rm -f dist/*.spec
|
||||
mv dist/* $STAGING_DIR
|
||||
for doc in CHANGES BUILD INSTALL MigrationGuide default; do
|
||||
cp docs/$doc.* $STAGING_DIR
|
||||
done
|
||||
|
||||
# cleanup
|
||||
echo "Cleaning up..."
|
||||
rm -f dist/*
|
||||
rm -rf _build_rpm
|
||||
fi
|
||||
|
||||
if [ $KIND = daily ]; then
|
||||
rm DAILY_BUILD
|
||||
fi
|
||||
|
||||
if [ $onlysource = yes ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Windows build
|
||||
|
||||
if [ $skipwin != yes ]; then
|
||||
echo "-=-=- Starting Windows build..."
|
||||
|
||||
echo "Copying source file and build script..."
|
||||
scp $STAGING_DIR/wxPythonSrc-$VERSION.tar.gz \
|
||||
distrib/all/build-windows \
|
||||
$WIN_HOST:$WIN_BUILD
|
||||
def usage():
|
||||
print ""
|
||||
print "Usage: build-all [command flags...]"
|
||||
print ""
|
||||
print "build types:"
|
||||
print " dryrun Do the build, but don't copy anywhere (default)"
|
||||
print " daily Do a daily build, copy to starship"
|
||||
print " release Do a normal release (cantidate) build, copy to starship"
|
||||
print ""
|
||||
print "optional command flags:"
|
||||
print " 2.2 Build for Python 2.2 (default=off)"
|
||||
print " 2.3 Build for Python 2.3 (default=on)"
|
||||
print " all Build for all supported Python versions"
|
||||
print ""
|
||||
print " skipsource Don't build the source archives, use the ones"
|
||||
print " already in the staging dir."
|
||||
print " onlysource Exit after building the source and docs archives"
|
||||
print " skipdocs Don't rebuild the docs"
|
||||
print " skipwin Don't do the remote Windows build"
|
||||
print " skiposx Don't do the remote OSX build"
|
||||
print " skiplinux Don't do the remote Linux build"
|
||||
print " skipclean Don't do the cleanup step on the remote builds"
|
||||
print " skipupload Don't upload the builds to starship"
|
||||
print ""
|
||||
|
||||
echo "Running build script on $WIN_HOST..."
|
||||
wxdir=$WIN_BUILD/wxPythonSrc-$VERSION
|
||||
cmd=./build-windows
|
||||
ssh $WIN_HOST "cd $WIN_BUILD && $cmd $wxdir $WIN_BUILD $skipclean $VERSION $PYVER && rm $cmd"
|
||||
|
||||
echo "Fetching the results..."
|
||||
scp $WIN_HOST:$WIN_BUILD/wxPythonWIN32* $STAGING_DIR
|
||||
ssh $WIN_HOST "rm $WIN_BUILD/wxPythonWIN32*"
|
||||
fi
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
def main(args):
|
||||
# Make sure we are running in the right directory. TODO: make
|
||||
# this test more robust. Currenly we just test for the presence
|
||||
# of 'wxPython' and 'wx' subdirs.
|
||||
if not os.path.isdir("wxPython") or not os.path.isdir("wx"):
|
||||
print "Please run this script from the root wxPython directory."
|
||||
sys.exit(1)
|
||||
|
||||
# Check command line flags
|
||||
for flag in args:
|
||||
if flag in ["dryrun", "daily", "release"]:
|
||||
config.KIND = flag
|
||||
|
||||
elif flag in ["2.2", "2.3"]:
|
||||
config.PYVER = flag
|
||||
elif flag == "all":
|
||||
config.PYVER = "2.2 2.3"
|
||||
|
||||
elif flag == "skipsource":
|
||||
config.skipsource = "yes"
|
||||
|
||||
elif flag == "onlysource":
|
||||
config.onlysource = "yes"
|
||||
|
||||
elif flag == "skipdocs":
|
||||
config.skipdocs = "yes"
|
||||
|
||||
elif flag == "skipnewdocs":
|
||||
config.skipnewdocs = "yes"
|
||||
|
||||
elif flag == "skipwin":
|
||||
config.skipwin = "yes"
|
||||
|
||||
elif flag == "skiposx":
|
||||
config.skiposx = "yes"
|
||||
|
||||
elif flag == "skiplinux":
|
||||
config.skiplinux = "yes"
|
||||
|
||||
elif flag == "skipclean":
|
||||
config.skipclean = "yes"
|
||||
|
||||
elif flag == "skipupload":
|
||||
config.skipupload = "yes"
|
||||
|
||||
else:
|
||||
print 'Unknown flag: "%s"' % flag
|
||||
usage()
|
||||
sys.exit(2)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# OSX build
|
||||
# ensure the staging area exists
|
||||
if not os.path.exists(config.STAGING_DIR):
|
||||
os.makedirs(config.STAGING_DIR)
|
||||
|
||||
function DoOSXBuild {
|
||||
local host=$1
|
||||
local flavor=$2
|
||||
# Figure out the wxPython version number, possibly adjusted for being a daily build
|
||||
if config.KIND == "daily":
|
||||
t = time.localtime()
|
||||
config.DAILY = time.strftime("%Y%m%d") # should it include the hour too? 2-digit year?
|
||||
file("DAILY_BUILD", "w").write(config.DAILY)
|
||||
sys.path.append('.')
|
||||
import setup
|
||||
config.VERSION = setup.VERSION
|
||||
|
||||
# test if the target machine is online
|
||||
if ping -q -c1 -w1 $host > /dev/null; then
|
||||
echo "-----------------------------------------------------------------"
|
||||
echo " The $host machine is online, OSX-$flavor build continuing..."
|
||||
echo "-----------------------------------------------------------------"
|
||||
else
|
||||
echo "-----------------------------------------------------------------"
|
||||
echo "The $host machine is offline, skipping the OSX-$flavor build."
|
||||
echo "-----------------------------------------------------------------"
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "-=-=- Starting OSX-$flavor build on $host..."
|
||||
|
||||
echo "Copying source files and build script..."
|
||||
ssh root@$host "mkdir -p $OSX_BUILD && rm -rf $OSX_BUILD/* || true"
|
||||
scp $STAGING_DIR/wxPythonSrc-$VERSION.tar.gz \
|
||||
$STAGING_DIR/wxPythonDocs-$VERSION.tar.gz \
|
||||
$STAGING_DIR/wxPythonDemo-$VERSION.tar.gz \
|
||||
distrib/all/build-osx \
|
||||
root@$host:$OSX_BUILD
|
||||
|
||||
echo "Running build script on $host..."
|
||||
wxdir=$OSX_BUILD/wxPythonSrc-$VERSION
|
||||
cmd=./build-osx
|
||||
ssh root@$host "cd $OSX_BUILD && $cmd $wxdir $OSX_BUILD $skipclean $VERSION $flavor $PYVER && rm $cmd"
|
||||
|
||||
echo "Fetching the results..."
|
||||
scp "root@$host:$OSX_BUILD/wxPythonOSX*" $STAGING_DIR
|
||||
ssh root@$host "rm $OSX_BUILD/wxPythonOSX*"
|
||||
|
||||
}
|
||||
# write the config file where the build scripts can find it
|
||||
config.write(CFGFILE)
|
||||
print "Build getting started at: ", time.ctime()
|
||||
|
||||
|
||||
if [ $skiposx != yes ]; then
|
||||
# Run the first task, which will create the docs and sources tarballs
|
||||
tr = TaskRunner(initialTask)
|
||||
rc = tr.run()
|
||||
|
||||
DoOSXBuild $OSX_HOST_panther panther
|
||||
DoOSXBuild $OSX_HOST_jaguar jaguar
|
||||
# cleanup the DAILY_BUILD file
|
||||
if config.KIND == "daily":
|
||||
os.unlink("DAILY_BUILD")
|
||||
|
||||
fi
|
||||
# Quit now?
|
||||
if rc != 0 or config.onlysource == "yes":
|
||||
sys.exit(rc)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Linux build
|
||||
# Run the main build tasks
|
||||
tr = TaskRunner(buildTasks)
|
||||
rc = tr.run()
|
||||
if rc != 0:
|
||||
sys.exit(rc)
|
||||
|
||||
# The remote Linux builds are different than those above. The source
|
||||
# RPMs were already built in the source step, and so building the
|
||||
# binary RPMs is a very simple followup step. But then add to that
|
||||
# the fact that we need to build on more than one distro...
|
||||
|
||||
function DoLinuxBuild {
|
||||
local host=$1
|
||||
local reltag=$2
|
||||
shift;shift
|
||||
local pyver=$@
|
||||
# when all the builds are done, run the finalization task
|
||||
tr = TaskRunner(finalizationTask)
|
||||
rc = tr.run()
|
||||
if rc != 0:
|
||||
sys.exit(rc)
|
||||
|
||||
# test if the target machine is online
|
||||
if ping -q -c1 -w1 $host > /dev/null; then
|
||||
echo "-----------------------------------------------------------------"
|
||||
echo " The $host machine is online, build continuing..."
|
||||
echo "-----------------------------------------------------------------"
|
||||
else
|
||||
echo "-----------------------------------------------------------------"
|
||||
echo "The $host machine is offline, skipping the binary RPM build."
|
||||
echo "-----------------------------------------------------------------"
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "Copying source files and build script..."
|
||||
ssh root@$host "mkdir -p $LINUX_BUILD && rm -rf $LINUX_BUILD/*"
|
||||
scp $STAGING_DIR/wxPython*.src.rpm \
|
||||
distrib/all/build-linux \
|
||||
root@$host:$LINUX_BUILD
|
||||
|
||||
echo "Running build script on $host..."
|
||||
cmd=./build-linux
|
||||
ssh root@$host "cd $LINUX_BUILD && ./build-linux $reltag $skipclean $VERSION $pyver"
|
||||
|
||||
echo "Fetching the results..."
|
||||
scp "root@$host:$LINUX_BUILD/wxPythonGTK*.i[0-9]86.rpm" $STAGING_DIR
|
||||
ssh root@$host "rm $LINUX_BUILD/wxPythonGTK*.i[0-9]86.rpm"
|
||||
|
||||
}
|
||||
|
||||
if [ $skiplinux != yes ]; then
|
||||
|
||||
DoLinuxBuild co-rh9 RH9 $PYVER
|
||||
DoLinuxBuild co-fc2 FC2 2.3
|
||||
|
||||
fi
|
||||
print "Build finished at: ", time.ctime()
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Final disposition of build results...
|
||||
|
||||
chmod a+r $STAGING_DIR/*
|
||||
|
||||
if [ $KIND = dryrun ]; then
|
||||
# we're done
|
||||
echo "Finished at " `date`
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
if [ $KIND = daily ]; then
|
||||
|
||||
destdir=$UPLOAD_DAILY_ROOT/$DAILY
|
||||
echo "Copying to the starship at $destdir..."
|
||||
ssh $UPLOAD_HOST "mkdir -p $destdir"
|
||||
scp $STAGING_DIR/* $UPLOAD_HOST:/$destdir
|
||||
ssh $UPLOAD_HOST "cd $destdir && ls -al"
|
||||
|
||||
|
||||
echo "Cleaning up staging dir..."
|
||||
rm $STAGING_DIR/*
|
||||
rmdir $STAGING_DIR
|
||||
|
||||
# TODO: something to remove old builds from starship, keeping
|
||||
# only N days worth
|
||||
|
||||
# Send email to wxPython-dev
|
||||
DATE=`date`
|
||||
TO=wxPython-dev@lists.wxwidgets.org
|
||||
|
||||
cat <<EOF | /usr/sbin/sendmail $TO
|
||||
From: R'bot <rbot@wxpython.org>
|
||||
To: $TO
|
||||
Subject: $DAILY test build uploaded
|
||||
Date: $DATE
|
||||
|
||||
Hi,
|
||||
|
||||
A new test build of wxPython has been uploaded to starship.
|
||||
|
||||
Version: $VERSION
|
||||
URL: http://starship.python.net/crew/robind/wxPython/daily/$DAILY
|
||||
Changes: http://starship.python.net/crew/robind/wxPython/daily/$DAILY/CHANGES.html
|
||||
|
||||
Have fun!
|
||||
R'bot
|
||||
|
||||
EOF
|
||||
|
||||
echo "Finished at " `date`
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
if [ $KIND = release ]; then
|
||||
|
||||
echo "Copying to the local file server..."
|
||||
destdir=/stuff/Development/wxPython/dist/$VERSION
|
||||
mkdir -p $destdir
|
||||
cp $STAGING_DIR/* $destdir
|
||||
|
||||
echo "Copying to the starship..."
|
||||
destdir=$UPLOAD_PREVIEW_ROOT/$VERSION
|
||||
ssh $UPLOAD_HOST "mkdir -p $destdir"
|
||||
scp $STAGING_DIR/* $UPLOAD_HOST:/$destdir
|
||||
|
||||
echo "Cleaning up staging dir..."
|
||||
rm $STAGING_DIR/*
|
||||
rmdir $STAGING_DIR
|
||||
|
||||
# Send email to wxPython-dev
|
||||
DATE=`date`
|
||||
TO=wxPython-dev@lists.wxwidgets.org
|
||||
|
||||
cat <<EOF | /usr/sbin/sendmail $TO
|
||||
From: R'bot <rbot@wxpython.org>
|
||||
To: $TO
|
||||
Subject: $VERSION release candidate build uploaded
|
||||
Date: $DATE
|
||||
|
||||
Hi,
|
||||
|
||||
A new RC build of wxPython has been uploaded to starship.
|
||||
|
||||
Version: $VERSION
|
||||
URL: http://starship.python.net/crew/robind/wxPython/preview/$VERSION
|
||||
Changes: http://starship.python.net/crew/robind/wxPython/preview/$VERSION/CHANGES.html
|
||||
|
||||
Have fun!
|
||||
R'bot
|
||||
|
||||
EOF
|
||||
|
||||
echo "Finished at " `date`
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1:])
|
||||
|
||||
36
wxPython/distrib/all/build-docs
Executable file
36
wxPython/distrib/all/build-docs
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
set -o errexit
|
||||
|
||||
# read the config variables from the file given on the command line
|
||||
. $1
|
||||
|
||||
|
||||
if [ $skipdocs != yes ]; then
|
||||
# Regenerate the reST docs
|
||||
echo "Regenerating the reST docs..."
|
||||
cd docs
|
||||
for x in *.txt; do
|
||||
docutils-html $x `basename $x .txt`.html
|
||||
done
|
||||
cd -
|
||||
for doc in CHANGES BUILD INSTALL MigrationGuide default; do
|
||||
cp docs/$doc.* $STAGING_DIR
|
||||
done
|
||||
|
||||
# build the doc and demo tarballs
|
||||
distrib/makedemo
|
||||
distrib/makedocs
|
||||
mv dist/wxPython-docs-$VERSION.tar.gz $STAGING_DIR
|
||||
mv dist/wxPython-demo-$VERSION.tar.gz $STAGING_DIR
|
||||
|
||||
|
||||
# build the new docs too
|
||||
if [ $skipnewdocs != yes ]; then
|
||||
docs/bin/everything
|
||||
mv dist/wxPython-newdocs-$VERSION.tar.gz $STAGING_DIR
|
||||
fi
|
||||
fi
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
115
wxPython/distrib/all/build-finalize
Executable file
115
wxPython/distrib/all/build-finalize
Executable file
@@ -0,0 +1,115 @@
|
||||
#!/bin/bash
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
set -o errexit
|
||||
|
||||
# read the config variables from the file given on the command line
|
||||
. $1
|
||||
|
||||
|
||||
|
||||
|
||||
chmod a+r $STAGING_DIR/*
|
||||
|
||||
if [ $KIND = dryrun ]; then
|
||||
# we're done leave the files in the staging dir and quit
|
||||
echo "Not uploading dryrun."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
if [ $KIND = daily ]; then
|
||||
|
||||
echo "Copying to the local file server..."
|
||||
destdir=/stuff/temp/$VERSION
|
||||
mkdir -p $destdir
|
||||
cp $STAGING_DIR/* $destdir
|
||||
|
||||
if [ $skipupload != yes ]; then
|
||||
destdir=$UPLOAD_DAILY_ROOT/$DAILY
|
||||
echo "Copying to the starship at $destdir..."
|
||||
ssh $UPLOAD_HOST "mkdir -p $destdir"
|
||||
scp $STAGING_DIR/* $UPLOAD_HOST:/$destdir
|
||||
ssh $UPLOAD_HOST "cd $destdir && ls -al"
|
||||
|
||||
|
||||
# TODO: something to remove old builds from starship, keeping
|
||||
# only N days worth
|
||||
|
||||
# Send email to wxPython-dev
|
||||
DATE=`date`
|
||||
TO=wxPython-dev@lists.wxwidgets.org
|
||||
|
||||
cat <<EOF | /usr/sbin/sendmail $TO
|
||||
From: R'bot <rbot@wxpython.org>
|
||||
To: $TO
|
||||
Subject: $DAILY test build uploaded
|
||||
Date: $DATE
|
||||
|
||||
Hi,
|
||||
|
||||
A new test build of wxPython has been uploaded to starship.
|
||||
|
||||
Version: $VERSION
|
||||
URL: http://starship.python.net/crew/robind/wxPython/daily/$DAILY
|
||||
Changes: http://starship.python.net/crew/robind/wxPython/daily/$DAILY/CHANGES.html
|
||||
|
||||
Have fun!
|
||||
R'bot
|
||||
|
||||
EOF
|
||||
fi
|
||||
|
||||
echo "Cleaning up staging dir..."
|
||||
rm $STAGING_DIR/*
|
||||
rmdir $STAGING_DIR
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
if [ $KIND = release ]; then
|
||||
|
||||
echo "Copying to the local file server..."
|
||||
destdir=/stuff/Development/wxPython/dist/$VERSION
|
||||
mkdir -p $destdir
|
||||
cp $STAGING_DIR/* $destdir
|
||||
|
||||
if [ $skipupload != yes ]; then
|
||||
echo "Copying to the starship..."
|
||||
destdir=$UPLOAD_PREVIEW_ROOT/$VERSION
|
||||
ssh $UPLOAD_HOST "mkdir -p $destdir"
|
||||
scp $STAGING_DIR/* $UPLOAD_HOST:/$destdir
|
||||
|
||||
# Send email to wxPython-dev
|
||||
DATE=`date`
|
||||
TO=wxPython-dev@lists.wxwidgets.org
|
||||
|
||||
cat <<EOF | /usr/sbin/sendmail $TO
|
||||
From: R'bot <rbot@wxpython.org>
|
||||
To: $TO
|
||||
Subject: $VERSION release candidate build uploaded
|
||||
Date: $DATE
|
||||
|
||||
Hi,
|
||||
|
||||
A new RC build of wxPython has been uploaded to starship.
|
||||
|
||||
Version: $VERSION
|
||||
URL: http://starship.python.net/crew/robind/wxPython/preview/$VERSION
|
||||
Changes: http://starship.python.net/crew/robind/wxPython/preview/$VERSION/CHANGES.html
|
||||
|
||||
Have fun!
|
||||
R'bot
|
||||
|
||||
EOF
|
||||
|
||||
fi
|
||||
|
||||
echo "Cleaning up staging dir..."
|
||||
rm $STAGING_DIR/*
|
||||
rmdir $STAGING_DIR
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@@ -1,65 +1,40 @@
|
||||
#!/bin/bash
|
||||
# ---------------------------------------------------------------------------
|
||||
# Build wxWidgets and wxPython on a OSX box. This is normally
|
||||
# called from build-all but it should be able to be used standalone too...
|
||||
#
|
||||
# The command line must have the following parameters:
|
||||
#
|
||||
# 1. the path to the base of the wx source tree
|
||||
# 2. the path of where to put the resulting installers
|
||||
# 3. skipclean flag (yes|no)
|
||||
# 4. the VERSION
|
||||
# 5. the FLAVOR (panther or jaguar)
|
||||
# *. the remaining args are the versions of Python to build for
|
||||
#
|
||||
# ---------------------------------------------------------------------------
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
set -o errexit
|
||||
#set -o xtrace
|
||||
|
||||
echo "-=-=-=- Hello from $HOSTNAME -=-=-=-"
|
||||
# read the config variables from the file given on the command line
|
||||
. $1
|
||||
|
||||
if [ $# -lt 6 ]; then
|
||||
echo "Usage: $0 WXDIR DESTDIR SKIPCLEAN VERSION FLAVOR PYVER..."
|
||||
exit 1
|
||||
|
||||
host=$2
|
||||
flavor=$3
|
||||
|
||||
if [ $skiposx != yes ]; then
|
||||
# test if the target machine is online
|
||||
if ping -q -c1 -w1 $host > /dev/null; then
|
||||
echo " The $host machine is online, OSX-$flavor build continuing..."
|
||||
else
|
||||
echo "The $host machine is **OFFLINE**, skipping the OSX-$flavor build."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Copying source files and build script..."
|
||||
ssh root@$host "mkdir -p $OSX_BUILD && rm -rf $OSX_BUILD/* || true"
|
||||
|
||||
scp $STAGING_DIR/wxPython-src-$VERSION.tar.gz \
|
||||
$STAGING_DIR/wxPython-docs-$VERSION.tar.gz \
|
||||
$STAGING_DIR/wxPython-demo-$VERSION.tar.gz \
|
||||
distrib/all/do-build-osx \
|
||||
root@$host:$OSX_BUILD
|
||||
|
||||
echo "Running build script on $host..."
|
||||
wxdir=$OSX_BUILD/wxPython-src-$VERSION
|
||||
cmd=./do-build-osx
|
||||
ssh root@$host "cd $OSX_BUILD && $cmd $wxdir $OSX_BUILD $skipclean $VERSION $flavor $PYVER && rm $cmd"
|
||||
|
||||
echo "Fetching the results..."
|
||||
scp "root@$host:$OSX_BUILD/wxPython*-osx*" $STAGING_DIR
|
||||
ssh root@$host "rm $OSX_BUILD/wxPython*-osx*"
|
||||
fi
|
||||
|
||||
WXDIR=$1
|
||||
DESTDIR=$2
|
||||
SKIPCLEAN=$3
|
||||
VERSION=$4
|
||||
FLAVOR=$5
|
||||
shift;shift;shift;shift;shift
|
||||
PYVER=$@
|
||||
|
||||
|
||||
export PATH=/sw/bin:/usr/local/bin:$PATH
|
||||
|
||||
|
||||
# untar the source
|
||||
echo "Unarchiving wxPythonSrc-$VERSION.tar.gz"
|
||||
cd $DESTDIR
|
||||
tar xzf wxPythonSrc-$VERSION.tar.gz
|
||||
rm wxPythonSrc-$VERSION.tar.gz
|
||||
|
||||
|
||||
echo "Invoking wxPythonOSX build script..."
|
||||
cd $WXDIR/wxPython
|
||||
export TARBALLDIR=$DESTDIR
|
||||
mkdir -p dist
|
||||
distrib/mac/wxPythonOSX/build $FLAVOR inplace skipclean
|
||||
|
||||
|
||||
echo "Copying installers to $DESTDIR..."
|
||||
cp dist/*.dmg $DESTDIR
|
||||
cd $DESTDIR
|
||||
|
||||
|
||||
if [ $SKIPCLEAN != yes ]; then
|
||||
echo "Cleaning up..."
|
||||
rm -r $WXDIR || true
|
||||
rm wxPythonDocs-$VERSION.tar.gz
|
||||
rm wxPythonDemo-$VERSION.tar.gz
|
||||
fi
|
||||
|
||||
echo "-=-=-=- Goodbye! -=-=-=-"
|
||||
|
||||
98
wxPython/distrib/all/build-rpm
Executable file
98
wxPython/distrib/all/build-rpm
Executable file
@@ -0,0 +1,98 @@
|
||||
#!/bin/bash
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
set -o errexit
|
||||
|
||||
# read the config variables from the file given on the command line
|
||||
. $1
|
||||
|
||||
coHost=$2
|
||||
host=$3
|
||||
reltag=$4
|
||||
shift;shift;shift;shift
|
||||
pyver=$@
|
||||
|
||||
if [ $pyver = config ]; then
|
||||
pyver=$PYVER
|
||||
fi
|
||||
|
||||
|
||||
function TestOnline {
|
||||
local host=$1
|
||||
local message=$2
|
||||
|
||||
if ping -q -c1 -w1 $host > /dev/null; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
if [ $skiplinux != yes ]; then
|
||||
|
||||
startedCoHost=no
|
||||
hostAvailable=no
|
||||
|
||||
# test if the target machine is online
|
||||
if TestOnline $host; then
|
||||
hostAvailable=yes
|
||||
else
|
||||
# Attempt to start the host via it's coLinux host, if there is one
|
||||
if [ $coHost != none ]; then
|
||||
if TestOnline $coHost; then
|
||||
echo "Attempting to start $host via coLinux on $coHost..."
|
||||
ssh $coHost "/c/coLinux/VMs/$host.bat -d > /dev/null 2>&1 &"
|
||||
|
||||
# Give it time to boot and be ready for conenctions,
|
||||
# and then test with ssh, limiting retries.
|
||||
for x in `seq 12`; do
|
||||
sleep 5
|
||||
echo "checking..."
|
||||
if ssh root@$host "true" >/dev/null 2>&1; then
|
||||
# success! the host is ready so we can break out of the loop
|
||||
break;
|
||||
fi
|
||||
done
|
||||
|
||||
# test if the host is ready
|
||||
if TestOnline $host; then
|
||||
echo "coLinux start of $host on $coHost successful."
|
||||
startedCoHost=yes
|
||||
hostAvailable=yes
|
||||
fi
|
||||
else
|
||||
echo "The $coHost machine is offline, unable to start coLinux for $host"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $hostAvailable = yes ]; then
|
||||
echo "The $host machine is online, build continuing..."
|
||||
else
|
||||
echo "The $host machine is **OFFLINE**, skipping the binary RPM build."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
echo "Copying source files and build script..."
|
||||
ssh root@$host "mkdir -p $LINUX_BUILD && rm -rf $LINUX_BUILD/*"
|
||||
scp $STAGING_DIR/wxPython-src* $STAGING_DIR/wxPython.spec\
|
||||
distrib/all/do-build-rpm \
|
||||
root@$host:$LINUX_BUILD
|
||||
|
||||
echo "Running build script on $host..."
|
||||
cmd=./do-build-rpm
|
||||
ssh root@$host "cd $LINUX_BUILD && $cmd $reltag $skipclean $VERSION $pyver"
|
||||
|
||||
echo "Fetching the results..."
|
||||
scp "root@$host:$LINUX_BUILD/wxPython*.i[0-9]86.rpm" $STAGING_DIR
|
||||
ssh root@$host "rm $LINUX_BUILD/wxPython*.i[0-9]86.rpm"
|
||||
|
||||
|
||||
if [ $startedCoHost = yes ]; then
|
||||
echo "Halting $host on $coHost..."
|
||||
ssh root@$host "/sbin/halt"
|
||||
sleep 10
|
||||
fi
|
||||
fi
|
||||
12
wxPython/distrib/all/build-setup
Executable file
12
wxPython/distrib/all/build-setup
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
set -o errexit
|
||||
|
||||
# read the config variables from the file given on the command line
|
||||
. $1
|
||||
|
||||
|
||||
# clean out the local dist dir
|
||||
rm -f dist/*
|
||||
|
||||
18
wxPython/distrib/all/build-sources
Executable file
18
wxPython/distrib/all/build-sources
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
set -o errexit
|
||||
|
||||
# read the config variables from the file given on the command line
|
||||
. $1
|
||||
|
||||
if [ $skipsource != yes -o $onlysource = yes ]; then
|
||||
|
||||
# make the source tarball and srpm
|
||||
distrib/makerpm 2.3 srpm
|
||||
|
||||
# Copy everything to the staging dir
|
||||
echo "Moving stuff to $STAGING_DIR..."
|
||||
mv dist/* $STAGING_DIR
|
||||
|
||||
fi
|
||||
@@ -1,128 +1,32 @@
|
||||
#!/bin/bash
|
||||
# ---------------------------------------------------------------------------
|
||||
# Build wxWidgets and wxPython on a Windows box. This is normally called
|
||||
# from build-all but it should be able to be used standalone too...
|
||||
#
|
||||
# The command line must have the following parameters:
|
||||
#
|
||||
# 1. the path to the base of the wx source tree
|
||||
# 2. the path of where to put the resulting installers
|
||||
# 3. skipclean flag (yes|no)
|
||||
# 4. the VERSION
|
||||
# 5. the remaining args are the versions of Python to build for
|
||||
#
|
||||
# ---------------------------------------------------------------------------
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
set -o errexit
|
||||
#set -o xtrace
|
||||
|
||||
echo "-=-=-=- Hello from $HOSTNAME -=-=-=-"
|
||||
|
||||
if [ $# -lt 5 ]; then
|
||||
echo "Usage: $0 WXDIR DESTDIR SKIPCLEAN VERSION PYVER..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
WXDIR=$1
|
||||
DESTDIR=$2
|
||||
SKIPCLEAN=$3
|
||||
VERSION=$4
|
||||
shift;shift;shift;shift
|
||||
PYVER=$@
|
||||
# read the config variables from the file given on the command line
|
||||
. $1
|
||||
|
||||
|
||||
# WXDIR is the cygwin path, WXWIN is the DOS path
|
||||
WXWIN_OLD=$WXWIN
|
||||
WXWIN=`cygpath -m $WXDIR`
|
||||
export WXWIN
|
||||
if [ $skipwin != yes ]; then
|
||||
# test if the target machine is online
|
||||
if ping -q -c1 -w1 $WIN_HOST > /dev/null; then
|
||||
echo " The $WIN_HOST machine is online, Windows build continuing..."
|
||||
else
|
||||
echo "The $WIN_HOST machine is **OFFLINE**, skipping the Windows build."
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "Copying source file and build script..."
|
||||
scp $STAGING_DIR/wxPython-src-$VERSION.tar.gz \
|
||||
distrib/all/do-build-windows \
|
||||
$WIN_HOST:$WIN_BUILD
|
||||
|
||||
echo "Running build script on $WIN_HOST..."
|
||||
wxdir=$WIN_BUILD/wxPython-src-$VERSION
|
||||
cmd=./do-build-windows
|
||||
ssh $WIN_HOST "cd $WIN_BUILD && $cmd $wxdir $WIN_BUILD $skipclean $VERSION $PYVER && rm $cmd"
|
||||
|
||||
# # Fix the PATH. (Why is this needed??)
|
||||
# PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/robind/bin:.:$WXDIR/lib/vc_dll:$PATH
|
||||
# export PATH
|
||||
# echo "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
|
||||
# echo $PATH
|
||||
# echo "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
|
||||
# exit 0
|
||||
|
||||
|
||||
# untar the source
|
||||
echo "Unarchiving wxPythonSrc-$VERSION.tar.gz"
|
||||
cd $DESTDIR
|
||||
tar xzf wxPythonSrc-$VERSION.tar.gz
|
||||
rm wxPythonSrc-$VERSION.tar.gz
|
||||
|
||||
|
||||
# Fix line endings
|
||||
echo "Converting wxPython line endings to CRLF..."
|
||||
cd $WXDIR
|
||||
names=`find wxPython -name "*.py" -o -name "*.txt" -o -name "*.htm*" -o -name "*.css" -o -name "*.h" -o -name "*.cpp" -o -name "*.c" -o -name "*.xml" `
|
||||
unix2dos -D $names
|
||||
|
||||
|
||||
# change to the right spot in the source tree and copy our build scripts
|
||||
echo "Setting up for the build..."
|
||||
cd $WXDIR/build/msw
|
||||
cp $WXDIR/wxPython/distrib/msw/.m* .
|
||||
|
||||
|
||||
# replace some settings in setup0.h and write to setup.h
|
||||
cat > .my.sedexpr <<EOF
|
||||
s/wxDIALOG_UNIT_COMPATIBILITY *1/wxDIALOG_UNIT_COMPATIBILITY 0/g
|
||||
s/wxUSE_DEBUG_CONTEXT *0/wxUSE_DEBUG_CONTEXT 1/g
|
||||
s/wxUSE_MEMORY_TRACING *0/wxUSE_MEMORY_TRACING 1/g
|
||||
s/wxUSE_DIALUP_MANAGER *1/wxUSE_DIALUP_MANAGER 0/g
|
||||
s/wxUSE_GLCANVAS *0/wxUSE_GLCANVAS 1/g
|
||||
s/wxUSE_POSTSCRIPT *0/wxUSE_POSTSCRIPT 1/g
|
||||
s/wxUSE_AFM_FOR_POSTSCRIPT *1/wxUSE_AFM_FOR_POSTSCRIPT 0/g
|
||||
s/wxUSE_DISPLAY *0/wxUSE_DISPLAY 1/g
|
||||
EOF
|
||||
cat $WXDIR/include/wx/msw/setup0.h | sed -f .my.sedexpr > $WXDIR/include/wx/msw/setup.h
|
||||
rm .my.sedexpr
|
||||
|
||||
|
||||
echo "Building the wx DLLs..."
|
||||
.make hybrid
|
||||
.make hybrid-uni
|
||||
|
||||
|
||||
echo "Building the wx tools..."
|
||||
.make_tools
|
||||
|
||||
# cheat and just copy the .CHM files from the regular project dir
|
||||
# TODO: Copy over the wxPythonDocs fle and run hhc on the contents of that.
|
||||
mkdir -p $WXDIR/docs/htmlhelp
|
||||
cp `cygpath $WXWIN_OLD/docs/htmlhelp`/*.chm $WXDIR/docs/htmlhelp
|
||||
|
||||
|
||||
echo "Building wxPython and installers..."
|
||||
cd $WXDIR/wxPython
|
||||
mkdir -p dist
|
||||
|
||||
for ver in $PYVER; do
|
||||
echo $ver
|
||||
b $ver d USE_SWIG=0
|
||||
b $ver h USE_SWIG=0
|
||||
b $ver r USE_SWIG=0
|
||||
b $ver d UNICODE=1 USE_SWIG=0
|
||||
b $ver h UNICODE=1 USE_SWIG=0
|
||||
b $ver r UNICODE=1 USE_SWIG=0
|
||||
done
|
||||
|
||||
echo "Building the developer package..."
|
||||
WXWIN=`cygpath -w $WXDIR`
|
||||
export WXWIN
|
||||
4nt /c distrib/makedev.bat $VERSION
|
||||
|
||||
|
||||
echo "Copying installers to $DESTDIR..."
|
||||
mv dist/wxPythonWIN32* $DESTDIR
|
||||
cd $DESTDIR
|
||||
|
||||
|
||||
if [ $SKIPCLEAN != yes ]; then
|
||||
echo "Cleaning up..."
|
||||
rm -r $WXDIR || true
|
||||
fi
|
||||
|
||||
echo "-=-=-=- Goodbye! -=-=-=-"
|
||||
echo "Fetching the results..."
|
||||
scp "$WIN_HOST:$WIN_BUILD/wxPython*-win32*" $STAGING_DIR
|
||||
ssh $WIN_HOST "rm $WIN_BUILD/wxPython*-win32*"
|
||||
fi
|
||||
71
wxPython/distrib/all/do-build-osx
Executable file
71
wxPython/distrib/all/do-build-osx
Executable file
@@ -0,0 +1,71 @@
|
||||
#!/bin/bash
|
||||
# ---------------------------------------------------------------------------
|
||||
# Build wxWidgets and wxPython on a OSX box. This is normally
|
||||
# called from build-all but it should be able to be used standalone too...
|
||||
#
|
||||
# The command line must have the following parameters:
|
||||
#
|
||||
# 1. the path to the base of the wx source tree
|
||||
# 2. the path of where to put the resulting installers
|
||||
# 3. skipclean flag (yes|no)
|
||||
# 4. the VERSION
|
||||
# 5. the KIND (panther or jaguar)
|
||||
# *. the remaining args are the versions of Python to build for
|
||||
#
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
set -o errexit
|
||||
#set -o xtrace
|
||||
|
||||
echo "-=-=-=- Hello from $HOSTNAME -=-=-=-"
|
||||
|
||||
if [ $# -lt 6 ]; then
|
||||
echo "Usage: $0 WXDIR DESTDIR SKIPCLEAN VERSION KIND PYVER..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
WXDIR=$1
|
||||
DESTDIR=$2
|
||||
SKIPCLEAN=$3
|
||||
VERSION=$4
|
||||
KIND=$5
|
||||
shift;shift;shift;shift;shift
|
||||
PYVER=$@
|
||||
|
||||
|
||||
#export PATH=/sw/bin:/usr/local/bin:$PATH
|
||||
export PATH=/sw/bin:/sw/sbin:/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:.:/usr/X11R6/bin
|
||||
echo "PATH =" $PATH
|
||||
echo "which gcc = " `which gcc`
|
||||
#exit 0
|
||||
|
||||
# untar the source
|
||||
echo "Unarchiving wxPython-src-$VERSION.tar.gz"
|
||||
cd $DESTDIR
|
||||
tar xzf wxPython-src-$VERSION.tar.gz
|
||||
rm wxPython-src-$VERSION.tar.gz
|
||||
|
||||
|
||||
echo "Invoking wxPythonOSX build script..."
|
||||
cd $WXDIR/wxPython
|
||||
export TARBALLDIR=$DESTDIR
|
||||
mkdir -p dist
|
||||
if [ $KIND = panther ]; then
|
||||
distrib/mac/wxPythonOSX/build $KIND inplace unicode
|
||||
fi
|
||||
distrib/mac/wxPythonOSX/build $KIND inplace
|
||||
|
||||
|
||||
echo "Copying installers to $DESTDIR..."
|
||||
cp dist/*.dmg $DESTDIR
|
||||
cd $DESTDIR
|
||||
|
||||
|
||||
if [ $SKIPCLEAN != yes ]; then
|
||||
echo "Cleaning up..."
|
||||
rm -r $WXDIR || true
|
||||
rm wxPython-docs-$VERSION.tar.gz
|
||||
rm wxPython-demo-$VERSION.tar.gz
|
||||
fi
|
||||
|
||||
echo "-=-=-=- Goodbye! -=-=-=-"
|
||||
@@ -31,52 +31,65 @@ PYVER=$@
|
||||
|
||||
rpmtop=_rpm_top
|
||||
|
||||
function DoRPMBuild {
|
||||
echo "*** Setting up RPM build dirs"
|
||||
for dir in SPECS BUILD RPMS SRPMS tmp; do
|
||||
if [ ! -d $rpmtop/$dir ]; then
|
||||
mkdir -p $rpmtop/$dir
|
||||
fi
|
||||
done
|
||||
if [ ! -e $rpmtop/SOURCES ]; then
|
||||
ln -s $PWD $rpmtop/SOURCES
|
||||
fi
|
||||
if which rpmbuild > /dev/null 2>&1; then
|
||||
RPMBUILD=rpmbuild
|
||||
else
|
||||
RPMBUILD=rpm
|
||||
fi
|
||||
|
||||
rpmbuild --define "_topdir $PWD/$rpmtop" \
|
||||
|
||||
function DoRPMBuild {
|
||||
# $1 : python version
|
||||
# $2 : port
|
||||
# $3 : unicode
|
||||
|
||||
echo "-=-=-=-=-=-=-=-=-=-=-"
|
||||
echo $1 $2 $3
|
||||
echo "-=-=-=-=-=-=-=-=-=-=-"
|
||||
|
||||
$RPMBUILD --define "_topdir $PWD/$rpmtop" \
|
||||
--define "_tmppath $PWD/$rpmtop/tmp" \
|
||||
--define "release $RELEASE" \
|
||||
$@
|
||||
--define "release ${RELEASE}_py$1" \
|
||||
--define "pyver $1" \
|
||||
--define "port $2" \
|
||||
--define "unicode $3" \
|
||||
-bb wxPython.spec
|
||||
|
||||
if [ $? != 0 ]; then
|
||||
return $?
|
||||
fi
|
||||
|
||||
echo "*** Moving RPMs to ."
|
||||
find $rpmtop -name "*.rpm"
|
||||
mv -f `find $rpmtop -name "*.rpm"` .
|
||||
|
||||
echo "*** Cleaning up $rpmtop"
|
||||
rm -rf $rpmtop
|
||||
}
|
||||
|
||||
|
||||
|
||||
echo "*** Setting up RPM build dirs"
|
||||
for dir in SPECS BUILD RPMS SOURCES SRPMS tmp; do
|
||||
if [ ! -d $rpmtop/$dir ]; then
|
||||
mkdir -p $rpmtop/$dir
|
||||
fi
|
||||
done
|
||||
|
||||
cp wxPython-src-$VERSION.tar.gz $rpmtop/SOURCES
|
||||
|
||||
echo "******************** PYVER = " $PYVER
|
||||
for ver in $PYVER; do
|
||||
echo "Building the RPMs for Python $ver..."
|
||||
for port in GTK GTK2; do
|
||||
rpm2cpio wxPython$port-py$ver-$VERSION-1.src.rpm | \
|
||||
cpio --extract -R root.
|
||||
DoRPMBuild -ba wxPython$port.spec
|
||||
done
|
||||
DoRPMBuild $ver gtk 0
|
||||
DoRPMBuild $ver gtk2 1
|
||||
DoRPMBuild $ver gtk2 0
|
||||
done
|
||||
|
||||
|
||||
echo "*** Moving RPMs to ."
|
||||
find $rpmtop -name "*.rpm"
|
||||
mv -f `find $rpmtop -name "*.rpm"` .
|
||||
|
||||
|
||||
if [ $SKIPCLEAN != yes ]; then
|
||||
echo "*** Cleaning up $rpmtop"
|
||||
rm -rf $rpmtop
|
||||
|
||||
echo "Cleaning up..."
|
||||
for ver in $PYVER; do
|
||||
rm wxPythonGTK-py$ver-$VERSION-*.src.rpm
|
||||
rm wxPythonGTK2-py$ver-$VERSION-*.src.rpm
|
||||
done
|
||||
rm *.spec *.tar.gz
|
||||
fi
|
||||
|
||||
128
wxPython/distrib/all/do-build-windows
Executable file
128
wxPython/distrib/all/do-build-windows
Executable file
@@ -0,0 +1,128 @@
|
||||
#!/bin/bash
|
||||
# ---------------------------------------------------------------------------
|
||||
# Build wxWidgets and wxPython on a Windows box. This is normally called
|
||||
# from build-all but it should be able to be used standalone too...
|
||||
#
|
||||
# The command line must have the following parameters:
|
||||
#
|
||||
# 1. the path to the base of the wx source tree
|
||||
# 2. the path of where to put the resulting installers
|
||||
# 3. skipclean flag (yes|no)
|
||||
# 4. the VERSION
|
||||
# 5. the remaining args are the versions of Python to build for
|
||||
#
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
set -o errexit
|
||||
#set -o xtrace
|
||||
|
||||
echo "-=-=-=- Hello from $HOSTNAME -=-=-=-"
|
||||
|
||||
if [ $# -lt 5 ]; then
|
||||
echo "Usage: $0 WXDIR DESTDIR SKIPCLEAN VERSION PYVER..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
WXDIR=$1
|
||||
DESTDIR=$2
|
||||
SKIPCLEAN=$3
|
||||
VERSION=$4
|
||||
shift;shift;shift;shift
|
||||
PYVER=$@
|
||||
|
||||
|
||||
# WXDIR is the cygwin path, WXWIN is the DOS path
|
||||
WXWIN_OLD=$WXWIN
|
||||
WXWIN=`cygpath -w $WXDIR`
|
||||
export WXWIN
|
||||
|
||||
|
||||
# # Fix the PATH. (Why is this needed??)
|
||||
# PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/robind/bin:.:$WXDIR/lib/vc_dll:$PATH
|
||||
# export PATH
|
||||
# echo "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
|
||||
# echo $PATH
|
||||
# echo "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
|
||||
# exit 0
|
||||
|
||||
|
||||
# untar the source
|
||||
echo "Unarchiving wxPython-src-$VERSION.tar.gz"
|
||||
cd $DESTDIR
|
||||
tar xzf wxPython-src-$VERSION.tar.gz
|
||||
rm wxPython-src-$VERSION.tar.gz
|
||||
|
||||
|
||||
# Fix line endings
|
||||
echo "Converting wxPython line endings to CRLF..."
|
||||
cd $WXDIR
|
||||
names=`find wxPython -name "*.py" -o -name "*.txt" -o -name "*.htm*" -o -name "*.css" -o -name "*.xml" `
|
||||
unix2dos -D $names
|
||||
|
||||
|
||||
# change to the right spot in the source tree and copy our build scripts
|
||||
echo "Setting up for the build..."
|
||||
cd $WXDIR/build/msw
|
||||
cp $WXDIR/wxPython/distrib/msw/.m* .
|
||||
|
||||
|
||||
# replace some settings in setup0.h and write to setup.h
|
||||
cat > .my.sedexpr <<EOF
|
||||
s/wxDIALOG_UNIT_COMPATIBILITY *1/wxDIALOG_UNIT_COMPATIBILITY 0/g
|
||||
s/wxUSE_DEBUG_CONTEXT *0/wxUSE_DEBUG_CONTEXT 1/g
|
||||
s/wxUSE_MEMORY_TRACING *0/wxUSE_MEMORY_TRACING 1/g
|
||||
s/wxUSE_DIALUP_MANAGER *1/wxUSE_DIALUP_MANAGER 0/g
|
||||
s/wxUSE_GLCANVAS *0/wxUSE_GLCANVAS 1/g
|
||||
s/wxUSE_POSTSCRIPT *0/wxUSE_POSTSCRIPT 1/g
|
||||
s/wxUSE_AFM_FOR_POSTSCRIPT *1/wxUSE_AFM_FOR_POSTSCRIPT 0/g
|
||||
s/wxUSE_DISPLAY *0/wxUSE_DISPLAY 1/g
|
||||
EOF
|
||||
cat $WXDIR/include/wx/msw/setup0.h | sed -f .my.sedexpr > $WXDIR/include/wx/msw/setup.h
|
||||
rm .my.sedexpr
|
||||
|
||||
|
||||
echo "Building the wx DLLs..."
|
||||
.make hybrid
|
||||
.make hybrid-uni
|
||||
|
||||
|
||||
#echo "Building the wx tools..."
|
||||
#.make_tools
|
||||
|
||||
# cheat and just copy the .CHM files from the regular project dir
|
||||
# TODO: Copy over the wxPython-docs fle and run hhc on the contents of that.
|
||||
mkdir -p $WXDIR/docs/htmlhelp
|
||||
cp `cygpath $WXWIN_OLD/docs/htmlhelp`/*.chm $WXDIR/docs/htmlhelp
|
||||
|
||||
|
||||
echo "Building wxPython and installers..."
|
||||
cd $WXDIR/wxPython
|
||||
mkdir -p dist
|
||||
|
||||
for ver in $PYVER; do
|
||||
echo $ver
|
||||
b $ver d USE_SWIG=0
|
||||
b $ver h USE_SWIG=0 EP_ADD_OPTS=1
|
||||
b $ver r USE_SWIG=0
|
||||
b $ver d UNICODE=1 USE_SWIG=0
|
||||
b $ver h UNICODE=1 USE_SWIG=0 EP_ADD_OPTS=1
|
||||
b $ver r UNICODE=1 USE_SWIG=0
|
||||
done
|
||||
|
||||
echo "Building the developer package..."
|
||||
WXWIN=`cygpath -w $WXDIR`
|
||||
export WXWIN
|
||||
4nt /c distrib/makedev.bat $VERSION
|
||||
|
||||
|
||||
echo "Copying installers to $DESTDIR..."
|
||||
mv dist/wxPython* $DESTDIR
|
||||
cd $DESTDIR
|
||||
|
||||
|
||||
if [ $SKIPCLEAN != yes ]; then
|
||||
echo "Cleaning up..."
|
||||
rm -r $WXDIR || true
|
||||
fi
|
||||
|
||||
echo "-=-=-=- Goodbye! -=-=-=-"
|
||||
4
wxPython/distrib/all/dryrun
Executable file
4
wxPython/distrib/all/dryrun
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
distrib/all/build-all dryrun $* 2>&1 | tee tmp/dryrun.log
|
||||
|
||||
1158
wxPython/distrib/all/subprocess.py
Normal file
1158
wxPython/distrib/all/subprocess.py
Normal file
File diff suppressed because it is too large
Load Diff
232
wxPython/distrib/all/taskrunner.py
Normal file
232
wxPython/distrib/all/taskrunner.py
Normal file
@@ -0,0 +1,232 @@
|
||||
#----------------------------------------------------------------------
|
||||
# Name: taskrunner.py
|
||||
# Purpose: Classes that can manage running of external processes,
|
||||
# either consecutively, simultaneously, or both, and can
|
||||
# log the output of those jobs
|
||||
#
|
||||
# Author: Robin Dunn
|
||||
#
|
||||
# Created: 05-Nov-2004
|
||||
# RCS-ID: $Id$
|
||||
# Copyright: (c) 2004 by Total Control Software
|
||||
# Licence: wxWindows license
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
import sys
|
||||
import os
|
||||
import signal
|
||||
import select
|
||||
import fcntl
|
||||
from subprocess import Popen, PIPE, STDOUT
|
||||
|
||||
|
||||
__all__ = ["Job", "Task", "TaskRunner"]
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
class Job(object):
|
||||
"""
|
||||
Each Job is a monitor wrapped around an externally executing
|
||||
process. It handles starting the process, polling if it is still
|
||||
running, reading and logging it's output, and killing it if
|
||||
needed.
|
||||
"""
|
||||
|
||||
LOGBASE="."
|
||||
|
||||
def __init__(self, label, args):
|
||||
self.label = label
|
||||
self.args = args
|
||||
self.proc = None
|
||||
if self.label:
|
||||
self.log = file("%s/%s.log" % (self.LOGBASE, label), "w", 0)
|
||||
|
||||
def start(self):
|
||||
self.proc = Popen(self.args, # the command and args to execute
|
||||
stdout=PIPE, stderr=STDOUT,
|
||||
bufsize=0, # line-buffered
|
||||
)
|
||||
# put the file in non-blocking mode
|
||||
#flags = fcntl.fcntl (self.proc.stdout, fcntl.F_GETFL, 0)
|
||||
#flags = flags | os.O_NONBLOCK
|
||||
#fcntl.fcntl (self.proc.stdout, fcntl.F_SETFL, flags)
|
||||
|
||||
|
||||
def stop(self):
|
||||
if self.proc is not None and self.proc.returncode is None:
|
||||
os.kill(self.proc.pid, signal.SIGTERM)
|
||||
self.logLines()
|
||||
|
||||
|
||||
def fileno(self):
|
||||
if self.proc is not None:
|
||||
return self.proc.stdout.fileno()
|
||||
else:
|
||||
return -1
|
||||
|
||||
|
||||
def logLines(self):
|
||||
if self.proc is not None:
|
||||
while self.linesAvailable():
|
||||
line = self.proc.stdout.readline()
|
||||
if not line: break
|
||||
if self.label:
|
||||
self.log.write(line)
|
||||
line = "** %s: %s" % (self.label, line)
|
||||
sys.stdout.write(line)
|
||||
|
||||
|
||||
def linesAvailable(self):
|
||||
if self.proc is None:
|
||||
return False
|
||||
ind, outd, err = select.select([self], [], [], 0)
|
||||
if ind:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
def finished(self):
|
||||
if self.proc is None:# or self.linesAvailable():
|
||||
return False
|
||||
return self.proc.poll() is not None
|
||||
|
||||
|
||||
def wait(self):
|
||||
if self.proc is None: return None
|
||||
return self.proc.wait()
|
||||
|
||||
|
||||
def poll(self):
|
||||
if self.proc is None: return None
|
||||
return self.proc.poll()
|
||||
|
||||
|
||||
def returnCode(self):
|
||||
if self.proc is None: return None
|
||||
return self.proc.returncode
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
class Task(object):
|
||||
"""
|
||||
This class helps manage the running of a Task, which is a simply a
|
||||
sequence of one or more Jobs, where subesquent jobs are not
|
||||
started until prior ones are completed.
|
||||
"""
|
||||
def __init__(self, jobs=[]):
|
||||
if type(jobs) != list:
|
||||
jobs = [jobs]
|
||||
self.jobs = jobs[:]
|
||||
self.active = 0
|
||||
|
||||
def append(self, job):
|
||||
self.jobs.append(job)
|
||||
|
||||
def activeJob(self):
|
||||
if self.active > len(self.jobs)-1:
|
||||
return None
|
||||
else:
|
||||
return self.jobs[self.active]
|
||||
|
||||
def next(self):
|
||||
self.active += 1
|
||||
if self.active < len(self.jobs):
|
||||
self.jobs[self.active].start()
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
class TaskRunner(object):
|
||||
"""
|
||||
Manages the running of multiple tasks.
|
||||
"""
|
||||
def __init__(self, tasks=[]):
|
||||
if type(tasks) != list:
|
||||
tasks = [tasks]
|
||||
self.tasks = tasks[:]
|
||||
|
||||
def append(self, task):
|
||||
self.tasks.append(task)
|
||||
|
||||
def run(self):
|
||||
# start all the active jobs
|
||||
for task in self.tasks:
|
||||
task.activeJob().start()
|
||||
|
||||
try:
|
||||
# loop, getting output from the jobs, etc.
|
||||
while True:
|
||||
# get all active Jobs
|
||||
jobs = [t.activeJob() for t in self.tasks if t.activeJob()]
|
||||
if not jobs:
|
||||
break
|
||||
|
||||
# wait for a job to have output ready, then log it
|
||||
input, output, err = select.select(jobs, [], [], 1)
|
||||
for job in input:
|
||||
job.logLines()
|
||||
|
||||
# check for finished jobs
|
||||
for task in self.tasks:
|
||||
job = task.activeJob()
|
||||
if job and job.finished():
|
||||
if job.returnCode() != 0:
|
||||
rc = job.returnCode()
|
||||
print "JOB RETURNED FAILURE CODE! (%d)" % rc
|
||||
self.stopAllJobs()
|
||||
return rc
|
||||
else:
|
||||
task.next()
|
||||
except KeyboardInterrupt:
|
||||
print "STOPPING JOBS..."
|
||||
self.stopAllJobs()
|
||||
return 1
|
||||
|
||||
except:
|
||||
print "Unknown exception..."
|
||||
self.stopAllJobs()
|
||||
raise
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
def stopAllJobs(self):
|
||||
for task in self.tasks:
|
||||
job = task.activeJob()
|
||||
if job:
|
||||
job.stop()
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
j1 = Job("label1", ["./tmp/job-1.py", "TEST-1"])
|
||||
j2 = Job("label2", ["./tmp/job-2.sh", "TEST-2"])
|
||||
|
||||
t1 = Task()
|
||||
t1.append(j1)
|
||||
t1.append(j2)
|
||||
|
||||
j3 = Job("task2a", ["./tmp/job-1.py", "TASK-2a"])
|
||||
j4 = Job("task2b", ["./tmp/job-2.sh", "TASK-2b"])
|
||||
|
||||
t2 = Task()
|
||||
t2.append(j4)
|
||||
t2.append(j3)
|
||||
|
||||
t3 = Task([Job("error", ["./tmp/job-3.sh", "TASK-3"])])
|
||||
|
||||
tr = TaskRunner()
|
||||
tr.append(t1)
|
||||
tr.append(t2)
|
||||
tr.append(t3)
|
||||
|
||||
for task in tr.tasks:
|
||||
for job in task.jobs:
|
||||
print job.label
|
||||
|
||||
print tr.run()
|
||||
|
||||
238
wxPython/distrib/mac/uninstall_wxPython.py
Executable file
238
wxPython/distrib/mac/uninstall_wxPython.py
Executable file
@@ -0,0 +1,238 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
This script will search for installed versions of wxPython on OSX and
|
||||
allow the user to choose one to uninstall. It then will use the
|
||||
metadata stored about the installed package to remove all the files
|
||||
associated with that install.
|
||||
|
||||
Only the files installed by the main Installer Package will be
|
||||
removed. This includes the Python modules and the wxWidgets shared
|
||||
libraries. If you also installed the demo or docs by dragging them out
|
||||
of the disk image, then you will need to drag them to the Trash
|
||||
yourself.
|
||||
"""
|
||||
|
||||
import sys, os, glob
|
||||
from fnmatch import fnmatchcase
|
||||
import cPickle, urllib
|
||||
|
||||
RCPTDIR = "/Library/Receipts"
|
||||
RSRCDIR = "Contents/Resources"
|
||||
|
||||
# Only completly clean out dirs that have one of these as a prefix.
|
||||
# We do this because the file list returned from lsbom will include /,
|
||||
# /usr, /usr/local, etc.
|
||||
PREFIXES = [ '/Library/Python/2.3/',
|
||||
'/Library/Python/2.4/',
|
||||
'/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-pacakges/',
|
||||
'/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-pacakges/',
|
||||
'/usr/local/lib/',
|
||||
]
|
||||
|
||||
# The files that match one of the items in this list will only be
|
||||
# removed if the last installation of wxPython on the system is being
|
||||
# uninstalled.
|
||||
COMMON_FILES = [ '/usr/local/bin/*',
|
||||
'wx.pth',
|
||||
'wxversion.py',
|
||||
]
|
||||
|
||||
|
||||
|
||||
class AccessError(Exception):
|
||||
pass
|
||||
|
||||
class ReceiptError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class InstalledReceipt(object):
|
||||
def __init__(self, rcptPath):
|
||||
self.rcptPath = rcptPath
|
||||
self.rsrcPath = os.path.join(rcptPath, RSRCDIR)
|
||||
bf = glob.glob(os.path.join(self.rsrcPath, "*.bom"))
|
||||
if bf:
|
||||
self.bomFile = bf[0]
|
||||
else:
|
||||
print "WARNING: Unable to find %s/*.bom" % self.rsrcPath
|
||||
raise ReceiptError
|
||||
self.findMetaData()
|
||||
|
||||
|
||||
def findMetaData(self):
|
||||
# TODO: Make this be able to also look at Info.plist files
|
||||
infoFiles = glob.glob(os.path.join(self.rsrcPath, "*.info"))
|
||||
if infoFiles:
|
||||
# there should be only one
|
||||
infoFile = infoFiles[0]
|
||||
self.mdata = {}
|
||||
for line in open(infoFile, "r").readlines():
|
||||
line = line.strip()
|
||||
if line and line[0] != '#':
|
||||
ls = line.split()
|
||||
self.mdata[ls[0]] = line[len(ls[0])+1:]
|
||||
else:
|
||||
print "WARNING: Unable to find %s/*.info" % self.rsrcPath
|
||||
raise ReceiptError
|
||||
|
||||
|
||||
def getFileList(self):
|
||||
p = os.popen("lsbom -s %s" % self.bomFile, "r")
|
||||
data = p.read()
|
||||
data.strip()
|
||||
data = filter(lambda s: s!='' and s!='.', data.split('\n'))
|
||||
loc = self.mdata['DefaultLocation']
|
||||
return [loc+item for item in data]
|
||||
|
||||
|
||||
def walkFiles(self, handleFile, handleDir):
|
||||
dirs = []
|
||||
names = self.getFileList()
|
||||
|
||||
# the plain files
|
||||
for name in names:
|
||||
name = os.path.abspath(name)
|
||||
if os.path.isdir(name):
|
||||
dirs.append(name)
|
||||
else:
|
||||
handleFile(name)
|
||||
|
||||
# the directories
|
||||
dirs.reverse()
|
||||
for dir in dirs:
|
||||
for prefix in PREFIXES:
|
||||
if dir.startswith(prefix):
|
||||
handleDir(dir)
|
||||
break
|
||||
|
||||
# Finally, remove the Receipts package, bottom-up
|
||||
for dirpath, dirname, filenames in os.walk(self.rcptPath, False):
|
||||
for name in filenames:
|
||||
name = os.path.join(dirpath, name)
|
||||
handleFile(name)
|
||||
handleDir(dirpath)
|
||||
|
||||
|
||||
def testCommon(self, name):
|
||||
for cmn in COMMON_FILES:
|
||||
if fnmatchcase(name, cmn) or fnmatchcase(os.path.basename(name), cmn):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def showFiles(self):
|
||||
def show(name):
|
||||
if os.path.exists(name):
|
||||
if not self.lastInstall and self.testCommon(name):
|
||||
return
|
||||
print "Will remove:", name
|
||||
self.walkFiles(show, show)
|
||||
|
||||
|
||||
def testUninstallAccess(self):
|
||||
def testFile(name):
|
||||
if os.path.exists(name):
|
||||
if not self.lastInstall and self.testCommon(name):
|
||||
return
|
||||
if not os.access(name, os.W_OK):
|
||||
raise AccessError(name)
|
||||
self.walkFiles(testFile, testFile)
|
||||
|
||||
|
||||
def doUninstall(self):
|
||||
def removeFile(name):
|
||||
if os.path.exists(name):
|
||||
if not self.lastInstall and self.testCommon(name):
|
||||
return
|
||||
print "Removing:", name
|
||||
os.unlink(name)
|
||||
def removeDir(name):
|
||||
print "Removing:", name
|
||||
if os.path.exists(name):
|
||||
hasFiles = os.listdir(name)
|
||||
if hasFiles: # perhaps some stale symlinks, or .pyc files
|
||||
for file in hasFiles:
|
||||
os.unlink(os.path.join(name, file))
|
||||
os.rmdir(name)
|
||||
|
||||
try:
|
||||
self.testUninstallAccess()
|
||||
except AccessError, e:
|
||||
print "UNABLE TO UNINSTALL!\nNo permission to remove: ", e.args[0]
|
||||
sys.exit()
|
||||
|
||||
self.walkFiles(removeFile, removeDir)
|
||||
|
||||
|
||||
|
||||
|
||||
def findInstalled():
|
||||
installed = []
|
||||
for name in glob.glob(os.path.join(RCPTDIR, "wxPython*")):
|
||||
try:
|
||||
ir = InstalledReceipt(name)
|
||||
installed.append(ir)
|
||||
except ReceiptError:
|
||||
pass # just skip it...
|
||||
|
||||
return installed
|
||||
|
||||
|
||||
# Just in case a Python < 2.3 is used to run this
|
||||
try:
|
||||
enumerate
|
||||
except NameError:
|
||||
def enumerate(sequence):
|
||||
return zip(range(len(sequence)), sequence)
|
||||
|
||||
|
||||
def main():
|
||||
if len(sys.argv) > 1 and sys.argv[1] == "-doit":
|
||||
inst = cPickle.loads(urllib.unquote(sys.argv[2]))
|
||||
inst.doUninstall()
|
||||
sys.exit()
|
||||
|
||||
print __doc__
|
||||
installed = findInstalled()
|
||||
|
||||
if not installed:
|
||||
print "*** No wxPython installations found! ***"
|
||||
raw_input("Press RETURN...")
|
||||
sys.exit()
|
||||
|
||||
for i, inst in enumerate(installed):
|
||||
print " %d. %s \t%s" % (i+1, inst.mdata["Title"], inst.mdata["Version"])
|
||||
|
||||
print
|
||||
ans = raw_input("Enter the number of the install to examine or 'Q' to quit: ")
|
||||
if ans in ['Q', 'q']:
|
||||
sys.exit()
|
||||
inst = installed[int(ans) - 1]
|
||||
inst.lastInstall = len(installed) == 1
|
||||
|
||||
while True:
|
||||
print
|
||||
print """
|
||||
Title: %(Title)s
|
||||
Version: %(Version)s
|
||||
Description: %(Description)s
|
||||
""" % inst.mdata
|
||||
|
||||
ans = raw_input("(U)ninstall, (S)how what will be removed, or (Q)uit? [u,s,q] ")
|
||||
if ans in ['Q', 'q']:
|
||||
sys.exit()
|
||||
|
||||
elif ans in ['S', 's']:
|
||||
inst.showFiles()
|
||||
|
||||
elif ans in ['U', 'u']:
|
||||
print
|
||||
print "Launching uninstaller with sudo, please enter your password if prompted:"
|
||||
os.system("sudo %s -doit %s" %
|
||||
(sys.argv[0],
|
||||
urllib.quote(cPickle.dumps(inst))))
|
||||
sys.exit()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -31,6 +31,7 @@ function usage {
|
||||
echo " skiptar Don't unpack the tarball"
|
||||
echo " inplace Don't use the tarball, build from the CVS tree instead"
|
||||
echo " (The Docs and Demo tarballs are still required for a full build.)"
|
||||
echo " unicode Make a unicode build"
|
||||
echo " skipconfig Don't run configure"
|
||||
echo " skipbuild Don't build wxWidgets or wxPython"
|
||||
echo " skipinstall Don't do the installation step"
|
||||
@@ -61,6 +62,7 @@ skipinstall=no
|
||||
skipdmg=no
|
||||
skipclean=no
|
||||
inplace=no
|
||||
unicode=no
|
||||
|
||||
for flag in $*; do
|
||||
case ${flag} in
|
||||
@@ -71,6 +73,7 @@ for flag in $*; do
|
||||
skipdmg) skipdmg=yes ;;
|
||||
skipclean) skipclean=yes ;;
|
||||
inplace) inplace=yes; skiptar=yes ;;
|
||||
unicode) unicode=yes ;;
|
||||
|
||||
*) echo "Unknown flag \"${flag}\""
|
||||
usage
|
||||
@@ -84,7 +87,21 @@ PYVER=`$PYTHON -c "import sys; print sys.version[:3]"`
|
||||
PYPREFIX=`$PYTHON -c "import sys; print sys.exec_prefix"`
|
||||
PYLIB=$PYPREFIX/lib/python$PYVER
|
||||
SITEPACKAGES=$PYLIB/site-packages
|
||||
SHORTVER=`echo $VERSION | cut -c 1,2,3`
|
||||
|
||||
if [ $unicode == yes ]; then
|
||||
CHARTYPE=unicode
|
||||
UNICODEOPT=--enable-unicode
|
||||
PYUNICODEOPT=1
|
||||
else
|
||||
CHARTYPE=ansi
|
||||
UNICODEOPT=--disable-unicode
|
||||
PYUNICODEOPT=0
|
||||
fi
|
||||
|
||||
#if [ "$HOSTNAME" = "bigmac.alldunn.com" ]; then
|
||||
# MAKEJOBS="--jobs=2"
|
||||
#fi
|
||||
|
||||
|
||||
if [ -z "$TARBALLDIR" ]; then
|
||||
@@ -93,28 +110,28 @@ if [ -z "$TARBALLDIR" ]; then
|
||||
# TARBALLDIR before invoking this script...
|
||||
TARBALLDIR=/stuff/Development/wxPython/dist/$VERSION
|
||||
fi
|
||||
TARBALL=$TARBALLDIR/wxPythonSrc-$VERSION.tar.gz
|
||||
TARBALL=$TARBALLDIR/wxPython-src-$VERSION.tar.gz
|
||||
|
||||
if [ ! -e $TARBALLDIR/wxPythonDemo-$VERSION.tar.gz ]; then
|
||||
if [ ! -e $TARBALLDIR/wxPython-demo-$VERSION.tar.gz ]; then
|
||||
echo "-------------------------------------------------------"
|
||||
echo " WARNING: Demo tarball not found, will skip building "
|
||||
echo " the Demo app bundle and etc."
|
||||
echo " $TARBALLDIR/wxPythonDemo-$VERSION.tar.gz"
|
||||
echo " $TARBALLDIR/wxPython-demo-$VERSION.tar.gz"
|
||||
echo "-------------------------------------------------------"
|
||||
fi
|
||||
|
||||
if [ ! -e $TARBALLDIR/wxPythonDocs-$VERSION.tar.gz ]; then
|
||||
if [ ! -e $TARBALLDIR/wxPython-docs-$VERSION.tar.gz ]; then
|
||||
echo "-------------------------------------------------------"
|
||||
echo " WARNING: Docs tarball not found, will skip building "
|
||||
echo " the the wxDocsViewer app bundle and etc."
|
||||
echo " $TARBALLDIR/wxPythonDocs-$VERSION.tar.gz"
|
||||
echo " $TARBALLDIR/wxPython-docs-$VERSION.tar.gz"
|
||||
echo "-------------------------------------------------------"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
PREFIX=/usr/local/lib/wxPython-$VERSION
|
||||
PREFIX=/usr/local/lib/wxPython-$CHARTYPE-$VERSION
|
||||
BINPREFIX=/usr/local/bin
|
||||
|
||||
WXROOT=`dirname $PWD`
|
||||
@@ -122,12 +139,17 @@ PROGDIR="`dirname \"$0\"`"
|
||||
TMPDIR=$PWD/_build_dmg
|
||||
|
||||
BUILDROOT=$TMPDIR/build
|
||||
INSTALLROOT=$TMPDIR/install
|
||||
INSTALLDEVEL=$TMPDIR/install-devel
|
||||
|
||||
INSTALLROOT=$TMPDIR/install-root
|
||||
INSTALLAPPS=$TMPDIR/install-apps
|
||||
|
||||
DMGDIR=$TMPDIR/dmg
|
||||
DMGROOT=$DMGDIR/root
|
||||
DMGAPPS=$DMGDIR/apps
|
||||
|
||||
RESOURCEDIR=$PROGDIR/resources
|
||||
DESTDIR=$PWD/dist
|
||||
SRCROOT=$BUILDROOT/wxPythonSrc-$VERSION
|
||||
SRCROOT=$BUILDROOT/wxPython-src-$VERSION
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@@ -135,11 +157,12 @@ SRCROOT=$BUILDROOT/wxPythonSrc-$VERSION
|
||||
|
||||
mkdir -p $BUILDROOT
|
||||
mkdir -p $INSTALLROOT
|
||||
#mkdir -p $INSTALLDEVEL
|
||||
mkdir -p $INSTALLAPPS
|
||||
|
||||
rm -rf $DMGDIR
|
||||
mkdir -p $DMGDIR/root/Apps
|
||||
mkdir -p $DMGDIR/root/Docs
|
||||
mkdir -p $DMGDIR/root/Samples
|
||||
mkdir -p $DMGROOT
|
||||
mkdir -p $DMGAPPS/Docs
|
||||
mkdir -p $DMGAPPS/Samples
|
||||
|
||||
|
||||
pushd $BUILDROOT
|
||||
@@ -155,21 +178,26 @@ fi
|
||||
|
||||
if [ $inplace = no ]; then
|
||||
# make a build dir and cd to it.
|
||||
cd wxPythonSrc-$VERSION
|
||||
cd wxPython-src-$VERSION
|
||||
WXDIR=`pwd`
|
||||
mkdir -p $WXDIR/bld
|
||||
cd $WXDIR/bld
|
||||
WXBLD=$WXDIR/bld
|
||||
else
|
||||
# If building "inplace" then our build dir will be BUILDROOT,
|
||||
# adjust the variables to find things that way.
|
||||
WXDIR=$WXROOT
|
||||
|
||||
# If building "inplace" then our build dir will be off of the
|
||||
# WXROOT like normal, adjust the variables to find things that
|
||||
# way.
|
||||
WXBLD=$WXROOT/build-$CHARTYPE
|
||||
mkdir -p $WXBLD
|
||||
cd $WXBLD
|
||||
WXDIR=..
|
||||
SRCROOT=$WXROOT
|
||||
WXBLD=$BUILDROOT
|
||||
fi
|
||||
|
||||
echo "Using source tree: $WXDIR"
|
||||
echo "Using wx root dir: $WXROOT"
|
||||
echo "Using build dir: $WXBLD"
|
||||
echo "Using source tree: $WXDIR"
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
@@ -184,14 +212,11 @@ if [ $skipconfig != yes ]; then
|
||||
--enable-sound \
|
||||
--enable-display \
|
||||
--enable-geometry \
|
||||
--enable-debug_flag \
|
||||
--enable-precomp=no \
|
||||
--enable-debug_flag
|
||||
--enable-optimise \
|
||||
$UNICODEOPT
|
||||
|
||||
## --enable-optimise \
|
||||
## --with-libjpeg=builtin \
|
||||
## --with-libpng=builtin \
|
||||
## --with-libtiff=builtin \
|
||||
## --with-zlib=builtin \
|
||||
|
||||
fi
|
||||
|
||||
@@ -199,26 +224,32 @@ fi
|
||||
if [ $skipbuild != yes ]; then
|
||||
|
||||
# Make wxWidgets and some contribs
|
||||
make
|
||||
make -C contrib/src/gizmos
|
||||
make -C contrib/src/ogl CXXFLAGS="-DwxUSE_DEPRECATED=0"
|
||||
make -C contrib/src/stc
|
||||
make -C contrib/src/xrc
|
||||
|
||||
# For some reason Rez and DeRez have started locking up if run as
|
||||
# root, figure out why, but in the meantime...
|
||||
if [ "$UID" = "0" ]; then
|
||||
chmod a+w lib
|
||||
if [ "$CHARTYPE" = "ansi" ]; then
|
||||
su robind -c "make lib/libwx_macd-2.5.3.r"
|
||||
else
|
||||
su robind -c "make lib/libwx_macud-2.5.3.r"
|
||||
fi
|
||||
fi
|
||||
|
||||
make $MAKEJOBS
|
||||
make $MAKEJOBS -C contrib/src/gizmos
|
||||
make $MAKEJOBS -C contrib/src/ogl CXXFLAGS="-DwxUSE_DEPRECATED=0"
|
||||
make $MAKEJOBS -C contrib/src/stc
|
||||
|
||||
# Build wxPython
|
||||
cd $WXDIR/wxPython
|
||||
cd $WXROOT/wxPython
|
||||
$PYTHON setup.py \
|
||||
UNICODE=$PYUNICODEOPT \
|
||||
NO_SCRIPTS=1 \
|
||||
EP_ADD_OPTS=1 \
|
||||
WX_CONFIG="$WXBLD/wx-config --inplace" \
|
||||
BUILD_BASE=$WXBLD/wxPython \
|
||||
build
|
||||
|
||||
|
||||
# Build wxrc (XRC resource tool)
|
||||
cd $WXBLD/contrib/utils/wxrc
|
||||
make
|
||||
strip wxrc
|
||||
|
||||
fi
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@@ -230,13 +261,19 @@ if [ $skipinstall != yes ]; then
|
||||
make -C contrib/src/gizmos prefix=$INSTALLROOT$PREFIX install
|
||||
make -C contrib/src/ogl CXXFLAGS="-DwxUSE_DEPRECATED=0" prefix=$INSTALLROOT/$PREFIX install
|
||||
make -C contrib/src/stc prefix=$INSTALLROOT$PREFIX install
|
||||
make -C contrib/src/xrc prefix=$INSTALLROOT$PREFIX install
|
||||
|
||||
|
||||
# relink wx-config with a relative link
|
||||
cd $INSTALLROOT$PREFIX/bin
|
||||
rm wx-config
|
||||
ln -s ../lib/wx/config/* wx-config
|
||||
|
||||
# and wxPython
|
||||
cd $WXDIR/wxPython
|
||||
cd $WXROOT/wxPython
|
||||
$PYTHON setup.py \
|
||||
UNICODE=$PYUNICODEOPT \
|
||||
NO_SCRIPTS=1 \
|
||||
EP_ADD_OPTS=1 \
|
||||
WX_CONFIG="$INSTALLROOT/$PREFIX/bin/wx-config --prefix=$INSTALLROOT/$PREFIX" \
|
||||
BUILD_BASE=$WXBLD/wxPython \
|
||||
install \
|
||||
@@ -256,16 +293,17 @@ if [ $skipinstall != yes ]; then
|
||||
SITEPACKAGES=/Library/Python/$PYVER
|
||||
fi
|
||||
|
||||
|
||||
# install wxPython's tool scripts
|
||||
mkdir -p $INSTALLROOT$BINPREFIX
|
||||
cd $WXDIR/wxPython/scripts
|
||||
cd $WXROOT/wxPython/scripts
|
||||
python$PYVER CreateMacScripts.py $INSTALLROOT $BINPREFIX
|
||||
|
||||
|
||||
# Install wxrc
|
||||
cp $WXBLD/contrib/utils/wxrc/wxrc $INSTALLROOT$BINPREFIX
|
||||
|
||||
# Remove the .pyc/.pyo files they just take up space and can be recreated
|
||||
# during the install.
|
||||
pushd $WXROOT/wxPython
|
||||
$PYTHON $PROGDIR/../zappycfiles.py $INSTALLROOT > /dev/null
|
||||
popd
|
||||
|
||||
# Set premissions for files in $INSTALLROOT
|
||||
if [ "$UID" = "0" ]; then
|
||||
@@ -274,6 +312,11 @@ if [ $skipinstall != yes ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$KIND" = "panther" ]; then
|
||||
SITEPACKAGES=/Library/Python/$PYVER
|
||||
fi
|
||||
PKGDIR=`cat $INSTALLROOT$SITEPACKAGES/wx.pth`
|
||||
|
||||
popd
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@@ -281,22 +324,28 @@ popd
|
||||
# Make the Installer packages and disk image
|
||||
if [ $skipdmg != yes ]; then
|
||||
|
||||
# Remove the .pyc/.pyo files they just take up space and can be recreated
|
||||
# during the install.
|
||||
$PYTHON $PROGDIR/../zappycfiles.py $INSTALLROOT > /dev/null
|
||||
|
||||
#-----------------------------------------------
|
||||
# The main runtime installer package
|
||||
|
||||
# Make the welcome message
|
||||
case $KIND in
|
||||
panther) W_MSG="the Panther (OS X 10.3.x) version of" ;;
|
||||
jaguar) W_MSG="the Jaguar (OS X 10.2.x) version of" ;;
|
||||
esac
|
||||
|
||||
|
||||
cat > $RESOURCEDIR/Welcome.txt <<EOF
|
||||
Welcome!
|
||||
|
||||
This program will install wxPython $VERSION for $W_MSG MacPython-OSX $PYVER.
|
||||
This Installer package will install the wxPython $CHARTYPE runtime $VERSION for $W_MSG MacPython-OSX $PYVER. This includes:
|
||||
|
||||
You must install onto your current boot disk, even though the installer does not enforce this, otherwise things will not work.
|
||||
* The wxPython packages and modules
|
||||
* The wxWidgets shared libraries and headers
|
||||
* Some command line tool scripts, installed to /usr/local/bin.
|
||||
|
||||
You must install onto your current boot disk, eventhough the installer does not enforce this, otherwise things will not work.
|
||||
|
||||
You can install more than one version of the wxPython runtime if you desire. The most recently installed version will be the default wxPython, but you can choose another by setting the PYTHONPATH or by using the wxversion module. See http://wiki.wxpython.org/index.cgi/MultiVersionInstalls for more details.
|
||||
|
||||
Build date: `date`
|
||||
EOF
|
||||
@@ -307,6 +356,7 @@ EOF
|
||||
# Cleanup any old install of the wxPython package
|
||||
rm -rf \$2$SITEPACKAGES/wxPython
|
||||
rm -rf \$2$SITEPACKAGES/wx
|
||||
rm -rf \$2$SITEPACKAGES/$PKGDIR
|
||||
exit 0
|
||||
EOF
|
||||
chmod +x $RESOURCEDIR/preflight
|
||||
@@ -315,64 +365,110 @@ EOF
|
||||
cat > $RESOURCEDIR/postflight <<EOF
|
||||
#!/bin/sh -e
|
||||
# Compile the .py files in the wxPython pacakge
|
||||
$PYTHON \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wxPython
|
||||
$PYTHON \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wx
|
||||
$PYTHON -O \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wxPython
|
||||
$PYTHON -O \$2$PYLIB/compileall.py \$2$SITEPACKAGES/wx
|
||||
|
||||
$PYTHON \$2$PYLIB/compileall.py \$2$SITEPACKAGES/$PKGDIR
|
||||
$PYTHON -O \$2$PYLIB/compileall.py \$2$SITEPACKAGES/$PKGDIR
|
||||
|
||||
# and all of the wxPython pacakge should be group writable
|
||||
chgrp -R admin \$2$SITEPACKAGES/wxPython
|
||||
chmod -R g+w \$2$SITEPACKAGES/wxPython
|
||||
chgrp -R admin \$2$SITEPACKAGES/wx
|
||||
chmod -R g+w \$2$SITEPACKAGES/wx
|
||||
chgrp -R admin \$2$SITEPACKAGES/$PKGDIR
|
||||
chmod -R g+w \$2$SITEPACKAGES/$PKGDIR
|
||||
|
||||
exit 0
|
||||
EOF
|
||||
chmod +x $RESOURCEDIR/postflight
|
||||
|
||||
|
||||
|
||||
|
||||
# Build the main Installer Package...
|
||||
rm -rf wxPythonOSX-$KIND.pkg
|
||||
rm -rf wxPython${SHORTVER}-osx-$CHARTYPE-$KIND.pkg
|
||||
python $PROGDIR/../buildpkg.py \
|
||||
--Title=wxPythonOSX-$KIND \
|
||||
--Title=wxPython${SHORTVER}-osx-$CHARTYPE-$KIND \
|
||||
--Version=$VERSION \
|
||||
--Description="wxPython $VERSION for $W_MSG MacPython-OSX $PYVER" \
|
||||
--Description="wxPython $CHARTYPE runtime $VERSION for $W_MSG MacPython-OSX $PYVER" \
|
||||
--NeedsAuthorization="YES" \
|
||||
--Relocatable="NO" \
|
||||
--InstallOnly="YES" \
|
||||
$INSTALLROOT \
|
||||
$RESOURCEDIR
|
||||
|
||||
mv wxPythonOSX-$KIND.pkg $DMGDIR/root
|
||||
mv wxPython${SHORTVER}-osx-$CHARTYPE-$KIND.pkg $DMGROOT
|
||||
|
||||
rm $RESOURCEDIR/postflight
|
||||
rm $RESOURCEDIR/preflight
|
||||
rm $RESOURCEDIR/Welcome.txt
|
||||
|
||||
|
||||
|
||||
# Make a README.txt to go on the disk image
|
||||
cat > "$DMGDIR/root/README 1st.txt" <<EOF
|
||||
#-----------------------------------------------
|
||||
# Make a README to go on the disk image
|
||||
cat > "$DMGROOT/README 1st.txt" <<EOF
|
||||
Welcome to wxPython!
|
||||
|
||||
On this disk image you will find the installer for wxPython $VERSION for $W_MSG MacPython-OSX $PYVER. MacPython-OSX is not included.
|
||||
This disk image contains the following items:
|
||||
|
||||
wxPython-$KIND.pkg The installer package. It contains the wxPython
|
||||
extension modules, wxMac dynamic libraries and
|
||||
headers, and some scripts for the command-line
|
||||
tools.
|
||||
wxPython${SHORTVER}-osx-$CHARTYPE-$VERSION-$KIND
|
||||
|
||||
Everything else here is optional and you can drag them out of the disk
|
||||
image and drop them wherever you want. You do need to install the above
|
||||
package before you can use any of the items below.
|
||||
This Installer contains the wxPython runtime, compiled on a
|
||||
$KIND OS X system, using the $CHARTYPE build of the wxWidgets
|
||||
library. It includes the Python modules and extension
|
||||
modules, as well as the wxWidgets libraries.
|
||||
|
||||
It is possible to have more than one version of the runtime
|
||||
installed at once if you wish. The most recently installed
|
||||
version will be the default wxPython, but you can choose
|
||||
another by setting the PYTHONPATH or by using the wxversion
|
||||
module. For more details see:
|
||||
http://wiki.wxpython.org/index.cgi/MultiVersionInstalls
|
||||
|
||||
|
||||
Apps/wxPython Demo An application bundle version of the demo.
|
||||
(This has it's own copy of the sources within
|
||||
the bundle.)
|
||||
uninstall_wxPython.py
|
||||
|
||||
Apps/XRCed An application for editing wxPython resource
|
||||
A simple tool to help you manage your installed versions of
|
||||
wxPython. It will allow you to choose from the currently
|
||||
installed wxPython packages and to select one for
|
||||
uninstallation. It is a text-mode tool so you can either run
|
||||
it from a Terminal command line, or you can open it with
|
||||
PythonLauncher and let it create a Terminal to run it in.
|
||||
|
||||
NOTE: If you have versions prior to 2.5.3.1 installed, please
|
||||
do run this uninstall tool to remove the older version.
|
||||
|
||||
EOF
|
||||
|
||||
|
||||
|
||||
cp $PROGDIR/../uninstall_wxPython.py $DMGROOT
|
||||
|
||||
|
||||
#-----------------------------------------------
|
||||
# Make a disk image to hold these files
|
||||
dmgname=wxPython${SHORTVER}-osx-$CHARTYPE-$VERSION-$KIND-py$PYVER
|
||||
$PROGDIR/../makedmg $DMGROOT $DMGDIR $dmgname
|
||||
|
||||
echo Moving $DMGDIR/$dmgname.dmg to $DESTDIR
|
||||
mv $DMGDIR/$dmgname.dmg $DESTDIR
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Now create app bundles for the demo, docs, and tools and make another
|
||||
# disk image to hold it all.
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
cat > "$DMGAPPS/README 1st.txt" <<EOF
|
||||
Welcome to wxPython!
|
||||
|
||||
On this disk image you will find Demo, Tools, Docs, and etc. for
|
||||
wxPython $VERSION. Everything here is optional and you can drag them
|
||||
out of the disk image and drop them wherever you want. You will need
|
||||
to have an installed wxPython runtime to be able to use any of them.
|
||||
|
||||
|
||||
wxPython Demo An application bundle version of the demo.
|
||||
(This has it's own copy of the demo sources
|
||||
within the bundle.)
|
||||
|
||||
XRCed An application for editing wxPython resource
|
||||
files (XRC files.)
|
||||
|
||||
Apps/PyCrust An application that provides an interactive
|
||||
PyCrust An application that provides an interactive
|
||||
Python shell and also namespace inspectors.
|
||||
|
||||
|
||||
@@ -399,29 +495,29 @@ EOF
|
||||
|
||||
|
||||
# wxDocs
|
||||
if [ ! -e $TARBALLDIR/wxPythonDocs-$VERSION.tar.gz ]; then
|
||||
cat > "$DMGDIR/root/Docs/Build ERROR.txt" <<EOF
|
||||
if [ ! -e $TARBALLDIR/wxPython-docs-$VERSION.tar.gz ]; then
|
||||
cat > "$DMGAPPS/Docs/Build ERROR.txt" <<EOF
|
||||
|
||||
The wxPythonDocs tarball was not found when building this disk image!
|
||||
The wxPython-docs tarball was not found when building this disk image!
|
||||
|
||||
EOF
|
||||
|
||||
else
|
||||
pushd $BUILDROOT
|
||||
tar xzvf $TARBALLDIR/wxPythonDocs-$VERSION.tar.gz
|
||||
tar xzvf $TARBALLDIR/wxPython-docs-$VERSION.tar.gz
|
||||
popd
|
||||
|
||||
# Make an app to launch viewdocs.py
|
||||
$PYTHONW $PROGDIR/../buildapp.py \
|
||||
--builddir=$DMGDIR/root/Docs \
|
||||
--builddir=$DMGAPPS/Docs \
|
||||
--name=wxDocsViewer \
|
||||
--mainprogram=$BUILDROOT/wxPython-$VERSION/docs/viewdocs.py \
|
||||
--iconfile=$PROGDIR/Info.icns \
|
||||
build
|
||||
|
||||
cp $BUILDROOT/wxPython-$VERSION/docs/*.zip $DMGDIR/root/Docs/wxDocsViewer.app/Contents/Resources
|
||||
cp $BUILDROOT/wxPython-$VERSION/docs/*.zip $DMGAPPS/Docs/wxDocsViewer.app/Contents/Resources
|
||||
|
||||
cat > "$DMGDIR/root/Docs/README 1st.txt" <<EOF
|
||||
cat > "$DMGAPPS/Docs/README 1st.txt" <<EOF
|
||||
|
||||
The wxDocsViewer application needs to be copied to your Desktop (or
|
||||
someplace else you have write access to) before you can run it, so it
|
||||
@@ -432,7 +528,7 @@ EOF
|
||||
fi
|
||||
|
||||
# license files, docs, etc.
|
||||
pushd $DMGDIR/root/Docs
|
||||
pushd $DMGAPPS/Docs
|
||||
cp -pR $SRCROOT/wxPython/licence .
|
||||
cp -pR $SRCROOT/wxPython/docs .
|
||||
rm -rf docs/bin
|
||||
@@ -441,19 +537,19 @@ EOF
|
||||
popd
|
||||
|
||||
|
||||
if [ ! -e $TARBALLDIR/wxPythonDemo-$VERSION.tar.gz ]; then
|
||||
cat > "$DMGDIR/root/Samples/Build ERROR.txt" <<EOF
|
||||
if [ ! -e $TARBALLDIR/wxPython-demo-$VERSION.tar.gz ]; then
|
||||
cat > "$DMGAPPS/Samples/Build ERROR.txt" <<EOF
|
||||
|
||||
The wxPythonDemo tarball was not found when building this disk image!
|
||||
The wxPython-demo tarball was not found when building this disk image!
|
||||
|
||||
EOF
|
||||
cp "$DMGDIR/root/Samples/Build ERROR.txt" $DMGDIR/root/Apps
|
||||
cp "$DMGAPPS/Samples/Build ERROR.txt" $DMGAPPS
|
||||
|
||||
else
|
||||
|
||||
# Copy the demo and samples to the disk image from the tarball
|
||||
pushd $DMGDIR/root/Samples
|
||||
tar xzvf $TARBALLDIR/wxPythonDemo-$VERSION.tar.gz
|
||||
pushd $DMGAPPS/Samples
|
||||
tar xzvf $TARBALLDIR/wxPython-demo-$VERSION.tar.gz
|
||||
mv wxPython-$VERSION/* .
|
||||
rm -rf wxPython-$VERSION
|
||||
rm demo/b demo/.setup.sh
|
||||
@@ -462,34 +558,36 @@ EOF
|
||||
|
||||
# Make an app bundle to run the demo
|
||||
$PYTHONW $PROGDIR/../buildapp.py \
|
||||
--builddir=$DMGDIR/root/Apps \
|
||||
--builddir=$DMGAPPS \
|
||||
--name="wxPython Demo" \
|
||||
--mainprogram=$DMGDIR/root/Samples/demo/demo.pyw \
|
||||
--mainprogram=$DMGAPPS/Samples/demo/demo.pyw \
|
||||
--iconfile=$PROGDIR/RunDemo.icns \
|
||||
build
|
||||
cp -pR $DMGDIR/root/Samples/demo/* "$DMGDIR/root/Apps/wxPython Demo.app/Contents/Resources"
|
||||
cp -pR $DMGAPPS/Samples/demo/* "$DMGAPPS/wxPython Demo.app/Contents/Resources"
|
||||
fi
|
||||
|
||||
|
||||
# Make an app bundle to launch PyCrust
|
||||
$PYTHONW $PROGDIR/../buildapp.py \
|
||||
--builddir=$DMGDIR/root/Apps \
|
||||
--builddir=$DMGAPPS \
|
||||
--name=PyCrust \
|
||||
--mainprogram=$INSTALLROOT$BINPREFIX/pycrust.py \
|
||||
--iconfile=$PROGDIR/PieShell.icns \
|
||||
build
|
||||
|
||||
# # and PyAlaMode
|
||||
# $PYTHONW $PROGDIR/../buildapp.py \
|
||||
# --builddir=$DMGDIR/root \
|
||||
# --name=PyAlaMode \
|
||||
# --mainprogram=$INSTALLROOT$BINPREFIX/pyalamode.py \
|
||||
# --iconfile=$PROGDIR/PieShell.icns \
|
||||
# build
|
||||
## TODO: PyAlaMode needs tweaked to be able to run from a bundle. It
|
||||
## needs to know to ignore command line parameters and etc...
|
||||
# # and PyAlaMode
|
||||
# $PYTHONW $PROGDIR/../buildapp.py \
|
||||
# --builddir=$DMGAPPS \
|
||||
# --name=PyAlaMode \
|
||||
# --mainprogram=$INSTALLROOT$BINPREFIX/pyalamode.py \
|
||||
# --iconfile=$PROGDIR/PieShell.icns \
|
||||
# build
|
||||
|
||||
# Make an app to launch XRCed
|
||||
$PYTHONW $PROGDIR/../buildapp.py \
|
||||
--builddir=$DMGDIR/root/Apps \
|
||||
--builddir=$DMGAPPS \
|
||||
--name=XRCed \
|
||||
--mainprogram=$INSTALLROOT$BINPREFIX/xrced.py \
|
||||
--iconfile=$PROGDIR/XRCed.icns \
|
||||
@@ -497,11 +595,12 @@ EOF
|
||||
|
||||
|
||||
|
||||
# and then finally make a disk image containing the packages and etc.
|
||||
$PROGDIR/../makedmg $DMGDIR/root $DMGDIR wxPythonOSX-$VERSION-$KIND-Py$PYVER
|
||||
# and then finally make a disk image containing everything
|
||||
dmgname=wxPython${SHORTVER}-osx-docs-demos-$VERSION-$KIND
|
||||
$PROGDIR/../makedmg $DMGAPPS $DMGDIR $dmgname
|
||||
|
||||
echo Moving $DMGDIR/wxPythonOSX-$VERSION-$KIND-Py$PYVER.dmg to $DESTDIR
|
||||
mv $DMGDIR/wxPythonOSX-$VERSION-$KIND-Py$PYVER.dmg $DESTDIR
|
||||
echo Moving $DMGDIR/$dmgname.dmg to $DESTDIR
|
||||
mv $DMGDIR/$dmgname.dmg $DESTDIR
|
||||
fi
|
||||
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ Source: "scripts\pywxrc"; DestDir: "{code:GetPythonDir}\Script
|
||||
Source: "scripts\xrced"; DestDir: "{code:GetPythonDir}\Scripts"; Flags: sharedfile; Components: core
|
||||
|
||||
|
||||
Source: "docs\README.txt"; DestDir: "{app}\%(PKGDIR)s\docs"; Flags: isreadme; Components: core
|
||||
Source: "distrib\README.win32.txt"; DestDir: "{app}\%(PKGDIR)s\docs"; Flags: isreadme; Components: core
|
||||
Source: "licence\*.txt"; DestDir: "{app}\%(PKGDIR)s\docs\licence"; Components: core
|
||||
|
||||
|
||||
@@ -285,7 +285,7 @@ begin
|
||||
'Should I do it?',
|
||||
mbConfirmation, MB_YESNO);
|
||||
if ResultCode = IDYES then begin
|
||||
InstExec(FileName, '/SILENT', WizardDirValue()+'\wxPython', True, False, SW_SHOWNORMAL, ResultCode);
|
||||
InstExec(FileName, '/SILENT', WizardDirValue(), True, False, SW_SHOWNORMAL, ResultCode);
|
||||
|
||||
end;
|
||||
end;
|
||||
@@ -315,11 +315,11 @@ end.
|
||||
ISS_DocDemo_Template = r'''
|
||||
|
||||
[Setup]
|
||||
AppName = wxPython%(SHORTVER)s-DocsDemo
|
||||
AppName = wxPython%(SHORTVER)s-docs-demos
|
||||
AppVerName = wxPython Docs and Demos %(VERSION)s
|
||||
OutputBaseFilename = wxPython%(SHORTVER)s-DocsDemo-%(VERSION)s
|
||||
OutputBaseFilename = wxPython%(SHORTVER)s-win32-docs-demos-%(VERSION)s
|
||||
AppCopyright = Copyright <20> 2004 Total Control Software
|
||||
DefaultDirName = {pf}\wxPython%(SHORTVER)s Docs Demos and Tools
|
||||
DefaultDirName = {pf}\wxPython%(SHORTVER)s Docs and Demos
|
||||
DefaultGroupName = wxPython%(SHORTVER)s Docs Demos and Tools
|
||||
AlwaysCreateUninstallIcon = yes
|
||||
AdminPrivilegesRequired = no
|
||||
|
||||
@@ -66,9 +66,9 @@ rem del /sxzy @del-dirs
|
||||
rm del-files
|
||||
rm del-dirs
|
||||
|
||||
rem *** bundle it all up
|
||||
tar cvf ../dist/wxPython-win32-devel-%1.tar wxPython-%1
|
||||
gzip -9 ../dist/wxPython-win32-devel-%1.tar
|
||||
rem *** bundle it all up TODO: don't hard-code the 2.5
|
||||
tar cvf ../dist/wxPython2.5-win32-devel-%1.tar wxPython-%1
|
||||
gzip -9 ../dist/wxPython2.5-win32-devel-%1.tar
|
||||
|
||||
rem *** cleanup
|
||||
cd ..
|
||||
|
||||
@@ -26,27 +26,23 @@ pythonbin=/usr/bin/python
|
||||
port=GTK
|
||||
lcport=gtk
|
||||
unicode=0
|
||||
tarname=wxPythonSrc
|
||||
rpmflag=-ba
|
||||
tarname=wxPython-src
|
||||
srpmonly=0
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Check parameters
|
||||
|
||||
function usage {
|
||||
echo "Usage: $0 py_version [command flags...]"
|
||||
echo " py_version String to append to $pythonbin (which python"
|
||||
echo " version to use.)"
|
||||
echo " py_version which python version to use."
|
||||
echo ""
|
||||
echo "command flags:"
|
||||
echo " skipcopy Don't copy the files for the tarball from the workspace"
|
||||
echo " skiptar Don't build the tarball"
|
||||
echo " skiprpm Don't build the RPM"
|
||||
echo " skipclean Don't do the cleanup at the end"
|
||||
echo " gtk2 Build using wxGTK2 and Unicode"
|
||||
echo " x11 Build using wxX11"
|
||||
echo " speconly Do nothing but write the RPM spec file"
|
||||
echo " srpm Only make the SRPM"
|
||||
# echo " smp Add SMP=2 to the envivonment to speed wxGTK build"
|
||||
}
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
@@ -68,17 +64,14 @@ fi
|
||||
|
||||
|
||||
function makespec {
|
||||
echo "*** Writing ${distdir}/wxPython${port}.spec"
|
||||
echo "*** Writing ${distdir}/wxPython.spec"
|
||||
cat ${spectemplate} \
|
||||
| sed s:@PYTHON@:${python}:g \
|
||||
| sed s:@PYVER@:${pyver}:g \
|
||||
| sed s:@PORT@:${port}:g \
|
||||
| sed s:@LCPORT@:${lcport}:g \
|
||||
| sed s:@TARNAME@:${tarname}:g \
|
||||
| sed s:@VERSION@:${version}:g \
|
||||
| sed s:@VER2@:${ver2}:g \
|
||||
| sed s:@UNICODE@:${unicode}:g \
|
||||
> ${distdir}/wxPython${port}.spec
|
||||
> ${distdir}/wxPython.spec
|
||||
}
|
||||
|
||||
|
||||
@@ -89,11 +82,8 @@ for flag in $*; do
|
||||
skipclean) skipclean=1 ;;
|
||||
skiptar) skiptar=1; skipcopy=1 ;;
|
||||
skiprpm) skiprpm=1 ;;
|
||||
gtk2) unicode=1; port=GTK2; lcport=gtk2 ;;
|
||||
x11) port=X11; lcport=x11 ;;
|
||||
smp) export SMP=2 ;;
|
||||
speconly) makespec; exit 0 ;;
|
||||
srpm) rpmflag=-bs; ;;
|
||||
srpm) srpmonly=1; ;;
|
||||
|
||||
*) echo "Unknown flag \"${flag}\""
|
||||
usage
|
||||
@@ -144,7 +134,7 @@ if [ -z "${skipcopy}" ]; then
|
||||
# copy root dir contents
|
||||
cp -pf --link ${wxdir}/* ${tarver} > /dev/null 2>&1
|
||||
|
||||
# copy all top dirs except CVS, build, demos, utils, samples, and wxPython
|
||||
# copy all top dirs except CVS, build, demos, samples, utils, and wxPython
|
||||
for d in art build contrib debian distrib docs include lib locale misc patches src; do
|
||||
if [ -e ${wxdir}/$d ]; then
|
||||
cp -Rpf --link ${wxdir}/$d ${tarver} #> /dev/null 2>&1
|
||||
@@ -177,13 +167,16 @@ if [ -z "${skipcopy}" ]; then
|
||||
cleanup CVS
|
||||
cleanup CVSROOT
|
||||
rm BuildCVS.txt
|
||||
rm -f ChangeLog
|
||||
rm *.spec
|
||||
rm -rf distrib/msw/tmake
|
||||
rm -rf docs/html
|
||||
rm -rf docs/latex
|
||||
rm -rf contrib/docs
|
||||
rm -rf contrib/samples
|
||||
rm locale/*.mo
|
||||
cleanup ".#*"
|
||||
cleanup "#*#"
|
||||
cleanup "*~"
|
||||
cleanup "*.orig"
|
||||
cleanup "*.rej"
|
||||
@@ -191,6 +184,13 @@ if [ -z "${skipcopy}" ]; then
|
||||
cleanup core
|
||||
cleanup "core.[0-9]*"
|
||||
|
||||
# ports that are not supported yet
|
||||
cleanup cocoa
|
||||
cleanup mgl
|
||||
cleanup motif
|
||||
cleanup os2
|
||||
cleanup x11
|
||||
|
||||
rm -f wxPython/wx/* > /dev/null 2>&1
|
||||
|
||||
popd > /dev/null
|
||||
@@ -205,7 +205,7 @@ fi
|
||||
# TODO? Output all combinations of spec files to put in the tar file??
|
||||
|
||||
makespec
|
||||
cp ${distdir}/wxPython${port}.spec ${builddir}/${tarver}/wxPython${port}.spec
|
||||
cp ${distdir}/wxPython.spec ${builddir}/${tarver}/wxPython.spec
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@@ -237,17 +237,44 @@ fi
|
||||
if [ -z "${skiprpm}" ]; then
|
||||
echo "*** Building RPMs..."
|
||||
cp ${distdir}/${tarver}.tar.gz ${rpmtop}/SOURCES
|
||||
rpmbuild ${rpmflag} \
|
||||
--define "_topdir ${rpmtop}" \
|
||||
--define "_tmppath ${builddir}" \
|
||||
${distdir}/wxPython${port}.spec
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "*** RPM failure, exiting."
|
||||
exit 1
|
||||
else
|
||||
echo "*** Moving RPMs to ${distdir}"
|
||||
mv -f `find ${rpmtop} -name "wxPython*.rpm"` ${distdir}
|
||||
|
||||
if [ "${srpmonly}" = "1" ]; then
|
||||
rpmbuild -bs \
|
||||
--define "_topdir ${rpmtop}" \
|
||||
--define "_tmppath ${builddir}" \
|
||||
--define "pyver ${pyver}" \
|
||||
${distdir}/wxPython.spec
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "*** RPM failure, exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
else
|
||||
rpmbuild -ba \
|
||||
--define "_topdir ${rpmtop}" \
|
||||
--define "_tmppath ${builddir}" \
|
||||
--define "port gtk" --define "unicode 0" \
|
||||
--define "pyver ${pyver}" \
|
||||
${distdir}/wxPython.spec
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "*** RPM failure, exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rpmbuild -ba \
|
||||
--define "_topdir ${rpmtop}" \
|
||||
--define "_tmppath ${builddir}" \
|
||||
--define "port gtk2" --define "unicode 1" \
|
||||
--define "pyver ${pyver}" \
|
||||
${distdir}/wxPython.spec
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "*** RPM failure, exiting."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "*** Moving RPMs to ${distdir}"
|
||||
mv -f `find ${rpmtop} -name "wxPython*.rpm"` ${distdir}
|
||||
fi
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
@@ -21,36 +21,36 @@ test :
|
||||
|
||||
# debug
|
||||
$(DIR)\vc_dll\mswd\wx\setup.h : $(SRC) .makesetup.mk
|
||||
-if not exist $(DIR)\vc_dll\mswd\wx mkdir /s $(DIR)\vc_dll\mswd\wx
|
||||
-if not exist $(DIR)\vc_dll\mswd\wx mkdir $(DIR)\vc_dll\mswd\wx
|
||||
cat $(SRC) > $@
|
||||
|
||||
# hybrid
|
||||
$(DIR)\vc_dll\mswh\wx\setup.h : $(SRC) .makesetup.mk
|
||||
-if not exist $(DIR)\vc_dll\mswh\wx mkdir /s $(DIR)\vc_dll\mswh\wx
|
||||
-if not exist $(DIR)\vc_dll\mswh\wx mkdir $(DIR)\vc_dll\mswh\wx
|
||||
cat $(SRC) | $(HYB_SEDCMD) > $@
|
||||
|
||||
# release
|
||||
$(DIR)\vc_dll\msw\wx\setup.h : $(SRC) .makesetup.mk
|
||||
-if not exist $(DIR)\vc_dll\msw\wx mkdir /s $(DIR)\vc_dll\msw\wx
|
||||
-if not exist $(DIR)\vc_dll\msw\wx mkdir $(DIR)\vc_dll\msw\wx
|
||||
cat $(SRC) > $@
|
||||
|
||||
$(DIR)\vc_lib\msw\wx\setup.h : $(SRC) .makesetup.mk
|
||||
-if not exist $(DIR)\vc_lib\msw\wx mkdir /s $(DIR)\vc_lib\msw\wx
|
||||
-if not exist $(DIR)\vc_lib\msw\wx mkdir $(DIR)\vc_lib\msw\wx
|
||||
cat $(SRC) > $@
|
||||
|
||||
# debug-uni
|
||||
$(DIR)\vc_dll\mswud\wx\setup.h : $(SRC) .makesetup.mk
|
||||
-if not exist $(DIR)\vc_dll\mswud\wx mkdir /s $(DIR)\vc_dll\mswud\wx
|
||||
-if not exist $(DIR)\vc_dll\mswud\wx mkdir $(DIR)\vc_dll\mswud\wx
|
||||
cat $(SRC) | $(UNI_SEDCMD) > $@
|
||||
|
||||
# hybrid-uni
|
||||
$(DIR)\vc_dll\mswuh\wx\setup.h : $(SRC) .makesetup.mk
|
||||
-if not exist $(DIR)\vc_dll\mswuh\wx mkdir /s $(DIR)\vc_dll\mswuh\wx
|
||||
-if not exist $(DIR)\vc_dll\mswuh\wx mkdir $(DIR)\vc_dll\mswuh\wx
|
||||
cat $(SRC) | $(UNI_SEDCMD) | $(HYB_SEDCMD) > $@
|
||||
|
||||
# release-uni
|
||||
$(DIR)\vc_dll\mswu\wx\setup.h : $(SRC) .makesetup.mk
|
||||
-if not exist $(DIR)\vc_dll\mswu\wx mkdir /s $(DIR)\vc_dll\mswu\wx
|
||||
-if not exist $(DIR)\vc_dll\mswu\wx mkdir $(DIR)\vc_dll\mswu\wx
|
||||
cat $(SRC) | $(UNI_SEDCMD) > $@
|
||||
|
||||
|
||||
|
||||
@@ -1,53 +1,97 @@
|
||||
%define pref %{_prefix}
|
||||
%define python @PYTHON@
|
||||
%define pyver @PYVER@
|
||||
%define port @PORT@
|
||||
%define lcport @LCPORT@
|
||||
%define unicode @UNICODE@
|
||||
%define tarname @TARNAME@
|
||||
%define version @VERSION@
|
||||
%define ver2 @VER2@
|
||||
%define wxprefbase %{pref}/lib/wxPython
|
||||
%define wxpref %{wxprefbase}-%{version}
|
||||
%define name wxPython%{port}-py%{pyver}
|
||||
#----------------------------------------------------------------------
|
||||
# Name: wxPython.spec
|
||||
# Purpose: RPM Build and packaging instructions
|
||||
#
|
||||
# Author: Robin Dunn
|
||||
#
|
||||
# RCS-ID: $Id$
|
||||
# Copyright: (c) 2004 by Total Control Software
|
||||
# Licence: wxWindows license
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
# Allow the release tag to be specified on the rpmbuild command
|
||||
# line with --define 'release SOMETHING' If no such definition is
|
||||
# used then the release number is 1.
|
||||
%if %{?release:0}%{!?release:1}
|
||||
%define release 1
|
||||
# The following values can be set on the rpmbuild command line with
|
||||
# --define 'name VALUE' If no value is set on the command line then
|
||||
# the default value set here will be used instead.
|
||||
|
||||
|
||||
# Which version of Python to build with. Used to assemble python
|
||||
# binary name so use '2.2', '2.3', etc.
|
||||
%if %{?pyver:0}%{!?pyver:1}
|
||||
%define pyver 2.3
|
||||
%endif
|
||||
|
||||
|
||||
# Which wxWidgets port to build and use. Current acceptable values
|
||||
# are 'gtk' and 'gtk2'.
|
||||
%if %{?port:0}%{!?port:1}
|
||||
%define port gtk2
|
||||
%endif
|
||||
|
||||
|
||||
# Build in unicode mode? Can only be used if port is gtk2, acceptable
|
||||
# values are '0' and '1'
|
||||
%if %{?unicode:0}%{!?unicode:1}
|
||||
%define unicode 1
|
||||
%endif
|
||||
|
||||
|
||||
# Should the builtin image and etc. libs be used, or system libs?
|
||||
# Distro specific RPMs should probably set this to 0, generic ones
|
||||
# should use 1
|
||||
%define builtin_libs 1
|
||||
# should use 1.
|
||||
# NOTE: I'm trying 0 for this next release to see if I can get rid of
|
||||
# this...
|
||||
%if %{?builtin_libs:0}%{!?builtin_libs:1}
|
||||
%define builtin_libs 0
|
||||
%endif
|
||||
|
||||
|
||||
# Should --enable-debug_flag be used in release builds? Using it
|
||||
# defines __WXDEBUG__ and gives us runtime diagnostics that are turned
|
||||
# into Python exceptions starting with 2.3.4. (So turning it on is a
|
||||
# very helpful thing IMO and is recommended.) The code is still
|
||||
# compiled with optimization flags and such when this option is used,
|
||||
# it simply turns on some extra code.
|
||||
# into Python exceptions. (So turning it on is a very helpful thing
|
||||
# IMO and is recommended.) The code is still compiled with
|
||||
# optimization flags and and without debug info and such when this
|
||||
# option is used, it simply turns on some extra code.
|
||||
%if %{?debug_flag:0}%{!?debug_flag:1}
|
||||
%define debug_flag 1
|
||||
%endif
|
||||
|
||||
|
||||
# build the name of the real wx-config from the port, flags, etc.
|
||||
%define dbgflg %(if [ "%{debug_flag}" = "1" ]; then echo d; fi)
|
||||
%define uniflg %(if [ "%{unicode}" = "1" ]; then echo u; fi)
|
||||
%define DBGFLG %(if [ "%{debug_flag}" = "1" ]; then echo D; fi)
|
||||
%define UNIFLG %(if [ "%{unicode}" = "1" ]; then echo U; fi)
|
||||
%define wxconfigname %{wxpref}/bin/wx%{lcport}%{uniflg}%{dbgflg}-%{ver2}-config
|
||||
# Used to set the Release tag below. I normally use it to define what
|
||||
# distro the RPM was build on and also include the version of Python
|
||||
# it was built with.
|
||||
%if %{?release:0}%{!?release:1}
|
||||
%define release 1_py%{pyver}
|
||||
%endif
|
||||
|
||||
# turn off the generation of debuginfo rpm (RH9)
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Other variables used below
|
||||
|
||||
%define pref %{_prefix}
|
||||
%define python /usr/bin/python%{pyver}
|
||||
%define tarname @TARNAME@
|
||||
%define version @VERSION@
|
||||
%define ver2 @VER2@
|
||||
|
||||
%define chartype %(if [ "%{unicode}" = "1" ]; then echo unicode; else echo ansi; fi)
|
||||
%define gtktype %(if [ "%{port}" = "gtk2" ]; then echo 2; fi)
|
||||
%define using_gtk1 %(if [ "%{port}" = "gtk" ]; then echo 1; else echo 0; fi)
|
||||
|
||||
%define wxprefbase %{pref}/lib/wxPython
|
||||
%define wxpref %{wxprefbase}-%{version}-%{port}-%{chartype}
|
||||
%define pkgname wxPython
|
||||
|
||||
# turn off the generation of debuginfo rpm (RH9) ??
|
||||
%define debug_package %{nil}
|
||||
|
||||
#----------------------------------------------------------------
|
||||
Summary: Cross platform GUI toolkit for Python using wx%{port}
|
||||
Name: %{name}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Package definition
|
||||
#----------------------------------------------------------------------
|
||||
Name: %{pkgname}%{ver2}
|
||||
Summary: Cross platform GUI toolkit for Python
|
||||
Version: %{version}
|
||||
Release: %{release}
|
||||
Source0: %{tarname}-%{version}.tar.gz
|
||||
@@ -55,72 +99,105 @@ License: wx Library Licence, Version 3
|
||||
URL: http://wxPython.org/
|
||||
Packager: Robin Dunn <robin@alldunn.com>
|
||||
Group: Development/Python
|
||||
BuildRoot: %{_tmppath}/%{name}-buildroot
|
||||
BuildRoot: %{_tmppath}/%{pkgname}-buildroot
|
||||
Prefix: %{pref}
|
||||
|
||||
Provides: wxPython = %{version}
|
||||
Provides: wxPython%{port} = %{version}
|
||||
|
||||
# Provides: libwx_%{lcport}%{uniflg}%{dbgflg}-%{ver2}.so
|
||||
# Provides: libwx_%{lcport}%{uniflg}%{dbgflg}-%{ver2}.so(WX%{port}%{UNIFLG}%{DBGFLG}_%{ver2})
|
||||
# Provides: libwx_%{lcport}%{uniflg}%{dbgflg}_gl-%{ver2}.so
|
||||
# Provides: libwx_%{lcport}%{uniflg}%{dbgflg}_gl-%{ver2}.so(WX%{port}%{UNIFLG}%{DBGFLG}_%{ver2})
|
||||
%description
|
||||
Cross platform GUI toolkit for Python
|
||||
|
||||
|
||||
# old wxPython packages
|
||||
Obsoletes: wxPython wxPython%{port}
|
||||
|
||||
|
||||
%description
|
||||
wxPython is a GUI toolkit for Python that is a wrapper around the
|
||||
wxWidgets C++ GUI library. wxPython provides a large variety of
|
||||
window types and controls, all implemented with a native look and feel
|
||||
(and native runtime speed) on the platforms it is supported on.
|
||||
|
||||
This package is implemented using the %{port} port of wxWidgets, and
|
||||
includes the wx%{port} shared libs and etc.
|
||||
%package -n %{pkgname}%{ver2}-%{port}-%{chartype}
|
||||
Summary: Cross platform GUI toolkit for Python
|
||||
Group: Development/Python
|
||||
Requires: %{pkgname}-common
|
||||
Obsoletes: wxPythonGTK%{gtktype}-py%{pyver}
|
||||
Provides: wxPython
|
||||
|
||||
|
||||
%package -n wxPython%{port}-devel
|
||||
Summary: wxPython%{port} development files
|
||||
%description -n %{pkgname}%{ver2}-%{port}-%{chartype}
|
||||
wxPython is a GUI toolkit for the Python programming language. It
|
||||
allows Python programmers to create programs with a robust, highly
|
||||
functional graphical user interface, simply and easily. It is
|
||||
implemented as a Python extension module (native code) that wraps the
|
||||
popular wxWidgets cross platform GUI library, which is written in C++.
|
||||
|
||||
wxPython is a cross-platform toolkit. The same program will usually
|
||||
run on multiple platforms without modification. Currently supported
|
||||
platforms are 32-bit Microsoft Windows, most Unix or unix-like
|
||||
systems, and Macintosh OS X.
|
||||
|
||||
This package contains the wxPython runtime files built for the
|
||||
wxWidgets %{port} port with %{chartype} character type.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
%package -n %{pkgname}-common-%{port}-%{chartype}
|
||||
Summary: Common files for needed by all wxPython runtimes
|
||||
Group: Development/Python
|
||||
Provides: %{pkgname}-common
|
||||
|
||||
# They obsolete each other so any of them can be installed over another
|
||||
# without conflicts
|
||||
Obsoletes: %{pkgname}-common-gtk-ansi
|
||||
Obsoletes: %{pkgname}-common-gtk2-ansi
|
||||
Obsoletes: %{pkgname}-common-gtk2-unicode
|
||||
|
||||
%description -n %{pkgname}-common-%{port}-%{chartype}
|
||||
This package contains the common files needed by any version of the
|
||||
wxPython runtime. This pacakge also installs a wx.pth file which will
|
||||
determine which of the installed runtimes is the default version of
|
||||
wxPython that is imported automatically with a bare "import wx".
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
%package -n %{pkgname}%{ver2}-devel-%{port}-%{chartype}
|
||||
Summary: wxPython development files
|
||||
Group: Development/Libraries
|
||||
Requires: wxPython%{port} = %{version}
|
||||
Requires: %{pkgname}%{ver2}-%{port}-%{chartype} = %{version}
|
||||
|
||||
|
||||
%description -n wxPython%{port}-devel
|
||||
%description -n %{pkgname}%{ver2}-devel-%{port}-%{chartype}
|
||||
This packages contains the headers and etc. for building apps or
|
||||
Python extension modules that use the same wx%{port} shared libraries
|
||||
Python extension modules that use the same wxWidgets shared libraries
|
||||
that wxPython uses.
|
||||
|
||||
#----------------------------------------------------------------
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
%prep
|
||||
%setup -q -n %{tarname}-%{version}
|
||||
|
||||
|
||||
#----------------------------------------------------------------
|
||||
#----------------------------------------------------------------------
|
||||
%build
|
||||
|
||||
WXDIR=`pwd`
|
||||
|
||||
# Configure and build wxWidgets
|
||||
mkdir bld
|
||||
cd bld
|
||||
|
||||
# Configure, trying to reduce external dependencies
|
||||
../configure --with-%{lcport} \
|
||||
../configure --with-gtk \
|
||||
--prefix=%{wxpref} \
|
||||
--disable-soname \
|
||||
--disable-monolithic \
|
||||
--enable-monolithic \
|
||||
--enable-rpath=%{wxpref}/lib \
|
||||
--with-opengl \
|
||||
%if %{unicode}
|
||||
--enable-gtk2 \
|
||||
--enable-unicode \
|
||||
%else
|
||||
--disable-gtk2 \
|
||||
%endif
|
||||
--enable-geometry \
|
||||
--enable-optimise \
|
||||
--enable-sound --with-sdl \
|
||||
--enable-display \
|
||||
%if %{using_gtk1}
|
||||
--disable-gtk2 \
|
||||
%else
|
||||
--enable-gtk2 \
|
||||
%endif
|
||||
%if %{unicode}
|
||||
--enable-unicode \
|
||||
%endif
|
||||
%if %{debug_flag}
|
||||
--enable-debug_flag \
|
||||
%endif
|
||||
@@ -132,56 +209,56 @@ cd bld
|
||||
%endif
|
||||
|
||||
|
||||
# Build wxWidgets and some contrib libs
|
||||
make
|
||||
make -C contrib/src/gizmos
|
||||
make -C contrib/src/ogl CXXFLAGS="-DwxUSE_DEPRECATED=0"
|
||||
make -C contrib/src/stc
|
||||
make -C contrib/src/xrc
|
||||
|
||||
|
||||
# Now build wxPython
|
||||
|
||||
# Build wxPython
|
||||
cd $WXDIR/wxPython
|
||||
%{python} setup.py \
|
||||
NO_SCRIPTS=1 \
|
||||
WXPORT=%{lcport} \
|
||||
WXPORT=%{port} \
|
||||
UNICODE=%{unicode} \
|
||||
EP_ADD_OPTS=1 \
|
||||
NO_SCRIPTS=1 \
|
||||
WX_CONFIG="$WXDIR/bld/wx-config --inplace" \
|
||||
build
|
||||
|
||||
|
||||
# Build wxrc (XRC resource tool)
|
||||
cd $WXDIR/bld/contrib/utils/wxrc
|
||||
make
|
||||
strip wxrc
|
||||
|
||||
|
||||
#----------------------------------------------------------------
|
||||
#----------------------------------------------------------------------
|
||||
%install
|
||||
|
||||
WXDIR=`pwd`
|
||||
cd bld
|
||||
|
||||
# Install wxWidgets and the contribs
|
||||
# Install wxGTK and contribs
|
||||
cd bld
|
||||
make prefix=$RPM_BUILD_ROOT%{wxpref} install
|
||||
make -C contrib/src/gizmos prefix=$RPM_BUILD_ROOT%{wxpref} install
|
||||
make -C contrib/src/ogl CXXFLAGS="-DwxUSE_DEPRECATED=0" prefix=$RPM_BUILD_ROOT%{wxpref} install
|
||||
make -C contrib/src/stc prefix=$RPM_BUILD_ROOT%{wxpref} install
|
||||
make -C contrib/src/xrc prefix=$RPM_BUILD_ROOT%{wxpref} install
|
||||
|
||||
|
||||
# install wxPython
|
||||
|
||||
# Install wxPython for wxGTK
|
||||
cd $WXDIR/wxPython
|
||||
%{python} setup.py \
|
||||
NO_SCRIPTS=1 \
|
||||
WXPORT=%{lcport} \
|
||||
WXPORT=%{port} \
|
||||
UNICODE=%{unicode} \
|
||||
EP_ADD_OPTS=1 \
|
||||
NO_SCRIPTS=1 \
|
||||
WX_CONFIG="$RPM_BUILD_ROOT%{wxpref}/bin/wx-config --prefix=$RPM_BUILD_ROOT%{wxpref}" \
|
||||
install \
|
||||
--root=$RPM_BUILD_ROOT
|
||||
|
||||
|
||||
cd $WXDIR/wxPython
|
||||
# remove the wx-config symlink, we'll redo it when installing the -devel package
|
||||
rm $RPM_BUILD_ROOT%{wxpref}/bin/wx-config
|
||||
|
||||
# make sure that debug info is stripped
|
||||
strip $RPM_BUILD_ROOT%{pref}/lib*/python%{pyver}/site-packages/wx-%{ver2}*-%{port}-%{chartype}/wx/*.so
|
||||
|
||||
|
||||
# Since I want this RPM to be as generic as possible I won't let
|
||||
@@ -189,10 +266,8 @@ cd $WXDIR/wxPython
|
||||
# the #! line to use the real python pathname. Since some distros
|
||||
# install python 2.2 as python2 and others as python I can't let
|
||||
# distutils do that otherwise the dependencies will be fouled up.
|
||||
# Copy them manually instead, leaving the #!/bin/env line intact.
|
||||
# TODO: Should this be dependent on %{builtin_libs} or something like
|
||||
# it?
|
||||
|
||||
# Copy them manually instead, leaving the #!/usr/bin/env line intact.
|
||||
cd $WXDIR/wxPython
|
||||
mkdir -p $RPM_BUILD_ROOT%{pref}/bin
|
||||
for s in \
|
||||
helpviewer \
|
||||
@@ -204,16 +279,14 @@ for s in \
|
||||
pycrust \
|
||||
pywrap \
|
||||
pyshell \
|
||||
pywxrc \
|
||||
xrced; do
|
||||
cp scripts/$s $RPM_BUILD_ROOT%{pref}/bin
|
||||
done
|
||||
|
||||
|
||||
# Install wxrc
|
||||
cp $WXDIR/bld/contrib/utils/wxrc/wxrc $RPM_BUILD_ROOT%{pref}/bin
|
||||
|
||||
|
||||
# install KDE & GNOME menus
|
||||
# install KDE & GNOME menu items
|
||||
mkdir -p $RPM_BUILD_ROOT%{_datadir}/applnk/Development
|
||||
mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
|
||||
for d in distrib/*.desktop; do
|
||||
@@ -231,31 +304,31 @@ install -m 644 wx/tools/XRCed/XRCed_16.png $RPM_BUILD_ROOT%{_datadir}/icons/hico
|
||||
install -m 644 wx/tools/XRCed/XRCed_32.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps/XRCed.png
|
||||
install -m 644 wx/tools/XRCed/XRCed_32.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/XRCed.png
|
||||
|
||||
# install Mandrake menu
|
||||
# install Mandrake menu items
|
||||
mkdir -p $RPM_BUILD_ROOT%{_libdir}/menu
|
||||
cat > $RPM_BUILD_ROOT%{_libdir}/menu/%{name} <<EOF
|
||||
?package(%{name}): \\
|
||||
cat > $RPM_BUILD_ROOT%{_libdir}/menu/%{pkgname} <<EOF
|
||||
?package(%{pkgname}): \\
|
||||
command="%{_bindir}/pyshell" \\
|
||||
needs="X11" \\
|
||||
icon="PyCrust.png" \\
|
||||
section="Applications/Development/Tools" \\
|
||||
title="PyShell" \\
|
||||
longtitle="GUI Python Shell"
|
||||
?package(%{name}): \\
|
||||
?package(%{pkgname}): \\
|
||||
command="%{_bindir}/pycrust" \\
|
||||
needs="X11" \\
|
||||
icon="PyCrust.png" \\
|
||||
section="Applications/Development/Tools" \\
|
||||
title="PyCrust" \\
|
||||
longtitle="GUI Python Shell with Filling"
|
||||
?package(%{name}): \\
|
||||
?package(%{pkgname}): \\
|
||||
command="%{_bindir}/pyalamode" \\
|
||||
needs="X11" \\
|
||||
icon="PyCrust.png" \\
|
||||
section="Applications/Development/Tools" \\
|
||||
title="PyAlaMode" \\
|
||||
longtitle="GUI Python Shell with Filling and editor windows"
|
||||
?package(%{name}): \\
|
||||
?package(%{pkgname}): \\
|
||||
command="%{_bindir}/xrced" \\
|
||||
needs="X11" \\
|
||||
icon="XRCed.png" \\
|
||||
@@ -265,62 +338,82 @@ cat > $RPM_BUILD_ROOT%{_libdir}/menu/%{name} <<EOF
|
||||
EOF
|
||||
|
||||
|
||||
#----------------------------------------------------------------
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
%pre
|
||||
if [ -e %{wxprefbase} ]; then
|
||||
# in case there are old dirs from an old install
|
||||
rm -r %{wxprefbase}
|
||||
fi
|
||||
|
||||
|
||||
%post
|
||||
%post -n %{pkgname}%{ver2}-%{port}-%{chartype}
|
||||
if [ ! -e %{wxprefbase} ]; then
|
||||
ln -s wxPython-%{version} %{wxprefbase}
|
||||
ln -s %{pkgname}-%{version}-%{port}-%{chartype} %{wxprefbase}
|
||||
fi
|
||||
|
||||
%preun -n %{pkgname}%{ver2}-%{port}-%{chartype}
|
||||
if [ -L %{wxprefbase} ]; then
|
||||
if [ `readlink %{wxprefbase}` == %{pkgname}-%{version}-%{port}-%{chartype} ]; then
|
||||
rm -f %{wxprefbase}
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
%post -n %{pkgname}-common-%{port}-%{chartype}
|
||||
# This is done on Mandrake to update its menus:
|
||||
if [ -x /usr/bin/update-menus ]; then /usr/bin/update-menus || true ; fi
|
||||
|
||||
|
||||
%postun
|
||||
rm -f %{wxprefbase}
|
||||
%postun -n %{pkgname}-common-%{port}-%{chartype}
|
||||
# This is done on Mandrake to update its menus:
|
||||
if [ "$1" = "0" -a -x /usr/bin/update-menus ]; then /usr/bin/update-menus || true ; fi
|
||||
|
||||
|
||||
#----------------------------------------------------------------
|
||||
|
||||
%post -n %{pkgname}%{ver2}-devel-%{port}-%{chartype}
|
||||
cd %{wxpref}/bin
|
||||
ln -s ../lib/wx/config/%{port}-%{chartype}* wx-config
|
||||
|
||||
%preun -n %{pkgname}%{ver2}-devel-%{port}-%{chartype}
|
||||
rm %{wxpref}/bin/wx-config
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
%clean
|
||||
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
|
||||
#----------------------------------------------------------------
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
%files
|
||||
%files -n %{pkgname}%{ver2}-%{port}-%{chartype}
|
||||
%defattr(-,root,root)
|
||||
%doc docs/preamble.txt docs/licence.txt docs/lgpl.txt docs/readme.txt docs/changes.txt
|
||||
%doc wxPython/docs/*
|
||||
%{_bindir}/*
|
||||
%{pref}/lib*/python%{pyver}/site-packages/*
|
||||
%dir %{pref}/lib*/python%{pyver}/site-packages/wx-%{ver2}*-%{port}-%{chartype}
|
||||
%{pref}/lib*/python%{pyver}/site-packages/wx-%{ver2}*-%{port}-%{chartype}/*
|
||||
%dir %{wxpref}
|
||||
%dir %{wxpref}/lib
|
||||
%{wxpref}/lib/libwx*
|
||||
%{wxpref}/lib/libwx_gtk*
|
||||
%{wxpref}/share
|
||||
|
||||
|
||||
|
||||
%files -n %{pkgname}-common-%{port}-%{chartype}
|
||||
%defattr(-,root,root)
|
||||
%{pref}/lib*/python%{pyver}/site-packages/wxversion.*
|
||||
%{pref}/lib*/python%{pyver}/site-packages/wx.pth
|
||||
%{_bindir}/*
|
||||
%{_datadir}/applnk/Development/*
|
||||
%{_datadir}/applications/*
|
||||
%{_datadir}/icons/hicolor/*/apps/*
|
||||
%{_datadir}/pixmaps/*
|
||||
%{_libdir}/menu/*
|
||||
|
||||
##%{wxprefbase}
|
||||
|
||||
|
||||
%files -n wxPython%{port}-devel
|
||||
|
||||
|
||||
%files -n %{pkgname}%{ver2}-devel-%{port}-%{chartype}
|
||||
%defattr(-,root,root)
|
||||
%{wxpref}/include
|
||||
%{wxpref}/lib/wx
|
||||
%{wxconfigname}
|
||||
%{wxpref}/bin/wx-config
|
||||
%{wxpref}/bin/wx-config-%{ver2}
|
||||
%dir %{wxpref}/bin
|
||||
|
||||
#----------------------------------------------------------------
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# end of file
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
development and testing, and is meant to help other people that want
|
||||
to do the same thing. I'll assume that you are using either a CVS
|
||||
snapshot from <a class="reference" href="http://wxWidgets.org/snapshots/">http://wxWidgets.org/snapshots/</a>, a checkout from CVS, or
|
||||
one of the released wxPythonSrc-2.5.* tarballs. I'll also assume that
|
||||
one of the released wxPython-src-2.5.* tarballs. I'll also assume that
|
||||
you know your way around your system, the compiler, etc. and most
|
||||
importantly, that you know what you are doing! ;-)</p>
|
||||
<p>If you want to also install the version of wxPython you build to be in
|
||||
@@ -25,29 +25,29 @@ you only use the instructions in this <a class="reference" href="BUILD.html">BUI
|
||||
will end up with a separate installation of wxPython and you can
|
||||
switch back and forth between this and the release version that you
|
||||
may already have installed.</p>
|
||||
<p>If you want to make changes to any of the <tt class="literal"><span class="pre">*.i</span></tt> files, (SWIG interface
|
||||
definition files,) or to regenerate the extension sources or renamer
|
||||
modules, then you will need an up to date version of SWIG. Either get
|
||||
and build the current CVS version, or version 1.3.20, and then apply
|
||||
the patches in wxPython/SWIG. See the README.txt in that dir for
|
||||
details about each patch and also info about those that may already
|
||||
have been applied to the SWIG sources. If you install this build of
|
||||
SWIG to a location that is not on the PATH (so it doesn't interfere
|
||||
with an existing SWIG install for example) then you can set a setup.py
|
||||
command-line variable named SWIG to be the full path name of the
|
||||
executable and the wxPython build will use it. See below for an
|
||||
example.</p>
|
||||
<p>If you want to make changes to any of the <tt class="literal"><span class="pre">*.i</span></tt> files, (SWIG
|
||||
interface definition files,) or to regenerate the extension sources or
|
||||
renamer modules, then you will need an up to date version of SWIG,
|
||||
plus some patches. Get the sources for version 1.3.22, and then apply
|
||||
the patches in wxPython/SWIG and then build SWIG like normal. See the
|
||||
README.txt in the wxPython/SWIG dir for details about each patch and
|
||||
also info about those that may already have been applied to the SWIG
|
||||
sources. If you install this build of SWIG to a location that is not
|
||||
on the PATH (so it doesn't interfere with an existing SWIG install for
|
||||
example) then you can set a setup.py command-line variable named SWIG
|
||||
to be the full path name of the executable and the wxPython build will
|
||||
use it. See below for an example.</p>
|
||||
<p>In the text below I'll use WXDIR with environment variable syntax
|
||||
(either $WXDIR or %WXDIR%) to refer to the top level directory were
|
||||
(either $WXDIR or %WXDIR%) to refer to the top level directory where
|
||||
your wxWidgerts and wxPython sources are located. It will equate to
|
||||
whereever you checked out the wxWidgets module from CVS, or untarred
|
||||
the wxPythonSrc tarball to. You can either substitute the $WXDIR text
|
||||
the wxPython-src tarball to. You can either substitute the $WXDIR text
|
||||
below with your actual dir, or set the value in the environment and
|
||||
use it just like you see it below.</p>
|
||||
<p>If you run into what appears to be compatibility issues between
|
||||
wxWidgets and wxPython while building wxPython, be sure you are using
|
||||
the wxWidgets sources included with the wxPythonSrc tarball or the CVS
|
||||
snapshot, and not a previously installed version or a version
|
||||
the wxWidgets sources included with the wxPython-src tarball or the
|
||||
CVS snapshot, and not a previously installed version or a version
|
||||
installed from one of the standard wxWidgets installers. With the
|
||||
"unstable" releases (have a odd-numbered minor release value, where
|
||||
the APIs are allowed to change) there are often significant
|
||||
@@ -81,23 +81,28 @@ cd bld
|
||||
</pre>
|
||||
<p>On OS X of course you'll want to use --with-mac instead of
|
||||
--with-gtk.</p>
|
||||
<p><strong>NOTE</strong>: Due to a recent change there is a dependency problem in the
|
||||
multilib builds of wxWidgets on OSX, so I have switched to a
|
||||
monolithic build on that platform. (IOW, all of the core code in
|
||||
one shared library instead of several.) I would also expect other
|
||||
unix builds to do just fine with a monolithic library, but I havn't
|
||||
tested it in a while so your mileage may vary. Anyway, to switch
|
||||
<p><strong>NOTE</strong>: Due to a recent change there is currently a dependency
|
||||
problem in the multilib builds of wxWidgets on OSX, so I have
|
||||
switched to using a monolithic build. That means that all of the
|
||||
core wxWidgets code is placed in in one shared library instead of
|
||||
several. wxPython can be used with either mode, so use whatever
|
||||
suits you on Linux and etc. but use monolithic on OSX. To switch
|
||||
to the monolithic build of wxWidgets just add this configure flag:</p>
|
||||
<pre class="literal-block">
|
||||
--enable-monolithic \
|
||||
</pre>
|
||||
<p>By default GTK2 will be selected if it is on your build system. To
|
||||
force the use of GTK 1.2.x add this flag:</p>
|
||||
<p>By default GTK2 will be selected if its development pacakge is
|
||||
installed on your build system. To force the use of GTK 1.2.x
|
||||
instead add this flag:</p>
|
||||
<pre class="literal-block">
|
||||
--disable-gtk2 \
|
||||
</pre>
|
||||
<p>To make the wxWidgets build be Unicode enabled (strongly
|
||||
recommended if you are building with GTK2) then add:</p>
|
||||
<p>To make the wxWidgets build be unicode enabled (strongly
|
||||
recommended if you are building with GTK2) then add the following.
|
||||
When wxPython is unicode enabled then all strings that are passed
|
||||
to wx functions and methods will first be converted to unicode
|
||||
objects, and any 'strings' returned from wx functions and methods
|
||||
will actually be unicode objects.:</p>
|
||||
<pre class="literal-block">
|
||||
--enable-unicode \
|
||||
</pre>
|
||||
@@ -131,8 +136,7 @@ dir I don't lose my scripts too.) This is what it looks like:</p>
|
||||
make $* \
|
||||
&& make -C contrib/src/gizmos $* \
|
||||
&& make -C contrib/src/ogl CXXFLAGS="-DwxUSE_DEPRECATED=0" $* \
|
||||
&& make -C contrib/src/stc $* \
|
||||
&& make -C contrib/src/xrc $*
|
||||
&& make -C contrib/src/stc $*
|
||||
</pre>
|
||||
<p>So you just use .make as if it where make, but don't forget to set
|
||||
the execute bit on .make first!:</p>
|
||||
@@ -178,7 +182,7 @@ WX_CONFIG=/opt/wx/2.5/bin/wx-config
|
||||
GTK2. If you built wxWidgets to use GTK 1.2.x then you should add
|
||||
this flag to the command-line:</p>
|
||||
<pre class="literal-block">
|
||||
WXPORT=gtk2
|
||||
WXPORT=gtk
|
||||
</pre>
|
||||
<p>If you would like to do a Unicode enabled build (all strings sent
|
||||
to or retruned from wx functions are Unicode objects) and your
|
||||
@@ -235,7 +239,7 @@ compilers) can also be used but I've never done the work to make that
|
||||
happen. If you want to try that then first you'll want to find out if
|
||||
there are any tricks that have to be done to make Python extension
|
||||
modules using that compiler, and then make a few changes to setup.py
|
||||
to accomodate that. (And send the patches to me.) If you plan on
|
||||
to accommodate that. (And send the patches to me.) If you plan on
|
||||
using VisualStudio.Net (a.k.a. MSVC 7.1) keep in mind that you'll also
|
||||
have to build Python and any other extension modules that you use with
|
||||
that compiler because a different version of the C runtime library is
|
||||
@@ -251,6 +255,12 @@ or python23_d.dll. If you don't need to trace through the C/C++ parts
|
||||
of the code with the debugger then building the normal (or hybrid)
|
||||
version is fine, and you can use the regular python executables with
|
||||
it.</p>
|
||||
<p>Starting with 2.5.3.0 wxPython can be built for either the monlithic
|
||||
or the multi-lib wxWidgets builds. (Monolithic means that all the
|
||||
core wxWidgets code is in one DLL, and multi-lib means that the core
|
||||
code is divided into multiple DLLs.) To select which one to use
|
||||
specify the MONOLITHIC flag for both the wxWidgets build and the
|
||||
wxPython build as shown below, setting it to either 0 or 1.</p>
|
||||
<p>Just like the unix versions I also use some scripts to help me build
|
||||
wxWidgets, but I use some non-standard stuff to do it. So if you have
|
||||
bash (cygwin or probably MSYS too) or 4NT plus unix-like cat and sed
|
||||
@@ -343,7 +353,7 @@ clean up the build:</p>
|
||||
executing nmake with a bunch of extra command line parameters.
|
||||
The base set are:</p>
|
||||
<pre class="literal-block">
|
||||
-f makefile.vc OFFICIAL_BUILD=1 SHARED=1 MONOLITHIC=0 USE_OPENGL=1
|
||||
-f makefile.vc OFFICIAL_BUILD=1 SHARED=1 MONOLITHIC=1 USE_OPENGL=1
|
||||
</pre>
|
||||
<p>If doing a debug build then add:</p>
|
||||
<pre class="literal-block">
|
||||
@@ -363,7 +373,6 @@ same command from the following directories in order to build the
|
||||
contrib libraries:</p>
|
||||
<pre class="literal-block">
|
||||
%WXDIR%\contrib\build\gizmos
|
||||
%WXDIR%\contrib\build\xrc
|
||||
%WXDIR%\contrib\build\stc
|
||||
%WXDIR%\contrib\build\ogl
|
||||
|
||||
@@ -385,10 +394,11 @@ version the rest of the time. If you ever do want to install the
|
||||
development version please refer to INSTALL.txt.</p>
|
||||
<p>Change to the %WXDIR%\wxPython dir and run the this command,
|
||||
making sure that you use the version of python that you want to
|
||||
build for (if you have more than one on your system):</p>
|
||||
build for (if you have more than one on your system) and to match
|
||||
the MONOLITHIC flag with how you built wxWidgets:</p>
|
||||
<pre class="literal-block">
|
||||
cd %WXDIR%\wxPython
|
||||
python setup.py build_ext --inplace
|
||||
python setup.py build_ext --inplace MONOLITHIC=1
|
||||
</pre>
|
||||
<p>If you are wanting to have the source files regenerated with swig,
|
||||
then you need to turn on the USE_SWIG flag and optionally tell it
|
||||
|
||||
@@ -5,7 +5,7 @@ This file describes how I build wxWidgets and wxPython while doing
|
||||
development and testing, and is meant to help other people that want
|
||||
to do the same thing. I'll assume that you are using either a CVS
|
||||
snapshot from http://wxWidgets.org/snapshots/, a checkout from CVS, or
|
||||
one of the released wxPythonSrc-2.5.* tarballs. I'll also assume that
|
||||
one of the released wxPython-src-2.5.* tarballs. I'll also assume that
|
||||
you know your way around your system, the compiler, etc. and most
|
||||
importantly, that you know what you are doing! ;-)
|
||||
|
||||
@@ -21,31 +21,31 @@ may already have installed.
|
||||
.. _INSTALL: INSTALL.html
|
||||
.. _BUILD: BUILD.html
|
||||
|
||||
If you want to make changes to any of the ``*.i`` files, (SWIG interface
|
||||
definition files,) or to regenerate the extension sources or renamer
|
||||
modules, then you will need an up to date version of SWIG. Either get
|
||||
and build the current CVS version, or version 1.3.20, and then apply
|
||||
the patches in wxPython/SWIG. See the README.txt in that dir for
|
||||
details about each patch and also info about those that may already
|
||||
have been applied to the SWIG sources. If you install this build of
|
||||
SWIG to a location that is not on the PATH (so it doesn't interfere
|
||||
with an existing SWIG install for example) then you can set a setup.py
|
||||
command-line variable named SWIG to be the full path name of the
|
||||
executable and the wxPython build will use it. See below for an
|
||||
example.
|
||||
If you want to make changes to any of the ``*.i`` files, (SWIG
|
||||
interface definition files,) or to regenerate the extension sources or
|
||||
renamer modules, then you will need an up to date version of SWIG,
|
||||
plus some patches. Get the sources for version 1.3.22, and then apply
|
||||
the patches in wxPython/SWIG and then build SWIG like normal. See the
|
||||
README.txt in the wxPython/SWIG dir for details about each patch and
|
||||
also info about those that may already have been applied to the SWIG
|
||||
sources. If you install this build of SWIG to a location that is not
|
||||
on the PATH (so it doesn't interfere with an existing SWIG install for
|
||||
example) then you can set a setup.py command-line variable named SWIG
|
||||
to be the full path name of the executable and the wxPython build will
|
||||
use it. See below for an example.
|
||||
|
||||
In the text below I'll use WXDIR with environment variable syntax
|
||||
(either $WXDIR or %WXDIR%) to refer to the top level directory were
|
||||
(either $WXDIR or %WXDIR%) to refer to the top level directory where
|
||||
your wxWidgerts and wxPython sources are located. It will equate to
|
||||
whereever you checked out the wxWidgets module from CVS, or untarred
|
||||
the wxPythonSrc tarball to. You can either substitute the $WXDIR text
|
||||
the wxPython-src tarball to. You can either substitute the $WXDIR text
|
||||
below with your actual dir, or set the value in the environment and
|
||||
use it just like you see it below.
|
||||
|
||||
If you run into what appears to be compatibility issues between
|
||||
wxWidgets and wxPython while building wxPython, be sure you are using
|
||||
the wxWidgets sources included with the wxPythonSrc tarball or the CVS
|
||||
snapshot, and not a previously installed version or a version
|
||||
the wxWidgets sources included with the wxPython-src tarball or the
|
||||
CVS snapshot, and not a previously installed version or a version
|
||||
installed from one of the standard wxWidgets installers. With the
|
||||
"unstable" releases (have a odd-numbered minor release value, where
|
||||
the APIs are allowed to change) there are often significant
|
||||
@@ -86,23 +86,28 @@ place, then do the same for wxPython.
|
||||
On OS X of course you'll want to use --with-mac instead of
|
||||
--with-gtk.
|
||||
|
||||
**NOTE**: Due to a recent change there is a dependency problem in the
|
||||
multilib builds of wxWidgets on OSX, so I have switched to a
|
||||
monolithic build on that platform. (IOW, all of the core code in
|
||||
one shared library instead of several.) I would also expect other
|
||||
unix builds to do just fine with a monolithic library, but I havn't
|
||||
tested it in a while so your mileage may vary. Anyway, to switch
|
||||
**NOTE**: Due to a recent change there is currently a dependency
|
||||
problem in the multilib builds of wxWidgets on OSX, so I have
|
||||
switched to using a monolithic build. That means that all of the
|
||||
core wxWidgets code is placed in in one shared library instead of
|
||||
several. wxPython can be used with either mode, so use whatever
|
||||
suits you on Linux and etc. but use monolithic on OSX. To switch
|
||||
to the monolithic build of wxWidgets just add this configure flag::
|
||||
|
||||
--enable-monolithic \
|
||||
|
||||
By default GTK2 will be selected if it is on your build system. To
|
||||
force the use of GTK 1.2.x add this flag::
|
||||
By default GTK2 will be selected if its development pacakge is
|
||||
installed on your build system. To force the use of GTK 1.2.x
|
||||
instead add this flag::
|
||||
|
||||
--disable-gtk2 \
|
||||
|
||||
To make the wxWidgets build be Unicode enabled (strongly
|
||||
recommended if you are building with GTK2) then add::
|
||||
To make the wxWidgets build be unicode enabled (strongly
|
||||
recommended if you are building with GTK2) then add the following.
|
||||
When wxPython is unicode enabled then all strings that are passed
|
||||
to wx functions and methods will first be converted to unicode
|
||||
objects, and any 'strings' returned from wx functions and methods
|
||||
will actually be unicode objects.::
|
||||
|
||||
--enable-unicode \
|
||||
|
||||
@@ -137,8 +142,7 @@ place, then do the same for wxPython.
|
||||
make $* \
|
||||
&& make -C contrib/src/gizmos $* \
|
||||
&& make -C contrib/src/ogl CXXFLAGS="-DwxUSE_DEPRECATED=0" $* \
|
||||
&& make -C contrib/src/stc $* \
|
||||
&& make -C contrib/src/xrc $*
|
||||
&& make -C contrib/src/stc $*
|
||||
|
||||
So you just use .make as if it where make, but don't forget to set
|
||||
the execute bit on .make first!::
|
||||
@@ -250,7 +254,7 @@ compilers) can also be used but I've never done the work to make that
|
||||
happen. If you want to try that then first you'll want to find out if
|
||||
there are any tricks that have to be done to make Python extension
|
||||
modules using that compiler, and then make a few changes to setup.py
|
||||
to accomodate that. (And send the patches to me.) If you plan on
|
||||
to accommodate that. (And send the patches to me.) If you plan on
|
||||
using VisualStudio.Net (a.k.a. MSVC 7.1) keep in mind that you'll also
|
||||
have to build Python and any other extension modules that you use with
|
||||
that compiler because a different version of the C runtime library is
|
||||
@@ -268,6 +272,13 @@ of the code with the debugger then building the normal (or hybrid)
|
||||
version is fine, and you can use the regular python executables with
|
||||
it.
|
||||
|
||||
Starting with 2.5.3.0 wxPython can be built for either the monlithic
|
||||
or the multi-lib wxWidgets builds. (Monolithic means that all the
|
||||
core wxWidgets code is in one DLL, and multi-lib means that the core
|
||||
code is divided into multiple DLLs.) To select which one to use
|
||||
specify the MONOLITHIC flag for both the wxWidgets build and the
|
||||
wxPython build as shown below, setting it to either 0 or 1.
|
||||
|
||||
Just like the unix versions I also use some scripts to help me build
|
||||
wxWidgets, but I use some non-standard stuff to do it. So if you have
|
||||
bash (cygwin or probably MSYS too) or 4NT plus unix-like cat and sed
|
||||
@@ -361,7 +372,7 @@ accordingly if you are using the bash shell.
|
||||
executing nmake with a bunch of extra command line parameters.
|
||||
The base set are::
|
||||
|
||||
-f makefile.vc OFFICIAL_BUILD=1 SHARED=1 MONOLITHIC=0 USE_OPENGL=1
|
||||
-f makefile.vc OFFICIAL_BUILD=1 SHARED=1 MONOLITHIC=1 USE_OPENGL=1
|
||||
|
||||
If doing a debug build then add::
|
||||
|
||||
@@ -381,7 +392,6 @@ accordingly if you are using the bash shell.
|
||||
contrib libraries::
|
||||
|
||||
%WXDIR%\contrib\build\gizmos
|
||||
%WXDIR%\contrib\build\xrc
|
||||
%WXDIR%\contrib\build\stc
|
||||
%WXDIR%\contrib\build\ogl
|
||||
|
||||
@@ -404,10 +414,11 @@ accordingly if you are using the bash shell.
|
||||
|
||||
Change to the %WXDIR%\\wxPython dir and run the this command,
|
||||
making sure that you use the version of python that you want to
|
||||
build for (if you have more than one on your system)::
|
||||
build for (if you have more than one on your system) and to match
|
||||
the MONOLITHIC flag with how you built wxWidgets::
|
||||
|
||||
cd %WXDIR%\wxPython
|
||||
python setup.py build_ext --inplace
|
||||
python setup.py build_ext --inplace MONOLITHIC=1
|
||||
|
||||
If you are wanting to have the source files regenerated with swig,
|
||||
then you need to turn on the USE_SWIG flag and optionally tell it
|
||||
|
||||
@@ -11,7 +11,161 @@
|
||||
<div class="document" id="recent-changes-for-wxpython">
|
||||
<h1 class="title">Recent Changes for wxPython</h1>
|
||||
<div class="section" id="id1">
|
||||
<h1><a name="id1">2.5.2.8</a></h1>
|
||||
<h1><a name="id1">2.5.3.1</a></h1>
|
||||
<p>wxMac focus and border refreshes corrected.</p>
|
||||
<p>Updated internal PNG library.</p>
|
||||
<p>wxMac fix for metal appearance on wx.ToolBar.</p>
|
||||
<p>wx.grid.Grid fix allowing DoGetBestSize to be called before CreateGrid
|
||||
(which means that a min size doesn't need to be specified.)</p>
|
||||
<p>wxMac fix for not sending a native click to a control if it is not
|
||||
enabled (does an enable itself)</p>
|
||||
<p>Added wx.lib.ogl.DrawnShape, and fixed various little bugs in the new
|
||||
OGL.</p>
|
||||
<p>Added support to XRC and XRCed for the 3-state checkbox flags and also
|
||||
for wx.ToggleButton. Updated the generic window styles supported by
|
||||
XRCed.</p>
|
||||
<p>It is now possible to create "stock" buttons. Basically this means
|
||||
that you only have to provide one of the stock IDs (and either an
|
||||
empty label or a label that matches the stock label) when creating the
|
||||
button and wxWidgets will choose the stock label to go with it
|
||||
automatically. Additionally on the platforms that have a native
|
||||
concept of a stock button (currently only GTK2) then the native stock
|
||||
button will be used. For example, the following will result in a
|
||||
button with "Cancel" as the label and an accelerator on the "C", and
|
||||
if run on wxGTK2 then there will also be an image of a red X:</p>
|
||||
<pre class="literal-block">
|
||||
b = wx.Button(parent, wx.ID_CANCEL)
|
||||
</pre>
|
||||
<p>Added wx.lib.ticker.Ticker class from Chris Mellon.</p>
|
||||
<p>Fix some incorrect clipping regions in wxSTC on wxGTK.</p>
|
||||
<p>Added wrapper for wx.grid.Grid.GetOrCreateCellAttr.</p>
|
||||
<p>Removed my copy of distutils from the wxPython source tree. Now that
|
||||
I am no longer doing builds on Python 2.1 the newest distutils is no
|
||||
longer needed. (There is still one small bug in Python 2.2 distutils
|
||||
on win32, but it is easily worked around.) This sovles the problem of
|
||||
incorrect builds on some systems where the system installed distutils
|
||||
has been patched to behave slightly differently, for example SuSE on
|
||||
x86_64 or Chandler's build.</p>
|
||||
<p>Updated to SWIG 1.3.22 (plus my patch.) See wxPython/SWIG/README.txt
|
||||
in the source tree if you need to use SWIG when building your own copy
|
||||
of wxPython, or other extension modules that need to integrate with
|
||||
the wxPython modules.</p>
|
||||
<p>Added wx.Frame.RequestUserAttention which, if the platform suports it,
|
||||
will do something (such as flash the task bar item) to suggest to the
|
||||
user that they should look at that window.</p>
|
||||
<p>"Fixed" wx.grid.Grid.SetDefaultEditor and SetDefaultRenderer by making
|
||||
them register the editor or renderer for the "string" data type.</p>
|
||||
<p>Added depth param to wx.Image.ConvertToBitmap.</p>
|
||||
<p>Extended the wx.calendar.CalendarCtrl class with methods that get/set
|
||||
a Python datetime or date object. (These will only work with Python
|
||||
2.3+) The methods are PySetDate, PyGetDate, PySetLowerDateLimit,
|
||||
PySetUpperDateLimit, PySetDateRange, PyGetLowerDateLimit, and
|
||||
PyGetUpperDateLimit. Also, CalendarEvent was extended with PySetDate
|
||||
and PyGetDate methods.</p>
|
||||
<p>wxMSW: SetBackgroundColour on a wx.Choice or a wx.ComboBox will now
|
||||
also set the colour of the dropdown.</p>
|
||||
<p>wxMac: MessageDialog now supports wx.NO_DEFAULT style</p>
|
||||
<p>wxMSW: added AssociateHandle and DissociateHandle to wx.Window</p>
|
||||
<p>wxMac: fix for toolbar tooltips</p>
|
||||
<p>wx.Sizer.Show (and Hide) now take an optional parameter specifying if
|
||||
the item to be shown should be searched for recursivly in subsizers,
|
||||
and return a boolean value indicating if the item was found.</p>
|
||||
<p>wxMSW: fixed MaximizeEvent generation in wx.Frame</p>
|
||||
<p>wxMSW: fixed sending duplicate EVT_COMBOBOX events</p>
|
||||
<p>Smoother time estimation updates in wx.ProgressDialog (patch 992813)</p>
|
||||
<p>Made wx.Listbook events more consistent with wx.Notebook ones (patch
|
||||
1001271)</p>
|
||||
<p>Fixed rounding errors in variable status bar panes widths computation
|
||||
(patch 1030021)</p>
|
||||
<p>Added possibility to specify printer bin (patch 910272)</p>
|
||||
<p>wxMSW: fixed wx.ListCtrl's SetWindowStyleFlag() to not remove
|
||||
WS_VISIBLE; also refresh the control automatically (closes bug
|
||||
1019440)</p>
|
||||
<p>Added wx.Choicebook, yet another notebook-like control.</p>
|
||||
<p>wxMSW: Make radiobutton tab behaviour the same on MSW as in standard
|
||||
MSW app, i.e. tab into the activated, not necessarily the first radio
|
||||
button.</p>
|
||||
<p>Added limited support for wxEventLoop (you can't derive from a
|
||||
wx.PyEventLoop version yet...) Updated and moved the sample showing
|
||||
how to replace the MainLoop to samples/mainloop/mainloop.py.</p>
|
||||
<p>The C++ xrc lib has been moved out of contrib and into the core, so it
|
||||
is always built by default. wxPython's build has also changed
|
||||
accordingly and will build the xrc module as part of the core set of
|
||||
modules built by default. If you were axplicitly using BUILD_XRC then
|
||||
it will no longer be recognized as a build option, otherwise you
|
||||
should notice no difference.</p>
|
||||
<p>wxMac: Fixed radio toolbar buttons to correctly untoggle the others
|
||||
when a new one is selected.</p>
|
||||
<p>wxMac: Fixed GetLineLength and GetLineText for MLTE text controls</p>
|
||||
<p>wxMac: wx.TaskBarIcon is implemented by allowing you to change the
|
||||
app's icon on the Dock and also specifying a menu that should be
|
||||
merged with the normal dock popup menu. See the MigrationGuide for
|
||||
more details and a warning.</p>
|
||||
<p>Added wx.TopLevelWindow.IsActive() which tells you if the frame or
|
||||
dialog is or containts the active window with the keyboard focus.</p>
|
||||
<p>Added ability to create a font based on pixel size rather than point
|
||||
size via the FontFromPixelSize constructor.</p>
|
||||
<p>Updated the Scintilla used by StyledTextCtrl to version 1.61</p>
|
||||
<p>Improved image HitTest for TreeListCtrl.</p>
|
||||
<p>Added wx.App.IsMainLoopRunning.</p>
|
||||
<p>wxGTK: Make wxComboBox spit out a bit fewer surplus events when
|
||||
holding down the mouse button.</p>
|
||||
<p>wxGTK: Enable key based navigation through notebook tabs as in the
|
||||
native control with Left and right keys. Support for vetoing.</p>
|
||||
<p>FloatCanvas updates from Chris Barker</p>
|
||||
<dl>
|
||||
<dt>PyPlot updates from Gordon Williams:</dt>
|
||||
<dd><ul class="first last simple">
|
||||
<li>Added bar graph demo</li>
|
||||
<li>Modified line end shape from round to square.</li>
|
||||
<li>Removed FloatDCWrapper for conversion to ints and ints in
|
||||
arguments</li>
|
||||
<li>Imported modules given leading underscore to name.</li>
|
||||
<li>Added Cursor Line Tracking and User Point Labels.</li>
|
||||
<li>Demo for Cursor Line Tracking and Point Labels.</li>
|
||||
<li>Size of plot preview frame adjusted to show page better.</li>
|
||||
<li>Added helper functions PositionUserToScreen and
|
||||
PositionScreenToUser in PlotCanvas.</li>
|
||||
<li>Added functions GetClosestPoints (all curves) and GetClosestPoint
|
||||
(only closest curve) can be in either user coords or screen
|
||||
coords.</li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt>MaskedEdit updates from Will Sadkin:</dt>
|
||||
<dd><ul class="first last simple">
|
||||
<li>Added '*' mask char that means "all ansii chars" (ords 32-255)</li>
|
||||
<li>Added proper unicode support to masked controls and wx.tools.dbg</li>
|
||||
<li>Fixed two reported missing import bugs introduced by package
|
||||
creation</li>
|
||||
<li>Converted masked package doc strings to reST format for better
|
||||
epydoc support</li>
|
||||
<li>lots of doc string improvements and function hiding to better
|
||||
reflect package's public contents.</li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
<p>Restructured the installer packages slightly to help facilitate having
|
||||
multiple versions of wxPython installed at the same time. See the
|
||||
Migrarion Guide for more information.</p>
|
||||
<dl>
|
||||
<dt>Applied patch from Pim Van Heuven that modifies 4 files:</dt>
|
||||
<dd><ul class="first last simple">
|
||||
<li>wxPython/demo/ListCtrl_edit.py (new demo)</li>
|
||||
<li>wxPython/demo/Main.py (include new demo in demo app)</li>
|
||||
<li>wxPython/wx/lib/mixins/listctrl.py (several improvements to
|
||||
TextEditMixin)</li>
|
||||
<li>wxPython/wx/lib/wxpTag.py (some small fixes)</li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
<p>Added (thanks to Kevin Ollivier!) wrappers for wx.WebKitCtrl for the
|
||||
OSX build. Other platforms will raise an exception if you try to use
|
||||
it.</p>
|
||||
<p>wxPython on OSX can now be built in Unicode mode, can support multiple
|
||||
version installs, and comes with an uninstaller script.</p>
|
||||
</div>
|
||||
<div class="section" id="id2">
|
||||
<h1><a name="id2">2.5.2.8</a></h1>
|
||||
<p>Predominantly a bug-fix release.</p>
|
||||
<blockquote>
|
||||
<ul class="simple">
|
||||
@@ -39,8 +193,8 @@ wxCheckListBox.</li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
</div>
|
||||
<div class="section" id="id2">
|
||||
<h1><a name="id2">2.5.2.7</a></h1>
|
||||
<div class="section" id="id3">
|
||||
<h1><a name="id3">2.5.2.7</a></h1>
|
||||
<p>wx.ADJUST_MINSIZE is now the default behaviour for window items in
|
||||
sizers. This means that the item's GetMinSize and/or GetBestSize will
|
||||
be called when calculating layout and the return value from that will
|
||||
@@ -133,8 +287,8 @@ in the PyShell:</p>
|
||||
... wx.MilliSleep(10)
|
||||
</pre>
|
||||
</div>
|
||||
<div class="section" id="id3">
|
||||
<h1><a name="id3">2.5.1.5</a></h1>
|
||||
<div class="section" id="id4">
|
||||
<h1><a name="id4">2.5.1.5</a></h1>
|
||||
<p>(See also the <a class="reference" href="MigrationGuide.html">MigrationGuide</a> file for details about some of the
|
||||
big changes that have happened in this release and how you should
|
||||
adapt your code.)</p>
|
||||
@@ -215,8 +369,8 @@ migrating away from using activexwrapper as well. Please see the
|
||||
MigrationGuide for more details on using the new module.</p>
|
||||
<p>Floats are allowed again as function parameters where ints are expected.</p>
|
||||
</div>
|
||||
<div class="section" id="id5">
|
||||
<h1><a name="id5">2.4.2.4</a></h1>
|
||||
<div class="section" id="id6">
|
||||
<h1><a name="id6">2.4.2.4</a></h1>
|
||||
<p>Use wxSTC in the demo for displaying the soucre code of the samples.</p>
|
||||
<p>Lots of bug fixes and such from the wxWindows folks.</p>
|
||||
<p>Added wxPython.lib.newevent from Miki Tebeka. Its usage is
|
||||
@@ -225,8 +379,8 @@ demonstrated in the Threads sample in the demo.</p>
|
||||
<p>Added wxMaskedNumCtrl.</p>
|
||||
<p>Added Chris Barker's FloatCanvas.</p>
|
||||
</div>
|
||||
<div class="section" id="id6">
|
||||
<h1><a name="id6">2.4.1.2</a></h1>
|
||||
<div class="section" id="id7">
|
||||
<h1><a name="id7">2.4.1.2</a></h1>
|
||||
<p>Added wxScrolledPanel from Will Sadkin</p>
|
||||
<p>Added SetShape method to top level windows (e.g. wxFrame.)</p>
|
||||
<p>Changed wxSWIG to not generate Python code using apply, (since it will
|
||||
@@ -277,8 +431,8 @@ release,) SetItemMinSize can now take a wxSize (or 2-tuple) parameter,
|
||||
and Spacers can be specified with a wxSize (or 2-tuple) parameter</p>
|
||||
<p>Added wxCursorFromBits.</p>
|
||||
</div>
|
||||
<div class="section" id="id7">
|
||||
<h1><a name="id7">2.4.0.7</a></h1>
|
||||
<div class="section" id="id8">
|
||||
<h1><a name="id8">2.4.0.7</a></h1>
|
||||
<p>Gave up on generating a warning upon the use of the old true/false or
|
||||
TRUE/FALSE values.</p>
|
||||
<p>Fixed wxGenericTreeCtrl (used on wxGTK and wxMac for wxTreeCtrl) so
|
||||
@@ -308,8 +462,8 @@ think I am testing in the future...</p>
|
||||
<p>Updated pycolourchooser.</p>
|
||||
<p>Updated to 0.9b of PyCrust.</p>
|
||||
</div>
|
||||
<div class="section" id="id8">
|
||||
<h1><a name="id8">2.4.0.4</a></h1>
|
||||
<div class="section" id="id9">
|
||||
<h1><a name="id9">2.4.0.4</a></h1>
|
||||
<p>Added missing wxRect methods</p>
|
||||
<p>Add OOR support for wxApp objects too.</p>
|
||||
<p>Added wxCursorFromImage, which works on wxMSW and wxGTK so far.</p>
|
||||
@@ -365,25 +519,25 @@ doesn't have a standard place for them.</p>
|
||||
<p>Fixed typemaps for wxGridCellCoordsArray.</p>
|
||||
<p>Updated to the 0.9a version of PyCrust</p>
|
||||
</div>
|
||||
<div class="section" id="id9">
|
||||
<h1><a name="id9">2.4.0.2</a></h1>
|
||||
<div class="section" id="id10">
|
||||
<h1><a name="id10">2.4.0.2</a></h1>
|
||||
<p>Several bug fixes.</p>
|
||||
<p>Added wxIntCtrl from Will Sadkin.</p>
|
||||
<p>Added wxPyColourChooser by Michael Gilfix.</p>
|
||||
</div>
|
||||
<div class="section" id="id10">
|
||||
<h1><a name="id10">2.4.0.1</a></h1>
|
||||
<div class="section" id="id11">
|
||||
<h1><a name="id11">2.4.0.1</a></h1>
|
||||
<p>No major new features since 2.3.4.2, mostly bug fixes and minor
|
||||
enhancements.</p>
|
||||
<p>Added function wrappers for the common dialogs from Kevin Altis. See
|
||||
wxPython/lib/dialogs.py for more details.</p>
|
||||
</div>
|
||||
<div class="section" id="id11">
|
||||
<h1><a name="id11">2.3.4.2</a></h1>
|
||||
<div class="section" id="id12">
|
||||
<h1><a name="id12">2.3.4.2</a></h1>
|
||||
<p>Various bug fixes.</p>
|
||||
</div>
|
||||
<div class="section" id="id12">
|
||||
<h1><a name="id12">2.3.4.1</a></h1>
|
||||
<div class="section" id="id13">
|
||||
<h1><a name="id13">2.3.4.1</a></h1>
|
||||
<p>Updated XRCed and wxTimeCtrl contribs.</p>
|
||||
<p>Show a couple new wxGrid features in the demo.</p>
|
||||
<p>Several bug fixes in wxWindows.</p>
|
||||
@@ -437,8 +591,8 @@ windows when desired.</p>
|
||||
HTMLHelp viewer does. Changed how the wxPythonDocs tarball is built
|
||||
and added a script to launch the doc viewer.</p>
|
||||
</div>
|
||||
<div class="section" id="id13">
|
||||
<h1><a name="id13">2.3.3.1</a></h1>
|
||||
<div class="section" id="id14">
|
||||
<h1><a name="id14">2.3.3.1</a></h1>
|
||||
<p>Added wxSplashScreen.</p>
|
||||
<p>Added wxGenericDirCtrl.</p>
|
||||
<p>Added wxMultiChoiceDialog.</p>
|
||||
@@ -580,15 +734,15 @@ example.</p>
|
||||
<p>Added wxPython.lib.mixins.rubberband module from Robb Shecter.</p>
|
||||
<p>Added wxTimeCtrl from Will Sadkin.</p>
|
||||
</div>
|
||||
<div class="section" id="id14">
|
||||
<h1><a name="id14">2.3.2.1</a></h1>
|
||||
<div class="section" id="id15">
|
||||
<h1><a name="id15">2.3.2.1</a></h1>
|
||||
<p>Changed (again) how the Python global interpreter lock is handled as
|
||||
well as the Python thread state. This time it works on SMP machines
|
||||
without barfing and is also still compatible with Python debuggers.</p>
|
||||
<p>Added some patches from library contributors.</p>
|
||||
</div>
|
||||
<div class="section" id="id15">
|
||||
<h1><a name="id15">2.3.2</a></h1>
|
||||
<div class="section" id="id16">
|
||||
<h1><a name="id16">2.3.2</a></h1>
|
||||
<p>Added EVT_HELP, EVT_HELP_RANGE, EVT_DETAILED_HELP,
|
||||
EVT_DETAILED_HELP_RANGE, EVT_CONTEXT_MENU, wxHelpEvent,
|
||||
wxContextMenuEvent, wxContextHelp, wxContextHelpButton, wxTipWindow,
|
||||
@@ -670,8 +824,8 @@ SendCommand method, but it is still quite powerful. See
|
||||
wxPython/contrib/dllwidget and wxPython/demo/dllwidget for more
|
||||
details.</p>
|
||||
</div>
|
||||
<div class="section" id="id16">
|
||||
<h1><a name="id16">2.3.1</a></h1>
|
||||
<div class="section" id="id17">
|
||||
<h1><a name="id17">2.3.1</a></h1>
|
||||
<p>Added EVT_GRID_EDITOR_CREATED and wxGridEditorCreatedEvent so the user
|
||||
code can get access to the edit control when it is created, (to push
|
||||
on a custom event handler for example.)</p>
|
||||
@@ -684,8 +838,8 @@ subclass wxXmlResourceHandler, etc...</p>
|
||||
<p>Fixed img2py to work correctly with Python 2.1.</p>
|
||||
<p>Added enhanced wxVTKRenderWindow by Prabhu Ramachandran</p>
|
||||
</div>
|
||||
<div class="section" id="id17">
|
||||
<h1><a name="id17">2.3.0</a></h1>
|
||||
<div class="section" id="id18">
|
||||
<h1><a name="id18">2.3.0</a></h1>
|
||||
<p>Removed initial startup dependency on the OpenGL DLLs so only the
|
||||
glcanvasc.pyd depends on them, (on wxMSW.)</p>
|
||||
<p>Changed wxFont, wxPen, wxBrush to not implicitly use the
|
||||
@@ -781,13 +935,13 @@ please send it to me for inclusion in this package.</p>
|
||||
by having smaller functional apps to play with. They can be found in
|
||||
wxPython/samples.</p>
|
||||
</div>
|
||||
<div class="section" id="id18">
|
||||
<h1><a name="id18">2.2.6</a></h1>
|
||||
<div class="section" id="id19">
|
||||
<h1><a name="id19">2.2.6</a></h1>
|
||||
<p>No changes happened in the Python wrappers for this release, only
|
||||
changes and fixes in the wxWindows library.</p>
|
||||
</div>
|
||||
<div class="section" id="id19">
|
||||
<h1><a name="id19">2.2.5</a></h1>
|
||||
<div class="section" id="id20">
|
||||
<h1><a name="id20">2.2.5</a></h1>
|
||||
<p>New typemaps for wxString when compiling for Python 2.0 and beyond
|
||||
that allow Unicode objects to be passed as well as String objects. If
|
||||
a Unicode object is passed PyString_AsStringAndSize is used to convert
|
||||
@@ -1030,7 +1184,7 @@ an EVT_SIZE handler that calls Layout().</p>
|
||||
<p>Fixed deadlock problem that happened when using threads.</p>
|
||||
<p>Added new HTML printing classes.</p>
|
||||
<p>Added wxWindow.GetHandle</p>
|
||||
<p>Apparently wxMouseEvent.Position has been depreciated in wxWindows as
|
||||
<p>Apparently wxMouseEvent.Position has been deprecated in wxWindows as
|
||||
it is no longer available by default. You can use GetPositionTuple
|
||||
(returning a tuple with x,y) instead, or GetPosition (returning a
|
||||
wxPoint.)</p>
|
||||
@@ -1088,7 +1242,7 @@ pages. See the demo for an example.</p>
|
||||
wxGTK. Added them back in since the methods exist now.</p>
|
||||
<p>Wrapped the wxHtmlHelpController and related classes.</p>
|
||||
<p>Wrapped the C++ versions of wxSizer and friends. The Python-only
|
||||
versions are still in the library, but depreciated. (You will get a
|
||||
versions are still in the library, but deprecated. (You will get a
|
||||
warning message if you try to use them, but the warning can be
|
||||
disabled.) The usage of the C++ versions is slightly different, and
|
||||
the functionality of wxBorderSizer is now part of wxBoxSizer. I have
|
||||
@@ -1227,7 +1381,7 @@ matches MSW's.</p>
|
||||
<p>Added wxGrid.GetCells</p>
|
||||
<p>Added wxSystemSettings static methods as functions with names like
|
||||
wxSystemSettings_GetSystemColour.</p>
|
||||
<p>Removed wxPyMenu since using menu callbacks have been depreciated in
|
||||
<p>Removed wxPyMenu since using menu callbacks have been deprecated in
|
||||
wxWindows. Use wxMenu and events instead.</p>
|
||||
<dl>
|
||||
<dt>Added alternate wxBitmap constructor (for MSW only) as</dt>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Recent Changes for wxPython
|
||||
=====================================================================
|
||||
|
||||
2.5.3.0
|
||||
2.5.3.1
|
||||
-------
|
||||
|
||||
wxMac focus and border refreshes corrected.
|
||||
@@ -152,8 +152,17 @@ FloatCanvas updates from Chris Barker
|
||||
PyPlot updates from Gordon Williams:
|
||||
- Added bar graph demo
|
||||
- Modified line end shape from round to square.
|
||||
- Removed FloatDCWrapper for conversion to ints and ints in arguments
|
||||
|
||||
- Removed FloatDCWrapper for conversion to ints and ints in
|
||||
arguments
|
||||
- Imported modules given leading underscore to name.
|
||||
- Added Cursor Line Tracking and User Point Labels.
|
||||
- Demo for Cursor Line Tracking and Point Labels.
|
||||
- Size of plot preview frame adjusted to show page better.
|
||||
- Added helper functions PositionUserToScreen and
|
||||
PositionScreenToUser in PlotCanvas.
|
||||
- Added functions GetClosestPoints (all curves) and GetClosestPoint
|
||||
(only closest curve) can be in either user coords or screen
|
||||
coords.
|
||||
|
||||
MaskedEdit updates from Will Sadkin:
|
||||
- Added '*' mask char that means "all ansii chars" (ords 32-255)
|
||||
@@ -165,6 +174,24 @@ MaskedEdit updates from Will Sadkin:
|
||||
- lots of doc string improvements and function hiding to better
|
||||
reflect package's public contents.
|
||||
|
||||
Restructured the installer packages slightly to help facilitate having
|
||||
multiple versions of wxPython installed at the same time. See the
|
||||
Migrarion Guide for more information.
|
||||
|
||||
Applied patch from Pim Van Heuven that modifies 4 files:
|
||||
- wxPython/demo/ListCtrl_edit.py (new demo)
|
||||
- wxPython/demo/Main.py (include new demo in demo app)
|
||||
- wxPython/wx/lib/mixins/listctrl.py (several improvements to
|
||||
TextEditMixin)
|
||||
- wxPython/wx/lib/wxpTag.py (some small fixes)
|
||||
|
||||
Added (thanks to Kevin Ollivier!) wrappers for wx.WebKitCtrl for the
|
||||
OSX build. Other platforms will raise an exception if you try to use
|
||||
it.
|
||||
|
||||
wxPython on OSX can now be built in Unicode mode, can support multiple
|
||||
version installs, and comes with an uninstaller script.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1558,7 +1585,7 @@ Added new HTML printing classes.
|
||||
|
||||
Added wxWindow.GetHandle
|
||||
|
||||
Apparently wxMouseEvent.Position has been depreciated in wxWindows as
|
||||
Apparently wxMouseEvent.Position has been deprecated in wxWindows as
|
||||
it is no longer available by default. You can use GetPositionTuple
|
||||
(returning a tuple with x,y) instead, or GetPosition (returning a
|
||||
wxPoint.)
|
||||
@@ -1640,7 +1667,7 @@ wxGTK. Added them back in since the methods exist now.
|
||||
Wrapped the wxHtmlHelpController and related classes.
|
||||
|
||||
Wrapped the C++ versions of wxSizer and friends. The Python-only
|
||||
versions are still in the library, but depreciated. (You will get a
|
||||
versions are still in the library, but deprecated. (You will get a
|
||||
warning message if you try to use them, but the warning can be
|
||||
disabled.) The usage of the C++ versions is slightly different, and
|
||||
the functionality of wxBorderSizer is now part of wxBoxSizer. I have
|
||||
@@ -1800,7 +1827,7 @@ Added wxGrid.GetCells
|
||||
Added wxSystemSettings static methods as functions with names like
|
||||
wxSystemSettings_GetSystemColour.
|
||||
|
||||
Removed wxPyMenu since using menu callbacks have been depreciated in
|
||||
Removed wxPyMenu since using menu callbacks have been deprecated in
|
||||
wxWindows. Use wxMenu and events instead.
|
||||
|
||||
Added alternate wxBitmap constructor (for MSW only) as
|
||||
|
||||
@@ -65,9 +65,11 @@ all.</p>
|
||||
</li>
|
||||
<li><p class="first">In addition to building wxPython as described in BUILD.txt, you can
|
||||
install it to Python's site-packages dir, as well as some scripts
|
||||
into the same bin dir used by Python by using this command:</p>
|
||||
into the same bin dir used by Python by using this command, plus
|
||||
whatever WXPORT, UNICODE, etc. settings you used for the initial
|
||||
build step:</p>
|
||||
<pre class="literal-block">
|
||||
python2.3 setup.py install
|
||||
python2.3 setup.py install
|
||||
</pre>
|
||||
<p>If you would like to install to some place besides the prefix where
|
||||
Python is installed, (such as to your home directory) then you can
|
||||
@@ -105,9 +107,9 @@ machines be careful to install to /Library/Python/2.3. To
|
||||
complicate things further, the Jaguar version, or a custom build
|
||||
you do yourself will end up in /Library/Frameworks even on
|
||||
Panther...</li>
|
||||
<li>You need to use pythonw at the command line or PythonLauncher app
|
||||
to run wxPython apps, otherwise the app will not be able to fully
|
||||
use the GUI display.</li>
|
||||
<li>You need to use pythonw at the command line or the PythonLauncher
|
||||
app to run wxPython apps, otherwise the app will not be able to
|
||||
fully use the GUI display.</li>
|
||||
</ol>
|
||||
</div>
|
||||
<div class="section" id="installing-on-windows">
|
||||
|
||||
@@ -112,9 +112,9 @@ instructions above, except for a few small, but important details:
|
||||
you do yourself will end up in /Library/Frameworks even on
|
||||
Panther...
|
||||
|
||||
3. You need to use pythonw at the command line or PythonLauncher app
|
||||
to run wxPython apps, otherwise the app will not be able to fully
|
||||
use the GUI display.
|
||||
3. You need to use pythonw at the command line or the PythonLauncher
|
||||
app to run wxPython apps, otherwise the app will not be able to
|
||||
fully use the GUI display.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -358,7 +358,7 @@ class MyDialog(wx.Dialog):
|
||||
<div class="section" id="sizers">
|
||||
<h1><a name="sizers">Sizers</a></h1>
|
||||
<p>The hack allowing the old "option" keyword parameter has been removed.
|
||||
If you use keyword args with w.xSizer Add, Insert, or Prepend methods
|
||||
If you use keyword args with wx.Sizer Add, Insert, or Prepend methods
|
||||
then you will need to use the <tt class="literal"><span class="pre">proportion</span></tt> name instead of
|
||||
<tt class="literal"><span class="pre">option</span></tt>. (The <tt class="literal"><span class="pre">proportion</span></tt> keyword was also allowed in 2.4.2.4.)</p>
|
||||
<p>When adding a spacer to a sizer you now need to use a wx.Size or a
|
||||
@@ -376,7 +376,7 @@ be used from XRC.</p>
|
||||
<p>You should not use AddWindow, AddSizer, AddSpacer (and similar for
|
||||
Insert, Prepend, and etc.) methods any longer. Just use Add and the
|
||||
wrappers will figure out what to do. <strong>[Changed in 2.5.2.x]</strong>
|
||||
AddWindow, AddSize, AddSpacer and etc. will now issue a
|
||||
AddWindow, AddSizer, AddSpacer and etc. will now issue a
|
||||
DeprecationWarning.</p>
|
||||
<p><strong>[Changed in 2.5.2.x]</strong> The Sizers have had some fundamental internal
|
||||
changes in the 2.5.2.x release intended to make them do more of the
|
||||
@@ -393,7 +393,7 @@ flag then when layout was calculated the item's <tt class="literal"><span class=
|
||||
would be used to reset the minimal size that the sizer used.</li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
<p>The main thrust of the new Sizer changes was to make behaviour like
|
||||
<p>The main thrust of the new Sizer changes was to make behavior like
|
||||
<tt class="literal"><span class="pre">wx.ADJUST_MINSIZE</span></tt> be the default, and also to push the tracking of
|
||||
the minimal size to the window itself (since it knows its own needs)
|
||||
instead of having the sizer take care of it. Consequently these
|
||||
@@ -401,7 +401,7 @@ changes were made:</p>
|
||||
<blockquote>
|
||||
<ul class="simple">
|
||||
<li>The <tt class="literal"><span class="pre">wx.FIXED_MINSIZE</span></tt> flag was added to allow for the old
|
||||
behaviour. When this flag is used the size a window has when
|
||||
behavior. When this flag is used the size a window has when
|
||||
added to the sizer will be treated as its minimal size and it
|
||||
will not be readjusted on each layout.</li>
|
||||
<li>The min size stored in <tt class="literal"><span class="pre">wx.Window</span></tt> and settable with
|
||||
@@ -603,9 +603,7 @@ mask and the rest would be made fully opaque.</p>
|
||||
channel and will now only create a mask when all the pixels in the
|
||||
image are either fully transparent or fully opaque. In addition, the
|
||||
wx.DC.DrawBitmap and wx.DC.Blit methods are able to correctly blend
|
||||
the pixels in the image with partially transparent alpha values.
|
||||
(Currently only on MSW and Mac, if anybody knows how to do it for GTK
|
||||
then please submit a patch!)</p>
|
||||
the pixels in the image with partially transparent alpha values.</p>
|
||||
<p>If you are using a PNG with an alpha channel but you need to have a
|
||||
wx.Mask like you automatically got in 2.4 then you can do one of the
|
||||
following:</p>
|
||||
@@ -674,7 +672,7 @@ later into the main namespace via Python code.</p>
|
||||
the "internal" module names have changed, but you shouldn't have been
|
||||
using them anyway so it shouldn't bother you. ;-) In case you were
|
||||
erroneously using them in 2.4, here are the internal extension modules
|
||||
no longer exist:</p>
|
||||
that no longer exist:</p>
|
||||
<blockquote>
|
||||
<ul class="simple">
|
||||
<li>clip_dnd</li>
|
||||
@@ -715,8 +713,93 @@ the objects in these modules only via the wx or wxPython.wx packages:</p>
|
||||
<p>The help module no longer exists and the classes therein are now part
|
||||
of the core module imported with wxPython.wx or the wx package.</p>
|
||||
</div>
|
||||
<div class="section" id="other-stuff">
|
||||
<h1><a name="other-stuff">Other Stuff</a></h1>
|
||||
<div class="section" id="wx-taskbaricon">
|
||||
<h1><a name="wx-taskbaricon">wx.TaskBarIcon</a></h1>
|
||||
<p><strong>[Changed in 2.5.3.x]</strong></p>
|
||||
<p>wx.TaskbarIcon now works on all three platforms, although for wxGTK it
|
||||
depends on support from the Window Manager. On OS X the icon replaces
|
||||
the application's icon on the dock and when you right click on it the
|
||||
app's default popup menu is merged with the wx.TaskBarIcon's menu.
|
||||
Because of how it is implemented on the Mac using the Dock most of the
|
||||
TaskBarIcon events will _not_ be emitted on that platform, but since
|
||||
98% of the time you simply want to display an icon and have a popup
|
||||
menu it shouldn't be much of a problem. You can still use the other
|
||||
events on the other platforms, you'll just want to be sure that you
|
||||
can do everything you want via the menu too.</p>
|
||||
<p>Since popping up a menu is the most common thing to do with a
|
||||
TaskBarIcon the class has some new built in functionality to
|
||||
facilitate that. To use the TaskBarIcon in this new way, simply
|
||||
derive a new class from TaskBarIcon and implement a CreatePopupMenu
|
||||
method that creates and returns the menu. That's all there is to it,
|
||||
besides binding event handlers for the menu items of course. Take a
|
||||
look at the DemoTaskBarIcon class in the demo/Main.py module for an
|
||||
example.</p>
|
||||
<p><strong>NOTE</strong>: Unfortunately due to being able to support virtualizing
|
||||
CreatePopupMenu the C++ TaskBarIcon instance now holds a reference to
|
||||
the Python instance, and so you will need to explicitly Destroy() your
|
||||
TaskBarIcon instance when you are done with it. (Like you do with
|
||||
wx.Dialogs.) If you don't destroy it then wxWidgets will assume that
|
||||
you want the app to keep running with just the icon in the task bar
|
||||
and the MainLoop will not exit.</p>
|
||||
</div>
|
||||
<div class="section" id="version-number-change">
|
||||
<h1><a name="version-number-change">Version Number Change</a></h1>
|
||||
<p><strong>[Changed in 2.5.3.x]</strong></p>
|
||||
<p>Starting with 2.5.3.0 the Unicode versions of wxPython will no longer
|
||||
have a 'u' appended to the fourth component of the version number.
|
||||
Please check for the presence of "unicode" in the <cite>wx.PlatformInfo</cite>
|
||||
tuple instead. (This tuple of strings has been available since the
|
||||
first 2.5 version.) For example:</p>
|
||||
<pre class="literal-block">
|
||||
if "unicode" in wx.PlatformInfo:
|
||||
# do whatever
|
||||
...
|
||||
</pre>
|
||||
</div>
|
||||
<div class="section" id="multi-version-installs">
|
||||
<h1><a name="multi-version-installs">Multi-Version Installs</a></h1>
|
||||
<p><strong>[Changed in 2.5.3.x]</strong></p>
|
||||
<p>Starting with 2.5.3.0 the wx and wxPython package directories will be
|
||||
installed in a subdirectory of the site-packages directory, instead of
|
||||
directly in site-packages. This is done to help facilitate having
|
||||
multiple versions of wxPython installed side-by-side. Why would you
|
||||
want to do this? One possible scenario is you have an app that
|
||||
requires wxPython 2.4 but you want to use the newest 2.5 to do your
|
||||
own development with. Or perhaps you want to be able to test your app
|
||||
with several different versions of wxPython to ensure compatibility.
|
||||
Before everyone panics, rest asured that if you only install one
|
||||
version of wxPython then you should notice no difference in how things
|
||||
work.</p>
|
||||
<p>In addition to installing wxPython into a "versioned" subdirectory of
|
||||
site-packages, a file named <cite>wx.pth</cite> is optionally installed that will
|
||||
contain the name of the versioned subdirectory. This will cause that
|
||||
subdirectory to be automatically added to the sys.path and so doing an
|
||||
"import wx" will find the package in the subdirectory like it would
|
||||
have if it was still located directly in site-packages. I say
|
||||
"optionally" above because that is how you can control which install
|
||||
of wxPython is the default one. Which ever version installs the
|
||||
wx.pth file will be the one that is imported with a plain "import wx"
|
||||
statement. Of course you can always manipulate that by editing the
|
||||
wx.pth file, or by setting PYTHONPATH in the environment, or by the
|
||||
method described in the next paragraph.</p>
|
||||
<p>Finally, a new module named wxversion.py is installed to the
|
||||
site-packages directory. It can be used to manipulate the sys.path at
|
||||
runtime so your applications can select which version of wxPython they
|
||||
would like to to have imported. You use it like this:</p>
|
||||
<pre class="literal-block">
|
||||
import wxversion
|
||||
wxversion.select("2.4")
|
||||
import wx
|
||||
</pre>
|
||||
<p>Then even though a 2.5 version of wxPython may be the default the
|
||||
application that does the above the first time that wx is imported
|
||||
will actually get a 2.4 version. <strong>NOTE:</strong> There isn't actually a 2.4
|
||||
version of wxPython that supports this, but there will be.</p>
|
||||
<p>Please see this wiki page for more details, HowTo's and FAQ's:
|
||||
<a class="reference" href="http://wiki.wxpython.org/index.cgi/MultiVersionInstalls">http://wiki.wxpython.org/index.cgi/MultiVersionInstalls</a></p>
|
||||
</div>
|
||||
<div class="section" id="miscellaneous-stuff">
|
||||
<h1><a name="miscellaneous-stuff">Miscellaneous Stuff</a></h1>
|
||||
<p>wxPyDefaultPosition and wxPyDefaultSize are gone. Use the
|
||||
wxDefaultPosition and wxDefaultSize objects instead.</p>
|
||||
<p>Similarly, the wxSystemSettings backwards compatibiility aliases for
|
||||
@@ -742,15 +825,6 @@ wxPyTypeCast at all.</p>
|
||||
there are compatibility aliases for much of the above items.</p>
|
||||
<p>The wxWave class has been renamed to wxSound, and now has a slightly
|
||||
different API.</p>
|
||||
<p>wx.TaskbarIcon works on wxGTK-based platforms (for some window
|
||||
managers,) however you have to manage it a little bit more than you
|
||||
did before. Basically, the app will treat it like a top-level frame
|
||||
in that if the wx.TaskBarIcon still exists when all the frames are
|
||||
closed then the app will still not exit. You need to ensure that the
|
||||
wx.TaskBarIcon is destroyed when your last Frame is closed. For
|
||||
wxPython apps it is usually enough if your main frame object holds the
|
||||
only reference to the wx.TaskBarIcon, then when the frame is closed
|
||||
Python reference counting takes care of the rest.</p>
|
||||
<p>Before Python 2.3 it was possible to pass a floating point object as a
|
||||
parameter to a function that expected an integer, and the
|
||||
PyArg_ParseTuple family of functions would automatically convert to
|
||||
|
||||
@@ -403,7 +403,7 @@ Sizers
|
||||
------
|
||||
|
||||
The hack allowing the old "option" keyword parameter has been removed.
|
||||
If you use keyword args with w.xSizer Add, Insert, or Prepend methods
|
||||
If you use keyword args with wx.Sizer Add, Insert, or Prepend methods
|
||||
then you will need to use the ``proportion`` name instead of
|
||||
``option``. (The ``proportion`` keyword was also allowed in 2.4.2.4.)
|
||||
|
||||
@@ -441,14 +441,14 @@ First a bit about how things used to work:
|
||||
flag then when layout was calculated the item's ``GetBestSize``
|
||||
would be used to reset the minimal size that the sizer used.
|
||||
|
||||
The main thrust of the new Sizer changes was to make behaviour like
|
||||
The main thrust of the new Sizer changes was to make behavior like
|
||||
``wx.ADJUST_MINSIZE`` be the default, and also to push the tracking of
|
||||
the minimal size to the window itself (since it knows its own needs)
|
||||
instead of having the sizer take care of it. Consequently these
|
||||
changes were made:
|
||||
|
||||
* The ``wx.FIXED_MINSIZE`` flag was added to allow for the old
|
||||
behaviour. When this flag is used the size a window has when
|
||||
behavior. When this flag is used the size a window has when
|
||||
added to the sizer will be treated as its minimal size and it
|
||||
will not be readjusted on each layout.
|
||||
|
||||
@@ -669,8 +669,6 @@ channel and will now only create a mask when all the pixels in the
|
||||
image are either fully transparent or fully opaque. In addition, the
|
||||
wx.DC.DrawBitmap and wx.DC.Blit methods are able to correctly blend
|
||||
the pixels in the image with partially transparent alpha values.
|
||||
(Currently only on MSW and Mac, if anybody knows how to do it for GTK
|
||||
then please submit a patch!)
|
||||
|
||||
If you are using a PNG with an alpha channel but you need to have a
|
||||
wx.Mask like you automatically got in 2.4 then you can do one of the
|
||||
@@ -786,6 +784,7 @@ The help module no longer exists and the classes therein are now part
|
||||
of the core module imported with wxPython.wx or the wx package.
|
||||
|
||||
|
||||
|
||||
wx.TaskBarIcon
|
||||
--------------
|
||||
|
||||
@@ -821,9 +820,76 @@ and the MainLoop will not exit.
|
||||
|
||||
|
||||
|
||||
Version Number Change
|
||||
---------------------
|
||||
|
||||
Other Stuff
|
||||
-----------
|
||||
**[Changed in 2.5.3.x]**
|
||||
|
||||
Starting with 2.5.3.0 the Unicode versions of wxPython will no longer
|
||||
have a 'u' appended to the fourth component of the version number.
|
||||
Please check for the presence of "unicode" in the `wx.PlatformInfo`
|
||||
tuple instead. (This tuple of strings has been available since the
|
||||
first 2.5 version.) For example::
|
||||
|
||||
if "unicode" in wx.PlatformInfo:
|
||||
# do whatever
|
||||
...
|
||||
|
||||
|
||||
|
||||
|
||||
Multi-Version Installs
|
||||
----------------------
|
||||
|
||||
**[Changed in 2.5.3.x]**
|
||||
|
||||
Starting with 2.5.3.0 the wx and wxPython package directories will be
|
||||
installed in a subdirectory of the site-packages directory, instead of
|
||||
directly in site-packages. This is done to help facilitate having
|
||||
multiple versions of wxPython installed side-by-side. Why would you
|
||||
want to do this? One possible scenario is you have an app that
|
||||
requires wxPython 2.4 but you want to use the newest 2.5 to do your
|
||||
own development with. Or perhaps you want to be able to test your app
|
||||
with several different versions of wxPython to ensure compatibility.
|
||||
Before everyone panics, rest asured that if you only install one
|
||||
version of wxPython then you should notice no difference in how things
|
||||
work.
|
||||
|
||||
In addition to installing wxPython into a "versioned" subdirectory of
|
||||
site-packages, a file named `wx.pth` is optionally installed that will
|
||||
contain the name of the versioned subdirectory. This will cause that
|
||||
subdirectory to be automatically added to the sys.path and so doing an
|
||||
"import wx" will find the package in the subdirectory like it would
|
||||
have if it was still located directly in site-packages. I say
|
||||
"optionally" above because that is how you can control which install
|
||||
of wxPython is the default one. Which ever version installs the
|
||||
wx.pth file will be the one that is imported with a plain "import wx"
|
||||
statement. Of course you can always manipulate that by editing the
|
||||
wx.pth file, or by setting PYTHONPATH in the environment, or by the
|
||||
method described in the next paragraph.
|
||||
|
||||
Finally, a new module named wxversion.py is installed to the
|
||||
site-packages directory. It can be used to manipulate the sys.path at
|
||||
runtime so your applications can select which version of wxPython they
|
||||
would like to to have imported. You use it like this::
|
||||
|
||||
import wxversion
|
||||
wxversion.select("2.4")
|
||||
import wx
|
||||
|
||||
Then even though a 2.5 version of wxPython may be the default the
|
||||
application that does the above the first time that wx is imported
|
||||
will actually get a 2.4 version. **NOTE:** There isn't actually a 2.4
|
||||
version of wxPython that supports this, but there will be.
|
||||
|
||||
Please see this wiki page for more details, HowTo's and FAQ's:
|
||||
http://wiki.wxpython.org/index.cgi/MultiVersionInstalls
|
||||
|
||||
|
||||
|
||||
|
||||
Miscellaneous Stuff
|
||||
-------------------
|
||||
|
||||
wxPyDefaultPosition and wxPyDefaultSize are gone. Use the
|
||||
wxDefaultPosition and wxDefaultSize objects instead.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
b 23 gtk2 t
|
||||
b 23 gtk2 BUILD_RENAMERS=0 PREP_ONLY=1 FULL_DOCS=1
|
||||
docs/bin/simplify.py
|
||||
##docs/bin/simplify.py
|
||||
docs/bin/makeapidocs
|
||||
b 23 gtk2 t
|
||||
b 23 gtk2 BUILD_RENAMERS=0 PREP_ONLY=1
|
||||
|
||||
@@ -169,8 +169,8 @@ wxPython, so there are lots of examples to look at and to play with.
|
||||
Here is one of them, it is the <tt class="literal"><span class="pre">simple</span></tt> sample.</p>
|
||||
<pre class="literal-block">
|
||||
#----------------------------------------------------------------------
|
||||
# A very simple wxPython example. Just a wxFrame, wxPanel,
|
||||
# wxStaticText, wxButton, and a wxBoxSizer, but it shows the basic
|
||||
# A very simple wxPython example. Just a wx.Frame, wx.Panel,
|
||||
# wx.StaticText, wx.Button, and a wx.BoxSizer, but it shows the basic
|
||||
# structure of any wxPython application.
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
@@ -244,11 +244,14 @@ class MyFrame(wx.Frame):
|
||||
class MyApp(wx.App):
|
||||
def OnInit(self):
|
||||
frame = MyFrame(None, "Simple wxPython App")
|
||||
frame.Show(True)
|
||||
self.SetTopWindow(frame)
|
||||
|
||||
print "Print statements go to this stdout window by default."
|
||||
|
||||
frame.Show(True)
|
||||
return True
|
||||
|
||||
app = MyApp(True)
|
||||
app = MyApp(redirect=True)
|
||||
app.MainLoop()
|
||||
|
||||
|
||||
|
||||
@@ -5724,7 +5724,7 @@ value as used by the parent. In addition, if the window overrides
|
||||
ShouldInheritColours to return false, the colours will not be changed
|
||||
no matter what and only the font might.
|
||||
|
||||
This rather complicated logic is necessary in order to accomodate the
|
||||
This rather complicated logic is necessary in order to accommodate the
|
||||
different usage scenarius. The most common one is when all default
|
||||
attributes are used and in this case, nothing should be inherited as
|
||||
in modern GUIs different controls use different fonts (and colours)
|
||||
|
||||
@@ -65,6 +65,20 @@ RELEASE_NUMBER = RELEASE_VERSION # for compatibility
|
||||
CLEANUP.append('wx/__version__.py')
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# patch distutils if it can't cope with the "classifiers" or
|
||||
# "download_url" keywords
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
if sys.version < '2.2.3':
|
||||
from distutils.dist import DistributionMetadata
|
||||
DistributionMetadata.classifiers = None
|
||||
DistributionMetadata.download_url = None
|
||||
depends = {}
|
||||
else:
|
||||
depends = {'depends' : depends}
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Define the CORE extension module
|
||||
#----------------------------------------------------------------------
|
||||
@@ -135,7 +149,7 @@ ext = Extension('_core_', ['src/helpers.cpp',
|
||||
extra_compile_args = cflags,
|
||||
extra_link_args = lflags,
|
||||
|
||||
depends = depends
|
||||
**depends
|
||||
)
|
||||
wxpExtensions.append(ext)
|
||||
|
||||
@@ -172,7 +186,7 @@ ext = Extension('_gdi_', ['src/drawlist.cpp'] + swig_sources,
|
||||
libraries = libs,
|
||||
extra_compile_args = cflags,
|
||||
extra_link_args = lflags,
|
||||
depends = depends
|
||||
**depends
|
||||
)
|
||||
wxpExtensions.append(ext)
|
||||
|
||||
@@ -208,7 +222,7 @@ ext = Extension('_windows_', swig_sources,
|
||||
libraries = libs,
|
||||
extra_compile_args = cflags,
|
||||
extra_link_args = lflags,
|
||||
depends = depends
|
||||
**depends
|
||||
)
|
||||
wxpExtensions.append(ext)
|
||||
|
||||
@@ -250,7 +264,7 @@ ext = Extension('_controls_', swig_sources,
|
||||
libraries = libs,
|
||||
extra_compile_args = cflags,
|
||||
extra_link_args = lflags,
|
||||
depends = depends
|
||||
**depends
|
||||
)
|
||||
wxpExtensions.append(ext)
|
||||
|
||||
@@ -288,7 +302,7 @@ ext = Extension('_misc_', swig_sources,
|
||||
libraries = libs,
|
||||
extra_compile_args = cflags,
|
||||
extra_link_args = lflags,
|
||||
depends = depends
|
||||
**depends
|
||||
)
|
||||
wxpExtensions.append(ext)
|
||||
|
||||
@@ -307,7 +321,7 @@ ext = Extension('_calendar', swig_sources,
|
||||
libraries = libs,
|
||||
extra_compile_args = cflags,
|
||||
extra_link_args = lflags,
|
||||
depends = depends
|
||||
**depends
|
||||
)
|
||||
wxpExtensions.append(ext)
|
||||
|
||||
@@ -321,7 +335,7 @@ ext = Extension('_grid', swig_sources,
|
||||
libraries = libs,
|
||||
extra_compile_args = cflags,
|
||||
extra_link_args = lflags,
|
||||
depends = depends
|
||||
**depends
|
||||
)
|
||||
wxpExtensions.append(ext)
|
||||
|
||||
@@ -336,7 +350,22 @@ ext = Extension('_html', swig_sources,
|
||||
libraries = libs,
|
||||
extra_compile_args = cflags,
|
||||
extra_link_args = lflags,
|
||||
depends = depends
|
||||
**depends
|
||||
)
|
||||
wxpExtensions.append(ext)
|
||||
|
||||
|
||||
|
||||
swig_sources = run_swig(['webkit.i'], 'src', GENDIR, PKGDIR,
|
||||
USE_SWIG, swig_force, swig_args, swig_deps)
|
||||
ext = Extension('_webkit', swig_sources,
|
||||
include_dirs = includes,
|
||||
define_macros = defines,
|
||||
library_dirs = libdirs,
|
||||
libraries = libs,
|
||||
extra_compile_args = cflags,
|
||||
extra_link_args = lflags,
|
||||
**depends
|
||||
)
|
||||
wxpExtensions.append(ext)
|
||||
|
||||
@@ -351,7 +380,7 @@ ext = Extension('_wizard', swig_sources,
|
||||
libraries = libs,
|
||||
extra_compile_args = cflags,
|
||||
extra_link_args = lflags,
|
||||
depends = depends
|
||||
**depends
|
||||
)
|
||||
wxpExtensions.append(ext)
|
||||
|
||||
@@ -627,16 +656,6 @@ if BUILD_DLLWIDGET:
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# patch distutils if it can't cope with the "classifiers" or
|
||||
# "download_url" keywords
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
if sys.version < '2.2.3':
|
||||
from distutils.dist import DistributionMetadata
|
||||
DistributionMetadata.classifiers = None
|
||||
DistributionMetadata.download_url = None
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Tools, scripts data files, etc.
|
||||
|
||||
@@ -124,7 +124,7 @@ optionally, client data associated with them.
|
||||
class wxItemContainer
|
||||
{
|
||||
public:
|
||||
// wxItemContainer() { m_clientDataItemsType = wxClientData_None; } ** It's an ABC
|
||||
// wxItemContainer() ** It's an ABC
|
||||
|
||||
|
||||
%extend {
|
||||
|
||||
@@ -866,7 +866,7 @@ the item.", "");
|
||||
"""
|
||||
A convenience method for Show(item, False, recursive).
|
||||
"""
|
||||
return self.Show(item, false, recursive)
|
||||
return self.Show(item, False, recursive)
|
||||
}
|
||||
|
||||
|
||||
|
||||
15
wxPython/src/_webkit_rename.i
Normal file
15
wxPython/src/_webkit_rename.i
Normal file
@@ -0,0 +1,15 @@
|
||||
// A bunch of %rename directives generated by BuildRenamers in config.py
|
||||
// in order to remove the wx prefix from all global scope names.
|
||||
|
||||
#ifndef BUILDING_RENAMERS
|
||||
|
||||
%rename(WebKitCtrl) wxWebKitCtrl;
|
||||
%rename(WEBKIT_STATE_START) wxWEBKIT_STATE_START;
|
||||
%rename(WEBKIT_STATE_NEGOTIATING) wxWEBKIT_STATE_NEGOTIATING;
|
||||
%rename(WEBKIT_STATE_REDIRECTING) wxWEBKIT_STATE_REDIRECTING;
|
||||
%rename(WEBKIT_STATE_TRANSFERRING) wxWEBKIT_STATE_TRANSFERRING;
|
||||
%rename(WEBKIT_STATE_STOP) wxWEBKIT_STATE_STOP;
|
||||
%rename(WEBKIT_STATE_FAILED) wxWEBKIT_STATE_FAILED;
|
||||
%rename(WebKitStateChangedEvent) wxWebKitStateChangedEvent;
|
||||
|
||||
#endif
|
||||
4
wxPython/src/_webkit_reverse.txt
Normal file
4
wxPython/src/_webkit_reverse.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
# Other names that need to be reverse-renamed for the old namespace
|
||||
|
||||
|
||||
EVT*
|
||||
@@ -1883,8 +1883,8 @@ value as used by the parent. In addition, if the window overrides
|
||||
ShouldInheritColours to return false, the colours will not be changed
|
||||
no matter what and only the font might.
|
||||
|
||||
This rather complicated logic is necessary in order to accomodate the
|
||||
different usage scenarius. The most common one is when all default
|
||||
This rather complicated logic is necessary in order to accommodate the
|
||||
different usage scenarios. The most common one is when all default
|
||||
attributes are used and in this case, nothing should be inherited as
|
||||
in modern GUIs different controls use different fonts (and colours)
|
||||
than their siblings so they can't inherit the same value from the
|
||||
|
||||
@@ -7678,8 +7678,8 @@ class Window(EvtHandler):
|
||||
ShouldInheritColours to return false, the colours will not be changed
|
||||
no matter what and only the font might.
|
||||
|
||||
This rather complicated logic is necessary in order to accomodate the
|
||||
different usage scenarius. The most common one is when all default
|
||||
This rather complicated logic is necessary in order to accommodate the
|
||||
different usage scenarios. The most common one is when all default
|
||||
attributes are used and in this case, nothing should be inherited as
|
||||
in modern GUIs different controls use different fonts (and colours)
|
||||
than their siblings so they can't inherit the same value from the
|
||||
@@ -9444,7 +9444,7 @@ class Sizer(Object):
|
||||
"""
|
||||
A convenience method for Show(item, False, recursive).
|
||||
"""
|
||||
return self.Show(item, false, recursive)
|
||||
return self.Show(item, False, recursive)
|
||||
|
||||
def ShowItems(*args, **kwargs):
|
||||
"""
|
||||
|
||||
136
wxPython/src/gtk/webkit.py
Normal file
136
wxPython/src/gtk/webkit.py
Normal file
@@ -0,0 +1,136 @@
|
||||
# This file was created automatically by SWIG.
|
||||
# Don't modify this file, modify the SWIG interface instead.
|
||||
|
||||
"""
|
||||
wx.webkit.WebKitCtrl for Mac OSX.
|
||||
"""
|
||||
|
||||
import _webkit
|
||||
|
||||
import _core
|
||||
wx = _core
|
||||
__docfilter__ = wx.__DocFilter(globals())
|
||||
class WebKitCtrl(_core.Control):
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxWebKitCtrl instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
__init__(self, Window parent, int winID=-1, String strURL=EmptyString,
|
||||
Point pos=DefaultPosition, Size size=DefaultSize,
|
||||
long style=0, Validator validator=DefaultValidator,
|
||||
String name=WebKitNameStr) -> WebKitCtrl
|
||||
"""
|
||||
newobj = _webkit.new_WebKitCtrl(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
del newobj.thisown
|
||||
self._setOORInfo(self)
|
||||
|
||||
def Create(*args, **kwargs):
|
||||
"""
|
||||
Create(self, Window parent, int winID=-1, String strURL=EmptyString,
|
||||
Point pos=DefaultPosition, Size size=DefaultSize,
|
||||
long style=0, Validator validator=DefaultValidator,
|
||||
String name=WebKitNameStr) -> bool
|
||||
"""
|
||||
return _webkit.WebKitCtrl_Create(*args, **kwargs)
|
||||
|
||||
def LoadURL(*args, **kwargs):
|
||||
"""LoadURL(self, String url)"""
|
||||
return _webkit.WebKitCtrl_LoadURL(*args, **kwargs)
|
||||
|
||||
def CanGoBack(*args, **kwargs):
|
||||
"""CanGoBack(self) -> bool"""
|
||||
return _webkit.WebKitCtrl_CanGoBack(*args, **kwargs)
|
||||
|
||||
def CanGoForward(*args, **kwargs):
|
||||
"""CanGoForward(self) -> bool"""
|
||||
return _webkit.WebKitCtrl_CanGoForward(*args, **kwargs)
|
||||
|
||||
def GoBack(*args, **kwargs):
|
||||
"""GoBack(self) -> bool"""
|
||||
return _webkit.WebKitCtrl_GoBack(*args, **kwargs)
|
||||
|
||||
def GoForward(*args, **kwargs):
|
||||
"""GoForward(self) -> bool"""
|
||||
return _webkit.WebKitCtrl_GoForward(*args, **kwargs)
|
||||
|
||||
def Reload(*args, **kwargs):
|
||||
"""Reload(self)"""
|
||||
return _webkit.WebKitCtrl_Reload(*args, **kwargs)
|
||||
|
||||
def Stop(*args, **kwargs):
|
||||
"""Stop(self)"""
|
||||
return _webkit.WebKitCtrl_Stop(*args, **kwargs)
|
||||
|
||||
def CanGetPageSource(*args, **kwargs):
|
||||
"""CanGetPageSource(self) -> bool"""
|
||||
return _webkit.WebKitCtrl_CanGetPageSource(*args, **kwargs)
|
||||
|
||||
def GetPageSource(*args, **kwargs):
|
||||
"""GetPageSource(self) -> String"""
|
||||
return _webkit.WebKitCtrl_GetPageSource(*args, **kwargs)
|
||||
|
||||
def SetPageSource(*args, **kwargs):
|
||||
"""SetPageSource(self, String source, String baseUrl=EmptyString)"""
|
||||
return _webkit.WebKitCtrl_SetPageSource(*args, **kwargs)
|
||||
|
||||
|
||||
class WebKitCtrlPtr(WebKitCtrl):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = WebKitCtrl
|
||||
_webkit.WebKitCtrl_swigregister(WebKitCtrlPtr)
|
||||
cvar = _webkit.cvar
|
||||
WebKitNameStr = cvar.WebKitNameStr
|
||||
|
||||
def PreWebKitCtrl(*args, **kwargs):
|
||||
"""PreWebKitCtrl() -> WebKitCtrl"""
|
||||
val = _webkit.new_PreWebKitCtrl(*args, **kwargs)
|
||||
val.thisown = 1
|
||||
return val
|
||||
|
||||
WEBKIT_STATE_START = _webkit.WEBKIT_STATE_START
|
||||
WEBKIT_STATE_NEGOTIATING = _webkit.WEBKIT_STATE_NEGOTIATING
|
||||
WEBKIT_STATE_REDIRECTING = _webkit.WEBKIT_STATE_REDIRECTING
|
||||
WEBKIT_STATE_TRANSFERRING = _webkit.WEBKIT_STATE_TRANSFERRING
|
||||
WEBKIT_STATE_STOP = _webkit.WEBKIT_STATE_STOP
|
||||
WEBKIT_STATE_FAILED = _webkit.WEBKIT_STATE_FAILED
|
||||
wxEVT_WEBKIT_STATE_CHANGED = _webkit.wxEVT_WEBKIT_STATE_CHANGED
|
||||
class WebKitStateChangedEvent(_core.CommandEvent):
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxWebKitStateChangedEvent instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""__init__(self, Window win=None) -> WebKitStateChangedEvent"""
|
||||
newobj = _webkit.new_WebKitStateChangedEvent(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
del newobj.thisown
|
||||
def GetState(*args, **kwargs):
|
||||
"""GetState(self) -> int"""
|
||||
return _webkit.WebKitStateChangedEvent_GetState(*args, **kwargs)
|
||||
|
||||
def SetState(*args, **kwargs):
|
||||
"""SetState(self, int state)"""
|
||||
return _webkit.WebKitStateChangedEvent_SetState(*args, **kwargs)
|
||||
|
||||
def GetURL(*args, **kwargs):
|
||||
"""GetURL(self) -> String"""
|
||||
return _webkit.WebKitStateChangedEvent_GetURL(*args, **kwargs)
|
||||
|
||||
def SetURL(*args, **kwargs):
|
||||
"""SetURL(self, String url)"""
|
||||
return _webkit.WebKitStateChangedEvent_SetURL(*args, **kwargs)
|
||||
|
||||
|
||||
class WebKitStateChangedEventPtr(WebKitStateChangedEvent):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = WebKitStateChangedEvent
|
||||
_webkit.WebKitStateChangedEvent_swigregister(WebKitStateChangedEventPtr)
|
||||
|
||||
EVT_WEBKIT_STATE_CHANGED = wx.PyEventBinder(wxEVT_WEBKIT_STATE_CHANGED)
|
||||
|
||||
|
||||
1759
wxPython/src/gtk/webkit_wrap.cpp
Normal file
1759
wxPython/src/gtk/webkit_wrap.cpp
Normal file
File diff suppressed because one or more lines are too long
@@ -424,7 +424,7 @@ void wxPyApp::_BootstrapApp()
|
||||
// On wxGTK the locale will be changed to match the system settings, but
|
||||
// Python needs to have LC_NUMERIC set to "C" in order for the floating
|
||||
// point conversions and such to work right.
|
||||
#ifdef __WXGTK__
|
||||
#if defined(__WXGTK__) && PYTHON_API_VERSION <= 1012
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
#endif
|
||||
|
||||
@@ -635,7 +635,7 @@ PyObject* __wxPySetDictionary(PyObject* /* self */, PyObject* args)
|
||||
PyDict_SetItemString(wxPython_dict, "USE_UNICODE", PyInt_FromLong(wxUSE_UNICODE));
|
||||
PyDict_SetItemString(wxPython_dict, "__WXDEBUG__", PyInt_FromLong(wxdebug));
|
||||
|
||||
|
||||
// Make a tuple of strings that gives more info about the platform.
|
||||
PyObject* PlatInfo = PyList_New(0);
|
||||
PyObject* obj;
|
||||
|
||||
@@ -649,7 +649,7 @@ PyObject* __wxPySetDictionary(PyObject* /* self */, PyObject* args)
|
||||
#if wxUSE_UNICODE
|
||||
_AddInfoString("unicode");
|
||||
#else
|
||||
_AddInfoString("ascii");
|
||||
_AddInfoString("ansi");
|
||||
#endif
|
||||
#ifdef __WXGTK__
|
||||
#ifdef __WXGTK20__
|
||||
@@ -1088,11 +1088,12 @@ void wxPySaveThreadState(PyThreadState* tstate) {
|
||||
if (info.tstate != tstate)
|
||||
wxLogMessage("*** tstate mismatch!???");
|
||||
#endif
|
||||
// info.tstate = tstate; *** DO NOT update existing ones???
|
||||
info.tstate = tstate; // allow for transient tstates
|
||||
// Normally it will never change, but apparently COM callbacks
|
||||
// (i.e. ActiveX controls) will (incorrectly IMHO) use a transient
|
||||
// tstate which will then be garbage the next time we try to use
|
||||
// it...
|
||||
|
||||
wxPyTMutex->Unlock();
|
||||
return;
|
||||
}
|
||||
@@ -1910,12 +1911,18 @@ wxString* wxString_in_helper(PyObject* source) {
|
||||
if (PyString_Check(source))
|
||||
Py_DECREF(uni);
|
||||
#else
|
||||
char* tmpPtr; int tmpSize;
|
||||
if (PyString_AsStringAndSize(source, &tmpPtr, &tmpSize) == -1) {
|
||||
PyErr_SetString(PyExc_TypeError, "Unable to convert string");
|
||||
return NULL;
|
||||
// Convert to a string object if it isn't already, then to wxString
|
||||
PyObject* str = source;
|
||||
if (!PyString_Check(source)) {
|
||||
str = PyObject_Str(source);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
}
|
||||
char* tmpPtr; int tmpSize;
|
||||
PyString_AsStringAndSize(str, &tmpPtr, &tmpSize);
|
||||
target = new wxString(tmpPtr, tmpSize);
|
||||
|
||||
if (!PyString_Check(source))
|
||||
Py_DECREF(str);
|
||||
#endif // wxUSE_UNICODE
|
||||
|
||||
return target;
|
||||
|
||||
@@ -7678,8 +7678,8 @@ class Window(EvtHandler):
|
||||
ShouldInheritColours to return false, the colours will not be changed
|
||||
no matter what and only the font might.
|
||||
|
||||
This rather complicated logic is necessary in order to accomodate the
|
||||
different usage scenarius. The most common one is when all default
|
||||
This rather complicated logic is necessary in order to accommodate the
|
||||
different usage scenarios. The most common one is when all default
|
||||
attributes are used and in this case, nothing should be inherited as
|
||||
in modern GUIs different controls use different fonts (and colours)
|
||||
than their siblings so they can't inherit the same value from the
|
||||
@@ -9444,7 +9444,7 @@ class Sizer(Object):
|
||||
"""
|
||||
A convenience method for Show(item, False, recursive).
|
||||
"""
|
||||
return self.Show(item, false, recursive)
|
||||
return self.Show(item, False, recursive)
|
||||
|
||||
def ShowItems(*args, **kwargs):
|
||||
"""
|
||||
|
||||
136
wxPython/src/mac/webkit.py
Normal file
136
wxPython/src/mac/webkit.py
Normal file
@@ -0,0 +1,136 @@
|
||||
# This file was created automatically by SWIG.
|
||||
# Don't modify this file, modify the SWIG interface instead.
|
||||
|
||||
"""
|
||||
wx.webkit.WebKitCtrl for Mac OSX.
|
||||
"""
|
||||
|
||||
import _webkit
|
||||
|
||||
import _core
|
||||
wx = _core
|
||||
__docfilter__ = wx.__DocFilter(globals())
|
||||
class WebKitCtrl(_core.Control):
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxWebKitCtrl instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
__init__(self, Window parent, int winID=-1, String strURL=EmptyString,
|
||||
Point pos=DefaultPosition, Size size=DefaultSize,
|
||||
long style=0, Validator validator=DefaultValidator,
|
||||
String name=WebKitNameStr) -> WebKitCtrl
|
||||
"""
|
||||
newobj = _webkit.new_WebKitCtrl(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
del newobj.thisown
|
||||
self._setOORInfo(self)
|
||||
|
||||
def Create(*args, **kwargs):
|
||||
"""
|
||||
Create(self, Window parent, int winID=-1, String strURL=EmptyString,
|
||||
Point pos=DefaultPosition, Size size=DefaultSize,
|
||||
long style=0, Validator validator=DefaultValidator,
|
||||
String name=WebKitNameStr) -> bool
|
||||
"""
|
||||
return _webkit.WebKitCtrl_Create(*args, **kwargs)
|
||||
|
||||
def LoadURL(*args, **kwargs):
|
||||
"""LoadURL(self, String url)"""
|
||||
return _webkit.WebKitCtrl_LoadURL(*args, **kwargs)
|
||||
|
||||
def CanGoBack(*args, **kwargs):
|
||||
"""CanGoBack(self) -> bool"""
|
||||
return _webkit.WebKitCtrl_CanGoBack(*args, **kwargs)
|
||||
|
||||
def CanGoForward(*args, **kwargs):
|
||||
"""CanGoForward(self) -> bool"""
|
||||
return _webkit.WebKitCtrl_CanGoForward(*args, **kwargs)
|
||||
|
||||
def GoBack(*args, **kwargs):
|
||||
"""GoBack(self) -> bool"""
|
||||
return _webkit.WebKitCtrl_GoBack(*args, **kwargs)
|
||||
|
||||
def GoForward(*args, **kwargs):
|
||||
"""GoForward(self) -> bool"""
|
||||
return _webkit.WebKitCtrl_GoForward(*args, **kwargs)
|
||||
|
||||
def Reload(*args, **kwargs):
|
||||
"""Reload(self)"""
|
||||
return _webkit.WebKitCtrl_Reload(*args, **kwargs)
|
||||
|
||||
def Stop(*args, **kwargs):
|
||||
"""Stop(self)"""
|
||||
return _webkit.WebKitCtrl_Stop(*args, **kwargs)
|
||||
|
||||
def CanGetPageSource(*args, **kwargs):
|
||||
"""CanGetPageSource(self) -> bool"""
|
||||
return _webkit.WebKitCtrl_CanGetPageSource(*args, **kwargs)
|
||||
|
||||
def GetPageSource(*args, **kwargs):
|
||||
"""GetPageSource(self) -> String"""
|
||||
return _webkit.WebKitCtrl_GetPageSource(*args, **kwargs)
|
||||
|
||||
def SetPageSource(*args, **kwargs):
|
||||
"""SetPageSource(self, String source, String baseUrl=EmptyString)"""
|
||||
return _webkit.WebKitCtrl_SetPageSource(*args, **kwargs)
|
||||
|
||||
|
||||
class WebKitCtrlPtr(WebKitCtrl):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = WebKitCtrl
|
||||
_webkit.WebKitCtrl_swigregister(WebKitCtrlPtr)
|
||||
cvar = _webkit.cvar
|
||||
WebKitNameStr = cvar.WebKitNameStr
|
||||
|
||||
def PreWebKitCtrl(*args, **kwargs):
|
||||
"""PreWebKitCtrl() -> WebKitCtrl"""
|
||||
val = _webkit.new_PreWebKitCtrl(*args, **kwargs)
|
||||
val.thisown = 1
|
||||
return val
|
||||
|
||||
WEBKIT_STATE_START = _webkit.WEBKIT_STATE_START
|
||||
WEBKIT_STATE_NEGOTIATING = _webkit.WEBKIT_STATE_NEGOTIATING
|
||||
WEBKIT_STATE_REDIRECTING = _webkit.WEBKIT_STATE_REDIRECTING
|
||||
WEBKIT_STATE_TRANSFERRING = _webkit.WEBKIT_STATE_TRANSFERRING
|
||||
WEBKIT_STATE_STOP = _webkit.WEBKIT_STATE_STOP
|
||||
WEBKIT_STATE_FAILED = _webkit.WEBKIT_STATE_FAILED
|
||||
wxEVT_WEBKIT_STATE_CHANGED = _webkit.wxEVT_WEBKIT_STATE_CHANGED
|
||||
class WebKitStateChangedEvent(_core.CommandEvent):
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxWebKitStateChangedEvent instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""__init__(self, Window win=None) -> WebKitStateChangedEvent"""
|
||||
newobj = _webkit.new_WebKitStateChangedEvent(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
del newobj.thisown
|
||||
def GetState(*args, **kwargs):
|
||||
"""GetState(self) -> int"""
|
||||
return _webkit.WebKitStateChangedEvent_GetState(*args, **kwargs)
|
||||
|
||||
def SetState(*args, **kwargs):
|
||||
"""SetState(self, int state)"""
|
||||
return _webkit.WebKitStateChangedEvent_SetState(*args, **kwargs)
|
||||
|
||||
def GetURL(*args, **kwargs):
|
||||
"""GetURL(self) -> String"""
|
||||
return _webkit.WebKitStateChangedEvent_GetURL(*args, **kwargs)
|
||||
|
||||
def SetURL(*args, **kwargs):
|
||||
"""SetURL(self, String url)"""
|
||||
return _webkit.WebKitStateChangedEvent_SetURL(*args, **kwargs)
|
||||
|
||||
|
||||
class WebKitStateChangedEventPtr(WebKitStateChangedEvent):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = WebKitStateChangedEvent
|
||||
_webkit.WebKitStateChangedEvent_swigregister(WebKitStateChangedEventPtr)
|
||||
|
||||
EVT_WEBKIT_STATE_CHANGED = wx.PyEventBinder(wxEVT_WEBKIT_STATE_CHANGED)
|
||||
|
||||
|
||||
1759
wxPython/src/mac/webkit_wrap.cpp
Normal file
1759
wxPython/src/mac/webkit_wrap.cpp
Normal file
File diff suppressed because one or more lines are too long
@@ -7691,8 +7691,8 @@ class Window(EvtHandler):
|
||||
ShouldInheritColours to return false, the colours will not be changed
|
||||
no matter what and only the font might.
|
||||
|
||||
This rather complicated logic is necessary in order to accomodate the
|
||||
different usage scenarius. The most common one is when all default
|
||||
This rather complicated logic is necessary in order to accommodate the
|
||||
different usage scenarios. The most common one is when all default
|
||||
attributes are used and in this case, nothing should be inherited as
|
||||
in modern GUIs different controls use different fonts (and colours)
|
||||
than their siblings so they can't inherit the same value from the
|
||||
@@ -9513,7 +9513,7 @@ class Sizer(Object):
|
||||
"""
|
||||
A convenience method for Show(item, False, recursive).
|
||||
"""
|
||||
return self.Show(item, false, recursive)
|
||||
return self.Show(item, False, recursive)
|
||||
|
||||
def ShowItems(*args, **kwargs):
|
||||
"""
|
||||
|
||||
136
wxPython/src/msw/webkit.py
Normal file
136
wxPython/src/msw/webkit.py
Normal file
@@ -0,0 +1,136 @@
|
||||
# This file was created automatically by SWIG.
|
||||
# Don't modify this file, modify the SWIG interface instead.
|
||||
|
||||
"""
|
||||
wx.webkit.WebKitCtrl for Mac OSX.
|
||||
"""
|
||||
|
||||
import _webkit
|
||||
|
||||
import _core
|
||||
wx = _core
|
||||
__docfilter__ = wx.__DocFilter(globals())
|
||||
class WebKitCtrl(_core.Control):
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxWebKitCtrl instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
__init__(self, Window parent, int winID=-1, String strURL=EmptyString,
|
||||
Point pos=DefaultPosition, Size size=DefaultSize,
|
||||
long style=0, Validator validator=DefaultValidator,
|
||||
String name=WebKitNameStr) -> WebKitCtrl
|
||||
"""
|
||||
newobj = _webkit.new_WebKitCtrl(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
del newobj.thisown
|
||||
self._setOORInfo(self)
|
||||
|
||||
def Create(*args, **kwargs):
|
||||
"""
|
||||
Create(self, Window parent, int winID=-1, String strURL=EmptyString,
|
||||
Point pos=DefaultPosition, Size size=DefaultSize,
|
||||
long style=0, Validator validator=DefaultValidator,
|
||||
String name=WebKitNameStr) -> bool
|
||||
"""
|
||||
return _webkit.WebKitCtrl_Create(*args, **kwargs)
|
||||
|
||||
def LoadURL(*args, **kwargs):
|
||||
"""LoadURL(self, String url)"""
|
||||
return _webkit.WebKitCtrl_LoadURL(*args, **kwargs)
|
||||
|
||||
def CanGoBack(*args, **kwargs):
|
||||
"""CanGoBack(self) -> bool"""
|
||||
return _webkit.WebKitCtrl_CanGoBack(*args, **kwargs)
|
||||
|
||||
def CanGoForward(*args, **kwargs):
|
||||
"""CanGoForward(self) -> bool"""
|
||||
return _webkit.WebKitCtrl_CanGoForward(*args, **kwargs)
|
||||
|
||||
def GoBack(*args, **kwargs):
|
||||
"""GoBack(self) -> bool"""
|
||||
return _webkit.WebKitCtrl_GoBack(*args, **kwargs)
|
||||
|
||||
def GoForward(*args, **kwargs):
|
||||
"""GoForward(self) -> bool"""
|
||||
return _webkit.WebKitCtrl_GoForward(*args, **kwargs)
|
||||
|
||||
def Reload(*args, **kwargs):
|
||||
"""Reload(self)"""
|
||||
return _webkit.WebKitCtrl_Reload(*args, **kwargs)
|
||||
|
||||
def Stop(*args, **kwargs):
|
||||
"""Stop(self)"""
|
||||
return _webkit.WebKitCtrl_Stop(*args, **kwargs)
|
||||
|
||||
def CanGetPageSource(*args, **kwargs):
|
||||
"""CanGetPageSource(self) -> bool"""
|
||||
return _webkit.WebKitCtrl_CanGetPageSource(*args, **kwargs)
|
||||
|
||||
def GetPageSource(*args, **kwargs):
|
||||
"""GetPageSource(self) -> String"""
|
||||
return _webkit.WebKitCtrl_GetPageSource(*args, **kwargs)
|
||||
|
||||
def SetPageSource(*args, **kwargs):
|
||||
"""SetPageSource(self, String source, String baseUrl=EmptyString)"""
|
||||
return _webkit.WebKitCtrl_SetPageSource(*args, **kwargs)
|
||||
|
||||
|
||||
class WebKitCtrlPtr(WebKitCtrl):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = WebKitCtrl
|
||||
_webkit.WebKitCtrl_swigregister(WebKitCtrlPtr)
|
||||
cvar = _webkit.cvar
|
||||
WebKitNameStr = cvar.WebKitNameStr
|
||||
|
||||
def PreWebKitCtrl(*args, **kwargs):
|
||||
"""PreWebKitCtrl() -> WebKitCtrl"""
|
||||
val = _webkit.new_PreWebKitCtrl(*args, **kwargs)
|
||||
val.thisown = 1
|
||||
return val
|
||||
|
||||
WEBKIT_STATE_START = _webkit.WEBKIT_STATE_START
|
||||
WEBKIT_STATE_NEGOTIATING = _webkit.WEBKIT_STATE_NEGOTIATING
|
||||
WEBKIT_STATE_REDIRECTING = _webkit.WEBKIT_STATE_REDIRECTING
|
||||
WEBKIT_STATE_TRANSFERRING = _webkit.WEBKIT_STATE_TRANSFERRING
|
||||
WEBKIT_STATE_STOP = _webkit.WEBKIT_STATE_STOP
|
||||
WEBKIT_STATE_FAILED = _webkit.WEBKIT_STATE_FAILED
|
||||
wxEVT_WEBKIT_STATE_CHANGED = _webkit.wxEVT_WEBKIT_STATE_CHANGED
|
||||
class WebKitStateChangedEvent(_core.CommandEvent):
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxWebKitStateChangedEvent instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""__init__(self, Window win=None) -> WebKitStateChangedEvent"""
|
||||
newobj = _webkit.new_WebKitStateChangedEvent(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
del newobj.thisown
|
||||
def GetState(*args, **kwargs):
|
||||
"""GetState(self) -> int"""
|
||||
return _webkit.WebKitStateChangedEvent_GetState(*args, **kwargs)
|
||||
|
||||
def SetState(*args, **kwargs):
|
||||
"""SetState(self, int state)"""
|
||||
return _webkit.WebKitStateChangedEvent_SetState(*args, **kwargs)
|
||||
|
||||
def GetURL(*args, **kwargs):
|
||||
"""GetURL(self) -> String"""
|
||||
return _webkit.WebKitStateChangedEvent_GetURL(*args, **kwargs)
|
||||
|
||||
def SetURL(*args, **kwargs):
|
||||
"""SetURL(self, String url)"""
|
||||
return _webkit.WebKitStateChangedEvent_SetURL(*args, **kwargs)
|
||||
|
||||
|
||||
class WebKitStateChangedEventPtr(WebKitStateChangedEvent):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = WebKitStateChangedEvent
|
||||
_webkit.WebKitStateChangedEvent_swigregister(WebKitStateChangedEventPtr)
|
||||
|
||||
EVT_WEBKIT_STATE_CHANGED = wx.PyEventBinder(wxEVT_WEBKIT_STATE_CHANGED)
|
||||
|
||||
|
||||
1759
wxPython/src/msw/webkit_wrap.cpp
Normal file
1759
wxPython/src/msw/webkit_wrap.cpp
Normal file
File diff suppressed because one or more lines are too long
201
wxPython/src/webkit.i
Normal file
201
wxPython/src/webkit.i
Normal file
@@ -0,0 +1,201 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: webkit.i
|
||||
// Purpose: Embedding Apple's WebKit in wxWidgets
|
||||
//
|
||||
// Author: Robin Dunn / Kevin Ollivier
|
||||
//
|
||||
// Created: 18-Oct-2004
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2004 by Total Control Software
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
%define DOCSTRING
|
||||
"wx.webkit.WebKitCtrl for Mac OSX."
|
||||
%enddef
|
||||
|
||||
%module(package="wx", docstring=DOCSTRING) webkit
|
||||
|
||||
%{
|
||||
|
||||
#include "wx/wxPython/wxPython.h"
|
||||
#include "wx/wxPython/pyclasses.h"
|
||||
#include "wx/wxPython/pyistream.h"
|
||||
|
||||
#ifdef __WXMAC__ // avoid a bug in Carbon headers
|
||||
#define scalb scalbn
|
||||
#endif
|
||||
|
||||
#if wxUSE_WEBKIT
|
||||
#include "wx/html/webkit.h"
|
||||
#endif
|
||||
%}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
%import core.i
|
||||
%pythoncode { wx = _core }
|
||||
%pythoncode { __docfilter__ = wx.__DocFilter(globals()) }
|
||||
|
||||
|
||||
%include _webkit_rename.i
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Put some wx default wxChar* values into wxStrings.
|
||||
MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
|
||||
MAKE_CONST_WXSTRING2(WebKitNameStr, wxT("webkitctrl"))
|
||||
|
||||
|
||||
|
||||
|
||||
%{
|
||||
#if !wxUSE_WEBKIT
|
||||
// a dummy class for ports that don't have wxWebKitCtrl
|
||||
class wxWebKitCtrl : public wxControl
|
||||
{
|
||||
public:
|
||||
wxWebKitCtrl(wxWindow *parent,
|
||||
wxWindowID winID,
|
||||
const wxString& strURL,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxPyWebKitNameStr)
|
||||
{ wxPyRaiseNotImplemented(); }
|
||||
|
||||
wxWebKitCtrl() { wxPyRaiseNotImplemented(); }
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID winID,
|
||||
const wxString& strURL,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxPyWebKitNameStr)
|
||||
{ return false; }
|
||||
|
||||
void LoadURL(const wxString &url) {}
|
||||
|
||||
bool CanGoBack() { return false; }
|
||||
bool CanGoForward() { return false; }
|
||||
bool GoBack() { return false; }
|
||||
bool GoForward() { return false; }
|
||||
void Reload() {}
|
||||
void Stop() {}
|
||||
bool CanGetPageSource() { return false; }
|
||||
wxString GetPageSource() { return wxEmptyString; }
|
||||
void SetPageSource(wxString& source, const wxString& baseUrl = wxEmptyString) {}
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
wxWEBKIT_STATE_START = 0,
|
||||
wxWEBKIT_STATE_NEGOTIATING = 0,
|
||||
wxWEBKIT_STATE_REDIRECTING = 0,
|
||||
wxWEBKIT_STATE_TRANSFERRING = 0,
|
||||
wxWEBKIT_STATE_STOP = 0,
|
||||
wxWEBKIT_STATE_FAILED = 0,
|
||||
|
||||
wxEVT_WEBKIT_STATE_CHANGED = 0
|
||||
};
|
||||
|
||||
class wxWebKitStateChangedEvent : public wxCommandEvent
|
||||
{
|
||||
public:
|
||||
wxWebKitStateChangedEvent( wxWindow* win = NULL )
|
||||
{ wxPyRaiseNotImplemented(); }
|
||||
|
||||
int GetState() { return 0; }
|
||||
void SetState(const int state) {}
|
||||
wxString GetURL() { return wxEmptyString; }
|
||||
void SetURL(const wxString& url) {}
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
%}
|
||||
|
||||
// Now define it for SWIG, usign either the real class or the dummy above.
|
||||
|
||||
MustHaveApp(wxWebKitCtrl);
|
||||
|
||||
class wxWebKitCtrl : public wxControl
|
||||
{
|
||||
public:
|
||||
%pythonAppend wxWebKitCtrl "self._setOORInfo(self)"
|
||||
%pythonAppend wxWebKitCtrl() ""
|
||||
|
||||
wxWebKitCtrl(wxWindow *parent,
|
||||
wxWindowID winID = -1,
|
||||
const wxString& strURL = wxPyEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxPyWebKitNameStr);
|
||||
|
||||
%name(PreWebKitCtrl)wxWebKitCtrl();
|
||||
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID winID = -1,
|
||||
const wxString& strURL = wxPyEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxPyWebKitNameStr);
|
||||
|
||||
void LoadURL(const wxString &url);
|
||||
|
||||
bool CanGoBack();
|
||||
bool CanGoForward();
|
||||
bool GoBack();
|
||||
bool GoForward();
|
||||
void Reload();
|
||||
void Stop();
|
||||
bool CanGetPageSource();
|
||||
wxString GetPageSource();
|
||||
void SetPageSource(wxString& source, const wxString& baseUrl = wxPyEmptyString);
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
enum {
|
||||
wxWEBKIT_STATE_START,
|
||||
wxWEBKIT_STATE_NEGOTIATING,
|
||||
wxWEBKIT_STATE_REDIRECTING,
|
||||
wxWEBKIT_STATE_TRANSFERRING,
|
||||
wxWEBKIT_STATE_STOP,
|
||||
wxWEBKIT_STATE_FAILED,
|
||||
};
|
||||
|
||||
|
||||
%constant wxEventType wxEVT_WEBKIT_STATE_CHANGED;
|
||||
|
||||
|
||||
class wxWebKitStateChangedEvent : public wxCommandEvent
|
||||
{
|
||||
public:
|
||||
wxWebKitStateChangedEvent( wxWindow* win = NULL );
|
||||
|
||||
int GetState();
|
||||
void SetState(const int state);
|
||||
wxString GetURL();
|
||||
void SetURL(const wxString& url);
|
||||
};
|
||||
|
||||
|
||||
%pythoncode %{
|
||||
EVT_WEBKIT_STATE_CHANGED = wx.PyEventBinder(wxEVT_WEBKIT_STATE_CHANGED)
|
||||
%}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
%init %{
|
||||
|
||||
%}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -136,7 +136,8 @@ class AnalogClockWindow(wx.PyWindow):
|
||||
|
||||
def OnPaint(self, event):
|
||||
dc = wx.BufferedPaintDC(self)
|
||||
self._doDrawHands(dc, True)
|
||||
if hasattr(self, 'coords'):
|
||||
self._doDrawHands(dc, True)
|
||||
|
||||
|
||||
def OnTimerExpire(self, event):
|
||||
|
||||
@@ -74,7 +74,7 @@ def _ColToRect(self,col):
|
||||
if self.GetNumberRows() > 0:
|
||||
rect = self.CellToRect(0,col)
|
||||
else:
|
||||
rect = wxRect()
|
||||
rect = wx.Rect()
|
||||
rect.height = self.GetColLabelSize()
|
||||
rect.width = self.GetColSize(col)
|
||||
|
||||
@@ -91,7 +91,7 @@ def _RowToRect(self,row):
|
||||
if self.GetNumberCols() > 0:
|
||||
rect = self.CellToRect(row,0)
|
||||
else:
|
||||
rect = wxRect()
|
||||
rect = wx.Rect()
|
||||
rect.width = self.GetRowLabelSize()
|
||||
rect.height = self.GetRowSize(row)
|
||||
|
||||
|
||||
@@ -5622,7 +5622,7 @@ class MaskedEditMixin:
|
||||
and sel_to >= edit_end
|
||||
and not self._GetValue()[edit_start:sel_start].strip() ):
|
||||
# text won't fit within selection, but left of selection is empty;
|
||||
# check to see if we can expand selection to accomodate the value:
|
||||
# check to see if we can expand selection to accommodate the value:
|
||||
empty_space = sel_start - edit_start
|
||||
amount_needed = len(paste_text) - (sel_to - sel_start)
|
||||
if amount_needed <= empty_space:
|
||||
|
||||
@@ -17,7 +17,15 @@
|
||||
# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||
#
|
||||
# o wxColumnSorterMixin -> ColumnSorterMixin
|
||||
# o wxListCtrlAutoWidthMixin -> ListCtrlAutoWidthMixin
|
||||
# o wxListCtrlAutoWidthMixin -> ListCtrlAutoWidthMixin
|
||||
# ...
|
||||
# 13/10/2004 - Pim Van Heuven (pim@think-wize.com)
|
||||
# o wxTextEditMixin: Support Horizontal scrolling when TAB is pressed on long
|
||||
# ListCtrls, support for WXK_DOWN, WXK_UP, performance improvements on
|
||||
# very long ListCtrls, Support for virtual ListCtrls
|
||||
#
|
||||
# 15-Oct-2004 - Robin Dunn
|
||||
# o wxTextEditMixin: Added Shift-TAB support
|
||||
#
|
||||
|
||||
import locale
|
||||
@@ -374,22 +382,35 @@ class TextEditMixin:
|
||||
#editor = wx.TextCtrl(self, -1, pos=(-1,-1), size=(-1,-1),
|
||||
# style=wx.TE_PROCESS_ENTER|wx.TE_PROCESS_TAB \
|
||||
# |wx.TE_RICH2)
|
||||
|
||||
self.make_editor()
|
||||
self.Bind(wx.EVT_TEXT_ENTER, self.CloseEditor)
|
||||
self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
|
||||
self.Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDown)
|
||||
self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected)
|
||||
|
||||
|
||||
def make_editor(self, col_style=wx.LIST_FORMAT_LEFT):
|
||||
editor = wx.PreTextCtrl()
|
||||
editor.Hide()
|
||||
editor.Create(self, -1, style=wx.TE_PROCESS_ENTER|wx.TE_PROCESS_TAB|wx.TE_RICH2)
|
||||
|
||||
style =wx.TE_PROCESS_ENTER|wx.TE_PROCESS_TAB|wx.TE_RICH2
|
||||
style |= {wx.LIST_FORMAT_LEFT: wx.TE_LEFT, wx.LIST_FORMAT_RIGHT: wx.TE_RIGHT, wx.LIST_FORMAT_CENTRE : wx.TE_CENTRE}[col_style]
|
||||
|
||||
editor.Create(self, -1, style=style)
|
||||
editor.SetBackgroundColour(wx.Colour(red=255,green=255,blue=175)) #Yellow
|
||||
font = self.GetFont()
|
||||
editor.SetFont(font)
|
||||
|
||||
self.curRow = 0
|
||||
self.curCol = 0
|
||||
|
||||
editor.Hide()
|
||||
self.editor = editor
|
||||
self.Bind(wx.EVT_TEXT_ENTER, self.CloseEditor)
|
||||
|
||||
self.col_style = col_style
|
||||
self.editor.Bind(wx.EVT_CHAR, self.OnChar)
|
||||
self.editor.Bind(wx.EVT_KILL_FOCUS, self.CloseEditor)
|
||||
self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
|
||||
self.Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDown)
|
||||
self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected)
|
||||
self.curRow = -1
|
||||
|
||||
|
||||
|
||||
def OnItemSelected(self, evt):
|
||||
self.curRow = evt.GetIndex()
|
||||
@@ -397,11 +418,35 @@ class TextEditMixin:
|
||||
|
||||
|
||||
def OnChar(self, event):
|
||||
''' Catch the TAB key code so we can open the editor at the next column (if any).'''
|
||||
if event.GetKeyCode() == wx.WXK_TAB:
|
||||
''' Catch the TAB, Shift-TAB, cursor DOWN/UP key code
|
||||
so we can open the editor at the next column (if any).'''
|
||||
|
||||
keycode = event.GetKeyCode()
|
||||
if keycode == wx.WXK_TAB and event.ShiftDown():
|
||||
self.CloseEditor()
|
||||
if self.curCol-1 >= 0:
|
||||
self.OpenEditor(self.curCol-1, self.curRow)
|
||||
|
||||
elif keycode == wx.WXK_TAB:
|
||||
self.CloseEditor()
|
||||
if self.curCol+1 < self.GetColumnCount():
|
||||
self.OpenEditor(self.curCol+1, self.curRow)
|
||||
|
||||
elif keycode == wx.WXK_ESCAPE:
|
||||
self.CloseEditor()
|
||||
|
||||
elif keycode == wx.WXK_DOWN:
|
||||
self.CloseEditor()
|
||||
if self.curRow+1 < self.GetItemCount():
|
||||
self._SelectIndex(self.curRow+1)
|
||||
self.OpenEditor(self.curCol, self.curRow)
|
||||
|
||||
elif keycode == wx.WXK_UP:
|
||||
self.CloseEditor()
|
||||
if self.curRow > 0:
|
||||
self._SelectIndex(self.curRow-1)
|
||||
self.OpenEditor(self.curCol, self.curRow)
|
||||
|
||||
else:
|
||||
event.Skip()
|
||||
|
||||
@@ -431,21 +476,50 @@ class TextEditMixin:
|
||||
for n in range(self.GetColumnCount()):
|
||||
loc = loc + self.GetColumnWidth(n)
|
||||
self.col_locs.append(loc)
|
||||
|
||||
|
||||
col = bisect(self.col_locs, x) - 1
|
||||
col = bisect(self.col_locs, x+self.GetScrollPos(wx.HORIZONTAL)) - 1
|
||||
self.OpenEditor(col, row)
|
||||
|
||||
|
||||
def OpenEditor(self, col, row):
|
||||
''' Opens an editor at the current position. '''
|
||||
|
||||
if self.GetColumn(col).m_format != self.col_style:
|
||||
self.make_editor(self.GetColumn(col).m_format)
|
||||
|
||||
x0 = self.col_locs[col]
|
||||
x1 = self.col_locs[col+1] - x0
|
||||
|
||||
scrolloffset = self.GetScrollPos(wx.HORIZONTAL)
|
||||
|
||||
# scroll foreward
|
||||
if x0+x1-scrolloffset > self.GetSize()[0]:
|
||||
if wx.Platform == "__WXMSW__":
|
||||
# don't start scrolling unless we really need to
|
||||
offset = x0+x1-self.GetSize()[0]-scrolloffset
|
||||
# scroll a bit more than what is minimum required
|
||||
# so we don't have to scroll everytime the user presses TAB
|
||||
# which is very tireing to the eye
|
||||
addoffset = self.GetSize()[0]/4
|
||||
# but be careful at the end of the list
|
||||
if addoffset + scrolloffset < self.GetSize()[0]:
|
||||
offset += addoffset
|
||||
|
||||
self.ScrollList(offset, 0)
|
||||
scrolloffset = self.GetScrollPos(wx.HORIZONTAL)
|
||||
else:
|
||||
# Since we can not programmatically scroll the ListCtrl
|
||||
# close the editor so the user can scroll and open the editor
|
||||
# again
|
||||
self.CloseEditor()
|
||||
return
|
||||
|
||||
y0 = self.GetItemRect(row)[1]
|
||||
|
||||
editor = self.editor
|
||||
editor.SetDimensions(x0,y0, x1,-1)
|
||||
editor.SetDimensions(x0-scrolloffset,y0, x1,-1)
|
||||
|
||||
editor.SetValue(self.GetItem(row, col).GetText())
|
||||
editor.Show()
|
||||
editor.Raise()
|
||||
@@ -460,7 +534,26 @@ class TextEditMixin:
|
||||
''' Close the editor and save the new value to the ListCtrl. '''
|
||||
text = self.editor.GetValue()
|
||||
self.editor.Hide()
|
||||
self.SetStringItem(self.curRow, self.curCol, text)
|
||||
if self.IsVirtual():
|
||||
# replace by whather you use to populate the virtual ListCtrl
|
||||
# data source
|
||||
self.SetVirtualData(self.curRow, self.curCol, text)
|
||||
else:
|
||||
self.SetStringItem(self.curRow, self.curCol, text)
|
||||
self.RefreshItem(self.curRow)
|
||||
|
||||
def _SelectIndex(self, row):
|
||||
listlen = self.GetItemCount()
|
||||
if row < 0 and not listlen:
|
||||
return
|
||||
if row > (listlen-1):
|
||||
row = listlen -1
|
||||
|
||||
self.SetItemState(self.curRow, ~wx.LIST_STATE_SELECTED,
|
||||
wx.LIST_STATE_SELECTED)
|
||||
self.EnsureVisible(row)
|
||||
self.SetItemState(row, wx.LIST_STATE_SELECTED,
|
||||
wx.LIST_STATE_SELECTED)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1797,15 +1797,15 @@ class Shape(ShapeEvtHandler):
|
||||
dc.SetBrush(wx.BLACK_BRUSH)
|
||||
|
||||
# Draw neck
|
||||
dc.DrawLine(root, neck)
|
||||
dc.DrawLine(root[0], root[1], neck[0], neck[1])
|
||||
|
||||
if count > 1:
|
||||
# Draw shoulder-to-shoulder line
|
||||
dc.DrawLine(shoulder1, shoulder2)
|
||||
dc.DrawLine(shoulder1[0], shoulder1[1], shoulder2[0], shoulder2[1])
|
||||
# Draw all the little branches
|
||||
for i in range(count):
|
||||
pt, stemPt = self.GetBranchingAttachmentPoint(attachment, i)
|
||||
dc.DrawLine(stemPt, pt)
|
||||
dc.DrawLine(stemPt[0], stemPt[1], pt[0], pt[1])
|
||||
|
||||
if self.GetBranchStyle() & BRANCHING_ATTACHMENT_BLOB and count > 1:
|
||||
blobSize = 6.0
|
||||
|
||||
@@ -297,6 +297,10 @@ class LineShape(Shape):
|
||||
point = wx.RealPoint(-999, -999)
|
||||
self._lineControlPoints.append(point)
|
||||
|
||||
# pi: added _initialised to keep track of when we have set
|
||||
# the middle points to something other than (-999, -999)
|
||||
self._initialised = False
|
||||
|
||||
def InsertLineControlPoint(self, dc = None):
|
||||
"""Insert a control point at an arbitrary position."""
|
||||
if dc:
|
||||
@@ -346,6 +350,7 @@ class LineShape(Shape):
|
||||
y2 = first_point[1]
|
||||
y1 = last_point[1]
|
||||
self._lineControlPoints[i] = wx.RealPoint((x2 - x1) / 2.0 + x1, (y2 - y1) / 2.0 + y1)
|
||||
self._initialised = True
|
||||
|
||||
def FormatText(self, dc, s, i):
|
||||
"""Format a text string according to the region size, adding
|
||||
@@ -503,7 +508,7 @@ class LineShape(Shape):
|
||||
first_point = self._lineControlPoints[0]
|
||||
last_point = self._lineControlPoints[-1]
|
||||
|
||||
return (first_point[0], first_point[1]), (last_point[0], last_point[1])
|
||||
return first_point[0], first_point[1], last_point[0], last_point[1]
|
||||
|
||||
def SetAttachments(self, from_attach, to_attach):
|
||||
"""Specify which object attachment points should be used at each end
|
||||
@@ -548,8 +553,8 @@ class LineShape(Shape):
|
||||
dy = point2[1] - point1[1]
|
||||
|
||||
seg_len = math.sqrt(dx * dx + dy * dy)
|
||||
if dy == 0 or dx == 0:
|
||||
return False
|
||||
if dy == 0 and dx == 0:
|
||||
continue
|
||||
distance_from_seg = seg_len * float((x - point1[0]) * dy - (y - point1[1]) * dx) / (dy * dy + dx * dx)
|
||||
distance_from_prev = seg_len * float((y - point1[1]) * dy + (x - point1[0]) * dx) / (dy * dy + dx * dx)
|
||||
|
||||
@@ -904,17 +909,25 @@ class LineShape(Shape):
|
||||
if not self._from or not self._to:
|
||||
return
|
||||
|
||||
if len(self._lineControlPoints) > 2:
|
||||
self.Initialise()
|
||||
|
||||
# Do each end - nothing in the middle. User has to move other points
|
||||
# manually if necessary
|
||||
end_x, end_y, other_end_x, other_end_y = self.FindLineEndPoints()
|
||||
|
||||
oldX, oldY = self._xpos, self._ypos
|
||||
|
||||
# pi: The first time we go through FindLineEndPoints we can't
|
||||
# use the middle points (since they don't have sane values),
|
||||
# so we just do what we do for a normal line. Then we call
|
||||
# Initialise to set the middle points, and then FindLineEndPoints
|
||||
# again, but this time (and from now on) we use the middle
|
||||
# points to calculate the end points.
|
||||
# This was buggy in the C++ version too.
|
||||
|
||||
self.SetEnds(end_x, end_y, other_end_x, other_end_y)
|
||||
|
||||
if len(self._lineControlPoints) > 2:
|
||||
self.Initialise()
|
||||
|
||||
# Do a second time, because one may depend on the other
|
||||
end_x, end_y, other_end_x, other_end_y = self.FindLineEndPoints()
|
||||
self.SetEnds(end_x, end_y, other_end_x, other_end_y)
|
||||
@@ -946,8 +959,10 @@ class LineShape(Shape):
|
||||
# manually if necessary.
|
||||
second_point = self._lineControlPoints[1]
|
||||
second_last_point = self._lineControlPoints[-2]
|
||||
|
||||
if len(self._lineControlPoints) > 2:
|
||||
|
||||
# pi: If we have a segmented line and this is the first time,
|
||||
# do this as a straight line.
|
||||
if len(self._lineControlPoints) > 2 and self._initialised:
|
||||
if self._from.GetAttachmentMode() != ATTACHMENT_MODE_NONE:
|
||||
nth, no_arcs = self.FindNth(self._from, False) # Not incoming
|
||||
end_x, end_y = self._from.GetAttachmentPosition(self._attachmentFrom, nth, no_arcs, self)
|
||||
@@ -999,7 +1014,6 @@ class LineShape(Shape):
|
||||
for point in self._lineControlPoints:
|
||||
points.append(wx.Point(point[0], point[1]))
|
||||
|
||||
#print points
|
||||
if self._isSpline:
|
||||
dc.DrawSpline(points)
|
||||
else:
|
||||
@@ -1088,7 +1102,7 @@ class LineShape(Shape):
|
||||
self._controlPoints.append(control)
|
||||
|
||||
def ResetControlPoints(self):
|
||||
if self._canvas and self._lineControlPoints:
|
||||
if self._canvas and self._lineControlPoints and self._controlPoints:
|
||||
for i in range(min(len(self._controlPoints), len(self._lineControlPoints))):
|
||||
point = self._lineControlPoints[i]
|
||||
control = self._controlPoints[i]
|
||||
@@ -1142,8 +1156,9 @@ class LineShape(Shape):
|
||||
|
||||
pt.SetX(x)
|
||||
pt.SetY(y)
|
||||
pt._point = x, y
|
||||
|
||||
pt._point[0] = x
|
||||
pt._point[1] = y
|
||||
|
||||
old_pen = self.GetPen()
|
||||
old_brush = self.GetBrush()
|
||||
|
||||
@@ -1177,7 +1192,8 @@ class LineShape(Shape):
|
||||
|
||||
pt._xpos = x
|
||||
pt._ypos = y
|
||||
pt._point = x, y
|
||||
pt._point[0] = x
|
||||
pt._point[1] = y
|
||||
|
||||
old_pen = self.GetPen()
|
||||
old_brush = self.GetBrush()
|
||||
@@ -1213,7 +1229,8 @@ class LineShape(Shape):
|
||||
# as it changed shape.
|
||||
pt._xpos = pt._originalPos[0]
|
||||
pt._ypos = pt._originalPos[1]
|
||||
pt._point = pt._originalPos[0], pt._originalPos[1]
|
||||
pt._point[0] = pt._originalPos[0]
|
||||
pt._point[1] = pt._originalPos[1]
|
||||
|
||||
self.OnMoveMiddleControlPoint(dc, pt, rpt)
|
||||
|
||||
@@ -1221,22 +1238,23 @@ class LineShape(Shape):
|
||||
if pt._oldCursor:
|
||||
self._canvas.SetCursor(pt._oldCursor)
|
||||
|
||||
if self.GetFrom():
|
||||
self.GetFrom().MoveLineToNewAttachment(dc, self, x, y)
|
||||
if self.GetFrom():
|
||||
self.GetFrom().MoveLineToNewAttachment(dc, self, x, y)
|
||||
|
||||
if pt._type == CONTROL_POINT_ENDPOINT_TO:
|
||||
if pt._oldCursor:
|
||||
self._canvas.SetCursor(pt._oldCursor)
|
||||
|
||||
if self.GetTo():
|
||||
self.GetTo().MoveLineToNewAttachment(dc, self, x, y)
|
||||
if self.GetTo():
|
||||
self.GetTo().MoveLineToNewAttachment(dc, self, x, y)
|
||||
|
||||
# This is called only when a non-end control point is moved
|
||||
def OnMoveMiddleControlPoint(self, dc, lpt, pt):
|
||||
lpt._xpos = pt[0]
|
||||
lpt._ypos = pt[1]
|
||||
|
||||
lpt._point = pt[0], pt[1]
|
||||
lpt._point[0] = pt[0]
|
||||
lpt._point[1] = pt[1]
|
||||
|
||||
self.GetEventHandler().OnMoveLink(dc)
|
||||
|
||||
|
||||
@@ -25,7 +25,16 @@
|
||||
# - Modified line end shape from round to square.
|
||||
# - Removed FloatDCWrapper for conversion to ints and ints in arguments
|
||||
#
|
||||
|
||||
# Oct 15, 2004 Gordon Williams (g_will@cyberus.ca)
|
||||
# - Imported modules given leading underscore to name.
|
||||
# - Added Cursor Line Tracking and User Point Labels.
|
||||
# - Demo for Cursor Line Tracking and Point Labels.
|
||||
# - Size of plot preview frame adjusted to show page better.
|
||||
# - Added helper functions PositionUserToScreen and PositionScreenToUser in PlotCanvas.
|
||||
# - Added functions GetClosestPoints (all curves) and GetClosestPoint (only closest curve)
|
||||
# can be in either user coords or screen coords.
|
||||
#
|
||||
#
|
||||
|
||||
"""
|
||||
This is a simple light weight plotting module that can be used with
|
||||
@@ -79,16 +88,16 @@ Zooming controls with mouse (when enabled):
|
||||
Right mouse click - zoom out centred on click location.
|
||||
"""
|
||||
|
||||
import string
|
||||
import time
|
||||
import string as _string
|
||||
import time as _time
|
||||
import wx
|
||||
|
||||
# Needs Numeric or numarray
|
||||
try:
|
||||
import Numeric
|
||||
import Numeric as _Numeric
|
||||
except:
|
||||
try:
|
||||
import numarray as Numeric #if numarray is used it is renamed Numeric
|
||||
import numarray as _Numeric #if numarray is used it is renamed Numeric
|
||||
except:
|
||||
msg= """
|
||||
This module requires the Numeric or numarray module,
|
||||
@@ -109,7 +118,7 @@ class PolyPoints:
|
||||
"""
|
||||
|
||||
def __init__(self, points, attr):
|
||||
self.points = Numeric.array(points)
|
||||
self.points = _Numeric.array(points)
|
||||
self.currentScale= (1,1)
|
||||
self.currentShift= (0,0)
|
||||
self.scaled = self.points
|
||||
@@ -124,11 +133,11 @@ class PolyPoints:
|
||||
if len(self.points) == 0:
|
||||
# no curves to draw
|
||||
# defaults to (-1,-1) and (1,1) but axis can be set in Draw
|
||||
minXY= Numeric.array([-1,-1])
|
||||
maxXY= Numeric.array([ 1, 1])
|
||||
minXY= _Numeric.array([-1,-1])
|
||||
maxXY= _Numeric.array([ 1, 1])
|
||||
else:
|
||||
minXY= Numeric.minimum.reduce(self.points)
|
||||
maxXY= Numeric.maximum.reduce(self.points)
|
||||
minXY= _Numeric.minimum.reduce(self.points)
|
||||
maxXY= _Numeric.maximum.reduce(self.points)
|
||||
return minXY, maxXY
|
||||
|
||||
def scaleAndShift(self, scale=(1,1), shift=(0,0)):
|
||||
@@ -145,7 +154,27 @@ class PolyPoints:
|
||||
def getLegend(self):
|
||||
return self.attributes['legend']
|
||||
|
||||
|
||||
def getClosestPoint(self, pntXY, pointScaled= True):
|
||||
"""Returns the index of closest point on the curve, pointXY, scaledXY, distance
|
||||
x, y in user coords
|
||||
if pointScaled == True based on screen coords
|
||||
if pointScaled == False based on user coords
|
||||
"""
|
||||
if pointScaled == True:
|
||||
#Using screen coords
|
||||
p = self.scaled
|
||||
pxy = self.currentScale * _Numeric.array(pntXY)+ self.currentShift
|
||||
else:
|
||||
#Using user coords
|
||||
p = self.points
|
||||
pxy = _Numeric.array(pntXY)
|
||||
#determine distance for each point
|
||||
d= _Numeric.sqrt(_Numeric.add.reduce((p-pxy)**2,1)) #sqrt(dx^2+dy^2)
|
||||
pntIndex = _Numeric.argmin(d)
|
||||
dist = d[pntIndex]
|
||||
return [pntIndex, self.points[pntIndex], self.scaled[pntIndex], dist]
|
||||
|
||||
|
||||
class PolyLine(PolyPoints):
|
||||
"""Class to define line type and style
|
||||
- All methods except __init__ are private.
|
||||
@@ -255,9 +284,9 @@ class PolyMarker(PolyPoints):
|
||||
def _circle(self, dc, coords, size=1):
|
||||
fact= 2.5*size
|
||||
wh= 5.0*size
|
||||
rect= Numeric.zeros((len(coords),4),Numeric.Float)+[0.0,0.0,wh,wh]
|
||||
rect= _Numeric.zeros((len(coords),4),_Numeric.Float)+[0.0,0.0,wh,wh]
|
||||
rect[:,0:2]= coords-[fact,fact]
|
||||
dc.DrawEllipseList(rect.astype(Numeric.Int32))
|
||||
dc.DrawEllipseList(rect.astype(_Numeric.Int32))
|
||||
|
||||
def _dot(self, dc, coords, size=1):
|
||||
dc.DrawPointList(coords)
|
||||
@@ -265,35 +294,35 @@ class PolyMarker(PolyPoints):
|
||||
def _square(self, dc, coords, size=1):
|
||||
fact= 2.5*size
|
||||
wh= 5.0*size
|
||||
rect= Numeric.zeros((len(coords),4),Numeric.Float)+[0.0,0.0,wh,wh]
|
||||
rect= _Numeric.zeros((len(coords),4),_Numeric.Float)+[0.0,0.0,wh,wh]
|
||||
rect[:,0:2]= coords-[fact,fact]
|
||||
dc.DrawRectangleList(rect.astype(Numeric.Int32))
|
||||
dc.DrawRectangleList(rect.astype(_Numeric.Int32))
|
||||
|
||||
def _triangle(self, dc, coords, size=1):
|
||||
shape= [(-2.5*size,1.44*size), (2.5*size,1.44*size), (0.0,-2.88*size)]
|
||||
poly= Numeric.repeat(coords,3)
|
||||
poly= _Numeric.repeat(coords,3)
|
||||
poly.shape= (len(coords),3,2)
|
||||
poly += shape
|
||||
dc.DrawPolygonList(poly.astype(Numeric.Int32))
|
||||
dc.DrawPolygonList(poly.astype(_Numeric.Int32))
|
||||
|
||||
def _triangle_down(self, dc, coords, size=1):
|
||||
shape= [(-2.5*size,-1.44*size), (2.5*size,-1.44*size), (0.0,2.88*size)]
|
||||
poly= Numeric.repeat(coords,3)
|
||||
poly= _Numeric.repeat(coords,3)
|
||||
poly.shape= (len(coords),3,2)
|
||||
poly += shape
|
||||
dc.DrawPolygonList(poly.astype(Numeric.Int32))
|
||||
dc.DrawPolygonList(poly.astype(_Numeric.Int32))
|
||||
|
||||
def _cross(self, dc, coords, size=1):
|
||||
fact= 2.5*size
|
||||
for f in [[-fact,-fact,fact,fact],[-fact,fact,fact,-fact]]:
|
||||
lines= Numeric.concatenate((coords,coords),axis=1)+f
|
||||
dc.DrawLineList(lines.astype(Numeric.Int32))
|
||||
lines= _Numeric.concatenate((coords,coords),axis=1)+f
|
||||
dc.DrawLineList(lines.astype(_Numeric.Int32))
|
||||
|
||||
def _plus(self, dc, coords, size=1):
|
||||
fact= 2.5*size
|
||||
for f in [[-fact,0,fact,0],[0,-fact,0,fact]]:
|
||||
lines= Numeric.concatenate((coords,coords),axis=1)+f
|
||||
dc.DrawLineList(lines.astype(Numeric.Int32))
|
||||
lines= _Numeric.concatenate((coords,coords),axis=1)+f
|
||||
dc.DrawLineList(lines.astype(_Numeric.Int32))
|
||||
|
||||
class PlotGraphics:
|
||||
"""Container to hold PolyXXX objects and graph labels
|
||||
@@ -318,8 +347,8 @@ class PlotGraphics:
|
||||
p1, p2 = self.objects[0].boundingBox()
|
||||
for o in self.objects[1:]:
|
||||
p1o, p2o = o.boundingBox()
|
||||
p1 = Numeric.minimum(p1, p1o)
|
||||
p2 = Numeric.maximum(p2, p2o)
|
||||
p1 = _Numeric.minimum(p1, p1o)
|
||||
p2 = _Numeric.maximum(p2, p2o)
|
||||
return p1, p2
|
||||
|
||||
def scaleAndShift(self, scale=(1,1), shift=(0,0)):
|
||||
@@ -356,9 +385,9 @@ class PlotGraphics:
|
||||
|
||||
def draw(self, dc):
|
||||
for o in self.objects:
|
||||
#t=time.clock() # profile info
|
||||
#t=_time.clock() # profile info
|
||||
o.draw(dc, self.printerScale)
|
||||
#dt= time.clock()-t
|
||||
#dt= _time.clock()-t
|
||||
#print o, "time=", dt
|
||||
|
||||
def getSymExtent(self, printerScale):
|
||||
@@ -366,7 +395,7 @@ class PlotGraphics:
|
||||
symExt = self.objects[0].getSymExtent(printerScale)
|
||||
for o in self.objects[1:]:
|
||||
oSymExt = o.getSymExtent(printerScale)
|
||||
symExt = Numeric.maximum(symExt, oSymExt)
|
||||
symExt = _Numeric.maximum(symExt, oSymExt)
|
||||
return symExt
|
||||
|
||||
def getLegendNames(self):
|
||||
@@ -424,8 +453,8 @@ class PlotCanvas(wx.Window):
|
||||
# Zooming variables
|
||||
self._zoomInFactor = 0.5
|
||||
self._zoomOutFactor = 2
|
||||
self._zoomCorner1= Numeric.array([0.0, 0.0]) # left mouse down corner
|
||||
self._zoomCorner2= Numeric.array([0.0, 0.0]) # left mouse up corner
|
||||
self._zoomCorner1= _Numeric.array([0.0, 0.0]) # left mouse down corner
|
||||
self._zoomCorner2= _Numeric.array([0.0, 0.0]) # left mouse up corner
|
||||
self._zoomEnabled= False
|
||||
self._hasDragged= False
|
||||
|
||||
@@ -444,13 +473,19 @@ class PlotCanvas(wx.Window):
|
||||
self._fontSizeTitle= 15
|
||||
self._fontSizeLegend= 7
|
||||
|
||||
# pointLabels
|
||||
self._pointLabelEnabled= False
|
||||
self.last_PointLabel= None
|
||||
self._pointLabelFunc= None
|
||||
self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeave)
|
||||
|
||||
self.Bind(wx.EVT_PAINT, self.OnPaint)
|
||||
self.Bind(wx.EVT_SIZE, self.OnSize)
|
||||
# OnSize called to make sure the buffer is initialized.
|
||||
# This might result in OnSize getting called twice on some
|
||||
# platforms at initialization, but little harm done.
|
||||
if wx.Platform != "__WXMAC__":
|
||||
self.OnSize(None) # sets the initial size based on client size
|
||||
if wx.Platform != "__WXMAC__":
|
||||
self.OnSize(None) # sets the initial size based on client size
|
||||
|
||||
|
||||
# SaveFile
|
||||
@@ -465,7 +500,7 @@ class PlotCanvas(wx.Window):
|
||||
.png Save a Portable Network Graphics file.
|
||||
.jpg Save a Joint Photographic Experts Group file.
|
||||
"""
|
||||
if string.lower(fileName[-3:]) not in ['bmp','xbm','xpm','png','jpg']:
|
||||
if _string.lower(fileName[-3:]) not in ['bmp','xbm','xpm','png','jpg']:
|
||||
dlg1 = wx.FileDialog(
|
||||
self,
|
||||
"Choose a file with extension bmp, gif, xbm, xpm, png, or jpg", ".", "",
|
||||
@@ -477,7 +512,7 @@ class PlotCanvas(wx.Window):
|
||||
if dlg1.ShowModal() == wx.ID_OK:
|
||||
fileName = dlg1.GetPath()
|
||||
# Check for proper exension
|
||||
if string.lower(fileName[-3:]) not in ['bmp','xbm','xpm','png','jpg']:
|
||||
if _string.lower(fileName[-3:]) not in ['bmp','xbm','xpm','png','jpg']:
|
||||
dlg2 = wx.MessageDialog(self, 'File name extension\n'
|
||||
'must be one of\n'
|
||||
'bmp, xbm, xpm, png, or jpg',
|
||||
@@ -494,7 +529,7 @@ class PlotCanvas(wx.Window):
|
||||
dlg1.Destroy()
|
||||
|
||||
# File name has required extension
|
||||
fType = string.lower(fileName[-3:])
|
||||
fType = _string.lower(fileName[-3:])
|
||||
if fType == "bmp":
|
||||
tp= wx.BITMAP_TYPE_BMP # Save a Windows bitmap file.
|
||||
elif fType == "xbm":
|
||||
@@ -547,7 +582,7 @@ class PlotCanvas(wx.Window):
|
||||
wx.MessageDialog(self, "Print Preview failed.\n" \
|
||||
"Check that default printer is configured\n", \
|
||||
"Print error", wx.OK|wx.CENTRE).ShowModal()
|
||||
self.preview.SetZoom(30)
|
||||
self.preview.SetZoom(40)
|
||||
# search up tree to find frame instance
|
||||
frameInst= self
|
||||
while not isinstance(frameInst, wx.Frame):
|
||||
@@ -555,7 +590,7 @@ class PlotCanvas(wx.Window):
|
||||
frame = wx.PreviewFrame(self.preview, frameInst, "Preview")
|
||||
frame.Initialize()
|
||||
frame.SetPosition(self.GetPosition())
|
||||
frame.SetSize((500,400))
|
||||
frame.SetSize((600,550))
|
||||
frame.Centre(wx.BOTH)
|
||||
frame.Show(True)
|
||||
|
||||
@@ -615,13 +650,37 @@ class PlotCanvas(wx.Window):
|
||||
"""True if Legend enabled."""
|
||||
return self._legendEnabled
|
||||
|
||||
def SetEnablePointLabel(self, value):
|
||||
"""Set True to enable pointLabel."""
|
||||
if value not in [True,False]:
|
||||
raise TypeError, "Value should be True or False"
|
||||
self._pointLabelEnabled= value
|
||||
self.Redraw() #will erase existing pointLabel if present
|
||||
self.last_PointLabel = None
|
||||
|
||||
def GetEnablePointLabel(self):
|
||||
"""True if pointLabel enabled."""
|
||||
return self._pointLabelEnabled
|
||||
|
||||
def SetPointLabelFunc(self, func):
|
||||
"""Sets the function with custom code for pointLabel drawing
|
||||
******** more info needed ***************
|
||||
"""
|
||||
self._pointLabelFunc= func
|
||||
|
||||
def GetPointLabelFunc(self):
|
||||
"""Returns pointLabel Drawing Function"""
|
||||
return self._pointLabelFunc
|
||||
|
||||
def Reset(self):
|
||||
"""Unzoom the plot."""
|
||||
self.last_PointLabel = None #reset pointLabel
|
||||
if self.last_draw is not None:
|
||||
self.Draw(self.last_draw[0])
|
||||
|
||||
def ScrollRight(self, units):
|
||||
"""Move view right number of axis units."""
|
||||
self.last_PointLabel = None #reset pointLabel
|
||||
if self.last_draw is not None:
|
||||
graphics, xAxis, yAxis= self.last_draw
|
||||
xAxis= (xAxis[0]+units, xAxis[1]+units)
|
||||
@@ -629,17 +688,28 @@ class PlotCanvas(wx.Window):
|
||||
|
||||
def ScrollUp(self, units):
|
||||
"""Move view up number of axis units."""
|
||||
if self.last_draw is not None:
|
||||
graphics, xAxis, yAxis= self.last_draw
|
||||
yAxis= (yAxis[0]+units, yAxis[1]+units)
|
||||
self.Draw(graphics,xAxis,yAxis)
|
||||
self.last_PointLabel = None #reset pointLabel
|
||||
if self.BeenDrawn():
|
||||
self._drawCmd.scrollAxisY(units, self._ySpec)
|
||||
self._draw()
|
||||
|
||||
def GetXY(self,event):
|
||||
"""Takes a mouse event and returns the XY user axis values."""
|
||||
screenPos= Numeric.array( event.GetPosition())
|
||||
x,y= (screenPos-self._pointShift)/self._pointScale
|
||||
x,y= self.PositionScreenToUser(event.GetPosition())
|
||||
return x,y
|
||||
|
||||
def PositionUserToScreen(self, pntXY):
|
||||
"""Converts User position to Screen Coordinates"""
|
||||
userPos= _Numeric.array(pntXY)
|
||||
x,y= userPos * self._pointScale + self._pointShift
|
||||
return x,y
|
||||
|
||||
def PositionScreenToUser(self, pntXY):
|
||||
"""Converts Screen position to User Coordinates"""
|
||||
screenPos= _Numeric.array(pntXY)
|
||||
x,y= (screenPos-self._pointShift)/self._pointScale
|
||||
return x,y
|
||||
|
||||
def SetXSpec(self, type= 'auto'):
|
||||
"""xSpec- defines x axis type. Can be 'none', 'min' or 'auto'
|
||||
where:
|
||||
@@ -711,7 +781,7 @@ class PlotCanvas(wx.Window):
|
||||
return
|
||||
|
||||
if dc == None:
|
||||
# allows using floats for certain functions
|
||||
# sets new dc and clears it
|
||||
dc = wx.BufferedDC(wx.ClientDC(self), self._Buffer)
|
||||
dc.Clear()
|
||||
|
||||
@@ -734,8 +804,8 @@ class PlotCanvas(wx.Window):
|
||||
p2[0],p2[1] = xAxis[1], yAxis[1] # upper right corner user scale (xmax,ymax)
|
||||
else:
|
||||
# Both axis specified in Draw
|
||||
p1= Numeric.array([xAxis[0], yAxis[0]]) # lower left corner user scale (xmin,ymin)
|
||||
p2= Numeric.array([xAxis[1], yAxis[1]]) # upper right corner user scale (xmax,ymax)
|
||||
p1= _Numeric.array([xAxis[0], yAxis[0]]) # lower left corner user scale (xmin,ymin)
|
||||
p2= _Numeric.array([xAxis[1], yAxis[1]]) # upper right corner user scale (xmax,ymax)
|
||||
|
||||
self.last_draw = (graphics, xAxis, yAxis) # saves most recient values
|
||||
|
||||
@@ -767,8 +837,8 @@ class PlotCanvas(wx.Window):
|
||||
lhsW= yTextExtent[0]+ yLabelWH[1]
|
||||
bottomH= max(xTextExtent[1], yTextExtent[1]/2.)+ xLabelWH[1]
|
||||
topH= yTextExtent[1]/2. + titleWH[1]
|
||||
textSize_scale= Numeric.array([rhsW+lhsW,bottomH+topH]) # make plot area smaller by text size
|
||||
textSize_shift= Numeric.array([lhsW, bottomH]) # shift plot area by this amount
|
||||
textSize_scale= _Numeric.array([rhsW+lhsW,bottomH+topH]) # make plot area smaller by text size
|
||||
textSize_shift= _Numeric.array([lhsW, bottomH]) # shift plot area by this amount
|
||||
|
||||
# drawing title and labels text
|
||||
dc.SetFont(self._getFont(self._fontSizeTitle))
|
||||
@@ -789,8 +859,8 @@ class PlotCanvas(wx.Window):
|
||||
self._drawLegend(dc,graphics,rhsW,topH,legendBoxWH, legendSymExt, legendTextExt)
|
||||
|
||||
# allow for scaling and shifting plotted points
|
||||
scale = (self.plotbox_size-textSize_scale) / (p2-p1)* Numeric.array((1,-1))
|
||||
shift = -p1*scale + self.plotbox_origin + textSize_shift * Numeric.array((1,-1))
|
||||
scale = (self.plotbox_size-textSize_scale) / (p2-p1)* _Numeric.array((1,-1))
|
||||
shift = -p1*scale + self.plotbox_origin + textSize_shift * _Numeric.array((1,-1))
|
||||
self._pointScale= scale # make available for mouse events
|
||||
self._pointShift= shift
|
||||
self._drawAxes(dc, p1, p2, scale, shift, xticks, yticks)
|
||||
@@ -802,9 +872,9 @@ class PlotCanvas(wx.Window):
|
||||
ptx,pty,rectWidth,rectHeight= self._point2ClientCoord(p1, p2)
|
||||
dc.SetClippingRegion(ptx,pty,rectWidth,rectHeight)
|
||||
# Draw the lines and markers
|
||||
#start = time.clock()
|
||||
#start = _time.clock()
|
||||
graphics.draw(dc)
|
||||
# print "entire graphics drawing took: %f second"%(time.clock() - start)
|
||||
# print "entire graphics drawing took: %f second"%(_time.clock() - start)
|
||||
# remove the clipping region
|
||||
dc.DestroyClippingRegion()
|
||||
dc.EndDrawing()
|
||||
@@ -817,6 +887,7 @@ class PlotCanvas(wx.Window):
|
||||
|
||||
def Clear(self):
|
||||
"""Erase the window."""
|
||||
self.last_PointLabel = None #reset pointLabel
|
||||
dc = wx.BufferedDC(wx.ClientDC(self), self._Buffer)
|
||||
dc.Clear()
|
||||
self.last_draw = None
|
||||
@@ -826,6 +897,7 @@ class PlotCanvas(wx.Window):
|
||||
Centers on the X,Y coords given in Center
|
||||
Zooms by the Ratio = (Xratio, Yratio) given
|
||||
"""
|
||||
self.last_PointLabel = None #reset maker
|
||||
x,y = Center
|
||||
if self.last_draw != None:
|
||||
(graphics, xAxis, yAxis) = self.last_draw
|
||||
@@ -835,6 +907,74 @@ class PlotCanvas(wx.Window):
|
||||
yAxis = ( y - h/2, y + h/2 )
|
||||
self.Draw(graphics, xAxis, yAxis)
|
||||
|
||||
def GetClosestPoints(self, pntXY, pointScaled= True):
|
||||
"""Returns list with
|
||||
[curveNumber, legend, index of closest point, pointXY, scaledXY, distance]
|
||||
list for each curve.
|
||||
Returns [] if no curves are being plotted.
|
||||
|
||||
x, y in user coords
|
||||
if pointScaled == True based on screen coords
|
||||
if pointScaled == False based on user coords
|
||||
"""
|
||||
if self.last_draw == None:
|
||||
#no graph available
|
||||
return []
|
||||
graphics, xAxis, yAxis= self.last_draw
|
||||
l = []
|
||||
for curveNum,obj in enumerate(graphics):
|
||||
#check there are points in the curve
|
||||
if len(obj.points) == 0:
|
||||
continue #go to next obj
|
||||
#[curveNumber, legend, index of closest point, pointXY, scaledXY, distance]
|
||||
cn = [curveNum]+ [obj.getLegend()]+ obj.getClosestPoint( pntXY, pointScaled)
|
||||
l.append(cn)
|
||||
return l
|
||||
|
||||
def GetClosetPoint(self, pntXY, pointScaled= True):
|
||||
"""Returns list with
|
||||
[curveNumber, legend, index of closest point, pointXY, scaledXY, distance]
|
||||
list for only the closest curve.
|
||||
Returns [] if no curves are being plotted.
|
||||
|
||||
x, y in user coords
|
||||
if pointScaled == True based on screen coords
|
||||
if pointScaled == False based on user coords
|
||||
"""
|
||||
#closest points on screen based on screen scaling (pointScaled= True)
|
||||
#list [curveNumber, index, pointXY, scaledXY, distance] for each curve
|
||||
closestPts= self.GetClosestPoints(pntXY, pointScaled)
|
||||
if closestPts == []:
|
||||
return [] #no graph present
|
||||
#find one with least distance
|
||||
dists = [c[-1] for c in closestPts]
|
||||
mdist = min(dists) #Min dist
|
||||
i = dists.index(mdist) #index for min dist
|
||||
return closestPts[i] #this is the closest point on closest curve
|
||||
|
||||
def UpdatePointLabel(self, mDataDict):
|
||||
"""Updates the pointLabel point on screen with data contained in
|
||||
mDataDict.
|
||||
|
||||
mDataDict will be passed to your function set by
|
||||
SetPointLabelFunc. It can contain anything you
|
||||
want to display on the screen at the scaledXY point
|
||||
you specify.
|
||||
|
||||
This function can be called from parent window with onClick,
|
||||
onMotion events etc.
|
||||
"""
|
||||
if self.last_PointLabel != None:
|
||||
#compare pointXY
|
||||
if mDataDict["pointXY"] != self.last_PointLabel["pointXY"]:
|
||||
#closest changed
|
||||
self._drawPointLabel(self.last_PointLabel) #erase old
|
||||
self._drawPointLabel(mDataDict) #plot new
|
||||
else:
|
||||
#just plot new with no erase
|
||||
self._drawPointLabel(mDataDict) #plot new
|
||||
#save for next erase
|
||||
self.last_PointLabel = mDataDict
|
||||
|
||||
# event handlers **********************************
|
||||
def OnMotion(self, event):
|
||||
@@ -855,8 +995,9 @@ class PlotCanvas(wx.Window):
|
||||
self._drawRubberBand(self._zoomCorner1, self._zoomCorner2) # remove old
|
||||
self._zoomCorner2[0], self._zoomCorner2[1]= self.GetXY(event)
|
||||
self._hasDragged = False # reset flag
|
||||
minX, minY= Numeric.minimum( self._zoomCorner1, self._zoomCorner2)
|
||||
maxX, maxY= Numeric.maximum( self._zoomCorner1, self._zoomCorner2)
|
||||
minX, minY= _Numeric.minimum( self._zoomCorner1, self._zoomCorner2)
|
||||
maxX, maxY= _Numeric.maximum( self._zoomCorner1, self._zoomCorner2)
|
||||
self.last_PointLabel = None #reset pointLabel
|
||||
if self.last_draw != None:
|
||||
self.Draw(self.last_draw[0], xAxis = (minX,maxX), yAxis = (minY,maxY), dc = None)
|
||||
#else: # A box has not been drawn, zoom in on a point
|
||||
@@ -875,7 +1016,10 @@ class PlotCanvas(wx.Window):
|
||||
|
||||
def OnPaint(self, event):
|
||||
# All that is needed here is to draw the buffer to screen
|
||||
dc = wx.BufferedPaintDC(self, self._Buffer)
|
||||
if self.last_PointLabel != None:
|
||||
self._drawPointLabel(self.last_PointLabel) #erase old
|
||||
self.last_PointLabel = None
|
||||
dc = wx.BufferedPaintDC(self, self._Buffer)
|
||||
|
||||
def OnSize(self,event):
|
||||
# The Buffer init is done here, to make sure the buffer is always
|
||||
@@ -887,12 +1031,21 @@ class PlotCanvas(wx.Window):
|
||||
# a file, or whatever.
|
||||
self._Buffer = wx.EmptyBitmap(Size[0],Size[1])
|
||||
self._setSize()
|
||||
|
||||
self.last_PointLabel = None #reset pointLabel
|
||||
|
||||
if self.last_draw is None:
|
||||
self.Clear()
|
||||
else:
|
||||
graphics, xSpec, ySpec = self.last_draw
|
||||
self.Draw(graphics,xSpec,ySpec)
|
||||
|
||||
def OnLeave(self, event):
|
||||
"""Used to erase pointLabel when mouse outside window"""
|
||||
if self.last_PointLabel != None:
|
||||
self._drawPointLabel(self.last_PointLabel) #erase old
|
||||
self.last_PointLabel = None
|
||||
|
||||
|
||||
# Private Methods **************************************************
|
||||
def _setSize(self, width=None, height=None):
|
||||
@@ -901,10 +1054,10 @@ class PlotCanvas(wx.Window):
|
||||
(self.width,self.height) = self.GetClientSize()
|
||||
else:
|
||||
self.width, self.height= width,height
|
||||
self.plotbox_size = 0.97*Numeric.array([self.width, self.height])
|
||||
self.plotbox_size = 0.97*_Numeric.array([self.width, self.height])
|
||||
xo = 0.5*(self.width-self.plotbox_size[0])
|
||||
yo = self.height-0.5*(self.height-self.plotbox_size[1])
|
||||
self.plotbox_origin = Numeric.array([xo, yo])
|
||||
self.plotbox_origin = _Numeric.array([xo, yo])
|
||||
|
||||
def _setPrinterScale(self, scale):
|
||||
"""Used to thicken lines and increase marker size for print out."""
|
||||
@@ -917,6 +1070,23 @@ class PlotCanvas(wx.Window):
|
||||
graphics, xSpec, ySpec= self.last_draw
|
||||
self.Draw(graphics,xSpec,ySpec,printDC)
|
||||
|
||||
def _drawPointLabel(self, mDataDict):
|
||||
"""Draws and erases pointLabels"""
|
||||
width = self._Buffer.GetWidth()
|
||||
height = self._Buffer.GetHeight()
|
||||
tmp_Buffer = wx.EmptyBitmap(width,height)
|
||||
dcs = wx.MemoryDC()
|
||||
dcs.SelectObject(tmp_Buffer)
|
||||
dcs.Clear()
|
||||
dcs.BeginDrawing()
|
||||
self._pointLabelFunc(dcs,mDataDict) #custom user pointLabel function
|
||||
dcs.EndDrawing()
|
||||
|
||||
dc = wx.ClientDC( self )
|
||||
#this will erase if called twice
|
||||
dc.Blit(0, 0, width, height, dcs, 0, 0, wx.EQUIV) #(NOT src) XOR dst
|
||||
|
||||
|
||||
def _drawLegend(self,dc,graphics,rhsW,topH,legendBoxWH, legendSymExt, legendTextExt):
|
||||
"""Draws legend symbols and text"""
|
||||
# top right hand corner of graph box is ref corner
|
||||
@@ -930,12 +1100,12 @@ class PlotCanvas(wx.Window):
|
||||
if isinstance(o,PolyMarker):
|
||||
# draw marker with legend
|
||||
pnt= (trhc[0]+legendLHS+legendSymExt[0]/2., trhc[1]+s+lineHeight/2.)
|
||||
o.draw(dc, self.printerScale, coord= Numeric.array([pnt]))
|
||||
o.draw(dc, self.printerScale, coord= _Numeric.array([pnt]))
|
||||
elif isinstance(o,PolyLine):
|
||||
# draw line with legend
|
||||
pnt1= (trhc[0]+legendLHS, trhc[1]+s+lineHeight/2.)
|
||||
pnt2= (trhc[0]+legendLHS+legendSymExt[0], trhc[1]+s+lineHeight/2.)
|
||||
o.draw(dc, self.printerScale, coord= Numeric.array([pnt1,pnt2]))
|
||||
o.draw(dc, self.printerScale, coord= _Numeric.array([pnt1,pnt2]))
|
||||
else:
|
||||
raise TypeError, "object is neither PolyMarker or PolyLine instance"
|
||||
# draw legend txt
|
||||
@@ -967,7 +1137,7 @@ class PlotCanvas(wx.Window):
|
||||
txtList= graphics.getLegendNames()
|
||||
txtExt= dc.GetTextExtent(txtList[0])
|
||||
for txt in graphics.getLegendNames()[1:]:
|
||||
txtExt= Numeric.maximum(txtExt,dc.GetTextExtent(txt))
|
||||
txtExt= _Numeric.maximum(txtExt,dc.GetTextExtent(txt))
|
||||
maxW= symExt[0]+txtExt[0]
|
||||
maxH= max(symExt[1],txtExt[1])
|
||||
# padding .1 for lhs of legend box and space between lines
|
||||
@@ -1007,14 +1177,14 @@ class PlotCanvas(wx.Window):
|
||||
|
||||
def _point2ClientCoord(self, corner1, corner2):
|
||||
"""Converts user point coords to client screen int coords x,y,width,height"""
|
||||
c1= Numeric.array(corner1)
|
||||
c2= Numeric.array(corner2)
|
||||
c1= _Numeric.array(corner1)
|
||||
c2= _Numeric.array(corner2)
|
||||
# convert to screen coords
|
||||
pt1= c1*self._pointScale+self._pointShift
|
||||
pt2= c2*self._pointScale+self._pointShift
|
||||
# make height and width positive
|
||||
pul= Numeric.minimum(pt1,pt2) # Upper left corner
|
||||
plr= Numeric.maximum(pt1,pt2) # Lower right corner
|
||||
pul= _Numeric.minimum(pt1,pt2) # Upper left corner
|
||||
plr= _Numeric.maximum(pt1,pt2) # Lower right corner
|
||||
rectWidth, rectHeight= plr-pul
|
||||
ptx,pty= pul
|
||||
return ptx, pty, rectWidth, rectHeight
|
||||
@@ -1030,8 +1200,8 @@ class PlotCanvas(wx.Window):
|
||||
range = upper-lower
|
||||
if range == 0.:
|
||||
return lower-0.5, upper+0.5
|
||||
log = Numeric.log10(range)
|
||||
power = Numeric.floor(log)
|
||||
log = _Numeric.log10(range)
|
||||
power = _Numeric.floor(log)
|
||||
fraction = log-power
|
||||
if fraction <= 0.05:
|
||||
power = power-1
|
||||
@@ -1068,11 +1238,11 @@ class PlotCanvas(wx.Window):
|
||||
lower, upper = p1[0],p2[0]
|
||||
text = 1
|
||||
for y, d in [(p1[1], -xTickLength), (p2[1], xTickLength)]: # miny, maxy and tick lengths
|
||||
a1 = scale*Numeric.array([lower, y])+shift
|
||||
a2 = scale*Numeric.array([upper, y])+shift
|
||||
a1 = scale*_Numeric.array([lower, y])+shift
|
||||
a2 = scale*_Numeric.array([upper, y])+shift
|
||||
dc.DrawLine(a1[0],a1[1],a2[0],a2[1]) # draws upper and lower axis line
|
||||
for x, label in xticks:
|
||||
pt = scale*Numeric.array([x, y])+shift
|
||||
pt = scale*_Numeric.array([x, y])+shift
|
||||
dc.DrawLine(pt[0],pt[1],pt[0],pt[1] + d) # draws tick mark d units
|
||||
if text:
|
||||
dc.DrawText(label,pt[0],pt[1])
|
||||
@@ -1083,11 +1253,11 @@ class PlotCanvas(wx.Window):
|
||||
text = 1
|
||||
h = dc.GetCharHeight()
|
||||
for x, d in [(p1[0], -yTickLength), (p2[0], yTickLength)]:
|
||||
a1 = scale*Numeric.array([x, lower])+shift
|
||||
a2 = scale*Numeric.array([x, upper])+shift
|
||||
a1 = scale*_Numeric.array([x, lower])+shift
|
||||
a2 = scale*_Numeric.array([x, upper])+shift
|
||||
dc.DrawLine(a1[0],a1[1],a2[0],a2[1])
|
||||
for y, label in yticks:
|
||||
pt = scale*Numeric.array([x, y])+shift
|
||||
pt = scale*_Numeric.array([x, y])+shift
|
||||
dc.DrawLine(pt[0],pt[1],pt[0]-d,pt[1])
|
||||
if text:
|
||||
dc.DrawText(label,pt[0]-dc.GetTextExtent(label)[0],
|
||||
@@ -1096,13 +1266,13 @@ class PlotCanvas(wx.Window):
|
||||
|
||||
def _ticks(self, lower, upper):
|
||||
ideal = (upper-lower)/7.
|
||||
log = Numeric.log10(ideal)
|
||||
power = Numeric.floor(log)
|
||||
log = _Numeric.log10(ideal)
|
||||
power = _Numeric.floor(log)
|
||||
fraction = log-power
|
||||
factor = 1.
|
||||
error = fraction
|
||||
for f, lf in self._multiples:
|
||||
e = Numeric.fabs(fraction-lf)
|
||||
e = _Numeric.fabs(fraction-lf)
|
||||
if e < error:
|
||||
error = e
|
||||
factor = f
|
||||
@@ -1116,13 +1286,13 @@ class PlotCanvas(wx.Window):
|
||||
digits = -int(power)
|
||||
format = '%'+`digits+2`+'.'+`digits`+'f'
|
||||
ticks = []
|
||||
t = -grid*Numeric.floor(-lower/grid)
|
||||
t = -grid*_Numeric.floor(-lower/grid)
|
||||
while t <= upper:
|
||||
ticks.append( (t, format % (t,)) )
|
||||
t = t + grid
|
||||
return ticks
|
||||
|
||||
_multiples = [(2., Numeric.log10(2.)), (5., Numeric.log10(5.))]
|
||||
_multiples = [(2., _Numeric.log10(2.)), (5., _Numeric.log10(5.))]
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
@@ -1198,6 +1368,7 @@ class PlotPrintout(wx.Printout):
|
||||
# rescale back to original
|
||||
self.graph._setSize()
|
||||
self.graph._setPrinterScale(1)
|
||||
self.graph.Redraw() #to get point label scale and shift correct
|
||||
|
||||
return True
|
||||
|
||||
@@ -1212,19 +1383,19 @@ class PlotPrintout(wx.Printout):
|
||||
|
||||
def _draw1Objects():
|
||||
# 100 points sin function, plotted as green circles
|
||||
data1 = 2.*Numeric.pi*Numeric.arange(200)/200.
|
||||
data1 = 2.*_Numeric.pi*_Numeric.arange(200)/200.
|
||||
data1.shape = (100, 2)
|
||||
data1[:,1] = Numeric.sin(data1[:,0])
|
||||
data1[:,1] = _Numeric.sin(data1[:,0])
|
||||
markers1 = PolyMarker(data1, legend='Green Markers', colour='green', marker='circle',size=1)
|
||||
|
||||
# 50 points cos function, plotted as red line
|
||||
data1 = 2.*Numeric.pi*Numeric.arange(100)/100.
|
||||
data1 = 2.*_Numeric.pi*_Numeric.arange(100)/100.
|
||||
data1.shape = (50,2)
|
||||
data1[:,1] = Numeric.cos(data1[:,0])
|
||||
data1[:,1] = _Numeric.cos(data1[:,0])
|
||||
lines = PolyLine(data1, legend= 'Red Line', colour='red')
|
||||
|
||||
# A few more points...
|
||||
pi = Numeric.pi
|
||||
pi = _Numeric.pi
|
||||
markers2 = PolyMarker([(0., 0.), (pi/4., 1.), (pi/2, 0.),
|
||||
(3.*pi/4., -1)], legend='Cross Legend', colour='blue',
|
||||
marker='cross')
|
||||
@@ -1233,19 +1404,19 @@ def _draw1Objects():
|
||||
|
||||
def _draw2Objects():
|
||||
# 100 points sin function, plotted as green dots
|
||||
data1 = 2.*Numeric.pi*Numeric.arange(200)/200.
|
||||
data1 = 2.*_Numeric.pi*_Numeric.arange(200)/200.
|
||||
data1.shape = (100, 2)
|
||||
data1[:,1] = Numeric.sin(data1[:,0])
|
||||
data1[:,1] = _Numeric.sin(data1[:,0])
|
||||
line1 = PolyLine(data1, legend='Green Line', colour='green', width=6, style=wx.DOT)
|
||||
|
||||
# 50 points cos function, plotted as red dot-dash
|
||||
data1 = 2.*Numeric.pi*Numeric.arange(100)/100.
|
||||
data1 = 2.*_Numeric.pi*_Numeric.arange(100)/100.
|
||||
data1.shape = (50,2)
|
||||
data1[:,1] = Numeric.cos(data1[:,0])
|
||||
data1[:,1] = _Numeric.cos(data1[:,0])
|
||||
line2 = PolyLine(data1, legend='Red Line', colour='red', width=3, style= wx.DOT_DASH)
|
||||
|
||||
# A few more points...
|
||||
pi = Numeric.pi
|
||||
pi = _Numeric.pi
|
||||
markers1 = PolyMarker([(0., 0.), (pi/4., 1.), (pi/2, 0.),
|
||||
(3.*pi/4., -1)], legend='Cross Hatch Square', colour='blue', width= 3, size= 6,
|
||||
fillcolour= 'red', fillstyle= wx.CROSSDIAG_HATCH,
|
||||
@@ -1264,7 +1435,7 @@ def _draw3Objects():
|
||||
|
||||
def _draw4Objects():
|
||||
# 25,000 point line
|
||||
data1 = Numeric.arange(5e5,1e6,10)
|
||||
data1 = _Numeric.arange(5e5,1e6,10)
|
||||
data1.shape = (25000, 2)
|
||||
line1 = PolyLine(data1, legend='Wide Line', colour='green', width=5)
|
||||
|
||||
@@ -1350,7 +1521,10 @@ class TestFrame(wx.Frame):
|
||||
menu.Append(215, 'Enable &Grid', 'Turn on Grid', kind=wx.ITEM_CHECK)
|
||||
self.Bind(wx.EVT_MENU,self.OnEnableGrid, id=215)
|
||||
menu.Append(220, 'Enable &Legend', 'Turn on Legend', kind=wx.ITEM_CHECK)
|
||||
self.Bind(wx.EVT_MENU,self.OnEnableLegend, id=220)
|
||||
self.Bind(wx.EVT_MENU,self.OnEnableLegend, id=220)
|
||||
menu.Append(222, 'Enable &Point Label', 'Show Closest Point', kind=wx.ITEM_CHECK)
|
||||
self.Bind(wx.EVT_MENU,self.OnEnablePointLabel, id=222)
|
||||
|
||||
menu.Append(225, 'Scroll Up 1', 'Move View Up 1 Unit')
|
||||
self.Bind(wx.EVT_MENU,self.OnScrUp, id=225)
|
||||
menu.Append(230, 'Scroll Rt 2', 'Move View Right 2 Units')
|
||||
@@ -1371,14 +1545,58 @@ class TestFrame(wx.Frame):
|
||||
self.CreateStatusBar(1)
|
||||
|
||||
self.client = PlotCanvas(self)
|
||||
#define the function for drawing pointLabels
|
||||
self.client.SetPointLabelFunc(self.DrawPointLabel)
|
||||
# Create mouse event for showing cursor coords in status bar
|
||||
self.client.Bind(wx.EVT_LEFT_DOWN, self.OnMouseLeftDown)
|
||||
# Show closest point when enabled
|
||||
self.client.Bind(wx.EVT_MOTION, self.OnMotion)
|
||||
|
||||
self.Show(True)
|
||||
|
||||
def DrawPointLabel(self, dc, mDataDict):
|
||||
"""This is the fuction that defines how the pointLabels are plotted
|
||||
dc - DC that will be passed
|
||||
mDataDict - Dictionary of data that you want to use for the pointLabel
|
||||
|
||||
As an example I have decided I want a box at the curve point
|
||||
with some text information about the curve plotted below.
|
||||
Any wxDC method can be used.
|
||||
"""
|
||||
# ----------
|
||||
dc.SetPen(wx.Pen(wx.BLACK))
|
||||
dc.SetBrush(wx.Brush( wx.BLACK, wx.SOLID ) )
|
||||
|
||||
sx, sy = mDataDict["scaledXY"] #scaled x,y of closest point
|
||||
dc.DrawRectangle( sx-5,sy-5, 10, 10) #10by10 square centered on point
|
||||
px,py = mDataDict["pointXY"]
|
||||
cNum = mDataDict["curveNum"]
|
||||
pntIn = mDataDict["pIndex"]
|
||||
legend = mDataDict["legend"]
|
||||
#make a string to display
|
||||
s = "Crv# %i, '%s', Pt. (%.2f,%.2f), PtInd %i" %(cNum, legend, px, py, pntIn)
|
||||
dc.DrawText(s, sx , sy+1)
|
||||
# -----------
|
||||
|
||||
def OnMouseLeftDown(self,event):
|
||||
s= "Left Mouse Down at Point: (%.4f, %.4f)" % self.client.GetXY(event)
|
||||
self.SetStatusText(s)
|
||||
event.Skip()
|
||||
event.Skip() #allows plotCanvas OnMouseLeftDown to be called
|
||||
|
||||
def OnMotion(self, event):
|
||||
#show closest point (when enbled)
|
||||
if self.client.GetEnablePointLabel() == True:
|
||||
#make up dict with info for the pointLabel
|
||||
#I've decided to mark the closest point on the closest curve
|
||||
dlst= self.client.GetClosetPoint( self.client.GetXY(event), pointScaled= True)
|
||||
if dlst != []: #returns [] if none
|
||||
curveNum, legend, pIndex, pointXY, scaledXY, distance = dlst
|
||||
#make up dictionary to pass to my user function (see DrawPointLabel)
|
||||
mDataDict= {"curveNum":curveNum, "legend":legend, "pIndex":pIndex,\
|
||||
"pointXY":pointXY, "scaledXY":scaledXY}
|
||||
#pass dict to update the pointLabel
|
||||
self.client.UpdatePointLabel(mDataDict)
|
||||
event.Skip() #go to next handler
|
||||
|
||||
def OnFilePageSetup(self, event):
|
||||
self.client.PageSetup()
|
||||
@@ -1416,12 +1634,12 @@ class TestFrame(wx.Frame):
|
||||
self.resetDefaults()
|
||||
drawObj= _draw4Objects()
|
||||
self.client.Draw(drawObj)
|
||||
## # profile
|
||||
## start = time.clock()
|
||||
## for x in range(10):
|
||||
## self.client.Draw(drawObj)
|
||||
## print "10 plots of Draw4 took: %f sec."%(time.clock() - start)
|
||||
## # profile end
|
||||
## # profile
|
||||
## start = _time.clock()
|
||||
## for x in range(10):
|
||||
## self.client.Draw(drawObj)
|
||||
## print "10 plots of Draw4 took: %f sec."%(_time.clock() - start)
|
||||
## # profile end
|
||||
|
||||
def OnPlotDraw5(self, event):
|
||||
# Empty plot with just axes
|
||||
@@ -1460,6 +1678,9 @@ class TestFrame(wx.Frame):
|
||||
def OnEnableLegend(self, event):
|
||||
self.client.SetEnableLegend(event.IsChecked())
|
||||
|
||||
def OnEnablePointLabel(self, event):
|
||||
self.client.SetEnablePointLabel(event.IsChecked())
|
||||
|
||||
def OnScrUp(self, event):
|
||||
self.client.ScrollUp(1)
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ class wxpTagHandler(wx.html.HtmlWinTagHandler):
|
||||
|
||||
|
||||
# check for something that should be evaluated
|
||||
elif value[0] in '[{(' or value[:2] == 'wx':
|
||||
elif value and value[0] in '[{(' or value[:2] == 'wx':
|
||||
saveVal = value
|
||||
try:
|
||||
value = eval(value, self.ctx.classMod.__dict__)
|
||||
@@ -203,7 +203,7 @@ class wxpTagHandler(wx.html.HtmlWinTagHandler):
|
||||
value = saveVal
|
||||
|
||||
# convert to wx.Colour
|
||||
elif value[0] == '#':
|
||||
elif value and value[0] == '#':
|
||||
try:
|
||||
red = int('0x'+value[1:3], 16)
|
||||
green = int('0x'+value[3:5], 16)
|
||||
@@ -212,7 +212,8 @@ class wxpTagHandler(wx.html.HtmlWinTagHandler):
|
||||
except:
|
||||
pass
|
||||
|
||||
self.ctx.kwargs[str(name)] = value
|
||||
if self.ctx:
|
||||
self.ctx.kwargs[str(name)] = value
|
||||
return False
|
||||
|
||||
|
||||
|
||||
@@ -208,9 +208,10 @@ class CrustFrame(frame.Frame):
|
||||
'the other half is still in the oven.\n\n' + \
|
||||
'Shell Revision: %s\n' % self.shell.revision + \
|
||||
'Interpreter Revision: %s\n\n' % self.shell.interp.revision + \
|
||||
'Platform: %s\n' % sys.platform + \
|
||||
'Python Version: %s\n' % sys.version.split()[0] + \
|
||||
'wxPython Version: %s\n' % wx.VERSION_STRING + \
|
||||
'Platform: %s\n' % sys.platform
|
||||
('\t(%s)\n' % ", ".join(wx.PlatformInfo[1:]))
|
||||
dialog = wx.MessageDialog(self, text, title,
|
||||
wx.OK | wx.ICON_INFORMATION)
|
||||
dialog.ShowModal()
|
||||
|
||||
@@ -72,9 +72,10 @@ class ShellFrame(frame.Frame):
|
||||
'the other half is still in the oven.\n\n' + \
|
||||
'Shell Revision: %s\n' % self.shell.revision + \
|
||||
'Interpreter Revision: %s\n\n' % self.shell.interp.revision + \
|
||||
'Platform: %s\n' % sys.platform + \
|
||||
'Python Version: %s\n' % sys.version.split()[0] + \
|
||||
'wxPython Version: %s\n' % wx.VERSION_STRING + \
|
||||
'Platform: %s\n' % sys.platform
|
||||
('\t(%s)\n' % ", ".join(wx.PlatformInfo[1:]))
|
||||
dialog = wx.MessageDialog(self, text, title,
|
||||
wx.OK | wx.ICON_INFORMATION)
|
||||
dialog.ShowModal()
|
||||
|
||||
@@ -136,7 +136,8 @@ class Panel(wxNotebook):
|
||||
if not self.GetPageCount() == 2:
|
||||
self.AddPage(self.page2, 'Style')
|
||||
self.page2.Layout()
|
||||
self.page2.Show(True)
|
||||
if 'wxGTK' in wx.PlatformInfo:
|
||||
self.page2.Show(True)
|
||||
size = self.page2.GetSizer().GetMinSize()
|
||||
self.page2.SetScrollbars(1, 1, size.width, size.height, 0, 0, True)
|
||||
else:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
|
||||
# We need to be able to import from the wx package, but there is also
|
||||
# a wxPyton.wx module and that would normally be chosen first by
|
||||
# a wxPython.wx module and that would normally be chosen first by
|
||||
# import statements. So instead we'll have a wxPython._wx module and
|
||||
# then stuff it into sys.modules with a wxPython.wx alias so old
|
||||
# programs will still work.
|
||||
|
||||
44
wxPython/wxPython/webkit.py
Normal file
44
wxPython/wxPython/webkit.py
Normal file
@@ -0,0 +1,44 @@
|
||||
## This file reverse renames symbols in the wx package to give
|
||||
## them their wx prefix again, for backwards compatibility.
|
||||
##
|
||||
## Generated by BuildRenamers in config.py
|
||||
|
||||
# This silly stuff here is so the wxPython.wx module doesn't conflict
|
||||
# with the wx package. We need to import modules from the wx package
|
||||
# here, then we'll put the wxPython.wx entry back in sys.modules.
|
||||
import sys
|
||||
_wx = None
|
||||
if sys.modules.has_key('wxPython.wx'):
|
||||
_wx = sys.modules['wxPython.wx']
|
||||
del sys.modules['wxPython.wx']
|
||||
|
||||
import wx.webkit
|
||||
|
||||
sys.modules['wxPython.wx'] = _wx
|
||||
del sys, _wx
|
||||
|
||||
|
||||
# Now assign all the reverse-renamed names:
|
||||
wxWebKitNameStr = wx.webkit.WebKitNameStr
|
||||
wxWebKitCtrl = wx.webkit.WebKitCtrl
|
||||
wxWebKitCtrlPtr = wx.webkit.WebKitCtrlPtr
|
||||
wxPreWebKitCtrl = wx.webkit.PreWebKitCtrl
|
||||
wxWEBKIT_STATE_START = wx.webkit.WEBKIT_STATE_START
|
||||
wxWEBKIT_STATE_NEGOTIATING = wx.webkit.WEBKIT_STATE_NEGOTIATING
|
||||
wxWEBKIT_STATE_REDIRECTING = wx.webkit.WEBKIT_STATE_REDIRECTING
|
||||
wxWEBKIT_STATE_TRANSFERRING = wx.webkit.WEBKIT_STATE_TRANSFERRING
|
||||
wxWEBKIT_STATE_STOP = wx.webkit.WEBKIT_STATE_STOP
|
||||
wxWEBKIT_STATE_FAILED = wx.webkit.WEBKIT_STATE_FAILED
|
||||
wxEVT_WEBKIT_STATE_CHANGED = wx.webkit.wxEVT_WEBKIT_STATE_CHANGED
|
||||
wxWebKitStateChangedEvent = wx.webkit.WebKitStateChangedEvent
|
||||
wxWebKitStateChangedEventPtr = wx.webkit.WebKitStateChangedEventPtr
|
||||
|
||||
|
||||
d = globals()
|
||||
for k, v in wx.webkit.__dict__.iteritems():
|
||||
if k.startswith('EVT'):
|
||||
d[k] = v
|
||||
del d, k, v
|
||||
|
||||
|
||||
|
||||
@@ -15,10 +15,16 @@
|
||||
"""
|
||||
If you have more than one version of wxPython installed this module
|
||||
allows your application to choose which version of wxPython will be
|
||||
imported when it does 'import wx'. You use it like this:
|
||||
imported when it does 'import wx'. You use it like this::
|
||||
|
||||
import wxversion
|
||||
wxversion.require('2.4')
|
||||
wxversion.select('2.4')
|
||||
import wx
|
||||
|
||||
Or additional build options can also be selected, like this::
|
||||
|
||||
import wxversion
|
||||
wxversion.select('2.5.3-unicode')
|
||||
import wx
|
||||
|
||||
Of course the default wxPython version can also be controlled by
|
||||
@@ -28,24 +34,53 @@ selection itself rather than depend on the user to setup the
|
||||
environment correctly.
|
||||
|
||||
It works by searching the sys.path for directories matching wx-* and
|
||||
then comparing them to what was passed to the require function. If a
|
||||
then comparing them to what was passed to the select function. If a
|
||||
match is found then that path is inserted into sys.path.
|
||||
|
||||
NOTE: If you are making a 'bundle' of your application with a tool
|
||||
like py2exe then you should *not* use the wxversion module since it
|
||||
looks at the filesystem for the directories on sys.path, it will fail
|
||||
in a bundled environment. Instead you should simply ensure that the
|
||||
version of wxPython that you want is found by default on the sys.path
|
||||
when making the bundled version by setting PYTHONPATH. Then that
|
||||
version will be included in your bundle and your app will work as
|
||||
expected. Py2exe and the others usually have a way to tell at runtime
|
||||
if they are running from a bundle or running raw, so you can check
|
||||
that and only use wxversion if needed. For example, for py2exe::
|
||||
|
||||
if not hasattr(sys, 'frozen'):
|
||||
import wxversion
|
||||
wxversion.select('2.5')
|
||||
import wx
|
||||
|
||||
More documentation on wxversion and multi-version installs can be
|
||||
found at: http://wiki.wxpython.org/index.cgi/MultiVersionInstalls
|
||||
|
||||
"""
|
||||
|
||||
import sys, os, glob, fnmatch
|
||||
|
||||
|
||||
_selected = None
|
||||
class VersionError(Exception):
|
||||
pass
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
def require(versions):
|
||||
def select(versions):
|
||||
"""
|
||||
Search for a wxPython installation that matches version.
|
||||
Search for a wxPython installation that matches version. If one
|
||||
is found then sys.path is modified so that version will be
|
||||
imported with a 'import wx', otherwise a VersionError exception is
|
||||
raised. This funciton should only be caled once at the begining
|
||||
of the application before wxPython is imported.
|
||||
|
||||
:param version: Specifies the version to look for, it can either be
|
||||
a sting or a list of strings. Each string is
|
||||
compared to the installed wxPythons and the best
|
||||
match is added to the sys.path, allowing an 'import
|
||||
wx' to find that version.
|
||||
:param version: Specifies the version to look for, it can
|
||||
either be a string or a list of strings. Each
|
||||
string is compared to the installed wxPythons
|
||||
and the best match is inserted into the
|
||||
sys.path, allowing an 'import wx' to find that
|
||||
version.
|
||||
|
||||
The version string is composed of the dotted
|
||||
version number (at least 2 of the 4 components)
|
||||
@@ -58,33 +93,142 @@ def require(versions):
|
||||
is increased for every specified optional component
|
||||
that is specified and that matches.
|
||||
"""
|
||||
assert not sys.modules.has_key('wx') and not sys.modules.has_key('wxPython'), \
|
||||
"wxversion.require() must be called before wxPython is imported"
|
||||
|
||||
bestMatch = None
|
||||
bestScore = 0
|
||||
if type(versions) == str:
|
||||
versions = [versions]
|
||||
|
||||
global _selected
|
||||
if _selected is not None:
|
||||
# A version was previously selected, ensure that it matches
|
||||
# this new request
|
||||
for ver in versions:
|
||||
if _selected.Score(_wxPackageInfo(ver)) > 0:
|
||||
return
|
||||
# otherwise, raise an exception
|
||||
raise VersionError("A previously selected wx version does not match the new request.")
|
||||
|
||||
# If we get here then this is the first time wxversion is used,
|
||||
# ensure that wxPython hasn't been imported yet.
|
||||
if sys.modules.has_key('wx') or sys.modules.has_key('wxPython'):
|
||||
raise VersionError("wxversion.select() must be called before wxPython is imported")
|
||||
|
||||
# Look for a matching version and manipulate the sys.path as
|
||||
# needed to allow it to be imported.
|
||||
installed = _find_installed(True)
|
||||
bestMatch = _get_best_match(installed, versions)
|
||||
|
||||
if bestMatch is None:
|
||||
raise VersionError("Requested version of wxPython not found")
|
||||
|
||||
sys.path.insert(0, bestMatch.pathname)
|
||||
_selected = bestMatch
|
||||
|
||||
packages = _find_installed()
|
||||
for pkg in packages:
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
UPDATE_URL = "http://wxPython.org/"
|
||||
#UPDATE_URL = "http://sourceforge.net/project/showfiles.php?group_id=10718"
|
||||
|
||||
|
||||
def ensureMinimal(minVersion):
|
||||
"""
|
||||
Checks to see if the default version of wxPython is greater-than
|
||||
or equal to `minVersion`. If not then it will try to find an
|
||||
installed version that is >= minVersion. If none are available
|
||||
then a message is displayed that will inform the user and will
|
||||
offer to open their web browser to the wxPython downloads page,
|
||||
and will then exit the application.
|
||||
"""
|
||||
assert type(minVersion) == str
|
||||
|
||||
# ensure that wxPython hasn't been imported yet.
|
||||
if sys.modules.has_key('wx') or sys.modules.has_key('wxPython'):
|
||||
raise VersionError("wxversion.ensureMinimal() must be called before wxPython is imported")
|
||||
|
||||
bestMatch = None
|
||||
minv = _wxPackageInfo(minVersion)
|
||||
defaultPath = _find_default()
|
||||
if defaultPath:
|
||||
defv = _wxPackageInfo(defaultPath, True)
|
||||
if defv >= minv:
|
||||
bestMatch = defv
|
||||
|
||||
if bestMatch is None:
|
||||
installed = _find_installed()
|
||||
if installed:
|
||||
# The list is in reverse sorted order, so if the first one is
|
||||
# big enough then choose it
|
||||
if installed[0] >= minv:
|
||||
bestMatch = installed[0]
|
||||
|
||||
if bestMatch is None:
|
||||
import wx, webbrowser
|
||||
versions = "\n".join([" "+ver for ver in getInstalled()])
|
||||
app = wx.PySimpleApp()
|
||||
result = wx.MessageBox("This application requires a version of wxPython "
|
||||
"greater than or equal to %s, but a matching version "
|
||||
"was not found.\n\n"
|
||||
"You currently have these version(s) installed:\n%s\n\n"
|
||||
"Would you like to download a new version of wxPython?\n"
|
||||
% (minVersion, versions),
|
||||
"wxPython Upgrade Needed", style=wx.YES_NO)
|
||||
if result == wx.YES:
|
||||
webbrowser.open(UPDATE_URL)
|
||||
app.MainLoop()
|
||||
sys.exit()
|
||||
|
||||
sys.path.insert(0, bestMatch.pathname)
|
||||
_selected = bestMatch
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
def checkInstalled(versions):
|
||||
"""
|
||||
Check if there is a version of wxPython installed that matches one
|
||||
of the versions given. Returns True if so, False if not. This
|
||||
can be used to determine if calling `select` will succeed or not.
|
||||
|
||||
:param version: Same as in `select`, either a string or a list
|
||||
of strings specifying the version(s) to check
|
||||
for.
|
||||
"""
|
||||
|
||||
if type(versions) == str:
|
||||
versions = [versions]
|
||||
installed = _find_installed()
|
||||
bestMatch = _get_best_match(installed, versions)
|
||||
return bestMatch is not None
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
def getInstalled():
|
||||
"""
|
||||
Returns a list of strings representing the installed wxPython
|
||||
versions that are found on the system.
|
||||
"""
|
||||
installed = _find_installed()
|
||||
return [os.path.basename(p.pathname)[3:] for p in installed]
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# private helpers...
|
||||
|
||||
def _get_best_match(installed, versions):
|
||||
bestMatch = None
|
||||
bestScore = 0
|
||||
for pkg in installed:
|
||||
for ver in versions:
|
||||
score = pkg.Score(_wxPackageInfo(ver))
|
||||
if score > bestScore:
|
||||
bestMatch = pkg
|
||||
bestScore = score
|
||||
|
||||
assert bestMatch is not None, \
|
||||
"Required version of wxPython not found"
|
||||
|
||||
sys.path.insert(0, bestMatch.pathname)
|
||||
|
||||
|
||||
return bestMatch
|
||||
|
||||
|
||||
_pattern = "wx-[0-9].*"
|
||||
def _find_installed():
|
||||
def _find_installed(removeExisting=False):
|
||||
installed = []
|
||||
toRemove = []
|
||||
for pth in sys.path:
|
||||
|
||||
# empty means to look in the current dir
|
||||
@@ -97,8 +241,10 @@ def _find_installed():
|
||||
|
||||
base = os.path.basename(pth)
|
||||
|
||||
# if it's a wx path that's already in the sys.path then skip it
|
||||
# if it's a wx path that's already in the sys.path then mark
|
||||
# it for removal and then skip it
|
||||
if fnmatch.fnmatchcase(base, _pattern):
|
||||
toRemove.append(pth)
|
||||
continue
|
||||
|
||||
# now look in the dir for matching subdirs
|
||||
@@ -111,11 +257,44 @@ def _find_installed():
|
||||
continue
|
||||
installed.append(_wxPackageInfo(name, True))
|
||||
|
||||
if removeExisting:
|
||||
for rem in toRemove:
|
||||
del sys.path[sys.path.index(rem)]
|
||||
|
||||
installed.sort()
|
||||
installed.reverse()
|
||||
return installed
|
||||
|
||||
|
||||
# Scan the sys.path looking for either a directory matching _pattern,
|
||||
# or a wx.pth file
|
||||
def _find_default():
|
||||
for pth in sys.path:
|
||||
# empty means to look in the current dir
|
||||
if not pth:
|
||||
pth = '.'
|
||||
|
||||
# skip it if it's not a package dir
|
||||
if not os.path.isdir(pth):
|
||||
continue
|
||||
|
||||
# does it match the pattern?
|
||||
base = os.path.basename(pth)
|
||||
if fnmatch.fnmatchcase(base, _pattern):
|
||||
return pth
|
||||
|
||||
for pth in sys.path:
|
||||
if not pth:
|
||||
pth = '.'
|
||||
if not os.path.isdir(pth):
|
||||
continue
|
||||
if os.path.exists(os.path.join(pth, 'wx.pth')):
|
||||
base = open(os.path.join(pth, 'wx.pth')).read()
|
||||
return os.path.join(pth, base)
|
||||
|
||||
return None
|
||||
|
||||
|
||||
class _wxPackageInfo(object):
|
||||
def __init__(self, pathname, stripFirst=False):
|
||||
self.pathname = pathname
|
||||
@@ -129,38 +308,64 @@ class _wxPackageInfo(object):
|
||||
|
||||
def Score(self, other):
|
||||
score = 0
|
||||
# whatever version components given in other must match exactly
|
||||
if len(self.version) > len(other.version):
|
||||
v = self.version[:len(other.version)]
|
||||
else:
|
||||
v = self.version
|
||||
if v != other.version:
|
||||
return 0
|
||||
|
||||
# whatever number of version components given in other must
|
||||
# match exactly
|
||||
minlen = min(len(self.version), len(other.version))
|
||||
if self.version[:minlen] != other.version[:minlen]:
|
||||
return 0
|
||||
score += 1
|
||||
|
||||
for opt in other.options:
|
||||
if opt in self.options:
|
||||
score += 1
|
||||
return score
|
||||
|
||||
|
||||
# TODO: factor self.options into the sort order?
|
||||
|
||||
def __lt__(self, other):
|
||||
return self.version < other.version
|
||||
return self.version < other.version or \
|
||||
(self.version == other.version and self.options < other.options)
|
||||
def __le__(self, other):
|
||||
return self.version <= other.version or \
|
||||
(self.version == other.version and self.options <= other.options)
|
||||
|
||||
def __gt__(self, other):
|
||||
return self.version > other.version
|
||||
return self.version > other.version or \
|
||||
(self.version == other.version and self.options > other.options)
|
||||
def __ge__(self, other):
|
||||
return self.version >= other.version or \
|
||||
(self.version == other.version and self.options >= other.options)
|
||||
|
||||
def __eq__(self, other):
|
||||
return self.version == other.version
|
||||
return self.version == other.version and self.options == other.options
|
||||
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
if __name__ == '__main__':
|
||||
import pprint
|
||||
|
||||
#ensureMinimal('2.5')
|
||||
#pprint.pprint(sys.path)
|
||||
#sys.exit()
|
||||
|
||||
|
||||
def test(version):
|
||||
# setup
|
||||
savepath = sys.path[:]
|
||||
require(version)
|
||||
|
||||
#test
|
||||
select(version)
|
||||
print "Asked for %s:\t got: %s" % (version, sys.path[0])
|
||||
pprint.pprint(sys.path)
|
||||
print
|
||||
|
||||
# reset
|
||||
sys.path = savepath[:]
|
||||
global _selected
|
||||
_selected = None
|
||||
|
||||
|
||||
# make some test dirs
|
||||
@@ -181,6 +386,14 @@ if __name__ == '__main__':
|
||||
|
||||
|
||||
# now run some tests
|
||||
pprint.pprint( getInstalled())
|
||||
print checkInstalled("2.4")
|
||||
print checkInstalled("2.5-unicode")
|
||||
print checkInstalled("2.99-bogus")
|
||||
print "Current sys.path:"
|
||||
pprint.pprint(sys.path)
|
||||
print
|
||||
|
||||
test("2.4")
|
||||
test("2.5")
|
||||
test("2.5-gtk2")
|
||||
@@ -192,14 +405,21 @@ if __name__ == '__main__':
|
||||
# available 2.4. Should it give an error instead? I don't think so...
|
||||
test("2.4-unicode")
|
||||
|
||||
# Try asking for multiple versions
|
||||
test(["2.6", "2.5.3", "2.5.2-gtk2"])
|
||||
|
||||
try:
|
||||
# expecting an error on this one
|
||||
test("2.6")
|
||||
except AssertionError:
|
||||
print "Asked for 2.6:\t got: Assertion"
|
||||
except VersionError, e:
|
||||
print "Asked for 2.6:\t got Exception:", e
|
||||
|
||||
# Try asking for multiple versions
|
||||
test(["2.6", "2.5.3", "2.5.2-gtk2"])
|
||||
# check for exception when incompatible versions are requested
|
||||
try:
|
||||
select("2.4")
|
||||
select("2.5")
|
||||
except VersionError, e:
|
||||
print "Asked for incompatible versions, got Exception:", e
|
||||
|
||||
# cleanup
|
||||
for name in names:
|
||||
|
||||
Reference in New Issue
Block a user