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