parent
cc47f62358
commit
6e1ca58e20
@ -0,0 +1,34 @@
|
||||
# Copyright 1999-2012 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: $
|
||||
|
||||
EAPI="3"
|
||||
|
||||
SUPPORT_PYTHON_ABIS="1"
|
||||
PYTHON_DEPEND="2:2.7"
|
||||
RESTRICT_PYTHON_ABIS="2.4 2.5 2.6 3.*"
|
||||
|
||||
inherit distutils eutils
|
||||
|
||||
SRC_URI="ftp://ftp.calculate.ru/pub/calculate/calculate3/${PN}/${P}.tar.bz2"
|
||||
|
||||
DESCRIPTION="The program of the desktop configuration Calculate Linux"
|
||||
HOMEPAGE="http://www.calculate-linux.org/main/en/calculate2"
|
||||
LICENSE="Apache-2.0"
|
||||
SLOT="3"
|
||||
KEYWORDS="amd64 x86"
|
||||
IUSE=""
|
||||
|
||||
DEPEND="~sys-apps/calculate-core-3.1.5
|
||||
>=dev-python/python-ldap-2.0[ssl]
|
||||
media-gfx/feh
|
||||
x11-apps/xmessage
|
||||
!<sys-apps/calculate-desktop-3.1.0_alpha1"
|
||||
RDEPEND="${DEPEND}"
|
||||
src_unpack() {
|
||||
unpack "${A}"
|
||||
cd "${S}"
|
||||
|
||||
# apply revision changes
|
||||
epatch "${FILESDIR}/calculate-desktop-3.1.5-r4.patch"
|
||||
}
|
@ -0,0 +1,197 @@
|
||||
diff --git desktop/cl_desktop.py desktop/cl_desktop.py
|
||||
index 9cfa6ef..c417f5e 100644
|
||||
--- desktop/cl_desktop.py
|
||||
+++ desktop/cl_desktop.py
|
||||
@@ -25,7 +25,8 @@ import traceback
|
||||
from datavars import DataVarsDesktop, DataVars, __version__,__app__
|
||||
|
||||
from calculate.lib.cl_template import Template, ProgressTemplate,TemplatesError
|
||||
-from calculate.lib.utils.files import runOsCommand, isMount
|
||||
+from calculate.lib.utils.files import runOsCommand, isMount,process, \
|
||||
+ getRunCommands
|
||||
from calculate.lib.utils.common import getpathenv,appendProgramToEnvFile, \
|
||||
removeProgramToEnvFile
|
||||
from calculate.core.server.func import safetyWrapper
|
||||
@@ -33,6 +34,7 @@ from calculate.core.server.func import safetyWrapper
|
||||
from calculate.lib.cl_lang import setLocalTranslate,getLazyLocalTranslate
|
||||
setLocalTranslate('cl_desktop3',sys.modules[__name__])
|
||||
__ = getLazyLocalTranslate(_)
|
||||
+from itertools import ifilter
|
||||
|
||||
class DesktopError(Exception):
|
||||
"""Desktop Error"""
|
||||
@@ -237,3 +239,54 @@ class Desktop:
|
||||
return False
|
||||
return True
|
||||
|
||||
+ @safetyWrapper(native_errors=(TemplatesError,DesktopError),
|
||||
+ man_int=__("Logout manually interrupted"),
|
||||
+ post_action=umountUserRes,
|
||||
+ success_message=__("The user logged out from the session!"),
|
||||
+ failed_message=__("Unable to logout the user"))
|
||||
+ def userLogout(self, datavars=None):
|
||||
+ """
|
||||
+ Raise user logout throught dbus
|
||||
+ """
|
||||
+ self.initVars(datavars)
|
||||
+ if not self.clVars.Get('ur_login') in \
|
||||
+ self.clVars.Get('cl_desktop_online_user'):
|
||||
+ raise DesktopError(_("X session users not found"))
|
||||
+ urLogin = self.clVars.Get('ur_login')
|
||||
+ display = self.clVars.Select('cl_desktop_online_display',
|
||||
+ where='cl_desktop_online_user',eq=urLogin,limit=1)
|
||||
+ session = self.clVars.Get('cl_desktop_xsession')
|
||||
+ if session == 'xfce':
|
||||
+ logoutCommand = "org.xfce.SessionManager " \
|
||||
+ "/org/xfce/SessionManager Logout False False"
|
||||
+ elif session == 'kde':
|
||||
+ logoutCommand = "org.kde.ksmserver /KSMServer logout 0 0 0"
|
||||
+ elif session == 'gnome':
|
||||
+ logoutCommand = "org.gnome.SessionManager " \
|
||||
+ "/org/gnome/SessionManager Logout 1"
|
||||
+ else:
|
||||
+ raise DesktopError(_("Unable detect X session"))
|
||||
+ if process("su",urLogin,"-c",
|
||||
+ ("DISPLAY=:%s /usr/bin/qdbus "%display)+logoutCommand).failed():
|
||||
+ raise DesktopError(_("Unable send logout command"))
|
||||
+ for i in range(0,20):
|
||||
+ if filter(lambda x: "xdm/xdm\x00--logout" in x,
|
||||
+ getRunCommands()):
|
||||
+ break
|
||||
+ time.sleep(0.5)
|
||||
+ if filter(lambda x: "xdm/xdm\x00--logout" in x,
|
||||
+ getRunCommands()):
|
||||
+ self.startTask(_("Waiting for completion of the user logout"))
|
||||
+ for i in range(0,300):
|
||||
+ if not filter(lambda x: "xdm/xdm\x00--logout" in x,
|
||||
+ getRunCommands()):
|
||||
+ return True
|
||||
+ time.sleep(1)
|
||||
+ self.endTask()
|
||||
+ else:
|
||||
+ raise DesktopError(_("Unable to wait for completion "
|
||||
+ "of the user logout"))
|
||||
+ if self.clVars.Get('ur_login') in \
|
||||
+ self.clVars.Get('cl_desktop_online_user'):
|
||||
+ raise DesktopError(_("Wrong logout"))
|
||||
+ return True
|
||||
diff --git desktop/cl_wsdl_desktop.py desktop/cl_wsdl_desktop.py
|
||||
index e65b02f..2e5f09d 100644
|
||||
--- desktop/cl_wsdl_desktop.py
|
||||
+++ desktop/cl_wsdl_desktop.py
|
||||
@@ -79,3 +79,34 @@ class Wsdl:
|
||||
view = ViewInfo(dv,viewparams=params)
|
||||
self.set_cache(sid, 'desktop', "vars",dv,smart=False)
|
||||
return view
|
||||
+
|
||||
+ @rpc(Integer, DesktopInfo, _returns = Array(ReturnedMessage))
|
||||
+ @core_method(category=__('Desktop'),title=__('Logout user'),
|
||||
+ image='system-log-out',
|
||||
+ gui=True,command='cl-desktop-logout',
|
||||
+ rights=['userconfigure'])
|
||||
+ def desktop_logout(self, sid, info):
|
||||
+ return self.callMethod(sid,info,method_name="desktop_logout",
|
||||
+ logicClass=Desktop,
|
||||
+ method="userLogout")
|
||||
+
|
||||
+ def desktop_logout_vars(self,dv=None):
|
||||
+ if not dv:
|
||||
+ dv = DataVarsDesktop()
|
||||
+ dv.importDesktop()
|
||||
+ dv.flIniFile()
|
||||
+ dv.addGroup(None,
|
||||
+ normal=('ur_login',),
|
||||
+ next_label=_("Logout"),)
|
||||
+ return dv
|
||||
+
|
||||
+ @rpc(Integer, ViewParams,_returns = ViewInfo)
|
||||
+ def desktop_logout_view (self, sid, params):
|
||||
+ dv = self.get_cache(sid,"desktop_logout","vars")
|
||||
+ if not dv:
|
||||
+ dv = self.desktop_logout_vars()
|
||||
+ else:
|
||||
+ dv.processRefresh()
|
||||
+ view = ViewInfo(dv,viewparams=params)
|
||||
+ self.set_cache(sid, 'desktop_logout', "vars",dv,smart=False)
|
||||
+ return view
|
||||
diff --git desktop/variables/desktop.py desktop/variables/desktop.py
|
||||
index 3a92ccb..34b2e4b 100644
|
||||
--- desktop/variables/desktop.py
|
||||
+++ desktop/variables/desktop.py
|
||||
@@ -1,8 +1,11 @@
|
||||
import os
|
||||
import sys
|
||||
+import re
|
||||
from os import path
|
||||
-from calculate.lib.datavars import Variable,VariableError,ReadonlyVariable
|
||||
-from calculate.lib.utils.files import readLinesFile
|
||||
+from calculate.lib.datavars import Variable,VariableError,ReadonlyVariable, \
|
||||
+ ReadonlyTableVariable,FieldValue
|
||||
+from calculate.lib.utils.files import readLinesFile,process
|
||||
+from itertools import *
|
||||
|
||||
from calculate.lib.cl_lang import setLocalTranslate
|
||||
setLocalTranslate('cl_desktop3',sys.modules[__name__])
|
||||
@@ -151,3 +154,62 @@ class VariableClDesktopXfceMixer(ReadonlyVariable):
|
||||
return "\n".join(
|
||||
map(lambda x:' <value type="string" value="%s" />'%x,
|
||||
self.Get('cl_desktop_gst_data').get('channels',[])))
|
||||
+
|
||||
+class VariableClDesktopOnlineData(ReadonlyTableVariable):
|
||||
+ """
|
||||
+ Information about online users
|
||||
+ """
|
||||
+ source = ['cl_desktop_online_user',
|
||||
+ 'cl_desktop_online_display']
|
||||
+
|
||||
+ reDisplay = re.compile(r"^\(?:(\d+\.?\d*)")
|
||||
+
|
||||
+ def _getDisplay(self,*args):
|
||||
+ """
|
||||
+ Get DISPLAY from args
|
||||
+ """
|
||||
+ for arg in map(self.reDisplay.search,args):
|
||||
+ if arg:
|
||||
+ return arg.group(1)
|
||||
+ return ""
|
||||
+
|
||||
+ def get(self,hr=False):
|
||||
+ xSession = 0
|
||||
+ foundTwoSession = False
|
||||
+ resWho = process("who")
|
||||
+ xData = [[]]
|
||||
+ if resWho.success():
|
||||
+ listProcessing = lambda x: (x[0], x[1], x[-1]) \
|
||||
+ if len(x)>=5 else []
|
||||
+ xData = map(lambda x:x[1].next(),
|
||||
+ groupby(
|
||||
+ sorted(
|
||||
+ filter(lambda x: x[0]!="root",
|
||||
+ map(lambda x: (x[0],self._getDisplay(x[1],x[2])),
|
||||
+ filter(lambda x: x and\
|
||||
+ (x[2].startswith("(:") or \
|
||||
+ x[1].startswith(":")),
|
||||
+ map(lambda x: listProcessing(\
|
||||
+ filter(lambda y: y, x.split())),
|
||||
+ resWho)))),
|
||||
+ key=lambda x:x[0]),
|
||||
+ lambda x:x[0]))
|
||||
+ return xData
|
||||
+
|
||||
+ setValue = Variable.setValue
|
||||
+
|
||||
+class VariableClDesktopOnlineUser(FieldValue,ReadonlyVariable):
|
||||
+ """
|
||||
+ User name
|
||||
+ """
|
||||
+ type = "list"
|
||||
+ source_variable = "cl_desktop_online_data"
|
||||
+ column = 0
|
||||
+
|
||||
+class VariableClDesktopOnlineDisplay(FieldValue,ReadonlyVariable):
|
||||
+ """
|
||||
+ Display for user
|
||||
+ """
|
||||
+ type = "list"
|
||||
+ source_variable = "cl_desktop_online_data"
|
||||
+ column = 1
|
@ -0,0 +1,26 @@
|
||||
# Copyright 1999-2011 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: $
|
||||
|
||||
EAPI=4
|
||||
|
||||
DESCRIPTION="Calculate Utilities meta package"
|
||||
HOMEPAGE="http://www.calculate-linux.org/main/en/calculate2"
|
||||
SRC_URI=""
|
||||
|
||||
LICENSE="Apache-2.0"
|
||||
SLOT="3"
|
||||
KEYWORDS="amd64 x86"
|
||||
IUSE="cl_consolegui cl_client cl_desktop cl_console"
|
||||
|
||||
RDEPEND="${RDEPEND}
|
||||
=sys-apps/calculate-install-3.1.5-r5
|
||||
=sys-apps/calculate-i18n-3.1.5-r1
|
||||
=sys-apps/calculate-lib-3.1.5-r1
|
||||
=sys-apps/calculate-core-3.1.5-r1
|
||||
=sys-apps/calculate-update-3.1.5
|
||||
cl_client? ( =sys-apps/calculate-client-3.1.5-r1 )
|
||||
cl_desktop? ( =sys-apps/calculate-desktop-3.1.5-r4 )
|
||||
cl_consolegui? ( =sys-apps/calculate-console-gui-3.1.5 )
|
||||
cl_console? ( =sys-apps/calculate-console-3.1.5 )
|
||||
"
|
Loading…
Reference in new issue