linux - Gtk/python and portability -


how programmers write portable ui code works on multiple distributions? considering desktop distributions , not specialized/embedded distributions. writing ui applications, have assume things available on platform either standard or means of added dependencies. there "minimum" ui/widget standard linux distributions own?

how gnome vs kde distributions come picture when writing code?

i have python script uses gtk , webkit. following imports script uses.

import os import threading gi.repository import webkit  gi.repository import gtk  gi.repository import glib, gobject 

what best source find out on distributions code work?

there not stuff have consider writing cross-distribution ui.
incompatibility issue can remember is:

tray icon or notification area or app indicator (so called in ubuntu)
example standard tray icon (created gtk.statusicon not work in ubuntu's unity default
better use appindicator.indicator if appindicator module found, otherwise use classic statusicon

and if care style/theme of program, may have issues on other environments kde
unless use suitable theme engines act bridge, take at:
https://wiki.archlinux.org/index.php/uniform_look_for_qt_and_gtk_applications

for finding out distribution / os, have written such function:

def getosfulldesc():     name = ''     if os.path.isfile('/etc/lsb-release'):         lines = open('/etc/lsb-release').read().split('\n')         line in lines:             if line.startswith('distrib_description='):                 name = line.split('=')[1]                 if name[0]=='"' , name[-1]=='"':                     return name[1:-1]     if os.path.isfile('/suse/etc/suse-release'):         return open('/suse/etc/suse-release').read().split('\n')[0]     try:         import platform         return ' '.join(platform.dist()).strip().title()         #return platform.platform().replace('-', ' ')     except importerror:         pass     if os.name=='posix':         ostype = os.getenv('ostype')         if ostype!='':             return ostype     ## sys.platform == 'linux2'     return os.name 

Comments