Skip to content

Commit 1a2630f

Browse files
author
Federico Ariza
committed
removing unused DialogLineprops from gtk3
1 parent 4e1792b commit 1a2630f

File tree

1 file changed

+0
-160
lines changed

1 file changed

+0
-160
lines changed

lib/matplotlib/backends/backend_gtk3.py

-160
Original file line numberDiff line numberDiff line change
@@ -935,166 +935,6 @@ def trigger(self, sender, event, data=None):
935935
self.window.present()
936936

937937

938-
class DialogLineprops(object):
939-
"""
940-
A GUI dialog for controlling lineprops
941-
"""
942-
signals = (
943-
'on_combobox_lineprops_changed',
944-
'on_combobox_linestyle_changed',
945-
'on_combobox_marker_changed',
946-
'on_colorbutton_linestyle_color_set',
947-
'on_colorbutton_markerface_color_set',
948-
'on_dialog_lineprops_okbutton_clicked',
949-
'on_dialog_lineprops_cancelbutton_clicked',
950-
)
951-
952-
linestyles = [ls for ls in lines.Line2D.lineStyles if ls.strip()]
953-
linestyled = dict([ (s,i) for i,s in enumerate(linestyles)])
954-
955-
956-
markers = [m for m in lines.Line2D.markers if cbook.is_string_like(m)]
957-
958-
markerd = dict([(s,i) for i,s in enumerate(markers)])
959-
960-
def __init__(self, lines):
961-
import Gtk.glade
962-
963-
datadir = matplotlib.get_data_path()
964-
gladefile = os.path.join(datadir, 'lineprops.glade')
965-
if not os.path.exists(gladefile):
966-
raise IOError('Could not find gladefile lineprops.glade in %s'%datadir)
967-
968-
self._inited = False
969-
self._updateson = True # suppress updates when setting widgets manually
970-
self.wtree = Gtk.glade.XML(gladefile, 'dialog_lineprops')
971-
self.wtree.signal_autoconnect(dict([(s, getattr(self, s)) for s in self.signals]))
972-
973-
self.dlg = self.wtree.get_widget('dialog_lineprops')
974-
975-
self.lines = lines
976-
977-
cbox = self.wtree.get_widget('combobox_lineprops')
978-
cbox.set_active(0)
979-
self.cbox_lineprops = cbox
980-
981-
cbox = self.wtree.get_widget('combobox_linestyles')
982-
for ls in self.linestyles:
983-
cbox.append_text(ls)
984-
cbox.set_active(0)
985-
self.cbox_linestyles = cbox
986-
987-
cbox = self.wtree.get_widget('combobox_markers')
988-
for m in self.markers:
989-
cbox.append_text(m)
990-
cbox.set_active(0)
991-
self.cbox_markers = cbox
992-
self._lastcnt = 0
993-
self._inited = True
994-
995-
996-
def show(self):
997-
'populate the combo box'
998-
self._updateson = False
999-
# flush the old
1000-
cbox = self.cbox_lineprops
1001-
for i in range(self._lastcnt-1,-1,-1):
1002-
cbox.remove_text(i)
1003-
1004-
# add the new
1005-
for line in self.lines:
1006-
cbox.append_text(line.get_label())
1007-
cbox.set_active(0)
1008-
1009-
self._updateson = True
1010-
self._lastcnt = len(self.lines)
1011-
self.dlg.show()
1012-
1013-
def get_active_line(self):
1014-
'get the active line'
1015-
ind = self.cbox_lineprops.get_active()
1016-
line = self.lines[ind]
1017-
return line
1018-
1019-
def get_active_linestyle(self):
1020-
'get the active lineinestyle'
1021-
ind = self.cbox_linestyles.get_active()
1022-
ls = self.linestyles[ind]
1023-
return ls
1024-
1025-
def get_active_marker(self):
1026-
'get the active lineinestyle'
1027-
ind = self.cbox_markers.get_active()
1028-
m = self.markers[ind]
1029-
return m
1030-
1031-
def _update(self):
1032-
'update the active line props from the widgets'
1033-
if not self._inited or not self._updateson: return
1034-
line = self.get_active_line()
1035-
ls = self.get_active_linestyle()
1036-
marker = self.get_active_marker()
1037-
line.set_linestyle(ls)
1038-
line.set_marker(marker)
1039-
1040-
button = self.wtree.get_widget('colorbutton_linestyle')
1041-
color = button.get_color()
1042-
r, g, b = [val/65535. for val in (color.red, color.green, color.blue)]
1043-
line.set_color((r,g,b))
1044-
1045-
button = self.wtree.get_widget('colorbutton_markerface')
1046-
color = button.get_color()
1047-
r, g, b = [val/65535. for val in (color.red, color.green, color.blue)]
1048-
line.set_markerfacecolor((r,g,b))
1049-
1050-
line.figure.canvas.draw()
1051-
1052-
def on_combobox_lineprops_changed(self, item):
1053-
'update the widgets from the active line'
1054-
if not self._inited: return
1055-
self._updateson = False
1056-
line = self.get_active_line()
1057-
1058-
ls = line.get_linestyle()
1059-
if ls is None: ls = 'None'
1060-
self.cbox_linestyles.set_active(self.linestyled[ls])
1061-
1062-
marker = line.get_marker()
1063-
if marker is None: marker = 'None'
1064-
self.cbox_markers.set_active(self.markerd[marker])
1065-
1066-
r,g,b = colorConverter.to_rgb(line.get_color())
1067-
color = Gdk.Color(*[int(val*65535) for val in (r,g,b)])
1068-
button = self.wtree.get_widget('colorbutton_linestyle')
1069-
button.set_color(color)
1070-
1071-
r,g,b = colorConverter.to_rgb(line.get_markerfacecolor())
1072-
color = Gdk.Color(*[int(val*65535) for val in (r,g,b)])
1073-
button = self.wtree.get_widget('colorbutton_markerface')
1074-
button.set_color(color)
1075-
self._updateson = True
1076-
1077-
def on_combobox_linestyle_changed(self, item):
1078-
self._update()
1079-
1080-
def on_combobox_marker_changed(self, item):
1081-
self._update()
1082-
1083-
def on_colorbutton_linestyle_color_set(self, button):
1084-
self._update()
1085-
1086-
def on_colorbutton_markerface_color_set(self, button):
1087-
'called colorbutton marker clicked'
1088-
self._update()
1089-
1090-
def on_dialog_lineprops_okbutton_clicked(self, button):
1091-
self._update()
1092-
self.dlg.hide()
1093-
1094-
def on_dialog_lineprops_cancelbutton_clicked(self, button):
1095-
self.dlg.hide()
1096-
1097-
1098938
# Define the file to use as the GTk icon
1099939
if sys.platform == 'win32':
1100940
icon_filename = 'matplotlib.png'

0 commit comments

Comments
 (0)