I am running xournal++ in a separate workspace. When I close down the computer I always forget to save the document in xournal++. When I reboot my changes in the document are gone. I have a python shutdown script/program
I would like to add the following to my shutdown program:
1. check if xournal is running
2. save the current document (this is the hard part)
3. close the program
Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
python save document in xournal++
- oswaldkelso
- df -h | grep > 20TiB
- Posts: 1497
- Joined: 2005-07-26 23:20
- Location: UK
- Has thanked: 1 time
- Been thanked: 60 times
Re: python save document in xournal++
enable auto saving.
edit > preferences
edit > preferences
Free Software Matters
Ash init durbatulûk, ash init gimbatul,
Ash init thrakatulûk agh burzum-ishi krimpatul.
My oldest used PC: 1999 imac 333Mhz 256MB PPC abandoned by Debian
Ash init durbatulûk, ash init gimbatul,
Ash init thrakatulûk agh burzum-ishi krimpatul.
My oldest used PC: 1999 imac 333Mhz 256MB PPC abandoned by Debian
Re: python save document in xournal++
auto saving is enabled. But xournal++ uses a different name for the autosaved file.
xournal++ is automatically started at boot with the document notes.xopp
The name of the autosaved document is notes.autosave.xopp
But I want to close xournal++ properly
xournal++ is automatically started at boot with the document notes.xopp
The name of the autosaved document is notes.autosave.xopp
But I want to close xournal++ properly
Re: python save document in xournal++
Instead of starting xournal++ automatically, perhaps make it run a (bash, for example) script automatically which renames (mv notes.autosave.xopp notes.xopp (maybe coupled with an if statement to check that the autosaved file does indeed exist)) the file right before launching xournal++?
Also, maybe running the killall -SIGTERM name_of_process command is what you need to terminate the process gracefully?
I don't use Python, but this should help with running Bash commands in Python.:
https://www.geeksforgeeks.org/how-to-ru ... in-python/
Also, maybe running the killall -SIGTERM name_of_process command is what you need to terminate the process gracefully?
I don't use Python, but this should help with running Bash commands in Python.:
https://www.geeksforgeeks.org/how-to-ru ... in-python/
Use Mnemosyne to Study for School!
Re: python save document in xournal++
This is exactly how I am doing it now. This works.s3a wrote: ↑2022-06-01 09:53 Instead of starting xournal++ automatically, perhaps make it run a (bash, for example) script automatically which renames (mv notes.autosave.xopp notes.xopp (maybe coupled with an if statement to check that the autosaved file does indeed exist)) the file right before launching xournal++?
Code: Select all
#! /bin/bash
#update notes.xopp
if test -f "/home/peer/Documenten/xournal/.notes.autosave.xopp"; then
mv "/home/peer/Documenten/xournal/.notes.autosave.xopp" "/home/peer/Documenten/xournal/notes.xopp"
fi
#start devilspie2 and xournal++
/usr/bin/devilspie2 &
/usr/bin/xournalpp /home/peer/Documenten/xournal/notes.xopp &
- canci
- Global Moderator
- Posts: 2502
- Joined: 2006-09-24 11:28
- Has thanked: 136 times
- Been thanked: 136 times
Re: python save document in xournal++
Learn Python and tell us.
Seruouse, what do you expect people to do? Write Python scripts for you or give you 10 lessons worth of python programming in 1 forum post?
The entitlement here is staggering.
Seruouse, what do you expect people to do? Write Python scripts for you or give you 10 lessons worth of python programming in 1 forum post?
The entitlement here is staggering.
Stable / Asus VivoBook X421DA / AMD Ryzen 7 3700U / Radeon Vega Mobile Gfx (Picasso) / 8 GB RAM / 512GB NVMe
READ THIS:
* How to Post a Thread Here
* Other Tips and Great Resources
READ THIS:
* How to Post a Thread Here
* Other Tips and Great Resources
Re: python save document in xournal++
I don't think I can help you do things in a "perfect" way without doing a lot of reading myself, but as a "good enough" solution, if you run the Bash commands through Python then you can use the Xournal++ app's autosave functionality (which you're already using) along with the if and mv to handle the autosave functionality (indirectly, by running the Bash script through Python as shown in this link https://www.geeksforgeeks.org/how-to-ru ... in-python/ ).But my question remains. I have xournal++ running with the document notes.xopp. How can I save the document and close xournal++ in a python program
Then using the teachings of that link ( https://www.geeksforgeeks.org/how-to-ru ... in-python/ ) again, you can run the killall -SIGTERM xournalpp command via Python too (which should make the OS tell Xournal++ to close itself gracefully / properly).
(Notice how I said killall -SIGTERM and not killall -SIGKILL, so it wouldn't be "pulling the rug from under the app"; i'd be telling the app to close itself properly.)
Use Mnemosyne to Study for School!
Re: python save document in xournal++
@canci:
Sorry but I did not like your comment. I think you misunderstood my question.
I am not a programmer but I did create working gui programs in java and python. I also make easy scripts in bash.
@s3a:
Thanks for you reaction. I tried killall -SIGTERM. It closes the program but it did not save or ask for saving the document. The autosave file still exists. Normally the autosave file is deleted when the document is saved.
The solution that you suggested with the startup script (which I also found) is a good working solution. So I will stick to that.
Sorry but I did not like your comment. I think you misunderstood my question.
I am not a programmer but I did create working gui programs in java and python. I also make easy scripts in bash.
@s3a:
Thanks for you reaction. I tried killall -SIGTERM. It closes the program but it did not save or ask for saving the document. The autosave file still exists. Normally the autosave file is deleted when the document is saved.
The solution that you suggested with the startup script (which I also found) is a good working solution. So I will stick to that.