示例#1
0
    def __init__(self, parent=None, view=None):
        super(KMLOverlayControlWidget, self).__init__(parent)
        self.setupUi(self)
        self.view = view  # canvas
        self.kml = None
        self.dict_files = {}  # Dictionary of files added; key : patch , color , linewidth
        self.colour = None
        # Connect slots and signals.
        self.btSelectFile.clicked.connect(self.get_file)
        self.pushButton_remove.clicked.connect(self.remove_file)
        self.pushButton_select_all.clicked.connect(self.select_all)
        self.pushButton_unselect_all.clicked.connect(self.unselect_all)
        self.pushButton_merge.clicked.connect(self.merge_file)
        self.labelStatusBar.setText("Status: Click on Add KML Files to get started.")
        self.dsbx_linewidth.setValue(0.1)  # sets initial value as 0.1 for linewidth

        # Hiding the color and linewidth options.
        self.frame.hide()
        # setting flags to control self.load_file() while changing color and linewidth.
        self.flag = 0   # Flag for control of load_file() for linewidth
        self.flag2 = 0  # Flag for control of load_file() for linewidth

        # Connect slots and signals (For showing color and linewidth of clicked file).
        self.listWidget.itemClicked.connect(self.show_linewidth)
        self.pushButton_color.clicked.connect(self.select_color)
        self.dsbx_linewidth.valueChanged.connect(self.select_linewidth)

        self.listWidget.itemChanged.connect(self.flagop)  # when item changes, flag operation happens.

        self.settings_tag = "kmldock"
        settings = load_settings_qsettings(
            self.settings_tag, {"filename": "", "linewidth": 2, "colour": (0, 0, 0, 1),
                                "saved_files": {}})  # initial settings

        self.directory_location = settings["filename"]
        if parent is not None:
            parent.viewCloses.connect(self.save_settings)

        # Restore previously opened files
        if settings["saved_files"] is not None:
            delete_files = []  # list to store non-existing files
            self.dict_files = settings["saved_files"]
            for fn in self.dict_files:
                if os.path.isfile(fn) is True:
                    self.create_list_item(fn)
                else:
                    delete_files.append(fn)  # add non-existent files to list
                    logging.info("'%s' does not exist in the directory anymore.", fn)
            for fn in delete_files:
                del self.dict_files[fn]  # remove non-existent files from dictionary
            self.load_file()

        # When KMLoverlaywidget is opened, it ensures that the
        # color of individual KML files are already shown as icons.
        self.set_color_icons()
        self.view.plot_kml(self)
示例#2
0
    def __init__(self, parent=None, view=None):
        super(AirdataDockwidget, self).__init__(parent)
        self.setupUi(self)
        self.view = view
        self.view.redrawn.connect(self.redraw_map)

        code_to_name = {
            country.alpha_2.lower(): country.name
            for country in pycountry.countries
        }
        self.cbAirspaces.addItems([
            f"{code_to_name.get(airspace[0].split('_')[0], 'Unknown')} "
            f"{airspace[0].split('_')[0]}" for airspace in _airspace_cache
        ])
        self.cbAirportType.addItems([
            "small_airport", "medium_airport", "large_airport", "heliport",
            "balloonport", "seaplane_base", "closed"
        ])

        self.settings_tag = "airdatadock"
        settings = load_settings_qsettings(
            self.settings_tag, {
                "draw_airports": False,
                "draw_airspaces": False,
                "airspaces": [],
                "airport_type": [],
                "filter_airspaces": False,
                "filter_from": 0,
                "filter_to": 100
            })

        self.btDownload.clicked.connect(lambda: get_airports(True))
        self.btDownloadAsp.clicked.connect(
            lambda: update_airspace(True, [
                airspace.split(" ")[-1]
                for airspace in self.cbAirspaces.currentData()
            ]))
        self.btApply.clicked.connect(self.redraw_map)

        self.cbDrawAirports.setChecked(settings["draw_airports"])
        self.cbDrawAirspaces.setChecked(settings["draw_airspaces"])
        for airspace in settings["airspaces"]:
            i = self.cbAirspaces.findText(airspace)
            if i != -1:
                self.cbAirspaces.model().item(i).setCheckState(
                    QtCore.Qt.Checked)
        for airport in settings["airport_type"]:
            i = self.cbAirportType.findText(airport)
            if i != -1:
                self.cbAirportType.model().item(i).setCheckState(
                    QtCore.Qt.Checked)
        self.cbAirspaces.updateText()
        self.cbFilterAirspaces.setChecked(settings["filter_airspaces"])
        self.sbFrom.setValue(settings["filter_from"])
        self.sbTo.setValue(settings["filter_to"])
示例#3
0
    def __init__(self, dock_widget):
        super().__init__(parent=dock_widget)
        self.setupUi(self)
        self.setWindowFlags(QtCore.Qt.Window)
        if isinstance(dock_widget, mslib.msui.wms_control.HSecWMSControlWidget):
            self.setWindowTitle(self.windowTitle() + " (Top View)")
        elif isinstance(dock_widget, mslib.msui.wms_control.VSecWMSControlWidget):
            self.setWindowTitle(self.windowTitle() + " (Side View)")
        elif isinstance(dock_widget, mslib.msui.wms_control.LSecWMSControlWidget):
            self.setWindowTitle(self.windowTitle() + " (Linear View)")
        self.dock_widget = dock_widget
        self.layers = {}
        self.layers_priority = []
        self.current_layer: Layer = None
        self.threads = 0
        self.height = None
        self.scale = self.logicalDpiX() / 96
        self.filter_favourite = False
        self.carry_parameters = {"level": None, "itime": None, "vtime": None}
        self.is_linear = isinstance(dock_widget, mslib.msui.wms_control.LSecWMSControlWidget)
        self.settings = load_settings_qsettings("multilayers",
                                                {"favourites": [], "saved_styles": {}, "saved_colors": {}})
        self.synced_reference = Layer(None, None, None, is_empty=True)
        self.skip_clicked_event = False
        self.listLayers.itemChanged.connect(self.multilayer_changed)
        self.listLayers.itemClicked.connect(self.check_icon_clicked)
        self.listLayers.itemClicked.connect(self.multilayer_clicked)
        self.listLayers.itemDoubleClicked.connect(self.multilayer_doubleclicked)
        self.listLayers.setVisible(True)

        self.leMultiFilter.setVisible(True)
        self.lFilter.setVisible(True)
        self.filterFavouriteAction = self.leMultiFilter.addAction(QtGui.QIcon(icons("64x64", "star_unfilled.png")),
                                                                  QtWidgets.QLineEdit.TrailingPosition)
        self.filterRemoveAction = self.leMultiFilter.addAction(QtGui.QIcon(icons("64x64", "remove.png")),
                                                               QtWidgets.QLineEdit.TrailingPosition)
        self.filterRemoveAction.setVisible(False)
        self.filterRemoveAction.setToolTip("Click to remove the filter")
        self.filterFavouriteAction.setToolTip("Show only favourite layers")
        self.filterRemoveAction.triggered.connect(lambda x: self.remove_filter_triggered())
        self.filterFavouriteAction.triggered.connect(lambda x: self.filter_favourite_toggled())
        self.cbMultilayering.stateChanged.connect(self.toggle_multilayering)
        self.leMultiFilter.textChanged.connect(self.filter_multilayers)

        self.listLayers.setColumnWidth(2, 50)
        self.listLayers.setColumnWidth(3, 50)
        self.listLayers.setColumnWidth(1, 200)
        self.listLayers.setColumnHidden(2, True)
        self.listLayers.setColumnHidden(3, not self.is_linear)
        self.listLayers.header().setSectionResizeMode(0, QtWidgets.QHeaderView.Stretch)

        self.delete_shortcut = QtWidgets.QShortcut(QtGui.QKeySequence("Delete"), self)
        self.delete_shortcut.activated.connect(self.delete_server)
        self.delete_shortcut.setWhatsThis("Delete selected server")
示例#4
0
    def __init__(self, parent=None, view=None):
        super(SatelliteControlWidget, self).__init__(parent)
        self.setupUi(self)
        self.view = view

        # Currently loaded satellite overpass segments.
        self.overpass_segments = None

        # Connect slots and signals.
        self.btSelectFile.clicked.connect(self.select_file)
        self.btLoadFile.clicked.connect(self.load_file)
        self.cbSatelliteOverpasses.currentIndexChanged.connect(
            self.plot_overpass_track)

        self.settings_tag = "satellitedock"
        settings = load_settings_qsettings(self.settings_tag, {"filename": ""})
        self.leFile.setText(settings["filename"])
示例#5
0
 def load_settings(self):
     """
     Load settings from the file self.settingsfile.
     """
     settings = load_settings_qsettings(self.settings_tag, {})
     self.getView().set_map_appearance(settings)
示例#6
0
 def load_settings(self):
     """
     Load settings from the file self.settingsfile.
     """
     settings = load_settings_qsettings(self.settings_tag)
     self.getView().set_settings(settings)
示例#7
0
 def load_settings(self):
     """
     Load settings from the file self.settingsfile.
     """
     self.performance_settings = load_settings_qsettings(
         self.settings_tag, DEFAULT_PERFORMANCE)
示例#8
0
 def test_load_settings(self):
     settings = {'foo': 'bar'}
     config.save_settings_qsettings(self.tag, settings, ignore_test=True)
     settings = config.load_settings_qsettings(self.tag, ignore_test=True)
     assert isinstance(settings, dict)
     assert settings["foo"] == "bar"