Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0
This repository has been archived on 2024-07-04. You can view files and clone it, but cannot push or open issues or pull requests.
laydi/system/navigator.py

48 lines
1.3 KiB
Python
Raw Normal View History

import gtk
import gobject
import plots
import logger
class NavigatorStore (gtk.TreeStore):
def __init__(self):
gtk.TreeStore.__init__(self, gobject.TYPE_STRING, plots.Plot)
iter = self.append(None)
self.set_value(iter, 0, ('Sine Plot'))
self.set_value(iter, 1, (plots.SinePlot()))
iter = self.append(None)
self.set_value(iter, 0, ('Sine Plot 1'))
self.set_value(iter, 1, (plots.EmptyPlot()))
def plot_at(self, path):
iter = self.get_iter(path)
plot = self.get_value(iter, 1)
if plot:
plot.show()
return plot
class NavigatorView (gtk.TreeView):
def __init__(self, nav, app):
gtk.TreeView.__init__(self, nav)
self.navigator = nav
self.app = app
self.set_headers_visible(False)
self.connect('row-activated', self.row_activated_handler)
renderer = gtk.CellRendererText()
self.object_col = gtk.TreeViewColumn('Object', renderer, text=0)
self.append_column(self.object_col)
logger.log('debug', 'Initializing naviagor window')
def row_activated_handler(self, widget, path, column):
#self.app.change_window(
#
plot = self.navigator.plot_at(path)
logger.log('notice', 'Button pressed')
self.app.change_plot(plot)