diff options
author | Sebastian Koslowski <koslowski@kit.edu> | 2016-04-25 21:59:55 +0200 |
---|---|---|
committer | Sebastian Koslowski <koslowski@kit.edu> | 2016-05-20 10:58:01 +0200 |
commit | 4be2523ecc678365c52701a37a1b13c285bef0ba (patch) | |
tree | f0688ddcc94e19fecb3c8bbc3d0be13f9eb4cb11 /grc | |
parent | 89ce0c2d754e85a207023d83da02e8623ae9df64 (diff) |
grc: add warning for block flagged deprecated
Diffstat (limited to 'grc')
-rw-r--r-- | grc/core/Block.py | 5 | ||||
-rw-r--r-- | grc/core/Constants.py | 1 | ||||
-rw-r--r-- | grc/core/generator/Generator.py | 4 |
3 files changed, 10 insertions, 0 deletions
diff --git a/grc/core/Block.py b/grc/core/Block.py index ab4174ce66..f67d990857 100644 --- a/grc/core/Block.py +++ b/grc/core/Block.py @@ -27,6 +27,7 @@ from . Constants import ( BLOCK_FLAG_NEED_QT_GUI, BLOCK_FLAG_NEED_WX_GUI, ADVANCED_PARAM_TAB, DEFAULT_PARAM_TAB, BLOCK_FLAG_THROTTLE, BLOCK_FLAG_DISABLE_BYPASS, + BLOCK_FLAG_DEPRECATED, BLOCK_ENABLED, BLOCK_BYPASSED, BLOCK_DISABLED ) from . Element import Element @@ -626,6 +627,10 @@ class Block(Element): def bypass_disabled(self): return BLOCK_FLAG_DISABLE_BYPASS in self._flags + @property + def is_deprecated(self): + return BLOCK_FLAG_DEPRECATED in self._flags + ############################################## # Access Params ############################################## diff --git a/grc/core/Constants.py b/grc/core/Constants.py index 1d1a17ee93..462049cc73 100644 --- a/grc/core/Constants.py +++ b/grc/core/Constants.py @@ -47,6 +47,7 @@ BLOCK_FLAG_THROTTLE = 'throttle' BLOCK_FLAG_DISABLE_BYPASS = 'disable_bypass' BLOCK_FLAG_NEED_QT_GUI = 'need_qt_gui' BLOCK_FLAG_NEED_WX_GUI = 'need_wx_gui' +BLOCK_FLAG_DEPRECATED = 'deprecated' # Block States BLOCK_DISABLED = 0 diff --git a/grc/core/generator/Generator.py b/grc/core/generator/Generator.py index 641bdea6e6..2fdd8509f1 100644 --- a/grc/core/generator/Generator.py +++ b/grc/core/generator/Generator.py @@ -145,6 +145,10 @@ class TopBlockGenerator(object): filter(lambda b: b.get_enabled() and not b.get_bypassed(), fg.blocks), lambda b: b.get_id(), _get_block_sort_text ) + deprecated_block_keys = set(block.get_name() for block in blocks if block.is_deprecated) + for key in deprecated_block_keys: + Messages.send_warning("The block {!r} is deprecated.".format(key)) + # List of regular blocks (all blocks minus the special ones) blocks = filter(lambda b: b not in (imports + parameters), blocks_all) |