Added patches for fixing crash in GetXWindow() and wx.lib.plot bugs

This commit is contained in:
Scott Talbert 2015-01-04 21:25:46 -05:00
commit 26b05c42b7
3 changed files with 127 additions and 1 deletions

View file

@ -0,0 +1,26 @@
diff -up wxPython-src-3.0.2.0/wxPython/src/helpers.cpp.getxwindowcrash wxPython-src-3.0.2.0/wxPython/src/helpers.cpp
--- wxPython-src-3.0.2.0/wxPython/src/helpers.cpp.getxwindowcrash 2014-10-13 18:37:52.000000000 -0400
+++ wxPython-src-3.0.2.0/wxPython/src/helpers.cpp 2015-01-03 22:05:35.936010783 -0500
@@ -29,9 +29,19 @@
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#ifdef __WXGTK3__
-#define GetXWindow(wxwin) (wxwin)->m_wxwindow ? \
- GDK_WINDOW_XID(gtk_widget_get_window((wxwin)->m_wxwindow)) : \
- GDK_WINDOW_XID(gtk_widget_get_window((wxwin)->m_widget))
+// Unlike GDK_WINDOW_XWINDOW, GDK_WINDOW_XID can't handle a NULL, so check 1st
+static XID GetXWindow(wxWindow* wxwin) {
+ if ((wxwin)->m_wxwindow) {
+ if (gtk_widget_get_window((wxwin)->m_wxwindow))
+ return GDK_WINDOW_XID(gtk_widget_get_window((wxwin)->m_wxwindow));
+ return 0;
+ }
+ else {
+ if (gtk_widget_get_window((wxwin)->m_widget))
+ return GDK_WINDOW_XID(gtk_widget_get_window((wxwin)->m_widget));
+ return 0;
+ }
+}
#else
#define GetXWindow(wxwin) (wxwin)->m_wxwindow ? \
GDK_WINDOW_XWINDOW((wxwin)->m_wxwindow->window) : \

View file

@ -0,0 +1,91 @@
diff -up wxPython-src-3.0.2.0/wxPython/wx/lib/plot.py.plot wxPython-src-3.0.2.0/wxPython/wx/lib/plot.py
--- wxPython-src-3.0.2.0/wxPython/wx/lib/plot.py.plot 2014-10-13 18:37:22.000000000 -0400
+++ wxPython-src-3.0.2.0/wxPython/wx/lib/plot.py 2015-01-04 20:38:04.645350202 -0500
@@ -237,7 +237,7 @@ class PolyLine(PolyPoints):
:keyword `attr`: keyword attributes, default to:
========================== ================================
- 'colour'= 'black' wx.Pen Colour any wx.Colour
+ 'colour'= 'black' wx.Pen Colour any wx.NamedColour
'width'= 1 Pen width
'style'= wx.PENSTYLE_SOLID wx.Pen style
'legend'= '' Line Legend to display
@@ -251,7 +251,7 @@ class PolyLine(PolyPoints):
width = self.attributes['width'] * printerScale * self._pointSize[0]
style = self.attributes['style']
if not isinstance(colour, wx.Colour):
- colour = wx.Colour(colour)
+ colour = wx.NamedColour(colour)
pen = wx.Pen(colour, width, style)
pen.SetCap(wx.CAP_BUTT)
dc.SetPen(pen)
@@ -287,7 +287,7 @@ class PolySpline(PolyLine):
:keyword `attr`: keyword attributes, default to:
========================== ================================
- 'colour'= 'black' wx.Pen Colour any wx.Colour
+ 'colour'= 'black' wx.Pen Colour any wx.NamedColour
'width'= 1 Pen width
'style'= wx.PENSTYLE_SOLID wx.Pen style
'legend'= '' Line Legend to display
@@ -301,7 +301,7 @@ class PolySpline(PolyLine):
width = self.attributes['width'] * printerScale * self._pointSize[0]
style = self.attributes['style']
if not isinstance(colour, wx.Colour):
- colour = wx.Colour(colour)
+ colour = wx.NamedColour(colour)
pen = wx.Pen(colour, width, style)
pen.SetCap(wx.CAP_ROUND)
dc.SetPen(pen)
@@ -365,9 +365,9 @@ class PolyMarker(PolyPoints):
marker = self.attributes['marker']
if colour and not isinstance(colour, wx.Colour):
- colour = wx.Colour(colour)
+ colour = wx.NamedColour(colour)
if fillcolour and not isinstance(fillcolour, wx.Colour):
- fillcolour = wx.Colour(fillcolour)
+ fillcolour = wx.NamedColour(fillcolour)
dc.SetPen(wx.Pen(colour, width))
if fillcolour:
@@ -595,9 +595,9 @@ class PlotCanvas(wx.Panel):
# set curser as cross-hairs
self.canvas.SetCursor(wx.CROSS_CURSOR)
- self.HandCursor = wx.Cursor(Hand.GetImage())
- self.GrabHandCursor = wx.Cursor(GrabHand.GetImage())
- self.MagCursor = wx.Cursor(MagPlus.GetImage())
+ self.HandCursor = wx.CursorFromImage(Hand.GetImage())
+ self.GrabHandCursor = wx.CursorFromImage(GrabHand.GetImage())
+ self.MagCursor = wx.CursorFromImage(MagPlus.GetImage())
# Things for printing
self._print_data = None
@@ -681,7 +681,7 @@ class PlotCanvas(wx.Panel):
if isinstance(colour, wx.Colour):
self._gridColour = colour
else:
- self._gridColour = wx.Colour(colour)
+ self._gridColour = wx.NamedColour(colour)
# SaveFile
def SaveFile(self, fileName=''):
@@ -1513,7 +1513,7 @@ class PlotCanvas(wx.Panel):
# Make new offscreen bitmap: this bitmap will always have the
# current drawing in it, so it can be used to save the image to
# a file, or whatever.
- self._Buffer = wx.Bitmap(Size.width, Size.height)
+ self._Buffer = wx.EmptyBitmap(Size.width, Size.height)
self._setSize()
self.last_PointLabel = None # reset pointLabel
@@ -1578,7 +1578,7 @@ class PlotCanvas(wx.Panel):
width = self._Buffer.GetWidth()
height = self._Buffer.GetHeight()
if sys.platform != "darwin":
- tmp_Buffer = wx.Bitmap(width, height)
+ tmp_Buffer = wx.EmptyBitmap(width, height)
dcs = wx.MemoryDC()
dcs.SelectObject(tmp_Buffer)
dcs.Clear()

View file

@ -5,7 +5,7 @@
Name: wxPython
Version: 3.0.2.0
Release: 1%{?dist}
Release: 2%{?dist}
Summary: GUI toolkit for the Python programming language
@ -17,6 +17,10 @@ Source0: http://downloads.sourceforge.net/wxpython/%{name}-src-%{version}
# Debian for the patch.
Patch0: fix-editra-removal.patch
Patch1: wxPython-3.0.0.0-format.patch
# http://trac.wxwidgets.org/ticket/16765
Patch2: wxPython-3.0.2.0-getxwindowcrash.patch
# http://trac.wxwidgets.org/ticket/16767
Patch3: wxPython-3.0.2.0-plot.patch
# make sure to keep this updated as appropriate
BuildRequires: wxGTK3-devel >= 3.0.0
BuildRequires: python-devel
@ -55,6 +59,8 @@ Documentation, samples and demo application for wxPython.
%setup -q -n wxPython-src-%{version}
%patch0 -p1 -b .editra-removal
%patch1 -p1 -b .format
%patch2 -p1 -b .getxwindowcrash
%patch3 -p1 -b .plot
# fix libdir otherwise additional wx libs cannot be found, fix default optimization flags
sed -i -e 's|/usr/lib|%{_libdir}|' -e 's|-O3|-O2|' wxPython/config.py
@ -105,6 +111,9 @@ mv $RPM_BUILD_ROOT%{python_sitelib}/wxversion.py* $RPM_BUILD_ROOT%{python_sitear
%changelog
* Sun Jan 04 2015 Scott Talbert <swt@techie.net> - 3.0.2.0-2
- Added patches for fixing crash in GetXWindow() and wx.lib.plot bugs
* Tue Dec 23 2014 Scott Talbert <swt@techie.net> - 3.0.2.0-1
- New upstream release 3.0.2.0, built against wxGTK3