summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Seguin <guillaume@segu.in>2008-05-17 11:02:37 +0200
committerGuillaume Seguin <guillaume@segu.in>2008-05-17 11:02:37 +0200
commit81e5acee0e8d15128b00267a3381d02f3b2733ef (patch)
tree0f7f330811f18ddc6cf625d74e4fa18b89de50f3
parent37915d912bf4645329c55dd382af2a9985a67729 (diff)
downloadgnxtlogger-81e5acee0e8d15128b00267a3381d02f3b2733ef.tar.gz
gnxtlogger-81e5acee0e8d15128b00267a3381d02f3b2733ef.tar.bz2
* Add "Name" column to columns treeview to let the user rename columns
-rw-r--r--nxtlogger/gui.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/nxtlogger/gui.py b/nxtlogger/gui.py
index b93d506..65f1f6d 100644
--- a/nxtlogger/gui.py
+++ b/nxtlogger/gui.py
@@ -230,7 +230,8 @@ class GNXTLogger:
self.chart_columns_store = gtk.ListStore (gobject.TYPE_INT,
gobject.TYPE_STRING,
- gobject.TYPE_BOOLEAN)
+ gobject.TYPE_BOOLEAN,
+ gobject.TYPE_STRING)
self.chart_columns_view.set_model (self.chart_columns_store)
text_renderer = gtk.CellRendererText ()
column = gtk.TreeViewColumn (_("Column"), text_renderer, text = 1)
@@ -240,18 +241,26 @@ class GNXTLogger:
bool_renderer.connect ("toggled", self.toggle_column_drawn)
column = gtk.TreeViewColumn (_("Draw"), bool_renderer, active = 2)
self.chart_columns_view.append_column (column)
+ text_renderer = gtk.CellRendererText ()
+ text_renderer.set_property ("editable", True)
+ text_renderer.connect ("edited", self.edit_column_name)
+ column = gtk.TreeViewColumn (_("Name"), text_renderer, text = 3)
+ self.chart_columns_view.append_column (column)
text_renderer = gtk.CellRendererText ()
for row, name, drawn_default in DATA_COLUMNS:
column = gtk.TreeViewColumn (name, text_renderer, text = row)
self.data_view.append_column (column)
- self.chart_columns_store.append ([row, name, drawn_default])
+ self.chart_columns_store.append ([row, name, drawn_default, name])
def edit_option (self, cell, path, data):
if "%s" % int (data) == data:
self.options_store[path][2] = int (data)
+ def edit_column_name (self, cell, path, data):
+ self.chart_columns_store[path][3] = data
+
def toggle_column_drawn (self, cell, path):
self.chart_columns_store[path][2] = not cell.get_active ()
@@ -344,7 +353,7 @@ class GNXTLogger:
def draw_chart (self):
columns = filter (lambda row: row[2], self.chart_columns_store)
columns = map (lambda row: (row[0], row[1]), columns)
- y_data_sets = map (lambda c: (c[1], self.get_data_column (c[0])),
+ y_data_sets = map (lambda c: (c[3], self.get_data_column (c[0])),
columns)
x_data = self.get_data_column (0)
width = self.get_option ("width")