@@ -94,7 +94,7 @@ def create_force_table(cls, sceneNode, dual=[]):
9494 attributes = filter (lambda attr : attr in Allowed , attributes )
9595
9696 for attr in attributes :
97- checkbox = type (datastructure .default_edge_attributes [attr ]) == bool
97+ checkbox = isinstance (datastructure .default_edge_attributes [attr ], bool )
9898 attr = attr .replace ("_" , "-" )
9999 table .add_column (attr , Editable = False , checkbox = checkbox )
100100
@@ -129,7 +129,7 @@ def create_vertices_table(cls, sceneNode):
129129 attributes = table .sort_attributes (attributes )
130130 for attr in attributes :
131131 editable = attr [0 ] != '_'
132- checkbox = type (datastructure .default_vertex_attributes [attr ]) == bool
132+ checkbox = isinstance (datastructure .default_vertex_attributes [attr ], bool )
133133 if not editable :
134134 attr = attr [1 :]
135135 table .add_column (attr , Editable = editable , checkbox = checkbox )
@@ -155,7 +155,7 @@ def create_edges_table(cls, sceneNode):
155155
156156 for attr in attributes :
157157 editable = attr [0 ] != '_'
158- checkbox = type (datastructure .default_edge_attributes [attr ]) == bool
158+ checkbox = isinstance (datastructure .default_edge_attributes [attr ], bool )
159159 if not editable :
160160 attr = attr [1 :]
161161 table .add_column (attr , Editable = editable , checkbox = checkbox )
@@ -252,10 +252,10 @@ def on_edited(sender, event):
252252
253253 original_value = get_set_attributes (key , attr )
254254
255- if type (original_value ) == float and type (new_value ) == int :
255+ if isinstance (original_value , float ) and isinstance (new_value , int ) :
256256 new_value = float (new_value )
257257 if new_value != original_value :
258- if type (new_value ) == type (original_value ):
258+ if type (new_value ) is type (original_value ):
259259 print ('will update key: %s, attr: %s, value: %s' % (key , attr , new_value ))
260260 self .to_update [(key , attr )] = (get_set_attributes , new_value )
261261 else :
0 commit comments