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

Source Code for Module node_manager_fkie.rqt_node_manager

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