|
|
|
@ -27,17 +27,17 @@ from optparse import OptionParser
|
|
|
|
|
import subprocess
|
|
|
|
|
# for compiz-kde package checking
|
|
|
|
|
import apt_pkg
|
|
|
|
|
from apt.progress import OpProgress
|
|
|
|
|
from apt.progress.base import OpProgress
|
|
|
|
|
|
|
|
|
|
import gettext
|
|
|
|
|
def _(str):
|
|
|
|
|
return unicode(gettext.gettext(str), 'UTF-8')
|
|
|
|
|
def __(catalog,str):
|
|
|
|
|
return unicode(gettext.dgettext(catalog, str), 'UTF-8')
|
|
|
|
|
def utf8(str):
|
|
|
|
|
if isinstance(str, unicode):
|
|
|
|
|
return str
|
|
|
|
|
return unicode(str, 'UTF-8')
|
|
|
|
|
def _(s):
|
|
|
|
|
return str(gettext.gettext(s), 'UTF-8')
|
|
|
|
|
def __(catalog, s):
|
|
|
|
|
return str(gettext.dgettext(catalog, s), 'UTF-8')
|
|
|
|
|
def utf8(s):
|
|
|
|
|
if isinstance(s, str):
|
|
|
|
|
return s
|
|
|
|
|
return str(s, 'UTF-8')
|
|
|
|
|
|
|
|
|
|
class DesktopEffectsCommon(object):
|
|
|
|
|
def __init__(self):
|
|
|
|
@ -57,18 +57,18 @@ class DesktopEffectsCommon(object):
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
def checkEnabled(self):
|
|
|
|
|
'''checks if the compizasWM file is present, and if so, reads what mode we are in'''
|
|
|
|
|
if os.path.exists(os.path.expanduser("~/.trinity/share/config/compizasWM")):
|
|
|
|
|
compizasWM = open(os.path.expanduser("~/.trinity/share/config/compizasWM"))
|
|
|
|
|
state = compizasWM.readline()
|
|
|
|
|
return state
|
|
|
|
|
else:
|
|
|
|
|
return False
|
|
|
|
|
'''checks if the compizasWM file is present, and if so, reads what mode we are in'''
|
|
|
|
|
if os.path.exists(os.path.expanduser("~/.trinity/share/config/compizasWM")):
|
|
|
|
|
compizasWM = open(os.path.expanduser("~/.trinity/share/config/compizasWM"))
|
|
|
|
|
state = compizasWM.readline()
|
|
|
|
|
return state
|
|
|
|
|
else:
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
def check(self):
|
|
|
|
|
''' checks the state and changes the UI accordingly. '''
|
|
|
|
|
self.installed = self.checkInstalled()
|
|
|
|
|
self.enabled = self.checkEnabled()
|
|
|
|
|
self.enabled = self.checkEnabled()
|
|
|
|
|
if(self.installed == True):
|
|
|
|
|
self.ibText = _("&Remove Desktop Effects")
|
|
|
|
|
self.showWarning()
|
|
|
|
@ -104,25 +104,24 @@ class DesktopEffectsCommon(object):
|
|
|
|
|
|
|
|
|
|
def done(self):
|
|
|
|
|
''' action to be done after the user clicks the "cancel" button '''
|
|
|
|
|
print "signalled" # DEBUG
|
|
|
|
|
print("signalled") # DEBUG
|
|
|
|
|
self.close()
|
|
|
|
|
|
|
|
|
|
def apply(self):
|
|
|
|
|
''' action to be done after the user clicks the "apply button '''
|
|
|
|
|
print "apply clicked" #DEBUG
|
|
|
|
|
print("apply clicked") #DEBUG
|
|
|
|
|
if self.action > 0:
|
|
|
|
|
if self.action == 1:
|
|
|
|
|
self.disableEffects()
|
|
|
|
|
|
|
|
|
|
self.disableEffects()
|
|
|
|
|
elif self.action == 2:
|
|
|
|
|
self.enableStandardEffects()
|
|
|
|
|
self.enableStandardEffects()
|
|
|
|
|
elif self.action == 3:
|
|
|
|
|
self.enableExtraEffects()
|
|
|
|
|
self.enableExtraEffects()
|
|
|
|
|
elif self.action == 4:
|
|
|
|
|
self.enableCustomEffects()
|
|
|
|
|
if not self.enabled and not self.action == 1:
|
|
|
|
|
os.spawnl(os.P_NOWAIT, "/opt/trinity/bin/compiz", "--replace")
|
|
|
|
|
self.enabled = True
|
|
|
|
|
self.enableCustomEffects()
|
|
|
|
|
if not self.enabled and not self.action == 1:
|
|
|
|
|
os.spawnl(os.P_NOWAIT, "/opt/trinity/bin/compiz", "--replace")
|
|
|
|
|
self.enabled = True
|
|
|
|
|
|
|
|
|
|
def btnInstallClicked(self):
|
|
|
|
|
if self.installed == True:
|
|
|
|
@ -138,18 +137,18 @@ class DesktopEffectsCommon(object):
|
|
|
|
|
|
|
|
|
|
# the functions toggled by radio boxes
|
|
|
|
|
def noEffects(self):
|
|
|
|
|
print "radio toggled" # DEBUG
|
|
|
|
|
print("radio toggled") # DEBUG
|
|
|
|
|
self.action = 1
|
|
|
|
|
# self.apply()
|
|
|
|
|
def standardEffects(self):
|
|
|
|
|
print "radio toggled" # DEBUG
|
|
|
|
|
print("radio toggled") # DEBUG
|
|
|
|
|
self.action = 2
|
|
|
|
|
# self.apply()
|
|
|
|
|
def extraEffects(self):
|
|
|
|
|
print "radio toggled" # DEBUG
|
|
|
|
|
print("radio toggled") # DEBUG
|
|
|
|
|
self.action = 3
|
|
|
|
|
def customEffects(self):
|
|
|
|
|
print "radio toggled" # DEBUG
|
|
|
|
|
print("radio toggled") # DEBUG
|
|
|
|
|
self.action = 4
|
|
|
|
|
# self.apply()
|
|
|
|
|
|
|
|
|
@ -161,70 +160,68 @@ class DesktopEffectsCommon(object):
|
|
|
|
|
subprocess.call(['tdesudo', '-c' '/opt/trinity/bin/adept_batch remove compiz-kde-trinity compiz-fusion-plugins-main-trinity compiz-fusion-plugins-extra-trinity'])
|
|
|
|
|
except:
|
|
|
|
|
subprocess.call(['kdialog', '--sorry', 'Adept Batch is not installed on this system'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def disableEffects(self):
|
|
|
|
|
'''remove compiz as the default WM'''
|
|
|
|
|
os.remove(os.path.expanduser("~/.trinity/share/config/compizasWM"))
|
|
|
|
|
self.enabled = False
|
|
|
|
|
'''remove compiz as the default WM'''
|
|
|
|
|
os.remove(os.path.expanduser("~/.trinity/share/config/compizasWM"))
|
|
|
|
|
self.enabled = False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def enableStandardEffects(self):
|
|
|
|
|
'''copy the .ini to Default.ini and enable compiz as default WM'''
|
|
|
|
|
code = os.system('mkdir -p ~/.config/compiz/compizconfig')
|
|
|
|
|
try:
|
|
|
|
|
enable = open(os.path.expanduser("~/.trinity/share/config/compizasWM"),"w")
|
|
|
|
|
if enable.readline() == "custom":
|
|
|
|
|
customeffects = open(os.path.expanduser("~/.config/compiz/compizconfig/Default.ini"),"r")
|
|
|
|
|
backupfile = open(os.path.expanduser("~/.config/compiz/compizconfig/Custom.ini"),"w")
|
|
|
|
|
backupfile.write(customeffects)
|
|
|
|
|
backupfile.close()
|
|
|
|
|
customeffects.close()
|
|
|
|
|
except:
|
|
|
|
|
print "error"
|
|
|
|
|
enable.write("standardeffects")
|
|
|
|
|
enable.close()
|
|
|
|
|
config = open(os.path.join(self.DATADIR,"MediumEffects.ini"),"r")
|
|
|
|
|
dest = open(os.path.expanduser("~/.config/compiz/compizconfig/Default.ini"),"w")
|
|
|
|
|
dest.write(config.read())
|
|
|
|
|
dest.close()
|
|
|
|
|
config.close()
|
|
|
|
|
print "standardEffects enabled" #DEBUG
|
|
|
|
|
|
|
|
|
|
'''copy the .ini to Default.ini and enable compiz as default WM'''
|
|
|
|
|
code = os.system('mkdir -p ~/.config/compiz/compizconfig')
|
|
|
|
|
try:
|
|
|
|
|
enable = open(os.path.expanduser("~/.trinity/share/config/compizasWM"),"w")
|
|
|
|
|
if enable.readline() == "custom":
|
|
|
|
|
customeffects = open(os.path.expanduser("~/.config/compiz/compizconfig/Default.ini"),"r")
|
|
|
|
|
backupfile = open(os.path.expanduser("~/.config/compiz/compizconfig/Custom.ini"),"w")
|
|
|
|
|
backupfile.write(customeffects)
|
|
|
|
|
backupfile.close()
|
|
|
|
|
customeffects.close()
|
|
|
|
|
except:
|
|
|
|
|
print("error")
|
|
|
|
|
enable.write("standardeffects")
|
|
|
|
|
enable.close()
|
|
|
|
|
config = open(os.path.join(self.DATADIR,"MediumEffects.ini"),"r")
|
|
|
|
|
dest = open(os.path.expanduser("~/.config/compiz/compizconfig/Default.ini"),"w")
|
|
|
|
|
dest.write(config.read())
|
|
|
|
|
dest.close()
|
|
|
|
|
config.close()
|
|
|
|
|
print("standardEffects enabled") #DEBUG
|
|
|
|
|
|
|
|
|
|
def enableExtraEffects(self):
|
|
|
|
|
''' copy the extraeffects.ini to Default.ini and enable compiz as defaultWM'''
|
|
|
|
|
code = os.system('mkdir -p ~/.config/compiz/compizconfig')
|
|
|
|
|
if os.path.exists(os.path.expanduser("~/.trinity/share/config/compizasWM")):
|
|
|
|
|
enable = open(os.path.expanduser("~/.trinity/share/config/compizasWM"),"r")
|
|
|
|
|
if enable.readline() == "custom":
|
|
|
|
|
customeffects = open(os.path.expanduser("~/.config/compiz/compizconfig/Default.ini"),"r")
|
|
|
|
|
backupfile = open(os.path.expanduser("~/.config/compiz/compizconfig/Custom.ini"),"w")
|
|
|
|
|
backupfile.write(customeffects)
|
|
|
|
|
backupfile.close()
|
|
|
|
|
customeffects.close()
|
|
|
|
|
enable.close()
|
|
|
|
|
|
|
|
|
|
enable = open(os.path.expanduser("~/.trinity/share/config/compizasWM"),"w")
|
|
|
|
|
enable.write("extraeffects")
|
|
|
|
|
enable.close()
|
|
|
|
|
config = open(os.path.join(self.DATADIR,"HighEffects.ini"),"r")
|
|
|
|
|
dest = open(os.path.expanduser("~/.config/compiz/compizconfig/Default.ini"),"w")
|
|
|
|
|
dest.write(config.read())
|
|
|
|
|
dest.close()
|
|
|
|
|
config.close()
|
|
|
|
|
print "extraEffects enabled" #DEBUG
|
|
|
|
|
|
|
|
|
|
''' copy the extraeffects.ini to Default.ini and enable compiz as defaultWM'''
|
|
|
|
|
code = os.system('mkdir -p ~/.config/compiz/compizconfig')
|
|
|
|
|
if os.path.exists(os.path.expanduser("~/.trinity/share/config/compizasWM")):
|
|
|
|
|
enable = open(os.path.expanduser("~/.trinity/share/config/compizasWM"),"r")
|
|
|
|
|
if enable.readline() == "custom":
|
|
|
|
|
customeffects = open(os.path.expanduser("~/.config/compiz/compizconfig/Default.ini"),"r")
|
|
|
|
|
backupfile = open(os.path.expanduser("~/.config/compiz/compizconfig/Custom.ini"),"w")
|
|
|
|
|
backupfile.write(customeffects)
|
|
|
|
|
backupfile.close()
|
|
|
|
|
customeffects.close()
|
|
|
|
|
enable.close()
|
|
|
|
|
|
|
|
|
|
enable = open(os.path.expanduser("~/.trinity/share/config/compizasWM"),"w")
|
|
|
|
|
enable.write("extraeffects")
|
|
|
|
|
enable.close()
|
|
|
|
|
config = open(os.path.join(self.DATADIR,"HighEffects.ini"),"r")
|
|
|
|
|
dest = open(os.path.expanduser("~/.config/compiz/compizconfig/Default.ini"),"w")
|
|
|
|
|
dest.write(config.read())
|
|
|
|
|
dest.close()
|
|
|
|
|
config.close()
|
|
|
|
|
print("extraEffects enabled") #DEBUG
|
|
|
|
|
|
|
|
|
|
def enableCustomEffects(self):
|
|
|
|
|
code = os.system('mkdir -p ~/.config/compiz/compizconfig')
|
|
|
|
|
try:
|
|
|
|
|
config = open(os.path.expanduser("~/.config/compiz/compizconfig/Custom.ini"),"r")
|
|
|
|
|
except:
|
|
|
|
|
print "no custom effects file, creating blank .ini" #DEBUG
|
|
|
|
|
config = open(os.path.join(self.DATADIR,"BlankEffects.ini"),"r")
|
|
|
|
|
enable = open(os.path.expanduser("~/.trinity/share/config/compizasWM"),"w")
|
|
|
|
|
enable.write("custom")
|
|
|
|
|
enable.close()
|
|
|
|
|
dest = open(os.path.expanduser("~/.config/compiz/compizconfig/Default.ini"),"w")
|
|
|
|
|
dest.write(config.read())
|
|
|
|
|
dest.close()
|
|
|
|
|
config.close()
|
|
|
|
|
code = os.system('mkdir -p ~/.config/compiz/compizconfig')
|
|
|
|
|
try:
|
|
|
|
|
config = open(os.path.expanduser("~/.config/compiz/compizconfig/Custom.ini"),"r")
|
|
|
|
|
except:
|
|
|
|
|
print("no custom effects file, creating blank .ini") #DEBUG
|
|
|
|
|
config = open(os.path.join(self.DATADIR,"BlankEffects.ini"),"r")
|
|
|
|
|
enable = open(os.path.expanduser("~/.trinity/share/config/compizasWM"),"w")
|
|
|
|
|
enable.write("custom")
|
|
|
|
|
enable.close()
|
|
|
|
|
dest = open(os.path.expanduser("~/.config/compiz/compizconfig/Default.ini"),"w")
|
|
|
|
|
dest.write(config.read())
|
|
|
|
|
dest.close()
|
|
|
|
|
config.close()
|
|
|
|
|