From 2c100fab3b7baf5e8d775a15f5287207e644432f Mon Sep 17 00:00:00 2001 From: Mike Hiretsky Date: Thu, 23 Jun 2011 13:00:23 +0400 Subject: [PATCH] Add video card name variable. --- pym/cl_fill.py | 26 ++++++++++++++------------ pym/cl_vars.py | 3 +++ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/pym/cl_fill.py b/pym/cl_fill.py index 639e100..a846970 100644 --- a/pym/cl_fill.py +++ b/pym/cl_fill.py @@ -24,7 +24,7 @@ from cl_vars_share import varsShare, clLocale from os.path import exists as pathexists from os import path from cl_utils import isMount, genpassword, getAvailableX11Drivers, \ - listDirectory,isPkgInstalled + listDirectory,isPkgInstalled,lspci from utils import ip from encrypt import getHash @@ -529,19 +529,21 @@ class fillVars(varsShare): return valBoardName or "unknown" return "" + def get_hr_video_name(self): + """Get video name""" + pciVideo = list(sorted(lspci("VGA compatible").items())) + if pciVideo: + pciVideo = pciVideo[0][1] + vendor=pciVideo.get("vendor","").split(" ")[0] + name=pciVideo.get("name","") + if "[" in name and "]" in name: + name = name.partition("[")[2].partition("]")[0] + return "{vendor} {name}".format(vendor=vendor,name=name) + return "" + def get_hr_video(self): """Videocard vendor""" - lines=self._runos("lspci") - if not lines: - return "" - reVGA = re.compile("vga",re.I) - foundVGA = False - for line in lines: - if reVGA.search(line): - foundVGA = True - break - if not foundVGA: - return "vesa" + line = self.Get('hr_video_name') if "nVidia" in line or "GeForce" in line: return "nvidia" elif "ATI" in line: diff --git a/pym/cl_vars.py b/pym/cl_vars.py index 3ffa1db..4d7f9f2 100644 --- a/pym/cl_vars.py +++ b/pym/cl_vars.py @@ -185,6 +185,9 @@ class Data: # video verdor name hr_video = {'hide':True} + # videocard name + hr_video_name = {'hide':True} + # Video driver used by xorg os_x11_video_drv = {'hide':True}