Menu

[r219]: / drplugins / install / Switcheroo.py.install  Maximize  Restore  History

Download this file

58 lines (53 with data), 2.7 kB

#	Programmer:	Daniel Pozmanter
#	E-mail:		drpython@bluebottle.com
#	Note:		You must reply to the verification e-mail to get through.
#
#	Copyright 2003-2004 Daniel Pozmanter
#
#	Distributed under the terms of the GPL (GNU Public License)
#
#    DrPython 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

#Plugin
#Switcheroo

import os, os.path, shutil, wx

def Install(DrFrame):
	d = wx.MessageDialog(DrFrame, "This will install the Switcheroo icons for the toolbar, and documentation.\nAre you sure you want to proceed?\n(Clicking cancel will still install the plugin).", "Install Switcheroo", wx.YES_NO | wx.ICON_QUESTION)
	answer = d.ShowModal()
	d.Destroy()
	if (answer == wx.ID_YES):
		try:
			cwd = os.getcwd()
			plugindir = DrFrame.GetPluginDirectory()
			if not os.path.exists(plugindir + "/bitmaps"):
				os.mkdir(plugindir + "/bitmaps")
			if not os.path.exists(plugindir + "/bitmaps/16"):
				os.mkdir(plugindir + "/bitmaps/16")
			if not os.path.exists(plugindir + "/bitmaps/24"):
				os.mkdir(plugindir + "/bitmaps/24")	
				
			shutil.copyfile(cwd + "/bitmaps/16/Switcheroo.png", plugindir + "/bitmaps/16/Switcheroo.png")
			shutil.copyfile(cwd + "/bitmaps/24/Switcheroo.png", plugindir + "/bitmaps/24/Switcheroo.png")
			
			DrFrame.AddPluginIcon("Switcheroo", plugindir + "/bitmaps/16/Switcheroo.png", plugindir + "/bitmaps/24/Switcheroo.png")
		except:
			e = drScrolledMessageDialog.ScrolledMessageDialog(DrFrame, "Error installing Search In Files.", "Plugin Install Error", wx.DefaultPosition, wx.Size(550,300))
			answer = e.ShowModal()
			e.Destroy()
		e = drScrolledMessageDialog.ScrolledMessageDialog(DrFrame, "Succesfully Installed Switcheroo icons and documentation.  Now proceeding to install the plugin.", "Success", wx.DefaultPosition, wx.Size(550,300))
		answer = e.ShowModal()
		e.Destroy()
	else:
		e = drScrolledMessageDialog.ScrolledMessageDialog(DrFrame, "Skipping icon/documentation installation.", "Skipping Install", wx.DefaultPosition, wx.Size(550,300))
		answer = e.ShowModal()
		e.Destroy()
	return True