Permalink
Browse files

Removed created icons in favour of pre-existing ones. Tried, unsucces…

…sfully to implement icon in wx.
  • Loading branch information...
1 parent 25df1bb commit c382f608aa991b9c924c64ba18df750a02323d81 pelson committed with pelson May 24, 2012
View
@@ -1,82 +0,0 @@
-"""
-Thanks to Tony Yu <tsyu80@gmail.com> for the logo design
-"""
-
-import numpy as np
-import matplotlib as mpl
-import matplotlib.pyplot as plt
-import matplotlib.cm as cm
-
-mpl.rcParams['xtick.labelsize'] = 10
-mpl.rcParams['ytick.labelsize'] = 12
-mpl.rcParams['axes.edgecolor'] = 'gray'
-
-
-axalpha = 0.05
-figcolor = 'white'
-dpi = 124
-fig = plt.figure(figsize=(1, 1), dpi=dpi)
-#fig.figurePatch.set_edgecolor(figcolor)
-#fig.figurePatch.set_facecolor(figcolor)
-fig.figurePatch.set_alpha(0)
-
-
-def add_math_background():
- ax = fig.add_axes([0., 0., 1., 1.])
-
- text = []
- #text.append((r"$W^{3\beta}_{\delta_1 \rho_1 \sigma_2} = U^{3\beta}_{\delta_1 \rho_1} + \frac{1}{8 \pi 2} \int^{\alpha_2}_{\alpha_2} d \alpha^\prime_2 \left[\frac{ U^{2\beta}_{\delta_1 \rho_1} - \alpha^\prime_2U^{1\beta}_{\rho_1 \sigma_2} }{U^{0\beta}_{\rho_1 \sigma_2}}\right]$", (0.7, 0.2), 20))
- #text.append((r"$\frac{d\rho}{d t} + \rho \vec{v}\cdot\nabla\vec{v} = -\nabla p + \mu\nabla^2 \vec{v} + \rho \vec{g}$",
- # (0.35, 0.9), 20))
- text.append((r"$\int_{-\infty}^\infty e^{-x^2}dx=\sqrt{\pi}$",
- (-0.1, 0.75), 14))
- text.append((r"$E = mc^2 = \sqrt{{m_0}^2c^4 + p^2c^2}$",
- (0.05, 0.2), 12))
- text.append((r"$F_G = G\frac{m_1m_2}{r^2}$",
- (0.4, 0.46), 12))
- for eq, (x, y), size in text:
- ax.text(x, y, eq, ha='left', va='center', color="#11557c", alpha=0.25,
- transform=ax.transAxes, fontsize=size)
- ax.set_axis_off()
- return ax
-
-def add_matplotlib_text(ax):
- ax.text(0.95, 0.5, 'matplotlib', color='#11557c', fontsize=65,
- ha='right', va='center', alpha=1.0, transform=ax.transAxes)
-
-def add_polar_bar():
- ax = fig.add_axes([0.05, 0.05, 0.9, 0.9], polar=True, resolution=50)
- ax.axesPatch.set_facecolor('white')
-
- # ax.axesPatch.set_alpha(axalpha)
- ax.set_axisbelow(True)
- N = 7
- arc = 2. * np.pi
- theta = np.arange(0.0, arc, arc/N)
- radii = 10 * np.array([0.2, 0.6, 0.8, 0.7, 0.4, 0.5, 0.8])
- width = np.pi / 4 * np.array([0.4, 0.4, 0.6, 0.8, 0.2, 0.5, 0.3])
- bars = ax.bar(theta, radii, width=width, bottom=0.0)
- for r, bar in zip(radii, bars):
- bar.set_facecolor(cm.jet(r/10.))
- bar.set_alpha(0.6)
-
- for label in ax.get_xticklabels() + ax.get_yticklabels():
- label.set_visible(False)
-
- for line in ax.get_ygridlines() + ax.get_xgridlines():
- line.set_lw(0.8)
- line.set_alpha(0.9)
- line.set_ls('-')
- line.set_color('0.5')
-
- ax.set_yticks(np.arange(1, 9, 2))
- ax.set_rmax(9)
-
-if __name__ == '__main__':
- #main_axes = add_math_background()
- add_polar_bar()
- #add_matplotlib_text(main_axes)
- plt.savefig('foo.png', dpi=dpi, )#transparent=True)
- #plt.show()
-
-
@@ -1,8 +1,5 @@
from __future__ import division, print_function
"""
-
- backend_wx.py
-
A wxPython backend for matplotlib, based (very heavily) on
backend_template.py and backend_gtk.py
@@ -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
-
# Debugging settings here...
# Debug level set here. If the debug level is less than 5, information
# messages (progressively more info for lower value) are printed. In addition,
@@ -188,7 +188,6 @@ def __init__(self, parent, *args, **kwargs):
# Unbinding causes Wx to stop for some reason. Disabling for now.
# def __del__(self):
-# import wx
# TimerBase.__del__(self)
# self.parent.Bind(wx.EVT_TIMER, None, self._timer)
@@ -410,7 +409,6 @@ def get_gc(self):
assert self.gc != None, "gc must be defined"
return self.gc
-
def get_wx_font(self, s, prop):
"""
Return a wx font. Cache instances in a font dictionary for
@@ -448,14 +446,14 @@ def get_wx_font(self, s, prop):
return font
-
def points_to_pixels(self, points):
"""
convert point measures to pixes using dpi and the pixels per
inch of the display
"""
return points*(PIXELS_PER_INCH/72.0*self.dpi/72.0)
+
class GraphicsContextWx(GraphicsContextBase):
"""
The graphics context provides the color, line styles, etc...
@@ -627,6 +625,7 @@ def get_wxcolour(self, color):
a *= 255
return wx.Colour(red=int(r), green=int(g), blue=int(b), alpha=int(a))
+
class FigureCanvasWx(FigureCanvasBase, wx.Panel):
"""
The FigureCanvas contains the figure and does event handling.
@@ -1421,7 +1420,7 @@ def _create_wx_app():
# retain a reference to the app object so it does not get garbage
# collected and cause segmentation faults
_create_wx_app.theWxApp = wxapp
-
+
def draw_if_interactive():
"""
@@ -1512,6 +1511,15 @@ def __init__(self, num, fig):
self.Fit()
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)
@@ -1559,15 +1567,14 @@ def Destroy(self, *args, **kwargs):
wxapp.Yield()
return True
+
class FigureManagerWx(FigureManagerBase):
"""
This class contains the FigureCanvas and GUI frame
It is instantiated by GcfWx whenever a new figure is created. GcfWx is
responsible for managing multiple instances of FigureManagerWx.
- NB: FigureManagerBase is found in _pylab_helpers
-
public attrs
canvas - a FigureCanvasWx(wx.Panel) instance
@@ -1599,7 +1606,6 @@ def destroy(self, *args):
DEBUG_MSG("destroy()", 1, self)
self.frame.Destroy()
#if self.tb is not None: self.tb.Destroy()
- import wx
#wx.GetApp().ProcessIdle()
wx.WakeUpIdle()
@@ -1939,11 +1945,6 @@ def set_history_buttons(self):
class NavigationToolbarWx(wx.ToolBar):
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)
DEBUG_MSG("__init__()", 1, self)
self.canvas = canvas
Deleted file not rendered
Binary file not shown.
Deleted file not rendered

Large diffs are not rendered by default.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit c382f60

Please sign in to comment.