diff options
Diffstat (limited to 'grc')
21 files changed, 106 insertions, 44 deletions
diff --git a/grc/Makefile.am b/grc/Makefile.am index 5e03d6276..104ff186b 100644 --- a/grc/Makefile.am +++ b/grc/Makefile.am @@ -24,5 +24,6 @@ include $(top_srcdir)/grc/Makefile.inc SUBDIRS = \ data \ examples \ + freedesktop \ scripts \ src diff --git a/grc/data/platforms/base/Makefile.am b/grc/data/platforms/base/Makefile.am index 56ff5939c..aaf53b4fc 100644 --- a/grc/data/platforms/base/Makefile.am +++ b/grc/data/platforms/base/Makefile.am @@ -25,7 +25,4 @@ ourdatadir = $(grc_base_data_dir) dist_ourdata_DATA = \ block_tree.dtd \ - flow_graph.dtd \ - grc-icon-256.png \ - grc-icon-256.svg \ - grc-icon-32.png + flow_graph.dtd diff --git a/grc/data/platforms/python/flow_graph.tmpl b/grc/data/platforms/python/flow_graph.tmpl index 0d02d258e..6bf79fc8b 100644 --- a/grc/data/platforms/python/flow_graph.tmpl +++ b/grc/data/platforms/python/flow_graph.tmpl @@ -41,15 +41,18 @@ $imp #set $class_name = $flow_graph.get_option('id') #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 import Preferences + #import gtk + #set $icon = gtk.IconTheme().lookup_icon('gnuradio-grc', 32, 0) class $(class_name)(grc_wxgui.top_block_gui): def __init__($param_str): grc_wxgui.top_block_gui.__init__( self, title="$Preferences.window_prefix() - Executing: $flow_graph.get_option('title')", - icon="$(os.path.join($DATA_DIR, 'grc-icon-32.png'))", + #if $icon + icon="$icon.get_filename()", + #end if ) #elif $generate_options == 'no_gui' class $(class_name)(gr.top_block): diff --git a/grc/freedesktop/Makefile.am b/grc/freedesktop/Makefile.am new file mode 100644 index 000000000..196d3a780 --- /dev/null +++ b/grc/freedesktop/Makefile.am @@ -0,0 +1,46 @@ +# +# Copyright 2008 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +include $(top_srcdir)/grc/Makefile.inc + +install-data-local: + xdg-icon-resource install --context mimetypes --mode system --size 48 $(srcdir)/grc-icon-48.png application-gnuradio-grc + xdg-icon-resource install --context apps --mode system --size 256 $(srcdir)/grc-icon-256.png gnuradio-grc + xdg-icon-resource install --context apps --mode system --size 32 $(srcdir)/grc-icon-32.png gnuradio-grc + xdg-mime install --mode system $(srcdir)/gnuradio-grc.xml + xdg-desktop-menu install --mode system $(srcdir)/gnuradio-grc.desktop + xdg-desktop-menu install --mode system $(srcdir)/gnuradio-usrp_diagnostics.desktop + +uninstall-local: + xdg-icon-resource uninstall --context mimetypes --mode system --size 48 application-gnuradio-grc + xdg-icon-resource uninstall --context apps --mode system --size 256 gnuradio-grc + xdg-icon-resource uninstall --context apps --mode system --size 32 gnuradio-grc + xdg-mime uninstall --mode system $(srcdir)/gnuradio-grc.xml + xdg-desktop-menu uninstall --mode system $(srcdir)/gnuradio-grc.desktop + xdg-desktop-menu uninstall --mode system $(srcdir)/gnuradio-usrp_diagnostics.desktop + +EXTRA_DIST = \ + $(srcdir)/grc-icon-256.png \ + $(srcdir)/grc-icon-48.png \ + $(srcdir)/grc-icon-32.png \ + $(srcdir)/gnuradio-grc.xml \ + $(srcdir)/gnuradio-grc.desktop \ + $(srcdir)/gnuradio-usrp_diagnostics.desktop diff --git a/grc/freedesktop/gnuradio-grc.desktop b/grc/freedesktop/gnuradio-grc.desktop new file mode 100644 index 000000000..d9c70ca92 --- /dev/null +++ b/grc/freedesktop/gnuradio-grc.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Name=GRC +Exec=grc %F +Categories=Development; +MimeType=application/gnuradio-grc; +Icon=gnuradio-grc diff --git a/grc/freedesktop/gnuradio-grc.xml b/grc/freedesktop/gnuradio-grc.xml new file mode 100644 index 000000000..a5cb95d9f --- /dev/null +++ b/grc/freedesktop/gnuradio-grc.xml @@ -0,0 +1,8 @@ +<?xml version="1.0"?> +<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'> + <mime-type type="application/gnuradio-grc"> + <sub-class-of type="application/xml"/> + <glob pattern="*.grc"/> + <glob pattern="*.grc.xml"/> + </mime-type> +</mime-info> diff --git a/grc/freedesktop/gnuradio-usrp_diagnostics.desktop b/grc/freedesktop/gnuradio-usrp_diagnostics.desktop new file mode 100644 index 000000000..9a5000bb7 --- /dev/null +++ b/grc/freedesktop/gnuradio-usrp_diagnostics.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Name=USRP Diagnostics +Exec=usrp_diagnostics +Categories=Development; +Icon=gnuradio-grc diff --git a/grc/data/platforms/base/grc-icon-256.png b/grc/freedesktop/grc-icon-256.png Binary files differindex e4e8e54ae..e4e8e54ae 100644 --- a/grc/data/platforms/base/grc-icon-256.png +++ b/grc/freedesktop/grc-icon-256.png diff --git a/grc/data/platforms/base/grc-icon-256.svg b/grc/freedesktop/grc-icon-256.svg index 87526d46c..87526d46c 100644 --- a/grc/data/platforms/base/grc-icon-256.svg +++ b/grc/freedesktop/grc-icon-256.svg diff --git a/grc/data/platforms/base/grc-icon-32.png b/grc/freedesktop/grc-icon-32.png Binary files differindex 1e4f4f6c5..1e4f4f6c5 100644 --- a/grc/data/platforms/base/grc-icon-32.png +++ b/grc/freedesktop/grc-icon-32.png diff --git a/grc/freedesktop/grc-icon-48.png b/grc/freedesktop/grc-icon-48.png Binary files differnew file mode 100644 index 000000000..caddc92ad --- /dev/null +++ b/grc/freedesktop/grc-icon-48.png diff --git a/grc/scripts/grc b/grc/scripts/grc index 93a9a05c0..4073c92f8 100755 --- a/grc/scripts/grc +++ b/grc/scripts/grc @@ -18,7 +18,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ -from gnuradio.grc.platforms.base.Constants import VERSION, FLOW_GRAPH_FILE_EXTENSION +from gnuradio.grc.gui.Constants import FLOW_GRAPH_FILE_EXTENSION +from gnuradio.grc.platforms.base.Constants import VERSION from optparse import OptionParser if __name__ == "__main__": 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 |