#! /usr/bin/env python """ Case Converter (caseconv.py) Tkinter GUI tool for converting strings, primarily domain names and email addresses, to lower case. Copyright (C) Benjamin D. McGinnes, 2005 ben@adversary.org """ __author__ = 'Ben McGinnes ' __copyright__ = 'Copyright (C) Benjamin D. McGinnes, 2005' __copyrightu__ = u'Copyright \xa9 Benjamin D. McGinnes, 2005'.encode('UTF-8') __copyrightl__ = u'Copyright \xa9 Benjamin D. McGinnes, 2005'.encode('iso-8859-1') __license__ = 'BSD' __program__ = 'Case Converter' __version__ = '0.0.2' import sys import Tkinter tk = Tkinter.Tk() def about(): """ About this program. """ aboutTL = Tkinter.Toplevel() aboutL1 = Tkinter.Label(aboutTL, text="Case Converter").pack() aboutL2 = Tkinter.Label(aboutTL, text="About This Program").pack() aboutL3 = Tkinter.Label(aboutTL, text=u""" Tkinter GUI tool for converting strings, primarily domain names and email addresses, to lower case. Version: 0.0.2 Case Converter website available at: http://www.adversary.org/sanctuary/geekstuff/caseconv.html This program is Copyright \xa9 Benjamin D. McGinnes, 2005. The author reserves all rights, including the right to release or re-release this program under any license. Click the "View License" button to read the current license under which this program is released. The current license is a slightly modified version of the BSD license. """.encode('UTF-8')).pack() aboutL4 = Tkinter.Label(aboutTL, text="About The Author").pack() aboutL5 = Tkinter.Label(aboutTL, text=""" Author: Ben McGinnes E-mail: ben@adversary.org RSA PGP Key: 0xA4E8732D DH/DSS PGP Key: 0xA04AE313 """).pack() aboutB1 = Tkinter.Button(aboutTL, text="View License", command=vlicense).pack(side='left') aboutB2 = Tkinter.Button(aboutTL, text="Requirements", command=require).pack(side='right') aboutB3 = Tkinter.Button(aboutTL, text="OK", command=aboutTL.withdraw).pack(side='bottom') aboutB4 = Tkinter.Button(aboutTL, text="Quit", command=rusure).pack(side='bottom') def vlicense(): """ The software license. """ vlicenseTL = Tkinter.Toplevel() vlicenseL1 = Tkinter.Label(vlicenseTL, text="Case Converter License").pack() vlicenseL2 = Tkinter.Label(vlicenseTL, text=u""" Copyright \xa9 2005, Benjamin D. McGinnes All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Benjamin D. McGinnes nor the adversary.org domain name may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """.encode('UTF-8')).pack() vlicenseB1 = Tkinter.Button(vlicenseTL, text="I Accept", command=vlicenseTL.withdraw).pack() def require(): """ Requirements to run this program properly. """ requireTL = Tkinter.Toplevel() requireL1 = Tkinter.Label(requireTL, text="Requirements for the Case Converter program").pack() requireL2 = Tkinter.Label(requireTL, text=""" Running the program from source requires a standard installation of the Python language, including standard modules and the Tkinter modules. In most cases Tkinter will come with Python, though it is sometimes stripped from a Python installation. The program requires Python 2.0.x or higher to operate properly. It has not been tested with any version of Python which predates 2.0.1. """).pack() requireL3 = Tkinter.Label(requireTL, text=""" Running the program as an executable binary has no guarantees of success. The requirements of such binaries depends entirely upon the system upon which it was generated. """).pack() requireB1 = Tkinter.Button(requireTL, text="OK", command=requireTL.withdraw).pack(side='left') requireB2 = Tkinter.Button(requireTL, text="Quit", command=rusure).pack(side='right') def rusure(): rusureTL = Tkinter.Toplevel() rusureL1 = Tkinter.Label(rusureTL, text="Are you sure you want to quit?").pack() rusureB1 = Tkinter.Button(rusureTL, text="Yes", command=sys.exit).pack(side='left') rusureB2 = Tkinter.Button(rusureTL, text="No", command=rusureTL.withdraw).pack(side='right') def clear(): wT1.delete(1.0, Tkinter.END) def convert(): x = wT1.get(1.0, Tkinter.END) y = x.lower() wT1.delete(1.0, Tkinter.END) wT1.insert(1.0, y) wL1 = Tkinter.Label(tk, text="""Domain Case Converter""").pack() wB1 = Tkinter.Button(tk, text="About", command=about).pack(side='left') wB2 = Tkinter.Button(tk, text="Quit", command=rusure).pack(side='right') wT1 = Tkinter.Text(tk, width=80) wT1.pack() wB3 = Tkinter.Button(tk, text="Clear", command=clear).pack(side='left') wB4 = Tkinter.Button(tk, text="Convert", command=convert).pack(side='right') tk.mainloop()