From 7fa03f371fb3244a5d6a8cb3cd510fef5f97cdfe Mon Sep 17 00:00:00 2001 From: jblum Date: Thu, 18 Sep 2008 16:56:25 +0000 Subject: moved some constants git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9601 221aa14e-8319-0410-a670-987f0aec2ac5 --- grc/data/platforms/python/blocks/preferences.xml | 6 ++++ grc/data/platforms/python/flow_graph.tmpl | 4 +-- grc/src/gui/Constants.py | 36 ++---------------------- grc/src/gui/Dialogs.py | 13 ++++----- grc/src/gui/MainWindow.py | 5 ++-- grc/src/gui/Messages.py | 2 +- grc/src/gui/Preferences.py | 4 +++ 7 files changed, 23 insertions(+), 47 deletions(-) (limited to 'grc') diff --git a/grc/data/platforms/python/blocks/preferences.xml b/grc/data/platforms/python/blocks/preferences.xml index e426b5a34..62f7e17c1 100644 --- a/grc/data/platforms/python/blocks/preferences.xml +++ b/grc/data/platforms/python/blocks/preferences.xml @@ -16,6 +16,12 @@ .grc string + + Window Prefix + window_prefix + GRC + string + File Open file_open diff --git a/grc/data/platforms/python/flow_graph.tmpl b/grc/data/platforms/python/flow_graph.tmpl index 2341ef46f..0d02d258e 100644 --- a/grc/data/platforms/python/flow_graph.tmpl +++ b/grc/data/platforms/python/flow_graph.tmpl @@ -42,13 +42,13 @@ $imp #set $param_str = ', '.join(['self'] + ['%s=%s'%(param.get_id(), param.get_make()) for param in $parameters]) #if $generate_options == 'wx_gui' #from gnuradio.grc.platforms.base.Constants import DATA_DIR - #from gnuradio.grc.gui.Constants import MAIN_WINDOW_PREFIX + #from gnuradio.grc.gui import Preferences class $(class_name)(grc_wxgui.top_block_gui): def __init__($param_str): grc_wxgui.top_block_gui.__init__( self, - title="$MAIN_WINDOW_PREFIX - Executing: $flow_graph.get_option('title')", + title="$Preferences.window_prefix() - Executing: $flow_graph.get_option('title')", icon="$(os.path.join($DATA_DIR, 'grc-icon-32.png'))", ) #elif $generate_options == 'no_gui' diff --git a/grc/src/gui/Constants.py b/grc/src/gui/Constants.py index 2f6af9a1f..804fff4c9 100644 --- a/grc/src/gui/Constants.py +++ b/grc/src/gui/Constants.py @@ -17,66 +17,34 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ -################################################## -## Global Titles -################################################## - -##The name to appear in the main window for a flow graph that has not been saved to file. +##The name for new/unsaved flow graphs NEW_FLOGRAPH_TITLE = 'untitled' -##The prefix title on the main window. -MAIN_WINDOW_PREFIX = "GRC" - -################################################## -## Signal block rotations -################################################## - -##direction of rotation left. +##Rotation constants DIR_LEFT = 'left' - -##direction of rotation right. DIR_RIGHT = 'right' -################################################## -## Dimension constraints for the various windows (in pixels) -################################################## - ##main window constraints MIN_WINDOW_WIDTH = 600 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 -################################################## -## Dragging, scrolling, and redrawing constants for the flow graph window in pixels -################################################## - ##How close can the mouse get to the window border before mouse events are ignored. BORDER_PROXIMITY_SENSITIVITY = 50 - ##How close the mouse can get to the edge of the visible window before scrolling is invoked. SCROLL_PROXIMITY_SENSITIVITY = 30 - ##When the window has to be scrolled, move it this distance in the required direction. SCROLL_DISTANCE = 15 - ##The redrawing sensitivity, how many seconds must pass between motion events before a redraw? MOTION_DETECT_REDRAWING_SENSITIVITY = .02 - ##How close the mouse click can be to a connection and register a connection select. CONNECTION_SELECT_SENSITIVITY = 5 -################################################## -# A state is recorded for each change to the flow graph, the size dictates how many states we can record -################################################## - ##The size of the state saving cache in the flow graph (for undo/redo functionality) STATE_CACHE_SIZE = 42 diff --git a/grc/src/gui/Dialogs.py b/grc/src/gui/Dialogs.py index f7ba2954b..415a53c93 100644 --- a/grc/src/gui/Dialogs.py +++ b/grc/src/gui/Dialogs.py @@ -20,9 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA import pygtk pygtk.require('2.0') import gtk -from Constants import \ - MIN_DIALOG_WIDTH, MIN_DIALOG_HEIGHT, \ - MAIN_WINDOW_PREFIX +from Constants import MIN_DIALOG_WIDTH, MIN_DIALOG_HEIGHT from .. platforms.base.Constants import VERSION import Preferences @@ -88,20 +86,21 @@ class AboutDialog(gtk.AboutDialog): """AboutDialog constructor.""" gtk.AboutDialog.__init__(self) self.set_version(VERSION) - self.set_name(MAIN_WINDOW_PREFIX) + self.set_name('GNU Radio Companion') self.set_license(__doc__) - self.set_copyright('Copyright 2008 Free Software Foundation, Inc.') + self.set_copyright(__doc__.strip().splitlines()[0]) self.set_website('http://gnuradio.org/trac/wiki/GNURadioCompanion') self.set_comments("""\ Thank you to all those from the mailing list who tested GNU Radio Companion and offered advice. --- +----- Special Thanks: A. Brinton Cooper -> starting the project +Patrick Mulligan -> starting the project CER Technology Fellowship Grant -> initial funding William R. Kenan Jr. Fund -> usrp & computers Patrick Strasser -> the GRC icon Achilleas Anastasopoulos -> trellis support ---""") +-----""") self.run() self.destroy() diff --git a/grc/src/gui/MainWindow.py b/grc/src/gui/MainWindow.py index e4c60fce5..16bbd8dba 100644 --- a/grc/src/gui/MainWindow.py +++ b/grc/src/gui/MainWindow.py @@ -19,8 +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, MAIN_WINDOW_PREFIX, \ - REPORTS_WINDOW_HEIGHT + NEW_FLOGRAPH_TITLE, REPORTS_WINDOW_HEIGHT from .. platforms.base.Constants import FLOW_GRAPH_FILE_EXTENSION from Actions import APPLICATION_QUIT, FLOW_GRAPH_KILL import pygtk @@ -241,7 +240,7 @@ class MainWindow(gtk.Window): """ if self.get_page(): title = ''.join(( - MAIN_WINDOW_PREFIX, + Preferences.window_prefix(), ' - Editing: ', (self.get_page().get_file_path() or NEW_FLOGRAPH_TITLE), (self.get_page().get_saved() and ' ' or '*'), #blank must be non empty diff --git a/grc/src/gui/Messages.py b/grc/src/gui/Messages.py index 1d9a80211..8f6a28048 100644 --- a/grc/src/gui/Messages.py +++ b/grc/src/gui/Messages.py @@ -45,7 +45,7 @@ register_messenger(sys.stdout.write) # Special functions for specific program functionalities ########################################################################### def send_init(): - send("""<<< Welcome to GRC %s >>>\n"""%VERSION) + send("""<<< Welcome to GNU Radio Companion %s >>>\n"""%VERSION) def send_page_switch(file_path): send('\nShowing: "%s"\n'%file_path) diff --git a/grc/src/gui/Preferences.py b/grc/src/gui/Preferences.py index fc06d9246..08b3da5cc 100644 --- a/grc/src/gui/Preferences.py +++ b/grc/src/gui/Preferences.py @@ -46,6 +46,7 @@ class _Preferences(object): self._prefs_block.import_data(n['block']) except: Messages.send_fail_load_preferences(self._prefs_file_path) ##all params + self.window_prefix_param = self._prefs_block.get_param('window_prefix') 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') @@ -92,6 +93,9 @@ Restore previously opened files on start-up. # Special methods for specific program functionalities ########################################################################### +def window_prefix(): + return _get_prefs().window_prefix_param.get_value() + def window_size(size=None): if size: _get_prefs().window_size_param.set_value(size) else: -- cgit