QGEP / qgepqwat2ili

3 stars 3 forks source link

logs with xtf file instead of temp folder #77

Closed sjib closed 1 year ago

sjib commented 2 years ago

Currently the logs are stored in the temp folder, as it usually has access rights for writing

In virtual environments reading the files is not possible as @urskaufmann mentioned.

qgepqwat2ili_logs

Suggestion: Change folder to xtf folder and name the logs as xtfname.*.log

Question: What happens if I export the xtf a second time with the same name? Overwrite old logs?

urskaufmann commented 2 years ago

Precision: it's not "not possible to read". But the button "show logs" has not an adress that works in the virtual environment (we have no access to c: )

sjib commented 2 years ago

@urskaufmann So even a tool tip with the file path would not help to access it manually, right?

urskaufmann commented 2 years ago

The path of the log-files is C:\Users\KAU\AppData\Local\Temp\qgepqwat2ili AppData is hidden and not shown even if I check Ausgeblendete Elemente in the file explorer. I have to use a detour to have access to this place.

ponceta commented 2 years ago

Windows + E and copy paste the URL

What I got is :

Is there a possibility to create an URL directly to the destination file in the success message ? file://C:\mypath\my_interlis_generated_file.xtf

sjib commented 2 years ago

A second button could be added in the success bar: https://github.com/QGEP/qgepqwat2ili/blob/49b419f39237cbb9a8be1d05b4c039e253b2d6ef/qgepqwat2ili/gui/__init__.py#L33

button2 = QPushButton(widget) button2.setText("Show export file") button.pressed.connect(lambda p=file_name: webbrowser.open(p)) widget.layout().addWidget(button)

Documentation can be found here https://docs.qgis.org/3.22/en/docs/pyqgis_developer_cookbook/communicating.html

sjib commented 2 years ago

Or even easier if it is possible to make {file_name} a hyperlink: https://github.com/QGEP/qgepqwat2ili/blob/49b419f39237cbb9a8be1d05b4c039e253b2d6ef/qgepqwat2ili/gui/__init__.py#L248

sjib commented 2 years ago

The log_path can be (easily?) adjusted in adding the file name directory path (export directory) as next_to_path in the function make_log_path https://github.com/QGEP/qgepqwat2ili/blob/49b419f39237cbb9a8be1d05b4c039e253b2d6ef/qgepqwat2ili/utils/various.py#L215 https://github.com/QGEP/qgepqwat2ili/blob/49b419f39237cbb9a8be1d05b4c039e253b2d6ef/qgepqwat2ili/utils/various.py#L216

All calls of make_log_path would have to be adjusted from eg. filename = make_log_path(None, "qgepqwat2ili") to filename = make_log_path("next_to_path", "qgepqwat2ili")

ponceta commented 2 years ago

@olivierdalang propose a way to :

sjib commented 2 years ago

WIP Pull request by OD: add ability to save logs next to input/output file in the GUI

Suggested implementation of the checkbox: gui_export_logs_option ui

olivierdalang commented 1 year ago

merged in https://github.com/QGEP/qgepplugin/pull/71