View Single Post
Posts: 3,328 | Thanked: 4,476 times | Joined on May 2011 @ Poland
#3
Originally Posted by otsaloma View Post
Maybe something in platform? Sailfish below, I don't know what others return.

Code:
$ python3
Python 3.4.3 (default, May 12 2016, 02:20:34) 
[GCC 4.8.3 20140106 (Mer 4.8.3-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.platform()
'Linux-3.4.108.20160401.1-armv7l-with-glibc2.4'
>>> platform.uname()
uname_result(system='Linux', node='Sailfish', release='3.4.108.20160401.1', version='#1 SMP PREEMPT Thu May 12 02:21:45 UTC 2016', machine='armv7l', processor='armv7l')
Checking for the existance of a particular file or directory with os.path.isfile/isdir should be quite simple too if you know what to check -- e.g. /usr/lib/qt5/qml/Sailfish.

And in case you're calling executables like notify-send, you can check if they're available with shutil.which.
node returns the contents of /etc/hostname (uname -n), so it's not reliable.

That's what I thought about, but it's the last resort. I didn't find anything useful in the platform module.

Basically, I use the Python example from here [1] to show the notification on desktop. Since libnotify is unavailable, I guess I'll use a dbus call on Fremantle.
__________________
If you want to support my work, you can donate by PayPal or Flattr

Projects no longer actively developed: here