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

Source Code for Module node_manager_fkie.rqt_node_manager

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