diff orpg/chat/chatwnd.py @ 63:c160f26ecf65 ornery-dev

Traipse Dev 'OpenRPG' {090817-00} Traipse is a distribution of OpenRPG that is designed to be easy to setup and go. Traipse also makes it easy for developers to work on code without fear of sacrifice. 'Ornery-Orc' continues the trend of 'Grumpy' and adds fixes to the code. 'Ornery-Orc''s main goal is to offer more advanced features and enhance the productivity of the user. Update Summary: Minor fixes to plugins. Hidden Die Roll no longer prints out data to the terminal. Bug fix in Simple Init; if the Auto Advance check was off and members were added, buttons would remain disabled. Added new CSS classes to Simple Init posts. Fix to Chat Log so log parses CSS classes correctly. Added Text Color button from Core; background color defaults to your settings. Fix to Alias Lib so panes have a minimum size.
author sirebral
date Mon, 17 Aug 2009 00:56:02 -0500
parents 5aff3ef1ae46
children c54768cffbd4
line wrap: on
line diff
--- a/orpg/chat/chatwnd.py	Thu Aug 13 13:01:09 2009 -0500
+++ b/orpg/chat/chatwnd.py	Mon Aug 17 00:56:02 2009 -0500
@@ -102,7 +102,7 @@
     htmlstripper.close()
     return htmlstripper.accum
 
-def log( settings, text ):
+def log( settings, c, text ):
     filename = settings.get_setting('GameLogPrefix')
     if filename > '' and filename[0] != commands.ANTI_LOG_CHAR:
         filename = filename + time.strftime( '-%Y-%m-%d.html', time.localtime( time.time() ) )
@@ -112,7 +112,7 @@
         if settings.get_setting('TimeStampGameLog') != '1': header = ''
         try:
             f = open( orpg.dirpath.dir_struct["user"] + filename, 'a' )
-            f.write( '%s%s<br />\n' % ( header, text ) )
+            f.write( '<div class="'+c+'">%s%s</div>\n' % ( header, text ) )
             f.close()
         except:
             print "could not open " + orpg.dirpath.dir_struct["user"] + filename + ", ignoring..."
@@ -932,13 +932,13 @@
         self.log.log("Enter chat_panel->build_dice(self)", ORPG_DEBUG)
         self.numDieText = wx.TextCtrl( self, wx.ID_ANY, "1", size= wx.Size(25, 25), validator=orpg.tools.inputValidator.MathOnlyValidator() )
         self.dieModText = wx.TextCtrl( self, wx.ID_ANY, "", size= wx.Size(50, 25), validator=orpg.tools.inputValidator.MathOnlyValidator() )
-        self.d4Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d4.gif', 'Roll d4', wx.ID_ANY, '#bdbdbd')
-        self.d6Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d6.gif', 'Roll d6', wx.ID_ANY, '#bdbdbd')
-        self.d8Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d8.gif', 'Roll d8', wx.ID_ANY, '#bdbdbd')
-        self.d10Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d10.gif', 'Roll d10', wx.ID_ANY, '#bdbdbd')
-        self.d12Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d12.gif', 'Roll d12', wx.ID_ANY, '#bdbdbd')
-        self.d20Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d20.gif', 'Roll d20', wx.ID_ANY, '#bdbdbd')
-        self.d100Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d100.gif', 'Roll d100', wx.ID_ANY, '#bdbdbd')
+        self.d4Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d4.gif', 'Roll d4', wx.ID_ANY)
+        self.d6Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d6.gif', 'Roll d6', wx.ID_ANY)
+        self.d8Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d8.gif', 'Roll d8', wx.ID_ANY)
+        self.d10Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d10.gif', 'Roll d10', wx.ID_ANY)
+        self.d12Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d12.gif', 'Roll d12', wx.ID_ANY)
+        self.d20Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d20.gif', 'Roll d20', wx.ID_ANY)
+        self.d100Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d100.gif', 'Roll d100', wx.ID_ANY)
         self.toolbar_sizer.Add( self.numDieText, 0, wx.ALIGN_CENTER | wx.EXPAND)
         self.toolbar_sizer.Add( self.d4Button, 0 ,wx.EXPAND)
         self.toolbar_sizer.Add( self.d6Button, 0 ,wx.EXPAND)
@@ -1007,12 +1007,16 @@
     # Heroman - Ideally, we would use static labels...
     def build_colorbutton(self):
         self.log.log("Enter chat_panel->build_colorbutton(self)", ORPG_DEBUG)
-        self.color_button = wx.Button(self, wx.ID_ANY, "C",wx.Point(0,0), wx.Size(22,0))
-        self.saveButton = createMaskedButton( self, orpg.dirpath.dir_struct["icon"]+'save.bmp', 'Save the chatbuffer', wx.ID_ANY, '#c0c0c0', wx.BITMAP_TYPE_BMP )
-        self.color_button.SetBackgroundColour(wx.BLACK)
-        self.color_button.SetForegroundColour(wx.WHITE)
+        self.color_button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'textcolor.gif', 
+                                                    'Text Color', wx.ID_ANY, '#bdbdbd', 
+                                                    wx.BITMAP_TYPE_GIF)
+
+        self.saveButton = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'save.bmp', 
+                                                    'Save the chatbuffer', wx.ID_ANY, 
+                                                    '#c0c0c0', wx.BITMAP_TYPE_BMP )
+        self.color_button.SetBackgroundColour(self.settings.get_setting('mytextcolor'))
         self.toolbar_sizer.Add(self.color_button, 0, wx.EXPAND)
-        self.toolbar_sizer.Add( self.saveButton, 0, wx.EXPAND )
+        self.toolbar_sizer.Add(self.saveButton, 0, wx.EXPAND)
         self.log.log("Exit chat_panel->build_colorbutton(self)", ORPG_DEBUG)
 
     def OnMotion(self, evt):
@@ -1768,11 +1772,11 @@
                         if self.type == WHISPER_TAB: name += " (whispering): "
                         elif self.type == GROUP_TAB: name += self.settings.get_setting("gwtext") + ' '
                         elif self.sendtarget == 'gm': name += " (whispering to GM) "
-                    newline = self.TimeIndexString() + "<div class='"+c+"'> " +name + s2 + "</div>"
-                    log( self.settings, c+' '+name + s2 )
+                    newline = "<div class='"+c+"'> " + self.TimeIndexString() + name + s2 + "</div>"
+                    log( self.settings, c, name+s2 )
             else:
-                newline = self.TimeIndexString() + "<div class='"+c+"'> " +name + s + "</div>"
-                log( self.settings, c+' '+name + s )
+                newline = "<div class='"+c+"'> " + self.TimeIndexString() + name + s + "</div>"
+                log( self.settings, c, name+s )
         else: send = False
         newline = chat_util.strip_unicode(newline)
         if self.lockscroll == 0: