Index: mpl/trunk/matplotlib/CHANGELOG
===================================================================
--- mpl/trunk/matplotlib/CHANGELOG (revision 8214)
+++ mpl/trunk/matplotlib/CHANGELOG (working copy)
@@ -1,3 +1,5 @@
+2010-03-28 some bugfixes and enhancements to Qt4Agg popup plot options. -PBH
+
2010-03-24 refactor colorbar code so that no cla() is necessary when
mappable is changed. -JJL
Index: mpl/trunk/matplotlib/lib/matplotlib/backends/qt4_editor/figureoptions.py
===================================================================
--- mpl/trunk/matplotlib/lib/matplotlib/backends/qt4_editor/figureoptions.py (revision 8214)
+++ mpl/trunk/matplotlib/lib/matplotlib/backends/qt4_editor/figureoptions.py (working copy)
@@ -17,40 +17,41 @@
return QIcon(osp.join(basedir, name))
LINESTYLES = {
- '-': 'Solid',
- '--': 'Dashed',
- '-.': 'DashDot',
- ':': 'Dotted',
- 'steps': 'Steps',
+ '-': 'solid "-"',
+ '--': 'dashed "--"',
+ '-.': 'dash_dot "-."',
+ ':': 'dotted ":"',
+ #'steps': 'Steps',
'none': 'None',
}
MARKERS = {
'none': 'None',
- 'o': 'circles',
- '^': 'triangle_up',
- 'v': 'triangle_down',
- '<': 'triangle_left',
- '>': 'triangle_right',
- 's': 'square',
- '+': 'plus',
- 'x': 'cross',
- '*': 'star',
- 'D': 'diamond',
- 'd': 'thin_diamond',
- '1': 'tripod_down',
- '2': 'tripod_up',
- '3': 'tripod_left',
- '4': 'tripod_right',
- 'h': 'hexagon',
- 'H': 'rotated_hexagon',
- 'p': 'pentagon',
- '|': 'vertical_line',
- '_': 'horizontal_line',
- '.': 'dots',
+ 'o': 'circle "o"',
+ '^': 'triangle_up "^"',
+ 'v': 'triangle_down "v"',
+ '<': 'triangle_left "<"',
+ '>': 'triangle_right ">"',
+ 's': 'square "s"',
+ '+': 'plus "+"',
+ 'x': 'cross "x"',
+ '*': 'star "*"',
+ 'D': 'diamond "D"',
+ 'd': 'thin_diamond "d"',
+ '1': 'tripod_down "1"',
+ '2': 'tripod_up "2"',
+ '3': 'tripod_left "3"',
+ '4': 'tripod_right "4"',
+ 'h': 'hexagon "h"',
+ 'H': 'rotated_hexagon "H"',
+ 'p': 'pentagon "p"',
+ '|': 'vertical_line "|"',
+ '_': 'horizontal_line "_"',
+ '.': 'dot "."',
+ ',': 'pixel ","',
}
-COLORS = {'b': '#0000ff', 'g': '#00ff00', 'r': '#ff0000', 'c': '#ff00ff',
+COLORS = {'b': '#0000ff', 'g': '#008000', 'r': '#ff0000', 'c': '#ff00ff',
'm': '#ff00ff', 'y': '#ffff00', 'k': '#000000', 'w': '#ffffff'}
def col2hex(color):
@@ -62,11 +63,13 @@
sep = (None, None) # separator
has_curve = len(axes.get_lines()) > 0
+ has_legend = (axes.legend_ is not None)
# Get / General
xmin, xmax = axes.get_xlim()
ymin, ymax = axes.get_ylim()
general = [('Title', axes.get_title()),
+ ('Legend', has_legend),
sep,
(None, "X-Axis"),
('Min', xmin), ('Max', xmax),
@@ -84,17 +87,18 @@
linedict = {}
for line in axes.get_lines():
label = line.get_label()
- if label == '_nolegend_':
- continue
+ # if label == '_nolegend_':
+ # continue
linedict[label] = line
curves = []
- linestyles = LINESTYLES.items()
- markers = MARKERS.items()
+ linestyles = sorted(LINESTYLES.items())
+ markers = sorted(MARKERS.items(), key=lambda (k,v): (v,k))
curvelabels = sorted(linedict.keys())
for label in curvelabels:
line = linedict[label]
curvedata = [
('Label', label),
+ ('Visible', line.get_visible()),
sep,
(None, 'Line'),
('Style', [line.get_linestyle()] + linestyles),
@@ -121,7 +125,8 @@
general, = data
# Set / General
- title, xmin, xmax, xlabel, xscale, ymin, ymax, ylabel, yscale = general
+ title, has_legend, xmin, xmax, xlabel, xscale, \
+ ymin, ymax, ylabel, yscale = general
axes.set_xscale(xscale)
axes.set_yscale(yscale)
axes.set_title(title)
@@ -132,19 +137,27 @@
if has_curve:
# Set / Curves
+ has_label = False
for index, curve in enumerate(curves):
line = linedict[curvelabels[index]]
- label, linestyle, linewidth, color, \
+ label, visible, linestyle, linewidth, color, \
marker, markersize, markerfacecolor, markeredgecolor = curve
+ if not label.startswith('_') :
+ has_label = True
line.set_label(label)
+ line.set_visible(visible)
line.set_linestyle(linestyle)
line.set_linewidth(linewidth)
line.set_color(color)
- if marker is not 'none':
- line.set_marker(marker)
- line.set_markersize(markersize)
- line.set_markerfacecolor(markerfacecolor)
- line.set_markeredgecolor(markeredgecolor)
+ if marker == 'none': marker='None'
+ line.set_marker(marker)
+ line.set_markersize(markersize)
+ line.set_markerfacecolor(markerfacecolor)
+ line.set_markeredgecolor(markeredgecolor)
+ if has_legend and has_label :
+ axes.legend(loc=0)
+ else:
+ axes.legend_=None
# Redraw
figure = axes.get_figure()
Index: mpl/trunk/matplotlib/lib/matplotlib/backends/qt4_editor/formlayout.py
===================================================================
--- mpl/trunk/matplotlib/lib/matplotlib/backends/qt4_editor/formlayout.py (revision 8214)
+++ mpl/trunk/matplotlib/lib/matplotlib/backends/qt4_editor/formlayout.py (working copy)
@@ -278,7 +278,7 @@
elif isinstance(value, int):
field = QSpinBox(self)
field.setValue(value)
- field.setMaximum(1e9)
+ field.setRange(-1e9, 1e9)
elif isinstance(value, date):
if hasattr(value, 'hour'):
field = QDateTimeEdit(self)
@@ -302,6 +302,8 @@
value = field.get_font()
elif isinstance(value, (str, unicode)):
value = unicode(field.text())
+ if isinstance(field, ColorLayout) and not text_to_qcolor(value).isValid():
+ if value not in ['b', 'g', 'r', 'c', 'm', 'y', 'k', 'w'] : value='None'
elif isinstance(value, (list, tuple)):
index = int(field.currentIndex())
if isinstance(value[0], (list, tuple)):
@@ -455,7 +457,7 @@
# Create a QApplication instance if no instance currently exists
# (e.g. if the module is used directly from the interpreter)
if QApplication.startingUp():
- QApplication([])
+ _app = QApplication([])
dialog = FormDialog(data, title, comment, icon, parent, apply)
if dialog.exec_():