From f8fe10054cba4a8dbf012f328eb86c9ef1c75869 Mon Sep 17 00:00:00 2001 From: jblum Date: Thu, 27 Nov 2008 07:12:15 +0000 Subject: resizable reports window git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10078 221aa14e-8319-0410-a670-987f0aec2ac5 --- grc/data/platforms/python/blocks/preferences.xml | 20 +++-------- grc/src/gui/Constants.py | 2 -- grc/src/gui/MainWindow.py | 42 ++++++++---------------- grc/src/gui/Preferences.py | 12 ++++--- 4 files changed, 26 insertions(+), 50 deletions(-) (limited to 'grc') diff --git a/grc/data/platforms/python/blocks/preferences.xml b/grc/data/platforms/python/blocks/preferences.xml index 62f7e17c1..9e97f8faf 100644 --- a/grc/data/platforms/python/blocks/preferences.xml +++ b/grc/data/platforms/python/blocks/preferences.xml @@ -37,7 +37,6 @@ Window Size window_size - 800, 600 int_vector @@ -92,20 +91,6 @@ - - Show Reports Window - show_reports - show - enum - - - Show Params Labels show_params @@ -135,4 +120,9 @@ no + + Reports Window Position + reports_window_position + string + diff --git a/grc/src/gui/Constants.py b/grc/src/gui/Constants.py index f5803cc17..853572217 100644 --- a/grc/src/gui/Constants.py +++ b/grc/src/gui/Constants.py @@ -39,8 +39,6 @@ MIN_WINDOW_HEIGHT = 400 ##dialog constraints MIN_DIALOG_WIDTH = 500 MIN_DIALOG_HEIGHT = 500 -##static height of reports window -REPORTS_WINDOW_HEIGHT = 100 ##static width of block selection window BLOCK_SELECTION_WINDOW_WIDTH = 200 diff --git a/grc/src/gui/MainWindow.py b/grc/src/gui/MainWindow.py index 4c572c446..1976fb436 100644 --- a/grc/src/gui/MainWindow.py +++ b/grc/src/gui/MainWindow.py @@ -19,7 +19,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA from Constants import \ MIN_WINDOW_WIDTH, MIN_WINDOW_HEIGHT, \ - NEW_FLOGRAPH_TITLE, REPORTS_WINDOW_HEIGHT + NEW_FLOGRAPH_TITLE from Actions import \ APPLICATION_QUIT, FLOW_GRAPH_KILL, \ FLOW_GRAPH_SAVE, get_accel_group @@ -71,31 +71,27 @@ class MainWindow(gtk.Window): self.notebook.set_show_border(False) self.notebook.set_scrollable(True) #scroll arrows for page tabs self.notebook.connect('switch-page', self._handle_page_change) - fg_and_report_box = gtk.VBox(False, 0) - fg_and_report_box.pack_start(self.notebook, False, False, 0) - fg_and_report_box.pack_start(self.scrolled_window) - hbox.pack_start(fg_and_report_box) + #setup containers + flow_graph_box = gtk.VBox(False, 0) + self.flow_graph_vpaned = gtk.VPaned() + flow_graph_box.pack_start(self.notebook, False, False, 0) + flow_graph_box.pack_start(self.scrolled_window) + self.flow_graph_vpaned.pack1(flow_graph_box) + hbox.pack_start(self.flow_graph_vpaned) vbox.pack_start(hbox) - #create the side windows - side_box = gtk.VBox() - hbox.pack_start(side_box, False) - side_box.pack_start(BlockTreeWindow(platform, self.get_flow_graph)) #allow resize, selection window can have more space + hbox.pack_start(BlockTreeWindow(platform, self.get_flow_graph), False) #dont allow resize #create the reports window self.text_display = TextDisplay() #house the reports in a scrolled window self.reports_scrolled_window = gtk.ScrolledWindow() - self.reports_scrolled_window.set_size_request(-1, REPORTS_WINDOW_HEIGHT) self.reports_scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self.reports_scrolled_window.add_with_viewport(self.text_display) - fg_and_report_box.pack_end(self.reports_scrolled_window, False) #dont allow resize, fg should get all the space - #show all but the main window container and the reports window - vbox.show_all() - self.notebook.hide() - self._show_reports_window(False) - # load preferences and show the main window + self.flow_graph_vpaned.pack2(self.reports_scrolled_window, False) #dont allow resize + #load preferences and show the main window Preferences.load(platform) self.resize(*Preferences.window_size()) - self.show()#show after resize in preferences + self.flow_graph_vpaned.set_position(Preferences.reports_window_position()) + self.show_all() ############################################################ # Event Handlers @@ -138,15 +134,6 @@ class MainWindow(gtk.Window): vadj.set_value(vadj.upper) vadj.emit('changed') - def _show_reports_window(self, show): - """ - Show the reports window when show is True. - Hide the reports window when show is False. - @param show boolean flag - """ - if show: self.reports_scrolled_window.show() - else: self.reports_scrolled_window.hide() - ############################################################ # Pages: create and close ############################################################ @@ -202,6 +189,7 @@ class MainWindow(gtk.Window): Preferences.files_open(open_files) Preferences.file_open(open_file) Preferences.window_size(self.get_size()) + Preferences.reports_window_position(self.flow_graph_vpaned.get_position()) Preferences.save() return True @@ -262,8 +250,6 @@ class MainWindow(gtk.Window): ) ) ) - #reports window - self._show_reports_window(Preferences.show_reports_window()) #show/hide notebook tabs if len(self._get_pages()) > 1: self.notebook.show() else: self.notebook.hide() diff --git a/grc/src/gui/Preferences.py b/grc/src/gui/Preferences.py index 80c4232b8..741ed8ca7 100644 --- a/grc/src/gui/Preferences.py +++ b/grc/src/gui/Preferences.py @@ -50,7 +50,7 @@ class _Preferences(object): self.snap_to_grid_param = self._prefs_block.get_param('snap_to_grid') self.grid_size_param = self._prefs_block.get_param('grid_size') self.show_grid_param = self._prefs_block.get_param('show_grid') - self.show_reports_param = self._prefs_block.get_param('show_reports') + self.reports_window_position_param = self._prefs_block.get_param('reports_window_position') self.restore_files_param = self._prefs_block.get_param('restore_files') self.window_size_param = self._prefs_block.get_param('window_size') self.file_open_param = self._prefs_block.get_param('file_open') @@ -75,10 +75,9 @@ Snap to Grid forces the upper right corner of the signal block to align with a g ( 'Appearance', ''' -Show or hide the reports window at the bottom of the main window. Show or hide all paramater labels in the signal blocks. ''', - [self.show_reports_param, self.show_params_param], + [self.show_params_param], ), ( 'Misc', @@ -113,8 +112,11 @@ def files_open(files=None): if files is not None: _get_prefs().files_open_param.set_value('\n'.join(files)) else: return _get_prefs().files_open_param.get_value().split('\n') -def show_reports_window(): - return _get_prefs().show_reports_param.get_value() == 'show' +def reports_window_position(pos=None): + if pos is not None: _get_prefs().reports_window_position_param.set_value('%d'%pos) + else: + try: return int(_get_prefs().reports_window_position_param.get_value()) or 1 #greater than 0 + except: return -1 def get_grid_size(): return int(_get_prefs().grid_size_param.get_value()) -- cgit