示例#1
0
    def setup(self):
        self.application = QtWidgets.QApplication(sys.argv)

        # Create an initital flight track.
        initial_waypoints = [
            ft.Waypoint(flightlevel=0, location="EDMO",
                        comments="take off OP"),
            ft.Waypoint(48.10, 10.27, 200),
            ft.Waypoint(52.32, 09.21, 200),
            ft.Waypoint(52.55, 09.99, 200),
            ft.Waypoint(flightlevel=0,
                        location="Hamburg",
                        comments="landing HH")
        ]

        waypoints_model = ft.WaypointsTableModel("")
        waypoints_model.insertRows(0,
                                   rows=len(initial_waypoints),
                                   waypoints=initial_waypoints)

        self.window = tv.MSSTableViewWindow(model=waypoints_model)
        self.window.show()

        QtWidgets.QApplication.processEvents()
        QtTest.QTest.qWaitForWindowExposed(self.window)
        QtWidgets.QApplication.processEvents()
示例#2
0
文件: mss_pyui.py 项目: iamansoni/MSS
 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])
     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()
示例#3
0
    def create_view_window(self, _type):
        for active_window in self.active_windows:
            if active_window.view_type == _type:
                active_window.raise_()
                active_window.activateWindow()
                return

        if _type == "topview":
            view_window = topview.MSSTopViewWindow(model=self.waypoints_model,
                                                   parent=self.listProjects,
                                                   _id=self.id_count)
            view_window.view_type = "topview"
        elif _type == "sideview":
            view_window = sideview.MSSSideViewWindow(model=self.waypoints_model,
                                                     parent=self.listProjects,
                                                     _id=self.id_count)
            view_window.view_type = "sideview"
        else:
            view_window = tableview.MSSTableViewWindow(model=self.waypoints_model,
                                                       parent=self.listProjects,
                                                       _id=self.id_count)
            view_window.view_type = "tableview"
        if self.access_level == "viewer":
            self.disable_navbar_action_buttons(_type, view_window)

        view_window.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        view_window.show()
        view_window.viewClosesId.connect(self.handle_view_close)
        self.active_windows.append(view_window)

        # increment id_count
        self.id_count += 1