Thank you, both!
AppImage - Include auto-updating logic in to appimage directly?
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Be nice to others! Read the FreeCAD code of conduct!
Re: AppImage - Include auto-updating logic in to appimage directly?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Re: AppImage - Include auto-updating logic in to appimage directly?
Using AppImageUpdaterBridge as Plugin,
- Building the Qt Plugin: https://antony-jr.github.io/AppImageUpd ... lugin.html
Make sure you follow the plugin rules.
- Example on Using the Plugin with PyQt5(You can easily translate this to PySide): https://antony-jr.github.io/AppImageUpd ... ample.html
- Plugin Interface Documentation: https://antony-jr.github.io/AppImageUpd ... rface.html
Re: AppImage - Include auto-updating logic in to appimage directly?
nice! I will include the package in the next appimage so we can try to update the appimage from within freecad.antonyjr wrote: ↑Sat Mar 28, 2020 8:47 pm Using AppImageUpdaterBridge as Plugin,
- Building the Qt Plugin: https://antony-jr.github.io/AppImageUpd ... lugin.html
Make sure you follow the plugin rules.
- Example on Using the Plugin with PyQt5(You can easily translate this to PySide): https://antony-jr.github.io/AppImageUpd ... ample.html
That's all you need to know to use the plugin with python. You can use v1.1.7 if you want to use the plugin.
- Plugin Interface Documentation: https://antony-jr.github.io/AppImageUpd ... rface.html
Code: Select all
import sys
import os
from PySide.QtCore import QPluginLoader
def handleUpdate(avail, info):
if avail:
print("New Update Available!")
else:
print("You have the latest version!")
def update_appimage():
path = os.path.join(os.environ["PREFIX"],
"lib", "libAppImageUpdaterBridge.so")
loader = QPluginLoader()
loader.setFileName(path)
loader.load()
AppImageUpdaterBridge = loader.instance()
AppImageUpdaterBridge.updateAvailable.connect(handleUpdate)
AppImageUpdaterBridge.setAppImage(os.environ["APPIMAGE"])
AppImageUpdaterBridge.checkForUpdate()
update_appimage()
Re: AppImage - Include auto-updating logic in to appimage directly?
@looo you really don't need the absolute path if you move the plugin to PySide's default plugin directory. Also you don't need to give the AppImage path if you execute from a AppImage since the plugin itself will guess the AppImage path from the environmental variable.
So the code can be reduced as following,
So the code can be reduced as following,
Code: Select all
from PySide.QtCore import QPluginLoader
def handleUpdate(avail, info):
if avail:
print("New Update Available!")
else:
print("You have the latest version!")
def update_appimage():
loader = QPluginLoader()
# Just make sure it is present in PySide's default Plugin directory, if not present do not use the
# internal updater, That's the key to the plugin architecture.
loader.setFileName('libAppImageUpdaterBridge')
if loader.load():
AppImageUpdaterBridge = loader.instance()
AppImageUpdaterBridge.updateAvailable.connect(handleUpdate)
AppImageUpdaterBridge.checkForUpdate()
else:
print("No updater plugin found.")
update_appimage()
Re: AppImage - Include auto-updating logic in to appimage directly?
I am not sure what the default plugin-dirs for the freecad-appimage is. But using the relative path to the plugin-library doesn't work for me. The library itself is installed in the default lib-dir which in my case is:antonyjr wrote: ↑Sun Mar 29, 2020 9:36 am @looo you really don't need the absolute path if you move the plugin to PySide's default plugin directory. Also you don't need to give the AppImage path if you execute from a AppImage since the plugin itself will guess the AppImage path from the environmental variable.
'/tmp/.mount_FreeCAnCUknh/usr/lib/libAppImageUpdaterBridge.so'
Maybe we have to setup the plugin dirs in qt.conf?
https://github.com/FreeCAD/FreeCAD-AppI ... ev/qt.conf
Re: AppImage - Include auto-updating logic in to appimage directly?
No we don't need to touch qt.conf, I think I must instruct cmake to install the plugin into qt's plugin dir when installed. I will look into it.
Re: AppImage - Include auto-updating logic in to appimage directly?
I guess by setting "-D CMAKE_INSTALL_LIBDIR:FILEPATH=$PREFIX/plugins \" the plugin should be installed correctly. But now when trying to update the appimage I don't see any feedback. So I think something does not work correctly.
Re: AppImage - Include auto-updating logic in to appimage directly?
The updater only starts working after you start the Qt's event loop (i.e you have to create the QApplication object) so you can't test this in an interactive python session, This is to ensure safety. This is how the library is non-blocking and single threaded. Sorry for the very late reply. I really don't know how to proceed with this issue. Are we implementing the updater from the menu???
Re: AppImage - Include auto-updating logic in to appimage directly?
I tried to update from the FreeCAD console, so the qtapplication was already started.antonyjr wrote: ↑Thu May 14, 2020 11:30 am The updater only starts working after you start the Qt's event loop (i.e you have to create the QApplication object) so you can't test this in an interactive python session, This is to ensure safety. This is how the library is non-blocking and single threaded.
Re: AppImage - Include auto-updating logic in to appimage directly?
I will try this on my machine.