I have connected a callback function to the realize event of a widget.
The widget is a treeview and when it is realized it will fill the table from the database. When I open up an entry from the table, it opens a window where I can edit the data. Then I save the data, the window closes and the table might be refreshed.
So I call treeview.emit('realize') to call the function that fills the treeview again.
But the treeview is corrupted, no column headers and the callback function is not called.
I tried also:
treeview.unrealize()
treeview.realize()
some code:
from gi.repository import Gtk
b = Gtk.Builder()
b.add_from_file('file.glade')
def fill_table(treeview, table_name):
'fills the treeview from database (select * from table_name ...)'
...
def open_entry(treeview, row ...):
'opens the window of the entry'
w = b.get_object('entry_window')
...
def save_and_fill(button):
'when the SAVE button in the entry_window is clicked, it saves the data, closes the entry_window and fills the treeview'
#update table1 set column=....
b.get_object('treeview').emit('realize') #here it might call the fill_table funcion
b.get_object('entry_window').hide()
signals = {'realize' : lambda *args: fill_table('table1'),
'row-activated' : open_entry,
'clicked' : save_and_fill}
b.connect_signals(signals)
b.get_object('main_window').show_all()
Gtk.main()
or just treeview.realize() but it doesn't work.
Is it posible to call the callback function witch is connected to the realize event of widget without destroying the widget?
realizeevent, is dynamically created at connection time? I want to get the function and call it or emit therealizeevent to call the function. - microo8