Menu

[r254]: / drplugins / PyCheckerSupport.py.install  Maximize  Restore  History

Download this file

61 lines (54 with data), 2.8 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

#Python Debugger Support

#Version: 0.0.2, 08.04.2007.

import os, os.path, shutil, wx

def Install(DrFrame):
	d = wx.MessageDialog(DrFrame, "This will install the Python Checker Support icons for the toolbar.\nAre you sure you want to proceed?\n(Clicking cancel will still install the plugin).", "Install Python Checker Support", 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/Run Python Checker.png", plugindir + "/bitmaps/16/Run Python Checker.png")
			shutil.copyfile(cwd + "/bitmaps/24/Run Python Checker.png", plugindir + "/bitmaps/24/Run Python Checker.png")
			
			DrFrame.AddPluginIcon("Run Python Checker", plugindir + "/bitmaps/16/Run Python Checker.png", plugindir + "/bitmaps/24/Run Python Checker.png")
		except:
			e = drScrolledMessageDialog.ScrolledMessageDialog(DrFrame, "Error installing Python Checker Support.", "Plugin Install Error", wx.DefaultPosition, wx.Size(550,300))
			answer = e.ShowModal()
			e.Destroy()
		e = drScrolledMessageDialog.ScrolledMessageDialog(DrFrame, "Succesfully Installed Python Checker Support icons.  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 installation.", "Skipping Install", wx.DefaultPosition, wx.Size(550,300))
		answer = e.ShowModal()
		e.Destroy()
	return True