[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r7892 - in grc/branches/grc_reloaded: notes src/grc sr
From: |
jblum |
Subject: |
[Commit-gnuradio] r7892 - in grc/branches/grc_reloaded: notes src/grc src/grc/gui/elements src/grc/platforms/gnuradio_python src/grc/platforms/gnuradio_python/blocks/graphical_sinks src/grc/platforms/gnuradio_python/data |
Date: |
Thu, 28 Feb 2008 23:40:28 -0700 (MST) |
Author: jblum
Date: 2008-02-28 23:40:27 -0700 (Thu, 28 Feb 2008)
New Revision: 7892
Added:
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/graphical_sinks/wxgui_constellationsink2.xml
Modified:
grc/branches/grc_reloaded/notes/todo.txt
grc/branches/grc_reloaded/src/grc/ActionHandler.py
grc/branches/grc_reloaded/src/grc/Constants.py
grc/branches/grc_reloaded/src/grc/gui/elements/FlowGraph.py
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/Generator.py
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/data/block_tree.xml
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/data/wx_gui.tmpl
Log:
moved exec into generator
Modified: grc/branches/grc_reloaded/notes/todo.txt
===================================================================
--- grc/branches/grc_reloaded/notes/todo.txt 2008-02-29 04:56:22 UTC (rev
7891)
+++ grc/branches/grc_reloaded/notes/todo.txt 2008-02-29 06:40:27 UTC (rev
7892)
@@ -3,6 +3,7 @@
usrp diagnostics in scripts (separate from grc)
generate button next to execute
dtd for saved flow graphs
+pid file in generator
############ Blocks to Add: ####################
-ofdm (blks2)
@@ -20,6 +21,10 @@
-save working directory after close
-create sub-flow graphs to be used in larger flow graphs
-copy and paste blocks
+-scope sink constructor needs average option and triggering option
+-const sink constructor needs marker option
+-clean up const sink display
+-clean up scope sink display
############ wxPython Features: ####################
-dump wx running graph to png?
Modified: grc/branches/grc_reloaded/src/grc/ActionHandler.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/ActionHandler.py 2008-02-29 04:56:22 UTC
(rev 7891)
+++ grc/branches/grc_reloaded/src/grc/ActionHandler.py 2008-02-29 06:40:27 UTC
(rev 7892)
@@ -20,7 +20,7 @@
#ActionHandler builds the interface and handles most of the user inputs.
address@hidden Josh Blum
-import os, sys, popen2
+import os, sys
from Constants import *
from Actions import *
import pygtk
@@ -341,35 +341,22 @@
self.page = action_handler.get_page()
#random id so multiple flow graphs can run w/o files
intersecting
rand_id = random.randint(10000, 99999)
- #generate
- try:
- generator = self.flow_graph.get_parent().get_generator()
- g = generator(self.flow_graph)
- self.exec_file =
self.page.get_file_path().replace(FLOW_GRAPH_FILE_EXTENSION, '') + '.py'
- open(self.exec_file, 'w').write(str(g))
- except:
- #TODO Messages
- print "Could not generate file"
- return
- #set files
- self.pid_file = '/tmp/grc-%d-%d.pid'%(os.getpid(), rand_id)
- self.page.set_pid_file(self.pid_file)
+ #set pid file
+ pid_file = '/tmp/grc-%d-%d.pid'%(os.getpid(), rand_id)
+ self.page.set_pid_file(pid_file)
+ #update
self.update_exec_stop()
- Messages.send_start_exec(self.exec_file)
+ Messages.send_start_exec(self.page.get_file_path())
self.start()
def run(self):
"""Execute the flow graph."""
- cmd = '%s "%s" --pid_file="%s"'%(
- PYEXEC,
- self.exec_file,
- self.pid_file
- )
- p = popen2.Popen3(cmd=cmd, capturestderr=True)
- #read all the lines of the stderr into a list
- Messages.send_end_exec(p.childerr.readlines())
- try: os.remove(self.pid_file)
- except: print "could not remove pid file: %s"%self.pid_file
+ #get generator
+ generator = self.flow_graph.get_parent().get_generator()
+ #execute generator
+ lines =
generator(self.flow_graph).execute(self.page.get_file_path(),
self.page.get_pid_file())
+ #handle completion
+ Messages.send_end_exec(lines)
self.page.set_pid_file('')
self.update_exec_stop()
Modified: grc/branches/grc_reloaded/src/grc/Constants.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/Constants.py 2008-02-29 04:56:22 UTC
(rev 7891)
+++ grc/branches/grc_reloaded/src/grc/Constants.py 2008-02-29 06:40:27 UTC
(rev 7892)
@@ -20,7 +20,7 @@
#Global constants
address@hidden Josh Blum
-import sys, os
+import os
import mutex
##mutex used when running a flow graph.
@@ -171,16 +171,6 @@
##The default icon for the gtk windows.
PY_GTK_ICON = os.path.abspath(DATA_DIR + '/grc-icon-256.png')
-##The default icon for the wx windows.
-WX_APP_ICON = os.path.abspath(DATA_DIR + '/grc-icon-32.png')
-#>>> platform dependency! wx under cygwin has issues with icon paths #
-if sys.platform == 'cygwin': WX_APP_ICON = None
-
-##The default binary to execute python files.
-PYEXEC = 'python'
-#>>> platform dependency! MacOS requires pythonw to run wx apps #
-if sys.platform == 'darwin': PYEXEC = 'pythonw'
-
##The default user preferences file.
PREFERENCES_FILE_PATH = os.path.abspath(DEFAULT_FILE_PATH + '/.grc.xml')
address@hidden
Modified: grc/branches/grc_reloaded/src/grc/gui/elements/FlowGraph.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/elements/FlowGraph.py 2008-02-29
04:56:22 UTC (rev 7891)
+++ grc/branches/grc_reloaded/src/grc/gui/elements/FlowGraph.py 2008-02-29
06:40:27 UTC (rev 7892)
@@ -75,9 +75,9 @@
Add a block of the given key to this flow graph.
@param key the block key
"""
- index = 0
+ index = -1
while True:
- id = '%s%d'%(key, index)
+ id = (index < 0) and key or '%s%d'%(key, index)
index = index + 1
#make sure that the id is not used by another block
if not filter(lambda e: e.is_block() and e.get_id() ==
id, self.get_elements()):
Modified:
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/Generator.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/Generator.py
2008-02-29 04:56:22 UTC (rev 7891)
+++ grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/Generator.py
2008-02-29 06:40:27 UTC (rev 7892)
@@ -21,8 +21,15 @@
address@hidden Josh Blum
import os
+import popen2
+import sys
from Cheetah.Template import Template
+##The default binary to execute python files.
+PYEXEC = 'python'
+#>>> platform dependency! MacOS requires pythonw to run wx apps #
+if sys.platform == 'darwin': PYEXEC = 'pythonw'
+
PATH = os.path.dirname(__file__)
NO_GUI_TEMPLATE = PATH + '/data/no_gui.tmpl'
@@ -33,7 +40,30 @@
def __init__(self, flow_graph):
self._flow_graph = flow_graph
+ self._pid_file = ''
+ def execute(self, file_path, pid_file=''):
+ """!
+ Generate and execute this python flow graph.
+ @param file_path the file path of the flow graph
+ @param pid_file the optional pid file to write to
+ @return a list of errors
+ """
+ self._pid_file = pid_file
+ exec_file = file_path + '.py'
+ #generate file
+ try: open(exec_file, 'w').write(str(self))
+ except: return ["Could not generate file."]
+ #execute
+ cmd = '%s %s'%(PYEXEC, exec_file)
+ if self._flow_graph.get_option('generate_options') == 'no_gui':
+ cmd = 'xterm -e ' + cmd
+ p = popen2.Popen3(cmd=cmd, capturestderr=True)
+ try: os.remove(self._pid_file)
+ except: print "could not remove pid file: %s"%self._pid_file
+ #read all the lines of the stderr into a list
+ return p.childerr.readlines()
+
def __str__(self):
"""!
Convert the flow graph to python code.
Copied:
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/graphical_sinks/wxgui_constellationsink2.xml
(from rev 7891,
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/graphical_sinks/wxgui_scopesink2.xml)
===================================================================
---
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/graphical_sinks/wxgui_constellationsink2.xml
(rev 0)
+++
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/graphical_sinks/wxgui_constellationsink2.xml
2008-02-29 06:40:27 UTC (rev 7892)
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+<!DOCTYPE block SYSTEM "../block.dtd">
+<!--
+###################################################
+##Constellation Sink
+###################################################
+ -->
+<block>
+ <name>Constellation Sink</name>
+ <key>wxgui_constellationsink2</key>
+ <import>from gnuradio.wxgui import scopesink2</import>
+ <make>scopesink2.constellation_sink(
+ _frame,
+ title=$title,
+ sample_rate=$samp_rate,
+ frame_decim=$frame_decim,
+)</make>
+ <callback>set_sample_rate($samp_rate)</callback>
+ <param>
+ <name>Title</name>
+ <key>title</key>
+ <value>Constellation Plot</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Sample Rate</name>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Frame Decimation</name>
+ <key>frame_decim</key>
+ <value>15</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Grid Position</name>
+ <key>grid_pos</key>
+ <value>0, 0, 1, 1</value>
+ <type>grid_pos</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+ <doc>
+Use the Grid Position (row, column, row span, column span) to position the
graphical element in the window.
+ </doc>
+</block>
Modified:
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/data/block_tree.xml
===================================================================
---
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/data/block_tree.xml
2008-02-29 04:56:22 UTC (rev 7891)
+++
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/data/block_tree.xml
2008-02-29 06:40:27 UTC (rev 7892)
@@ -35,7 +35,7 @@
<block>number_sink</block>
<block>wxgui_scopesink2</block>
<block>wxgui_fftsink2</block>
- <block>constellation_sink</block>
+ <block>wxgui_constellationsink2</block>
<block>waterfall_sink</block>
</cat>
<cat>
Modified:
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/data/wx_gui.tmpl
===================================================================
---
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/data/wx_gui.tmpl
2008-02-29 04:56:22 UTC (rev 7891)
+++
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/data/wx_gui.tmpl
2008-02-29 06:40:27 UTC (rev 7892)
@@ -15,7 +15,14 @@
########################################################
#import time
#import os
-#from grc.Constants import WX_APP_ICON,MAIN_WINDOW_PREFIX
+#import sys
+#from grc.Constants import MAIN_WINDOW_PREFIX,DATA_DIR
+##The default icon for the wx windows.
+#set $WX_APP_ICON = $DATA_DIR + '/grc-icon-32.png'
+##>>> platform dependency! wx under cygwin has issues with icon paths #
+#if sys.platform == 'cygwin'
+#set $WX_APP_ICON = None
+#end if
$('#'*40)
# Gnuradio Python Flow Graph (wx gui)
$('# Name: %s'%$flow_graph.get_option('name'))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r7892 - in grc/branches/grc_reloaded: notes src/grc src/grc/gui/elements src/grc/platforms/gnuradio_python src/grc/platforms/gnuradio_python/blocks/graphical_sinks src/grc/platforms/gnuradio_python/data,
jblum <=