[Frubar Paste] Hosted by SkyLime - Chat with us at XChannel IRC

Posted by sajut on Thu 2nd Jul 22:05
download

  1. #!/usr/bin/python                                                                                                                                                                                                                
  2. """                                                                                                                                                                                                                              
  3. This program is free software; you can redistribute it and/or modify                                                                                                                                                            
  4. it under the terms of the GNU General Public License as published by                                                                                                                                                            
  5. the Free Software Foundation; either version 2 of the License, or                                                                                                                                                              
  6. (at your option) any later version.                                                                                                                                                                                            
  7.                                                                                                                                                                                                                                
  8. This program is distributed in the hope that it will be useful,                                                                                                                                                                
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of                                                                                                                                                                  
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                                                                                                                                                  
  11. GNU General Public License for more details.                                                                                                                                                                                    
  12.                                                                                                                                                                                                                                
  13. You should have received a copy of the GNU General Public License                                                                                                                                                              
  14. along with this program; if not, write to the Free Software                                                                                                                                                                    
  15. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                                                                                                                                                      
  16. """                                                                                                                                                                                                                              
  17.                                                                                                                                                                                                                                  
  18.                                                                                                                                                                                                                                  
  19. import pygtk                                                                                                                                                                                                                    
  20. pygtk.require('2.0')                                                                                                                                                                                                            
  21. import gtk                                                                                                                                                                                                                      
  22. import time                                                                                                                                                                                                                      
  23. import gobject                                                                                                                                                                                                                  
  24. import fcntl                                                                                                                                                                                                                    
  25. import struct                                                                                                                                                                                                                    
  26. import ConfigParser                                                                                                                                                                                                              
  27. import os.path                                                                                                                                                                                                                  
  28. import array                                                                                                                                                                                                                    
  29. import getpass                                                                                                                                                                                                                  
  30.                                                                                                                                                                                                                                  
  31. class zhemes:                                                                                                                                                                                                                    
  32.                                                                                                                                                                                                                                  
  33.         #check which user is running this script                                                                                                                                                                                
  34.         global user                                                                                                                                                                                                              
  35.         global home                                                                                                                                                                                                              
  36.         user = getpass.getuser()                                                                                                                                                                                                
  37.         if user == 'root':                                                                                                                                                                                                      
  38.                 home = '/root/'                                                                                                                                                                                                  
  39.         else:                                                                                                                                                                                                                    
  40.                 home = '/home/' + user +  '/'                                                                                                                                                                                    
  41.  
  42.         def btnStandardClicked( self, widget, data = None ):
  43.                 copyfiles(name, 'zhone-nights')            
  44.                 os.system('echo Installed Zhone-Nights Zheme')
  45.  
  46.                 self.btnDark.set_sensitive( True )
  47.                 self.btnBright.set_sensitive( True )
  48.                 self.btnStandard.set_sensitive( False )
  49.                 self.btnStorm.set_sensitive( True )    
  50.  
  51.                 self.winMain.set_title( "please reboot" )
  52.  
  53.                 return True
  54.  
  55.         def btnStormClicked( self, widget, data = None ):
  56.                 copyfiles(name, 'neo-vento')            
  57.                 os.system('echo Installed neovento theme')
  58.  
  59.                 self.btnDark.set_sensitive( True )
  60.                 self.btnBright.set_sensitive( True )
  61.                 self.btnStandard.set_sensitive( True )
  62.                 self.btnStorm.set_sensitive( False )  
  63.  
  64.                 self.winMain.set_title( "please reboot" )
  65.  
  66.                 return True
  67.  
  68.         def btnDarkClicked( self, widget, data = None ):
  69.                 copyfiles(name, 'cosmic-hand')          
  70.                 os.system('echo Installed fyp theme')  
  71.  
  72.                 self.btnDark.set_sensitive( False )
  73.                 self.btnBright.set_sensitive( True )
  74.                 self.btnStandard.set_sensitive( True )
  75.                 self.btnStorm.set_sensitive( True )  
  76.  
  77.                 self.winMain.set_title( "please reboot" )
  78.  
  79.                 return True
  80.  
  81.         def btnBrightClicked( self, widget, data = None ):
  82.                 copyfiles(name, 'spring-thing')          
  83.                 os.system('echo Installed spring theme')  
  84.  
  85.                 self.btnDark.set_sensitive( True )
  86.                 self.btnBright.set_sensitive( False )
  87.                 self.btnStandard.set_sensitive( True )
  88.                 self.btnStorm.set_sensitive( True )
  89.  
  90.                 self.winMain.set_title( "please reboot" )
  91.  
  92.                 return True
  93.  
  94.         def btnRestartClicked( self, widget, data = None ):
  95.  
  96.                 exit()
  97.  
  98.                 return true
  99.  
  100.         def copyfiles(sourcepath, zhemename):
  101.                 os.system('cp ' + sourcepath + '.fyp/zhemes/' + zhemename + '/' + zhemename + '.edj /usr/share/zhone/zhone.edj')
  102.                 os.system('cp ' + sourcepath + '.fyp/zhemes/' + zhemename + '/wallpaper.jpg ' + home + '.fyp/wallpaper.jpg')
  103.                 os.system('cp ' + sourcepath + '.fyp/zhemes/' + zhemename + '/panel.png /usr/share/lxpanel/images/background.png')
  104.                 os.system('cp ' + sourcepath + '.fyp/zhemes/' + zhemename + '/emblem.png /usr/share/lxde/images/lxde-icon.png')
  105.  
  106.                 return true
  107.  
  108.  
  109.         def __init__( self ):
  110.  
  111.                 self.winMain = gtk.Window()
  112.                 self.winMain.connect( 'delete-event', gtk.main_quit )
  113.                 self.vboxMain = gtk.VBox( homogeneous = True, spacing = 0 )
  114.                 self.vboxBtns = gtk.VBox( homogeneous = True, spacing = 0 )
  115.                 self.vboxConfig = gtk.VBox( homogeneous = True, spacing = 0 )
  116.                 self.winMain.set_title( "Zhemes" )
  117.                 self.winMain.set_size_request(480,480)
  118.  
  119.                 """ buttons """
  120.                 self.btnStandard = gtk.Button( "default theme" )
  121.                 self.btnDark = gtk.Button( "fyp theme" )
  122.                 self.btnBright = gtk.Button( "spring theme" )
  123.                 self.btnStorm = gtk.Button( "neovento theme" )
  124.                 self.btnRestart = gtk.Button( "Exit" )
  125.  
  126.                 """ Connect buttons with their functions """
  127.                 self.btnStandardClicked = self.btnStandard.connect( "clicked", self.btnStandardClicked )
  128.                 self.btnDarkClicked = self.btnDark.connect( "clicked", self.btnDarkClicked )
  129.                 self.btnBrightClicked = self.btnBright.connect( "clicked", self.btnBrightClicked )
  130.                 self.btnStormClicked = self.btnStorm.connect( "clicked", self.btnStormClicked )
  131.                 self.btnRestartClicked = self.btnRestart.connect( "clicked", self.btnRestartClicked )
  132.  
  133.  
  134.                 """ Put them on the window """
  135.                 self.vboxMain.pack_start( self.vboxBtns, padding = 1 )
  136.                 self.vboxBtns.pack_start( self.btnStandard )
  137.                 self.vboxBtns.pack_start( self.btnDark )
  138.                 self.vboxBtns.pack_start( self.btnBright )
  139.                 self.vboxBtns.pack_start( self.btnStorm )
  140.                 self.vboxBtns.pack_start( self.btnRestart )
  141.  
  142.  
  143.                 self.winMain.add( self.vboxMain )
  144.  
  145.                 self.winMain.show_all()
  146.  
  147.         def main( self ):
  148.                         gtk.main()
  149.  
  150. if __name__ == "__main__":
  151.     zhemes = zhemes()
  152.     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.



Remember my name in a cookie


Code: To highlight particular lines, prefix each line with @@.
Include comments to indicate what you need feedback on.