def getPresence(self): if not helpers.isInstalled( 'telepathy-mission-control-5' ) or 'mission-control' not in commands.getoutput( 'ps -A | grep mission-control'): return None account_manager = bus.get_object( 'org.freedesktop.Telepathy.AccountManager', '/org/freedesktop/Telepathy/AccountManager') accounts = account_manager.Get( 'org.freedesktop.Telepathy.AccountManager', 'ValidAccounts') for account_path in accounts: if str(account_path ) == '/org/freedesktop/Telepathy/Account/ring/tel/ring': continue account = bus.get_object( 'org.freedesktop.Telepathy.AccountManager', account_path) enabled = account.Get('org.freedesktop.Telepathy.Account', 'Enabled') if not enabled: continue i, s, t = account.Get('org.freedesktop.Telepathy.Account', 'RequestedPresence') return i return None
def setPresence(self, presence): if not helpers.isInstalled( 'telepathy-mission-control-5' ) or 'mission-control' not in commands.getoutput( 'ps -A | grep mission-control'): return account_manager = bus.get_object( 'org.freedesktop.Telepathy.AccountManager', '/org/freedesktop/Telepathy/AccountManager') accounts = account_manager.Get( 'org.freedesktop.Telepathy.AccountManager', 'ValidAccounts') for account_path in accounts: if str(account_path ) == '/org/freedesktop/Telepathy/Account/ring/tel/ring': continue account = bus.get_object( 'org.freedesktop.Telepathy.AccountManager', account_path) #account.Set('org.freedesktop.Telepathy.Account', 'Enabled', dbus.Struct((dbus.Boolean(True)), signature='b'), dbus_interface='org.freedesktop.DBus.Properties') enabled = account.Get('org.freedesktop.Telepathy.Account', 'Enabled') if not enabled: continue presence_text = "" if presence in STATUSLIST: presence_text = STATUSLIST[presence] account.Set('org.freedesktop.Telepathy.Account', 'RequestedPresence', \ dbus.Struct((dbus.UInt32(presence), presence_text, ''), signature='uss'), dbus_interface='org.freedesktop.DBus.Properties')
def getPresence(self) : if not helpers.isInstalled('telepathy-mission-control-5') or 'mission-control' not in commands.getoutput('ps -A | grep mission-control' ): return None account_manager = bus.get_object('org.freedesktop.Telepathy.AccountManager', '/org/freedesktop/Telepathy/AccountManager') accounts = account_manager.Get( 'org.freedesktop.Telepathy.AccountManager', 'ValidAccounts') for account_path in accounts: if str(account_path) == '/org/freedesktop/Telepathy/Account/ring/tel/ring': continue account = bus.get_object('org.freedesktop.Telepathy.AccountManager', account_path) enabled = account.Get('org.freedesktop.Telepathy.Account', 'Enabled') if not enabled: continue i,s,t = account.Get('org.freedesktop.Telepathy.Account', 'RequestedPresence') return i return None
def setPresence(self, presence): if not helpers.isInstalled('telepathy-mission-control-5') or 'mission-control' not in commands.getoutput('ps -A | grep mission-control' ) or not settings.get_use_global_status(): return account_manager = bus.get_object('org.freedesktop.Telepathy.AccountManager', '/org/freedesktop/Telepathy/AccountManager') accounts = account_manager.Get( 'org.freedesktop.Telepathy.AccountManager', 'ValidAccounts') for account_path in accounts: if str(account_path) == '/org/freedesktop/Telepathy/Account/ring/tel/ring': continue account = bus.get_object('org.freedesktop.Telepathy.AccountManager', account_path) enabled = account.Get('org.freedesktop.Telepathy.Account', 'Enabled') if not enabled: continue presence_text = "" if presence in STATUSLIST: presence_text = STATUSLIST[presence] account.Set('org.freedesktop.Telepathy.Account', 'RequestedPresence', \ dbus.Struct((dbus.UInt32(presence), presence_text, ''), signature='uss'), dbus_interface='org.freedesktop.DBus.Properties')
log.addHandler(handler) log = logging.getLogger(__name__) #log.info('set log level to %s (%d)' % (options.loglevel, log.getEffectiveLevel())) if not options.file: parser.print_help() parser.error("Missing topology file") rpath = options.rpath try: if (not options.noupdate) and ( not options.noinstall): # double negative if isInstalled('yum'): call("yum update") elif isInstalled('apt-get'): call("apt-get -y update") else: msg = 'I do not know how to update this system. Platform not supported. Run with --noupdate or on a supported platform (yum or apt-get enabled).' log.critical(msg) sys.exit(msg) # write msg and exit with status 1 verifyPythonDevel() if not options.noinstall: try: installPython('PyYAML', 'yaml', 'install', rpath) except PBuildException:
log.addHandler(handler) rpath = options.rpath if sys.hexversion < 0x020700F0: log.critical("Only works with python 2.7 or greater. Current python version: %s" %(sys.version)) sys.exit("Only works with python 2.7 or greater. Current python version: %s" %(sys.version)) MAX_TRIES = 5 trialItr = 1 while True: try: if (not options.noupdate) and (not options.noinstall): # double negative if isInstalled('yum'): call("yum update") elif isInstalled('apt-get'): call("apt-get -y update") else: msg = 'I do not know how to update this system. Platform not supported. Run with --noupdate or on a supported platform (yum or apt-get enabled).' log.critical(msg) sys.exit(msg) # write msg and exit with status 1 verifyPythonDevel() if not options.noinstall: try: installC('yaml', '/usr/lib/libyaml.so', rpath) import yaml except: