def getStandAloneInstance(pkg_name, dashboard_class, lng="en"): dashboard_instance = dashboard_class(Context(QMainWindow())) dashboard_descriptor = ET.parse("%s/dashboard_descriptor.xml"%get_pkg_dir(pkg_name)) dashboard_params = DashboardProvider.getParameters(dashboard_descriptor.getroot(), None) dashboard_instance.setup(dashboard_descriptor, dashboard_params) dashboard_instance.onTranslate(lng) return dashboard_instance
def getStandAloneInstance(pkg_name, plugin_class, lng="en"): plugin_instance = plugin_class(Context(QMainWindow())) plugin_descriptor = ET.parse("%s/plugin_descriptor.xml"%get_pkg_dir(pkg_name)) plugin_params = PluginProvider.getParameters(plugin_descriptor.getroot(), None) plugin_instance.tryToCreate(plugin_params) plugin_instance.tryToResume() plugin_instance.onTranslate(lng) return plugin_instance
self.message_cb) def update_diag(self): #update the tree self._tree.prune() self.tree_all_devices.resizeColumnToContents(0) self.adjustSize() def message_cb(self, msg): """ DiagnosticArray message callback """ for status in msg.status: path = status.name.split('/') if path[0] == '': path = path[1:] tmp_tree = self._tree for p in path: tmp_tree = tmp_tree[p] tmp_tree.update(status, util.get_resource_name(status.name)) self.emit(SIGNAL('UpdateDiagnostics')) if __name__ == "__main__": from cobot_gui.context import Context app = QApplication(sys.argv) main = QMainWindow() main.setCentralWidget(TranslatorUi(Context(main))) main.show() app.exec_() #End of file
self._context.sendAlarm( Alarm.WARNING, "Control mode switching automatic to manual mode !") def onEmergencyStop(self, emer): if emer == EmergencyStopState.LOCKED: if self._context.getControlMode() != ControlMode.MANUAL: self.setControlMode(ControlMode.MANUAL) def onDestroy(self): pass if __name__ == "__main__": from cobot_gui.context import Context rospy.init_node('unittest_countrol_mode_ui') a = QApplication(sys.argv) utt_appli = QMainWindow() utt_appli.setCentralWidget(ControlModeWidget(Context(utt_appli))) utt_appli.show() a.exec_() #End of file
return parameters ##Unittest if __name__ == "__main__": from python_qt_binding.QtGui import * from python_qt_binding.QtCore import * from cobot_gui.context import Context rospy.init_node('dashboard_privider_test') a = QApplication(sys.argv) utt_appli = QMainWindow() context = Context(utt_appli) provider = DashboardProvider( context, "/opt/ros/indigo/workspace/src/gui/dashboard/dashboard_register.xml") dashboard = provider.getDashboardInstance("IIWA") utt_appli.setCentralWidget(dashboard) plugin.onStart() utt_appli.show() a.exec_() #End of file
r.sleep() def onTranslate(self, lng): pass def onDestroy(self): """Called when appli closes.""" self._keep_running = False ##Unittest if __name__ == "__main__": from cobot_gui.context import Context rospy.init_node('unittest_emergency_stop_2') a = QApplication(sys.argv) utt_appli = QMainWindow() context = Context(utt_appli) context.requestNewLanguage('fr') estop = EmergencyStopButton(context) estop.setIconSize(QSize(80, 80)) utt_appli.setCentralWidget(estop) utt_appli.show() a.exec_() estop.onDestroy() #End of file