def openTool(self, index): """ Slot that handles requests to open control windows. """ index = self.controlToBeCreated(index) if index >= 0: if index == WMS: # Create a new WMSDockWidget. title = "Web Map Service (Top View)" widget = wc.HSecWMSControlWidget( default_WMS=config_loader(dataset="default_WMS"), view=self.mpl.canvas, wms_cache=config_loader(dataset="wms_cache")) widget.signal_disable_cbs.connect(self.disable_cbs) widget.signal_enable_cbs.connect(self.enable_cbs) elif index == SATELLITE: title = "Satellite Track Prediction" widget = sat.SatelliteControlWidget(parent=self, view=self.mpl.canvas) elif index == REMOTESENSING: title = "Remote Sensing Tools" widget = rs.RemoteSensingControlWidget(parent=self, view=self.mpl.canvas) elif index == KMLOVERLAY: title = "KML Overlay" widget = kml.KMLOverlayControlWidget(parent=self, view=self.mpl.canvas) else: raise IndexError("invalid control index") # Create the actual dock widget containing <widget>. self.createDockWidget(index, title, widget)
def _setup(self, widget_type): self.port = PORTS.pop() self.application = QtWidgets.QApplication(sys.argv) if widget_type == "hsec": self.view = HSecViewMockup() else: self.view = VSecViewMockup() self.tempdir = tempfile.mkdtemp() if not os.path.exists(self.tempdir): os.mkdir(self.tempdir) QtTest.QTest.qWait(3000) self.thread = multiprocessing.Process( target=application.run, args=("127.0.0.1", self.port)) self.thread.start() if widget_type == "hsec": self.window = wc.HSecWMSControlWidget(view=self.view, wms_cache=self.tempdir) else: 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 = wc.VSecWMSControlWidget( view=self.view, wms_cache=self.tempdir, waypoints_model=waypoints_model) self.window.show() QtWidgets.QApplication.processEvents() QtTest.QTest.qWait(2000) QtTest.QTest.qWaitForWindowExposed(self.window) QtTest.QTest.mouseClick(self.window.cbCacheEnabled, QtCore.Qt.LeftButton) QtWidgets.QApplication.processEvents()
def setup(self): self.application = QtWidgets.QApplication(sys.argv) self.view = HSecViewMockup() self.window = wc.HSecWMSControlWidget(view=self.view) self.window.show() # Remove all previous cached URLs for url in self.window.multilayers.layers.copy(): server = self.window.multilayers.listLayers.findItems(url, QtCore.Qt.MatchFixedString)[0] self.window.multilayers.delete_server(server) QtWidgets.QApplication.processEvents()
def _setup(self, widget_type): wc.WMS_SERVICE_CACHE = {} self.port = PORTS.pop() self.application = QtWidgets.QApplication(sys.argv) if widget_type == "hsec": self.view = HSecViewMockup() else: self.view = VSecViewMockup() self.tempdir = tempfile.mkdtemp() if not os.path.exists(self.tempdir): os.mkdir(self.tempdir) QtTest.QTest.qWait(3000) self.thread = multiprocessing.Process(target=application.run, args=("127.0.0.1", self.port)) self.thread.start() if widget_type == "hsec": self.window = wc.HSecWMSControlWidget(view=self.view, wms_cache=self.tempdir) else: 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 = wc.VSecWMSControlWidget( view=self.view, wms_cache=self.tempdir, waypoints_model=waypoints_model) self.window.show() # Remove all previous cached URLs for url in self.window.multilayers.layers.copy(): server = self.window.multilayers.listLayers.findItems( url, QtCore.Qt.MatchFixedString)[0] self.window.multilayers.delete_server(server) QtWidgets.QApplication.processEvents() QtTest.QTest.qWait(2000) QtTest.QTest.qWaitForWindowExposed(self.window) QtTest.QTest.mouseClick(self.window.cbCacheEnabled, QtCore.Qt.LeftButton) QtWidgets.QApplication.processEvents()
def setup(self): self.application = QtWidgets.QApplication(sys.argv) self.view = HSecViewMockup() self.window = wc.HSecWMSControlWidget(view=self.view) self.window.show() QtWidgets.QApplication.processEvents()