Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: "Generate report with previous settings" #6

Open
velle opened this issue Jun 1, 2022 · 1 comment
Open

Feature request: "Generate report with previous settings" #6

velle opened this issue Jun 1, 2022 · 1 comment

Comments

@velle
Copy link

velle commented Jun 1, 2022

Feature request: An easy way of repeating the report generation process with the same parameters as the last time. This could be in the form of an item in the "qgis report wizard" menu called "Generate report with previous settings".

More context below.

Im in the process of writing a Jinja HTML template. For every small change I make, I need to run the "hypertext report generator" and inspect the result. I imagine that other users will also need to do this.

There are three obvious ways of generating the report:

  • If I leave the wizard open it requires two clicks, which is acceptable. However the window is always on top of the other QGIS windows, so if I need to work in QGIS with only one monitor, this is annoying.
  • If I don't leave the wizard open, then when I open the wizard I need to either type or paste the settings (input template, vector layer, output file), which is very tedious.
  • I can click "Advanced" -> "Copy as Python Command", and I get a line of Python code. I open the Python Console and paste this line and excecute. From now on, when I need to render another time, I can put the cursor in the Python Console, press Up-key, press Enter.

The best solution for me, which I am currently using, is described below. However it is not suitable for users in general and it is more tedious to set up than what one would have hoped for.

Paste the code below into the Python Console, it is now possible to generate the report by pressing Ctrl + Shift + 1.

def qgis_wizard_predefined():
    #from qgis import processing
    print('qgis_wizard_predefined')
    processing.run("report_wizard:hypertext_report", {'TEMPLATE':'/home/jdoe/myproj/report/html/main.html','VECTOR_LAYER':'/home/jdoe/myproj/lamps.shp','LIMIT':100,'EMBED_IMAGES':False,'OUTPUT':'/home/jdoe/myproj/report/htmloutp/main.html'})

# Assign "Ctrl + Shift + 1" to openAlgorithm()
from qgis.PyQt.QtGui import QKeySequence
from qgis.PyQt.QtWidgets import QShortcut
from qgis.PyQt.QtCore import Qt
shortcut = QShortcut(QKeySequence(Qt.ControlModifier + Qt.ShiftModifier + Qt.Key_2), iface.mainWindow())

shortcut.setContext(Qt.ApplicationShortcut)
shortcut.activated.connect(qgis_wizard_predefined)
@robf300
Copy link

robf300 commented Nov 3, 2022

This would be brilliant to tie in with a one press button for my purposes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants