diff options
Diffstat (limited to 'grc/src')
-rw-r--r-- | grc/src/gui/ActionHandler.py | 9 | ||||
-rw-r--r-- | grc/src/gui/Constants.py | 13 | ||||
-rw-r--r-- | grc/src/gui/FileDialogs.py | 5 | ||||
-rw-r--r-- | grc/src/gui/MainWindow.py | 4 | ||||
-rw-r--r-- | grc/src/gui/Preferences.py | 4 | ||||
-rw-r--r-- | grc/src/platforms/base/Constants.py.in | 24 | ||||
-rw-r--r-- | grc/src/platforms/base/Platform.py | 4 | ||||
-rw-r--r-- | grc/src/platforms/gui/Param.py | 1 | ||||
-rw-r--r-- | grc/src/platforms/python/Platform.py | 1 |
9 files changed, 28 insertions, 37 deletions
diff --git a/grc/src/gui/ActionHandler.py b/grc/src/gui/ActionHandler.py index 95825bd0a..7558d16ae 100644 --- a/grc/src/gui/ActionHandler.py +++ b/grc/src/gui/ActionHandler.py @@ -18,9 +18,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ import os -import signal -from .. platforms.base.Constants import PY_GTK_ICON, IMAGE_FILE_EXTENSION -from Constants import DIR_LEFT, DIR_RIGHT +import signal +from Constants import DIR_LEFT, DIR_RIGHT, IMAGE_FILE_EXTENSION import Actions import pygtk pygtk.require('2.0') @@ -54,7 +53,9 @@ class ActionHandler: """ self.clipboard = None platform = Platform(platform) - if PY_GTK_ICON: gtk.window_set_default_icon_from_file(PY_GTK_ICON) + #setup icon using icon theme + try: gtk.window_set_default_icon(gtk.IconTheme().load_icon('gnuradio-grc', 256, 0)) + except: pass for action in Actions.ACTIONS_LIST: action.connect('activate', self._handle_actions) #setup the main window self.main_window = MainWindow(self.handle_states, platform) diff --git a/grc/src/gui/Constants.py b/grc/src/gui/Constants.py index 804fff4c9..f5803cc17 100644 --- a/grc/src/gui/Constants.py +++ b/grc/src/gui/Constants.py @@ -17,10 +17,19 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ -##The name for new/unsaved flow graphs +import os + +##default path for the open/save dialogs +DEFAULT_FILE_PATH = os.getcwd() + +##file extensions +FLOW_GRAPH_FILE_EXTENSION = '.grc' +IMAGE_FILE_EXTENSION = '.png' + +##name for new/unsaved flow graphs NEW_FLOGRAPH_TITLE = 'untitled' -##Rotation constants +##rotation constants DIR_LEFT = 'left' DIR_RIGHT = 'right' diff --git a/grc/src/gui/FileDialogs.py b/grc/src/gui/FileDialogs.py index 320c1161c..2758e909b 100644 --- a/grc/src/gui/FileDialogs.py +++ b/grc/src/gui/FileDialogs.py @@ -21,10 +21,9 @@ import pygtk pygtk.require('2.0') import gtk from Dialogs import MessageDialogHelper -from Constants import NEW_FLOGRAPH_TITLE -from .. platforms.base.Constants import \ +from Constants import \ DEFAULT_FILE_PATH, FLOW_GRAPH_FILE_EXTENSION, \ - IMAGE_FILE_EXTENSION + IMAGE_FILE_EXTENSION, NEW_FLOGRAPH_TITLE from os import path OPEN_FLOW_GRAPH = 'open flow graph' diff --git a/grc/src/gui/MainWindow.py b/grc/src/gui/MainWindow.py index 16bbd8dba..647c4db1e 100644 --- a/grc/src/gui/MainWindow.py +++ b/grc/src/gui/MainWindow.py @@ -19,8 +19,8 @@ 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 -from .. platforms.base.Constants import FLOW_GRAPH_FILE_EXTENSION + NEW_FLOGRAPH_TITLE, REPORTS_WINDOW_HEIGHT, \ + FLOW_GRAPH_FILE_EXTENSION from Actions import APPLICATION_QUIT, FLOW_GRAPH_KILL import pygtk pygtk.require('2.0') diff --git a/grc/src/gui/Preferences.py b/grc/src/gui/Preferences.py index 08b3da5cc..80c4232b8 100644 --- a/grc/src/gui/Preferences.py +++ b/grc/src/gui/Preferences.py @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ -from .. platforms.base.Constants import HOME_DIR, FLOW_GRAPH_DTD +from .. platforms.base.Constants import FLOW_GRAPH_DTD from .. utils import ParseXML import Messages import os @@ -38,7 +38,7 @@ class _Preferences(object): #get prefs block self._prefs_block = platform.get_prefs_block() #prefs file path - self._prefs_file_path = os.path.join(HOME_DIR, self._prefs_block.get_param('prefs_file').get_value()) + self._prefs_file_path = os.path.join(os.path.expanduser('~'), self._prefs_block.get_param('prefs_file').get_value()) #load try: ParseXML.validate_dtd(self._prefs_file_path, FLOW_GRAPH_DTD) diff --git a/grc/src/platforms/base/Constants.py.in b/grc/src/platforms/base/Constants.py.in index 4ee4278f1..6d60f2493 100644 --- a/grc/src/platforms/base/Constants.py.in +++ b/grc/src/platforms/base/Constants.py.in @@ -19,29 +19,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA import os -##The package name. +#package and version constants PACKAGE = '@PACKAGE@' - -##The current version. VERSION = '@VERSION@' -##Location of external data files. +#setup paths DATA_DIR = '@datadir@' - -##DTD validator for saved flow graphs. FLOW_GRAPH_DTD = os.path.join(DATA_DIR, 'flow_graph.dtd') - -##The default file extension for flow graphs. -FLOW_GRAPH_FILE_EXTENSION = '.grc' - -##The default file extension for saving flow graph snap shots. -IMAGE_FILE_EXTENSION = '.png' - -##The default path for the open/save dialogs. -DEFAULT_FILE_PATH = os.getcwd() - -##The default icon for the gtk windows. -PY_GTK_ICON = os.path.join(DATA_DIR, 'grc-icon-256.png') - -##The users home directory. -HOME_DIR = os.path.expanduser('~') +BLOCK_TREE_DTD = os.path.join(DATA_DIR, 'block_tree.dtd') diff --git a/grc/src/platforms/base/Platform.py b/grc/src/platforms/base/Platform.py index 2904208cc..ee6cd3ba3 100644 --- a/grc/src/platforms/base/Platform.py +++ b/grc/src/platforms/base/Platform.py @@ -26,7 +26,7 @@ from Connection import Connection as _Connection from Block import Block as _Block from Port import Port as _Port from Param import Param as _Param -from Constants import DATA_DIR +from Constants import BLOCK_TREE_DTD class Platform(_Element): @@ -102,7 +102,7 @@ class Platform(_Element): block_tree.add_block(parent, self.get_block(block_key)) #load the block tree f = self._block_tree - try: ParseXML.validate_dtd(f, os.path.join(DATA_DIR, 'block_tree.dtd')) + try: ParseXML.validate_dtd(f, BLOCK_TREE_DTD) except ParseXML.XMLSyntaxError, e: self._exit_with_error('Block tree "%s" failed: \n\t%s'%(f, e)) #add all blocks in the tree load_category(ParseXML.from_file(f)['cat']) diff --git a/grc/src/platforms/gui/Param.py b/grc/src/platforms/gui/Param.py index a2e09172c..013a8f84f 100644 --- a/grc/src/platforms/gui/Param.py +++ b/grc/src/platforms/gui/Param.py @@ -25,6 +25,7 @@ import gtk import pango import gobject from Constants import PARAM_LABEL_FONT, PARAM_FONT +from ... gui.Constants import DEFAULT_FILE_PATH from os import path ###################################################################################################### diff --git a/grc/src/platforms/python/Platform.py b/grc/src/platforms/python/Platform.py index c31701e0e..d1c8a36a8 100644 --- a/grc/src/platforms/python/Platform.py +++ b/grc/src/platforms/python/Platform.py @@ -18,7 +18,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ import os -from .. base.Constants import FLOW_GRAPH_FILE_EXTENSION from .. base.Platform import Platform as _Platform from FlowGraph import FlowGraph as _FlowGraph from Connection import Connection as _Connection |