master
Самоукин Алексей 14 years ago
commit 7e2465c56f

@ -0,0 +1,5 @@
# Calculate format=xml_gconf
<?xml version="1.0"?>
<gconf>
<entry name="display-no-pass-info" type="bool" value="false"/>
</gconf>

@ -2,6 +2,6 @@
<?xml version="1.0"?>
<gconf>
<entry name="command" type="string">
<stringvalue>firefox %s</stringvalue>
<stringvalue>/usr/lib/mozilla-firefox/firefox &quot;%s&quot;</stringvalue>
</entry>
</gconf>

@ -0,0 +1,9 @@
# Calculate format=xml_gconf
<?xml version="1.0"?>
<gconf>
<entry name="needs_terminal" type="bool" value="false"/>
<entry name="enabled" type="bool" value="true"/>
<entry name="command" type="string">
<stringvalue>/usr/lib/mozilla-firefox/firefox &quot;%s&quot;</stringvalue>
</entry>
</gconf>

@ -0,0 +1,9 @@
# Calculate format=xml_gconf
<?xml version="1.0"?>
<gconf>
<entry name="needs_terminal" type="bool" value="false"/>
<entry name="enabled" type="bool" value="true"/>
<entry name="command" type="string">
<stringvalue>/usr/lib/mozilla-firefox/firefox &quot;%s&quot;</stringvalue>
</entry>
</gconf>

@ -2,6 +2,6 @@
<?xml version="1.0"?>
<gconf>
<entry name="command" type="string">
<stringvalue>firefox %s</stringvalue>
<stringvalue>/usr/lib/mozilla-firefox/firefox &quot;%s&quot;</stringvalue>
</entry>
</gconf>

@ -2,6 +2,6 @@
<?xml version="1.0"?>
<gconf>
<entry name="command" type="string">
<stringvalue>firefox %s</stringvalue>
<stringvalue>/usr/lib/mozilla-firefox/firefox &quot;%s&quot;</stringvalue>
</entry>
</gconf>

@ -2,6 +2,6 @@
<?xml version="1.0"?>
<gconf>
<entry name="command" type="string">
<stringvalue>firefox %s</stringvalue>
<stringvalue>/usr/lib/mozilla-firefox/firefox &quot;%s&quot;</stringvalue>
</entry>
</gconf>

@ -6,7 +6,7 @@ Type=Application
Name=Terminal window as root
Name[ru]=Терминал суперпользователя
Categories=Application;
Exec=gksudo Terminal
Exec=gksudo gnome-terminal
Icon=konsole
Terminal=false
StartupNotify=false

@ -1,3 +0,0 @@
#Calculate os_root_type==livecd
alias su="sudo su -"

@ -0,0 +1,39 @@
#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import gtk
import os
import sys
import re
import subprocess
if __name__ == "__main__":
if gtk.gdk.get_display():
window = gtk.Window(gtk.WINDOW_TOPLEVEL)
# Here we connect the "destroy" event to a signal handler
window.connect("destroy", lambda w: gtk.main_quit())
pipe = subprocess.Popen(["xdpyinfo"],
stdout=subprocess.PIPE, env=os.environ)
reRes = re.compile("dimensions:\s+(\d+)x(\d+)\s+pixels")
cx, cy = 1024, 768
if pipe.wait() == 0:
for line in pipe.stdout:
searchRes = reRes.search(line)
if searchRes:
cx, cy = int(searchRes.group(1)), int(searchRes.group(2))
break
pipe.stdout.close()
window.set_size_request(cx,cy)
window.maximize()
window.set_border_width(0)
window.modify_bg(gtk.STATE_NORMAL,
gtk.gdk.rgb_get_colormap().alloc_color('#5F7583'))
window.show()
pid = os.fork()
if not pid:
gtk.main()
sys.exit(0)

@ -3,6 +3,12 @@
# set background color
xsetroot -solid rgb:5F/75/83
if [[ -n $(env | grep RUNNING_UNDER_GDM=true) ]]
then
python /usr/share/calculate/xdm/gtkbg
BG_PID=$(ps ax | sed -nr "s/^\s*([0-9]+)\s.*gtkbg$/\1/p")
fi
xmes() {
xmessage -buttons OK:0 -default OK "`echo \"$1:
$2\" | iconv -f utf8 -t koi8-r - `"
@ -47,6 +53,7 @@ then
then
echo "$ERRORLOG" >> $FILE_LOG
xmes cl-sync "$ERRORLOG"
[[ -n $BG_PID ]] && kill $BG_PID
exit 1
fi
fi
@ -65,6 +72,7 @@ then
xmes cl-sync "$ERRORLOG2"
fi
xmes cl-createhome "$ERRORLOG"
[[ -n $BG_PID ]] && kill $BG_PID
exit 1
fi
fi
@ -72,4 +80,5 @@ fi
#очистим кэш
/bin/rm -rf /var/tmp/kdecache-$USER
[[ -n $BG_PID ]] && kill $BG_PID
exit 0

@ -34,6 +34,7 @@ import subprocess
import time
from encrypt import encrypt
from signal import SIGTERM
Version = "calculate-client 2.1.11"
@ -46,7 +47,90 @@ class printNoColor:
def colorPrint(self,attr,fg,bg,string):
sys.stdout.write(string)
class ProgressBar:
class NoneProgressBar:
def __init__(self,title,dialog=None):
pass
def openDialog(self,title,max=None):
pass
def shutdownDialog(self):
pass
def setValue(self,value):
pass
def setMaximum(self,max):
pass
def setTitle(self,title):
pass
def close(self):
pass
class GProgressBar(NoneProgressBar):
def __init__(self,title,xdialog=None):
self.title = title
self.bgPID = 0
self.value = 0
self.pipein = None
if xdialog == None:
self.openDialog(self.title)
def openDialog(self,title,max=None):
if max != None:
self.setMaximum(max)
self.title = title
if os.system('which Xdialog &>/dev/null') == 0:
pipe = subprocess.Popen('/usr/bin/Xdialog --progress "%s" 5 80'\
%(self.title),
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
close_fds=True,
env=os.environ, shell=True)
self.pipein = pipe.stdin
self._set(1)
pipe.stdout.close()
pipe.stderr.close()
def shutdownDialog(self):
'''Принудительно уничтожить процесс dialog'''
if self.pipein:
self._set(100)
time.sleep(0.1)
self.pipein.close()
self.pipein = None
def _set(self,value):
if self.pipein:
self.pipein.write("%02d\n"%value)
self.pipein.flush()
def setValue(self,value):
'''Установить текущее значения для прогресса'''
if self.pipein and value <= self.max:
progress_value = int(value / self.kmax)
if progress_value > int(self.value / self.kmax) and progress_value < 100:
self._set(progress_value)
self.value = value
def setMaximum(self,max):
'''Установить максимальное значения для прогресса'''
self.max = max
self.kmax = max / 100.0
def setTitle(self,title):
'''Установить описания прогресса'''
pass
def close(self):
'''Закрыть прогресс'''
self.shutdownDialog()
class KProgressBar(NoneProgressBar):
suffixSet = 'org.freedesktop.DBus.Properties.Set \
org.kde.kdialog.ProgressDialog'
execenv = {"HOME":"/root"}
@ -55,6 +139,7 @@ org.kde.kdialog.ProgressDialog'
label = None
def __init__(self,title,kdialog=None):
self.title = title
self.value = 0
if kdialog is None:
self.openDialog(self.title)
@ -123,19 +208,25 @@ org.kde.kdialog.ProgressDialog'
if self.execenv:
env = " ".join(map(lambda x: '%s="%s"'%(x[0],x[1]),\
self.execenv)) + " "
os.system(env + '/usr/bin/qdbus %s %s value %d >/dev/null'\
%(self.kdialog,self.suffixSet, value))
oldperc = int(self.value / self.kmax)
newperc = int(value / self.kmax)
if newperc > oldperc:
os.system(env + '/usr/bin/qdbus %s %s value %d >/dev/null'\
%(self.kdialog,self.suffixSet, newperc))
self.value = value
def setMaximum(self,max):
'''Установить максимальное значения для прогресса'''
self.max = max
if self.kdialog:
if self.kdialog and self.max == 0 and max != 0:
env = ""
if self.execenv:
env = " ".join(map(lambda x: '%s="%s"'%(x[0],x[1]),\
self.execenv)) + " "
os.system(env + '/usr/bin/qdbus %s %s maximum %d >/dev/null'\
%(self.kdialog,self.suffixSet, self.max))
%(self.kdialog,self.suffixSet, 100))
self.max = max
self.kmax = max / 100.0
def setTitle(self,title):
'''Установить описания прогресса'''
@ -152,6 +243,13 @@ org.kde.kdialog.ProgressDialog'
'''Закрыть прогресс'''
self.shutdownDialog()
def ProgressBar(*args,**kwarg):
if os.system('which kdialog &>/dev/null') == 0:
return KProgressBar(*args,**kwarg)
elif os.system('which Xdialog &>/dev/null') == 0:
return GProgressBar(*args,**kwarg)
return NoneProgressBar(*args,**kwarg)
class ProgressProfile(cl_profile.profile):
def __init__(self, vars):
cl_profile.profile.__init__(self,vars)
@ -165,7 +263,7 @@ class ProgressProfile(cl_profile.profile):
self.progress.setValue(number)
return True
class RsyncProgressBar(ProgressBar):
class RsyncProgressBar:
'''Объект запуска rsync для получения количества созданных файлов и
при необходимости вывода progressbar
'''
@ -183,6 +281,8 @@ class RsyncProgressBar(ProgressBar):
self.secondtitle = secondtitle
self.maximum = maximum
self.rsyncstr = rsyncstr
self.progress = ProgressBar(title,1)
self.progress.setMaximum(self.maximum)
def getFilesNum(self):
'''Получить количество файлов созданных генератором'''
@ -210,7 +310,7 @@ class RsyncProgressBar(ProgressBar):
def run(self):
'''Запустить rsync с progressbar'''
self.openDialog(self.title,0)
self.progress.openDialog(self.title,0)
self.pipe = subprocess.Popen(self.rsyncstr, stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
@ -229,15 +329,15 @@ class RsyncProgressBar(ProgressBar):
q = self.receiverre.search(s)
if q:
if not self.copyStarting:
self.shutdownDialog()
self.max = 100
self.openDialog(self.secondtitle)
self.progress.shutdownDialog()
self.progress.openDialog(self.secondtitle)
self.progress.setMaximum(self.maximum)
self.copyStarting = True
self.value = int(q.groups()[0])
newpercent = self.value * 100 / self.maximum
if oldpercent < newpercent:
oldpercent = newpercent
self.setValue(oldpercent)
value = int(q.groups()[0])
self.progress.setValue(value)
def close(self):
self.progress.close()
# Импортированные классы в cl_ldap
# Запись ошибок

@ -110,6 +110,7 @@ data_files += create_data_files (data_dirs_share, share_calculate_dir)
data_files += [('/etc/init.d', ['data/client'])]
data_files += [('/usr/share/calculate/xdm', ['data/login',
'data/logout',
'data/gtkbg',
'data/cmd_login'])]
class cl_install_data(install_data):
def run (self):
@ -117,6 +118,7 @@ class cl_install_data(install_data):
data_file = [("/etc/init.d/client",0755),
("/usr/share/calculate/xdm/login",0755),
("/usr/share/calculate/xdm/logout",0755),
("/usr/share/calculate/xdm/gtkbg",0755),
("/usr/share/calculate/xdm/cmd_login",0755)]
fileNames = map(lambda x: os.path.split(x[0])[1], data_file)
listNames = map(lambda x: filter(lambda y: y, x[0].split("/")),data_file)

Loading…
Cancel
Save