changeset 82:2fa8bd6785a5 ornery-dev

TerminalWriter's colors are nice, but if no debug console is open it causes the software to look for one until a recursion error is created. Crash reports are sent to the debug console and a pop-up tells the user one has happened. Fix to chat window from SnowDog.
author sirebral
date Thu, 27 Aug 2009 00:51:22 -0500
parents 65c212e9a5b4
children f38df4bf9715
files orpg/chat/chatwnd.py orpg/gametree/nodehandlers/dnd35.py orpg/gametree/nodehandlers/dnd3e.py orpg/orpg_version.py orpg/tools/orpg_log.py
diffstat 5 files changed, 26 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/orpg/chat/chatwnd.py	Wed Aug 26 23:24:45 2009 -0500
+++ b/orpg/chat/chatwnd.py	Thu Aug 27 00:51:22 2009 -0500
@@ -66,6 +66,7 @@
 from HTMLParser import HTMLParser
 import chat_util
 import traceback
+from wx.lib.expando import EVT_ETC_LAYOUT_NEEDED 
 
 from orpg.tools.validate import validate
 from orpg.tools.orpg_settings import settings
@@ -557,11 +558,9 @@
         self.advancedFilter = False
         self.lastSend = 0         #  this is used to help implement the player typing indicator
         self.lastPress = 0        #  this is used to help implement the player typing indicator
-        self.Bind(wx.EVT_SIZE, self.OnSize)
+        self.Bind(wx.EVT_SIZE, self.OnSize)
+        self.Bind(EVT_ETC_LAYOUT_NEEDED, self.OnSize) #require to keep text at bottom of chat when text entry expands --SD
         self.build_ctrls()
-        #openrpg dir
-        #self.root_dir = dir_struct["home"] #Removing!
-        # html font/fontsize is global to all the notebook tabs.
         StartupFont = self.settings.get_setting("defaultfont")
         StartupFontSize = self.settings.get_setting("defaultfontsize")
         if(StartupFont != "") and (StartupFontSize != ""):
@@ -569,7 +568,7 @@
             except: pass
         self.font = self.chatwnd.GetFont().GetFaceName()
         self.fontsize = self.chatwnd.GetFont().GetPointSize()
-        self.scroll_down()
+        self.scroll_down()
 
     @debugging
     def set_default_font(self, fontname=None, fontsize=None):
--- a/orpg/gametree/nodehandlers/dnd35.py	Wed Aug 26 23:24:45 2009 -0500
+++ b/orpg/gametree/nodehandlers/dnd35.py	Thu Aug 27 00:51:22 2009 -0500
@@ -1,9 +1,10 @@
-import orpg.tools.orpg_settings #Settings
-import orpg.minidom
+#from orpg.tools.orpg_settings import settings #Settings used?
+#import orpg.minidom
 from core import *
 from containers import *
 from string import *  #a 1.6003
-from inspect import *  #a 1.9001
+from inspect import *  #a 1.9001
+from orpg.dirpath import dir_struct
 dnd35_EXPORT = wx.NewId()
 
 ############Global Stuff##############
@@ -90,7 +91,7 @@
         return html_str
 
     def about(self):
-        html_str = "<img src='" + orpg.dirpath.dir_struct["icon"]
+        html_str = "<img src='" + dir_struct["icon"]
         html_str += "dnd3e_logo.gif' ><br /><b>dnd35 Character Tool "
         html_str += self.Version+"</b>" #m 1.6000 was hard coded.
         html_str += "<br />by Dj Gilcrease<br />digitalxero@gmail.com"
@@ -680,7 +681,7 @@
 
     def on_add(self,evt):
         if not self.temp_dom:
-            tmp = open(orpg.dirpath.dir_struct["dnd35"]+"dnd35classes.xml","r")
+            tmp = open(dir_struct["dnd35"]+"dnd35classes.xml","r")
             xml_dom = parseXml_with_dlg(self,tmp.read())
             xml_dom = xml_dom._get_firstChild()
             tmp.close()
@@ -1314,7 +1315,7 @@
     def on_add(self,evt):
 
         if not self.temp_dom:
-            tmp = open(orpg.dirpath.dir_struct["dnd35"]+"dnd35feats.xml","r")
+            tmp = open(dir_struct["dnd35"]+"dnd35feats.xml","r")
             xml_dom = parseXml_with_dlg(self,tmp.read())
             xml_dom = xml_dom._get_firstChild()
             tmp.close()
@@ -1329,7 +1330,8 @@
             i = dlg.GetSelection()
             new_node = self.master_dom.appendChild(f_list[i].cloneNode(False))
             self.grid.AppendRows(1)
-            self.refresh_row(self.grid.GetNumberRows()-1)
+            self.refresh_row(self.grid.GetNumberRows()-1)
+        f_list=0; opts=0
         dlg.Destroy()
 
 
@@ -1579,7 +1581,7 @@
 
     def updateFootN(self,n):#a 1.5012 this whole function
         if not self.temp_dom:
-            tmp = open(orpg.dirpath.dir_struct["dnd35"]+"dnd35weapons.xml","r")
+            tmp = open(dir_struct["dnd35"]+"dnd35weapons.xml","r")
             #tmp = open("c:\clh\codeSamples\sample1.xml","r") #a (debug) 1.5012
             self.temp_dom = xml.dom.minidom.parse(tmp)
 
@@ -2048,7 +2050,7 @@
             fnFrame = wx.Frame(masterFrame, -1, title)
             fnFrame.panel = wx.html.HtmlWindow(fnFrame,-1)
             if not self.temp_dom:
-                tmp = open(orpg.dirpath.dir_struct["dnd35"]+
+                tmp = open(dir_struct["dnd35"]+
                             "dnd35weapons.xml","r")
                 #tmp = open("c:\clh\codeSamples\sample1.xml","r")
                 xml_dom = parseXml_with_dlg(self,tmp.read())
@@ -2141,11 +2143,11 @@
 
     def on_add(self,evt):
         if not self.temp_dom:
-            tmp = open(orpg.dirpath.dir_struct["dnd35"]+"dnd35weapons.xml","r")
+            tmp = open(dir_struct["dnd35"]+"dnd35weapons.xml","r")
             #tmp = open("c:\clh\codeSamples\sample1.xml","r") #a (debug) 1.5012
             xml_dom = parseXml_with_dlg(self,tmp.read())
             xml_dom = xml_dom._get_firstChild()
-            tmp.close()
+            tmp.close(); print
             self.temp_dom = xml_dom
         f_list = self.temp_dom.getElementsByTagName('weapon')
         opts = []
@@ -2368,7 +2370,7 @@
 
     def on_add(self,evt):
         if not self.temp_dom:
-            tmp = open(orpg.dirpath.dir_struct["dnd35"]+"dnd35armor.xml","r")
+            tmp = open(dir_struct["dnd35"]+"dnd35armor.xml","r")
             xml_dom = parseXml_with_dlg(self,tmp.read())
             xml_dom = xml_dom._get_firstChild()
             tmp.close()
--- a/orpg/gametree/nodehandlers/dnd3e.py	Wed Aug 26 23:24:45 2009 -0500
+++ b/orpg/gametree/nodehandlers/dnd3e.py	Thu Aug 27 00:51:22 2009 -0500
@@ -145,12 +145,13 @@
 #
 
 #import orpg.tools.orpg_settings #Not used??
-import orpg.minidom
-from core import component
+#import orpg.minidom
+from core import *
 from containers import *
 from string import *  #a 1.6003
 from inspect import *  #a 1.9001
-from orpg.dirpath import dir_struct
+from orpg.dirpath import dir_struct
+
 dnd3e_EXPORT = wx.NewId()
 ############Global Stuff##############
 
@@ -302,7 +303,6 @@
         html_str += "<P>" + self.pp.tohtml()
         html_str += "<P>" + self.skills.tohtml() +"</td>"
         #a block for 1.6009 end
-
         html_str += "</tr></table>"
         return html_str
 
--- a/orpg/orpg_version.py	Wed Aug 26 23:24:45 2009 -0500
+++ b/orpg/orpg_version.py	Thu Aug 27 00:51:22 2009 -0500
@@ -4,7 +4,7 @@
 #BUILD NUMBER FORMAT: "YYMMDD-##" where ## is the incremental daily build index (if needed)
 DISTRO = "Traipse Dev"
 DIS_VER = "Ornery Orc"
-BUILD = "090826-00"
+BUILD = "090827-00"
 
 # This version is for network capability.
 PROTOCOL_VERSION = "1.2"
--- a/orpg/tools/orpg_log.py	Wed Aug 26 23:24:45 2009 -0500
+++ b/orpg/tools/orpg_log.py	Thu Aug 27 00:51:22 2009 -0500
@@ -54,10 +54,7 @@
     crash_report.close()
     logger.exception("Crash Report Created!!")
     logger.info("Printed out crash-report.txt in your System folder", True)
-    if sys.platform in ('win32', 'win64'):
-        logger.info("Press <enter> to continue!", True)
-        raw_input('')
-    #exit()
+    wx.MessageBox('Crash Report Created!', 'System Failure')
 
 class DebugConsole(wx.Frame):
     def __init__(self, parent):
@@ -124,7 +121,8 @@
 
     def log(self, msg, log_type, to_console=False):
         if self.log_to_console or to_console or log_type == ORPG_CRITICAL:
-            self._io.line(str(msg), **self._lvl_args[log_type]['colorizer'])
+            try: self._io.line(str(msg), **self._lvl_args[log_type]['colorizer'])
+            except: pass #Fails without the Debug Console
             try: component.get('debugger').AppendText(".. " + str(msg) +'\n')
             except: pass