for dirname in dirnames:
os.unlink(os.path.join(fullpath, dirname))
- def convert_image_format(self, file):
+ def convert_image_format(self, filename):
"""Convert the image to a png, and store it in a local place"""
self.remove_old_image_cache()
output_name = os.path.join(self._ConvertedWallpaperLocation, '%s.png' % time.time())
- cmd = ["convert", '-resize', '1280', '-gravity', 'Center', '-crop', '1280x800+0+0', file, output_name]
+ cmd = ["convert", '-resize', '1280', '-gravity', 'Center', '-crop', '1280x800+0+0', filename, output_name]
logging.debug("""Convert command: '"%s"'""", '" "'.join(cmd))
return output_name, self._exec_cmd(cmd)
- def set_image(self, file):
+ def set_image(self, filename):
if self.convert:
- file, convert_status = self.convert_image_format(file)
+ filename, convert_status = self.convert_image_format(filename)
if convert_status:
logging.debug('Convert failed')
cmd = ["wmsetbg",
]
if self.permanent:
cmd += ["-u"] # update the wmaker database
- cmd += [file]
+ cmd += [filename]
logging.debug('''WMaker bgset command: "'%s'"''', "' '".join(cmd))
return not self._exec_cmd(cmd)
for dirname in dirnames:
os.unlink(os.path.join(fullpath, dirname))
- def convert_image_format(self, file):
+ def convert_image_format(self, filename):
"""Convert the image to a png, and store it in a local place"""
self.remove_old_image_cache()
output_name = os.path.join(self._ConvertedWallpaperLocation, '%s.png' % time.time())
try:
- return super(OSXChanger, self).convert_image_format(file, format='PNG', extension='.png')
+ return super(OSXChanger, self).convert_image_format(filename, format='PNG', extension='.png')
except ImportError:
logging.debug('Could not load PIL, going to try just copying the image')
import shutil
- output_name = os.path.join(self._ConvertedWallpaperLocation, os.path.basename(file))
- shutil.copyfile(file, output_name)
+ output_name = os.path.join(self._ConvertedWallpaperLocation, os.path.basename(filename))
+ shutil.copyfile(filename, output_name)
return output_name, True
def fix_desktop_plist(self):
class GnomeChanger(BaseChanger):
name = "Gnome"
- def set_image(self, file):
- cmd = ['gconftool-2', '--type', 'string', '--set', '/desktop/gnome/background/picture_filename', file]
+ def set_image(self, filename):
+ cmd = ['gconftool-2', '--type', 'string', '--set', '/desktop/gnome/background/picture_filename', filename]
logging.debug(cmd)
return not self._exec_cmd(cmd)
class UnityChanger(BaseChanger):
name = "Unity"
- def set_image(self, file):
- cmd = ['gsettings', 'set', 'org.gnome.desktop.background', 'picture-uri', 'file://'+file]
+ def set_image(self, filename):
+ cmd = ['gsettings', 'set', 'org.gnome.desktop.background', 'picture-uri', 'file://'+filename]
logging.debug(cmd)
return not self._exec_cmd(cmd)
class KDEChanger(BaseChanger):
name = "KDE"
- def set_image(self, file):
+ def set_image(self, filename):
cmds = []
for group in ('Desktop0', 'Desktop0Screen0'):
base = ['kwriteconfig', '--file', 'kdesktoprc', '--group', group, '--key']
- cmds.append(base + ['Wallpaper', file])
+ cmds.append(base + ['Wallpaper', filename])
cmds.append(base + ['UseSHM', '--type', 'bool', 'true'])
cmds.append(base + ['WallpaperMode', 'ScaleAndCrop'])
cmds.append(base + ['MultiWallpaperMode', 'NoMulti'])