summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Koslowski <koslowski@kit.edu>2016-05-07 13:26:01 +0200
committerSeth Hitefield <sdhitefield@gmail.com>2016-05-18 18:59:31 -0400
commitd535ba24c44247630555d95efc9bde1696d555a4 (patch)
tree766df5f5e5d78aff863100e426bcb0554e27c973
parent2a51cc7abfae4867c08935f42bf6c2679dc3e23b (diff)
grc: minor fixes/clean-ups
-rw-r--r--grc/core/Block.py2
-rw-r--r--grc/gui/Actions.py4
-rw-r--r--grc/gui/Utils.py9
3 files changed, 9 insertions, 6 deletions
diff --git a/grc/core/Block.py b/grc/core/Block.py
index 106e4bc89a..c2111fe1bb 100644
--- a/grc/core/Block.py
+++ b/grc/core/Block.py
@@ -356,7 +356,7 @@ class Block(Element):
"""
Resolve all import statements.
Split each import statement at newlines.
- Combine all import statments into a list.
+ Combine all import statements into a list.
Filter empty imports.
Returns:
diff --git a/grc/gui/Actions.py b/grc/gui/Actions.py
index 484d4f3301..ce5bc4eba8 100644
--- a/grc/gui/Actions.py
+++ b/grc/gui/Actions.py
@@ -92,6 +92,7 @@ class _ActionBase(object):
self.set_accel_group(get_accel_group())
self.set_accel_path(accel_path)
gtk.accel_map_add_entry(accel_path, keyval, mod_mask)
+ self.args = None
def __str__(self):
"""
@@ -105,10 +106,11 @@ class _ActionBase(object):
def __repr__(self): return str(self)
- def __call__(self):
+ def __call__(self, *args):
"""
Emit the activate signal when called with ().
"""
+ self.args = args
self.emit('activate')
diff --git a/grc/gui/Utils.py b/grc/gui/Utils.py
index f20e3c0fa6..51b9b19e9f 100644
--- a/grc/gui/Utils.py
+++ b/grc/gui/Utils.py
@@ -123,10 +123,11 @@ class TemplateParser(object):
parse_template = TemplateParser()
-def align_to_grid(coor):
- _align = lambda: int(round(x / (1.0 * CANVAS_GRID_SIZE)) * CANVAS_GRID_SIZE)
+def align_to_grid(coor, mode=round):
+ def align(value):
+ return int(mode(value / (1.0 * CANVAS_GRID_SIZE)) * CANVAS_GRID_SIZE)
try:
- return [_align() for x in coor]
+ return map(align, coor)
except TypeError:
x = coor
- return _align()
+ return align(coor)