




Oyabunbaba wrote:Thank you esteban1uy i try use GDM theme but I do as you say and still the "file not tar.gz or tar file" any suggestions?


#!/usr/bin/env python
# Convert GDM theme to MDM by esteban1uy
import pygtk
import tarfile
import os
import sys
import tempfile
import gtk
pygtk.require('2.0')
if gtk.pygtk_version < (2,3,90):
raise SystemExit
def look_in_directory(directory):
for f in os.listdir(directory):
if os.path.isfile(os.path.join(directory, f)):
if f == "GdmGreeterTheme.desktop":
return os.path.join(directory, f)
if os.path.isdir(os.path.join(directory, f)):
if look_in_directory(os.path.join(directory, f)) != "":
return os.path.join(directory, f)
dialog = gtk.FileChooserDialog("Select theme file",
None,
gtk.FILE_CHOOSER_ACTION_OPEN,
(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
gtk.STOCK_OPEN, gtk.RESPONSE_OK))
dialog.set_default_response(gtk.RESPONSE_OK)
filter = gtk.FileFilter()
filter.set_name("All files")
filter.add_pattern("*.tar.gz")
dialog.add_filter(filter)
response = dialog.run()
if response == gtk.RESPONSE_OK:
fullpathToTar = dialog.get_filename()
fullpath = os.path.dirname(fullpathToTar)
tar = tarfile.open(fullpathToTar, "r:gz")
destinationPath = tempfile.mkdtemp() + "/"
tar.extractall(destinationPath)
GdmFile = look_in_directory(destinationPath)
if GdmFile != "":
o = open(GdmFile+"/MdmGreeterTheme.desktop","a")
for line in open(GdmFile+"/GdmGreeterTheme.desktop"):
line = line.replace("GdmGreeterTheme","MdmGreeterTheme")
o.write(line)
o.close()
innerfolder = os.path.split(os.path.dirname(GdmFile+"/"))[1]
newtar = tarfile.open(fullpath + "/"+innerfolder+"_for_MDM.tar.gz", "w:gz")
newtar.add(GdmFile+"/",innerfolder+"/")
newtar.close()
elif response == gtk.RESPONSE_CANCEL:
exit()
dialog.destroy()


diva4 wrote:Hi esteban1uy,
can you post the link to your GDM theme shown in your 1st post?
Or have you created it yourselve?
Best regards
Diva4



esteban1uy wrote:I made a little script for Nautilus to convert some GDM themes to MDM.





esteban1uy wrote:I made a little script for Nautilus to convert some GDM themes to MDM.
Copy the following code, open gedit and paste it, save it to /home/YOUR_PERSONAL_FOLDER/.gnome2/nautilus-scripts/ with the name Convert GDM theme to MDM.
Then open nautilus, navigate to that folder, right-click the script file, select "Properties" and under "Permissions" tick "Allow executing file as program".
Now you can download any GDM theme pack, right-click and select "Convert..." from the scripts sub-menu.
- Code: Select all
#!/usr/bin/env python
# Convert GDM theme to MDM by esteban1uy
import pygtk
import tarfile
import os
import sys
import tempfile
import gtk
pygtk.require('2.0')
if gtk.pygtk_version < (2,3,90):
raise SystemExit
def look_in_directory(directory):
for f in os.listdir(directory):
if os.path.isfile(os.path.join(directory, f)):
if f == "GdmGreeterTheme.desktop":
return os.path.join(directory, f)
if os.path.isdir(os.path.join(directory, f)):
if look_in_directory(os.path.join(directory, f)) != "":
return os.path.join(directory, f)
dialog = gtk.FileChooserDialog("Select theme file",
None,
gtk.FILE_CHOOSER_ACTION_OPEN,
(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
gtk.STOCK_OPEN, gtk.RESPONSE_OK))
dialog.set_default_response(gtk.RESPONSE_OK)
filter = gtk.FileFilter()
filter.set_name("All files")
filter.add_pattern("*.tar.gz")
dialog.add_filter(filter)
response = dialog.run()
if response == gtk.RESPONSE_OK:
fullpathToTar = dialog.get_filename()
fullpath = os.path.dirname(fullpathToTar)
tar = tarfile.open(fullpathToTar, "r:gz")
destinationPath = tempfile.mkdtemp() + "/"
tar.extractall(destinationPath)
GdmFile = look_in_directory(destinationPath)
if GdmFile != "":
o = open(GdmFile+"/MdmGreeterTheme.desktop","a")
for line in open(GdmFile+"/GdmGreeterTheme.desktop"):
line = line.replace("GdmGreeterTheme","MdmGreeterTheme")
o.write(line)
o.close()
innerfolder = os.path.split(os.path.dirname(GdmFile+"/"))[1]
newtar = tarfile.open(fullpath + "/"+innerfolder+"_for_MDM.tar.gz", "w:gz")
newtar.add(GdmFile+"/",innerfolder+"/")
newtar.close()
elif response == gtk.RESPONSE_CANCEL:
exit()
dialog.destroy()
Edit: If you're using MATE desktop, save the script to /home/YOUR_PERSONAL_FOLDER/.config/caja/scripts/ (thanks therobertsonz).


Inoki wrote:Is there a way to make this work on XFCE? I'm using Linux Mint Debian.

cwwgateway wrote:Inoki wrote:Is there a way to make this work on XFCE? I'm using Linux Mint Debian.
The idea would work, but the script would have to be adapted to thunar or you'd have to install nautilus.
python .GDM2MDM.py

esteban1uy wrote:cwwgateway wrote:Inoki wrote:Is there a way to make this work on XFCE? I'm using Linux Mint Debian.
The idea would work, but the script would have to be adapted to thunar or you'd have to install nautilus.
Well... not really.
The script is independent from Nautilus, it doesn't rely on Nautilus to pass some parameters. The use as a Nautilus script is just because it's a great placeholder, you don't have to manually create a menu entry or something like that to easily use it, just right click and go (try it, right click wherever you want and the script will equally run).
But if you don't have Nautilus you can still start the script from a terminal and it will work the same way.
For example, save the script with the name .GDM2MDM.py inside your personal folder, then open a terminal and execute this command:
- Code: Select all
python .GDM2MDM.py
That's all.
Of course, you can add that command to Thunar's custom actions: http://forums.linuxmint.com/viewtopic.php?f=110&t=66076

cwwgateway wrote:Oyabunbaba wrote:Thank you esteban1uy i try use GDM theme but I do as you say and still the "file not tar.gz or tar file" any suggestions?
Does this happen when you try to add it to MDM? For some reason, the MdmGreeterTheme.desktop file added a second .desktop to the end (so it looked like "MdmGreeterTheme.desktop.desktop"). I had to rename it and remove the second .desktop before it would work.


Users browsing this forum: Google [Bot] and 9 guests