Added documentation strings and removed some unused code.
This commit is contained in:
parent
42f6fd7440
commit
ba55678472
|
@ -212,6 +212,9 @@ class MainView (gtk.Notebook):
|
|||
return self._views[x, y]
|
||||
|
||||
def update_small_views(self):
|
||||
"""Creates a new gtk.Table to show the views. Called after changes to
|
||||
the _views property"""
|
||||
|
||||
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)
|
||||
|
@ -222,18 +225,28 @@ class MainView (gtk.Notebook):
|
|||
self._small_views.show_all()
|
||||
|
||||
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
|
||||
will be returned, not the active maximized ViewFrame"""
|
||||
for vf in self._view_frames:
|
||||
if vf.focused:
|
||||
return vf
|
||||
return None
|
||||
|
||||
def get_active_view_frame(self):
|
||||
"""Returns the active view frame."""
|
||||
if self.get_current_page() == 0:
|
||||
return self.get_active_small_view()
|
||||
else:
|
||||
return self._large_view
|
||||
|
||||
def goto_large(self):
|
||||
"""Maximize the view in the current ViewFrame.
|
||||
|
||||
Maximizes the View in the current ViewFrame. The ViewFrame itself is
|
||||
not resized or modified, except it's view will be set to None.
|
||||
This method will do nothing if a view is currently maximized.
|
||||
"""
|
||||
if self.get_current_page() == 1:
|
||||
return
|
||||
|
||||
|
@ -244,6 +257,11 @@ class MainView (gtk.Notebook):
|
|||
self.set_current_page(1)
|
||||
|
||||
def goto_small(self):
|
||||
"""Goes to the small views page.
|
||||
|
||||
The maximized View will be given to the active ViewFrame in the view
|
||||
table.
|
||||
"""
|
||||
if self.get_current_page() == 0:
|
||||
return
|
||||
|
||||
|
@ -254,6 +272,7 @@ class MainView (gtk.Notebook):
|
|||
self.set_current_page(0)
|
||||
|
||||
def insert_view(self, view):
|
||||
"""Set a view in the currently active ViewFrame"""
|
||||
if self.get_current_page() == 0:
|
||||
vf = self.get_active_small_view()
|
||||
else:
|
||||
|
@ -261,6 +280,7 @@ class MainView (gtk.Notebook):
|
|||
vf.set_view(view)
|
||||
|
||||
def set_all_plots(self, plots):
|
||||
"""Displays all the plots in the list plots, and hides all other plots"""
|
||||
for y in range(self._views.ysize):
|
||||
for x in range(self._views.xsize):
|
||||
if plots:
|
||||
|
@ -268,12 +288,6 @@ class MainView (gtk.Notebook):
|
|||
else:
|
||||
self._views[x, y].set_view(None)
|
||||
|
||||
def show(self):
|
||||
for vf in self._view_frames:
|
||||
vf.show()
|
||||
self._small_views.show()
|
||||
gtk.Notebook.show(self)
|
||||
|
||||
def on_view_focus_changed(self, widget, vf, focused):
|
||||
if focused:
|
||||
self.emit('view-changed', vf)
|
||||
|
@ -298,6 +312,7 @@ class MainView (gtk.Notebook):
|
|||
#self.set_current_page(0)
|
||||
self.goto_small()
|
||||
|
||||
|
||||
class View (gtk.Frame):
|
||||
"""The base class of everything that is shown in the center view of fluents.
|
||||
|
||||
|
|
Reference in New Issue