summaryrefslogtreecommitdiff
path: root/grc
diff options
context:
space:
mode:
authorJosh Blum2011-04-14 10:49:23 -0700
committerJosh Blum2011-04-14 10:49:23 -0700
commitaf1d0a61d01c7c17dedcb5388ed8a077213d4b4f (patch)
tree7e5a7366ac37d5309c4338ad464bdeaab40788f3 /grc
parent66d7b23402dd9c366bb6c824d693274ccf3868db (diff)
downloadgnuradio-af1d0a61d01c7c17dedcb5388ed8a077213d4b4f.tar.gz
gnuradio-af1d0a61d01c7c17dedcb5388ed8a077213d4b4f.tar.bz2
gnuradio-af1d0a61d01c7c17dedcb5388ed8a077213d4b4f.zip
grc: replaced asserts in gui subdirectory
Diffstat (limited to 'grc')
-rw-r--r--grc/gui/ActionHandler.py5
-rw-r--r--grc/gui/Actions.py5
-rw-r--r--grc/gui/FlowGraph.py10
-rw-r--r--grc/gui/Utils.py5
4 files changed, 13 insertions, 12 deletions
diff --git a/grc/gui/ActionHandler.py b/grc/gui/ActionHandler.py
index 350b297bb..15785f2ee 100644
--- a/grc/gui/ActionHandler.py
+++ b/grc/gui/ActionHandler.py
@@ -1,5 +1,5 @@
"""
-Copyright 2007, 2008, 2009, 2011 Free Software Foundation, Inc.
+Copyright 2007-2011 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion is free software; you can redistribute it and/or
@@ -78,8 +78,7 @@ class ActionHandler:
When not in focus, gtk and the accelerators handle the the key press.
@return false to let gtk handle the key action
"""
- try: assert self.get_focus_flag()
- except AssertionError: return False
+ if not self.get_focus_flag(): return False
return Actions.handle_key_press(event)
def _quit(self, window, event):
diff --git a/grc/gui/Actions.py b/grc/gui/Actions.py
index f374efde1..4d196477e 100644
--- a/grc/gui/Actions.py
+++ b/grc/gui/Actions.py
@@ -1,5 +1,5 @@
"""
-Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
+Copyright 2007-2011 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion is free software; you can redistribute it and/or
@@ -76,7 +76,8 @@ class Action(gtk.Action):
for i in range(len(keypresses)/2):
keyval, mod_mask = keypresses[i*2:(i+1)*2]
#register this keypress
- assert not _actions_keypress_dict.has_key((keyval, mod_mask))
+ if _actions_keypress_dict.has_key((keyval, mod_mask)):
+ raise KeyError('keyval/mod_mask pair already registered "%s"'%str((keyval, mod_mask)))
_actions_keypress_dict[(keyval, mod_mask)] = self
#set the accelerator group, and accelerator path
#register the key name and mod mask with the accelerator path
diff --git a/grc/gui/FlowGraph.py b/grc/gui/FlowGraph.py
index 897145a1d..9f3326ada 100644
--- a/grc/gui/FlowGraph.py
+++ b/grc/gui/FlowGraph.py
@@ -1,5 +1,5 @@
"""
-Copyright 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+Copyright 2007-2011 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion is free software; you can redistribute it and/or
@@ -290,10 +290,10 @@ class FlowGraph(Element):
for selected in selected_elements:
if selected in elements: continue
selected_elements.remove(selected)
- try: assert self._old_selected_port.get_parent() in elements
- except: self._old_selected_port = None
- try: assert self._new_selected_port.get_parent() in elements
- except: self._new_selected_port = None
+ if self._old_selected_port and self._old_selected_port.get_parent() not in elements:
+ self._old_selected_port = None
+ if self._new_selected_port and self._new_selected_port.get_parent() not in elements:
+ self._new_selected_port = None
#update highlighting
for element in elements:
element.set_highlighted(element in selected_elements)
diff --git a/grc/gui/Utils.py b/grc/gui/Utils.py
index b5489d56e..bb19ed3d9 100644
--- a/grc/gui/Utils.py
+++ b/grc/gui/Utils.py
@@ -1,5 +1,5 @@
"""
-Copyright 2008, 2009 Free Software Foundation, Inc.
+Copyright 2008-2011 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion is free software; you can redistribute it and/or
@@ -53,7 +53,8 @@ def get_rotated_coordinate(coor, rotation):
"""
#handles negative angles
rotation = (rotation + 360)%360
- assert rotation in POSSIBLE_ROTATIONS
+ if rotation not in POSSIBLE_ROTATIONS:
+ raise ValueError('unusable rotation angle "%s"'%str(rotation))
#determine the number of degrees to rotate
cos_r, sin_r = {
0: (1, 0),