def test_de(self): de = tools.guess_de() if de: self.add_success('Desktop environment detected as {0}'.format(de), '') else: self.add_warning('Desktop environment couldn\'t be detected.', "Auto power off feature may not work.") self.do_next_test()
def guess_shutdown_cmd(self): de = tools.guess_de() des = { 'xfce' : 'xfce4-session-logout --halt', 'gnome' : 'gnome-session-save --shutdown-dialog', 'ubuntu' : 'gnome-session-quit --power-off', 'mate' : 'mate-session-save --shutdown-dialog', 'kde' : 'qdbus org.kde.ksmserver /KSMServer logout 0 2 2', 'cinnamon': 'cinnamon-session-quit --power-off --no-prompt'} if de and des.has_key(de): return des[de] else: return 'shutdown -h now'
def guess_shutdown_cmd(self): de = tools.guess_de() des = { 'xfce': 'xfce4-session-logout --halt', 'gnome': 'gnome-session-save --shutdown-dialog', 'ubuntu': 'gnome-session-quit --power-off', 'mate': 'mate-session-save --shutdown-dialog', 'kde': 'qdbus org.kde.ksmserver /KSMServer logout 0 2 2', 'cinnamon': 'cinnamon-session-quit --power-off --no-prompt' } if de and des.has_key(de): return des[de] else: return 'shutdown -h now'