Add Report Export Functionality#35
Conversation
this will not break existing references to the functions and will ensure that the new behaviour will be off unless explicitly enabled at function call
The new system report generator function will produce 2 strings (1 md & 1 html) which can in the future be connected to a system report export system, two new modules have been added to the import list to enable this function to work (markdown & datetime).
prints the output of the report generator to the terminal when the refresh button is ran, this will be removed when an actual system to export the reports has been implemented
this will prevent a situation where two string literals are being fed into two different functions which would inevitably become an issue if these literals are not updated at the same time, using a single var for both eliminates this risk
oops, my bad
this very minor inconsistancy bugged me abit...
im unsure if its best practice to record the issue in that manner but i would have forgotten otherwise
whenever data has been collected and written to the window a check is done to see if "export_data" is enabled, if so it will add that data to a string which will be exported to a report, at the end of the function - if export_data is enabled - it will then return this string
see motherboard data export commit desc for details
see motherboard data export commit desc for details
see motherboard data export commit desc for details (also the variable "first_part" is created (ln 423) but never displayed in the window, i have included it in the report but if this should not be done for whatever reason please let me know
move the changes from the branch to main to simplify stuff
everything works™, some formatting and performance issues likely still need addressing but the core functionality is all there
such a big global var will use a fair bit of ram, once the file is saved we can free up this space again
|
Hi @Epig-is-a-llama I am very happy to see somebody working on this and am honored this is your first contribution! 😄 I have tested it and I have noticed the following things:
Do this:
If you want to also add export to pdf I would really appreciate. Since Let me know if you need any help!! |
|
Sounds good, the global never broke when testing last night but appears to be throwing errors now, should be an easy fix. I was worried about the buttons taking too much room on the top as well but was just trying to get a functional prototype done last night. What about either an The formatting on the reports is indeed currently very janky, my initial plan was to try and keep it as close to the original programme interface as possible. Your proposed format however both works and looks vastly superior and will also help solve part of the HTML formatting issues. I will implement that now. I will implement the MD to PDF as well, I will also try out Also thanks for inviting me to add myself to the developer's list, I will do that too! |
also remove redundant parsing of the report var to the file_save_dialog function (it can't pass it to file save response anyway)
move the html conversion to the html only function so we don't waste time converting to html for an md export
previously an error was thrown by opening the save file dialog for export and then closing it, this is no longer the case
was uppercase (inconsistent with md export func name)
currently just does the same as the md export but will allow for testing of the md to pdf functionality and button testing
the modules on PyPI have their names `-` separated but as that is invalid py import syntax they must be imported `_` separated, this then means meson fails to find the module as it is apparently only distributed with the `-` separated name
it installs io perfectly fine but refuses to install markdown-it, markdown-pdf or xhtml2pdf? I am going to assume im doing something wrong and have left the code commented out so everything else is still functional
now the reports are *far* more compact, the html is also actually readable now thanks to this!
|
Ok I have done as much as possible right now, the current issues blocking further progress are:
|
A menu button with a document symbolic is good
The app uses flatpak so it needs to build the packages in the manifest Here is the one for "modules" : [
"python3-markdown-it-py.json",
{I had some issues trying to build the other two, but I was able to build
Lets see how it comes out using the library.
You can remove them For the markdown I would try to have a list with dashes and a tab before sublist items like this: otherwise when rendered in markdown there is no newline, all information is on the same line |
many thanks to Nokse22 for the jsons and general pointers Co-Authored-By: Nokse <44558032+Nokse22@users.noreply.github.com>
tested and correctly converts the fed HTML fed into it into an identically formatted pdf
button brings up a drop down box containing the 3 options, currently the keybinds are set to ctrl+ the first letter of the file type, these need to be added to the keyboard shortcut window at some stage
Co-Authored-By: Nokse <44558032+Nokse22@users.noreply.github.com>
|
The current version addresses all concerns found in your previous comment, thank you so much for the help getting it to build the extra modules in. With everything including PDF export working this not only closes #31 but now will also close #33! The two remaining issues I have identified are:
|
|
Nice!
The keyboard shortcuts window is in
I would prefer to add a ToastOverlay with a message like |
|
Adding the keyboard shortcuts was easy, I was however completely unable to get any toasts to show at all after hours of trying. I wasn't getting any errors or anything the code ran and then the code below continued to run but nothing ever showed up? If you could help setup the toast itself so it shows at the end of |
|
Hold on, looking at it I'm getting permission errors from trying to get files to open on my test function, are you sure this is possible from a permissions standpoint? |
|
If you want I can merge this and add it myself no problem. |
Yea that works, thanks for all the help with getting it working, good luck with the toast and releasing etc! |
I will preface this with the fact that I have never contributed to an open source repo before nor do I have any experience with GUI applications. I apologise if any of my code/commit names/commenting is against convention.
Quick Summary:
Adds 2 new buttons to export all data from inspector to either a .md or .html (depending on button clicked), clicking either button will open a save file dialogue.
Details of modifications:
Into each
update_x_pagefunction I have added the following:Falseby default, specifically calledexport_data.markdown_datalocal variable.Furthermore several string literals which were parsed into the window have been moved to variables, this is so the report builder can simply reference those variables rather than having its own set of string literals. This has a very minor ram utilisation penalty for the benefit of preventing situations where the string literal pairs are not updated together and only one gets updated (or translated).
I have added an additional function which when called manages the gathering of all of these datapoints and their formatting, it then returns the MD string in a tuple together with a HTML string (converted by the markdown module).
To control this function I have added 2 new buttons
Export .md&Export .html, these both call the aforementioned report builder function and then call the file saving system which opens a file saving dialogue and saves the report in their respective file types.As a side effect of these buttons I found the default window size slightly too small and so increased the default size, if this is an issue the easiest solution would be to switch the buttons from displaying text to displaying sprites.
Currently everything is working as intended, I have however marked this as a draft because of some formatting issues with the html (and to a far lesser extent the md) which I still want to address.
As a nice bonus this also closes #31 and could perhaps be classified as closing #33 too (if desired I would be more than happy to also create a .pdf export option, the current code would not need very much modification (perhaps using https://pypi.org/project/markdown-pdf/)).