Package node_manager_fkie :: Module rqt_node_manager
[frames] | no frames]

Source Code for Module node_manager_fkie.rqt_node_manager

 1  from qt_gui.plugin import Plugin 
 2   
 3  import node_manager_fkie 
 4  from node_manager_fkie.common import utf8 
 5  from node_manager_fkie.detailed_msg_box import MessageBox 
 6   
 7  from .main_window import MainWindow 
 8   
 9   
10  # from python_qt_binding import loadUi 
11 -class NodeManager(Plugin):
12
13 - def __init__(self, context):
14 super(NodeManager, self).__init__(context) 15 # Give QObjects reasonable names 16 self.setObjectName('NodeManagerFKIE') 17 18 # Process standalone plugin command-line arguments 19 from argparse import ArgumentParser 20 parser = ArgumentParser() 21 # Add argument(s) to the parser. 22 parser.add_argument("-q", "--quiet", action="store_true", 23 dest="quiet", 24 help="Put plugin in silent mode") 25 args, unknowns = parser.parse_known_args(context.argv()) 26 if not args.quiet: 27 print 'arguments: ', args 28 print 'unknowns: ', unknowns 29 node_manager_fkie.init_settings() 30 masteruri = node_manager_fkie.settings().masteruri() 31 node_manager_fkie.init_globals(masteruri) 32 # Create QWidget 33 try: 34 self._widget = MainWindow() 35 # self._widget.read_view_history() 36 except Exception, e: 37 MessageBox.critical(self, "Node Manager", utf8(e)) 38 raise 39 # Get path to UI file which is a sibling of this file 40 # in this example the .ui and .py file are in the same folder 41 # ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'MyPlugin.ui') 42 # Extend the widget with all attributes and children from UI file 43 # loadUi(ui_file, self._widget) 44 # Give QObjects reasonable names 45 self._widget.setObjectName('NodeManagerFKIEPlugin') 46 # Show _widget.windowTitle on left-top of each plugin (when 47 # it's set in _widget). This is useful when you open multiple 48 # plugins at once. Also if you open multiple instances of your 49 # plugin at once, these lines add number to make it easy to 50 # tell from pane to pane. 51 if context.serial_number() > 1: 52 self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number())) 53 # Add widget to the user interface 54 context.add_widget(self._widget)
55
56 - def shutdown_plugin(self):
57 # TODO unregister all publishers here 58 node_manager_fkie.finish() 59 if self._widget: 60 self._widget.finish()
61
62 - def save_settings(self, plugin_settings, instance_settings):
63 # TODO save intrinsic configuration, usually using: 64 # instance_settings.set_value(k, v) 65 pass
66
67 - def restore_settings(self, plugin_settings, instance_settings):
68 # TODO restore intrinsic configuration, usually using: 69 # v = instance_settings.value(k) 70 pass
71 72 # def trigger_configuration(self): 73 # Comment in to signal that the plugin has a way to configure it 74 # Usually used to open a configuration dialog 75