[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 15/18: grc-refactoring: fix gui mode errors
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 15/18: grc-refactoring: fix gui mode errors, no empty import on fg init, some renames |
Date: |
Sun, 24 Apr 2016 19:19:37 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit 036264ef5c8e2376acd426a99ca42d29390e3e2a
Author: Sebastian Koslowski <address@hidden>
Date: Fri Apr 8 14:30:46 2016 +0200
grc-refactoring: fix gui mode errors, no empty import on fg init, some
renames
---
grc/core/FlowGraph.py | 30 +++++++++++++++---------------
grc/gui/FlowGraph.py | 4 ++--
2 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/grc/core/FlowGraph.py b/grc/core/FlowGraph.py
index a6c1a00..177d16b 100644
--- a/grc/core/FlowGraph.py
+++ b/grc/core/FlowGraph.py
@@ -62,8 +62,7 @@ class FlowGraph(Element):
self.namespace = {}
self.grc_file_path = ''
-
- self.import_data()
+ self._options_block = self.new_block('options')
def __str__(self):
return 'FlowGraph - {}({})'.format(self.get_option('title'),
self.get_option('id'))
@@ -286,7 +285,7 @@ class FlowGraph(Element):
# Add/remove stuff
##############################################
- def get_new_block(self, key):
+ def new_block(self, key):
"""
Get a new block of the specified key.
Add the block to the list of elements.
@@ -375,7 +374,7 @@ class FlowGraph(Element):
})
return odict({'flow_graph': n, '_instructions': instructions})
- def import_data(self, n=None):
+ def import_data(self, n):
"""
Import blocks and connections into this flow graph.
Clear this flowgraph of all previous blocks and connections.
@@ -384,7 +383,6 @@ class FlowGraph(Element):
Args:
n: the nested data odict
"""
- errors = False
# Remove previous elements
del self.blocks[:]
del self.connections[:]
@@ -399,34 +397,35 @@ class FlowGraph(Element):
self._timestamp = fg_n.find('timestamp') or time.ctime()
# build the blocks
- self._options_block = self.get_parent().get_new_block(self, 'options')
+ self._options_block = self.new_block('options')
for block_n in fg_n.findall('block'):
key = block_n.find('key')
- block = self._options_block if key == 'options' else
self.get_new_block(key)
+ block = self._options_block if key == 'options' else
self.new_block(key)
if not block:
- platform = self.get_parent()
- # we're before the initial fg rewrite(), so no evaluated
values!
+ # we're before the initial fg update(), so no evaluated values!
# --> use raw value instead
path_param =
self._options_block.get_param('hier_block_src_path')
- file_path = platform.find_file_in_paths(
- filename=key + '.' + platform.get_key(),
+ file_path = self.platform.find_file_in_paths(
+ filename=key + '.grc',
paths=path_param.get_value(),
cwd=self.grc_file_path
)
if file_path: # grc file found. load and get block
- platform.load_and_generate_flow_graph(file_path)
- block = self.get_new_block(key) # can be None
+ self.platform.load_and_generate_flow_graph(file_path)
+ block = self.new_block(key) # can be None
if not block: # looks like this block key cannot be found
# create a dummy block instead
- block = self.get_new_block('dummy_block')
+ block = self.new_block('dummy_block')
# Ugly ugly ugly
_initialize_dummy_block(block, block_n)
print('Block key "%s" not found' % key)
block.import_data(block_n)
+ self.rewrite()
+
# build the connections
def verify_and_get_port(key, block, dir):
ports = block.get_sinks() if dir == 'sink' else block.get_sources()
@@ -442,6 +441,7 @@ class FlowGraph(Element):
raise LookupError('%s key %r not in %s block keys' % (dir,
key, dir))
return port
+ errors = False
for connection_n in fg_n.findall('connection'):
# get the block ids and port keys
source_block_id = connection_n.find('source_block_id')
@@ -454,7 +454,7 @@ class FlowGraph(Element):
# fix old, numeric message ports keys
if file_format < 1:
- source_key, sink_key = self._update_old_message_port_keys(
+ source_key, sink_key = _update_old_message_port_keys(
source_key, sink_key, source_block, sink_block)
# build the connection
diff --git a/grc/gui/FlowGraph.py b/grc/gui/FlowGraph.py
index 2f8ca00..c7c64c6 100644
--- a/grc/gui/FlowGraph.py
+++ b/grc/gui/FlowGraph.py
@@ -150,7 +150,7 @@ class FlowGraph(Element, _Flowgraph):
int(random.uniform(.25, .75)*v_adj.page_size + v_adj.get_value()),
)
#get the new block
- block = self.get_new_block(key)
+ block = self.new_block(key)
block.set_coordinate(coor)
block.set_rotation(0)
block.get_param('id').set_value(id)
@@ -207,7 +207,7 @@ class FlowGraph(Element, _Flowgraph):
for block_n in blocks_n:
block_key = block_n.find('key')
if block_key == 'options': continue
- block = self.get_new_block(block_key)
+ block = self.new_block(block_key)
selected.add(block)
#set params
params_n = block_n.findall('param')
- [Commit-gnuradio] [gnuradio] branch master updated (bdf8517 -> a03a390), git, 2016/04/24
- [Commit-gnuradio] [gnuradio] 15/18: grc-refactoring: fix gui mode errors, no empty import on fg init, some renames,
git <=
- [Commit-gnuradio] [gnuradio] 06/18: grc-refactor: rename grc/model/ to grc/core/, git, 2016/04/24
- [Commit-gnuradio] [gnuradio] 08/18: grc-refactor: Platform.py fixes, FlowGraphProxy, git, 2016/04/24
- [Commit-gnuradio] [gnuradio] 02/18: grc-refactor: clean-up grc directory, git, 2016/04/24
- [Commit-gnuradio] [gnuradio] 09/18: grc-refactor: move Messages to core, git, 2016/04/24
- [Commit-gnuradio] [gnuradio] 07/18: grc-refactor: cmake fixes and more reorganizing, git, 2016/04/24
- [Commit-gnuradio] [gnuradio] 13/18: grc-refactoring: move template arg to param, git, 2016/04/24
- [Commit-gnuradio] [gnuradio] 14/18: grc-refactor: fix fg load, git, 2016/04/24
- [Commit-gnuradio] [gnuradio] 12/18: grc-refactor: remove (hopefully) all deps to GR in core/ and gui/, git, 2016/04/24
- [Commit-gnuradio] [gnuradio] 18/18: Merge branch 'maint_grcwg' into refactoring, git, 2016/04/24
- [Commit-gnuradio] [gnuradio] 11/18: grc-refactor: move gui prefs to gui, git, 2016/04/24