flathub / org.freecadweb.FreeCAD

https://flathub.org/apps/details/org.freecadweb.FreeCAD
14 stars 14 forks source link

Add `flatpak` name to FreeCAD core so it displays in the About dialog if built as flatpak #119

Open luzpaz opened 1 year ago

luzpaz commented 1 year ago

The FreeCAD About dialog currently will list AppImage or Snap but not flatpak:

https://github.com/FreeCAD/FreeCAD/blob/8d1c9c256318cba56e6cdabefad7445fc0badfb0/src/Gui/Splashscreen.cpp#L751-L757

Shall we add it ?

adrianinsaval commented 1 year ago

We can, I assume those are environment variables, what are the expected contents of the variables?

adrianinsaval commented 1 year ago

I'm not sure if it's needed though, since in the os info it shows it's running on flatpak, for example:

OS: KDE Flatpak runtime (KDE/plasma)
Word size of FreeCAD: 64-bit
Version: 0.20.2.29603 (Git)
Build type: Release
Branch: (HEAD detached at 0.20.2)
Hash: 930dd9a76203a3260b1e6256c70c1c3cad8c5cb8
Python 3.10.6, Qt 5.15.8, Coin 4.0.0, Vtk 8.2.0, OCC 7.6.3
Locale: German/Switzerland (de_CH)
Installed mods: 
adrianinsaval commented 1 year ago

we can check for existence of FLATPAK_ID env variable if desired

luzpaz commented 1 year ago
    char *appimage = getenv("APPIMAGE");
    if (appimage)
        str << " AppImage";
    char* snap = getenv("SNAP_REVISION");
    if (snap)
        str << " Snap " << snap;
    str << '\n';

Aside: Any idea why the asterisks sometimes on the char and sometimes on the pointer name ?

char *appimage Vs char* snap

hfiguiere commented 1 year ago

we can check for existence of FLATPAK_ID env variable if desired

it's better to check for the /.flatpak-info file.

easyw commented 1 year ago

in Snap it seems there is an additional info like: Version: 0.20.2.29177 +426 (Git) Snap 517 it would be useful also in FlatPack, to allow WB coders to adapt the code in case of Flat or Snap versions. I don't know if there is any other way to get this info inside FreeCAD python console EDIT: Is there a way to collect and invoke about Info inside FreeCAD python console?

luzpaz commented 1 year ago

EDIT: Is there a way to collect and invoke about Info inside FreeCAD python console?

@easyw see https://forum.freecad.org/viewtopic.php?p=678285&sid=3c0c01d73465a17e9d9c6f3828e00678#p678285

easyw commented 1 year ago

@luzpaz thanks a lot 😄