Mercurial > traipse_dev
annotate orpg/chat/chatwnd.py @ 133:37d26a98883f alpha
Traipse Alpha 'OpenRPG' {091010-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 (Cleaning up for Beta)
Added Bookmarks
Fix to Remote Admin Commands
Minor fix to text based Server
Fix to Pretty Print, from Core
Fix to Splitter Nodes not being created
Fix to massive amounts of images loading, from Core
Added 'boot' command to remote admin
Added confirmation window for sent nodes
Minor changes to allow for portability to an OpenSUSE linux OS
Miniatures Layer pop up box allows users to turn off Mini labels, from FlexiRPG
Zoom Mouse plugin added
Images added to Plugin UI
Switching to Element Tree
Map efficiency, from FlexiRPG
Added Status Bar to Update Manager
default_manifest.xml renamed to default_upmana.xml
Cleaner clode for saved repositories
New TrueDebug Class in orpg_log (See documentation for usage)
Mercurial's hgweb folder is ported to upmana
**Pretty important update that can help remove thousands of dead children from your gametree.
**Children, <forms />, <group_atts />, <horizontal />, <cols />, <rows />, <height />, etc... are all tags now.
Check your gametree and look for dead children!!
**New Gamtree Recusion method, mapping, and context sensitivity. !!Alpha - Watch out for infinite loops!!
Dead Node Children, now that's a
O O
-v-v- Happy Halloween!
author | sirebral |
---|---|
date | Tue, 10 Nov 2009 12:11:13 -0600 |
parents | fe4dc5817d5e |
children | b4e02e8cd314 |
rev | line source |
---|---|
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1 # Copyright (C) 2000-2001 The OpenRPG Project |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
2 # |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
3 # openrpg-dev@lists.sourceforge.net |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
4 # |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
5 # This program is free software; you can redistribute it and/or modify |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
6 # it under the terms of the GNU General Public License as published by |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
7 # the Free Software Foundation; either version 2 of the License, or |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
8 # (at your option) any later version. |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
9 # |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
10 # This program is distributed in the hope that it will be useful, |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
13 # GNU General Public License for more details. |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
14 # |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
15 # You should have received a copy of the GNU General Public License |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
16 # along with this program; if not, write to the Free Software |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
18 # -- |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
19 # |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
20 # File: chatutils.py |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
21 # Author: Chris Davis |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
22 # Maintainer: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
23 # Version: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
24 # $Id: chatwnd.py,v 1.177 2007/12/07 20:39:48 digitalxero Exp $ |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
25 # |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
26 # Description: This file contains some of the basic definitions for the chat |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
27 # utilities in the orpg project. |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
28 # |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
29 # History |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
30 # 2002-01-20 HeroMan |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
31 # + Added 4 dialog items on toolbar in support of Alias Library Functionallity |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
32 # + Shrunk the text view button to an image |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
33 # 2005-04-25 Snowdog |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
34 # + Added simple_html_repair() to post() to fix malformed html in the chat window |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
35 # + Added strip_script_tags() to post() to remove crash point. See chat_util.py |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
36 # 2005-04-25 Snowdog |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
37 # + Added simple_html_repair() to post() to fix malformed html in the chat window |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
38 # |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
39 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
40 __version__ = "$Id: chatwnd.py,v 1.177 2007/12/07 20:39:48 digitalxero Exp $" |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
41 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
42 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
43 ## |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
44 ## Module Loading |
133 | 45 ## |
46 import os, time, re, sys, traceback, webbrowser, commands, chat_msg, chat_util | |
47 | |
48 from orpg.orpg_version import VERSION | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
49 from orpg.orpg_windows import * |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
50 from orpg.player_list import WG_LIST |
66 | 51 from orpg.dirpath import dir_struct |
133 | 52 #from orpg.tools.metamenus import MenuEx #Needed? |
53 from string import * | |
54 | |
55 import cStringIO # for reading inline imagedata as a stream | |
56 from HTMLParser import HTMLParser | |
57 from wx.lib.expando import EVT_ETC_LAYOUT_NEEDED | |
58 | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
59 import orpg.tools.rgbhex |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
60 import orpg.tools.inputValidator |
133 | 61 from orpg.tools.validate import validate |
62 from orpg.tools.orpg_settings import settings | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
63 import orpg.tools.predTextCtrl |
133 | 64 from orpg.tools.orpg_log import logger, debug |
65 from orpg.orpgCore import component | |
66 from xml.etree.ElementTree import tostring | |
67 | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
68 from orpg.networking.mplay_client import MPLAY_CONNECTED # needed to only send typing/not_typing messages while connected |
129 | 69 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
70 NEWCHAT = False |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
71 try: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
72 import wx.webview |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
73 NEWCHAT = True |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
74 except: pass |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
75 NEWCHAT = False |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
76 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
77 # Global parser for stripping HTML tags: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
78 # The 'tag stripping' is implicit, because this parser echoes every |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
79 # type of html data *except* the tags. |
118 | 80 class HTMLStripper(HTMLParser): |
129 | 81 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
82 def __init__(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
83 self.accum = "" |
118 | 84 self.special_tags = ['hr', 'br', 'img'] |
129 | 85 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
86 def handle_data(self, data): # quote cdata literally |
118 | 87 self.accum += data |
129 | 88 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
89 def handle_entityref(self, name): # entities must be preserved exactly |
118 | 90 self.accum += "&" + name + ";" |
129 | 91 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
92 def handle_starttag(self, tag, attrs): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
93 if tag in self.special_tags: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
94 self.accum += '<' + tag |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
95 for attrib in attrs: self.accum += ' ' + attrib[0] + '="' + attrib[1] + '"' |
118 | 96 self.accum += '>' |
129 | 97 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
98 def handle_charref(self, name): # charrefs too |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
99 self.accum += "&#" + name + ";" |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
100 htmlstripper = HTMLStripper() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
101 |
118 | 102 # utility function; see Post(). |
129 | 103 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
104 def strip_html(string): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
105 "Return string tripped of html tags." |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
106 htmlstripper.reset() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
107 htmlstripper.accum = "" |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
108 htmlstripper.feed(string) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
109 htmlstripper.close() |
118 | 110 return htmlstripper.accum |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
111 |
129 | 112 |
63 | 113 def log( settings, c, text ): |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
114 filename = settings.get_setting('GameLogPrefix') |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
115 if filename > '' and filename[0] != commands.ANTI_LOG_CHAR: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
116 filename = filename + time.strftime( '-%Y-%m-%d.html', time.localtime( time.time() ) ) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
117 #filename = time.strftime( filename, time.localtime( time.time() ) ) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
118 timestamp = time.ctime(time.time()) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
119 header = '[%s] : ' % ( timestamp ); |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
120 if settings.get_setting('TimeStampGameLog') != '1': header = '' |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
121 try: |
66 | 122 f = open( dir_struct["user"] + filename, 'a' ) |
63 | 123 f.write( '<div class="'+c+'">%s%s</div>\n' % ( header, text ) ) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
124 f.close() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
125 except: |
66 | 126 print "could not open " + dir_struct["user"] + filename + ", ignoring..." |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
127 pass |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
128 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
129 # This class displayes the chat information in html? |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
130 # |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
131 # Defines: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
132 # __init__(self, parent, id) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
133 # OnLinkClicked(self, linkinfo) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
134 # CalculateAllFonts(self, defaultsize) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
135 # SetDefaultFontAndSize(self, fontname) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
136 # |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
137 class chat_html_window(wx.html.HtmlWindow): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
138 """ a wxHTMLwindow that will load links """ |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
139 # initialization subroutine |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
140 # |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
141 # !self : instance of self |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
142 # !parent : |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
143 # !id : |
129 | 144 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
145 def __init__(self, parent, id): |
118 | 146 wx.html.HtmlWindow.__init__(self, parent, id, |
79
dd4be4817377
Chat Window no longer prints excessive debug statements to console. Renamed the Update Manager menu item to Traipse Suite. Added debug console to Traipse Suite. Log now prints an error report and waits for user input so Windows users can see the error being reported.
sirebral
parents:
71
diff
changeset
|
147 style=wx.SUNKEN_BORDER|wx.html.HW_SCROLLBAR_AUTO|wx.NO_FULL_REPAINT_ON_RESIZE) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
148 self.parent = parent |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
149 self.build_menu() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
150 self.Bind(wx.EVT_LEFT_UP, self.LeftUp) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
151 self.Bind(wx.EVT_RIGHT_DOWN, self.onPopup) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
152 if "gtk2" in wx.PlatformInfo: self.SetStandardFonts() |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
153 # def __init__ - end |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
154 |
129 | 155 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
156 def onPopup(self, evt): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
157 self.PopupMenu(self.menu) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
158 |
129 | 159 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
160 def LeftUp(self, event): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
161 event.Skip() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
162 wx.CallAfter(self.parent.set_chat_text_focus, None) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
163 |
129 | 164 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
165 def build_menu(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
166 self.menu = wx.Menu() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
167 item = wx.MenuItem(self.menu, wx.ID_ANY, "Copy", "Copy") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
168 self.Bind(wx.EVT_MENU, self.OnM_EditCopy, item) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
169 self.menu.AppendItem(item) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
170 |
129 | 171 |
118 | 172 def OnM_EditCopy(self, evt): |
173 wx.TheClipboard.UsePrimarySelection(False) | |
174 wx.TheClipboard.Open() | |
175 wx.TheClipboard.SetData(wx.TextDataObject(self.SelectionToText())) | |
176 wx.TheClipboard.Close() | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
177 |
129 | 178 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
179 def scroll_down(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
180 maxrange = self.GetScrollRange(wx.VERTICAL) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
181 pagesize = self.GetScrollPageSize(wx.VERTICAL) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
182 self.Scroll(-1, maxrange-pagesize) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
183 |
129 | 184 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
185 def mouse_wheel(self, event): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
186 amt = event.GetWheelRotation() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
187 units = amt/(-(event.GetWheelDelta())) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
188 self.ScrollLines(units*3) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
189 |
129 | 190 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
191 def Header(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
192 return '<html><body bgcolor="' + self.parent.bgcolor + '" text="' + self.parent.textcolor + '">' |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
193 |
129 | 194 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
195 def StripHeader(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
196 return self.GetPageSource().replace(self.Header(), '') |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
197 |
129 | 198 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
199 def GetPageSource(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
200 return self.GetParser().GetSource() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
201 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
202 # This subroutine fires up the webbrowser when a link is clicked. |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
203 # |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
204 # !self : instance of self |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
205 # !linkinfo : instance of a class that contains the link information |
129 | 206 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
207 def OnLinkClicked(self, linkinfo): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
208 href = linkinfo.GetHref() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
209 wb = webbrowser.get() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
210 wb.open(href) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
211 # def OnLinkClicked - end |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
212 |
129 | 213 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
214 def CalculateAllFonts(self, defaultsize): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
215 return [int(defaultsize * 0.4), |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
216 int(defaultsize * 0.7), |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
217 int(defaultsize), |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
218 int(defaultsize * 1.3), |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
219 int(defaultsize * 1.7), |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
220 int(defaultsize * 2), |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
221 int(defaultsize * 2.5)] |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
222 |
129 | 223 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
224 def SetDefaultFontAndSize(self, fontname, fontsize): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
225 """Set 'fontname' to the default chat font. |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
226 Returns current font settings in a (fontname, fontsize) tuple.""" |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
227 self.SetFonts(fontname, "", self.CalculateAllFonts(int(fontsize))) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
228 return (self.GetFont().GetFaceName(), self.GetFont().GetPointSize()) |
118 | 229 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
230 # class chat_html_window - end |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
231 if NEWCHAT: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
232 class ChatHtmlWindow(wx.webview.WebView): |
129 | 233 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
234 def __init__(self, parent, id): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
235 wx.webview.WebView.__init__(self, parent, id) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
236 self.parent = parent |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
237 self.__font = wx.Font(10, wx.FONTFAMILY_ROMAN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, faceName='Ariel') |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
238 self.build_menu() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
239 self.Bind(wx.EVT_LEFT_UP, self.LeftUp) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
240 self.Bind(wx.EVT_RIGHT_DOWN, self.onPopup) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
241 self.Bind(wx.webview.EVT_WEBVIEW_BEFORE_LOAD, self.OnLinkClicked) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
242 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
243 #Wrapers so I dont have to add special Code |
129 | 244 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
245 def SetPage(self, htmlstring): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
246 self.SetPageSource(htmlstring) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
247 |
129 | 248 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
249 def AppendToPage(self, htmlstring): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
250 self.SetPageSource(self.GetPageSource() + htmlstring) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
251 |
129 | 252 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
253 def GetFont(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
254 return self.__font |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
255 |
129 | 256 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
257 def CalculateAllFonts(self, defaultsize): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
258 return |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
259 |
129 | 260 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
261 def SetDefaultFontAndSize(self, fontname, fontsize): |
118 | 262 self.__font = wx.Font(int(fontsize), |
263 wx.FONTFAMILY_ROMAN, wx.FONTSTYLE_NORMAL, | |
79
dd4be4817377
Chat Window no longer prints excessive debug statements to console. Renamed the Update Manager menu item to Traipse Suite. Added debug console to Traipse Suite. Log now prints an error report and waits for user input so Windows users can see the error being reported.
sirebral
parents:
71
diff
changeset
|
264 wx.FONTWEIGHT_NORMAL, faceName=fontname) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
265 try: self.SetPageSource(self.Header() + self.StripHeader()) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
266 except Exception, e: print e |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
267 return (self.GetFont().GetFaceName(), self.GetFont().GetPointSize()) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
268 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
269 #Events |
129 | 270 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
271 def OnLinkClicked(self, linkinfo): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
272 href = linkinfo.GetHref() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
273 wb = webbrowser.get() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
274 wb.open(href) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
275 |
129 | 276 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
277 def onPopup(self, evt): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
278 self.PopupMenu(self.menu) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
279 |
129 | 280 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
281 def LeftUp(self, event): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
282 event.Skip() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
283 wx.CallAfter(self.parent.set_chat_text_focus, None) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
284 |
129 | 285 |
118 | 286 def OnM_EditCopy(self, evt): |
287 wx.TheClipboard.UsePrimarySelection(False) | |
288 wx.TheClipboard.Open() | |
289 wx.TheClipboard.SetData(wx.TextDataObject(self.SelectionToText())) | |
87 | 290 wx.TheClipboard.Close() |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
291 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
292 #Cutom Methods |
129 | 293 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
294 def Header(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
295 return "<html><head><style>body {font-size: " + str(self.GetFont().GetPointSize()) + "px;font-family: " + self.GetFont().GetFaceName() + ";color: " + self.parent.textcolor + ";background-color: " + self.parent.bgcolor + ";margin: 0;padding: 0 0;height: 100%;}</style></head><body>" |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
296 |
129 | 297 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
298 def StripHeader(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
299 tmp = self.GetPageSource().split('<BODY>') |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
300 if tmp[-1].find('<body>') > -1: tmp = tmp[-1].split('<body>') |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
301 return tmp[-1] |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
302 |
129 | 303 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
304 def build_menu(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
305 self.menu = wx.Menu() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
306 item = wx.MenuItem(self.menu, wx.ID_ANY, "Copy", "Copy") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
307 self.Bind(wx.EVT_MENU, self.OnM_EditCopy, item) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
308 self.menu.AppendItem(item) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
309 |
129 | 310 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
311 def scroll_down(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
312 maxrange = self.GetScrollRange(wx.VERTICAL) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
313 pagesize = self.GetScrollPageSize(wx.VERTICAL) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
314 self.Scroll(-1, maxrange-pagesize) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
315 |
129 | 316 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
317 def mouse_wheel(self, event): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
318 amt = event.GetWheelRotation() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
319 units = amt/(-(event.GetWheelDelta())) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
320 self.ScrollLines(units*3) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
321 chat_html_window = ChatHtmlWindow |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
322 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
323 ######################### |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
324 #chat frame window |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
325 ######################### |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
326 # These are kinda global...and static..and should be located somewhere else |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
327 # then the middle of a file between two classes. |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
328 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
329 ################### |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
330 # Tab Types |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
331 ################### |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
332 MAIN_TAB = wx.NewId() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
333 WHISPER_TAB = wx.NewId() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
334 GROUP_TAB = wx.NewId() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
335 NULL_TAB = wx.NewId() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
336 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
337 # This class defines the tabbed 'notebook' that holds multiple chatpanels. |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
338 # It's the widget attached to the main application frame. |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
339 # |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
340 # Inherits: wxNotebook |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
341 # |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
342 # Defines: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
343 # create_private_tab(self, playerid) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
344 # get_tab_index(self, chatpanel) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
345 # destroy_private_tab(self, chatpanel) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
346 # OnPageChanged(self, event) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
347 # set_default_font(self, font, fontsize) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
348 |
118 | 349 class chat_notebook(orpgTabberWnd): |
129 | 350 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
351 def __init__(self, parent, size): |
118 | 352 orpgTabberWnd.__init__(self, parent, True, size=size, |
66 | 353 style=FNB.FNB_DROPDOWN_TABS_LIST|FNB.FNB_NO_NAV_BUTTONS|FNB.FNB_MOUSE_MIDDLE_CLOSES_TABS) |
354 self.settings = component.get("settings") | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
355 self.whisper_tabs = [] |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
356 self.group_tabs = [] |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
357 self.null_tabs = [] |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
358 self.il = wx.ImageList(16, 16) |
66 | 359 bmp = wx.Bitmap(dir_struct["icon"]+'player.gif') |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
360 self.il.Add(bmp) |
66 | 361 bmp = wx.Bitmap(dir_struct["icon"]+'clear.gif') |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
362 self.il.Add(bmp) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
363 self.SetImageList(self.il) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
364 # Create "main" chatpanel tab, undeletable, connected to 'public' room. |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
365 self.MainChatPanel = chat_panel(self, -1, MAIN_TAB, 'all') |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
366 self.AddPage(self.MainChatPanel, "Main Room") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
367 self.SetPageImage(0, 1) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
368 self.chat_timer = wx.Timer(self, wx.NewId()) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
369 self.Bind(wx.EVT_TIMER, self.MainChatPanel.typingTimerFunc) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
370 self.chat_timer.Start(1000) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
371 # Hook up event handler for flipping tabs |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
372 self.Bind(FNB.EVT_FLATNOTEBOOK_PAGE_CHANGED, self.onPageChanged) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
373 self.Bind(FNB.EVT_FLATNOTEBOOK_PAGE_CHANGING, self.onPageChanging) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
374 self.Bind(FNB.EVT_FLATNOTEBOOK_PAGE_CLOSING, self.onCloseTab) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
375 # html font/fontsize is global to all the notebook tabs. |
79
dd4be4817377
Chat Window no longer prints excessive debug statements to console. Renamed the Update Manager menu item to Traipse Suite. Added debug console to Traipse Suite. Log now prints an error report and waits for user input so Windows users can see the error being reported.
sirebral
parents:
71
diff
changeset
|
376 self.font, self.fontsize = self.MainChatPanel.chatwnd.SetDefaultFontAndSize(self.settings.get_setting('defaultfont'), self.settings.get_setting('defaultfontsize')) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
377 self.GMChatPanel = None |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
378 if self.settings.get_setting("GMWhisperTab") == '1': |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
379 self.create_gm_tab() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
380 self.SetSelection(0) |
118 | 381 |
129 | 382 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
383 def get_tab_index(self, chatpanel): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
384 "Return the index of a chatpanel in the wxNotebook." |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
385 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
386 for i in xrange(self.GetPageCount()): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
387 if (self.GetPage(i) == chatpanel): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
388 return i |
118 | 389 |
129 | 390 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
391 def create_gm_tab(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
392 if self.GMChatPanel == None: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
393 self.GMChatPanel = chat_panel(self, -1, MAIN_TAB, 'gm') |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
394 self.AddPage(self.GMChatPanel, "GM", False) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
395 self.SetPageImage(self.GetPageCount()-1, 1) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
396 self.GMChatPanel.chatwnd.SetDefaultFontAndSize(self.font, self.fontsize) |
118 | 397 |
129 | 398 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
399 def create_whisper_tab(self, playerid): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
400 "Add a new chatpanel directly connected to integer 'playerid' via whispering." |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
401 private_tab = chat_panel(self, -1, WHISPER_TAB, playerid) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
402 playername = strip_html(self.MainChatPanel.session.get_player_by_player_id(playerid)[0]) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
403 self.AddPage(private_tab, playername, False) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
404 private_tab.chatwnd.SetDefaultFontAndSize(self.font, self.fontsize) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
405 self.whisper_tabs.append(private_tab) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
406 self.newMsg(self.GetPageCount()-1) |
66 | 407 self.AliasLib = component.get('alias') |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
408 wx.CallAfter(self.AliasLib.RefreshAliases) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
409 return private_tab |
118 | 410 |
129 | 411 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
412 def create_group_tab(self, group_name): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
413 "Add a new chatpanel directly connected to integer 'playerid' via whispering." |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
414 private_tab = chat_panel(self, -1, GROUP_TAB, group_name) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
415 self.AddPage(private_tab, group_name, False) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
416 private_tab.chatwnd.SetDefaultFontAndSize(self.font, self.fontsize) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
417 self.group_tabs.append(private_tab) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
418 self.newMsg(self.GetPageCount()-1) |
66 | 419 self.AliasLib = component.get('alias') |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
420 wx.CallAfter(self.AliasLib.RefreshAliases) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
421 return private_tab |
118 | 422 |
129 | 423 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
424 def create_null_tab(self, tab_name): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
425 "Add a new chatpanel directly connected to integer 'playerid' via whispering." |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
426 private_tab = chat_panel(self, -1, NULL_TAB, tab_name) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
427 self.AddPage(private_tab, tab_name, False) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
428 private_tab.chatwnd.SetDefaultFontAndSize(self.font, self.fontsize) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
429 self.null_tabs.append(private_tab) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
430 self.newMsg(self.GetPageCount()-1) |
66 | 431 self.AliasLib = component.get('alias') |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
432 wx.CallAfter(self.AliasLib.RefreshAliases) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
433 return private_tab |
118 | 434 |
129 | 435 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
436 def onCloseTab(self, evt): |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
437 try: tabid = evt.GetSelection() |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
438 except: tabid = self.GetSelection() |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
439 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
440 if self.GetPageText(tabid) == 'Main Room': |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
441 #send no close error to chat |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
442 evt.Veto() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
443 return |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
444 if self.GetPageText(tabid) == 'GM': |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
445 msg = "Are You Sure You Want To Close This Page?" |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
446 dlg = wx.MessageDialog(self, msg, "NotebookCtrl Question", |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
447 wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
448 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
449 if wx.Platform != '__WXMAC__': |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
450 dlg.SetFont(wx.Font(8, wx.NORMAL, wx.NORMAL, wx.NORMAL, False)) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
451 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
452 if dlg.ShowModal() in [wx.ID_NO]: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
453 dlg.Destroy() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
454 evt.Veto() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
455 return |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
456 dlg.Destroy() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
457 self.GMChatPanel = None |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
458 self.settings.set_setting("GMWhisperTab", "0") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
459 panel = self.GetPage(tabid) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
460 if panel in self.whisper_tabs: self.whisper_tabs.remove(panel) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
461 elif panel in self.group_tabs: self.group_tabs.remove(panel) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
462 elif panel in self.null_tabs: self.null_tabs.remove(panel) |
118 | 463 |
129 | 464 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
465 def newMsg(self, tabid): |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
466 if tabid != self.GetSelection(): self.SetPageImage(tabid, 0) |
118 | 467 |
129 | 468 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
469 def onPageChanging(self, event): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
470 """When private chattabs are selected, set the bitmap back to 'normal'.""" |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
471 event.Skip() |
118 | 472 |
129 | 473 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
474 def onPageChanged(self, event): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
475 """When private chattabs are selected, set the bitmap back to 'normal'.""" |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
476 selected_idx = event.GetSelection() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
477 self.SetPageImage(selected_idx, 1) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
478 page = self.GetPage(selected_idx) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
479 #wx.CallAfter(page.set_chat_text_focus, 0) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
480 event.Skip() |
118 | 481 |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
482 """ |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
483 This class defines and builds the Chat Frame for OpenRPG |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
484 |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
485 Inherits: wxPanel |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
486 |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
487 Defines: |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
488 __init__((self, parent, id, openrpg, sendtarget) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
489 build_ctrls(self) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
490 on_buffer_size(self,evt) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
491 set_colors(self) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
492 set_buffersize(self) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
493 set_chat_text(self,txt) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
494 OnChar(self,event) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
495 on_chat_save(self,evt) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
496 on_text_color(self,event) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
497 colorize(self, color, text) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
498 on_text_format(self,event) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
499 OnSize(self,event) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
500 scroll_down(self) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
501 InfoPost(self,s) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
502 Post(self,s="",send=False,myself=False) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
503 ParsePost(self,s,send=False,myself=False) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
504 ParseDice(self,s) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
505 ParseNodes(self,s) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
506 get_sha_checksum(self) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
507 get_color(self) |
118 | 508 |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
509 """ |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
510 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
511 class chat_panel(wx.Panel): |
118 | 512 |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
513 """ |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
514 This is the initialization subroutine |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
515 |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
516 !self : instance of self |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
517 !parent : parent that defines the chatframe |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
518 !id : |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
519 !openrpg : |
118 | 520 !sendtarget: who gets outbound messages: either 'all' or a playerid |
521 """ | |
522 | |
129 | 523 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
524 def __init__(self, parent, id, tab_type, sendtarget): |
118 | 525 wx.Panel.__init__(self, parent, id) |
526 logger._set_log_to_console(False) | |
66 | 527 self.session = component.get('session') |
528 self.settings = component.get('settings') | |
529 self.activeplugins = component.get('plugins') | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
530 self.parent = parent |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
531 # who receives outbound messages, either "all" or "playerid" string |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
532 self.sendtarget = sendtarget |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
533 self.type = tab_type |
71
449a8900f9ac
Code refining almost completed, for this round. Some included files are still in need of some clean up, but this is test worthy.
sirebral
parents:
69
diff
changeset
|
534 #self.sound_player = component.get('sound') #Removing! |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
535 # create die roller manager |
71
449a8900f9ac
Code refining almost completed, for this round. Some included files are still in need of some clean up, but this is test worthy.
sirebral
parents:
69
diff
changeset
|
536 #self.DiceManager = component.get('DiceManager') #Removing! |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
537 # create rpghex tool |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
538 self.r_h = orpg.tools.rgbhex.RGBHex() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
539 self.h = 0 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
540 self.set_colors() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
541 self.version = VERSION |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
542 self.histidx = -1 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
543 self.temptext = "" |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
544 self.history = [] |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
545 self.storedata = [] |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
546 #self.lasthistevt = None |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
547 self.parsed=0 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
548 #chat commands |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
549 self.lockscroll = False # set the default to scrolling on. |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
550 self.chat_cmds = commands.chat_commands(self) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
551 self.html_strip = strip_html |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
552 #Alias Lib stuff |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
553 self.defaultAliasName = 'Use Real Name' |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
554 self.defaultFilterName = 'No Filter' |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
555 self.advancedFilter = False |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
556 self.lastSend = 0 # this is used to help implement the player typing indicator |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
557 self.lastPress = 0 # this is used to help implement the player typing indicator |
118 | 558 self.Bind(wx.EVT_SIZE, self.OnSize) |
559 self.Bind(EVT_ETC_LAYOUT_NEEDED, self.OnSize) #require to keep text at bottom of chat when text entry expands --SD | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
560 self.build_ctrls() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
561 StartupFont = self.settings.get_setting("defaultfont") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
562 StartupFontSize = self.settings.get_setting("defaultfontsize") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
563 if(StartupFont != "") and (StartupFontSize != ""): |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
564 try: self.set_default_font(StartupFont, int(StartupFontSize)) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
565 except: pass |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
566 self.font = self.chatwnd.GetFont().GetFaceName() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
567 self.fontsize = self.chatwnd.GetFont().GetPointSize() |
118 | 568 self.scroll_down() |
569 | |
129 | 570 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
571 def set_default_font(self, fontname=None, fontsize=None): |
118 | 572 """Set all chatpanels to new default fontname/fontsize. |
79
dd4be4817377
Chat Window no longer prints excessive debug statements to console. Renamed the Update Manager menu item to Traipse Suite. Added debug console to Traipse Suite. Log now prints an error report and waits for user input so Windows users can see the error being reported.
sirebral
parents:
71
diff
changeset
|
573 Returns current font settings in a (fontname, fontsize) tuple.""" |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
574 if (fontname is not None): newfont = fontname |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
575 else: newfont = self.font |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
576 if (fontsize is not None): newfontsize = int(fontsize) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
577 else: newfontsize = int(self.fontsize) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
578 self.chatwnd.SetDefaultFontAndSize(newfont, newfontsize) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
579 self.InfoPost("Font is now " + newfont + " point size " + `newfontsize`) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
580 self.font = newfont |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
581 self.fontsize = newfontsize |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
582 return (self.font, self.fontsize) |
118 | 583 |
129 | 584 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
585 def build_menu(self): |
118 | 586 top_frame = component.get('frame') |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
587 menu = wx.Menu() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
588 item = wx.MenuItem(menu, wx.ID_ANY, "&Background color", "Background color") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
589 top_frame.Bind(wx.EVT_MENU, self.OnMB_BackgroundColor, item) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
590 menu.AppendItem(item) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
591 item = wx.MenuItem(menu, wx.ID_ANY, "&Text color", "Text color") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
592 top_frame.Bind(wx.EVT_MENU, self.OnMB_TextColor, item) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
593 menu.AppendItem(item) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
594 menu.AppendSeparator() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
595 item = wx.MenuItem(menu, wx.ID_ANY, "&Chat Focus\tCtrl-H", "Chat Focus") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
596 self.setChatFocusMenu = item |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
597 top_frame.Bind(wx.EVT_MENU, self.set_chat_text_focus, item) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
598 menu.AppendItem(item) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
599 menu.AppendSeparator() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
600 item = wx.MenuItem(menu, wx.ID_ANY, "Toggle &Scroll Lock", "Toggle Scroll Lock") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
601 top_frame.Bind(wx.EVT_MENU, self.lock_scroll, item) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
602 menu.AppendItem(item) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
603 item = wx.MenuItem(menu, wx.ID_ANY, "Save Chat &Log", "Save Chat Log") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
604 top_frame.Bind(wx.EVT_MENU, self.on_chat_save, item) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
605 menu.AppendItem(item) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
606 item = wx.MenuItem(menu, wx.ID_ANY, "Text &View", "Text View") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
607 top_frame.Bind(wx.EVT_MENU, self.pop_textpop, item) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
608 menu.AppendItem(item) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
609 item = wx.MenuItem(menu, wx.ID_ANY, "Forward Tab\tCtrl+Tab", "Swap Tabs") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
610 top_frame.Bind(wx.EVT_MENU, self.forward_tabs, item) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
611 menu.AppendItem(item) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
612 item = wx.MenuItem(menu, wx.ID_ANY, "Forward Tab\tCtrl+Shift+Tab", "Swap Tabs") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
613 top_frame.Bind(wx.EVT_MENU, self.back_tabs, item) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
614 menu.AppendItem(item) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
615 menu.AppendSeparator() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
616 settingmenu = wx.Menu() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
617 wndmenu = wx.Menu() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
618 tabmenu = wx.Menu() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
619 toolmenu = wx.Menu() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
620 item = wx.MenuItem(wndmenu, wx.ID_ANY, "Show Images", "Show Images", wx.ITEM_CHECK) |
118 | 621 top_frame.Bind(wx.EVT_MENU, self.OnMB_ShowImages, item) |
66 | 622 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
623 wndmenu.AppendItem(item) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
624 if self.settings.get_setting("Show_Images_In_Chat") == '1': item.Check(True) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
625 item = wx.MenuItem(wndmenu, wx.ID_ANY, "Strip HTML", "Strip HTML", wx.ITEM_CHECK) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
626 top_frame.Bind(wx.EVT_MENU, self.OnMB_StripHTML, item) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
627 wndmenu.AppendItem(item) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
628 if self.settings.get_setting("striphtml") == '1': item.Check(True) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
629 item = wx.MenuItem(wndmenu, wx.ID_ANY, "Chat Time Index", "Chat Time Index", wx.ITEM_CHECK) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
630 top_frame.Bind(wx.EVT_MENU, self.OnMB_ChatTimeIndex, item) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
631 wndmenu.AppendItem(item) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
632 if self.settings.get_setting("Chat_Time_Indexing") == '1': item.Check(True) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
633 item = wx.MenuItem(wndmenu, wx.ID_ANY, "Chat Auto Complete", "Chat Auto Complete", wx.ITEM_CHECK) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
634 top_frame.Bind(wx.EVT_MENU, self.OnMB_ChatAutoComplete, item) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
635 wndmenu.AppendItem(item) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
636 if self.settings.get_setting("SuppressChatAutoComplete") == '0': item.Check(True) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
637 item = wx.MenuItem(wndmenu, wx.ID_ANY, "Show ID in Chat", "Show ID in Chat", wx.ITEM_CHECK) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
638 top_frame.Bind(wx.EVT_MENU, self.OnMB_ShowIDinChat, item) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
639 wndmenu.AppendItem(item) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
640 if self.settings.get_setting("ShowIDInChat") == '1': item.Check(True) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
641 item = wx.MenuItem(wndmenu, wx.ID_ANY, "Log Time Index", "Log Time Index", wx.ITEM_CHECK) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
642 top_frame.Bind(wx.EVT_MENU, self.OnMB_LogTimeIndex, item) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
643 wndmenu.AppendItem(item) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
644 if self.settings.get_setting("TimeStampGameLog") == '1': item.Check(True) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
645 settingmenu.AppendMenu(wx.ID_ANY, 'Chat Window', wndmenu ) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
646 item = wx.MenuItem(tabmenu, wx.ID_ANY, "Tabbed Whispers", "Tabbed Whispers", wx.ITEM_CHECK) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
647 top_frame.Bind(wx.EVT_MENU, self.OnMB_TabbedWhispers, item) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
648 tabmenu.AppendItem(item) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
649 if self.settings.get_setting("tabbedwhispers") == '1': item.Check(True) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
650 item = wx.MenuItem(tabmenu, wx.ID_ANY, "GM Tab", "GM Tab", wx.ITEM_CHECK) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
651 top_frame.Bind(wx.EVT_MENU, self.OnMB_GMTab, item) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
652 tabmenu.AppendItem(item) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
653 if self.settings.get_setting("GMWhisperTab") == '1':item.Check(True) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
654 item = wx.MenuItem(tabmenu, wx.ID_ANY, "Group Whisper Tabs", "Group Whisper Tabs", wx.ITEM_CHECK) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
655 top_frame.Bind(wx.EVT_MENU, self.OnMB_GroupWhisperTabs, item) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
656 tabmenu.AppendItem(item) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
657 if self.settings.get_setting("GroupWhisperTab") == '1': item.Check(True) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
658 settingmenu.AppendMenu(wx.ID_ANY, 'Chat Tabs', tabmenu) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
659 item = wx.MenuItem(toolmenu, wx.ID_ANY, "Dice Bar", "Dice Bar", wx.ITEM_CHECK) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
660 top_frame.Bind(wx.EVT_MENU, self.OnMB_DiceBar, item) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
661 toolmenu.AppendItem(item) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
662 if self.settings.get_setting("DiceButtons_On") == '1': item.Check(True) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
663 item = wx.MenuItem(toolmenu, wx.ID_ANY, "Format Buttons", "Format Buttons", wx.ITEM_CHECK) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
664 top_frame.Bind(wx.EVT_MENU, self.OnMB_FormatButtons, item) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
665 toolmenu.AppendItem(item) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
666 if self.settings.get_setting("FormattingButtons_On") == '1': item.Check(True) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
667 item = wx.MenuItem(toolmenu, wx.ID_ANY, "Alias Tool", "Alias Tool", wx.ITEM_CHECK) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
668 top_frame.Bind(wx.EVT_MENU, self.OnMB_AliasTool, item) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
669 toolmenu.AppendItem(item) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
670 if self.settings.get_setting("AliasTool_On") == '1': item.Check(True) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
671 settingmenu.AppendMenu(wx.ID_ANY, 'Chat Tool Bars', toolmenu) |
118 | 672 menu.AppendMenu(wx.ID_ANY, 'Chat Settings', settingmenu) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
673 top_frame.mainmenu.Insert(2, menu, '&Chat') |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
674 |
118 | 675 ## Settings Menu Events |
129 | 676 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
677 def OnMB_ShowImages(self, event): |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
678 if event.IsChecked(): self.settings.set_setting("Show_Images_In_Chat", '1') |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
679 else: self.settings.set_setting("Show_Images_In_Chat", '0') |
118 | 680 |
129 | 681 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
682 def OnMB_StripHTML(self, event): |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
683 if event.IsChecked(): self.settings.set_setting("Sstriphtml", '1') |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
684 else: self.settings.set_setting("striphtml", '0') |
118 | 685 |
129 | 686 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
687 def OnMB_ChatTimeIndex(self, event): |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
688 if event.IsChecked(): self.settings.set_setting("Chat_Time_Indexing", '1') |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
689 else: self.settings.set_setting("Chat_Time_Indexing", '0') |
118 | 690 |
129 | 691 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
692 def OnMB_ChatAutoComplete(self, event): |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
693 if event.IsChecked(): self.settings.set_setting("SuppressChatAutoComplete", '0') |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
694 else: self.settings.set_setting("SuppressChatAutoComplete", '1') |
118 | 695 |
129 | 696 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
697 def OnMB_ShowIDinChat(self, event): |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
698 if event.IsChecked(): self.settings.set_setting("ShowIDInChat", '1') |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
699 else: self.settings.set_setting("ShowIDInChat", '0') |
118 | 700 |
129 | 701 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
702 def OnMB_LogTimeIndex(self, event): |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
703 if event.IsChecked(): self.settings.set_setting("TimeStampGameLog", '1') |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
704 else: self.settings.set_setting("TimeStampGameLog", '0') |
118 | 705 |
129 | 706 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
707 def OnMB_TabbedWhispers(self, event): |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
708 if event.IsChecked(): self.settings.set_setting("tabbedwhispers", '1') |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
709 else: self.settings.set_setting("tabbedwhispers", '0') |
118 | 710 |
129 | 711 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
712 def OnMB_GMTab(self, event): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
713 if event.IsChecked(): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
714 self.settings.set_setting("GMWhisperTab", '1') |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
715 self.parent.create_gm_tab() |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
716 else: self.settings.set_setting("GMWhisperTab", '0') |
118 | 717 |
129 | 718 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
719 def OnMB_GroupWhisperTabs(self, event): |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
720 if event.IsChecked(): self.settings.set_setting("GroupWhisperTab", '1') |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
721 else: self.settings.set_setting("GroupWhisperTab", '0') |
118 | 722 |
129 | 723 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
724 def OnMB_DiceBar(self, event): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
725 act = '0' |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
726 if event.IsChecked(): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
727 self.settings.set_setting("DiceButtons_On", '1') |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
728 act = '1' |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
729 else: self.settings.set_setting("DiceButtons_On", '0') |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
730 self.toggle_dice(act) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
731 try: self.parent.GMChatPanel.toggle_dice(act) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
732 except: pass |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
733 for panel in self.parent.whisper_tabs: panel.toggle_dice(act) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
734 for panel in self.parent.group_tabs: panel.toggle_dice(act) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
735 for panel in self.parent.null_tabs: panel.toggle_dice(act) |
118 | 736 |
129 | 737 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
738 def OnMB_FormatButtons(self, event): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
739 act = '0' |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
740 if event.IsChecked(): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
741 self.settings.set_setting("FormattingButtons_On", '1') |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
742 act = '1' |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
743 else: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
744 self.settings.set_setting("FormattingButtons_On", '0') |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
745 self.toggle_formating(act) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
746 try: self.parent.GMChatPanel.toggle_formating(act) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
747 except: pass |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
748 for panel in self.parent.whisper_tabs: panel.toggle_formating(act) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
749 for panel in self.parent.group_tabs: panel.toggle_formating(act) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
750 for panel in self.parent.null_tabs: panel.toggle_formating(act) |
118 | 751 |
129 | 752 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
753 def OnMB_AliasTool(self, event): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
754 act = '0' |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
755 if event.IsChecked(): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
756 self.settings.set_setting("AliasTool_On", '1') |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
757 act = '1' |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
758 else: self.settings.set_setting("AliasTool_On", '0') |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
759 self.toggle_alias(act) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
760 try: self.parent.GMChatPanel.toggle_alias(act) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
761 except: pass |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
762 for panel in self.parent.whisper_tabs: panel.toggle_alias(act) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
763 for panel in self.parent.group_tabs: panel.toggle_alias(act) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
764 for panel in self.parent.null_tabs:panel.toggle_alias(act) |
118 | 765 |
129 | 766 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
767 def OnMB_BackgroundColor(self, event): |
66 | 768 top_frame = component.get('frame') |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
769 hexcolor = self.get_color() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
770 if hexcolor != None: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
771 self.bgcolor = hexcolor |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
772 self.settings.set_setting('bgcolor', hexcolor) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
773 self.chatwnd.SetPage(self.ResetPage()) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
774 if self.settings.get_setting('ColorTree') == '1': |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
775 top_frame.tree.SetBackgroundColour(self.settings.get_setting('bgcolor')) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
776 top_frame.tree.Refresh() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
777 top_frame.players.SetBackgroundColour(self.settings.get_setting('bgcolor')) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
778 top_frame.players.Refresh() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
779 else: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
780 top_frame.tree.SetBackgroundColour('white') |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
781 top_frame.tree.SetForegroundColour('black') |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
782 top_frame.tree.Refresh() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
783 top_frame.players.SetBackgroundColour('white') |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
784 top_frame.players.SetForegroundColour('black') |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
785 top_frame.players.Refresh() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
786 self.chatwnd.scroll_down() |
118 | 787 |
129 | 788 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
789 def OnMB_TextColor(self, event): |
66 | 790 top_frame = component.get('frame') |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
791 hexcolor = self.get_color() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
792 if hexcolor != None: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
793 self.textcolor = hexcolor |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
794 self.settings.set_setting('textcolor', hexcolor) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
795 self.chatwnd.SetPage(self.ResetPage()) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
796 if self.settings.get_setting('ColorTree') == '1': |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
797 top_frame.tree.SetForegroundColour(self.settings.get_setting('textcolor')) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
798 top_frame.tree.Refresh() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
799 top_frame.players.SetForegroundColour(self.settings.get_setting('textcolor')) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
800 top_frame.players.Refresh() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
801 else: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
802 top_frame.tree.SetBackgroundColour('white') |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
803 top_frame.tree.SetForegroundColour('black') |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
804 top_frame.tree.Refresh() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
805 top_frame.players.SetBackgroundColour('white') |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
806 top_frame.players.SetForegroundColour('black') |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
807 top_frame.players.Refresh() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
808 self.chatwnd.scroll_down() |
118 | 809 |
129 | 810 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
811 def get_hot_keys(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
812 # dummy menus for hotkeys |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
813 self.build_menu() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
814 entries = [] |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
815 entries.append((wx.ACCEL_CTRL, ord('H'), self.setChatFocusMenu.GetId())) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
816 #entries.append((wx.ACCEL_CTRL, wx.WXK_TAB, SWAP_TABS)) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
817 return entries |
118 | 818 |
129 | 819 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
820 def forward_tabs(self, evt): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
821 self.parent.AdvanceSelection() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
822 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
823 def back_tabs(self, evt): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
824 self.parent.AdvanceSelection(False) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
825 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
826 # This subroutine builds the controls for the chat frame |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
827 # |
118 | 828 # !self : instance of self |
129 | 829 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
830 def build_ctrls(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
831 self.chatwnd = chat_html_window(self,-1) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
832 self.set_colors() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
833 wx.CallAfter(self.chatwnd.SetPage, self.chatwnd.Header()) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
834 if (self.sendtarget == "all"): |
118 | 835 wx.CallAfter(self.Post, self.colorize(self.syscolor, |
66 | 836 "<b>Welcome to <a href='http://www.openrpg.com'>OpenRPG</a> version " + self.version + "... </b>")) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
837 #self.chat_cmds.on_help() |
118 | 838 self.chattxt = orpg.tools.predTextCtrl.predTextCtrl(self, -1, "", |
839 style=wx.TE_PROCESS_ENTER |wx.TE_PROCESS_TAB|wx.TE_LINEWRAP, | |
66 | 840 keyHook = self.myKeyHook, validator=None ) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
841 self.build_bar() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
842 self.basesizer = wx.BoxSizer(wx.VERTICAL) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
843 self.basesizer.Add( self.chatwnd, 1, wx.EXPAND ) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
844 self.basesizer.Add( self.toolbar_sizer, 0, wx.EXPAND ) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
845 self.basesizer.Add( self.chattxt, 0, wx.EXPAND ) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
846 self.SetSizer(self.basesizer) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
847 self.SetAutoLayout(True) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
848 self.Fit() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
849 #events |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
850 self.Bind(wx.EVT_BUTTON, self.on_text_format, self.boldButton) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
851 self.Bind(wx.EVT_BUTTON, self.on_text_format, self.italicButton) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
852 self.Bind(wx.EVT_BUTTON, self.on_text_format, self.underlineButton) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
853 self.Bind(wx.EVT_BUTTON, self.on_text_color, self.color_button) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
854 self.Bind(wx.EVT_BUTTON, self.on_chat_save, self.saveButton) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
855 self.Bind(wx.EVT_BUTTON, self.onDieRoll, self.d4Button) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
856 self.Bind(wx.EVT_BUTTON, self.onDieRoll, self.d6Button) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
857 self.Bind(wx.EVT_BUTTON, self.onDieRoll, self.d8Button) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
858 self.Bind(wx.EVT_BUTTON, self.onDieRoll, self.d10Button) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
859 self.Bind(wx.EVT_BUTTON, self.onDieRoll, self.d12Button) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
860 self.Bind(wx.EVT_BUTTON, self.onDieRoll, self.d20Button) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
861 self.Bind(wx.EVT_BUTTON, self.onDieRoll, self.d100Button) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
862 self.dieIDs = {} |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
863 self.dieIDs[self.d4Button.GetId()] = 'd4' |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
864 self.dieIDs[self.d6Button.GetId()] = 'd6' |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
865 self.dieIDs[self.d8Button.GetId()] = 'd8' |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
866 self.dieIDs[self.d10Button.GetId()] = 'd10' |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
867 self.dieIDs[self.d12Button.GetId()] = 'd12' |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
868 self.dieIDs[self.d20Button.GetId()] = 'd20' |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
869 self.dieIDs[self.d100Button.GetId()] = 'd100' |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
870 self.Bind(wx.EVT_BUTTON, self.pop_textpop, self.textpop_lock) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
871 self.Bind(wx.EVT_BUTTON, self.lock_scroll, self.scroll_lock) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
872 self.chattxt.Bind(wx.EVT_MOUSEWHEEL, self.chatwnd.mouse_wheel) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
873 self.chattxt.Bind(wx.EVT_CHAR, self.chattxt.OnChar) |
87 | 874 self.chattxt.Bind(wx.EVT_TEXT_COPY, self.chatwnd.OnM_EditCopy) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
875 # def build_ctrls - end |
118 | 876 |
129 | 877 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
878 def build_bar(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
879 self.toolbar_sizer = wx.BoxSizer(wx.HORIZONTAL) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
880 self.scroll_lock = None |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
881 self.numDieText = None |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
882 self.dieModText = None |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
883 if self.settings.get_setting('Toolbar_On') == "1": |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
884 self.build_alias() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
885 self.build_dice() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
886 self.build_scroll() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
887 self.build_text() |
133 | 888 self.toolbar_sizer.Add(self.textpop_lock, 0, wx.EXPAND) |
889 self.toolbar_sizer.Add(self.scroll_lock, 0, wx.EXPAND) | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
890 self.build_formating() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
891 self.build_colorbutton() |
118 | 892 |
129 | 893 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
894 def build_scroll(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
895 self.scroll_lock = wx.Button( self, wx.ID_ANY, "Scroll ON",size= wx.Size(80,25)) |
118 | 896 |
129 | 897 |
133 | 898 def build_alias(self): |
899 self.aliasSizer = wx.BoxSizer(wx.HORIZONTAL) ## Future ## Add these to a sizer, then turn the toolbar_sizer into a grid so these can adjust to the frame. | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
900 self.aliasList = wx.Choice(self, wx.ID_ANY, size=(100, 25), choices=[self.defaultAliasName]) |
118 | 901 self.aliasButton = createMaskedButton( self, dir_struct["icon"] + 'player.gif', |
66 | 902 'Refresh list of aliases from Game Tree', wx.ID_ANY, '#bdbdbd' ) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
903 self.aliasList.SetSelection(0) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
904 self.filterList = wx.Choice(self, wx.ID_ANY, size=(100, 25), choices=[self.defaultFilterName]) |
118 | 905 self.filterButton = createMaskedButton( self, dir_struct["icon"] + 'add_filter.gif', |
66 | 906 'Refresh list of filters from Game Tree', wx.ID_ANY, '#bdbdbd' ) |
133 | 907 self.filterList.SetSelection(0) |
908 | |
909 self.aliasSizer.Add( self.aliasButton, 0, wx.EXPAND ) | |
910 self.aliasSizer.Add( self.aliasList,0,wx.EXPAND) | |
911 self.aliasSizer.Add( self.filterButton, 0, wx.EXPAND ) | |
912 self.aliasSizer.Add( self.filterList,0,wx.EXPAND) | |
913 | |
914 self.toolbar_sizer.Add(self.aliasSizer, 0, wx.EXPAND) | |
915 | |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
916 if self.settings.get_setting('AliasTool_On') == '0': self.toggle_alias('0') |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
917 else: self.toggle_alias('1') |
118 | 918 |
129 | 919 |
133 | 920 def toggle_alias(self, act): |
921 if act == '0': self.toolbar_sizer.Show(self.aliasSizer, False) | |
922 else: self.toolbar_sizer.Show(self.aliasSizer, True) | |
923 self.toolbar_sizer.Layout() | |
129 | 924 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
925 def build_text(self): |
66 | 926 self.textpop_lock = createMaskedButton(self, dir_struct["icon"]+'note.gif', 'Open Text View Of Chat Session', wx.ID_ANY, '#bdbdbd') |
118 | 927 |
129 | 928 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
929 def build_dice(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
930 self.numDieText = wx.TextCtrl( self, wx.ID_ANY, "1", size= wx.Size(25, 25), validator=orpg.tools.inputValidator.MathOnlyValidator() ) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
931 self.dieModText = wx.TextCtrl( self, wx.ID_ANY, "", size= wx.Size(50, 25), validator=orpg.tools.inputValidator.MathOnlyValidator() ) |
66 | 932 self.d4Button = createMaskedButton(self, dir_struct["icon"]+'b_d4.gif', 'Roll d4', wx.ID_ANY) |
933 self.d6Button = createMaskedButton(self, dir_struct["icon"]+'b_d6.gif', 'Roll d6', wx.ID_ANY) | |
934 self.d8Button = createMaskedButton(self, dir_struct["icon"]+'b_d8.gif', 'Roll d8', wx.ID_ANY) | |
935 self.d10Button = createMaskedButton(self, dir_struct["icon"]+'b_d10.gif', 'Roll d10', wx.ID_ANY) | |
936 self.d12Button = createMaskedButton(self, dir_struct["icon"]+'b_d12.gif', 'Roll d12', wx.ID_ANY) | |
937 self.d20Button = createMaskedButton(self, dir_struct["icon"]+'b_d20.gif', 'Roll d20', wx.ID_ANY) | |
938 self.d100Button = createMaskedButton(self, dir_struct["icon"]+'b_d100.gif', 'Roll d100', wx.ID_ANY) | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
939 self.toolbar_sizer.Add( self.numDieText, 0, wx.ALIGN_CENTER | wx.EXPAND) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
940 self.toolbar_sizer.Add( self.d4Button, 0 ,wx.EXPAND) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
941 self.toolbar_sizer.Add( self.d6Button, 0 ,wx.EXPAND) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
942 self.toolbar_sizer.Add( self.d8Button, 0 ,wx.EXPAND) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
943 self.toolbar_sizer.Add( self.d10Button, 0 ,wx.EXPAND) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
944 self.toolbar_sizer.Add( self.d12Button, 0 ,wx.EXPAND) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
945 self.toolbar_sizer.Add( self.d20Button, 0 ,wx.EXPAND) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
946 self.toolbar_sizer.Add( self.d100Button, 0 ,wx.EXPAND) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
947 self.toolbar_sizer.Add( self.dieModText, 0, wx.ALIGN_CENTER, 5 ) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
948 if self.settings.get_setting('DiceButtons_On') == '0': self.toggle_dice('0') |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
949 else: self.toggle_dice('1') |
118 | 950 |
129 | 951 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
952 def toggle_dice(self, act): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
953 if act == '0': |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
954 self.toolbar_sizer.Show(self.numDieText, False) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
955 self.toolbar_sizer.Show(self.d4Button, False) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
956 self.toolbar_sizer.Show(self.d6Button, False) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
957 self.toolbar_sizer.Show(self.d8Button, False) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
958 self.toolbar_sizer.Show(self.d10Button, False) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
959 self.toolbar_sizer.Show(self.d12Button, False) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
960 self.toolbar_sizer.Show(self.d20Button, False) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
961 self.toolbar_sizer.Show(self.d100Button, False) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
962 self.toolbar_sizer.Show(self.dieModText, False) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
963 self.toolbar_sizer.Layout() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
964 else: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
965 self.toolbar_sizer.Show(self.numDieText, True) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
966 self.toolbar_sizer.Show(self.d4Button, True) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
967 self.toolbar_sizer.Show(self.d6Button, True) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
968 self.toolbar_sizer.Show(self.d8Button, True) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
969 self.toolbar_sizer.Show(self.d10Button, True) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
970 self.toolbar_sizer.Show(self.d12Button, True) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
971 self.toolbar_sizer.Show(self.d20Button, True) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
972 self.toolbar_sizer.Show(self.d100Button, True) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
973 self.toolbar_sizer.Show(self.dieModText, True) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
974 self.toolbar_sizer.Layout() |
118 | 975 |
129 | 976 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
977 def build_formating(self): |
118 | 978 self.boldButton = createMaskedButton( self, dir_struct["icon"]+'bold.gif', |
66 | 979 'Make the selected text Bold', wx.ID_ANY, '#bdbdbd') |
118 | 980 self.italicButton = createMaskedButton( self, dir_struct["icon"]+'italic.gif', |
66 | 981 'Italicize the selected text', wx.ID_ANY, '#bdbdbd' ) |
118 | 982 self.underlineButton = createMaskedButton( self, dir_struct["icon"]+'underlined.gif', |
66 | 983 'Underline the selected text', wx.ID_ANY, '#bdbdbd' ) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
984 self.toolbar_sizer.Add( self.boldButton, 0, wx.EXPAND ) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
985 self.toolbar_sizer.Add( self.italicButton, 0, wx.EXPAND ) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
986 self.toolbar_sizer.Add( self.underlineButton, 0, wx.EXPAND ) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
987 if self.settings.get_setting('FormattingButtons_On') == '0': self.toggle_formating('0') |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
988 else: self.toggle_formating('1') |
118 | 989 |
129 | 990 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
991 def toggle_formating(self, act): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
992 if act == '0': |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
993 self.toolbar_sizer.Show(self.boldButton, False) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
994 self.toolbar_sizer.Show(self.italicButton, False) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
995 self.toolbar_sizer.Show(self.underlineButton, False) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
996 self.toolbar_sizer.Layout() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
997 else: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
998 self.toolbar_sizer.Show(self.boldButton, True) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
999 self.toolbar_sizer.Show(self.italicButton, True) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1000 self.toolbar_sizer.Show(self.underlineButton, True) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1001 self.toolbar_sizer.Layout() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1002 |
118 | 1003 # Heroman - Ideally, we would use static labels... |
129 | 1004 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1005 def build_colorbutton(self): |
118 | 1006 self.color_button = createMaskedButton(self, dir_struct["icon"]+'textcolor.gif', |
1007 'Text Color', wx.ID_ANY, '#bdbdbd', | |
1008 wx.BITMAP_TYPE_GIF) | |
63 | 1009 |
118 | 1010 self.saveButton = createMaskedButton(self, dir_struct["icon"]+'save.bmp', |
1011 'Save the chatbuffer', wx.ID_ANY, | |
1012 '#c0c0c0', wx.BITMAP_TYPE_BMP ) | |
63 | 1013 self.color_button.SetBackgroundColour(self.settings.get_setting('mytextcolor')) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1014 self.toolbar_sizer.Add(self.color_button, 0, wx.EXPAND) |
118 | 1015 self.toolbar_sizer.Add(self.saveButton, 0, wx.EXPAND) |
1016 | |
129 | 1017 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1018 def OnMotion(self, evt): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1019 contain = self.chatwnd.GetInternalRepresentation() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1020 if contain: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1021 sx = sy = 0 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1022 x = y = 0 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1023 (sx,sy) = self.chatwnd.GetViewStart() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1024 (sx1,sy1) = self.chatwnd.GetScrollPixelsPerUnit() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1025 sx = sx*sx1 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1026 sy = sy*sy1 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1027 (x,y) = evt.GetPosition() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1028 lnk = contain.GetLink(sx+x,sy+y) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1029 if lnk: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1030 try: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1031 link = lnk.GetHref() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1032 self.session.set_status_url(link) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1033 except: pass |
66 | 1034 else: logger.general("Error, self.chatwnd.GetInternalRepresentation() return None") |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1035 evt.Skip() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1036 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1037 # This subroutine is registered with predTextCtrl to be run for every OnChar event |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1038 # It checks if we need to send a typing message |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1039 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1040 # |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1041 # self: duh |
118 | 1042 # event: raw KeyEvent from OnChar() |
129 | 1043 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1044 def myKeyHook(self, event): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1045 if self.session.get_status() == MPLAY_CONNECTED: # only do if we're connected |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1046 thisPress = time.time() # thisPress is local temp variable |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1047 if (thisPress - self.lastSend) > 4: # Check to see if it's been 5 seconds since our last notice |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1048 # If we're not already typing, then self.lastSend will be 0 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1049 self.sendTyping(1) # send a not typing event here (1 for True) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1050 self.lastPress = thisPress # either way, record the time of this keystroke for use in |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1051 # self.typingTimerFunc() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1052 if self.settings.get_setting('SuppressChatAutoComplete') == '1': |
66 | 1053 logger.debug("Exit chat_panel->myKeyHook(self, event) return 1") |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1054 return 1 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1055 else: |
69 | 1056 logger.debug("Exit chat_panel->myKeyHook(self, event) return 0") |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1057 return 0 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1058 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1059 # This subroutine gets called once a second by the typing Timer |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1060 # It checks if we need to send a not_typing message |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1061 # |
118 | 1062 # self: duh |
129 | 1063 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1064 def typingTimerFunc(self, event): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1065 #following added by mDuo13 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1066 ##############refresh_counter()############## |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1067 for plugin_fname in self.activeplugins.keys(): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1068 plugin = self.activeplugins[plugin_fname] |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1069 try: plugin.refresh_counter() |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1070 except Exception, e: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1071 if str(e) != "'module' object has no attribute 'refresh_counter'": |
66 | 1072 logger.general(traceback.format_exc()) |
1073 logger.general("EXCEPTION: " + str(e)) | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1074 #end mDuo13 added code |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1075 if self.lastSend: # This will be zero when not typing, so equiv to if is_typing |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1076 thisTime = time.time() # thisTime is a local temp variable |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1077 if (thisTime - self.lastPress) > 4: # Check to see if it's been 5 seconds since our last keystroke |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1078 # If we're not already typing, then self.lastSend will be 0 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1079 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1080 self.sendTyping(0) # send a typing event here (0 for False) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1081 # This subroutine actually takes care of sending the messages for typing/not_typing events |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1082 # |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1083 # self: duh |
118 | 1084 # typing: boolean |
1085 | |
129 | 1086 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1087 def sendTyping(self, typing): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1088 if typing: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1089 self.lastSend = time.time() # remember our send time for use in myKeyHook() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1090 #I think this is cleaner |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1091 status_text = self.settings.get_setting('TypingStatusAlias') |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1092 if status_text == "" or status_text == None: status_text = "Typing" |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1093 self.session.set_text_status(status_text) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1094 else: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1095 self.lastSend = 0 # set lastSend to zero to indicate we're not typing |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1096 #I think this is cleaner |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1097 status_text = self.settings.get_setting('IdleStatusAlias') |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1098 if status_text == "" or status_text == None: status_text = "Idle" |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1099 self.session.set_text_status(status_text) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1100 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1101 # This subroutine sets the colors of the chat based on the settings in the |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1102 # self instance. |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1103 # |
118 | 1104 # !self : instance of self |
129 | 1105 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1106 def set_colors(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1107 # chat window backround color |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1108 self.bgcolor = self.settings.get_setting('bgcolor') |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1109 # chat window normal text color |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1110 self.textcolor = self.settings.get_setting('textcolor') |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1111 # color of text player types |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1112 self.mytextcolor = self.settings.get_setting('mytextcolor') |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1113 # color of system warnings |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1114 self.syscolor = self.settings.get_setting('syscolor') |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1115 # color of system info messages |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1116 self.infocolor = self.settings.get_setting('infocolor') |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1117 # color of emotes |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1118 self.emotecolor = self.settings.get_setting('emotecolor') |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1119 # color of whispers |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1120 self.whispercolor = self.settings.get_setting('whispercolor') |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1121 # def set_colors - end |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1122 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1123 # This subroutine will insert text into the chat window |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1124 # |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1125 # !self : instance of self |
118 | 1126 # !txt : text to be inserted into the chat window |
129 | 1127 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1128 def set_chat_text(self, txt): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1129 self.chattxt.SetValue(txt) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1130 self.chattxt.SetFocus() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1131 self.chattxt.SetInsertionPointEnd() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1132 # def set_chat_text - end |
118 | 1133 |
129 | 1134 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1135 def get_chat_text(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1136 return self.chattxt.GetValue() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1137 |
118 | 1138 # This subroutine sets the focus to the chat window |
129 | 1139 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1140 def set_chat_text_focus(self, event): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1141 wx.CallAfter(self.chattxt.SetFocus) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1142 # def set_chat_text_focus - end |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1143 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1144 # This subrtouine grabs the user input and make the special keys and |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1145 # modifiers work. |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1146 # |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1147 # !self : instance of self |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1148 # !event : |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1149 # |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1150 # Note: self.chattxt now handles it's own Key events. It does, however still |
118 | 1151 # call it's parent's (self) OnChar to handle "default" behavior. |
129 | 1152 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1153 def OnChar(self, event): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1154 s = self.chattxt.GetValue() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1155 #self.histlen = len(self.history) - 1 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1156 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1157 ## RETURN KEY (no matter if there is text in chattxt) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1158 # This section is run even if there is nothing in the chattxt (as opposed to the next wx.WXK_RETURN handler |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1159 if event.GetKeyCode() == wx.WXK_RETURN: |
66 | 1160 logger.debug("event.GetKeyCode() == wx.WXK_RETURN") |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1161 self.set_colors() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1162 if self.session.get_status() == MPLAY_CONNECTED: # only do if we're connected |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1163 self.sendTyping(0) # Send a "not_typing" event on enter key press |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1164 macroText="" |
118 | 1165 recycle_bin = {wx.WXK_F1: 'event.GetKeyCode() == wx.WXK_F1', wx.WXK_F2: 'event.GetKeyCode() == wx.WXK_F2', |
1166 wx.WXK_F3: 'event.GetKeyCode() == wx.WXK_F3', wx.WXK_F4: 'event.GetKeyCode() == wx.WXK_F4', | |
1167 wx.WXK_F5: 'event.GetKeyCode() == wx.WXK_F5', wx.WXK_F6: 'event.GetKeyCode() == wx.WXK_F6', | |
1168 wx.WXK_F7: 'event.GetKeyCode() == wx.WXK_F7', wx.WXK_F8: 'event.GetKeyCode() == wx.WXK_F8', | |
1169 wx.WXK_F9: 'event.GetKeyCode() == wx.WXK_F9', wx.WXK_F10: 'event.GetKeyCode() == wx.WXK_F10', | |
1170 wx.WXK_F11: 'event.GetKeyCode() == wx.WXK_F11', wx.WXK_F12: 'event.GetKeyCode() == wx.WXK_F12'} | |
1171 | |
1172 bin_event = event.GetKeyCode() | |
133 | 1173 if recycle_bin.has_key(bin_event): |
118 | 1174 logger.debug(lambda bin_event: recycle_bin[bin_event]) |
1175 macroText = self.settings.get_setting(recycle_bin[bin_event][29:]) | |
1176 recycle_bin = {}; del bin_event | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1177 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1178 # Append to the existing typed text as needed and make sure the status doesn't change back. |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1179 if len(macroText): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1180 self.sendTyping(0) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1181 s = macroText |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1182 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1183 ## RETURN KEY (and not text in control) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1184 if (event.GetKeyCode() == wx.WXK_RETURN and len(s)) or len(macroText): |
66 | 1185 logger.debug("(event.GetKeyCode() == wx.WXK_RETURN and len(s)) or len(macroText)") |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1186 self.histidx = -1 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1187 self.temptext = "" |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1188 self.history = [s] + self.history#prepended instead of appended now, so higher index = greater age |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1189 if not len(macroText): self.chattxt.SetValue("") |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1190 # play sound |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1191 sound_file = self.settings.get_setting("SendSound") |
71
449a8900f9ac
Code refining almost completed, for this round. Some included files are still in need of some clean up, but this is test worthy.
sirebral
parents:
69
diff
changeset
|
1192 if sound_file != '': component.get('sound').play(sound_file) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1193 if s[0] != "/": ## it's not a slash command |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1194 s = self.ParsePost( s, True, True ) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1195 else: self.chat_cmds.docmd(s) # emote is in chatutils.py |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1196 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1197 ## UP KEY |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1198 elif event.GetKeyCode() == wx.WXK_UP: |
66 | 1199 logger.debug("event.GetKeyCode() == wx.WXK_UP") |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1200 if self.histidx < len(self.history)-1: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1201 #text that's not in history but also hasn't been sent to chat gets stored in self.temptext |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1202 #this way if someone presses the up key, they don't lose their current message permanently |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1203 #(unless they also press enter at the time) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1204 if self.histidx is -1: self.temptext = self.chattxt.GetValue() |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1205 self.histidx += 1 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1206 self.chattxt.SetValue(self.history[self.histidx]) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1207 self.chattxt.SetInsertionPointEnd() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1208 else: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1209 self.histidx = len(self.history) -1#in case it got too high somehow, this should fix it |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1210 #self.InfoPost("**Going up? I don't think so.**") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1211 #print self.histidx, "in",self.history |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1212 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1213 ## DOWN KEY |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1214 elif event.GetKeyCode() == wx.WXK_DOWN: |
66 | 1215 logger.debug("event.GetKeyCode() == wx.WXK_DOWN") |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1216 #histidx of -1 indicates currently viewing text that's not in self.history |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1217 if self.histidx > -1: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1218 self.histidx -= 1 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1219 if self.histidx is -1: #remember, it just decreased |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1220 self.chattxt.SetValue(self.temptext) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1221 else: self.chattxt.SetValue(self.history[self.histidx]) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1222 self.chattxt.SetInsertionPointEnd() |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1223 else: self.histidx = -1 #just in case it somehow got below -1, this should fix it |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1224 #self.InfoPost("**Going down? I don't think so.**") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1225 #print self.histidx, "in",self.history |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1226 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1227 ## TAB KEY |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1228 elif event.GetKeyCode() == wx.WXK_TAB: |
66 | 1229 logger.debug("event.GetKeyCode() == wx.WXK_TAB") |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1230 if s !="": |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1231 found = 0 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1232 nicks = [] |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1233 testnick = "" |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1234 inlength = len(s) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1235 for getnames in self.session.players.keys(): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1236 striphtmltag = re.compile ('<[^>]+>*') |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1237 testnick = striphtmltag.sub ("", self.session.players[getnames][0]) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1238 if string.lower(s) == string.lower(testnick[:inlength]): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1239 found = found + 1 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1240 nicks[len(nicks):]=[testnick] |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1241 if found == 0: ## no nick match |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1242 self.Post(self.colorize(self.syscolor," ** No match found")) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1243 elif found > 1: ## matched more than 1, tell user what matched |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1244 nickstring = "" |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1245 nicklist = [] |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1246 for foundnicks in nicks: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1247 nickstring = nickstring + foundnicks + ", " |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1248 nicklist.append(foundnicks) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1249 nickstring = nickstring[:-2] |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1250 self.Post(self.colorize(self.syscolor, " ** Multiple matches found: " + nickstring)) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1251 # set text to the prefix match between first two matches |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1252 settext = re.match(''.join(map(lambda x: '(%s?)' % x, string.lower(nicklist[0]))), string.lower(nicklist[1])).group() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1253 # run through the rest of the nicks |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1254 for i in nicklist: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1255 settext = re.match(''.join(map(lambda x: '(%s?)' % x, string.lower(i))), string.lower(settext)).group() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1256 if settext: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1257 self.chattxt.SetValue(settext) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1258 self.chattxt.SetInsertionPointEnd() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1259 else: ## put the matched name in the chattxt box |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1260 settext = nicks[0] + ": " |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1261 self.chattxt.SetValue(settext) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1262 self.chattxt.SetInsertionPointEnd() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1263 else: ## not online, and no text in chattxt box |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1264 self.Post(self.colorize(self.syscolor, " ** That's the Tab key, Dave")) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1265 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1266 ## PAGE UP |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1267 elif event.GetKeyCode() in (wx.WXK_PRIOR, wx.WXK_PAGEUP): |
66 | 1268 logger.debug("event.GetKeyCode() in (wx.WXK_PRIOR, wx.WXK_PAGEUP)") |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1269 self.chatwnd.ScrollPages(-1) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1270 if not self.lockscroll: self.lock_scroll(0) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1271 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1272 ## PAGE DOWN |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1273 elif event.GetKeyCode() in (wx.WXK_NEXT, wx.WXK_PAGEDOWN): |
66 | 1274 logger.debug("event.GetKeyCode() in (wx.WXK_NEXT, wx.WXK_PAGEDOWN)") |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1275 if not self.lockscroll: self.lock_scroll(0) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1276 if ((self.chatwnd.GetScrollRange(1)-self.chatwnd.GetScrollPos(1)-self.chatwnd.GetScrollThumb(1) < 30) and self.lockscroll): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1277 self.lock_scroll(0) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1278 self.chatwnd.ScrollPages(1) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1279 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1280 ## END |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1281 elif event.GetKeyCode() == wx.WXK_END: |
79
dd4be4817377
Chat Window no longer prints excessive debug statements to console. Renamed the Update Manager menu item to Traipse Suite. Added debug console to Traipse Suite. Log now prints an error report and waits for user input so Windows users can see the error being reported.
sirebral
parents:
71
diff
changeset
|
1282 logger.debug("event.GetKeyCode() == wx.WXK_END") |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1283 if self.lockscroll: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1284 self.lock_scroll(0) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1285 self.Post() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1286 event.Skip() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1287 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1288 ## NOTHING |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1289 else: event.Skip() |
79
dd4be4817377
Chat Window no longer prints excessive debug statements to console. Renamed the Update Manager menu item to Traipse Suite. Added debug console to Traipse Suite. Log now prints an error report and waits for user input so Windows users can see the error being reported.
sirebral
parents:
71
diff
changeset
|
1290 logger.debug("Exit chat_panel->OnChar(self, event)") |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1291 # def OnChar - end |
118 | 1292 |
129 | 1293 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1294 def onDieRoll(self, evt): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1295 """Roll the dice based on the button pressed and the die modifiers entered, if any.""" |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1296 # Get any die modifiers if they have been entered |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1297 numDie = self.numDieText.GetValue() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1298 dieMod = self.dieModText.GetValue() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1299 dieText = numDie |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1300 # Now, apply and roll die mods based on the button that was pressed |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1301 id = evt.GetId() |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1302 if self.dieIDs.has_key(id): dieText += self.dieIDs[id] |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1303 if len(dieMod) and dieMod[0] not in "*/-+": dieMod = "+" + dieMod |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1304 dieText += dieMod |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1305 dieText = "[" + dieText + "]" |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1306 self.ParsePost(dieText, 1, 1) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1307 self.chattxt.SetFocus() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1308 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1309 # This subroutine saves a chat buffer as html to a file chosen via a |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1310 # FileDialog. |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1311 # |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1312 # !self : instance of self |
118 | 1313 # !evt : |
129 | 1314 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1315 def on_chat_save(self, evt): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1316 f = wx.FileDialog(self,"Save Chat Buffer",".","","HTM* (*.htm*)|*.htm*|HTML (*.html)|*.html|HTM (*.htm)|*.htm",wx.SAVE) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1317 if f.ShowModal() == wx.ID_OK: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1318 file = open(f.GetPath(), "w") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1319 file.write(self.ResetPage() + "</body></html>") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1320 file.close() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1321 f.Destroy() |
71
449a8900f9ac
Code refining almost completed, for this round. Some included files are still in need of some clean up, but this is test worthy.
sirebral
parents:
69
diff
changeset
|
1322 os.chdir(dir_struct["home"]) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1323 # def on_chat_save - end |
118 | 1324 |
129 | 1325 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1326 def ResetPage(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1327 self.set_colors() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1328 buffertext = self.chatwnd.Header() + "\n" |
118 | 1329 buffertext += chat_util.strip_body_tags(self.chatwnd.StripHeader()).replace("<br>", |
1330 "<br />").replace('</html>', | |
1331 '').replace("<br />", | |
66 | 1332 "<br />\n").replace("\n\n", '') |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1333 return buffertext |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1334 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1335 # This subroutine sets the color of selected text, or base text color if |
118 | 1336 # nothing is selected |
129 | 1337 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1338 def on_text_color(self, event): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1339 hexcolor = self.r_h.do_hex_color_dlg(self) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1340 if hexcolor != None: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1341 (beg,end) = self.chattxt.GetSelection() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1342 if beg != end: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1343 txt = self.chattxt.GetValue() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1344 txt = txt[:beg]+self.colorize(hexcolor,txt[beg:end]) +txt[end:] |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1345 self.chattxt.SetValue(txt) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1346 self.chattxt.SetInsertionPointEnd() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1347 self.chattxt.SetFocus() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1348 else: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1349 self.color_button.SetBackgroundColour(hexcolor) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1350 self.mytextcolor = hexcolor |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1351 self.settings.set_setting('mytextcolor',hexcolor) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1352 self.set_colors() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1353 self.Post() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1354 # def on_text_color - end |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1355 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1356 # This subroutine take a color and a text string and formats it into html. |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1357 # |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1358 # !self : instance of self |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1359 # !color : color for the text to be set |
118 | 1360 # !text : text string to be included in the html. |
129 | 1361 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1362 def colorize(self, color, text): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1363 """Puts font tags of 'color' around 'text' value, and returns the string""" |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1364 return "<font color='" + color + "'>" + text + "</font>" |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1365 # def colorize - end |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1366 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1367 # This subroutine takes and event and inserts text with the basic format |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1368 # tags included. |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1369 # |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1370 # !self : instance of self |
118 | 1371 # !event : |
129 | 1372 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1373 def on_text_format(self, event): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1374 id = event.GetId() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1375 txt = self.chattxt.GetValue() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1376 (beg,end) = self.chattxt.GetSelection() |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1377 if beg != end: sel_txt = txt[beg:end] |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1378 else: sel_txt = txt |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1379 if id == self.boldButton.GetId(): sel_txt = "<b>" + sel_txt + "</b>" |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1380 elif id == self.italicButton.GetId(): sel_txt = "<i>" + sel_txt + "</i>" |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1381 elif id == self.underlineButton.GetId(): sel_txt = "<u>" + sel_txt + "</u>" |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1382 if beg != end: txt = txt[:beg] + sel_txt + txt[end:] |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1383 else: txt = sel_txt |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1384 self.chattxt.SetValue(txt) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1385 self.chattxt.SetInsertionPointEnd() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1386 self.chattxt.SetFocus() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1387 # def on_text_format - end |
118 | 1388 |
129 | 1389 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1390 def lock_scroll(self, event): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1391 if self.lockscroll: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1392 self.lockscroll = False |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1393 self.scroll_lock.SetLabel("Scroll ON") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1394 if len(self.storedata) != 0: |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1395 for line in self.storedata: self.chatwnd.AppendToPage(line) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1396 self.storedata = [] |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1397 self.scroll_down() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1398 else: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1399 self.lockscroll = True |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1400 self.scroll_lock.SetLabel("Scroll OFF") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1401 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1402 # This subroutine will popup a text window with the chatbuffer contents |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1403 # |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1404 # !self : instance of self |
118 | 1405 # !event : |
129 | 1406 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1407 def pop_textpop(self, event): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1408 """searchable popup text view of chatbuffer""" |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1409 h_buffertext = self.ResetPage() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1410 h_dlg = orpgScrolledMessageFrameEditor(self, h_buffertext, "Text View of Chat Window", None, (500,300)) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1411 h_dlg.Show(True) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1412 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1413 # This subroutine will change the dimension of the window |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1414 # |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1415 # !self : instance of self |
118 | 1416 # !event : |
129 | 1417 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1418 def OnSize(self, event=None): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1419 event.Skip() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1420 wx.CallAfter(self.scroll_down) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1421 # def OnSize - end |
118 | 1422 |
129 | 1423 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1424 def scroll_down(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1425 self.Freeze() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1426 self.chatwnd.scroll_down() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1427 self.Thaw() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1428 |
118 | 1429 ###### message helpers ###### |
129 | 1430 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1431 def PurgeChat(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1432 self.set_colors() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1433 self.chatwnd.SetPage(self.chatwnd.Header()) |
118 | 1434 |
129 | 1435 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1436 def system_message(self, text): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1437 self.send_chat_message(text,chat_msg.SYSTEM_MESSAGE) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1438 self.SystemPost(text) |
118 | 1439 |
129 | 1440 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1441 def info_message(self, text): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1442 self.send_chat_message(text,chat_msg.INFO_MESSAGE) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1443 self.InfoPost(text) |
118 | 1444 |
129 | 1445 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1446 def get_gms(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1447 the_gms = [] |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1448 for playerid in self.session.players: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1449 if len(self.session.players[playerid])>7: |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1450 if self.session.players[playerid][7]=="GM" and self.session.group_id != '0': the_gms += [playerid] |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1451 return the_gms |
118 | 1452 |
129 | 1453 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1454 def GetName(self): |
66 | 1455 self.AliasLib = component.get('alias') |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1456 player = self.session.get_my_info() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1457 if self.AliasLib != None: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1458 self.AliasLib.alias = self.aliasList.GetStringSelection(); |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1459 if self.AliasLib.alias[0] != self.defaultAliasName: |
66 | 1460 logger.debug("Exit chat_panel->GetName(self)") |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1461 return [self.chat_display_name([self.AliasLib.alias[0], player[1], player[2]]), self.AliasLib.alias[1]] |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1462 return [self.chat_display_name(player), "Default"] |
118 | 1463 |
129 | 1464 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1465 def GetFilteredText(self, text): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1466 advregex = re.compile('\"(.*?)\"', re.I) |
66 | 1467 self.AliasLib = component.get('alias') |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1468 if self.AliasLib != None: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1469 self.AliasLib.filter = self.filterList.GetSelection()-1; |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1470 for rule in self.AliasLib.filterRegEx: |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1471 if not self.advancedFilter: text = re.sub(rule[0], rule[1], text) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1472 else: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1473 for m in advregex.finditer(text): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1474 match = m.group(0) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1475 newmatch = re.sub(rule[0], rule[1], match) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1476 text = text.replace(match, newmatch) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1477 return text |
118 | 1478 |
129 | 1479 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1480 def emote_message(self, text): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1481 text = self.NormalizeParse(text) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1482 text = self.colorize(self.emotecolor, text) |
118 | 1483 |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1484 if self.type == MAIN_TAB and self.sendtarget == 'all': self.send_chat_message(text,chat_msg.EMOTE_MESSAGE) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1485 elif self.type == MAIN_TAB and self.sendtarget == "gm": |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1486 msg_type = chat_msg.WHISPER_EMOTE_MESSAGE |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1487 the_gms = self.get_gms() |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1488 for each_gm in the_gms: self.send_chat_message(text,chat_msg.WHISPER_EMOTE_MESSAGE, str(each_gm)) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1489 elif self.type == GROUP_TAB and WG_LIST.has_key(self.sendtarget): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1490 for pid in WG_LIST[self.sendtarget]: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1491 self.send_chat_message(text,chat_msg.WHISPER_EMOTE_MESSAGE, str(pid)) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1492 elif self.type == WHISPER_TAB: self.send_chat_message(text,chat_msg.WHISPER_EMOTE_MESSAGE, str(self.sendtarget)) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1493 elif self.type == NULL_TAB: pass |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1494 name = self.GetName()[0] |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1495 text = "** " + name + " " + text + " **" |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1496 self.EmotePost(text) |
118 | 1497 |
129 | 1498 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1499 def whisper_to_players(self, text, player_ids): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1500 tabbed_whispers_p = self.settings.get_setting("tabbedwhispers") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1501 # Heroman - apply any filtering selected |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1502 text = self.NormalizeParse(text) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1503 player_names = "" |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1504 # post to our chat before we colorize |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1505 for m in player_ids: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1506 id = m.strip() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1507 if self.session.is_valid_id(id): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1508 returned_name = self.session.get_player_by_player_id(id)[0] |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1509 player_names += returned_name |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1510 player_names += ", " |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1511 else: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1512 player_names += " Unknown!" |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1513 player_names += ", " |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1514 comma = "," |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1515 comma.join(player_ids) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1516 if (self.sendtarget == "all"): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1517 self.InfoPost("<i>whispering to "+ player_names + " " + text + "</i> ") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1518 # colorize and loop, sending whisper messages to all valid clients |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1519 text = self.colorize(self.mytextcolor, text) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1520 for id in player_ids: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1521 id = id.strip() |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1522 if self.session.is_valid_id(id): self.send_chat_message(text,chat_msg.WHISPER_MESSAGE,id) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1523 else: self.InfoPost(id + " Unknown!") |
118 | 1524 |
129 | 1525 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1526 def send_chat_message(self, text, type=chat_msg.CHAT_MESSAGE, player_id="all"): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1527 #########send_msg()############# |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1528 send = 1 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1529 for plugin_fname in self.activeplugins.keys(): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1530 plugin = self.activeplugins[plugin_fname] |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1531 try: text, send = plugin.send_msg(text, send) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1532 except Exception, e: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1533 if str(e) != "'module' object has no attribute 'send_msg'": |
66 | 1534 logger.general(traceback.format_exc()) |
1535 logger.general("EXCEPTION: " + str(e)) | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1536 msg = chat_msg.chat_msg() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1537 msg.set_text(text) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1538 msg.set_type(type) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1539 turnedoff = False |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1540 if self.settings.get_setting("ShowIDInChat") == "1": |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1541 turnedoff = True |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1542 self.settings.set_setting("ShowIDInChat", "0") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1543 playername = self.GetName()[0] |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1544 |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1545 if turnedoff: self.settings.set_setting("ShowIDInChat", "1") |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1546 msg.set_alias(playername) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1547 if send: self.session.send(msg.toxml(),player_id) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1548 del msg |
118 | 1549 |
1550 #### incoming chat message handler ##### | |
129 | 1551 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1552 def post_incoming_msg(self, msg, player): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1553 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1554 # pull data |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1555 type = msg.get_type() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1556 text = msg.get_text() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1557 alias = msg.get_alias() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1558 # who sent us the message? |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1559 if alias: display_name = self.chat_display_name([alias, player[1], player[2]]) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1560 elif player: display_name = self.chat_display_name(player) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1561 else: display_name = "Server Administrator" |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1562 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1563 ######### START plugin_incoming_msg() ########### |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1564 for plugin_fname in self.activeplugins.keys(): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1565 plugin = self.activeplugins[plugin_fname] |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1566 try: text, type, name = plugin.plugin_incoming_msg(text, type, display_name, player) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1567 except Exception, e: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1568 if str(e) != "'module' object has no attribute 'receive_msg'": |
66 | 1569 logger.general(traceback.format_exc()) |
1570 logger.general("EXCEPTION: " + str(e)) | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1571 #end mDuo13 added code |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1572 #image stripping for players' names |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1573 strip_img = self.settings.get_setting("Show_Images_In_Chat") |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1574 if (strip_img == "0"): display_name = chat_util.strip_img_tags(display_name) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1575 #end image stripping. --mDuo13, July 11th, 2005 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1576 # default sound |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1577 recvSound = "RecvSound" |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1578 # act on the type of messsage |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1579 if (type == chat_msg.CHAT_MESSAGE): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1580 text = "<b>" + display_name + "</b>: " + text |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1581 self.Post(text) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1582 self.parent.newMsg(0) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1583 elif type == chat_msg.WHISPER_MESSAGE or type == chat_msg.WHISPER_EMOTE_MESSAGE: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1584 tabbed_whispers_p = self.settings.get_setting("tabbedwhispers") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1585 displaypanel = self |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1586 whisperingstring = " (whispering): " |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1587 panelexists = 0 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1588 GMWhisperTab = self.settings.get_setting("GMWhisperTab") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1589 GroupWhisperTab = self.settings.get_setting("GroupWhisperTab") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1590 name = '<i><b>' + display_name + '</b>: ' |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1591 text += '</i>' |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1592 panelexists = 0 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1593 created = 0 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1594 try: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1595 if GMWhisperTab == '1': |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1596 the_gms = self.get_gms() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1597 #Check if whisper if from a GM |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1598 if player[2] in the_gms: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1599 msg = name + ' (GM Whisper:) ' + text |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1600 if type == chat_msg.WHISPER_MESSAGE: self.parent.GMChatPanel.Post(msg) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1601 else: self.parent.GMChatPanel.EmotePost("**" + msg + "**") |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1602 idx = self.parent.get_tab_index(self.parent.GMChatPanel) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1603 self.parent.newMsg(idx) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1604 panelexists = 1 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1605 #See if message if from someone in our groups or for a whisper tab we already have |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1606 if not panelexists and GroupWhisperTab == "1": |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1607 for panel in self.parent.group_tabs: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1608 if WG_LIST.has_key(panel.sendtarget) and WG_LIST[panel.sendtarget].has_key(int(player[2])): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1609 msg = name + text |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1610 if type == chat_msg.WHISPER_MESSAGE: panel.Post(msg) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1611 else: panel.EmotePost("**" + msg + "**") |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1612 idx = self.parent.get_tab_index(panel) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1613 self.parent.newMsg(idx) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1614 panelexists = 1 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1615 break |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1616 if not panelexists and tabbed_whispers_p == "1": |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1617 for panel in self.parent.whisper_tabs: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1618 #check for whisper tabs as well, to save the number of loops |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1619 if panel.sendtarget == player[2]: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1620 msg = name + whisperingstring + text |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1621 if type == chat_msg.WHISPER_MESSAGE: panel.Post(msg) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1622 else: panel.EmotePost("**" + msg + "**") |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1623 idx = self.parent.get_tab_index(panel) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1624 self.parent.newMsg(idx) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1625 panelexists = 1 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1626 break |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1627 #We did not fint the tab |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1628 if not panelexists: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1629 #If we get here the tab was not found |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1630 if GroupWhisperTab == "1": |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1631 for group in WG_LIST.keys(): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1632 #Check if this group has the player in it |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1633 if WG_LIST[group].has_key(int(player[2])): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1634 #Yup, post message. Player may be in more then 1 group so continue as well |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1635 panel = self.parent.create_group_tab(group) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1636 msg = name + text |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1637 if type == chat_msg.WHISPER_MESSAGE: wx.CallAfter(panel.Post, msg) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1638 else: wx.CallAfter(panel.EmotePost, "**" + msg + "**") |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1639 created = 1 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1640 #Check to see if we should create a whisper tab |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1641 if not created and tabbed_whispers_p == "1": |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1642 panel = self.parent.create_whisper_tab(player[2]) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1643 msg = name + whisperingstring + text |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1644 if type == chat_msg.WHISPER_MESSAGE: wx.CallAfter(panel.Post, msg) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1645 else: wx.CallAfter(panel.EmotePost, "**" + msg + "**") |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1646 created = 1 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1647 #Final check |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1648 if not created: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1649 #No tabs to create, just send the message to the main chat tab |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1650 msg = name + whisperingstring + text |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1651 if type == chat_msg.WHISPER_MESSAGE: self.parent.MainChatPanel.Post(msg) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1652 else: self.parent.MainChatPanel.EmotePost("**" + msg + "**") |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1653 self.parent.newMsg(0) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1654 except Exception, e: |
66 | 1655 logger.general(traceback.format_exc()) |
1656 logger.general("EXCEPTION: 'Error in posting whisper message': " + str(e)) | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1657 elif (type == chat_msg.EMOTE_MESSAGE): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1658 text = "** " + display_name + " " + text + " **" |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1659 self.EmotePost(text) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1660 self.parent.newMsg(0) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1661 elif (type == chat_msg.INFO_MESSAGE): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1662 text = "<b>" + display_name + "</b>: " + text |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1663 self.InfoPost(text) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1664 self.parent.newMsg(0) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1665 elif (type == chat_msg.SYSTEM_MESSAGE): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1666 text = "<b>" + display_name + "</b>: " + text |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1667 self.SystemPost(text) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1668 self.parent.newMsg(0) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1669 # playe sound |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1670 sound_file = self.settings.get_setting(recvSound) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1671 if sound_file != '': |
71
449a8900f9ac
Code refining almost completed, for this round. Some included files are still in need of some clean up, but this is test worthy.
sirebral
parents:
69
diff
changeset
|
1672 component.get('sound').play(sound_file) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1673 #### Posting helpers ##### |
118 | 1674 |
129 | 1675 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1676 def InfoPost(self, s): |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1677 self.Post(self.colorize(self.infocolor, s), c='info') |
118 | 1678 |
129 | 1679 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1680 def SystemPost(self, s): |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1681 self.Post(self.colorize(self.syscolor, s), c='system') |
118 | 1682 |
129 | 1683 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1684 def EmotePost(self, s): |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1685 self.Post(self.colorize(self.emotecolor, s), c='emote') |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1686 |
118 | 1687 #### Standard Post method ##### |
129 | 1688 |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1689 def Post(self, s="", send=False, myself=False, c='post'): |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1690 strip_p = self.settings.get_setting("striphtml") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1691 strip_img = self.settings.get_setting("Show_Images_In_Chat")#moved back 7-11-05. --mDuo13 |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1692 if (strip_p == "1"): s = strip_html(s) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1693 if (strip_img == "0"): s = chat_util.strip_img_tags(s) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1694 s = chat_util.simple_html_repair(s) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1695 s = chat_util.strip_script_tags(s) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1696 s = chat_util.strip_li_tags(s) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1697 s = chat_util.strip_body_tags(s) #7-27-05 mDuo13 |
118 | 1698 s = chat_util.strip_misalignment_tags(s) #7-27-05 mDuo13 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1699 aliasInfo = self.GetName() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1700 display_name = aliasInfo[0] |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1701 if aliasInfo[1] != 'Default': |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1702 defaultcolor = self.settings.get_setting("mytextcolor") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1703 self.settings.set_setting("mytextcolor", aliasInfo[1]) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1704 self.set_colors() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1705 newline = '' |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1706 #following added by mDuo13 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1707 #########post_msg() - other########## |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1708 if not myself and not send: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1709 for plugin_fname in self.activeplugins.keys(): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1710 plugin = self.activeplugins[plugin_fname] |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1711 try: s = plugin.post_msg(s, myself) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1712 except Exception, e: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1713 if str(e) != "'module' object has no attribute 'post_msg'": |
66 | 1714 logger.general(traceback.format_exc()) |
1715 logger.general("EXCEPTION: " + str(e)) | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1716 #end mDuo13 added code |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1717 if myself: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1718 name = "<b>" + display_name + "</b>: " |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1719 s = self.colorize(self.mytextcolor, s) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1720 else: name = "" |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1721 if aliasInfo[1] != 'Default': |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1722 self.settings.set_setting("mytextcolor", defaultcolor) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1723 self.set_colors() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1724 #following line based on sourceforge patch #880403 from mDuo |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1725 # EDIT: Had to rework blank line check to handle malformed HTML throwing error. |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1726 # this limits the effectiveness of this check -SD |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1727 lineHasText = 1 |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1728 try: lineHasText = strip_html(s).replace(" ","").replace(" ","").strip()!="" |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1729 except: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1730 # HTML parser has errored out (most likely). Being as all we are doing is |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1731 # scanning for empty/blank lines anyway there is no harm in letting a |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1732 # troublesome message though. Worst case is a blank line to chat. |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1733 lineHasText = 1 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1734 if lineHasText: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1735 #following added by mDuo13 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1736 if myself: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1737 s2 = s |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1738 ########post_msg() - self ####### |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1739 for plugin_fname in self.activeplugins.keys(): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1740 plugin = self.activeplugins[plugin_fname] |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1741 try: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1742 s2 = plugin.post_msg(s2, myself) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1743 except Exception, e: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1744 if str(e) != "'module' object has no attribute 'post_msg'": |
66 | 1745 logger.general(traceback.format_exc()) |
1746 logger.general("EXCEPTION: " + str(e)) | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1747 if s2 != "": |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1748 #Italici the messages from tabbed whispers |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1749 if self.type == WHISPER_TAB or self.type == GROUP_TAB or self.sendtarget == 'gm': |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1750 s2 = s2 + '</i>' |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1751 name = '<i>' + name |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1752 if self.type == WHISPER_TAB: name += " (whispering): " |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1753 elif self.type == GROUP_TAB: name += self.settings.get_setting("gwtext") + ' ' |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1754 elif self.sendtarget == 'gm': name += " (whispering to GM) " |
63 | 1755 newline = "<div class='"+c+"'> " + self.TimeIndexString() + name + s2 + "</div>" |
1756 log( self.settings, c, name+s2 ) | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1757 else: |
118 | 1758 newline = "<div class='"+c+"'> " + self.TimeIndexString() + name + s + "</div>" |
63 | 1759 log( self.settings, c, name+s ) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1760 else: send = False |
71
449a8900f9ac
Code refining almost completed, for this round. Some included files are still in need of some clean up, but this is test worthy.
sirebral
parents:
69
diff
changeset
|
1761 newline = component.get('xml').strip_unicode(newline) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1762 if self.lockscroll == 0: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1763 self.chatwnd.AppendToPage(newline) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1764 self.scroll_down() |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1765 else: self.storedata.append(newline) |
133 | 1766 if send: |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1767 if self.type == MAIN_TAB and self.sendtarget == 'all': self.send_chat_message(s) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1768 elif self.type == MAIN_TAB and self.sendtarget == "gm": |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1769 the_gms = self.get_gms() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1770 self.whisper_to_players(s, the_gms) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1771 elif self.type == GROUP_TAB and WG_LIST.has_key(self.sendtarget): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1772 members = [] |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1773 for pid in WG_LIST[self.sendtarget]: members.append(str(WG_LIST[self.sendtarget][pid])) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1774 self.whisper_to_players(self.settings.get_setting("gwtext") + s, members) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1775 elif self.type == WHISPER_TAB: self.whisper_to_players(s, [self.sendtarget]) |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1776 elif self.type == NULL_TAB: pass |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1777 else: self.InfoPost("Failed to send message, unknown send type for this tab") |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1778 self.parsed=0 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1779 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1780 # |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1781 # TimeIndexString() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1782 # |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1783 # time indexing for chat display only (don't log time indexing) |
118 | 1784 # added by Snowdog 4/04 |
129 | 1785 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1786 def TimeIndexString(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1787 try: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1788 mtime = "" |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1789 if self.settings.get_setting('Chat_Time_Indexing') == "0": pass |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1790 elif self.settings.get_setting('Chat_Time_Indexing') == "1": |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1791 mtime = time.strftime("[%I:%M:%S] ", time.localtime()) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1792 return mtime |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1793 except Exception, e: |
66 | 1794 logger.general(traceback.format_exc()) |
1795 logger.general("EXCEPTION: " + str(e)) | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1796 return "[ERROR]" |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1797 |
118 | 1798 #### Post with parsing dice #### |
129 | 1799 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1800 def ParsePost(self, s, send=False, myself=False): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1801 s = self.NormalizeParse(s) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1802 self.set_colors() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1803 self.Post(s,send,myself) |
118 | 1804 |
129 | 1805 |
118 | 1806 def NormalizeParse(self, s): |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1807 for plugin_fname in self.activeplugins.keys(): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1808 plugin = self.activeplugins[plugin_fname] |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1809 try: s = plugin.pre_parse(s) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1810 except Exception, e: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1811 if str(e) != "'module' object has no attribute 'post_msg'": |
66 | 1812 logger.general(traceback.format_exc()) |
1813 logger.general("EXCEPTION: " + str(e)) | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1814 if self.parsed == 0: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1815 s = self.ParseNode(s) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1816 s = self.ParseDice(s) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1817 s = self.ParseFilter(s) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1818 self.parsed = 1 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1819 return s |
118 | 1820 |
129 | 1821 |
118 | 1822 def ParseFilter(self, s): |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1823 s = self.GetFilteredText(s) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1824 return s |
129 | 1825 |
118 | 1826 def ParseNode(self, s): |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1827 """Parses player input for embedded nodes rolls""" |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1828 cur_loc = 0 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1829 #[a-zA-Z0-9 _\-\.] |
129 | 1830 reg = re.compile("(!@(.*?)@!)") |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1831 matches = reg.findall(s) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1832 for i in xrange(0,len(matches)): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1833 newstr = self.ParseNode(self.resolve_nodes(matches[i][1])) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1834 s = s.replace(matches[i][0], newstr, 1) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1835 return s |
118 | 1836 |
129 | 1837 |
118 | 1838 def ParseDice(self, s): |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1839 """Parses player input for embedded dice rolls""" |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1840 reg = re.compile("\[([^]]*?)\]") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1841 matches = reg.findall(s) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1842 for i in xrange(0,len(matches)): |
118 | 1843 newstr = self.PraseUnknowns(matches[i]) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1844 qmode = 0 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1845 newstr1 = newstr |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1846 if newstr[0].lower() == 'q': |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1847 newstr = newstr[1:] |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1848 qmode = 1 |
71
449a8900f9ac
Code refining almost completed, for this round. Some included files are still in need of some clean up, but this is test worthy.
sirebral
parents:
69
diff
changeset
|
1849 try: newstr = component.get('DiceManager').proccessRoll(newstr) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1850 except: pass |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1851 if qmode == 1: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1852 s = s.replace("[" + matches[i] + "]", "<!-- Official Roll [" + newstr1 + "] => " + newstr + "-->" + newstr, 1) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1853 else: s = s.replace("[" + matches[i] + "]", "[" + newstr1 + "<!-- Official Roll -->] => " + newstr, 1) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1854 return s |
118 | 1855 |
129 | 1856 |
118 | 1857 def PraseUnknowns(self, s): |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1858 # Uses a tuple. Usage: ?Label}dY. If no Label is assigned then use ?}DY |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1859 newstr = "0" |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1860 reg = re.compile("(\?\{*)([a-zA-Z ]*)(\}*)") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1861 matches = reg.findall(s) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1862 for i in xrange(0,len(matches)): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1863 lb = "Replace '?' with: " |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1864 if len(matches[i][0]): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1865 lb = matches[i][1] + "?: " |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1866 dlg = wx.TextEntryDialog(self, lb, "Missing Value?") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1867 dlg.SetValue('') |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1868 if matches[i][0] != '': |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1869 dlg.SetTitle("Enter Value for " + matches[i][1]) |
59
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1870 if dlg.ShowModal() == wx.ID_OK: newstr = dlg.GetValue() |
5aff3ef1ae46
New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates
sirebral
parents:
0
diff
changeset
|
1871 if newstr == '': newstr = '0' |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1872 s = s.replace(matches[i][0], newstr, 1).replace(matches[i][1], '', 1).replace(matches[i][2], '', 1) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1873 dlg.Destroy() |
118 | 1874 return s |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1875 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1876 # This subroutine builds a chat display name. |
118 | 1877 # |
129 | 1878 |
118 | 1879 def chat_display_name(self, player): |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1880 if self.settings.get_setting("ShowIDInChat") == "0": |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1881 display_name = player[0] |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1882 else: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1883 display_name = "("+player[2]+") " + player[0] |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1884 return display_name |
118 | 1885 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1886 # This subroutine will get a hex color and return it, or return nothing |
118 | 1887 # |
129 | 1888 |
118 | 1889 def get_color(self): |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1890 data = wx.ColourData() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1891 data.SetChooseFull(True) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1892 dlg = wx.ColourDialog(self, data) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1893 if dlg.ShowModal() == wx.ID_OK: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1894 data = dlg.GetColourData() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1895 (red,green,blue) = data.GetColour().Get() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1896 hexcolor = self.r_h.hexstring(red, green, blue) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1897 dlg.Destroy() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1898 return hexcolor |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1899 else: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1900 dlg.Destroy() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1901 return None |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1902 # def get_color - end |
118 | 1903 |
129 | 1904 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1905 def replace_quotes(self, s): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1906 in_tag = 0 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1907 i = 0 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1908 rs = s[:] |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1909 for c in s: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1910 if c == "<": |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1911 in_tag += 1 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1912 elif c == ">": |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1913 if in_tag: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1914 in_tag -= 1 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1915 elif c == '"': |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1916 if in_tag: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1917 rs = rs[:i] + "'" + rs[i+1:] |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1918 i += 1 |
118 | 1919 return rs |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1920 |
129 | 1921 def resolve_loop(self, node, path, step, depth): |
1922 if step == depth: | |
1923 self.resolution(node) | |
1924 else: | |
1925 child_list = node.findall('nodehandler') | |
1926 for child in child_list: | |
1927 if step == depth: break | |
1928 if child.get('name') == path[step]: | |
1929 node = child | |
1930 step += 1 | |
1931 self.resolve_loop(node, path, step, depth) | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1932 |
129 | 1933 def resolution(self, node): |
1934 if self.passed == False: | |
1935 self.passed = True | |
1936 if node.get('class') == 'textctrl_handler': self.data = str(node.find('text').text) | |
1937 else: self.data = 'Nodehandler for '+ node.get('class') + ' not done!' or 'No Data!' | |
1938 else: | |
1939 self.data = '' | |
132 | 1940 pass |
1941 self.data = self.ParseMap(self.data, node) | |
1942 | |
1943 def ParseMap(self, s, node): | |
1944 """Parses player input for embedded nodes rolls""" | |
1945 cur_loc = 0 | |
1946 reg = re.compile("(!!(.*?)!!)") | |
1947 matches = reg.findall(s) | |
1948 print matches | |
1949 for i in xrange(0,len(matches)): | |
1950 newstr = txt = '!@' + node.get('map') + '::' + matches[i][1] + '@!' | |
1951 s = s.replace(matches[i][0], newstr, 1) | |
1952 s = self.ParseNode(s) | |
1953 return s | |
129 | 1954 |
118 | 1955 def resolve_nodes(self, s): |
129 | 1956 self.passed = False |
1957 self.data = 'No Data!' | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1958 value = "" |
129 | 1959 path = s.split('::') |
1960 depth = len(path) | |
130 | 1961 self.gametree = component.get('tree') |
1962 dom = self.gametree.xml_root.getchildren() | |
129 | 1963 for node in dom: |
1964 if node.get('name') == path[0]: | |
1965 self.resolve_loop(node, path, 1, len(path)) | |
1966 return self.data |