From 1937f756fd4027ace86316fc6fb1433cd832e6eb Mon Sep 17 00:00:00 2001
From: Sebastian Koslowski <koslowski@kit.edu>
Date: Tue, 5 Apr 2016 22:03:43 +0200
Subject: grc: separate core and OOT block trees via the category of each block

Each block get assigned a module based on the root of its category.
The category is set via a block_tree.xml or else from its <category> tag.
The category root is only interpreted as module name if it is in square brackets.
Else the default module 'Others' is used.
---
 grc/core/Block.py | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

(limited to 'grc/core/Block.py')

diff --git a/grc/core/Block.py b/grc/core/Block.py
index f67d990857..8a683a2b6b 100644
--- a/grc/core/Block.py
+++ b/grc/core/Block.py
@@ -79,7 +79,8 @@ class Block(Element):
         sinks = n.findall('sink')
         self._name = n.find('name')
         self._key = n.find('key')
-        self._category = n.find('category') or ''
+        category = (n.find('category') or '').split('/')
+        self.category = [cat.strip() for cat in category if cat.strip()]
         self._flags = n.find('flags') or ''
         # Backwards compatibility
         if n.find('throttle') and BLOCK_FLAG_THROTTLE not in self._flags:
@@ -594,12 +595,6 @@ class Block(Element):
     def get_key(self):
         return self._key
 
-    def get_category(self):
-        return self._category
-
-    def set_category(self, cat):
-        self._category = cat
-
     def get_ports(self):
         return self.get_sources() + self.get_sinks()
 
-- 
cgit v1.2.3