[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r9584 - in gnuradio/trunk/grc: data/platforms/python/b
From: |
jblum |
Subject: |
[Commit-gnuradio] r9584 - in gnuradio/trunk/grc: data/platforms/python/blocks src/platforms/base src/platforms/gui src/platforms/python |
Date: |
Tue, 16 Sep 2008 10:59:14 -0600 (MDT) |
Author: jblum
Date: 2008-09-16 10:59:13 -0600 (Tue, 16 Sep 2008)
New Revision: 9584
Modified:
gnuradio/trunk/grc/data/platforms/python/blocks/gr_sig_source_x.xml
gnuradio/trunk/grc/src/platforms/base/Param.py
gnuradio/trunk/grc/src/platforms/gui/Param.py
gnuradio/trunk/grc/src/platforms/python/Constants.py.in
gnuradio/trunk/grc/src/platforms/python/Param.py
gnuradio/trunk/grc/src/platforms/python/Port.py
Log:
color coding for param entry boxes
Modified: gnuradio/trunk/grc/data/platforms/python/blocks/gr_sig_source_x.xml
===================================================================
--- gnuradio/trunk/grc/data/platforms/python/blocks/gr_sig_source_x.xml
2008-09-16 11:15:33 UTC (rev 9583)
+++ gnuradio/trunk/grc/data/platforms/python/blocks/gr_sig_source_x.xml
2008-09-16 16:59:13 UTC (rev 9584)
@@ -21,21 +21,25 @@
<name>Complex</name>
<key>complex</key>
<opt>fcn:c</opt>
+ <opt>offset_type:complex</opt>
</option>
<option>
<name>Float</name>
<key>float</key>
<opt>fcn:f</opt>
+ <opt>offset_type:real</opt>
</option>
<option>
<name>Int</name>
<key>int</key>
<opt>fcn:i</opt>
+ <opt>offset_type:int</opt>
</option>
<option>
<name>Short</name>
<key>short</key>
<opt>fcn:s</opt>
+ <opt>offset_type:int</opt>
</option>
</param>
<param>
@@ -90,7 +94,7 @@
<name>Offset</name>
<key>offset</key>
<value>0</value>
- <type>complex</type>
+ <type>$type.offset_type</type>
</param>
<source>
<name>out</name>
Modified: gnuradio/trunk/grc/src/platforms/base/Param.py
===================================================================
--- gnuradio/trunk/grc/src/platforms/base/Param.py 2008-09-16 11:15:33 UTC
(rev 9583)
+++ gnuradio/trunk/grc/src/platforms/base/Param.py 2008-09-16 16:59:13 UTC
(rev 9584)
@@ -163,6 +163,8 @@
"""
raise NotImplementedError
+ def get_color(self): return '#FFFFFF'
+
def __str__(self): return 'Param - %s(%s)'%(self.get_name(),
self.get_key())
def is_param(self): return True
Modified: gnuradio/trunk/grc/src/platforms/gui/Param.py
===================================================================
--- gnuradio/trunk/grc/src/platforms/gui/Param.py 2008-09-16 11:15:33 UTC
(rev 9583)
+++ gnuradio/trunk/grc/src/platforms/gui/Param.py 2008-09-16 16:59:13 UTC
(rev 9584)
@@ -43,6 +43,7 @@
self.pack_start(self.label, False)
self.set_markup = lambda m: self.label.set_markup(m)
self.tp = None
+ def set_color(self, color): pass
class EntryParam(InputParam):
"""Provide an entry box for strings and numbers."""
@@ -58,6 +59,7 @@
self.tp = gtk.Tooltips()
self.tp.set_tip(self.entry, '')
self.tp.enable()
+ def set_color(self, color): self.entry.modify_base(gtk.STATE_NORMAL,
gtk.gdk.color_parse(color))
class FileParam(EntryParam):
"""Provide an entry box for filename and a button to browse for a
file."""
@@ -153,15 +155,17 @@
name = '<span underline="low">%s</span>'%name
if not self.is_valid():
self.input.set_markup('<span
foreground="red">%s</span>'%name)
- tip = '- ' + '\n- '.join(self.get_error_messages())
+ tip = 'Error: ' + ' '.join(self.get_error_messages())
else:
self.input.set_markup(name)
- tip = self.evaluate()
+ tip = 'Value: %s'%str(self.evaluate())
#hide/show
if self.get_hide() == 'all': self.input.hide_all()
else: self.input.show_all()
+ #set the color
+ self.input.set_color(self.get_color())
#set the tooltip
- if self.input.tp: self.input.tp.set_tip(self.input.entry,
str(tip))
+ if self.input.tp: self.input.tp.set_tip(self.input.entry,
'Type: %s\nKey: %s\n%s'%(self.get_type(), self.get_key(), tip))
#execute the external callback
if self.callback: self.callback(self)
Modified: gnuradio/trunk/grc/src/platforms/python/Constants.py.in
===================================================================
--- gnuradio/trunk/grc/src/platforms/python/Constants.py.in 2008-09-16
11:15:33 UTC (rev 9583)
+++ gnuradio/trunk/grc/src/platforms/python/Constants.py.in 2008-09-16
16:59:13 UTC (rev 9584)
@@ -38,3 +38,15 @@
BLOCK_DTD = os.path.join(DATA_DIR, 'block.dtd')
BLOCK_TREE = os.path.join(DATA_DIR, 'block_tree.xml')
DEFAULT_FLOW_GRAPH = os.path.join(DATA_DIR, 'default_flow_graph.grc.xml')
+
+#coloring
+COMPLEX_COLOR_SPEC = '#3399FF'
+FLOAT_COLOR_SPEC = '#FF8C69'
+INT_COLOR_SPEC = '#00FF99'
+SHORT_COLOR_SPEC = '#FFFF66'
+BYTE_COLOR_SPEC = '#FF66FF'
+COMPLEX_VECTOR_COLOR_SPEC = '#3399AA'
+FLOAT_VECTOR_COLOR_SPEC = '#CC8C69'
+INT_VECTOR_COLOR_SPEC = '#00CC99'
+SHORT_VECTOR_COLOR_SPEC = '#CCCC33'
+BYTE_VECTOR_COLOR_SPEC = '#CC66CC'
Modified: gnuradio/trunk/grc/src/platforms/python/Param.py
===================================================================
--- gnuradio/trunk/grc/src/platforms/python/Param.py 2008-09-16 11:15:33 UTC
(rev 9583)
+++ gnuradio/trunk/grc/src/platforms/python/Param.py 2008-09-16 16:59:13 UTC
(rev 9584)
@@ -19,6 +19,7 @@
from utils import expr_utils
from .. base.Param import Param as _Param
+import Constants
import os
class Param(_Param):
@@ -36,6 +37,29 @@
'grid_pos', 'import',
]
+ def get_color(self):
+ """
+ Get the color that represents this param's type.
+ @return a hex color code.
+ """
+ try:
+ return {
+ #number types
+ 'complex': Constants.COMPLEX_COLOR_SPEC,
+ 'real': Constants.FLOAT_COLOR_SPEC,
+ 'int': Constants.INT_COLOR_SPEC,
+ #vector types
+ 'complex_vector':
Constants.COMPLEX_VECTOR_COLOR_SPEC,
+ 'real_vector':
Constants.FLOAT_VECTOR_COLOR_SPEC,
+ 'int_vector': Constants.INT_VECTOR_COLOR_SPEC,
+ #special
+ 'hex': Constants.INT_COLOR_SPEC,
+ 'string': Constants.BYTE_VECTOR_COLOR_SPEC,
+ 'id': '#DDDDDD',
+ 'grid_pos': Constants.INT_VECTOR_COLOR_SPEC,
+ }[self.get_type()]
+ except: return _Param.get_color(self)
+
def get_hide(self):
"""
Get the hide value from the base class.
@@ -67,7 +91,7 @@
def eval_string(v):
try:
e = self.get_parent().get_parent().evaluate(v)
- assert(isinstance(e, str))
+ assert isinstance(e, str)
return e
except:
self._stringify_flag = True
Modified: gnuradio/trunk/grc/src/platforms/python/Port.py
===================================================================
--- gnuradio/trunk/grc/src/platforms/python/Port.py 2008-09-16 11:15:33 UTC
(rev 9583)
+++ gnuradio/trunk/grc/src/platforms/python/Port.py 2008-09-16 16:59:13 UTC
(rev 9584)
@@ -19,6 +19,7 @@
from .. base.Port import Port as _Port
from ... import utils
+import Constants
class Port(_Port):
@@ -82,18 +83,18 @@
try:
if self.get_vlen() == 1:
return {#vlen is 1
- 'complex': '#3399FF',
- 'float': '#FF8C69',
- 'int': '#00FF99',
- 'short': '#FFFF66',
- 'byte': '#FF66FF',
+ 'complex': Constants.COMPLEX_COLOR_SPEC,
+ 'float': Constants.FLOAT_COLOR_SPEC,
+ 'int': Constants.INT_COLOR_SPEC,
+ 'short': Constants.SHORT_COLOR_SPEC,
+ 'byte': Constants.BYTE_COLOR_SPEC,
}[self.get_type()]
return {#vlen is non 1
- 'complex': '#3399AA',
- 'float': '#CC8C69',
- 'int': '#00CC99',
- 'short': '#CCCC33',
- 'byte': '#CC66CC',
+ 'complex': Constants.COMPLEX_VECTOR_COLOR_SPEC,
+ 'float': Constants.FLOAT_VECTOR_COLOR_SPEC,
+ 'int': Constants.INT_VECTOR_COLOR_SPEC,
+ 'short': Constants.SHORT_VECTOR_COLOR_SPEC,
+ 'byte': Constants.BYTE_VECTOR_COLOR_SPEC,
}[self.get_type()]
except: return _Port.get_color(self)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r9584 - in gnuradio/trunk/grc: data/platforms/python/blocks src/platforms/base src/platforms/gui src/platforms/python,
jblum <=