All pastes #707690 Raw Edit

Stuff

public text v1 · immutable
#707690 ·published 2007-09-23 05:18 UTC
rendered paste body
#!/usr/bin/env python

import pygtk
pygtk.require('2.0')
import gtk
import gtk.glade
import gtk.gdk as gdk
import gobject
import compizconfig
from execute import run
from subprocess import Popen
import ccm

class Base:

	def SystemInfoCheck(self):

		self.glxinfo = run('glxinfo', 'output')
		self.xvinfo = run('xvinfo', 'output')
		self.xdpyinfo = run('xdpyinfo', 'output')

		# We need to check if TFP is direct or Indirect

		self.tfp = False
		if self.glxinfo.count('GLX_EXT_texture_from_pixmap') == 0:
			self.tfp = 'none'
		elif self.glxinfo.count('GLX_EXT_texture_from_pixmap') < 3:
			self.tfp = 'indirect'
		else:
			self.tfp = 'direct'


		# Because Xgl is an entirely new server, we need to check for it first

		if 'Xgl' in self.xvinfo:
			self.XglIsActive = True
			self.possible = True
			self.StartupCommand = "compiz --replace ccp"
		else:
			self.XglIsActive = False

		if self.XglIsActive == True:
			self.RenderingPathString = '<b>Xgl</b>. Desktop effects are provided by an OpenGL overlay. You may notice slowness with 3D applications and Video'
		else:
			if self.tfp == 'direct':
				self.RenderingPathString = '<b>Direct Rendering.</b> Desktop effects are provided by your graphics card. You may experience driver glitches.'
				self.possible = True
			elif self.tfp == 'indirect':
				self.RenderingPathString = 'X.org <b>AIGLX</b>. Some 3D applications and video may not display correctly when desktop effects are enabled'
				self.possible = True
			elif self.tfp == 'none':
				self.RenderingPathString = 'Desktop effects cannot be enabled. You will need to configure your X server'
				self.possible = False

		line = [l for l in self.glxinfo.splitlines() if 'OpenGL renderer string:' in l]
		if line:
			self.GlxRenderer = ' '.join(line[0].split()[4:])

		if 'Intel' in self.GlxRenderer:
			self.StartupCommand = "INTEL_BATCH=1 LIBGL_ALWAYS_INDIRECT=1 compiz --replace ccp"

		elif 'ATI' in self.GlxRenderer:
			self.StartupCommand = "LIBGL_ALWAYS_INDIRECT=1 compiz --replace ccp"

		elif 'NVIDIA' in self.GlxRenderer:
			if self.tfp == "direct":
				self.StartupCommand = "__GL_YEILD='NOTHING' compiz --replace --loose-binding ccp"
			elif self.tfp == "indirect":
				self.StartupCommand = "LIBGL_ALWAYS_INDIRECT=1 compiz --replace ccp"

		print "For reference, your startup command is:" + " " + self.StartupCommand