From: jblum Date: Sun, 28 Sep 2008 03:35:21 +0000 (+0000) Subject: freedesktop X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=0174f42a56c3e95008ffc6a9771f2bb2d155f0f5;p=debian%2Fgnuradio freedesktop git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9668 221aa14e-8319-0410-a670-987f0aec2ac5 --- diff --git a/config/grc_grc.m4 b/config/grc_grc.m4 index c8ea1099..f82c5558 100644 --- a/config/grc_grc.m4 +++ b/config/grc_grc.m4 @@ -76,6 +76,7 @@ AC_DEFUN([GRC_GRC],[ grc/data/platforms/python/Makefile \ grc/data/platforms/python/blocks/Makefile \ grc/scripts/Makefile \ + grc/freedesktop/Makefile \ ]) GRC_BUILD_CONDITIONAL(grc) diff --git a/grc/Makefile.am b/grc/Makefile.am index 5e03d627..104ff186 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 56ff5939..aaf53b4f 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/base/grc-icon-256.png b/grc/data/platforms/base/grc-icon-256.png deleted file mode 100644 index e4e8e54a..00000000 Binary files a/grc/data/platforms/base/grc-icon-256.png and /dev/null differ diff --git a/grc/data/platforms/base/grc-icon-256.svg b/grc/data/platforms/base/grc-icon-256.svg deleted file mode 100644 index 87526d46..00000000 --- a/grc/data/platforms/base/grc-icon-256.svg +++ /dev/null @@ -1,216 +0,0 @@ - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - Patrick Strasser <patrick.strasser@tugraz.at> - - - Icon/Symbol for the GNURadio Companion - grc-icon.svg - 2007-02-23 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/grc/data/platforms/base/grc-icon-32.png b/grc/data/platforms/base/grc-icon-32.png deleted file mode 100644 index 1e4f4f6c..00000000 Binary files a/grc/data/platforms/base/grc-icon-32.png and /dev/null differ diff --git a/grc/data/platforms/python/flow_graph.tmpl b/grc/data/platforms/python/flow_graph.tmpl index 0d02d258..6bf79fc8 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 00000000..196d3a78 --- /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 00000000..d9c70ca9 --- /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 00000000..a5cb95d9 --- /dev/null +++ b/grc/freedesktop/gnuradio-grc.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/grc/freedesktop/gnuradio-usrp_diagnostics.desktop b/grc/freedesktop/gnuradio-usrp_diagnostics.desktop new file mode 100644 index 00000000..9a5000bb --- /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/freedesktop/grc-icon-256.png b/grc/freedesktop/grc-icon-256.png new file mode 100644 index 00000000..e4e8e54a Binary files /dev/null and b/grc/freedesktop/grc-icon-256.png differ diff --git a/grc/freedesktop/grc-icon-256.svg b/grc/freedesktop/grc-icon-256.svg new file mode 100644 index 00000000..87526d46 --- /dev/null +++ b/grc/freedesktop/grc-icon-256.svg @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Patrick Strasser <patrick.strasser@tugraz.at> + + + Icon/Symbol for the GNURadio Companion + grc-icon.svg + 2007-02-23 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/grc/freedesktop/grc-icon-32.png b/grc/freedesktop/grc-icon-32.png new file mode 100644 index 00000000..1e4f4f6c Binary files /dev/null and b/grc/freedesktop/grc-icon-32.png differ diff --git a/grc/freedesktop/grc-icon-48.png b/grc/freedesktop/grc-icon-48.png new file mode 100644 index 00000000..caddc92a Binary files /dev/null and b/grc/freedesktop/grc-icon-48.png differ diff --git a/grc/scripts/grc b/grc/scripts/grc index 93a9a05c..4073c92f 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 95825bd0..7558d16a 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 804fff4c..f5803cc1 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 320c1161..2758e909 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 16bbd8db..647c4db1 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 08b3da5c..80c4232b 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 4ee4278f..6d60f249 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 2904208c..ee6cd3ba 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 a2e09172..013a8f84 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 c31701e0..d1c8a36a 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