1 import ns.point_to_point
11 from gi.repository
import GObject
15 PIXELS_PER_METER = 3.0
21 __gtype_name__ =
"PyVizObject" 27 tooltip.set_text(
"TODO: tooltip for %r" % self)
35 class InformationWindow(object):
40 raise NotImplementedError
49 def __init__(self, is_wireless=None, is_virtual=False):
50 ''' Initialize function. 52 @param is_wireless is wireless flag 53 @param is_virtual is virtual flag 55 assert is_virtual
or is_wireless
is not None 60 ns.point_to_point.PointToPointNetDevice:
NetDeviceTraits(is_wireless=
False),
64 ns.internet.LoopbackNetDevice:
NetDeviceTraits(is_virtual=
True, is_wireless=
False),
74 return netdevice_traits[class_type]
76 sys.stderr.write(
"WARNING: no NetDeviceTraits registered for device type %r; " 77 "I will assume this is a non-virtual wireless device, " 78 "but you should edit %r, variable 'netdevice_traits'," 79 " to make sure.\n" % (class_type.__name__, __file__))
81 netdevice_traits[class_type] = t
85 return d*PIXELS_PER_METER
88 return x*PIXELS_PER_METER, y*PIXELS_PER_METER
91 return d/PIXELS_PER_METER
94 return x/PIXELS_PER_METER, y/PIXELS_PER_METER
106 @param plugin: a callable object that will be invoked whenever a 107 Visualizer object is created, like this: plugin(visualizer) 109 assert callable(plugin_init_func)
110 plugins.append(plugin_init_func)
111 if plugin_module
is not None:
112 plugin_modules[plugin_name] = plugin_module
114 plugins_loaded =
False 116 global plugins_loaded
119 plugins_loaded =
True 120 plugins_dir = os.path.join(os.path.dirname(__file__),
'plugins')
121 old_path =
list(sys.path)
122 sys.path.insert(0, plugins_dir)
123 for filename
in os.listdir(plugins_dir):
124 name, ext = os.path.splitext(filename)
128 plugin_module = __import__(name)
129 except ImportError, ex:
130 print >> sys.stderr,
"Could not load plugin %r: %s" % (filename, str(ex))
133 plugin_func = plugin_module.register
134 except AttributeError:
135 print >> sys.stderr,
"Plugin %r has no 'register' function" % name
def transform_distance_simulation_to_canvas(d)
def tooltip_query(self, tooltip)
Returns tooltip text string.
def __init__(self, is_wireless=None, is_virtual=False)
def register_plugin(plugin_init_func, plugin_name=None, plugin_module=None)
def transform_point_simulation_to_canvas(x, y)
def transform_point_canvas_to_simulation(x, y)
is_wireless
class variablesis wireless
def lookup_netdevice_traits(class_type)
def transform_distance_canvas_to_simulation(d)