예제 #1
0
    def __init__(self, parent=None):
        """
        OsmFileWidget constructor
        """
        QuickOSMWidget.__init__(self, parent)
        self.setupUi(self)

        # Set UI
        self.radioButton_osmConf.setChecked(False)
        self.label_progress.setText("")
        self.lineEdit_filePrefix.setDisabled(True)

        # Set default osm conf
        self.defaultOsmConf = join(
            dirname(dirname(abspath(__file__))), 'osmconf.ini')
        if not isfile(self.defaultOsmConf):
            self.defaultOsmConf = ''
        self.lineEdit_osmConf.setText(self.defaultOsmConf)
        self.pushButton_runQuery.setEnabled(False)

        # Connect
        self.pushButton_browseOsmFile.clicked.connect(self.set_osm_file_path)
        self.pushButton_browseOsmConf.clicked.connect(self.set_osm_conf_path)
        self.lineEdit_osmConf.textEdited.connect(self.disable_run_button)
        self.lineEdit_osmFile.textEdited.connect(self.disable_run_button)
        self.radioButton_osmConf.toggled.connect(self.disable_run_button)
        self.pushButton_runQuery.clicked.connect(self.open_file)
        self.pushButton_resetIni.clicked.connect(self.reset_ini)
        self.lineEdit_browseDir.textEdited.connect(self.disable_prefix_file)
예제 #2
0
    def __init__(self, parent=None):
        """
        OsmFileWidget constructor
        """
        QuickOSMWidget.__init__(self, parent)
        self.setupUi(self)

        # Set UI
        self.radioButton_osmConf.setChecked(False)
        self.label_progress.setText("")
        self.lineEdit_filePrefix.setDisabled(True)

        # Set default osm conf
        self.defaultOsmConf = join(dirname(dirname(abspath(__file__))),
                                   'osmconf.ini')
        if not isfile(self.defaultOsmConf):
            self.defaultOsmConf = ''
        self.lineEdit_osmConf.setText(self.defaultOsmConf)
        self.pushButton_runQuery.setEnabled(False)

        # Connect
        self.pushButton_browseOsmFile.clicked.connect(self.set_osm_file_path)
        self.pushButton_browseOsmConf.clicked.connect(self.set_osm_conf_path)
        self.lineEdit_osmConf.textEdited.connect(self.disable_run_button)
        self.lineEdit_osmFile.textEdited.connect(self.disable_run_button)
        self.radioButton_osmConf.toggled.connect(self.disable_run_button)
        self.pushButton_runQuery.clicked.connect(self.open_file)
        self.pushButton_resetIni.clicked.connect(self.reset_ini)
        self.lineEdit_browseDir.textEdited.connect(self.disable_prefix_file)
예제 #3
0
    def __init__(self, parent=None):
        """
        MyQueriesWidget constructor
        """
        QuickOSMWidget.__init__(self, parent)
        self.setupUi(self)
        self.current_query = None
        self.config_layer = None

        # Setup UI
        self.label_progress.setText("")
        self.pushButton_runQuery.setDisabled(True)
        self.pushButton_showQuery.setDisabled(True)
        self.groupBox.setDisabled(True)
        self.lineEdit_nominatim.setEnabled(False)
        self.radioButton_extentLayer.setEnabled(False)
        self.radioButton_extentMapCanvas.setEnabled(False)

        self.fill_layer_combobox()
        self.fill_tree()
        self.groupBox.setCollapsed(True)

        # Connect
        self.pushButton_runQuery.clicked.connect(self.run_query)
        self.pushButton_showQuery.clicked.connect(self.show_query)
        self.pushButton_browse_output_file.clicked.connect(
            self.set_output_directory_path)
        self.lineEdit_browseDir.textEdited.connect(self.disable_prefix_file)
        self.treeQueries.doubleClicked.connect(self.open_and_run_query)
        self.treeQueries.customContextMenuRequested.connect(
            self.show_popup_menu)
        self.treeQueries.clicked.connect(self.open_query)
        self.lineEdit_search.textChanged.connect(self.text_changed)
        self.radioButton_extentLayer.toggled.connect(self.extent_radio)
        self.pushButton_refreshLayers.clicked.connect(self.fill_layer_combobox)
예제 #4
0
    def __init__(self, parent=None):
        """
        QuickQueryWidget constructor
        """
        QuickOSMWidget.__init__(self, parent)
        self.setupUi(self)

        # Setup UI
        self.label_progress.setText("")
        self.lineEdit_filePrefix.setDisabled(True)
        self.groupBox.setCollapsed(True)
        self.fill_layer_combobox()
        self.groupBox.setCollapsed(True)
        self.comboBox_in_around.setDisabled(True)
        self.lineEdit_nominatim.setDisabled(True)
        self.radioButton_extentMapCanvas.setChecked(True)
        self.spinBox_distance_point.setDisabled(True)
        self.label_distance_point.setDisabled(True)

        # Setup in/around combobox
        self.comboBox_in_around.insertItem(0, tr('ui_quick_query', u'In'))
        self.comboBox_in_around.insertItem(1, tr('ui_quick_query', u'Around'))

        # connect
        self.pushButton_runQuery.clicked.connect(self.run_query)
        self.pushButton_showQuery.clicked.connect(self.show_query)
        self.pushButton_browse_output_file.clicked.connect(
            self.set_output_directory_path)
        self.comboBox_key.editTextChanged.connect(self.key_edited)
        self.lineEdit_browseDir.textEdited.connect(self.disable_prefix_file)
        self.radioButton_extentLayer.toggled.connect(
            self.allow_nominatim_or_extent)
        self.radioButton_extentMapCanvas.toggled.connect(
            self.allow_nominatim_or_extent)
        self.radioButton_place.toggled.connect(self.allow_nominatim_or_extent)
        self.pushButton_refreshLayers.clicked.connect(self.fill_layer_combobox)
        self.pushButton_mapFeatures.clicked.connect(self.open_map_features)
        self.buttonBox.button(QDialogButtonBox.Reset).clicked.connect(
            self.reset_form)
        self.comboBox_in_around.currentIndexChanged.connect(self.in_or_around)

        # Setup auto completion
        map_features_json_file = join(dirname(dirname(abspath(__file__))),
                                      'mapFeatures.json')

        if isfile(map_features_json_file):
            self.osmKeys = load(open(map_features_json_file))
            keys = self.osmKeys.keys()
            keys.sort()
            keys_completer = QCompleter(keys)
            self.comboBox_key.addItems(keys)
            self.comboBox_key.setCompleter(keys_completer)
            self.comboBox_key.completer().setCompletionMode(
                QCompleter.PopupCompletion)
        self.key_edited()

        self.init_nominatim_autofill()
예제 #5
0
    def __init__(self, parent=None):
        """
        QuickQueryWidget constructor
        """
        QuickOSMWidget.__init__(self, parent)
        self.setupUi(self)

        # Setup UI
        self.label_progress.setText("")
        self.lineEdit_filePrefix.setDisabled(True)
        self.groupBox.setCollapsed(True)
        self.fill_layer_combobox()
        self.groupBox.setCollapsed(True)
        self.comboBox_in_around.setDisabled(True)
        self.lineEdit_nominatim.setDisabled(True)
        self.radioButton_extentMapCanvas.setChecked(True)
        self.spinBox_distance_point.setDisabled(True)
        self.label_distance_point.setDisabled(True)

        # Setup in/around combobox
        self.comboBox_in_around.insertItem(0, tr('ui_quick_query', u'In'))
        self.comboBox_in_around.insertItem(1, tr('ui_quick_query', u'Around'))

        # connect
        self.pushButton_runQuery.clicked.connect(self.run_query)
        self.pushButton_showQuery.clicked.connect(self.show_query)
        self.pushButton_browse_output_file.clicked.connect(
            self.set_output_directory_path)
        self.comboBox_key.editTextChanged.connect(self.key_edited)
        self.lineEdit_browseDir.textEdited.connect(self.disable_prefix_file)
        self.radioButton_extentLayer.toggled.connect(
            self.allow_nominatim_or_extent)
        self.radioButton_extentMapCanvas.toggled.connect(
            self.allow_nominatim_or_extent)
        self.radioButton_place.toggled.connect(self.allow_nominatim_or_extent)
        self.pushButton_refreshLayers.clicked.connect(self.fill_layer_combobox)
        self.pushButton_mapFeatures.clicked.connect(self.open_map_features)
        self.buttonBox.button(QDialogButtonBox.Reset).clicked.connect(
            self.reset_form)
        self.comboBox_in_around.currentIndexChanged.connect(self.in_or_around)

        # Setup auto completion
        map_features_json_file = join(
            dirname(dirname(abspath(__file__))), 'mapFeatures.json')

        if isfile(map_features_json_file):
            self.osmKeys = load(open(map_features_json_file))
            keys = self.osmKeys.keys()
            keys.sort()
            keys_completer = QCompleter(keys)
            self.comboBox_key.addItems(keys)
            self.comboBox_key.setCompleter(keys_completer)
            self.comboBox_key.completer().setCompletionMode(
                QCompleter.PopupCompletion)
        self.key_edited()

        self.init_nominatim_autofill()
예제 #6
0
    def __init__(self, parent=None):
        """
        MyQueriesWidget constructor
        """
        QuickOSMWidget.__init__(self, parent)
        self.setupUi(self)
        self.current_query = None
        self.config_layer = None

        # Setup UI
        self.label_progress.setText("")
        self.pushButton_runQuery.setDisabled(True)
        self.pushButton_showQuery.setDisabled(True)
        self.groupBox.setDisabled(True)
        self.lineEdit_nominatim.setEnabled(False)
        self.radioButton_extentLayer.setEnabled(False)
        self.radioButton_extentMapCanvas.setEnabled(False)

        self.fill_layer_combobox()
        self.fill_tree()
        self.groupBox.setCollapsed(True)

        # Enable autofill on nominatim
        self.init_nominatim_autofill()

        # Connect
        self.pushButton_runQuery.clicked.connect(self.run_query)
        self.pushButton_showQuery.clicked.connect(self.show_query)
        self.pushButton_browse_output_file.clicked.connect(
            self.set_output_directory_path)
        self.lineEdit_browseDir.textEdited.connect(self.disable_prefix_file)
        self.treeQueries.doubleClicked.connect(self.open_and_run_query)
        self.treeQueries.customContextMenuRequested.connect(
            self.show_popup_menu)
        self.treeQueries.clicked.connect(self.open_query)
        self.lineEdit_search.textChanged.connect(self.text_changed)
        self.radioButton_extentLayer.toggled.connect(self.extent_radio)
        self.pushButton_refreshLayers.clicked.connect(self.fill_layer_combobox)
예제 #7
0
    def __init__(self, parent=None):
        """
        QueryWidget constructor
        """
        QuickOSMWidget.__init__(self, parent)
        self.setupUi(self)

        # Highlight XML
        self.highlighter = XMLHighlighter(self.textEdit_query.document())

        # Setup UI
        self.label_progress.setText("")
        self.lineEdit_filePrefix.setDisabled(True)
        self.groupBox.setCollapsed(True)
        self.bbox = None
        self.fill_layer_combobox()
        self.groupBox.setCollapsed(True)
        # Disable buttons
        self.pushButton_generateQuery.setDisabled(True)
        self.pushButton_saveQuery.setDisabled(True)
        self.pushButton_runQuery.setDisabled(True)

        # Setup menu for saving
        popup_menu = QMenu()
        save_final_query_action = QAction(
            tr('QuickOSM', 'Save as final query'), self.pushButton_saveQuery)
        save_final_query_action.triggered.connect(self.save_final_query)
        popup_menu.addAction(save_final_query_action)
        save_template_query_action = QAction(
            tr('QuickOSM', 'Save as template'), self.pushButton_saveQuery)
        save_template_query_action.triggered.connect(self.save_template_query)
        popup_menu.addAction(save_template_query_action)
        self.pushButton_saveQuery.setMenu(popup_menu)

        # Setup menu for documentation
        popup_menu = QMenu()
        map_features_action = QAction('Map Features',
                                      self.pushButton_documentation)
        map_features_action.triggered.connect(self.open_map_features)
        popup_menu.addAction(map_features_action)
        overpass_action = QAction('Overpass', self.pushButton_documentation)
        overpass_action.triggered.connect(self.open_doc_overpass)
        popup_menu.addAction(overpass_action)
        self.pushButton_documentation.setMenu(popup_menu)

        # Enable autofill on nominatim
        self.init_nominatim_autofill()

        # connect
        self.pushButton_runQuery.clicked.connect(self.run_query)
        self.pushButton_generateQuery.clicked.connect(self.generate_query)
        self.pushButton_browse_output_file.clicked.connect(
            self.set_output_directory_path)
        self.lineEdit_browseDir.textEdited.connect(self.disable_prefix_file)
        self.textEdit_query.cursorPositionChanged.connect(
            self.highlighter.rehighlight)
        self.textEdit_query.cursorPositionChanged.connect(
            self.allow_nominatim_or_extent)
        self.radioButton_extentLayer.toggled.connect(self.extent_radio)
        self.pushButton_refreshLayers.clicked.connect(self.fill_layer_combobox)
        self.pushButton_overpassTurbo.clicked.connect(self.open_overpass_turbo)
        self.buttonBox.button(QDialogButtonBox.Reset).clicked.connect(
            self.reset_form)
예제 #8
0
    def __init__(self, parent=None):
        """
        QueryWidget constructor
        """
        QuickOSMWidget.__init__(self, parent)
        self.setupUi(self)

        # Highlight XML
        self.highlighter = XMLHighlighter(self.textEdit_query.document())

        # Setup UI
        self.label_progress.setText("")
        self.lineEdit_filePrefix.setDisabled(True)
        self.groupBox.setCollapsed(True)
        self.bbox = None
        self.fill_layer_combobox()
        self.groupBox.setCollapsed(True)
        # Disable buttons
        self.pushButton_generateQuery.setDisabled(True)
        self.pushButton_saveQuery.setDisabled(True)
        self.pushButton_runQuery.setDisabled(True)

        # Setup menu for saving
        popup_menu = QMenu()
        save_final_query_action = QAction(
            tr('QuickOSM', 'Save as final query'), self.pushButton_saveQuery)
        save_final_query_action.triggered.connect(self.save_final_query)
        popup_menu.addAction(save_final_query_action)
        save_template_query_action = QAction(
            tr('QuickOSM', 'Save as template'), self.pushButton_saveQuery)
        save_template_query_action.triggered.connect(self.save_template_query)
        popup_menu.addAction(save_template_query_action)
        self.pushButton_saveQuery.setMenu(popup_menu)

        # Setup menu for documentation
        popup_menu = QMenu()
        map_features_action = QAction(
            'Map Features', self.pushButton_documentation)
        map_features_action.triggered.connect(self.open_map_features)
        popup_menu.addAction(map_features_action)
        overpass_action = QAction('Overpass', self.pushButton_documentation)
        overpass_action.triggered.connect(self.open_doc_overpass)
        popup_menu.addAction(overpass_action)
        self.pushButton_documentation.setMenu(popup_menu)

        # Enable autofill on nominatim
        self.init_nominatim_autofill()

        # connect
        self.pushButton_runQuery.clicked.connect(self.run_query)
        self.pushButton_generateQuery.clicked.connect(self.generate_query)
        self.pushButton_browse_output_file.clicked.connect(
            self.set_output_directory_path)
        self.lineEdit_browseDir.textEdited.connect(self.disable_prefix_file)
        self.textEdit_query.cursorPositionChanged.connect(
            self.highlighter.rehighlight)
        self.textEdit_query.cursorPositionChanged.connect(
            self.allow_nominatim_or_extent)
        self.radioButton_extentLayer.toggled.connect(self.extent_radio)
        self.pushButton_refreshLayers.clicked.connect(self.fill_layer_combobox)
        self.pushButton_overpassTurbo.clicked.connect(self.open_overpass_turbo)
        self.buttonBox.button(QDialogButtonBox.Reset).clicked.connect(
            self.reset_form)