Added ctrl+arrows to navigate between plots.
This commit is contained in:
parent
eacb44f32a
commit
f73a6db0ee
|
@ -189,6 +189,11 @@ class FluentApp:
|
||||||
'on_report_bug1_activate' : (self.on_help_report_bug),
|
'on_report_bug1_activate' : (self.on_help_report_bug),
|
||||||
'on_small_view1_activate' : (self.on_multiple_view),
|
'on_small_view1_activate' : (self.on_multiple_view),
|
||||||
'on_large_view1_activate' : (self.on_single_view),
|
'on_large_view1_activate' : (self.on_single_view),
|
||||||
|
|
||||||
|
'on_left1_activate' : (self.on_left),
|
||||||
|
'on_right1_activate' : (self.on_right),
|
||||||
|
'on_up1_activate' : (self.on_up),
|
||||||
|
'on_down1_activate' : (self.on_down),
|
||||||
}
|
}
|
||||||
self.widget_tree.signal_autoconnect(signals)
|
self.widget_tree.signal_autoconnect(signals)
|
||||||
|
|
||||||
|
@ -341,6 +346,18 @@ class FluentApp:
|
||||||
def on_view_changed(self, widget, vf):
|
def on_view_changed(self, widget, vf):
|
||||||
self._update_toolbar(vf.get_view())
|
self._update_toolbar(vf.get_view())
|
||||||
|
|
||||||
|
def on_left(self, item):
|
||||||
|
self.main_view.move_focus_left()
|
||||||
|
|
||||||
|
def on_right(self, item):
|
||||||
|
self.main_view.move_focus_right()
|
||||||
|
|
||||||
|
def on_up(self, item):
|
||||||
|
self.main_view.move_focus_up()
|
||||||
|
|
||||||
|
def on_down(self, item):
|
||||||
|
self.main_view.move_focus_down()
|
||||||
|
|
||||||
|
|
||||||
gobject.signal_new('table-size-set', TableSizeSelection,
|
gobject.signal_new('table-size-set', TableSizeSelection,
|
||||||
gobject.SIGNAL_RUN_LAST,
|
gobject.SIGNAL_RUN_LAST,
|
||||||
|
|
|
@ -351,6 +351,37 @@ class MainView (gtk.Notebook):
|
||||||
else:
|
else:
|
||||||
self._views[x, y].set_view(None)
|
self._views[x, y].set_view(None)
|
||||||
|
|
||||||
|
def get_active_view_index(self):
|
||||||
|
current = self.get_active_small_view()
|
||||||
|
for i in range(self._views.xsize):
|
||||||
|
for j in range(self._views.ysize):
|
||||||
|
if self._views[i, j] == current:
|
||||||
|
return (i, j)
|
||||||
|
return None
|
||||||
|
|
||||||
|
def set_active_view_by_index(self, x, y):
|
||||||
|
self._views[x, y].focus()
|
||||||
|
|
||||||
|
def move_focus_left(self):
|
||||||
|
x, y = self.get_active_view_index()
|
||||||
|
if x > 0:
|
||||||
|
self.set_active_view_by_index(x-1, y)
|
||||||
|
|
||||||
|
def move_focus_right(self):
|
||||||
|
x, y = self.get_active_view_index()
|
||||||
|
if x < self._views.xsize-1:
|
||||||
|
self.set_active_view_by_index(x+1, y)
|
||||||
|
|
||||||
|
def move_focus_up(self):
|
||||||
|
x, y = self.get_active_view_index()
|
||||||
|
if y > 0:
|
||||||
|
self.set_active_view_by_index(x, y-1)
|
||||||
|
|
||||||
|
def move_focus_down(self):
|
||||||
|
x, y = self.get_active_view_index()
|
||||||
|
if y < self._views.ysize-1:
|
||||||
|
self.set_active_view_by_index(x, y+1)
|
||||||
|
|
||||||
def _on_view_focus_changed(self, widget, vf, focused):
|
def _on_view_focus_changed(self, widget, vf, focused):
|
||||||
if focused:
|
if focused:
|
||||||
self.emit('view-changed', vf)
|
self.emit('view-changed', vf)
|
||||||
|
|
Reference in New Issue