|
From: <pki...@us...> - 2007-07-16 02:16:23
|
Revision: 3534
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3534&view=rev
Author: pkienzle
Date: 2007-07-15 19:16:22 -0700 (Sun, 15 Jul 2007)
Log Message:
-----------
Don't release mouse unless it is captured
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2007-07-16 00:40:38 UTC (rev 3533)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2007-07-16 02:16:22 UTC (rev 3534)
@@ -1177,7 +1177,7 @@
x = evt.GetX()
y = self.figure.bbox.height() - evt.GetY()
evt.Skip()
- self.ReleaseMouse()
+ if self.HasCapture(): self.ReleaseMouse()
FigureCanvasBase.button_release_event(self, x, y, 3, guiEvent=evt)
def _onLeftButtonDown(self, evt):
@@ -1194,7 +1194,7 @@
y = self.figure.bbox.height() - evt.GetY()
#print 'release button', 1
evt.Skip()
- self.ReleaseMouse()
+ if self.HasCapture(): self.ReleaseMouse()
FigureCanvasBase.button_release_event(self, x, y, 1, guiEvent=evt)
def _onMouseWheel(self, evt):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2007-11-14 19:07:01
|
Revision: 4287
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4287&view=rev
Author: mdboom
Date: 2007-11-14 11:06:52 -0800 (Wed, 14 Nov 2007)
Log Message:
-----------
Fix placement of rotated text in Wx backend (thanks Michael Day).
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2007-11-14 18:44:39 UTC (rev 4286)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2007-11-14 19:06:52 UTC (rev 4287)
@@ -381,7 +381,12 @@
y = int(y-h)
if angle!=0:
- try: gc.DrawRotatedText(s, x, y, angle)
+ # Correct for the fact that text if rotated around the upper-left corner,
+ # rather than the lower-left corner as we expect.
+ rads = angle / 180.0 * math.pi
+ xo = h * math.sin(rads)
+ yo = h * math.cos(rads)
+ try: gc.DrawRotatedText(s, x - xo, y - yo, angle)
except:
verbose.print_error(exception_to_str('WX rotated text failed'))
else:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pki...@us...> - 2008-02-05 23:17:38
|
Revision: 4943
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4943&view=rev
Author: pkienzle
Date: 2008-02-05 15:17:34 -0800 (Tue, 05 Feb 2008)
Log Message:
-----------
Move flush_events to canvas as in other backends; remove Yield loop on gui_repaint; fix showfig callback in FigureManager
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-02-05 21:52:04 UTC (rev 4942)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-02-05 23:17:34 UTC (rev 4943)
@@ -889,6 +889,9 @@
if repaint:
self.gui_repaint()
+ def flush_events(self):
+ wx.Yield()
+
def _get_imagesave_wildcards(self):
'return the wildcard string for the filesave dialog'
default_filetype = self.get_default_filetype()
@@ -921,7 +924,7 @@
drawDC.BeginDrawing()
drawDC.DrawBitmap(self.bitmap, 0, 0)
drawDC.EndDrawing()
- wx.GetApp().Yield()
+ #wx.GetApp().Yield()
filetypes = FigureCanvasBase.filetypes.copy()
filetypes['bmp'] = 'Windows bitmap'
@@ -1301,9 +1304,6 @@
wxapp.Yield()
return True
- def flush_events(self):
- wx.Yield()
-
class FigureManagerWx(FigureManagerBase):
"""
This class contains the FigureCanvas and GUI frame
@@ -1332,9 +1332,9 @@
self.canvas.figure.add_axobserver(notify_axes_change)
def showfig(*args):
- figwin.frame.Show()
- figwin.canvas.realize()
- figwin.canvas.draw()
+ frame.Show()
+ canvas.realize()
+ canvas.draw()
# attach a show method to the figure
self.canvas.figure.show = showfig
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-04-24 12:20:40
|
Revision: 5067
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5067&view=rev
Author: mdboom
Date: 2008-04-24 05:20:23 -0700 (Thu, 24 Apr 2008)
Log Message:
-----------
Fix clipping bug in Wx backend.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-04-23 17:44:15 UTC (rev 5066)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-04-24 12:20:23 UTC (rev 5067)
@@ -283,13 +283,14 @@
if new_bounds is not None:
new_bounds = new_bounds.bounds
gfx_ctx = gc.gfx_ctx
- if gfx_ctx._lastcliprect != new_bounds:
+ if True or gfx_ctx._lastcliprect != new_bounds:
gfx_ctx._lastcliprect = new_bounds
if new_bounds is None:
gfx_ctx.ResetClip()
else:
- gfx_ctx.Clip(*new_bounds)
-
+ gfx_ctx.Clip(new_bounds[0], self.height - new_bounds[1] - new_bounds[3],
+ new_bounds[1], new_bounds[3])
+
#@staticmethod
def convert_path(gfx_ctx, tpath):
wxpath = gfx_ctx.CreatePath()
@@ -306,7 +307,7 @@
wxpath.CloseSubpath()
return wxpath
convert_path = staticmethod(convert_path)
-
+
def draw_path(self, gc, path, transform, rgbFace=None):
gc.select()
self.handle_clip_rectangle(gc)
@@ -331,7 +332,7 @@
gc.select()
self.handle_clip_rectangle(gc)
gfx_ctx = gc.gfx_ctx
-
+
font = self.get_wx_font(s, prop)
color = gc.get_wxcolour(gc.get_rgb())
gfx_ctx.SetFont(font, color)
@@ -347,7 +348,7 @@
xo = h * math.sin(rads)
yo = h * math.cos(rads)
gfx_ctx.DrawRotatedText(s, x - xo, y - yo, rads)
-
+
gc.unselect()
def new_gc(self):
@@ -423,7 +424,7 @@
wxGraphicsContext that draws to it. Creating a wxGraphicsContext
seems to be fairly heavy, so these objects are cached based on the
bitmap object that is passed in.
-
+
The base GraphicsContext stores colors as a RGB tuple on the unit
interval, eg, (0.5, 0.0, 1.0). wxPython uses an int interval, but
since wxPython colour management is rather simple, I have not chosen
@@ -442,7 +443,7 @@
'dashdot': wx.DOT_DASH,
'dotted': wx.DOT }
_cache = weakref.WeakKeyDictionary()
-
+
def __init__(self, bitmap, renderer):
GraphicsContextBase.__init__(self)
#assert self.Ok(), "wxMemoryDC not OK to use"
@@ -455,7 +456,7 @@
gfx_ctx = wx.GraphicsContext.Create(dc)
gfx_ctx._lastcliprect = None
self._cache[bitmap] = dc, gfx_ctx
-
+
self.bitmap = bitmap
self.dc = dc
self.gfx_ctx = gfx_ctx
@@ -463,7 +464,7 @@
gfx_ctx.SetPen(self._pen)
self._style = wx.SOLID
self.renderer = renderer
-
+
def select(self):
"""
Select the current bitmap into this wxDC instance
@@ -720,7 +721,7 @@
self.macros = {} # dict from wx id to seq of macros
self.Printer_Init()
-
+
def Destroy(self, *args, **kwargs):
wx.Panel.Destroy(self, *args, **kwargs)
@@ -877,7 +878,7 @@
def draw_idle(self, *args, **kwargs):
pass
-
+
def draw(self, repaint=True):
"""
Render the figure using RendererWx instance renderer, or using a
@@ -891,7 +892,7 @@
def flush_events(self):
wx.Yield()
-
+
def _get_imagesave_wildcards(self):
'return the wildcard string for the filesave dialog'
default_filetype = self.get_default_filetype()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-05-25 01:30:33
|
Revision: 5256
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5256&view=rev
Author: jdh2358
Date: 2008-05-24 18:30:32 -0700 (Sat, 24 May 2008)
Log Message:
-----------
added tonys wx loan icon patch
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-05-24 21:05:14 UTC (rev 5255)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-05-25 01:30:32 UTC (rev 5256)
@@ -1383,9 +1383,6 @@
matplotlib library is installed. The filename parameter should not
contain any path information as this is determined automatically.
- Bitmaps should be in XPM format, and of size 16x16 (unless you change
- the code!). I have converted the stock GTK2 16x16 icons to XPM format.
-
Returns a wx.Bitmap object
"""
@@ -1395,27 +1392,9 @@
if not os.path.exists(bmpFilename):
raise IOError('Could not find bitmap file "%s"; dying'%bmpFilename)
- bmp =wx.Bitmap(bmpFilename, wx.BITMAP_TYPE_XPM)
+ bmp = wx.Bitmap(bmpFilename)
return bmp
-def _load_pngicon(filename):
- """
- Load a png icon file from the backends/images subdirectory in which the
- matplotlib library is installed. The filename parameter should not
- contain any path information as this is determined automatically.
-
- Returns a wx.Bitmap object
- """
-
- basedir = os.path.join(rcParams['datapath'],'images')
-
- pngFilename = os.path.normpath(os.path.join(basedir, filename))
- if not os.path.exists(pngFilename):
- raise IOError('Could not find bitmap file "%s"; dying'%pngFilename)
-
- png =wx.Bitmap(pngFilename, wx.BITMAP_TYPE_PNG)
- return png
-
class MenuButtonWx(wx.Button):
"""
wxPython does not permit a menu to be incorporated directly into a toolbar.
@@ -1576,24 +1555,24 @@
self.SetToolBitmapSize(wx.Size(24,24))
- self.AddSimpleTool(_NTB2_HOME, _load_pngicon('home.png'),
+ self.AddSimpleTool(_NTB2_HOME, _load_bitmap('home.png'),
'Home', 'Reset original view')
- self.AddSimpleTool(self._NTB2_BACK, _load_pngicon('back.png'),
+ self.AddSimpleTool(self._NTB2_BACK, _load_bitmap('back.png'),
'Back', 'Back navigation view')
- self.AddSimpleTool(self._NTB2_FORWARD, _load_pngicon('forward.png'),
+ self.AddSimpleTool(self._NTB2_FORWARD, _load_bitmap('forward.png'),
'Forward', 'Forward navigation view')
# todo: get new bitmap
- self.AddCheckTool(self._NTB2_PAN, _load_pngicon('move.png'),
+ self.AddCheckTool(self._NTB2_PAN, _load_bitmap('move.png'),
shortHelp='Pan',
longHelp='Pan with left, zoom with right')
- self.AddCheckTool(self._NTB2_ZOOM, _load_pngicon('zoom_to_rect.png'),
+ self.AddCheckTool(self._NTB2_ZOOM, _load_bitmap('zoom_to_rect.png'),
shortHelp='Zoom', longHelp='Zoom to rectangle')
self.AddSeparator()
- self.AddSimpleTool(_NTB2_SUBPLOT, _load_pngicon('subplots.png'),
+ self.AddSimpleTool(_NTB2_SUBPLOT, _load_bitmap('subplots.png'),
'Configure subplots', 'Configure subplot parameters')
- self.AddSimpleTool(_NTB2_SAVE, _load_pngicon('filesave.png'),
+ self.AddSimpleTool(_NTB2_SAVE, _load_bitmap('filesave.png'),
'Save', 'Save plot contents to file')
if wx.VERSION_STRING >= '2.5':
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-06-10 14:29:49
|
Revision: 5459
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5459&view=rev
Author: jdh2358
Date: 2008-06-10 07:29:43 -0700 (Tue, 10 Jun 2008)
Log Message:
-----------
implemented a warning for the wx sizer func if we cant find a match
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-06-10 14:25:49 UTC (rev 5458)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-06-10 14:29:43 UTC (rev 5459)
@@ -94,7 +94,7 @@
cvs_id = '$Id$'
-import sys, os, os.path, math, StringIO, weakref
+import sys, os, os.path, math, StringIO, weakref, warnings
# Debugging settings here...
# Debug level set here. If the debug level is less than 5, information
@@ -1235,7 +1235,9 @@
self.SetStatusBar(statbar)
self.canvas = self.get_canvas(fig)
- def do_nothing(*args, **kwargs): pass
+ def do_nothing(*args, **kwargs):
+ warnings.warn('could not find a SetSizeFunc for backend_wx; please report your wxpython version=%s to the matplotlib developers list'%backend_version)
+ pass
# try to find the set size func across wx versions
self.SetSizeFunc = getattr(self.canvas, 'SetInitialSize',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-06-12 19:48:48
|
Revision: 5494
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5494&view=rev
Author: jdh2358
Date: 2008-06-12 12:48:23 -0700 (Thu, 12 Jun 2008)
Log Message:
-----------
applied stand setinitialsize fix
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-06-12 19:35:41 UTC (rev 5493)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-06-12 19:48:23 UTC (rev 5494)
@@ -678,6 +678,17 @@
h = int(math.ceil(h))
wx.Panel.__init__(self, parent, id, size=wx.Size(w, h))
+
+ def do_nothing(*args, **kwargs):
+ warnings.warn('could not find a setinitialsize function for backend_wx; please report your wxpython version=%s to the matplotlib developers list'%backend_version)
+ pass
+
+ # try to find the set size func across wx versions
+ try:
+ getattr(self, 'SetInitialSize')
+ except AttributeError:
+ self.SetInitialSize = getattr(self, 'SetBestFittingSize', do_nothing)
+
# Create the drawing bitmap
self.bitmap =wx.EmptyBitmap(w, h)
DEBUG_MSG("__init__() - bitmap w:%d h:%d" % (w,h), 2, self)
@@ -1234,15 +1245,7 @@
statbar = StatusBarWx(self)
self.SetStatusBar(statbar)
self.canvas = self.get_canvas(fig)
-
- def do_nothing(*args, **kwargs):
- warnings.warn('could not find a SetSizeFunc for backend_wx; please report your wxpython version=%s to the matplotlib developers list'%backend_version)
- pass
-
- # try to find the set size func across wx versions
- self.SetSizeFunc = getattr(self.canvas, 'SetInitialSize',
- getattr(self.canvas, 'SetBestFittingSize', do_nothing))
- self.SetSizeFunc(wx.Size(fig.bbox.width, fig.bbox.height))
+ self.canvas.SetInitialSize(wx.Size(fig.bbox.width, fig.bbox.height))
self.sizer =wx.BoxSizer(wx.VERTICAL)
self.sizer.Add(self.canvas, 1, wx.TOP | wx.LEFT | wx.EXPAND)
# By adding toolbar in sizer, we are able to put it at the bottom
@@ -1363,7 +1366,7 @@
def resize(self, width, height):
'Set the canvas size in pixels'
- self.canvas.SetSizeFunc(wx.Size(width, height))
+ self.canvas.SetInitialSize(wx.Size(width, height))
self.window.GetSizer().Fit(self.window)
# Identifiers for toolbar controls - images_wx contains bitmaps for the images
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-06-18 17:23:02
|
Revision: 5587
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5587&view=rev
Author: mdboom
Date: 2008-06-18 10:20:40 -0700 (Wed, 18 Jun 2008)
Log Message:
-----------
Fix wx backend clipping bug.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-06-17 21:01:29 UTC (rev 5586)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-06-18 17:20:40 UTC (rev 5587)
@@ -283,13 +283,13 @@
if new_bounds is not None:
new_bounds = new_bounds.bounds
gfx_ctx = gc.gfx_ctx
- if True or gfx_ctx._lastcliprect != new_bounds:
+ if gfx_ctx._lastcliprect != new_bounds:
gfx_ctx._lastcliprect = new_bounds
if new_bounds is None:
gfx_ctx.ResetClip()
else:
gfx_ctx.Clip(new_bounds[0], self.height - new_bounds[1] - new_bounds[3],
- new_bounds[1], new_bounds[3])
+ new_bounds[2], new_bounds[3])
#@staticmethod
def convert_path(gfx_ctx, tpath):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|