This propsed patch should add WryeMash.pyw (code below). The pyw extension is registered when python is installed to start python without a console. So to start WryeMash, all a user would have to do is double click on the new file. The patch shouldn't replace mash.py for compatibility reasons.
Changes between mash.py and the new file
- A ot more error checking - It attempts to give a messagebox error if wxpython is not installed etc
- Automatic logging. Everything that is written to stderr (the error output stream) and stdout is now written to a file as well as the output stream
- The python install does the same thing as the shortcut which makes messing arround with the shortcut uneeded
This has the following advantages:
- Installing and running becomes easier. Extract to the Morrowind dir and double click on the file called Wrye Mash sums it up.
- Users debugging their own errors becomes eaiser. The most commen errors are caught and a messagebox is given. This removes the need for them to look at a scary stack traces
- Getting a bugdump no longer requires use of the terminal. Everything is in WryeMash.log
Is anyone able to give it a try before I see if Wrye can include it. Just copy the text below into a new file called anythingyouwant.pyw (Make sure you uncheck "Hide extensions of known types" in the windows explorer options).
#Copyright (c) 2009 Jacob Essix#Permission is hereby granted, free of charge, to any person obtaining a copy#of this software and associated documentation files (the "Software"), to deal#in the Software without restriction, including without limitation the rights#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell#copies of the Software, and to permit persons to whom the Software is#furnished to do so, subject to the following conditions:#The above copyright notice and this permission notice shall be included in#all copies or substantial portions of the Software.#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN#THE SOFTWARE.import sys, osclass ErrorLogger: def __init__(self, f, df): self.file = f self.defaultStream = df def write(self, string): f.write(string) self.defaultStream.write(string)def wxMessageBox(caption, message): app = wx.App() dlg = wx.MessageDialog(None, message, caption, wx.OK | wx.ICON_ERROR) dlg.ShowModal() dlg.Destroy() app.Destroy()#redirect stdout and stderr to a filef = file("WryeMash.log", "w+")sys.stdout = ErrorLogger(f, sys.__stdout__)sys.stderr = ErrorLogger(f, sys.__stderr__)print "Wrye Mash Log!"#check for wxtry: import wxexcept ImportError: try: #the default win install comes with Tkinter iirc... from Tkinter import * import tkMessageBox tk = Tk() tk.withdraw() #hide the main window tkMessageBox.showwarning("wxPython Not Found!", "You need to install wxPython. See the Wrye Mash readme for more info") tk.destroy() sys.exit(1) except ImportError: print "You need to install wxPython. See the Wrye Mash readme for more info!" raise #dump the info to sdterr#--Force wxversion for Python 2.4if sys.version[:3] == '2.4': import wxversion wxversion.select("2.5.3.1")try: import masherexcept ImportError: wxMessageBox("masher not found", "masher.py was not found. This file may be installed incorrectly. It must go in the same directory as Wrye Mash") raise# Main ------------------------------------------------------------------------if __name__ == '__main__': if not os.path.exists("../Morrowind.exe"): wxMessageBox("Incorrect install directory", "Wrye Mash cannot find ../Morrowind.exe. Wrye Mash must be installed to Morrowind/Mopy") sys.exit(1) masher.InitSettings() masher.InitLinks() masher.InitImages() app = masher.MashApp(0) app.MainLoop()