|
|
|
@ -23,6 +23,7 @@ import cl_overriding
|
|
|
|
|
|
|
|
|
|
from cl_ldap import ldapUser
|
|
|
|
|
from cl_datavars import glob_attr
|
|
|
|
|
from os.path import exists as pathexists
|
|
|
|
|
|
|
|
|
|
class clLocale:
|
|
|
|
|
lang = {
|
|
|
|
@ -35,6 +36,15 @@ class clLocale:
|
|
|
|
|
'xkblayout':'us,by',
|
|
|
|
|
'language':'ru',
|
|
|
|
|
},
|
|
|
|
|
#Bulgarian
|
|
|
|
|
'bg_BG' : {
|
|
|
|
|
'locale':'bg_BG.UTF-8',
|
|
|
|
|
'keymap':'bg_bds-utf8',
|
|
|
|
|
'dumpkeys_charset': '',
|
|
|
|
|
'consolefont':'ter-m14n',
|
|
|
|
|
'xkblayout':'us,bg',
|
|
|
|
|
'language':'bg',
|
|
|
|
|
},
|
|
|
|
|
#Belgian
|
|
|
|
|
'fr_BE' : {
|
|
|
|
|
'locale':'fr_BE.UTF-8',
|
|
|
|
@ -265,8 +275,24 @@ class fillVars(glob_attr):
|
|
|
|
|
else:
|
|
|
|
|
return domain
|
|
|
|
|
|
|
|
|
|
dictLinuxName = {"CLD":"Calculate Linux Desktop",
|
|
|
|
|
"CLDX":"Calculate Linux Desktop",
|
|
|
|
|
"CLDG":"Calculate Linux Desktop",
|
|
|
|
|
"CDS":"Calculate Directory Server",
|
|
|
|
|
"CLS":"Calculate Linx Scratch",
|
|
|
|
|
"CSS":"Calculate Scratch Server",
|
|
|
|
|
"Gentoo":"Gentoo"}
|
|
|
|
|
|
|
|
|
|
def get_os_linux_shortname(self):
|
|
|
|
|
'''Получить переменную короткого названия системы'''
|
|
|
|
|
makeprofile = '/etc/make.profile'
|
|
|
|
|
if os.path.exists(makeprofile):
|
|
|
|
|
link = os.readlink(makeprofile)
|
|
|
|
|
reMakeProfileLink = re.compile('calculate/(desktop|server)/(%s)'%
|
|
|
|
|
"|".join(self.dictLinuxName.keys()),re.S)
|
|
|
|
|
shortnameSearch = reMakeProfileLink.search(link)
|
|
|
|
|
if shortnameSearch:
|
|
|
|
|
return shortnameSearch.groups()[1]
|
|
|
|
|
path = '/etc/calculate/calculate.ini'
|
|
|
|
|
if os.path.exists(path):
|
|
|
|
|
FD = open(path)
|
|
|
|
@ -289,15 +315,8 @@ class fillVars(glob_attr):
|
|
|
|
|
"""полное название системы"""
|
|
|
|
|
linuxShortName = self.Get("os_linux_shortname")
|
|
|
|
|
if linuxShortName:
|
|
|
|
|
dictLinuxName = {"CLD":"Calculate Linux Desktop",
|
|
|
|
|
"CLDX":"Calculate Linux Desktop",
|
|
|
|
|
"CLDG":"Calculate Linux Desktop",
|
|
|
|
|
"CDS":"Calculate Directory Server",
|
|
|
|
|
"CLS":"Calculate Linx Scratch",
|
|
|
|
|
"CSS":"Calculate Scratch Server",
|
|
|
|
|
"Gentoo":"Gentoo"}
|
|
|
|
|
if linuxShortName in dictLinuxName.keys():
|
|
|
|
|
return dictLinuxName[linuxShortName]
|
|
|
|
|
if linuxShortName in self.dictLinuxName.keys():
|
|
|
|
|
return self.dictLinuxName[linuxShortName]
|
|
|
|
|
else:
|
|
|
|
|
return "Linux"
|
|
|
|
|
else:
|
|
|
|
@ -316,32 +335,51 @@ class fillVars(glob_attr):
|
|
|
|
|
return ""
|
|
|
|
|
|
|
|
|
|
def get_os_linux_ver(self):
|
|
|
|
|
'''Получить версию системы'''
|
|
|
|
|
path = '/etc/calculate/calculate.ini'
|
|
|
|
|
if os.path.exists(path):
|
|
|
|
|
FD = open(path)
|
|
|
|
|
data = FD.readlines()
|
|
|
|
|
FD.close()
|
|
|
|
|
shortNameList = filter(lambda y:y,
|
|
|
|
|
map(lambda x:\
|
|
|
|
|
len(x.split("="))==2 and\
|
|
|
|
|
x.split("=")[0]=="linuxver" and\
|
|
|
|
|
x.split("=")[1].strip(), data))
|
|
|
|
|
if shortNameList:
|
|
|
|
|
return shortNameList[0]
|
|
|
|
|
gentooFile = "/etc/gentoo-release"
|
|
|
|
|
systemVersion = ""
|
|
|
|
|
flagGentoo = False
|
|
|
|
|
if os.path.exists(gentooFile):
|
|
|
|
|
gentooLink = "/etc/make.profile"
|
|
|
|
|
if os.path.islink(gentooLink):
|
|
|
|
|
systemVersion = os.readlink(gentooLink).rpartition("/")[2]
|
|
|
|
|
flagGentoo = True
|
|
|
|
|
if not flagGentoo:
|
|
|
|
|
'''Get system version'''
|
|
|
|
|
def get_from_metapackage():
|
|
|
|
|
"""Get version from meta package"""
|
|
|
|
|
shortname = self.Get('os_linux_shortname')
|
|
|
|
|
metaPkgs = filter(lambda x:"%s-meta"%shortname.lower() in x,
|
|
|
|
|
os.listdir('/var/db/pkg/app-misc/'))
|
|
|
|
|
if metaPkgs:
|
|
|
|
|
reFindVer = re.compile("(?<=\-)\d+\.?\d*\.?\d*")
|
|
|
|
|
findVer = reFindVer.search(metaPkgs[0])
|
|
|
|
|
if findVer:
|
|
|
|
|
return findVer.group()
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
def get_from_calculate_ini():
|
|
|
|
|
"""Get version from calculate ini"""
|
|
|
|
|
path = '/etc/calculate/calculate.ini'
|
|
|
|
|
if os.path.exists(path):
|
|
|
|
|
FD = open(path)
|
|
|
|
|
data = FD.readlines()
|
|
|
|
|
FD.close()
|
|
|
|
|
shortNameList = filter(lambda y:y,
|
|
|
|
|
map(lambda x:\
|
|
|
|
|
len(x.split("="))==2 and\
|
|
|
|
|
x.split("=")[0]=="linuxver" and\
|
|
|
|
|
x.split("=")[1].strip(), data))
|
|
|
|
|
if shortNameList:
|
|
|
|
|
return shortNameList[0]
|
|
|
|
|
|
|
|
|
|
def get_from_gentoo_files():
|
|
|
|
|
"""Get version from gentoo files"""
|
|
|
|
|
gentooFile = "/etc/gentoo-release"
|
|
|
|
|
systemVersion = ""
|
|
|
|
|
flagGentoo = False
|
|
|
|
|
if os.path.exists(gentooFile):
|
|
|
|
|
gentooLink = "/etc/make.profile"
|
|
|
|
|
if os.path.islink(gentooLink):
|
|
|
|
|
return os.readlink(gentooLink).rpartition("/")[2]
|
|
|
|
|
|
|
|
|
|
def get_from_uname():
|
|
|
|
|
"""Get version from uname"""
|
|
|
|
|
kernelVersion=self._runos("uname -r")
|
|
|
|
|
if kernelVersion:
|
|
|
|
|
systemVersion = kernelVersion.partition("-")[0]
|
|
|
|
|
return systemVersion
|
|
|
|
|
return kernelVersion.partition("-")[0]
|
|
|
|
|
return get_from_metapackage() or get_from_calculate_ini() or \
|
|
|
|
|
get_from_gentoo_files() or get_from_uname() or "0"
|
|
|
|
|
|
|
|
|
|
def get_os_net_hostname(self):
|
|
|
|
|
'''Считать имя компьютера net_host'''
|
|
|
|
@ -418,13 +456,6 @@ class fillVars(glob_attr):
|
|
|
|
|
return ""
|
|
|
|
|
return ",".join(networks)
|
|
|
|
|
|
|
|
|
|
def get_os_locale_xkbname(self):
|
|
|
|
|
"""названия используемых раскладок клавиатуры для X"""
|
|
|
|
|
localeXkb = self.Get("os_locale_xkb")
|
|
|
|
|
if localeXkb:
|
|
|
|
|
return localeXkb.split("(")[0]
|
|
|
|
|
return ""
|
|
|
|
|
|
|
|
|
|
def get_os_arch_machine(self):
|
|
|
|
|
"""архитектура процессора"""
|
|
|
|
|
march = self._runos("uname -m")
|
|
|
|
@ -503,44 +534,6 @@ class fillVars(glob_attr):
|
|
|
|
|
break
|
|
|
|
|
return virtName
|
|
|
|
|
|
|
|
|
|
def getValueFromConfig(self,config,name):
|
|
|
|
|
"""Get value of parameter from bash type file
|
|
|
|
|
|
|
|
|
|
Parameters:
|
|
|
|
|
config config file name
|
|
|
|
|
name param name
|
|
|
|
|
"""
|
|
|
|
|
reMatch = re.compile("^%s\s*=\s*\"?(.*)\"?$"%name, re.I)
|
|
|
|
|
try:
|
|
|
|
|
if os.path.exists(config):
|
|
|
|
|
for line in open(config,"r").readlines():
|
|
|
|
|
match = reMatch.match(line)
|
|
|
|
|
if match:
|
|
|
|
|
return group().strip()
|
|
|
|
|
except:
|
|
|
|
|
pass
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
def getValueFromCmdLine(self,option,num):
|
|
|
|
|
"""Get value of parameter from boot params
|
|
|
|
|
|
|
|
|
|
Parameters:
|
|
|
|
|
option param name
|
|
|
|
|
num number part of value parameter (, split)
|
|
|
|
|
"""
|
|
|
|
|
cmdLine = "/proc/cmdline"
|
|
|
|
|
calculateParam = "calculate"
|
|
|
|
|
# try get timezone from kernel calculate param
|
|
|
|
|
try:
|
|
|
|
|
for param in open(cmdLine,"r").read().split(" "):
|
|
|
|
|
parname,op,value = param.partition("=")
|
|
|
|
|
if parname == calculateParam and op == "=":
|
|
|
|
|
values = value.split(",")
|
|
|
|
|
if len(values) > num and values[num].strip():
|
|
|
|
|
return values[num].strip()
|
|
|
|
|
except IOError,e:
|
|
|
|
|
return ""
|
|
|
|
|
|
|
|
|
|
def get_hr_board_model(self):
|
|
|
|
|
"""motherboard model"""
|
|
|
|
|
modelFile = "/sys/class/dmi/id/board_name"
|
|
|
|
@ -591,65 +584,15 @@ class fillVars(glob_attr):
|
|
|
|
|
def get_os_locale_xkb(self):
|
|
|
|
|
"""xkb layouts (example: en,ru)"""
|
|
|
|
|
locale = clLocale()
|
|
|
|
|
# is specified keymap support by locale hash
|
|
|
|
|
if self.Get('os_locale_keymap') in locale.getFields('keymap'):
|
|
|
|
|
return locale.getFieldByKeymap("xkblayout",
|
|
|
|
|
self.Get('os_locale_keymap'))
|
|
|
|
|
else:
|
|
|
|
|
return locale.getFieldByLang("xkblayout",
|
|
|
|
|
self.Get('os_locale_lang'))
|
|
|
|
|
return locale.getFieldByLang("xkblayout",
|
|
|
|
|
self.Get('os_locale_lang'))
|
|
|
|
|
|
|
|
|
|
def get_os_locale_keymap(self):
|
|
|
|
|
"""keymap of locale (used for /etc/conf.d/keymaps)"""
|
|
|
|
|
locale = clLocale()
|
|
|
|
|
# get keymap from boot calculate param (keymap specified
|
|
|
|
|
# by lang)
|
|
|
|
|
keymapConfd = '/etc/conf.d/keymaps'
|
|
|
|
|
keymap = self.getValueFromCmdLine("calculate",1)
|
|
|
|
|
if locale.isLangExists(keymap):
|
|
|
|
|
return locale.getFieldByLang('keymap',keymap)
|
|
|
|
|
# get keymap by os_locale_lang
|
|
|
|
|
keymap = self.getValueFromConfig(keymapConfd,'KEYMAP')
|
|
|
|
|
if keymap:
|
|
|
|
|
return keymap
|
|
|
|
|
return locale.getFieldByLang("keymap",self.Get("os_locale_lang"))
|
|
|
|
|
|
|
|
|
|
def get_os_locale_dumpkeys(self):
|
|
|
|
|
"""dumpkeys charset for keymap"""
|
|
|
|
|
locale = clLocale()
|
|
|
|
|
# is specified keymap support by locale hash
|
|
|
|
|
if self.Get('os_locale_keymap') in locale.getFields('keymap'):
|
|
|
|
|
return locale.getFieldByKeymap("dumpkeys_charset",
|
|
|
|
|
self.Get('os_locale_keymap'))
|
|
|
|
|
else:
|
|
|
|
|
return locale.getFieldByLang("dumpkeys_charset",
|
|
|
|
|
self.Get('os_locale_lang'))
|
|
|
|
|
|
|
|
|
|
def get_os_clock_timezone(self):
|
|
|
|
|
"""timezone for clock"""
|
|
|
|
|
zoneinfodir = "/usr/share/zoneinfo/"
|
|
|
|
|
localtimefile = "/etc/localtime"
|
|
|
|
|
# try get timezone from kernel calculate param
|
|
|
|
|
timezone = self.getValueFromCmdLine("calculate",2)
|
|
|
|
|
if timezone and \
|
|
|
|
|
os.path.exists(os.path.join(zoneinfodir,timezone)):
|
|
|
|
|
return timezone
|
|
|
|
|
# get timezone from localtime symlink
|
|
|
|
|
if os.path.lexists(localtimefile):
|
|
|
|
|
return os.readlink(localtimefile).replace(zoneinfodir,"")
|
|
|
|
|
return "UTC"
|
|
|
|
|
|
|
|
|
|
def get_os_clock_type(self):
|
|
|
|
|
"""type of clock (UTC or local)"""
|
|
|
|
|
clockTypeFile = ['/etc/conf.d/clock','/etc/conf.d/hwclock']
|
|
|
|
|
for f in clockTypeFile:
|
|
|
|
|
clock = self.getValueFromConfig(f,"clock")
|
|
|
|
|
if clock:
|
|
|
|
|
if clock.upper() == 'UTC':
|
|
|
|
|
return clock.upper()
|
|
|
|
|
elif clock.lower() == 'local':
|
|
|
|
|
return clock.lower()
|
|
|
|
|
return "local"
|
|
|
|
|
def get_os_locale_xkbname(self):
|
|
|
|
|
"""названия используемых раскладок клавиатуры для X"""
|
|
|
|
|
localeXkb = self.Get("os_locale_xkb")
|
|
|
|
|
if localeXkb:
|
|
|
|
|
return localeXkb.split("(")[0]
|
|
|
|
|
return ""
|
|
|
|
|
|
|
|
|
|
def get_ur_login(self):
|
|
|
|
|
"""Имя пользователя"""
|
|
|
|
@ -745,28 +688,34 @@ class fillVars(glob_attr):
|
|
|
|
|
else:
|
|
|
|
|
return ""
|
|
|
|
|
|
|
|
|
|
def get_hr_x11_video_drv(self):
|
|
|
|
|
def get_os_x11_video_drv(self):
|
|
|
|
|
"""Get video driver used by xorg"""
|
|
|
|
|
xorg_modules_dir = '/usr/lib/xorg/modules/drivers'
|
|
|
|
|
xorg_conf = '/etc/X11/xorg.conf'
|
|
|
|
|
# Try analize Xorg.{DISPLAY}.log
|
|
|
|
|
display = os.environ.get('DISPLAY')
|
|
|
|
|
if display and os.path.exists(xorg_modules_dir):
|
|
|
|
|
list_avialable_drivers = os.listdir(xorg_modules_dir)
|
|
|
|
|
if list_avialable_drivers:
|
|
|
|
|
reDriver = re.compile('|'.join(list_avialable_drivers))
|
|
|
|
|
display_number = re.search(r':(\d+)\..*', display)
|
|
|
|
|
if display_number:
|
|
|
|
|
xorg_log_file = '/var/log/Xorg.%s.log' % \
|
|
|
|
|
display_number.group(1)
|
|
|
|
|
if os.path.exists(xorg_log_file):
|
|
|
|
|
matchStrs = [i for i in open(xorg_log_file)
|
|
|
|
|
if "drv" in i and reDriver.search(i)]
|
|
|
|
|
if matchStrs:
|
|
|
|
|
resDriver = re.search(r'([^/]+)_drv.so',
|
|
|
|
|
matchStrs[-1])
|
|
|
|
|
if resDriver:
|
|
|
|
|
return resDriver.group(1)
|
|
|
|
|
if pathexists(xorg_modules_dir):
|
|
|
|
|
list_avialable_drivers = \
|
|
|
|
|
map(lambda x: x[:-7],
|
|
|
|
|
filter(lambda x: x.endswith('_drv.so'),
|
|
|
|
|
os.listdir(xorg_modules_dir)))
|
|
|
|
|
else:
|
|
|
|
|
list_avialable_drivers = []
|
|
|
|
|
if display and list_avialable_drivers:
|
|
|
|
|
reDriver = re.compile('|'.join(map(lambda x: "%s_drv.so"%x,
|
|
|
|
|
list_avialable_drivers)))
|
|
|
|
|
display_number = re.search(r':(\d+)\..*', display)
|
|
|
|
|
if display_number:
|
|
|
|
|
xorg_log_file = '/var/log/Xorg.%s.log' % \
|
|
|
|
|
display_number.group(1)
|
|
|
|
|
if os.path.exists(xorg_log_file):
|
|
|
|
|
matchStrs = [i for i in open(xorg_log_file)
|
|
|
|
|
if "drv" in i and reDriver.search(i)]
|
|
|
|
|
if matchStrs:
|
|
|
|
|
resDriver = re.search(r'([^/]+)_drv.so',
|
|
|
|
|
matchStrs[-1])
|
|
|
|
|
if resDriver:
|
|
|
|
|
return resDriver.group(1)
|
|
|
|
|
|
|
|
|
|
# analize /etc/X11/xorg.conf
|
|
|
|
|
if os.path.exists(xorg_conf):
|
|
|
|
@ -777,7 +726,129 @@ class fillVars(glob_attr):
|
|
|
|
|
matchSect.group(0),re.S)
|
|
|
|
|
if resDriver:
|
|
|
|
|
return resDriver.group(1)
|
|
|
|
|
return "vesa"
|
|
|
|
|
defaultDriver = {
|
|
|
|
|
'vesa':'vesa',
|
|
|
|
|
'nvidia':'nvidia' if "nvidia" in list_avialable_drivers else "nv",
|
|
|
|
|
'ati':'fglrx' if "fglrx" in list_avialable_drivers else "radeon",
|
|
|
|
|
'intel':'intel',
|
|
|
|
|
'via':'via',
|
|
|
|
|
'vmware':'vmware'}
|
|
|
|
|
hr_video = self.Get('hr_video')
|
|
|
|
|
if hr_video in defaultDriver and \
|
|
|
|
|
defaultDriver[hr_video] in list_avialable_drivers:
|
|
|
|
|
return defaultDriver[hr_video]
|
|
|
|
|
else:
|
|
|
|
|
return "vesa"
|
|
|
|
|
|
|
|
|
|
def getX11Resolution(self):
|
|
|
|
|
"""возвращает текущее разрешение экрана (ширина, высота), X запущен"""
|
|
|
|
|
lines=self._runos("xdpyinfo")
|
|
|
|
|
if not lines:
|
|
|
|
|
return ""
|
|
|
|
|
reRes = re.compile("dimensions:\s+(\d+)x(\d+)\s+pixels")
|
|
|
|
|
searchRes=False
|
|
|
|
|
for line in lines:
|
|
|
|
|
searchRes = reRes.search(line)
|
|
|
|
|
if searchRes:
|
|
|
|
|
break
|
|
|
|
|
if searchRes:
|
|
|
|
|
return (searchRes.group(1), searchRes.group(2))
|
|
|
|
|
else:
|
|
|
|
|
return ""
|
|
|
|
|
|
|
|
|
|
def get_os_x11_height(self):
|
|
|
|
|
"""Получить высоту экрана в пикселах"""
|
|
|
|
|
resolution = self.getX11Resolution()
|
|
|
|
|
if resolution:
|
|
|
|
|
self.Set('os_x11_width',resolution[0])
|
|
|
|
|
return resolution[1]
|
|
|
|
|
return "768"
|
|
|
|
|
|
|
|
|
|
def get_os_x11_width(self):
|
|
|
|
|
"""Получить ширину экрана в пикселах"""
|
|
|
|
|
resolution = self.getX11Resolution()
|
|
|
|
|
if resolution:
|
|
|
|
|
self.Set('os_x11_height',resolution[1])
|
|
|
|
|
return resolution[0]
|
|
|
|
|
return "1024"
|
|
|
|
|
|
|
|
|
|
def get_os_x11_standart(self):
|
|
|
|
|
"""Get the nearest standard size of image relative current
|
|
|
|
|
screen resolution"""
|
|
|
|
|
#Стандартные разрешения
|
|
|
|
|
widthVal = self.Get('os_x11_width')
|
|
|
|
|
heightVal = self.Get('os_x11_height')
|
|
|
|
|
if not widthVal or not heightVal:
|
|
|
|
|
return ""
|
|
|
|
|
width = int(widthVal)
|
|
|
|
|
height = int(heightVal)
|
|
|
|
|
res = [(1024,768),
|
|
|
|
|
(1280,1024),
|
|
|
|
|
(1280,800),
|
|
|
|
|
(1440,900),
|
|
|
|
|
(1600,1200),
|
|
|
|
|
(1680,1050),
|
|
|
|
|
(1920,1200)]
|
|
|
|
|
resolution = []
|
|
|
|
|
formats = []
|
|
|
|
|
for w, h in res:
|
|
|
|
|
formats.append(float(w)/float(h))
|
|
|
|
|
listFr = list(set(formats))
|
|
|
|
|
listFormats = {}
|
|
|
|
|
for fr in listFr:
|
|
|
|
|
listFormats[fr] = []
|
|
|
|
|
for w, h in res:
|
|
|
|
|
for fr in listFormats.keys():
|
|
|
|
|
if fr == float(w)/float(h):
|
|
|
|
|
listFormats[fr].append((w,h))
|
|
|
|
|
break
|
|
|
|
|
format = float(width)/float(height)
|
|
|
|
|
deltaFr = {}
|
|
|
|
|
for fr in listFormats.keys():
|
|
|
|
|
deltaFr[abs(format - fr)] = fr
|
|
|
|
|
resolution = listFormats[deltaFr[min(deltaFr.keys())]]
|
|
|
|
|
flagFound = False
|
|
|
|
|
stResol = []
|
|
|
|
|
stHeights = []
|
|
|
|
|
stWidths = []
|
|
|
|
|
stWidth = False
|
|
|
|
|
stHeight = False
|
|
|
|
|
for w, h in resolution:
|
|
|
|
|
if w >= width and h >= height:
|
|
|
|
|
stResol.append((w,h))
|
|
|
|
|
stHeights.append(h)
|
|
|
|
|
if stHeights:
|
|
|
|
|
stHeight = min(stHeights)
|
|
|
|
|
for w, h in stResol:
|
|
|
|
|
if stHeight == h:
|
|
|
|
|
stWidths.append(w)
|
|
|
|
|
if stWidths:
|
|
|
|
|
stWidth = min(stWidths)
|
|
|
|
|
if (not stWidth) or (not stHeight):
|
|
|
|
|
return "%sx%s"%(resolution[-1][0],resolution[-1][1])
|
|
|
|
|
else:
|
|
|
|
|
return "%sx%s"%(stWidth,stHeight)
|
|
|
|
|
|
|
|
|
|
def get_os_x11_composite(self):
|
|
|
|
|
"""Включен ли композитный режим видеокарты on/off"""
|
|
|
|
|
state = self.get_composite_from_xorgconf()
|
|
|
|
|
return state or "off"
|
|
|
|
|
|
|
|
|
|
def get_hr_laptop(self):
|
|
|
|
|
"""Если компьютер ноутбук, то его производитель"""
|
|
|
|
|
formfactor = self._runos("hal-get-property --udi \
|
|
|
|
|
/org/freedesktop/Hal/devices/computer --key system.formfactor")
|
|
|
|
|
if not formfactor:
|
|
|
|
|
return ""
|
|
|
|
|
if formfactor == 'laptop':
|
|
|
|
|
vendor = self._runos("hal-get-property --udi \
|
|
|
|
|
/org/freedesktop/Hal/devices/computer --key system.hardware.vendor")
|
|
|
|
|
if vendor:
|
|
|
|
|
vendor = vendor.split(" ")[0]
|
|
|
|
|
else:
|
|
|
|
|
vendor = "unknown"
|
|
|
|
|
return vendor.lower()
|
|
|
|
|
return ""
|
|
|
|
|
|
|
|
|
|
def get_hr_video(self):
|
|
|
|
|
"""Производитель видеокарты"""
|
|
|
|
|