Fixed plot focus signal problem.
This commit is contained in:
parent
10eba079bc
commit
6e4db7ebe4
|
@ -236,13 +236,12 @@ class MainView (gtk.Notebook):
|
|||
self.set_show_tabs(False)
|
||||
self.set_show_border(False)
|
||||
|
||||
self._focus_listeners = []
|
||||
self._view_frames = []
|
||||
self._views = ObjectTable(2, 2, lambda : ViewFrame(self._view_frames))
|
||||
self._large_view = ViewFrame(list())
|
||||
self.update_small_views()
|
||||
|
||||
for vf in self._view_frames:
|
||||
vf.connect('focus-changed', self._on_view_focus_changed)
|
||||
|
||||
self.append_page(self._small_views)
|
||||
self.append_page(self._large_view)
|
||||
|
@ -256,6 +255,11 @@ class MainView (gtk.Notebook):
|
|||
"""Creates a new gtk.Table to show the views. Called after changes to
|
||||
the _views property"""
|
||||
|
||||
# Disconnect focus-changed signal for all ViewFrames
|
||||
for vf, fl in zip(self._view_frames, self._focus_listeners):
|
||||
vf.disconnect(fl)
|
||||
|
||||
# Resize table
|
||||
self._small_views = gtk.Table(self._views.ysize, self._views.xsize, True)
|
||||
self._small_views.set_col_spacings(4)
|
||||
self._small_views.set_row_spacings(4)
|
||||
|
@ -265,6 +269,12 @@ class MainView (gtk.Notebook):
|
|||
self._small_views.attach(child, x, x+1, y, y+1)
|
||||
self._small_views.show_all()
|
||||
|
||||
# Create new focus-changed signal handlers
|
||||
fls = []
|
||||
for vf in self._view_frames:
|
||||
fls.append(vf.connect('focus-changed', self._on_view_focus_changed))
|
||||
self._focus_listeners = fls
|
||||
|
||||
def get_active_small_view(self):
|
||||
"""Returns the active ViewFrame in the small views table.
|
||||
If a view is maximized, the corresponding ViewFrame in the table
|
||||
|
|
Reference in New Issue