[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r11191 - in gnuradio/branches/developers/jblum/grc/grc
From: |
jblum |
Subject: |
[Commit-gnuradio] r11191 - in gnuradio/branches/developers/jblum/grc/grc: base blocks gui python |
Date: |
Sat, 13 Jun 2009 22:42:34 -0600 (MDT) |
Author: jblum
Date: 2009-06-13 22:42:34 -0600 (Sat, 13 Jun 2009)
New Revision: 11191
Modified:
gnuradio/branches/developers/jblum/grc/grc/base/Platform.py
gnuradio/branches/developers/jblum/grc/grc/blocks/Makefile.am
gnuradio/branches/developers/jblum/grc/grc/gui/NotebookPage.py
gnuradio/branches/developers/jblum/grc/grc/python/Platform.py
Log:
move the flow graph validation out of the gui code
Modified: gnuradio/branches/developers/jblum/grc/grc/base/Platform.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/base/Platform.py 2009-06-14
04:20:54 UTC (rev 11190)
+++ gnuradio/branches/developers/jblum/grc/grc/base/Platform.py 2009-06-14
04:42:34 UTC (rev 11191)
@@ -26,7 +26,7 @@
from Block import Block as _Block
from Port import Port as _Port
from Param import Param as _Param
-from Constants import BLOCK_TREE_DTD
+from Constants import BLOCK_TREE_DTD, FLOW_GRAPH_DTD
class Platform(_Element):
@@ -85,6 +85,19 @@
except ParseXML.XMLSyntaxError, e:
print >> sys.stderr, 'Warning: Block
validation failed: %s\n\tIgnoring: %s'%(e, xml_file)
+ def parse_flow_graph(self, flow_graph_file):
+ """
+ Parse a saved flow graph file.
+ Ensure that the file exists, and passes the dtd check.
+ @param flow_graph_file the flow graph file
+ @return nested data
+ @throws exception if the validation fails
+ """
+ file_path = flow_graph_file or self._default_flow_graph
+ open(flow_graph_file, 'r') #test open
+ ParseXML.validate_dtd(flow_graph_file, FLOW_GRAPH_DTD)
+ return ParseXML.from_file(flow_graph_file)
+
def load_block_tree(self, block_tree):
"""
Load a block tree with categories and blocks.
@@ -117,8 +130,6 @@
def get_new_flow_graph(self): return self.FlowGraph(self)
- def get_default_flow_graph(self): return self._default_flow_graph
-
def get_generator(self): return self._generator
##############################################
Modified: gnuradio/branches/developers/jblum/grc/grc/blocks/Makefile.am
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/blocks/Makefile.am
2009-06-14 04:20:54 UTC (rev 11190)
+++ gnuradio/branches/developers/jblum/grc/grc/blocks/Makefile.am
2009-06-14 04:42:34 UTC (rev 11191)
@@ -1,5 +1,5 @@
#
-# Copyright 2008 Free Software Foundation, Inc.
+# Copyright 2008, 2009 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
Modified: gnuradio/branches/developers/jblum/grc/grc/gui/NotebookPage.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/gui/NotebookPage.py
2009-06-14 04:20:54 UTC (rev 11190)
+++ gnuradio/branches/developers/jblum/grc/grc/gui/NotebookPage.py
2009-06-14 04:42:34 UTC (rev 11191)
@@ -21,9 +21,7 @@
import pygtk
pygtk.require('2.0')
import gtk
-from .. base import ParseXML
from StateCache import StateCache
-from .. base.Constants import FLOW_GRAPH_DTD
from Constants import MIN_WINDOW_WIDTH, MIN_WINDOW_HEIGHT
from DrawingArea import DrawingArea
import os
@@ -46,10 +44,7 @@
#import the file
self.main_window = main_window
self.set_file_path(file_path)
- file_path = file_path or
flow_graph.get_parent().get_default_flow_graph()
- open(file_path, 'r') #test open
- ParseXML.validate_dtd(file_path, FLOW_GRAPH_DTD)
- initial_state = ParseXML.from_file(file_path)
+ initial_state =
flow_graph.get_parent().parse_flow_graph(file_path)
self.state_cache = StateCache(initial_state)
self.set_saved(True)
#import the data to the flow graph
Modified: gnuradio/branches/developers/jblum/grc/grc/python/Platform.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/python/Platform.py
2009-06-14 04:20:54 UTC (rev 11190)
+++ gnuradio/branches/developers/jblum/grc/grc/python/Platform.py
2009-06-14 04:42:34 UTC (rev 11191)
@@ -37,9 +37,8 @@
"""
#ensure hier dir
if not os.path.exists(HIER_BLOCKS_LIB_DIR):
os.mkdir(HIER_BLOCKS_LIB_DIR)
- block_paths = extra_blocks + BLOCKS_DIRS
- #convert block paths to absolute paths, ensure uniqueness
- block_paths = set(map(os.path.abspath, block_paths))
+ #convert block paths to absolute paths
+ block_paths = set(map(os.path.abspath, BLOCKS_DIRS))
#init
_Platform.__init__(
self,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r11191 - in gnuradio/branches/developers/jblum/grc/grc: base blocks gui python,
jblum <=