Skip to content

Commit

Permalink
Update plugin to Wegue v1.0.0 (#33)
Browse files Browse the repository at this point in the history
- adapt the color value to the new position within the config file
- add more map modules: Attribute Table, Overview Map, Map Recorder
- **deprecate** options to add text, because these option have moved to the "locale" file 
- adapt UI and help text
- some typos
- minor Update of README
  • Loading branch information
JakobMiksch authored Mar 24, 2022
1 parent d6d2b01 commit 801f7ba
Show file tree
Hide file tree
Showing 9 changed files with 194 additions and 115 deletions.
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![logo](logo/logo.png)

# QGIS2Wegue
# QGIS2Wegue

A QGIS plugin for creating [Wegue](https://github.com/meggsimum/wegue) configurations based on a QGIS project. Supported formats are: `WMS`, `XYZ`, `KML`, `GeoJSON`, `WFS`

Expand All @@ -10,7 +10,7 @@ A QGIS plugin for creating [Wegue](https://github.com/meggsimum/wegue) configura

- Add all your desired layers to QGIS
- Open the plugin, chose a filepath and click `OK`
- Now you have a configuration file that works with Wegue
- Now you have a configuration file that works with Wegue

## Installation

Expand All @@ -37,11 +37,20 @@ Update the plugin with `git pull https://github.com/meggsimum/qgis2wegue` and re

## Development Snippets

Install `pyqt5-dev-tools`. On Debian/Ubuntu:

```shell
sudo apt-get install pyqt5-dev-tools
```

Check code quality and errors:

```shell
# installation if needed
pip install --user pylint pycodestyle

pylint --reports=n --rcfile=pylintrc .
pycodestyle --repeat --ignore=E203,E121,E122,E123,E124,E125,E126,E127,E128 --exclude=resources.py .
pycodestyle --repeat --ignore=W504,E203,E121,E122,E123,E124,E125,E126,E127,E128 --exclude=resources.py .
```

Compile resources e.g. when logo has changed:
Expand All @@ -58,7 +67,6 @@ TARGET_DIR=your/custom/path

TMP_PLUGIN_DIR=${TARGET_DIR}/qgis2wegue

rm -rf ${TMP_PLUGIN_DIR}
mkdir ${TMP_PLUGIN_DIR}
cp -r \
*.py \
Expand Down
2 changes: 1 addition & 1 deletion metadata.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[general]
name=QGIS2Wegue
qgisMinimumVersion=3.4
version=1.0.0
version=1.1.0
author=Jakob Miksch
[email protected]
tracker=https://github.com/meggsimum/qgis2wegue/issues
Expand Down
49 changes: 29 additions & 20 deletions qgis2wegue.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@

from .wegue_util import (center2webmercator,
scale2zoom,
extract_wegue_layer_config)
extract_wegue_layer_config,
rgb2hex
)


class qgis2wegue:
Expand Down Expand Up @@ -136,20 +138,16 @@ def check_path_and_handle_submit_button(self, path):

dir_exists = os.path.exists(base_dir)

# wegue config files must match this pattern
file_is_valid = (
file == 'app-conf.json') | (file.startswith('app-conf-') & file.endswith('.json'))

enabled = False
if (file != "") & dir_exists & file_is_valid:
if (file != "") & dir_exists & file.endswith('.json'):
# output path valid
enabled = True

self.dlg.button_box.setEnabled(enabled)

def store_wegue_conf_to_file(self):
"""
Collects all paramters from QGIS and the plugin form
Collects all parameters from QGIS and the plugin form
and creates the Wegue configuration
"""

Expand All @@ -176,12 +174,6 @@ def store_wegue_conf_to_file(self):
if result_layer:
self.wegue_conf.mapLayers.append(result_layer)

# optional properties
self.wegue_conf.title = self.dlg.q2w_title_widget.text()
self.wegue_conf.footerTextLeft = self.dlg.q2w_footer_left_widget.text()
self.wegue_conf.footerTextRight = \
self.dlg.q2w_footer_right_widget.text()

# add checkbox properties
self.wegue_conf.showCopyrightYear = \
self.dlg.q2w_copyright_year.isChecked()
Expand All @@ -203,21 +195,38 @@ def store_wegue_conf_to_file(self):

if self.dlg.q2w_geocoder.isChecked():
self.wegue_conf.add_geocoder()

if self.dlg.q2w_geodata_drag_drop.isChecked():
self.wegue_conf.add_map_geodata_drag_drop()

if self.dlg.q2w_permalink.isChecked():
self.wegue_conf.add_permalink()

if self.dlg.q2w_geolocator.isChecked():
self.wegue_conf.add_geolocator()

if self.dlg.q2w_overview_map.isChecked():
self.wegue_conf.add_overview_map()

if self.dlg.q2w_view_animation.isChecked():
self.wegue_conf.add_view_animation()

if self.dlg.q2w_map_recorder.isChecked():
self.wegue_conf.add_maprecorder()

if self.dlg.q2w_attribute_table.isChecked():
self.wegue_conf.add_attribute_table()

# color
color_rgb = self.dlg.q2w_color_widget.color().getRgb()
# drop alpha value
color_rgb = color_rgb[0:3]
self.wegue_conf.baseColor = "rgb" + str(color_rgb)
qt_color = self.dlg.q2w_color_widget.color()
hex_color = rgb2hex(qt_color.red(), qt_color.green(), qt_color.blue())
self.wegue_conf.colorTheme = {
"themes": {
"light": {
"primary": hex_color
}
}
}

# path for config
user_input = self.dlg.q2w_file_widget.filePath()
Expand Down
2 changes: 1 addition & 1 deletion qgis2wegue_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ class qgis2wegueDialog(QtWidgets.QDialog, FORM_CLASS):
def __init__(self, parent=None):
"""Constructor."""
super(qgis2wegueDialog, self).__init__(parent)
self.setupUi(self)
self.setupUi(self)
Loading

0 comments on commit 801f7ba

Please sign in to comment.