FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Yafli by ddale · Pull Request #46 · matplotlib/matplotlib · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
68 changes: 38 additions & 30 deletions lib/matplotlib/backends/backend_qt4.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@
from matplotlib.figure import Figure
from matplotlib.mathtext import MathTextParser
from matplotlib.widgets import SubplotTool
import matplotlib.backends.qt4_editor.figureoptions as figureoptions
try:
import matplotlib.backends.qt4_editor.figureoptions as figureoptions
except ImportError:
figureoptions = None
figureoptions = None

print figureoptions

try:
from PyQt4 import QtCore, QtGui, Qt
Expand Down Expand Up @@ -424,9 +430,10 @@ def _init_toolbar(self):
self.configure_subplots)
a.setToolTip('Configure subplots')

a = self.addAction(self._icon("qt4_editor_options.svg"),
'Customize', self.edit_parameters)
a.setToolTip('Edit curves line and axes parameters')
if figureoptions is not None:
a = self.addAction(self._icon("qt4_editor_options.svg"),
'Customize', self.edit_parameters)
a.setToolTip('Edit curves line and axes parameters')

a = self.addAction(self._icon('filesave.svg'), 'Save',
self.save_figure)
Expand All @@ -451,34 +458,35 @@ def _init_toolbar(self):
# reference holder for subplots_adjust window
self.adj_window = None

def edit_parameters(self):
allaxes = self.canvas.figure.get_axes()
if len(allaxes) == 1:
axes = allaxes[0]
else:
titles = []
for axes in allaxes:
title = axes.get_title()
ylabel = axes.get_ylabel()
if title:
text = title
if ylabel:
text += ": "+ylabel
text += " (%s)"
elif ylabel:
text = "%%s (%s)" % ylabel
else:
text = "%s"
titles.append(text % repr(axes))
item, ok = QtGui.QInputDialog.getItem(self, 'Customize',
'Select axes:', titles,
0, False)
if ok:
axes = allaxes[titles.index(unicode(item))]
if figureoptions is not None:
def edit_parameters(self):
allaxes = self.canvas.figure.get_axes()
if len(allaxes) == 1:
axes = allaxes[0]
else:
return
titles = []
for axes in allaxes:
title = axes.get_title()
ylabel = axes.get_ylabel()
if title:
text = title
if ylabel:
text += ": "+ylabel
text += " (%s)"
elif ylabel:
text = "%%s (%s)" % ylabel
else:
text = "%s"
titles.append(text % repr(axes))
item, ok = QtGui.QInputDialog.getItem(self, 'Customize',
'Select axes:', titles,
0, False)
if ok:
axes = allaxes[titles.index(unicode(item))]
else:
return

figureoptions.figure_edit(axes, self)
figureoptions.figure_edit(axes, self)


def dynamic_update( self ):
Expand Down

Back | FazBrowse Home | New Git URL