8 |
OBSERVER_NOEDIT_COLOR = "#000088" |
OBSERVER_NOEDIT_COLOR = "#000088" |
9 |
OBSERVER_NORMAL_COLOR = "black" |
OBSERVER_NORMAL_COLOR = "black" |
10 |
|
|
11 |
# This code uses the technique described in |
# This code uses the techniques described in |
12 |
# http://www.daa.com.au/pipermail/pygtk/2006-February/011777.html |
# http://www.daa.com.au/pipermail/pygtk/2006-February/011777.html |
13 |
|
# http://piman.livejournal.com/361173.html |
14 |
|
|
15 |
OBSERVER_NUM=0 |
OBSERVER_NUM=0 |
16 |
|
|
17 |
|
class ClickableTreeColumn(gtk.TreeViewColumn): |
18 |
|
def __init__(self, title="", *args, **kwargs): |
19 |
|
super(ClickableTreeColumn, self).__init__(None, *args, **kwargs) |
20 |
|
self.label = gtk.Label("%s" % title) |
21 |
|
self.label.show() |
22 |
|
self.set_widget(self.label) |
23 |
|
|
24 |
|
def do_connect(self): |
25 |
|
""" Connect the defined 'on_click' method. Note: must be called after |
26 |
|
this object (ClickableTreeColumn) has been added to the TreeView, |
27 |
|
eg mytreeview.append_column(col). """ |
28 |
|
button = self.label.get_ancestor(gtk.Button) |
29 |
|
h = button.connect("clicked",self.on_click) |
30 |
|
#button.clicked() |
31 |
|
|
32 |
|
def on_click(self,widget,*args): |
33 |
|
print "RECEIVED EVENT" |
34 |
|
|
35 |
class ObserverColumn: |
class ObserverColumn: |
36 |
""" |
""" |
37 |
A class to identify the instance that relates to a specify column |
A class to identify the instance that relates to a specify column |
154 |
|
|
155 |
# create the 'active' pixbuf column |
# create the 'active' pixbuf column |
156 |
_renderer = gtk.CellRendererPixbuf() |
_renderer = gtk.CellRendererPixbuf() |
157 |
_col = gtk.TreeViewColumn() |
_col = ClickableTreeColumn("") |
|
_col.set_title("") |
|
158 |
_col.pack_start(_renderer,False) |
_col.pack_start(_renderer,False) |
159 |
_col.set_cell_data_func(_renderer, self.activepixbufvalue) |
_col.set_cell_data_func(_renderer, self.activepixbufvalue) |
160 |
self.view.append_column(_col); |
self.view.append_column(_col) |
161 |
|
_col.do_connect() |
162 |
|
|
163 |
# initially there will not be any other columns |
# initially there will not be any other columns |
164 |
|
|
228 |
# create a new column |
# create a new column |
229 |
_renderer = gtk.CellRendererText() |
_renderer = gtk.CellRendererText() |
230 |
_renderer.connect('edited',self.on_view_cell_edited, _col) |
_renderer.connect('edited',self.on_view_cell_edited, _col) |
231 |
_tvcol = gtk.TreeViewColumn() |
_tvcol = ClickableTreeColumn(_col.title) |
|
_tvcol.set_title(_col.title) |
|
232 |
_tvcol.pack_start(_renderer,False) |
_tvcol.pack_start(_renderer,False) |
233 |
_tvcol.set_cell_data_func(_renderer, _col.cellvalue) |
_tvcol.set_cell_data_func(_renderer, _col.cellvalue) |
234 |
self.view.append_column(_tvcol); |
self.view.append_column(_tvcol); |
235 |
|
_tvcol.do_connect() |
236 |
#self.browser.reporter.reportError("cols = "+str(self.cols)) |
#self.browser.reporter.reportError("cols = "+str(self.cols)) |
237 |
|
|
238 |
def copy_to_clipboard(self,clip): |
def copy_to_clipboard(self,clip): |