summaryrefslogtreecommitdiff
path: root/grc/gui/MainWindow.py
diff options
context:
space:
mode:
Diffstat (limited to 'grc/gui/MainWindow.py')
-rw-r--r--grc/gui/MainWindow.py62
1 files changed, 45 insertions, 17 deletions
diff --git a/grc/gui/MainWindow.py b/grc/gui/MainWindow.py
index 2f761df1f8..4c2a3ae2d2 100644
--- a/grc/gui/MainWindow.py
+++ b/grc/gui/MainWindow.py
@@ -118,7 +118,9 @@ class MainWindow(gtk.Window):
Handle the delete event from the main window.
Generated by pressing X to close, alt+f4, or right click+close.
This method in turns calls the state handler to quit.
- @return true
+
+ Returns:
+ true
"""
Actions.APPLICATION_QUIT()
return True
@@ -128,9 +130,11 @@ class MainWindow(gtk.Window):
Handle a page change. When the user clicks on a new tab,
reload the flow graph to update the vars window and
call handle states (select nothing) to update the buttons.
- @param notebook the notebook
- @param page new page
- @param page_num new page number
+
+ Args:
+ notebook: the notebook
+ page: new page
+ page_num: new page number
"""
self.current_page = self.notebook.get_nth_page(page_num)
Messages.send_page_switch(self.current_page.get_file_path())
@@ -143,7 +147,9 @@ class MainWindow(gtk.Window):
def add_report_line(self, line):
"""
Place line at the end of the text buffer, then scroll its window all the way down.
- @param line the new text
+
+ Args:
+ line: the new text
"""
self.text_display.insert(line)
vadj = self.reports_scrolled_window.get_vadjustment()
@@ -158,8 +164,10 @@ class MainWindow(gtk.Window):
"""
Create a new notebook page.
Set the tab to be selected.
- @param file_path optional file to load into the flow graph
- @param show true if the page should be shown after loading
+
+ Args:
+ file_path: optional file to load into the flow graph
+ show: true if the page should be shown after loading
"""
#if the file is already open, show the open page and return
if file_path and file_path in self._get_files(): #already open
@@ -189,7 +197,9 @@ class MainWindow(gtk.Window):
def close_pages(self):
"""
Close all the pages in this notebook.
- @return true if all closed
+
+ Returns:
+ true if all closed
"""
open_files = filter(lambda file: file, self._get_files()) #filter blank files
open_file = self.get_page().get_file_path()
@@ -212,7 +222,9 @@ class MainWindow(gtk.Window):
Close the current page.
If the notebook becomes empty, and ensure is true,
call new page upon exit to ensure that at least one page exists.
- @param ensure boolean
+
+ Args:
+ ensure: boolean
"""
if not self.page_to_be_closed: self.page_to_be_closed = self.get_page()
#show the page if it has an executing flow graph or is unsaved
@@ -240,7 +252,9 @@ class MainWindow(gtk.Window):
Set the title of the main window.
Set the titles on the page tabs.
Show/hide the reports window.
- @param title the window title
+
+ Args:
+ title: the window title
"""
gtk.Window.set_title(self, Utils.parse_template(MAIN_WINDOW_TITLE_TMPL,
basename=os.path.basename(self.get_page().get_file_path()),
@@ -266,21 +280,27 @@ class MainWindow(gtk.Window):
def get_page(self):
"""
Get the selected page.
- @return the selected page
+
+ Returns:
+ the selected page
"""
return self.current_page
def get_flow_graph(self):
"""
Get the selected flow graph.
- @return the selected flow graph
+
+ Returns:
+ the selected flow graph
"""
return self.get_page().get_flow_graph()
def get_focus_flag(self):
"""
Get the focus flag from the current page.
- @return the focus flag
+
+ Returns:
+ the focus flag
"""
return self.get_page().get_drawing_area().get_focus_flag()
@@ -291,7 +311,9 @@ class MainWindow(gtk.Window):
def _set_page(self, page):
"""
Set the current page.
- @param page the page widget
+
+ Args:
+ page: the page widget
"""
self.current_page = page
self.notebook.set_current_page(self.notebook.page_num(self.current_page))
@@ -299,7 +321,9 @@ class MainWindow(gtk.Window):
def _save_changes(self):
"""
Save changes to flow graph?
- @return true if yes
+
+ Returns:
+ true if yes
"""
return MessageDialogHelper(
gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, 'Unsaved Changes!',
@@ -309,13 +333,17 @@ class MainWindow(gtk.Window):
def _get_files(self):
"""
Get the file names for all the pages, in order.
- @return list of file paths
+
+ Returns:
+ list of file paths
"""
return map(lambda page: page.get_file_path(), self._get_pages())
def _get_pages(self):
"""
Get a list of all pages in the notebook.
- @return list of pages
+
+ Returns:
+ list of pages
"""
return [self.notebook.get_nth_page(page_num) for page_num in range(self.notebook.get_n_pages())]