Created
May 28, 2017 18:28
-
-
Save bvaudour/d02adc31e4d66a5a5460f66439050590 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def setWallpaper(self, path): | |
wp = self.getWallpaper() | |
print(wp[0]) | |
print(wp[1]) | |
print(wp[2]) | |
if wp[1] != "Image": | |
regex = "\[Containments\]\[[1-9]+\]\[Wallpaper\]\[org.kde.image\]\[General\]\n.*\n.*\n" | |
com = re.compile(regex) | |
new_data = com.sub((wp[0]+"Image=%s\n"+wp()[1])%path, self.read()) | |
self.sync(new_data) | |
elif wp[1] == "Image": | |
regex = r"\[Containments\]\[[1-9]+\]\[Wallpaper\]\[org.kde.image\]\[General\]\n%s=.*\n"%(wp[1]) | |
com = re.compile(regex) | |
new_data = com.sub(wp[0].replace(wp[2], path), self.read()) | |
self.sync(new_data) | |
else: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment