summaryrefslogtreecommitdiff
path: root/grc/core/Constants.py
diff options
context:
space:
mode:
authorAndrej Rode <mail@andrejro.de>2018-06-23 17:44:58 +0200
committerAndrej Rode <mail@andrejro.de>2018-06-23 17:44:58 +0200
commit5e07e65fe9350a51cd45f8f21cfa6bf144e42e1c (patch)
treeb88dde44a0ba1f2ce1b382bbca02e80050f77a17 /grc/core/Constants.py
parent9f7e39ee5141791f93dbc1c842b1d1a49e33b068 (diff)
parente82e337d0c74fa7ea5e8b8429de29bec43818552 (diff)
Merge branch 'python3_fix' into python3_merge
Diffstat (limited to 'grc/core/Constants.py')
-rw-r--r--grc/core/Constants.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/grc/core/Constants.py b/grc/core/Constants.py
index fc5383378c..8ed8899c70 100644
--- a/grc/core/Constants.py
+++ b/grc/core/Constants.py
@@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
from __future__ import absolute_import
import os
+import numbers
import stat
import numpy
@@ -31,6 +32,8 @@ BLOCK_DTD = os.path.join(DATA_DIR, 'block.dtd')
DEFAULT_FLOW_GRAPH = os.path.join(DATA_DIR, 'default_flow_graph.grc')
DEFAULT_HIER_BLOCK_LIB_DIR = os.path.expanduser('~/.grc_gnuradio')
+CACHE_FILE = os.path.expanduser('~/.cache/grc_gnuradio/cache.json')
+
BLOCK_DESCRIPTION_FILE_FORMAT_VERSION = 1
# File format versions:
# 0: undefined / legacy
@@ -52,7 +55,7 @@ TOP_BLOCK_FILE_MODE = stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | stat.S_IRGRP
stat.S_IWGRP | stat.S_IXGRP | stat.S_IROTH
HIER_BLOCK_FILE_MODE = stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IWGRP | stat.S_IROTH
-PARAM_TYPE_NAMES = (
+PARAM_TYPE_NAMES = {
'raw', 'enum',
'complex', 'real', 'float', 'int',
'complex_vector', 'real_vector', 'float_vector', 'int_vector',
@@ -61,18 +64,17 @@ PARAM_TYPE_NAMES = (
'id', 'stream_id',
'gui_hint',
'import',
-)
+}
+
+PARAM_TYPE_MAP = {
+ 'complex': numbers.Complex,
+ 'float': numbers.Real,
+ 'real': numbers.Real,
+ 'int': numbers.Integral,
+}
# Define types, native python + numpy
VECTOR_TYPES = (tuple, list, set, numpy.ndarray)
-COMPLEX_TYPES = [complex, numpy.complex, numpy.complex64, numpy.complex128]
-REAL_TYPES = [float, numpy.float, numpy.float32, numpy.float64]
-INT_TYPES = [int, numpy.int, numpy.int8, numpy.int16, numpy.int32, numpy.uint64,
- numpy.uint, numpy.uint8, numpy.uint16, numpy.uint32, numpy.uint64]
-# Cast to tuple for isinstance, concat subtypes
-COMPLEX_TYPES = tuple(COMPLEX_TYPES + REAL_TYPES + INT_TYPES)
-REAL_TYPES = tuple(REAL_TYPES + INT_TYPES)
-INT_TYPES = tuple(INT_TYPES)
# Updating colors. Using the standard color palette from:
# http://www.google.com/design/spec/style/color.html#color-color-palette