From 0d52620b7a6a0c755258b9728ca7d9b06ad105f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A5=D0=B8=D1=80=D0=B5=D1=86=D0=BA=D0=B8=D0=B9=20=D0=9C?= =?UTF-8?q?=D0=B8=D1=85=D0=B0=D0=B8=D0=BB?= Date: Wed, 28 Dec 2016 14:35:45 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20=D0=B2=D1=8B=D1=85=D0=BE=D0=B4=20=D0=B8=D0=B7=20?= =?UTF-8?q?plasma=20=D0=BF=D1=80=D0=B8=20=D0=BF=D0=BE=D0=BC=D0=BE=D1=89?= =?UTF-8?q?=D0=B8=20cl-desktop-logout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pym/desktop/desktop.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/pym/desktop/desktop.py b/pym/desktop/desktop.py index 1e5669b..c66b5d7 100644 --- a/pym/desktop/desktop.py +++ b/pym/desktop/desktop.py @@ -271,7 +271,7 @@ class Desktop(MethodsInterface): elif session == 'kde': logoutCommand = "/usr/bin/kquitapp ksmserver" elif session == 'plasma': - logoutCommand = "/usr/bin/kquitapp5 ksmserver" + logoutCommand = "/usr/bin/pkill -f ksmserver" elif session == 'gnome': logoutCommand = "/usr/bin/qdbus org.gnome.SessionManager " \ "/org/gnome/SessionManager Logout 1" @@ -282,7 +282,7 @@ class Desktop(MethodsInterface): raise DesktopError(_("Unable to send the logout command")) return True - def waitLogout(self, urLogin, waitTime, postWaitTime=5): + def waitLogout(self, urLogin, waitTime, postWaitTime=20): """ Ожидать завершения пользовательского сеанса @@ -290,6 +290,17 @@ class Desktop(MethodsInterface): urLogin: логин пользователя waitTime: время ожидания завершения сеанса """ + session = self.clVars.Get('cl_desktop_xsession') + if session == "plasma": + uid = self.clVars.Get('ur_uid') + if uid: + uid = int(uid) + for i in range(0, postWaitTime): + if not filter(lambda x: "ksmserver" in x, + getRunCommands(uid=uid)): + break + time.sleep(1) + if filter(lambda x: "xdm/xdm\x00--logout" in x, getRunCommands()): for i in range(0, waitTime): @@ -300,7 +311,7 @@ class Desktop(MethodsInterface): else: raise DesktopError(_("Unable to wait for completion " "of the user logout")) - for wait in range(0, 5): + for wait in range(0, postWaitTime): self.clVars.Invalidate('cl_desktop_online_data') if urLogin not in self.clVars.Get('cl_desktop_online_user'): return True