def main(): rospy.init_node('event_gui', anonymous=True) app = QApplication(sys.argv) event_gui = NodeWidgetsContainer() event_gui.show() signal.signal(signal.SIGINT, signal.SIG_DFL) sys.exit(app.exec_())
def runGUI(self): app = QApplication(sys.argv) self.myWidget.show() while (0 == 0): rospy.sleep(1.) self.myWidget.updateLabel() sys.exit(app.exec_())
def runGUI(self): app = QApplication(sys.argv) self.myWidget.show() while (0 == 0): rospy.sleep(1.) self.myWidget.updateLabel() sys.exit(app.exec_())
def window(): app = QApplication(sys.argv) w = PostProcMainWidget() w.bagWidget.bagSelector1.bagEdit.setText('/home/max/obj-lst-vis/src/simulation/rosbag_files/Groundtruth_2020-6-18-8-20-53.bag') w.bagWidget.bagSelector1.fileName = '/home/max/obj-lst-vis/src/simulation/rosbag_files/Groundtruth_2020-6-18-8-20-53.bag' w.bagWidget.bagSelector2.bagEdit.setText('/home/max/obj-lst-vis/src/simulation/rosbag_files/Camera_2020-6-18-8-20-53.bag') w.bagWidget.bagSelector2.fileName = '/home/max/obj-lst-vis/src/simulation/rosbag_files/Camera_2020-6-18-8-20-53.bag' w.setWindowTitle("Object List Postprocessing") w.show() sys.exit(app.exec_())
def run(gui, debug=False): """ @param gui: The gui to render and execute """ if debug: str_traverse = StringTraverse() gui.traverse(str_traverse) rospy.init_node("guiname") code_traverse = pyqtTraverse() app = QApplication(sys.argv) gui.traverse(code_traverse) sys.exit(app.exec_())
self.completer.setCompletionColumn(column) self.filter_model.setFilterKeyColumn(column) super(ExtendedComboBox, self).setModelColumn(column) @Slot(list) def onSetItems(self, items): self.clear() self.addItems(items) if __name__ == '__main__': import sys from python_qt_binding.QtWidgets import QApplication app = QApplication(sys.argv) string_list = ['hola muchachos', 'adios amigos', 'hello world', 'good bye'] combo = ExtendedComboBox() # either fill the standard model of the combobox combo.addItems(string_list) # or use another model # combo.setModel(QStringListModel(string_list)) combo.resize(300, 40) combo.show() sys.exit(app.exec_())
class JointStatePublisher(): def __init__(self): self.app = QApplication(sys.argv) num_rows = len(config) self.gui = JointStatePublisherGui("Joint State Publisher", self, num_rows) self.gui.show() self.gui.callback_start = self.start self.gui.callback_pause = self.pause self.gui.callback_reset = self.reset self.gui.callback_record = self.record self.gui.callback_replay = self.repaly self.gui.callback_replay_stop = self.replay_stop self.gui.callback_delete = self.delete self.gui.callback_debug = self.debug self.gui.callback_import = self._import self.gui.callback_export = self.export self.gui.callback_list_clicked = self.list_clicked self.agent = RosLeapOne(self.gui.num_rows) self.start_or_pause = False self.data_replay = [] self.replay_flag = False self.replay_index = 0 self.data_last = [0 for x in range(0, 12)] def list_clicked(self): index = self.gui.get_listVeiw_current_item() data_last = [0 for x in range(0, 12)] for i in range(0, index): data = copy.copy(self.data_replay[i]) base = data_last for i in range(0, len(data)): data[i] = float(int((base[i] * 1000)) + int(data[i] * 1000)) / 1000 data_last = data self.gui.set_positions(data_last) pass def _import(self): print "import" array = pd.read_excel(self.gui.file_path, index_col=[0]).values.tolist() if len(self.data_replay) > 0: msg = QMessageBox() msg.setIcon(QMessageBox.Warning) msg.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel) msg.setText("Data is not empty!\n Force clear") retval = msg.exec_() if retval == QMessageBox.Cancel: return else: self.data_replay = [] self.gui.listVeiw.clear() if isinstance(array, list): self.data_replay = array for i in range(0, len(self.data_replay)): self.gui.listView_add_item(i) pass def export(self): print "export" print self.gui.file_path self.writer = pd.ExcelWriter(self.gui.file_path) df = pd.DataFrame(self.data_replay) df.to_excel(self.writer) self.writer.save() pass def debug(self): print self.data_replay def delete(self): print "delete" print self.data_replay if self.gui.listVeiw_isClicked: current_index = self.gui.get_listVeiw_current_item() self.data_replay.remove(self.data_replay[current_index]) print self.data_replay pass def reset(self): print "reset" self.agent.reset() def replay_stop(self): self.replay_flag = False self.data_last = [0 for x in range(0, 12)] def repaly(self): print "replay" if len(self.data_replay) > 0: self.replay_flag = True def start(self): print "start" self.agent.set_callback(self.send_position) def pause(self): print "pause" self.agent.set_callback(None) def record(self): #data = self.gui.get_position() data = self.gui.get_speed() if self.gui.listVeiw_isClicked: self.gui.listView_inset_item(self.gui.listVeiw_current_item + 1, self.gui.listVeiw_current_item + 1) self.data_replay.insert(self.gui.listVeiw_current_item + 1, data) self.gui.listVeiw_current_item += 1 self.gui.listVeiw.setCurrentRow(self.gui.listVeiw_current_item) self.gui.update_listView() else: self.gui.listView_add_item(len(self.data_replay)) self.data_replay.append(data) pass def send_position(self): if self.replay_flag: data = self.data_replay[self.replay_index] data = copy.copy(data) #base = self.gui.get_position() base = self.data_last for i in range(0, len(data)): data[i] = float(int((base[i] * 1000)) + int(data[i] * 1000)) / 1000 #self.gui.set_positions(data) self.data_last = data self.replay_index += 1 self.replay_index = self.replay_index % len(self.data_replay) #if self.replay_index >= len(self.data_replay): # print self.data_last # self.data_last = [0 for x in range(0, 12)] # self.gui.set_positions(self.data_last) # self.replay_flag = False # self.replay_index = 0 else: data = self.gui.get_position() self.agent.send_position(data) def loop(self): self.app.exec_()
def start_logging(self): pid = self._widgets["pid"].text() log_path = LOG_DEST + "%s" % pid log_path = os.path.abspath(os.path.expanduser(log_path)) # Make the directory if not os.path.exists(log_path): print "Creating destination directory '%s'" % log_path os.makedirs(log_path) try: self._logging_start(log_path, "--all") except Exception as e: print "Failed to start logging service:" print str(e) def stop_logging(self): try: self._logging_stop() except Exception as e: print "Failed to stop logging service:" print str(e) if __name__ == "__main__": rospy.init_node('LoggingInterface') a = QApplication(sys.argv) e = LoggingWidget() e.show() ret = a.exec_() rospy.signal_shutdown("Application Close") sys.exit(ret)
self.title_label.setText(self.title_edit.text()) self._dock_widget.setWindowTitle(self.title_edit.text()) if __name__ == '__main__': import sys from python_qt_binding.QtWidgets import QApplication from qt_gui.dockable_main_window import DockableMainWindow from ament_index_python.resources import get_resource _, qtgui_path = get_resource('packages', 'qt_gui') app = QApplication(sys.argv) win = DockableMainWindow() dock1 = QDockWidget('dockwidget1', win) win.addDockWidget(Qt.LeftDockWidgetArea, dock1) title_bar = DockWidgetTitleBar(dock1, qtgui_path) dock1.setTitleBarWidget(title_bar) dock2 = QDockWidget('dockwidget2') win.addDockWidget(Qt.RightDockWidgetArea, dock2) title_bar = DockWidgetTitleBar(dock2, qtgui_path) dock2.setTitleBarWidget(title_bar) win.resize(640, 480) win.show() app.exec_()
def main(): app = QApplication(["Metrics Refbox"]) #['Breeze', 'Windows', 'GTK+', 'Fusion'] app.setStyle('Fusion') trw = MetricsRefboxWidget() app.exec_()