Coder Social home page Coder Social logo

qgis / qgis-hub-plugin Goto Github PK

View Code? Open in Web Editor NEW
3.0 5.0 2.0 1.03 MB

A QGIS plugins to fetch resources from the QGIS Hub

Home Page: https://qgis.github.io/QGIS-Hub-Plugin/

License: GNU General Public License v3.0

Python 98.72% HTML 0.45% QMake 0.84%
qgis

qgis-hub-plugin's Introduction

QGIS Hub Plugin - QGIS Plugin

A QGIS plugins to fetch resources from the QGIS Hub

Resource Browser

Code style: black Imports: isort pre-commit

flake8

Tooling

This project is configured with the following tools:

  • Black to format the code without any existential question
  • iSort to sort the Python imports

Code rules are enforced with pre-commit hooks. Static code analisis is based on: Flake8

See also: contribution guidelines.

CI/CD

Plugin is linted, tested, packaged and published with GitHub.

If you mean to deploy it to the official QGIS plugins repository, remember to set your OSGeo credentials (OSGEO_USER_NAME and OSGEO_USER_PASSWORD) as environment variables in your CI/CD tool.

Documentation

The documentation is generated using Sphinx and is automatically generated through the CI and published on Pages.


Next steps

Set up development environment

Typical commands on Linux (Ubuntu).

  1. If you don't pick the git init option, initialize your local repository:

    git init
  2. Follow the embedded documentation to set up your development environment

  3. Add all files to git index to prepare initial commit:

    git add -A
  4. Run the git hooks to ensure that everything runs OK and to start developing on quality standards:

    pre-commit run

Try to build documentation locally

  1. Have a look to the plugin's metadata.txt file: review it, complete it or fix it if needed (URLs, etc.).
  2. Follow the embedded documentation to build plugin documentation locally

License

Distributed under the terms of the GPLv3 license.

qgis-hub-plugin's People

Contributors

dependabot[bot] avatar ismailsunni avatar ronitjadhav avatar timlinux avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

gischen

qgis-hub-plugin's Issues

Custom Button: Load Geopackage Directly to QGIS

Feature description

If the selected resource is a Geopackage, add a button to open the Geopackage directly to QGIS
If QGIS is currently opening a project: Add a dialog to close without saving, canceling, or save

  • Create a button to add the geopackage to the current project
  • Create a button to add the geopackage to a new project

Additional context

No response

Translation

No need to translate, but setup the infrastructure correctly:

  • Setup transifex
  • Test if we can update the string, push to transifex, translate, pul the translation, and compile the strings

More-Integration Feature

Feature description

Add more integration for each type of resource:

  • Style: copy directly
  • Model: add the model to QGIS directly
  • Project: load the project
  • Layer Definition: load the layer

Additional context

No response

Basic Features

Feature description

  • A better way to handle download (e.g. background process)
  • Use the thumbnail of the resource in the browser
  • #25
  • Load the resource asynchronously
  • #26
  • Option to choose download folder #18
  • Filtering by resource type #13
  • Full-text search #14

Additional context

Currently, the plugin is working (i.e. able to browse, preview, and download)

image

Release as Non Experimental

Feature description

We have released it as experimental, people have tested it and so far looks good. Time to release it as non-experimental.

Additional context

No response

Search Resource By Text

Feature description

Implement search resource (for resource name and creator)

  • Remove the unused tool button (blue arrow)
  • Implement the search for the line edit in the blue rectangle
  • Search is updated when the search term is changed (that's why no need the tool button)

image

Additional context

No response

Store the Download Location in QgsSetting

Feature description

  • Store the download location as a QgsSetting
  • Set the default to ~/Downloads or a similar directory
  • Update it when the user changes the download location when downloading other resources
  • Don't update the download location when the user doesn't download it (e.g. add model to QGIS directly)

Additional context

No response

Add Layer Definition File and 3D Model

Feature description

Currently, the QGIS Hub website accepts users to upload Layer Definition Files and 3D Models, but it's not available from the API. We should add those two to the plugin when the API allows it.

Upstream issue: qgis/QGIS-Django#280

Additional context

No response

Create, Edit, and Delete Resources

Feature description

Currently, there is no API for these features. When they are available, we should implement this and make it closely integrated into QGS. For example:

  • On setting dialog, set up authentication
  • On layer, right-click and upload the layer definition
  • On style, right-click and upload the style
  • On model, 3d model, right then upload
  • Delete the resource from the resource browser
  • Filter by author or show only your own resource

Additional context

No response

Keep the State of Plugin Options

Feature description

We should store the state of the Open Download Directory check box in the QgsSetting so that it always keeps the preferred choice.

  • Download checkbox
  • Active view (grid vs list)
  • Plugin dialog geometry
  • Icon size
  • Selected resource (?)

Use PlgOptionsManager for storing the setting.

Additional context

No response

Show Better Image in the Preview

Feature description

Currently, the API only gives the thumbnail URL. It's enough for the grid view. But it's not so good when shown in the preview area.
Example:

Thumbnail:
Thumbnail

Image:
Image

Additional context

Need an upstream implementation: qgis/QGIS-Django#291

No response

Custom Tag for Style

Feature description

Add a custom tag (e.g. QGIS Hub) for style added to the QGIS

Additional context

No response

Python error

What is the bug or the crash?

Unable to open the tool.
Tried with several QGIS versions (3.28., 3.30., 3.32.)

I got the following error message:
2023-11-01T11:06:14 WARNING Traceback (most recent call last):
File "C:\Users/joona/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis_hub_plugin\utilities\common.py", line 33, in download_resource_thumbnail
extension = url.split(".")[-1]
AttributeError: 'NoneType' object has no attribute 'split'

         During handling of the above exception, another exception occurred:
         
         Traceback (most recent call last):
          File "C:\Users/joona/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis_hub_plugin\plugin_main.py", line 174, in _open_resource_browser_dialog
          dialog = ResourceBrowserDialog(
          File "C:\Users/joona/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis_hub_plugin\gui\resource_browser.py", line 89, in __init__
          self.populate_resources()
          File "C:\Users/joona/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis_hub_plugin\utilities\qgis_util.py", line 11, in wrapper
          return func(*args, **kwargs)
          File "C:\Users/joona/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis_hub_plugin\gui\resource_browser.py", line 222, in populate_resources
          item = ResourceItem(resource)
          File "C:\Users/joona/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis_hub_plugin\gui\resource_item.py", line 34, in __init__
          thumbnail_path = download_resource_thumbnail(self.thumbnail, self.uuid)
          File "C:\Users/joona/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis_hub_plugin\utilities\common.py", line 34, in download_resource_thumbnail
          except IndexError():
         TypeError: catching classes that do not inherit from BaseException is not allowed

Steps to reproduce the issue

  1. Install the plugin.
  2. Click on the plugin icon.
  3. See error
    QGIS_Hub_plugin_error

QGIS and Plugin Versions

Tried wtih several QGIS versions. Same problem every time.
3.28.
3.30.
3.34.

Operating System

Windows 10

Better Download Resource Button

Feature description

The download button should open a file dialog to let the user select the download directory
Make the download button a tool button

Additional context

No response

Load the Thumbnail in the Background

Feature description

Currently, we have around ~160 resources. It will take some time to load them all for the first time. I guess, it's time to put the thumbnail downloader in the background using QgsTask and show it after we download it.

  • Call the download thumbnail in the background with QgsTask
  • If the thumbnail is not ready, use a default thumbnail
  • After the download is finished, we should update the thumbnail
  • When a thumbnail is clicked and shown in the preview, it should directly download the thumbnail (without going to the QgsTask) to have smooth user experience

Additional context

No response

Custom Button: Add Style Resource Directly to QGIS

Feature description

If the currently selected resource is a style, add a button to add the style directly to QGIS

image

  • Download the file to the temp directory
  • [ ] Unzip it
  • [ ] Find the style file
  • Import the style to QGIS (see: Settings -> Style Manager -> Export/Import -> Import item(s))

Additional context

No response

Use Custom Directory when Add Model to QGIS

Feature description

A user needs to choose the filename when adding the model to QGIS. We can make it better by saving the model to a specific directory under the processing directory, for example: QGISHub

  • Remove the save dialog for Add Model to QGIS
  • Create the directory qgis_hub if it's not created yet
  • Store the model in the directory

Additional context

No response

Filter By Resources Type

Feature description

  • Add a check box for each resource type in the red box below
  • Filter the resource according to the checkbox

image

Additional context

No response

A better icon

Feature description

A better icon

Additional context

No response

Fix UI on HiDPI Screen

What is the bug or the crash?

The UI is messed up on the HiDPI screen. Tested on Ubuntu 22.04, XPS 13, QHD.

2023-07-18_00-25-high-res-screen

Steps to reproduce the issue

Open it in HiDPI screen

Versions

Plugin Version 0.1.0

Supported QGIS version

  • I'm running a supported QGIS version according to the official roadmap.

New profile

  • I tried with a new QGIS profile

Additional context

No response

Move the Reload Resources Button

Feature description

Move the reload resources button to under the browser area, and use QPushButton instead.
image

Additional context

No response

Store the Response from the API as a File

Feature description

The resources hub is not updated frequently. It's better to only do a request to the resource hub API once in a while. We will populate the resource from the stored response. We will need to implement these:

  • Store the response from the API as a file (e.g. QGIS_PROFILE_DRIECTORY/qgis_hub/response.json)
  • Load from when opening the browser dialog (see: populate_resources function)
  • Add a button to reload resources (re-fetch the resource and update the file) in the browser dialog

Additional context

No response

Download Style Should be Saved as zip (?)

What is the bug or the crash?

Currently, when we download the style resource, it's saved as an XML. It's not the correct format (at least for some resources like Dormido_Rustic_Circles, Cross-Stitch-II).

It will work when we saved it as a zip file, extract it then export it to QGIS.

TODO:

  • Check if the file property in the response.json is really wrong (it has XML in the URL, but it is supposed to be a .zip)
  • Save as a zip file

Steps to reproduce the issue

Clear

Versions

3.30

Supported QGIS version

  • I'm running a supported QGIS version according to the official roadmap.

New profile

  • I tried with a new QGIS profile

Additional context

No response

Update Resources Automatically

Feature description

There are two options:

Option 1: Always update when the plugin is launched

Pros:

  • Always get the last update without doing anything
  • No need to have update resources button

Cons:

  • More time to open (especially when the internet is slow and if the resource is a lot)

Option 2: Add a setting on how often should the plugin check for new updates

Pros:

  • Not doing useless requests, since the resources are not always updated every day (the download number probably, but not the content itself)

Cons:

  • Need to have a manual update resource button, like what we have now
  • Need to add a setting to set the interval: e.g. every launch, every day, every 3 day, every week, every two weeks, never (use manual update button)

Additional context

No response

Better UX when Load/Reload Resource from the API

Feature description

We will do it in a simple way for now:

  • Show a busy cursor when retrieving the resources list, implement it as a decorator so that we can reuse it in other function/process
  • Show a success or failure message using QgsMessageBar

Additional context

No response

Put the Message Bar on the Plugin Window

Feature description

Currently, we show the message to the user on the QGIS message bar. It's better to put it in the plugin window

  • Put the message in the plugin window message bar, not the main QGIS application window
  • Put it as a function so that we apply DRY (Don't Repeat Yourself) principle

Additional context

No response

Add Clear Cache/Thumbnail

Feature description

Currently, reload repositories button only reloads the content of the resource, not the downloaded thumbnail. We should add this functionality, and probably put it in the setting dialog.

It's a low priority though.

Additional context

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.