Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Removed created icons in favour of pre-existing ones. Tried, unsucces…
…sfully to implement icon in wx.
  • Loading branch information
pelson authored and pelson committed Jul 29, 2012
1 parent 25df1bb commit c382f60
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 1,381 deletions.
82 changes: 0 additions & 82 deletions examples/api/mpl_icon.py

This file was deleted.

39 changes: 20 additions & 19 deletions lib/matplotlib/backends/backend_wx.py
@@ -1,8 +1,5 @@
from __future__ import division, print_function from __future__ import division, print_function
""" """
backend_wx.py
A wxPython backend for matplotlib, based (very heavily) on A wxPython backend for matplotlib, based (very heavily) on
backend_template.py and backend_gtk.py backend_template.py and backend_gtk.py
Expand All @@ -18,14 +15,17 @@
""" """


cvs_id = '$Id$' import sys
import os
import os.path
import math
import StringIO
import weakref
import warnings



import sys, os, os.path, math, StringIO, weakref, warnings
import numpy as np import numpy as np





# Debugging settings here... # Debugging settings here...
# Debug level set here. If the debug level is less than 5, information # Debug level set here. If the debug level is less than 5, information
# messages (progressively more info for lower value) are printed. In addition, # messages (progressively more info for lower value) are printed. In addition,
Expand Down Expand Up @@ -188,7 +188,6 @@ def __init__(self, parent, *args, **kwargs):


# Unbinding causes Wx to stop for some reason. Disabling for now. # Unbinding causes Wx to stop for some reason. Disabling for now.
# def __del__(self): # def __del__(self):
# import wx
# TimerBase.__del__(self) # TimerBase.__del__(self)
# self.parent.Bind(wx.EVT_TIMER, None, self._timer) # self.parent.Bind(wx.EVT_TIMER, None, self._timer)


Expand Down Expand Up @@ -410,7 +409,6 @@ def get_gc(self):
assert self.gc != None, "gc must be defined" assert self.gc != None, "gc must be defined"
return self.gc return self.gc



def get_wx_font(self, s, prop): def get_wx_font(self, s, prop):
""" """
Return a wx font. Cache instances in a font dictionary for Return a wx font. Cache instances in a font dictionary for
Expand Down Expand Up @@ -448,14 +446,14 @@ def get_wx_font(self, s, prop):


return font return font



def points_to_pixels(self, points): def points_to_pixels(self, points):
""" """
convert point measures to pixes using dpi and the pixels per convert point measures to pixes using dpi and the pixels per
inch of the display inch of the display
""" """
return points*(PIXELS_PER_INCH/72.0*self.dpi/72.0) return points*(PIXELS_PER_INCH/72.0*self.dpi/72.0)



class GraphicsContextWx(GraphicsContextBase): class GraphicsContextWx(GraphicsContextBase):
""" """
The graphics context provides the color, line styles, etc... The graphics context provides the color, line styles, etc...
Expand Down Expand Up @@ -627,6 +625,7 @@ def get_wxcolour(self, color):
a *= 255 a *= 255
return wx.Colour(red=int(r), green=int(g), blue=int(b), alpha=int(a)) return wx.Colour(red=int(r), green=int(g), blue=int(b), alpha=int(a))



class FigureCanvasWx(FigureCanvasBase, wx.Panel): class FigureCanvasWx(FigureCanvasBase, wx.Panel):
""" """
The FigureCanvas contains the figure and does event handling. The FigureCanvas contains the figure and does event handling.
Expand Down Expand Up @@ -1421,7 +1420,7 @@ def _create_wx_app():
# retain a reference to the app object so it does not get garbage # retain a reference to the app object so it does not get garbage
# collected and cause segmentation faults # collected and cause segmentation faults
_create_wx_app.theWxApp = wxapp _create_wx_app.theWxApp = wxapp



def draw_if_interactive(): def draw_if_interactive():
""" """
Expand Down Expand Up @@ -1512,6 +1511,15 @@ def __init__(self, num, fig):
self.Fit() self.Fit()


self.canvas.SetMinSize((2, 2)) self.canvas.SetMinSize((2, 2))

# give the window a matplotlib icon rather than the stock one.
# This is not currently working on Linux and is untested elsewhere.
#icon_path = os.path.join(matplotlib.rcParams['datapath'],
# 'images', 'matplotlib.png')
#icon = wx.IconFromBitmap(wx.Bitmap(icon_path))
# for xpm type icons try:
#icon = wx.Icon(icon_path, wx.BITMAP_TYPE_XPM)
#self.SetIcon(icon)


self.figmgr = FigureManagerWx(self.canvas, num, self) self.figmgr = FigureManagerWx(self.canvas, num, self)


Expand Down Expand Up @@ -1559,15 +1567,14 @@ def Destroy(self, *args, **kwargs):
wxapp.Yield() wxapp.Yield()
return True return True



class FigureManagerWx(FigureManagerBase): class FigureManagerWx(FigureManagerBase):
""" """
This class contains the FigureCanvas and GUI frame This class contains the FigureCanvas and GUI frame
It is instantiated by GcfWx whenever a new figure is created. GcfWx is It is instantiated by GcfWx whenever a new figure is created. GcfWx is
responsible for managing multiple instances of FigureManagerWx. responsible for managing multiple instances of FigureManagerWx.
NB: FigureManagerBase is found in _pylab_helpers
public attrs public attrs
canvas - a FigureCanvasWx(wx.Panel) instance canvas - a FigureCanvasWx(wx.Panel) instance
Expand Down Expand Up @@ -1599,7 +1606,6 @@ def destroy(self, *args):
DEBUG_MSG("destroy()", 1, self) DEBUG_MSG("destroy()", 1, self)
self.frame.Destroy() self.frame.Destroy()
#if self.tb is not None: self.tb.Destroy() #if self.tb is not None: self.tb.Destroy()
import wx
#wx.GetApp().ProcessIdle() #wx.GetApp().ProcessIdle()
wx.WakeUpIdle() wx.WakeUpIdle()


Expand Down Expand Up @@ -1939,11 +1945,6 @@ def set_history_buttons(self):


class NavigationToolbarWx(wx.ToolBar): class NavigationToolbarWx(wx.ToolBar):
def __init__(self, canvas, can_kill=False): def __init__(self, canvas, can_kill=False):
"""
figure is the Figure instance that the toolboar controls
win, if not None, is the wxWindow the Figure is embedded in
"""
wx.ToolBar.__init__(self, canvas.GetParent(), -1) wx.ToolBar.__init__(self, canvas.GetParent(), -1)
DEBUG_MSG("__init__()", 1, self) DEBUG_MSG("__init__()", 1, self)
self.canvas = canvas self.canvas = canvas
Expand Down
Binary file removed lib/matplotlib/mpl-data/images/logo.gif
Binary file not shown.
Binary file removed lib/matplotlib/mpl-data/images/logo.ico
Binary file not shown.
Binary file removed lib/matplotlib/mpl-data/images/logo.png
Binary file not shown.
5 changes: 0 additions & 5 deletions lib/matplotlib/mpl-data/images/logo.ppm

This file was deleted.

0 comments on commit c382f60

Please sign in to comment.