Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tiago Peixoto
graph-tool
Commits
b46a8656
Commit
b46a8656
authored
Nov 06, 2014
by
Tiago Peixoto
Browse files
Better error diagnostics in graph_draw()
parent
8e851554
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/graph/draw/graph_cairo_draw.cc
View file @
b46a8656
...
...
@@ -195,6 +195,15 @@ istream& operator>>(istream& in, edge_marker_t& c)
return
in
;
}
namespace
boost
{
template
<
>
string
lexical_cast
<
string
,
python
::
object
>
(
const
python
::
object
&
val
)
{
return
python
::
extract
<
string
>
(
val
);
}
}
template
<
class
T1
,
class
T2
>
struct
specific_convert
;
...
...
@@ -213,7 +222,26 @@ struct Converter
Type1
do_convert
(
const
Type2
&
v
,
std
::
false_type
)
const
{
return
specific_convert
<
Type1
,
Type2
>
()(
v
);
try
{
return
specific_convert
<
Type1
,
Type2
>
()(
v
);
}
catch
(
bad_lexical_cast
&
)
{
string
name1
=
python
::
detail
::
gcc_demangle
(
typeid
(
Type1
).
name
());
string
name2
=
python
::
detail
::
gcc_demangle
(
typeid
(
Type2
).
name
());
string
val_name
;
try
{
val_name
=
lexical_cast
<
string
>
(
v
);
}
catch
(
bad_lexical_cast
)
{
val_name
=
"<no lexical cast available>"
;
}
throw
GraphException
(
"error converting from type '"
+
name2
+
"' to type '"
+
name1
+
"', val: "
+
val_name
);
}
}
template
<
class
T1
,
class
T2
,
class
Enable
=
void
>
...
...
src/graph_tool/draw/gtk_draw.py
View file @
b46a8656
...
...
@@ -322,6 +322,8 @@ class GraphWidget(Gtk.DrawingArea):
def
cleanup
(
self
):
"""Cleanup callbacks."""
if
gobject
is
None
:
return
if
self
.
layout_callback_id
is
not
None
:
ret
=
gobject
.
source_remove
(
self
.
layout_callback_id
)
if
not
ret
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment