comparison 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
comparison
equal deleted inserted replaced
62:e8029caed892 63:c160f26ecf65
100 htmlstripper.accum = "" 100 htmlstripper.accum = ""
101 htmlstripper.feed(string) 101 htmlstripper.feed(string)
102 htmlstripper.close() 102 htmlstripper.close()
103 return htmlstripper.accum 103 return htmlstripper.accum
104 104
105 def log( settings, text ): 105 def log( settings, c, text ):
106 filename = settings.get_setting('GameLogPrefix') 106 filename = settings.get_setting('GameLogPrefix')
107 if filename > '' and filename[0] != commands.ANTI_LOG_CHAR: 107 if filename > '' and filename[0] != commands.ANTI_LOG_CHAR:
108 filename = filename + time.strftime( '-%Y-%m-%d.html', time.localtime( time.time() ) ) 108 filename = filename + time.strftime( '-%Y-%m-%d.html', time.localtime( time.time() ) )
109 #filename = time.strftime( filename, time.localtime( time.time() ) ) 109 #filename = time.strftime( filename, time.localtime( time.time() ) )
110 timestamp = time.ctime(time.time()) 110 timestamp = time.ctime(time.time())
111 header = '[%s] : ' % ( timestamp ); 111 header = '[%s] : ' % ( timestamp );
112 if settings.get_setting('TimeStampGameLog') != '1': header = '' 112 if settings.get_setting('TimeStampGameLog') != '1': header = ''
113 try: 113 try:
114 f = open( orpg.dirpath.dir_struct["user"] + filename, 'a' ) 114 f = open( orpg.dirpath.dir_struct["user"] + filename, 'a' )
115 f.write( '%s%s<br />\n' % ( header, text ) ) 115 f.write( '<div class="'+c+'">%s%s</div>\n' % ( header, text ) )
116 f.close() 116 f.close()
117 except: 117 except:
118 print "could not open " + orpg.dirpath.dir_struct["user"] + filename + ", ignoring..." 118 print "could not open " + orpg.dirpath.dir_struct["user"] + filename + ", ignoring..."
119 pass 119 pass
120 120
930 930
931 def build_dice(self): 931 def build_dice(self):
932 self.log.log("Enter chat_panel->build_dice(self)", ORPG_DEBUG) 932 self.log.log("Enter chat_panel->build_dice(self)", ORPG_DEBUG)
933 self.numDieText = wx.TextCtrl( self, wx.ID_ANY, "1", size= wx.Size(25, 25), validator=orpg.tools.inputValidator.MathOnlyValidator() ) 933 self.numDieText = wx.TextCtrl( self, wx.ID_ANY, "1", size= wx.Size(25, 25), validator=orpg.tools.inputValidator.MathOnlyValidator() )
934 self.dieModText = wx.TextCtrl( self, wx.ID_ANY, "", size= wx.Size(50, 25), validator=orpg.tools.inputValidator.MathOnlyValidator() ) 934 self.dieModText = wx.TextCtrl( self, wx.ID_ANY, "", size= wx.Size(50, 25), validator=orpg.tools.inputValidator.MathOnlyValidator() )
935 self.d4Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d4.gif', 'Roll d4', wx.ID_ANY, '#bdbdbd') 935 self.d4Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d4.gif', 'Roll d4', wx.ID_ANY)
936 self.d6Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d6.gif', 'Roll d6', wx.ID_ANY, '#bdbdbd') 936 self.d6Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d6.gif', 'Roll d6', wx.ID_ANY)
937 self.d8Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d8.gif', 'Roll d8', wx.ID_ANY, '#bdbdbd') 937 self.d8Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d8.gif', 'Roll d8', wx.ID_ANY)
938 self.d10Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d10.gif', 'Roll d10', wx.ID_ANY, '#bdbdbd') 938 self.d10Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d10.gif', 'Roll d10', wx.ID_ANY)
939 self.d12Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d12.gif', 'Roll d12', wx.ID_ANY, '#bdbdbd') 939 self.d12Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d12.gif', 'Roll d12', wx.ID_ANY)
940 self.d20Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d20.gif', 'Roll d20', wx.ID_ANY, '#bdbdbd') 940 self.d20Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d20.gif', 'Roll d20', wx.ID_ANY)
941 self.d100Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d100.gif', 'Roll d100', wx.ID_ANY, '#bdbdbd') 941 self.d100Button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'b_d100.gif', 'Roll d100', wx.ID_ANY)
942 self.toolbar_sizer.Add( self.numDieText, 0, wx.ALIGN_CENTER | wx.EXPAND) 942 self.toolbar_sizer.Add( self.numDieText, 0, wx.ALIGN_CENTER | wx.EXPAND)
943 self.toolbar_sizer.Add( self.d4Button, 0 ,wx.EXPAND) 943 self.toolbar_sizer.Add( self.d4Button, 0 ,wx.EXPAND)
944 self.toolbar_sizer.Add( self.d6Button, 0 ,wx.EXPAND) 944 self.toolbar_sizer.Add( self.d6Button, 0 ,wx.EXPAND)
945 self.toolbar_sizer.Add( self.d8Button, 0 ,wx.EXPAND) 945 self.toolbar_sizer.Add( self.d8Button, 0 ,wx.EXPAND)
946 self.toolbar_sizer.Add( self.d10Button, 0 ,wx.EXPAND) 946 self.toolbar_sizer.Add( self.d10Button, 0 ,wx.EXPAND)
1005 self.log.log("Exit chat_panel->toggle_formating(self, " + str(act) + ")", ORPG_DEBUG) 1005 self.log.log("Exit chat_panel->toggle_formating(self, " + str(act) + ")", ORPG_DEBUG)
1006 1006
1007 # Heroman - Ideally, we would use static labels... 1007 # Heroman - Ideally, we would use static labels...
1008 def build_colorbutton(self): 1008 def build_colorbutton(self):
1009 self.log.log("Enter chat_panel->build_colorbutton(self)", ORPG_DEBUG) 1009 self.log.log("Enter chat_panel->build_colorbutton(self)", ORPG_DEBUG)
1010 self.color_button = wx.Button(self, wx.ID_ANY, "C",wx.Point(0,0), wx.Size(22,0)) 1010 self.color_button = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'textcolor.gif',
1011 self.saveButton = createMaskedButton( self, orpg.dirpath.dir_struct["icon"]+'save.bmp', 'Save the chatbuffer', wx.ID_ANY, '#c0c0c0', wx.BITMAP_TYPE_BMP ) 1011 'Text Color', wx.ID_ANY, '#bdbdbd',
1012 self.color_button.SetBackgroundColour(wx.BLACK) 1012 wx.BITMAP_TYPE_GIF)
1013 self.color_button.SetForegroundColour(wx.WHITE) 1013
1014 self.saveButton = createMaskedButton(self, orpg.dirpath.dir_struct["icon"]+'save.bmp',
1015 'Save the chatbuffer', wx.ID_ANY,
1016 '#c0c0c0', wx.BITMAP_TYPE_BMP )
1017 self.color_button.SetBackgroundColour(self.settings.get_setting('mytextcolor'))
1014 self.toolbar_sizer.Add(self.color_button, 0, wx.EXPAND) 1018 self.toolbar_sizer.Add(self.color_button, 0, wx.EXPAND)
1015 self.toolbar_sizer.Add( self.saveButton, 0, wx.EXPAND ) 1019 self.toolbar_sizer.Add(self.saveButton, 0, wx.EXPAND)
1016 self.log.log("Exit chat_panel->build_colorbutton(self)", ORPG_DEBUG) 1020 self.log.log("Exit chat_panel->build_colorbutton(self)", ORPG_DEBUG)
1017 1021
1018 def OnMotion(self, evt): 1022 def OnMotion(self, evt):
1019 self.log.log("Enter chat_panel->OnMotion(self, evt)", ORPG_DEBUG) 1023 self.log.log("Enter chat_panel->OnMotion(self, evt)", ORPG_DEBUG)
1020 contain = self.chatwnd.GetInternalRepresentation() 1024 contain = self.chatwnd.GetInternalRepresentation()
1766 s2 = s2 + '</i>' 1770 s2 = s2 + '</i>'
1767 name = '<i>' + name 1771 name = '<i>' + name
1768 if self.type == WHISPER_TAB: name += " (whispering): " 1772 if self.type == WHISPER_TAB: name += " (whispering): "
1769 elif self.type == GROUP_TAB: name += self.settings.get_setting("gwtext") + ' ' 1773 elif self.type == GROUP_TAB: name += self.settings.get_setting("gwtext") + ' '
1770 elif self.sendtarget == 'gm': name += " (whispering to GM) " 1774 elif self.sendtarget == 'gm': name += " (whispering to GM) "
1771 newline = self.TimeIndexString() + "<div class='"+c+"'> " +name + s2 + "</div>" 1775 newline = "<div class='"+c+"'> " + self.TimeIndexString() + name + s2 + "</div>"
1772 log( self.settings, c+' '+name + s2 ) 1776 log( self.settings, c, name+s2 )
1773 else: 1777 else:
1774 newline = self.TimeIndexString() + "<div class='"+c+"'> " +name + s + "</div>" 1778 newline = "<div class='"+c+"'> " + self.TimeIndexString() + name + s + "</div>"
1775 log( self.settings, c+' '+name + s ) 1779 log( self.settings, c, name+s )
1776 else: send = False 1780 else: send = False
1777 newline = chat_util.strip_unicode(newline) 1781 newline = chat_util.strip_unicode(newline)
1778 if self.lockscroll == 0: 1782 if self.lockscroll == 0:
1779 self.chatwnd.AppendToPage(newline) 1783 self.chatwnd.AppendToPage(newline)
1780 self.scroll_down() 1784 self.scroll_down()