[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r11255 - in gnuradio/branches/developers/jblum/grc/grc
From: |
jblum |
Subject: |
[Commit-gnuradio] r11255 - in gnuradio/branches/developers/jblum/grc/grc: . base blocks gui python |
Date: |
Sun, 21 Jun 2009 13:23:06 -0600 (MDT) |
Author: jblum
Date: 2009-06-21 13:23:06 -0600 (Sun, 21 Jun 2009)
New Revision: 11255
Modified:
gnuradio/branches/developers/jblum/grc/grc/Makefile.am
gnuradio/branches/developers/jblum/grc/grc/__init__.py.in
gnuradio/branches/developers/jblum/grc/grc/base/Platform.py
gnuradio/branches/developers/jblum/grc/grc/blocks/options.xml
gnuradio/branches/developers/jblum/grc/grc/gui/ActionHandler.py
gnuradio/branches/developers/jblum/grc/grc/gui/Dialogs.py
gnuradio/branches/developers/jblum/grc/grc/gui/MainWindow.py
gnuradio/branches/developers/jblum/grc/grc/gui/Messages.py
gnuradio/branches/developers/jblum/grc/grc/gui/NotebookPage.py
gnuradio/branches/developers/jblum/grc/grc/python/Generator.py
gnuradio/branches/developers/jblum/grc/grc/python/Platform.py
gnuradio/branches/developers/jblum/grc/grc/python/flow_graph.tmpl
Log:
Default title, author, desc in options block to blank (and hidden).
Using templates for main window and tab titles.
Switched tab titles to pango markup.
Generified about dialog for multiple platforms,
including passing about information (license, website, version) up though the
platform.
Make use of version and name strings for About dialog and Messages init.
Modified: gnuradio/branches/developers/jblum/grc/grc/Makefile.am
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/Makefile.am 2009-06-21
16:06:01 UTC (rev 11254)
+++ gnuradio/branches/developers/jblum/grc/grc/Makefile.am 2009-06-21
19:23:06 UTC (rev 11255)
@@ -52,7 +52,6 @@
__init__.py: $(srcdir)/__init__.py.in Makefile
sed \
- -e 's|@address@hidden|$(PACKAGE)|g' \
-e 's|@address@hidden|$(VERSION)|g' \
$< > $@
Modified: gnuradio/branches/developers/jblum/grc/grc/__init__.py.in
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/__init__.py.in 2009-06-21
16:06:01 UTC (rev 11254)
+++ gnuradio/branches/developers/jblum/grc/grc/__init__.py.in 2009-06-21
19:23:06 UTC (rev 11255)
@@ -18,5 +18,4 @@
"""
#package and version constants
-PACKAGE = '@PACKAGE@'
VERSION = '@VERSION@'
Modified: gnuradio/branches/developers/jblum/grc/grc/base/Platform.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/base/Platform.py 2009-06-21
16:06:01 UTC (rev 11254)
+++ gnuradio/branches/developers/jblum/grc/grc/base/Platform.py 2009-06-21
19:23:06 UTC (rev 11255)
@@ -30,11 +30,15 @@
class Platform(_Element):
- def __init__(self, name, key, block_paths, block_dtd,
default_flow_graph, generator):
+ def __init__(self, name, version, key, license, website,
+ block_paths, block_dtd, default_flow_graph, generator):
"""
Make a platform from the arguments.
@param name the platform name
+ @param version the version string
@param key the unique platform key
+ @param license a multi-line license (first line is copyright)
+ @param website the website url for this platform
@param block_paths the file paths to blocks in this platform
@param block_dtd the dtd validator for xml block wrappers
@param default_flow_graph the default flow graph file path
@@ -43,7 +47,10 @@
"""
_Element.__init__(self)
self._name = name
+ self._version = version
self._key = key
+ self._license = license
+ self._website = website
self._block_paths = block_paths
self._block_dtd = block_dtd
self._default_flow_graph = default_flow_graph
@@ -147,8 +154,10 @@
def get_new_block(self, flow_graph, key): return self.Block(flow_graph,
n=self._blocks_n[key])
def get_name(self): return self._name
-
+ def get_version(self): return self._version
def get_key(self): return self._key
+ def get_license(self): return self._license
+ def get_website(self): return self._website
##############################################
# Constructors
Modified: gnuradio/branches/developers/jblum/grc/grc/blocks/options.xml
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/blocks/options.xml
2009-06-21 16:06:01 UTC (rev 11254)
+++ gnuradio/branches/developers/jblum/grc/grc/blocks/options.xml
2009-06-21 19:23:06 UTC (rev 11255)
@@ -24,20 +24,23 @@
<param>
<name>Title</name>
<key>title</key>
- <value>untitled</value>
+ <value></value>
<type>string</type>
+ <hide>#if $title() then 'none' else 'part'#</hide>
</param>
<param>
<name>Author</name>
<key>author</key>
- <value>unknown</value>
+ <value></value>
<type>string</type>
+ <hide>#if $author() then 'none' else 'part'#</hide>
</param>
<param>
<name>Description</name>
<key>description</key>
- <value>gnuradio flow graph</value>
+ <value></value>
<type>string</type>
+ <hide>#if $description() then 'none' else 'part'#</hide>
</param>
<param>
<name>Window Size</name>
@@ -51,6 +54,7 @@
<key>generate_options</key>
<value>wx_gui</value>
<type>enum</type>
+ <hide>#if $generate_options() == 'wx_gui' then 'part' else
'none'#</hide>
<option>
<name>WX GUI</name>
<key>wx_gui</key>
Modified: gnuradio/branches/developers/jblum/grc/grc/gui/ActionHandler.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/gui/ActionHandler.py
2009-06-21 16:06:01 UTC (rev 11254)
+++ gnuradio/branches/developers/jblum/grc/grc/gui/ActionHandler.py
2009-06-21 19:23:06 UTC (rev 11255)
@@ -64,7 +64,7 @@
self.get_focus_flag = self.main_window.get_focus_flag
#setup the messages
Messages.register_messenger(self.main_window.add_report_line)
- Messages.send_init()
+ Messages.send_init(platform)
#initialize
self.init_file_paths = file_paths
self.handle_states(Actions.APPLICATION_INITIALIZE)
@@ -233,7 +233,7 @@
# Window stuff
##################################################
elif state == Actions.ABOUT_WINDOW_DISPLAY:
- Dialogs.AboutDialog()
+ Dialogs.AboutDialog(self.get_flow_graph().get_parent())
elif state == Actions.HELP_WINDOW_DISPLAY:
Dialogs.HelpDialog()
##################################################
Modified: gnuradio/branches/developers/jblum/grc/grc/gui/Dialogs.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/gui/Dialogs.py 2009-06-21
16:06:01 UTC (rev 11254)
+++ gnuradio/branches/developers/jblum/grc/grc/gui/Dialogs.py 2009-06-21
19:23:06 UTC (rev 11255)
@@ -20,7 +20,6 @@
import pygtk
pygtk.require('2.0')
import gtk
-from .. import PACKAGE, VERSION
import Preferences
class TextDisplay(gtk.TextView):
@@ -51,8 +50,8 @@
@return the gtk response from run()
"""
message_dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL, type,
buttons)
- if title != None: message_dialog.set_title(title)
- if markup != None: message_dialog.set_markup(markup)
+ if title: message_dialog.set_title(title)
+ if markup: message_dialog.set_markup(markup)
response = message_dialog.run()
message_dialog.destroy()
return response
@@ -60,25 +59,14 @@
class AboutDialog(gtk.AboutDialog):
"""A cute little about dialog."""
- def __init__(self):
+ def __init__(self, platform):
"""AboutDialog constructor."""
gtk.AboutDialog.__init__(self)
- self.set_name(PACKAGE)
- self.set_version(VERSION)
- self.set_license(__doc__)
- 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.set_name(platform.get_name())
+ self.set_version(platform.get_version())
+ self.set_license(platform.get_license())
+ self.set_copyright(platform.get_license().splitlines()[0])
+ self.set_website(platform.get_website())
self.run()
self.destroy()
Modified: gnuradio/branches/developers/jblum/grc/grc/gui/MainWindow.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/gui/MainWindow.py
2009-06-21 16:06:01 UTC (rev 11254)
+++ gnuradio/branches/developers/jblum/grc/grc/gui/MainWindow.py
2009-06-21 19:23:06 UTC (rev 11255)
@@ -31,8 +31,35 @@
from NotebookPage import NotebookPage
import Preferences
import Messages
+import Utils
import os
+MAIN_WINDOW_TITLE_TMPL = """\
+#if not $saved
+*#slurp
+#end if
+#if $basename
+$basename#slurp
+#else
+$new_flowgraph_title#slurp
+#end if
+#if $read_only
+ (read only)#slurp
+#end if
+#if $dirname
+ - $dirname#slurp
+#end if
+ - $platform_name#slurp
+"""
+
+PAGE_TITLE_MARKUP_TMPL = """\
+#set $foreground = $saved and 'black' or 'red'
+<span foreground="$foreground">$encode($title or
$new_flowgraph_title)</span>#slurp
+#if $read_only
+ (ro)#slurp
+#end if
+"""
+
############################################################
# Main window
############################################################
@@ -218,26 +245,24 @@
Show/hide the reports window.
@param title the window title
"""
- title = ''.join((
- self._platform.get_name(),
- ' - Editing: ',
- (self.get_page().get_file_path() or
NEW_FLOGRAPH_TITLE),
- (self.get_page().get_saved() and ' ' or '*'),
#blank must be non empty
- (self.get_page().get_read_only() and '
(read-only)' or ''),
+ gtk.Window.set_title(self,
Utils.parse_template(MAIN_WINDOW_TITLE_TMPL,
+
basename=os.path.basename(self.get_page().get_file_path()),
+
dirname=os.path.dirname(self.get_page().get_file_path()),
+ new_flowgraph_title=NEW_FLOGRAPH_TITLE,
+ read_only=self.get_page().get_read_only(),
+ saved=self.get_page().get_saved(),
+ platform_name=self._platform.get_name(),
)
)
- gtk.Window.set_title(self, title)
#set tab titles
- for page in self._get_pages():
- #get filename and strip out file extension
- title =
os.path.splitext(os.path.basename(page.get_file_path()))[0]
- page.set_text(''.join((
- (title or NEW_FLOGRAPH_TITLE),
- (page.get_saved() and ' ' or
'*'), #blank must be non empty
- (page.get_read_only() and '
(ro)' or ''),
- )
- )
+ for page in self._get_pages(): page.set_markup(
+ Utils.parse_template(PAGE_TITLE_MARKUP_TMPL,
+ #get filename and strip out file extension
+
title=os.path.splitext(os.path.basename(page.get_file_path()))[0],
+ read_only=page.get_read_only(),
saved=page.get_saved(),
+ new_flowgraph_title=NEW_FLOGRAPH_TITLE,
)
+ )
#show/hide notebook tabs
self.notebook.set_show_tabs(len(self._get_pages()) > 1)
Modified: gnuradio/branches/developers/jblum/grc/grc/gui/Messages.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/gui/Messages.py 2009-06-21
16:06:01 UTC (rev 11254)
+++ gnuradio/branches/developers/jblum/grc/grc/gui/Messages.py 2009-06-21
19:23:06 UTC (rev 11255)
@@ -17,7 +17,6 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
-from .. import PACKAGE, VERSION
import traceback
import sys
@@ -44,8 +43,8 @@
###########################################################################
# Special functions for specific program functionalities
###########################################################################
-def send_init():
- send("""<<< Welcome to %s %s >>>\n"""%(PACKAGE, VERSION))
+def send_init(platform):
+ send("""<<< Welcome to %s %s >>>\n"""%(platform.get_name(),
platform.get_version()))
def send_page_switch(file_path):
send('\nShowing: "%s"\n'%file_path)
Modified: gnuradio/branches/developers/jblum/grc/grc/gui/NotebookPage.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/gui/NotebookPage.py
2009-06-21 16:06:01 UTC (rev 11254)
+++ gnuradio/branches/developers/jblum/grc/grc/gui/NotebookPage.py
2009-06-21 19:23:06 UTC (rev 11255)
@@ -1,5 +1,5 @@
"""
-Copyright 2008 Free Software Foundation, Inc.
+Copyright 2008, 2009 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion is free software; you can redistribute it and/or
@@ -106,12 +106,12 @@
self.main_window.page_to_be_closed = self
self.main_window.handle_states(FLOW_GRAPH_CLOSE)
- def set_text(self, text):
+ def set_markup(self, markup):
"""
- Set the text in this label.
- @param text the new text
+ Set the markup in this label.
+ @param markup the new markup text
"""
- self.label.set_text(text)
+ self.label.set_markup(markup)
def get_tab(self):
"""
Modified: gnuradio/branches/developers/jblum/grc/grc/python/Generator.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/python/Generator.py
2009-06-21 16:06:01 UTC (rev 11254)
+++ gnuradio/branches/developers/jblum/grc/grc/python/Generator.py
2009-06-21 19:23:06 UTC (rev 11255)
@@ -81,6 +81,7 @@
Convert the flow graph to python code.
@return a string of python code
"""
+ title = self._flow_graph.get_option('title') or
self._flow_graph.get_option('id').replace('_', ' ').title()
imports = self._flow_graph.get_imports()
variables = self._flow_graph.get_variables()
parameters = self._flow_graph.get_parameters()
@@ -127,6 +128,7 @@
)
#load the namespace
namespace = {
+ 'title': title,
'imports': imports,
'flow_graph': self._flow_graph,
'variables': variables,
Modified: gnuradio/branches/developers/jblum/grc/grc/python/Platform.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/python/Platform.py
2009-06-21 16:06:01 UTC (rev 11254)
+++ gnuradio/branches/developers/jblum/grc/grc/python/Platform.py
2009-06-21 19:23:06 UTC (rev 11255)
@@ -18,6 +18,7 @@
"""
import os
+from .. import VERSION #TEMP: until gnuradio has __version__
from .. base.Platform import Platform as _Platform
from FlowGraph import FlowGraph as _FlowGraph
from Connection import Connection as _Connection
@@ -42,8 +43,11 @@
#init
_Platform.__init__(
self,
- name='GRC',
+ name='GNU Radio Companion',
+ version=VERSION,
key='grc',
+ license=__doc__.strip(),
+
website='http://gnuradio.org/trac/wiki/GNURadioCompanion',
block_paths=block_paths,
block_dtd=BLOCK_DTD,
default_flow_graph=DEFAULT_FLOW_GRAPH,
Modified: gnuradio/branches/developers/jblum/grc/grc/python/flow_graph.tmpl
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/python/flow_graph.tmpl
2009-06-21 16:06:01 UTC (rev 11254)
+++ gnuradio/branches/developers/jblum/grc/grc/python/flow_graph.tmpl
2009-06-21 19:23:06 UTC (rev 11255)
@@ -22,9 +22,13 @@
#set $DIVIDER = '#'*50
$DIVIDER
# Gnuradio Python Flow Graph
-# Title: $flow_graph.get_option('title')
+# Title: $title
+#if $flow_graph.get_option('author')
# Author: $flow_graph.get_option('author')
+#end if
+#if $flow_graph.get_option('description')
# Description: $flow_graph.get_option('description')
+#end if
# Generated: $time.ctime()
$DIVIDER
@@ -52,7 +56,7 @@
def __init__($param_str):
grc_wxgui.top_block_gui.__init__(
self,
- title="$flow_graph.get_parent().get_name() - Executing:
$flow_graph.get_option('title')",
+ title="$title",
#if $icon
icon="$icon.get_filename()",
#end if
@@ -61,7 +65,7 @@
class $(class_name)(gr.top_block):
def __init__($param_str):
- gr.top_block.__init__(self, "$flow_graph.get_option('title')")
+ gr.top_block.__init__(self, "$title")
#elif $generate_options == 'hb'
#set $in_sig = $flow_graph.get_input_signature()
#set $out_sig = $flow_graph.get_output_signature()
@@ -70,7 +74,7 @@
def __init__($param_str):
gr.hier_block2.__init__(
self,
- "$flow_graph.get_option('title')",
+ "$title",
gr.io_signature($in_sig.nports, $in_sig.nports,
$in_sig.size*$in_sig.vlen),
gr.io_signature($out_sig.nports, $out_sig.nports,
$out_sig.size*$out_sig.vlen),
)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r11255 - in gnuradio/branches/developers/jblum/grc/grc: . base blocks gui python,
jblum <=