Posted by sajut on Thu 2nd Jul 22:05
download
- #!/usr/bin/python
- """
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- """
- import pygtk
- pygtk.require('2.0')
- import gtk
- import time
- import gobject
- import fcntl
- import struct
- import ConfigParser
- import os.path
- import array
- import getpass
- class zhemes:
- #check which user is running this script
- global user
- global home
- user = getpass.getuser()
- if user == 'root':
- home = '/root/'
- else:
- home = '/home/' + user + '/'
- def btnStandardClicked( self, widget, data = None ):
- copyfiles(name, 'zhone-nights')
- os.system('echo Installed Zhone-Nights Zheme')
- self.btnDark.set_sensitive( True )
- self.btnBright.set_sensitive( True )
- self.btnStandard.set_sensitive( False )
- self.btnStorm.set_sensitive( True )
- self.winMain.set_title( "please reboot" )
- return True
- def btnStormClicked( self, widget, data = None ):
- copyfiles(name, 'neo-vento')
- os.system('echo Installed neovento theme')
- self.btnDark.set_sensitive( True )
- self.btnBright.set_sensitive( True )
- self.btnStandard.set_sensitive( True )
- self.btnStorm.set_sensitive( False )
- self.winMain.set_title( "please reboot" )
- return True
- def btnDarkClicked( self, widget, data = None ):
- copyfiles(name, 'cosmic-hand')
- os.system('echo Installed fyp theme')
- self.btnDark.set_sensitive( False )
- self.btnBright.set_sensitive( True )
- self.btnStandard.set_sensitive( True )
- self.btnStorm.set_sensitive( True )
- self.winMain.set_title( "please reboot" )
- return True
- def btnBrightClicked( self, widget, data = None ):
- copyfiles(name, 'spring-thing')
- os.system('echo Installed spring theme')
- self.btnDark.set_sensitive( True )
- self.btnBright.set_sensitive( False )
- self.btnStandard.set_sensitive( True )
- self.btnStorm.set_sensitive( True )
- self.winMain.set_title( "please reboot" )
- return True
- def btnRestartClicked( self, widget, data = None ):
- exit()
- return true
- def copyfiles(sourcepath, zhemename):
- os.system('cp ' + sourcepath + '.fyp/zhemes/' + zhemename + '/' + zhemename + '.edj /usr/share/zhone/zhone.edj')
- os.system('cp ' + sourcepath + '.fyp/zhemes/' + zhemename + '/wallpaper.jpg ' + home + '.fyp/wallpaper.jpg')
- os.system('cp ' + sourcepath + '.fyp/zhemes/' + zhemename + '/panel.png /usr/share/lxpanel/images/background.png')
- os.system('cp ' + sourcepath + '.fyp/zhemes/' + zhemename + '/emblem.png /usr/share/lxde/images/lxde-icon.png')
- return true
- def __init__( self ):
- self.winMain = gtk.Window()
- self.winMain.connect( 'delete-event', gtk.main_quit )
- self.vboxMain = gtk.VBox( homogeneous = True, spacing = 0 )
- self.vboxBtns = gtk.VBox( homogeneous = True, spacing = 0 )
- self.vboxConfig = gtk.VBox( homogeneous = True, spacing = 0 )
- self.winMain.set_title( "Zhemes" )
- self.winMain.set_size_request(480,480)
- """ buttons """
- self.btnStandard = gtk.Button( "default theme" )
- self.btnDark = gtk.Button( "fyp theme" )
- self.btnBright = gtk.Button( "spring theme" )
- self.btnStorm = gtk.Button( "neovento theme" )
- self.btnRestart = gtk.Button( "Exit" )
- """ Connect buttons with their functions """
- self.btnStandardClicked = self.btnStandard.connect( "clicked", self.btnStandardClicked )
- self.btnDarkClicked = self.btnDark.connect( "clicked", self.btnDarkClicked )
- self.btnBrightClicked = self.btnBright.connect( "clicked", self.btnBrightClicked )
- self.btnStormClicked = self.btnStorm.connect( "clicked", self.btnStormClicked )
- self.btnRestartClicked = self.btnRestart.connect( "clicked", self.btnRestartClicked )
- """ Put them on the window """
- self.vboxMain.pack_start( self.vboxBtns, padding = 1 )
- self.vboxBtns.pack_start( self.btnStandard )
- self.vboxBtns.pack_start( self.btnDark )
- self.vboxBtns.pack_start( self.btnBright )
- self.vboxBtns.pack_start( self.btnStorm )
- self.vboxBtns.pack_start( self.btnRestart )
- self.winMain.add( self.vboxMain )
- self.winMain.show_all()
- def main( self ):
- gtk.main()
- if __name__ == "__main__":
- zhemes = zhemes()
- zhemes.main()
Submit a correction or amendment below. (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.