DARIAH-DE / TopicsExplorer

Explore your own text collection with a topic model – without prior knowledge.
https://dariah-de.github.io/TopicsExplorer
Apache License 2.0
61 stars 10 forks source link

add a way to download created files during the modelling process #7

Closed MHuberFaust closed 6 years ago

MHuberFaust commented 6 years ago

make a zip file downloadable including file for configuration, doc-topic, topic-key, key-weight?, static visualisation?

severinsimmler commented 6 years ago

All produced files will be saved as a ZIP archive in the current working directory by default.

Todo

Do not save the files automatically, but offer a button that triggers the saving.

severinsimmler commented 6 years ago

https://stackoverflow.com/questions/24577349/flask-download-a-file https://stackoverflow.com/questions/30024948/flask-download-a-csv-file-on-clicking-a-button

severinsimmler commented 6 years ago
@app.route('/model/download') 
def download_generated_data():
    return send_file(pathlib.Path(tempdir, 'topicmodeling.zip'),  # dump it to static folder?
                              mimetype='???',  # is there a mimetype for ZIP archives?
                              attachment_filename='topicmodeling.zip',
                              as_attachment=True)
severinsimmler commented 6 years ago

https://stackoverflow.com/questions/42887955/how-to-download-files-using-pyqt5-webenginewidgets

severinsimmler commented 6 years ago

If I merge testing into master, the issue will close. When the download button is pressed, the ZIP archive is automatically saved to the download folder. So it doesn't open a dialog or anything, like in a normal browser. Implementing such a dialog would be an extension for a later release.

Here is an example for a download manager in C++: http://doc.qt.io/qt-5/qtnetwork-downloadmanager-downloadmanager-cpp.html

One could translate that into Python or something. No idea.

severinsimmler commented 6 years ago

https://github.com/pycom/EricShort/tree/master/Helpviewer/Download

thvitt commented 6 years ago

Isn't a call to QFileDialog.getSaveFileName enough?

severinsimmler commented 6 years ago

Great, thank you! Exactly what I was looking for :)