4 from gi.repository
import GObject
12 __gtype_name__ =
"PyVizObject"
19 tooltip.set_text(
"TODO: tooltip for %r" % self)
33 raise NotImplementedError
43 def __init__(self, is_wireless=None, is_virtual=False):
46 @param self The current class
47 @param is_wireless is wireless flag
48 @param is_virtual is virtual flag
50 assert is_virtual
or is_wireless
is not None
60 ns.LoopbackNetDevice:
NetDeviceTraits(is_virtual=
True, is_wireless=
False),
71 return netdevice_traits[class_type]
74 "WARNING: no NetDeviceTraits registered for device type %r; "
75 "I will assume this is a non-virtual wireless device, "
76 "but you should edit %r, variable 'netdevice_traits',"
77 " to make sure.\n" % (class_type.__name__, __file__)
80 netdevice_traits[class_type] = t
85 return d * PIXELS_PER_METER
89 return x * PIXELS_PER_METER, y * PIXELS_PER_METER
93 return d / PIXELS_PER_METER
97 return x / PIXELS_PER_METER, y / PIXELS_PER_METER
108 @param plugin: a callable object that will be invoked whenever a
109 Visualizer object is created, like this: plugin(visualizer)
111 assert callable(plugin_init_func)
112 plugins.append(plugin_init_func)
113 if plugin_module
is not None:
114 plugin_modules[plugin_name] = plugin_module
117 plugins_loaded =
False
121 global plugins_loaded
124 plugins_loaded =
True
125 plugins_dir = os.path.join(os.path.dirname(__file__),
"plugins")
126 old_path =
list(sys.path)
127 sys.path.insert(0, plugins_dir)
128 for filename
in os.listdir(plugins_dir):
129 name, ext = os.path.splitext(filename)
133 plugin_module = __import__(name)
134 except ImportError
as ex:
135 print(
"Could not load plugin %r: %s" % (filename, str(ex)), file=sys.stderr)
138 plugin_func = plugin_module.register
139 except AttributeError:
140 print(
"Plugin %r has no 'register' function" % name, file=sys.stderr)
def __init__(self, is_wireless=None, is_virtual=False)
Initialize function.
is_wireless
class variablesis wireless
def tooltip_query(self, tooltip)
Returns tooltip text string.
def transform_distance_simulation_to_canvas(d)
def register_plugin(plugin_init_func, plugin_name=None, plugin_module=None)
def transform_distance_canvas_to_simulation(d)
def transform_point_canvas_to_simulation(x, y)
def lookup_netdevice_traits(class_type)
def transform_point_simulation_to_canvas(x, y)