def setup(self): self.application = QtWidgets.QApplication(sys.argv) self.port = PORTS.pop() self.tempdir = tempfile.mkdtemp() if not os.path.exists(self.tempdir): os.mkdir(self.tempdir) self.thread = multiprocessing.Process(target=application.run, args=("127.0.0.1", self.port)) self.thread.start() initial_waypoints = [ ft.Waypoint(40., 25., 0), ft.Waypoint(60., -10., 0), ft.Waypoint(40., 10, 0) ] waypoints_model = ft.WaypointsTableModel("") waypoints_model.insertRows(0, rows=len(initial_waypoints), waypoints=initial_waypoints) self.window = tv.MSSLinearViewWindow(model=waypoints_model) self.window.show() QtWidgets.QApplication.processEvents() QtTest.QTest.qWait(2000) QtTest.QTest.qWaitForWindowExposed(self.window) QtWidgets.QApplication.processEvents() self.window.cbTools.currentIndexChanged.emit(1) QtWidgets.QApplication.processEvents() self.wms_control = self.window.docks[0].widget() self.wms_control.multilayers.cbWMS_URL.setEditText("")
def setup(self): self.application = QtWidgets.QApplication(sys.argv) initial_waypoints = [ft.Waypoint(40., 25., 300), ft.Waypoint(60., -10., 400), ft.Waypoint(40., 10, 300)] waypoints_model = ft.WaypointsTableModel("") waypoints_model.insertRows( 0, rows=len(initial_waypoints), waypoints=initial_waypoints) self.window = tv.MSSLinearViewWindow(model=waypoints_model) self.window.show() QtWidgets.QApplication.processEvents() QtTest.QTest.qWaitForWindowExposed(self.window) QtWidgets.QApplication.processEvents()
def create_new_view(self): """Method called when the user selects a new view to be opened. Creates a new instance of the view and adds a QActiveViewsListWidgetItem to the list of open views (self.listViews). """ layout = config_loader(dataset="layout") view_window = None if self.sender() == self.actionTopView: # Top view. view_window = topview.MSSTopViewWindow( model=self.active_flight_track) view_window.mpl.resize(layout['topview'][0], layout['topview'][1]) if layout["immutable"]: view_window.mpl.setFixedSize(layout['topview'][0], layout['topview'][1]) elif self.sender() == self.actionSideView: # Side view. view_window = sideview.MSSSideViewWindow( model=self.active_flight_track) view_window.mpl.resize(layout['sideview'][0], layout['sideview'][1]) if layout["immutable"]: view_window.mpl.setFixedSize(layout['sideview'][0], layout['sideview'][1]) elif self.sender() == self.actionTableView: # Table view. view_window = tableview.MSSTableViewWindow( model=self.active_flight_track) view_window.centralwidget.resize(layout['tableview'][0], layout['tableview'][1]) elif self.sender() == self.actionLinearView: # Linear view. view_window = linearview.MSSLinearViewWindow( model=self.active_flight_track) view_window.mpl.resize(layout['linearview'][0], layout['linearview'][1]) if layout["immutable"]: view_window.mpl.setFixedSize(layout['linearview'][0], layout['linearview'][1]) if view_window is not None: # Make sure view window will be deleted after being closed, not # just hidden (cf. Chapter 5 in PyQt4). view_window.setAttribute(QtCore.Qt.WA_DeleteOnClose) # Open as a non-modal window. view_window.show() # Add an entry referencing the new view to the list of views. listitem = QActiveViewsListWidgetItem(view_window, self.listViews, self.viewsChanged) view_window.viewCloses.connect(listitem.view_destroyed) self.listViews.setCurrentItem(listitem) self.viewsChanged.emit()