summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnathan Corgan <johnathan@corganlabs.com>2015-07-24 08:18:40 -0700
committerJohnathan Corgan <johnathan@corganlabs.com>2015-07-24 08:18:40 -0700
commit474f88abe17c873c78cedcda28b4d321eafeebbd (patch)
tree525d9bdb8450938f931878ff710a218fcd04945d
parentcc973de4273bd74d10504fba880804b22e462145 (diff)
parentf8a9f9fb9939799228ef38deab68c71a44acd324 (diff)
Merge branch 'maint'
-rw-r--r--cmake/Modules/FindGSL.cmake11
-rw-r--r--gnuradio-runtime/lib/pmt/pmt_serialize.cc2
-rw-r--r--grc/gui/Utils.py57
m---------volk0
4 files changed, 40 insertions, 30 deletions
diff --git a/cmake/Modules/FindGSL.cmake b/cmake/Modules/FindGSL.cmake
index 6d7155284f..b36a1e9c2a 100644
--- a/cmake/Modules/FindGSL.cmake
+++ b/cmake/Modules/FindGSL.cmake
@@ -18,8 +18,10 @@
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(GSL "gsl >= 1.10")
-IF(NOT GSL_FOUND)
-
+IF(GSL_FOUND)
+ set(GSL_LIBRARY_DIRS ${GSL_LIBDIR})
+ set(GSL_INCLUDE_DIRS ${GSL_INCLUDEDIR})
+ELSE(GSL_FOUND)
set( GSL_FOUND OFF )
set( GSL_CBLAS_FOUND OFF )
@@ -141,6 +143,7 @@ endif( GSL_FOUND )
#needed for gsl windows port but safe to always define
LIST(APPEND GSL_DEFINITIONS "-DGSL_DLL")
+ENDIF(GSL_FOUND)
+
INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(GSL DEFAULT_MSG GSL_LIBRARIES GSL_INCLUDE_DIRS)
-ENDIF(NOT GSL_FOUND)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GSL DEFAULT_MSG GSL_LIBRARIES GSL_INCLUDE_DIRS GSL_LIBRARY_DIRS)
diff --git a/gnuradio-runtime/lib/pmt/pmt_serialize.cc b/gnuradio-runtime/lib/pmt/pmt_serialize.cc
index 5cc2005ca7..6147082a21 100644
--- a/gnuradio-runtime/lib/pmt/pmt_serialize.cc
+++ b/gnuradio-runtime/lib/pmt/pmt_serialize.cc
@@ -531,7 +531,7 @@ deserialize(std::streambuf &sb)
uint32_t u32;
uint64_t u64;
double f64;
- static char tmpbuf[1024];
+ char tmpbuf[1024];
if (!deserialize_untagged_u8(&tag, sb))
return PMT_EOF;
diff --git a/grc/gui/Utils.py b/grc/gui/Utils.py
index 9a0a59cda7..624197f213 100644
--- a/grc/gui/Utils.py
+++ b/grc/gui/Utils.py
@@ -1,5 +1,5 @@
"""
-Copyright 2008-2011 Free Software Foundation, Inc.
+Copyright 2008-2011,2015 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion is free software; you can redistribute it and/or
@@ -17,13 +17,16 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
-from Constants import POSSIBLE_ROTATIONS, CANVAS_GRID_SIZE
-from Cheetah.Template import Template
import pygtk
pygtk.require('2.0')
import gtk
import gobject
+from Cheetah.Template import Template
+
+from Constants import POSSIBLE_ROTATIONS, CANVAS_GRID_SIZE
+
+
def rotate_pixmap(gc, src_pixmap, dst_pixmap, angle=gtk.gdk.PIXBUF_ROTATE_COUNTERCLOCKWISE):
"""
Load the destination pixmap with a rotated version of the source pixmap.
@@ -46,6 +49,7 @@ def rotate_pixmap(gc, src_pixmap, dst_pixmap, angle=gtk.gdk.PIXBUF_ROTATE_COUNTE
pixbuf = pixbuf.rotate_simple(angle)
dst_pixmap.draw_pixbuf(gc, pixbuf, 0, 0, 0, 0)
+
def get_rotated_coordinate(coor, rotation):
"""
Rotate the coordinate by the given rotation.
@@ -57,21 +61,19 @@ def get_rotated_coordinate(coor, rotation):
Returns:
the rotated coordinates
"""
- #handles negative angles
+ # handles negative angles
rotation = (rotation + 360)%360
if rotation not in POSSIBLE_ROTATIONS:
raise ValueError('unusable rotation angle "%s"'%str(rotation))
- #determine the number of degrees to rotate
+ # determine the number of degrees to rotate
cos_r, sin_r = {
- 0: (1, 0),
- 90: (0, 1),
- 180: (-1, 0),
- 270: (0, -1),
+ 0: (1, 0), 90: (0, 1), 180: (-1, 0), 270: (0, -1),
}[rotation]
x, y = coor
- return (x*cos_r + y*sin_r, -x*sin_r + y*cos_r)
+ return x * cos_r + y * sin_r, -x * sin_r + y * cos_r
-def get_angle_from_coordinates((x1,y1), (x2,y2)):
+
+def get_angle_from_coordinates((x1, y1), (x2, y2)):
"""
Given two points, calculate the vector direction from point1 to point2, directions are multiples of 90 degrees.
@@ -82,12 +84,22 @@ def get_angle_from_coordinates((x1,y1), (x2,y2)):
Returns:
the direction in degrees
"""
- if y1 == y2:#0 or 180
- if x2 > x1: return 0
- else: return 180
- else:#90 or 270
- if y2 > y1: return 270
- else: return 90
+ if y1 == y2: # 0 or 180
+ return 0 if x2 > x1 else 180
+ else: # 90 or 270
+ return 270 if y2 > y1 else 90
+
+
+def encode(value):
+ """Make sure that we pass only valid utf-8 strings into markup_escape_text.
+
+ Older versions of glib seg fault if the last byte starts a multi-byte
+ character.
+ """
+
+ valid_utf8 = value.decode('utf-8', errors='ignore').encode('utf-8')
+ return gobject.markup_escape_text(valid_utf8)
+
def parse_template(tmpl_str, **kwargs):
"""
@@ -100,19 +112,14 @@ def parse_template(tmpl_str, **kwargs):
Returns:
a string of the parsed template
"""
- kwargs['encode'] = gobject.markup_escape_text
- #try:
- # cat = str(Template(tmpl_str, kwargs))
- #except TypeError:
- # print 'guppy'
- # print tmpl_str
- # print str(kwargs['param'].get_error_messages())
+ kwargs['encode'] = encode
return str(Template(tmpl_str, kwargs))
+
def align_to_grid(coor):
_align = lambda: int(round(x / (1.0 * CANVAS_GRID_SIZE)) * CANVAS_GRID_SIZE)
try:
return [_align() for x in coor]
except TypeError:
x = coor
- return _align() \ No newline at end of file
+ return _align()
diff --git a/volk b/volk
-Subproject 5582e551051e864f5e55a518fc17250324130d4
+Subproject 4a25f2ea6db33e3269ab485341c65d653712835