comparison orpg/tools/aliaslib.py @ 73:7b752c9d0c28 ornery-dev

Alias Lib is now really stable. Awesome tool! Fix to Chat Notify, plugin now sets Plugin DB settings correctly.
author sirebral
date Thu, 20 Aug 2009 08:41:29 -0500
parents c54768cffbd4
children f38df4bf9715
comparison
equal deleted inserted replaced
72:8bc955faf819 73:7b752c9d0c28
27 # 27 #
28 28
29 __version__ = "$Id: aliaslib.py,v 1.20 2007/08/09 05:23:21 digitalxero Exp $" 29 __version__ = "$Id: aliaslib.py,v 1.20 2007/08/09 05:23:21 digitalxero Exp $"
30 30
31 from orpg.orpg_wx import * 31 from orpg.orpg_wx import *
32 from orpg.orpgCore import * 32 from orpg.orpgCore import component
33 from orpg.orpg_windows import createMaskedButton, orpgMultiCheckBoxDlg 33 from orpg.orpg_windows import createMaskedButton, orpgMultiCheckBoxDlg
34 from orpg.tools.rgbhex import RGBHex 34 from orpg.tools.rgbhex import RGBHex
35 import orpg.tools.orpg_log
36 from orpg.dirpath import dir_struct 35 from orpg.dirpath import dir_struct
37 import orpg.orpg_xml 36 from orpg.tools.validate import validate
38 import orpg.tools.validate 37 from orpg.tools.orpg_settings import settings
39 #import orpg.tools.orpg_settings 38 import re
40 39
41 class AliasLib(wx.Frame): 40 class AliasLib(wx.Frame):
42 def __init__(self): 41 def __init__(self):
43 self.orpgframe = component.get('frame') 42 self.orpgframe = component.get('frame')
44 self.log = component.get('log')
45 self.log.log("Enter AliasLib", ORPG_DEBUG)
46 wx.Frame.__init__(self, None, wx.ID_ANY, title="Alias Lib") 43 wx.Frame.__init__(self, None, wx.ID_ANY, title="Alias Lib")
47 self.orpgframe.Freeze() 44 self.orpgframe.Freeze()
48 self.Freeze() 45 self.Freeze()
49 self.SetOwnBackgroundColour('#EFEFEF') 46 self.SetOwnBackgroundColour('#EFEFEF')
50 self.dir_struct = dir_struct 47 self.filename = settings.get_setting('aliasfile') + '.alias'
51 self.settings = component.get('settings') 48 validate.config_file(self.filename, "default_alias.alias")
52 self.xml = component.get('xml')
53 self.validate = component.get('validate')
54 self.filename = self.settings.get_setting('aliasfile') + '.alias'
55 self.validate.config_file(self.filename, "default_alias.alias")
56 self.buildMenu() 49 self.buildMenu()
57 self.buildButtons() 50 self.buildButtons()
58 self.buildGUI() 51 self.buildGUI()
59 wx.CallAfter(self.InitSetup) 52 wx.CallAfter(self.InitSetup)
60 wx.CallAfter(self.loadFile) 53 wx.CallAfter(self.loadFile)
61 self.Thaw() 54 self.Thaw()
62 self.orpgframe.Thaw() 55 self.orpgframe.Thaw()
63 self.Bind(wx.EVT_CLOSE, self.OnMB_FileExit) 56 self.Bind(wx.EVT_CLOSE, self.OnMB_FileExit)
64 self.log.log("Exit AliasLib", ORPG_DEBUG)
65 57
66 def InitSetup(self): 58 def InitSetup(self):
67 self.chat = component.get('chat') 59 self.chat = component.get('chat')
68 self.gametree = component.get('tree') 60 self.gametree = component.get('tree')
69 self.map = component.get('map') 61 self.map = component.get('map')
70 self.session = component.get('session') 62 self.session = component.get('session')
71 63
72 def buildMenu(self): 64 def buildMenu(self):
73 self.log.log("Enter AliasLib->buildMenu(self)", ORPG_DEBUG)
74 filemenu = wx.Menu() 65 filemenu = wx.Menu()
75 item = wx.MenuItem(filemenu, wx.ID_ANY, "&New\tCtrl+N", "New ALias Lib") 66 item = wx.MenuItem(filemenu, wx.ID_ANY, "&New\tCtrl+N", "New ALias Lib")
76 self.Bind(wx.EVT_MENU, self.OnMB_FileNew, item) 67 self.Bind(wx.EVT_MENU, self.OnMB_FileNew, item)
77 filemenu.AppendItem(item) 68 filemenu.AppendItem(item)
78 item = wx.MenuItem(filemenu, wx.ID_ANY, "&Open\tCtrl+O", "Open Alias Lib") 69 item = wx.MenuItem(filemenu, wx.ID_ANY, "&Open\tCtrl+O", "Open Alias Lib")
127 menu.Append(filemenu, "&File") 118 menu.Append(filemenu, "&File")
128 menu.Append(aliasmenu, "&Alias") 119 menu.Append(aliasmenu, "&Alias")
129 menu.Append(filtermenu, "&Filter") 120 menu.Append(filtermenu, "&Filter")
130 menu.Append(transmitmenu, "&Transmit") 121 menu.Append(transmitmenu, "&Transmit")
131 self.SetMenuBar(menu) 122 self.SetMenuBar(menu)
132 self.log.log("Exit AliasLib->buildMenu(self)", ORPG_DEBUG)
133 123
134 def OnMB_FileNew(self, event): 124 def OnMB_FileNew(self, event):
135 self.log.log("Enter AliasLib->OnMB_FileNew(self, event)", ORPG_DEBUG)
136 oldfilename = self.filename 125 oldfilename = self.filename
137 dlg = wx.TextEntryDialog(self, "Please Name This Alias Lib", "New Alias Lib") 126 dlg = wx.TextEntryDialog(self, "Please Name This Alias Lib", "New Alias Lib")
138 if dlg.ShowModal() == wx.ID_OK: 127 if dlg.ShowModal() == wx.ID_OK:
139 self.filename = dlg.GetValue() + '.alias' 128 self.filename = dlg.GetValue() + '.alias'
140 dlg.Destroy() 129 dlg.Destroy()
141 if oldfilename != self.filename: 130 if oldfilename != self.filename:
142 self.OnMB_FileSave(None, oldfilename) 131 self.OnMB_FileSave(None, oldfilename)
143 self.aliasList = [] 132 self.aliasList = []
144 self.filterList = [] 133 self.filterList = []
145 self.OnMB_FileSave(None) 134 self.OnMB_FileSave(None)
146 self.settings.set_setting('aliasfile', self.filename[:-6]) 135 settings.set_setting('aliasfile', self.filename[:-6])
147 self.log.log("Exit AliasLib->OnMB_FileNew(self, event)", ORPG_DEBUG)
148 136
149 def OnMB_FileOpen(self, event): 137 def OnMB_FileOpen(self, event):
150 self.log.log("Enter AliasLib->OnMB_FileOpen(self, event)", ORPG_DEBUG)
151 oldfilename = self.filename 138 oldfilename = self.filename
152 dlg = wx.FileDialog(self, "Select an Alias Lib to Open", self.dir_struct["user"], wildcard="*.alias", style=wx.HIDE_READONLY|wx.OPEN) 139 dlg = wx.FileDialog(self, "Select an Alias Lib to Open",
140 dir_struct["user"], wildcard="*.alias",
141 style=wx.HIDE_READONLY|wx.OPEN)
153 if dlg.ShowModal() == wx.ID_OK: 142 if dlg.ShowModal() == wx.ID_OK:
154 self.filename = dlg.GetFilename() 143 self.filename = dlg.GetFilename()
155 dlg.Destroy() 144 dlg.Destroy()
156 if oldfilename != self.filename: 145 if oldfilename != self.filename:
157 self.OnMB_FileSave(None, oldfilename) 146 self.OnMB_FileSave(None, oldfilename)
158 self.loadFile() 147 self.loadFile()
159 self.settings.set_setting('aliasfile', self.filename[:-6]) 148 settings.set_setting('aliasfile', self.filename[:-6])
160 self.log.log("Exit AliasLib->OnMB_FileOpen(self, event)", ORPG_DEBUG)
161 149
162 def OnMB_FileSave(self, event, file=None): 150 def OnMB_FileSave(self, event, file=None):
163 self.log.log("Enter AliasLib->OnMB_FileSave(self, event)", ORPG_DEBUG)
164 idx = self.aliasIdx 151 idx = self.aliasIdx
165 if file == None: 152 if file == None:
166 file = self.filename 153 file = self.filename
167 xml = "<aliaslib>\n" 154 xml = "<aliaslib>\n"
168 for n in xrange(self.selectAliasWnd.GetItemCount()): 155 for n in xrange(self.selectAliasWnd.GetItemCount()):
180 xml += 'sub="' + self.MakeHTMLSafe(rule[1]) + '" ' 167 xml += 'sub="' + self.MakeHTMLSafe(rule[1]) + '" '
181 xml += "/>\n" 168 xml += "/>\n"
182 xml += "\t</filter>\n" 169 xml += "\t</filter>\n"
183 xml += "</aliaslib>" 170 xml += "</aliaslib>"
184 self.alias = idx 171 self.alias = idx
185 f = open(self.dir_struct["user"] + file, "w") 172 f = open(dir_struct["user"] + file, "w")
186 f.write(xml) 173 f.write(xml)
187 f.close() 174 f.close()
188 self.log.log("Exit AliasLib->OnMB_FileSave(self, event)", ORPG_DEBUG)
189 175
190 def OnMB_FileExportToTree(self, event): 176 def OnMB_FileExportToTree(self, event):
191 self.log.log("Enter AliasLib->OnMB_FileExportToTree(self, event)", ORPG_DEBUG)
192 #tree = component.get("tree") 177 #tree = component.get("tree")
193 xml = '<nodehandler class="voxchat_handler" icon="player" module="voxchat" name="' + self.filename[:-6] + '" use.filter="0" version="1.0">' + "\n" 178 xml = '<nodehandler class="voxchat_handler" '
179 xml += 'icon="player" '
180 xml += 'module="voxchat" '
181 xml += 'name="' + self.filename[:-6] + '" '
182 xml += 'use.filter="0" '
183 xml += 'version="1.0">' + '\n'
194 idx = self.aliasIdx 184 idx = self.aliasIdx
195 for n in xrange(self.selectAliasWnd.GetItemCount()): 185 for n in xrange(self.selectAliasWnd.GetItemCount()):
196 self.alias = n 186 self.alias = n
197 xml += "\t<voxchat.alias " 187 xml += "\t<voxchat.alias "
198 xml += 'name="' + self.MakeHTMLSafe(self.alias[0]) + '" ' 188 xml += 'name="' + self.MakeHTMLSafe(self.alias[0]) + '" '
208 xml += 'sub="' + self.MakeHTMLSafe(rule[1]) + '" ' 198 xml += 'sub="' + self.MakeHTMLSafe(rule[1]) + '" '
209 xml += "/>\n" 199 xml += "/>\n"
210 xml += "\t</voxchat.filter>\n" 200 xml += "\t</voxchat.filter>\n"
211 xml += "</nodehandler>" 201 xml += "</nodehandler>"
212 self.gametree.insert_xml(xml) 202 self.gametree.insert_xml(xml)
213 self.log.log("Exit AliasLib->OnMB_FileExportToTree(self, event)", ORPG_DEBUG)
214 203
215 def OnMB_FileExit(self, event): 204 def OnMB_FileExit(self, event):
216 self.log.log("Enter AliasLib->OnMB_FileExit(self, event)", ORPG_DEBUG)
217 self.OnMB_FileSave(0) 205 self.OnMB_FileSave(0)
218 self.Hide() 206 self.Hide()
219 top_frame = component.get('frame') 207 self.orpgframe.mainmenu.Check(self.orpgframe.mainmenu.FindMenuItem("Windows", "Alias Lib"), False)
220 top_frame.mainmenu.Check(top_frame.mainmenu.FindMenuItem("Windows", "Alias Lib"), False)
221 self.log.log("Exit AliasLib->OnMB_FileExit(self, event)", ORPG_DEBUG)
222 208
223 def OnMB_AliasNew(self, event): 209 def OnMB_AliasNew(self, event):
224 self.log.log("Enter AliasLib->OnMB_AliasNew(self, event)", ORPG_DEBUG)
225 self.NewEditAliasDialog("New") 210 self.NewEditAliasDialog("New")
226 self.log.log("Exit AliasLib->OnMB_AliasNew(self, event)", ORPG_DEBUG)
227 211
228 def OnMB_AliasAddTemporary(self, event): 212 def OnMB_AliasAddTemporary(self, event):
229 self.log.log("Enter AliasLib->OnMB_AliasAddTemporary(self, event)", ORPG_DEBUG)
230 minis = self.map.canvas.layers['miniatures'].miniatures 213 minis = self.map.canvas.layers['miniatures'].miniatures
231 for min in minis: 214 for min in minis:
232 name = min.label 215 name = min.label
233 if name not in self.aliasList: 216 if name not in self.aliasList:
234 i = self.selectAliasWnd.InsertStringItem(self.selectAliasWnd.GetItemCount(), name) 217 i = self.selectAliasWnd.InsertStringItem(self.selectAliasWnd.GetItemCount(), name)
235 self.selectAliasWnd.SetStringItem(i, 1, "Default") 218 self.selectAliasWnd.SetStringItem(i, 1, "Default")
236 self.selectAliasWnd.RefreshItem(i) 219 self.selectAliasWnd.RefreshItem(i)
237 self.RefreshAliases() 220 self.RefreshAliases()
238 self.log.log("Exit AliasLib->OnMB_AliasAddTemporary(self, event)", ORPG_DEBUG)
239 221
240 def OnMB_AliasEdit(self, event): 222 def OnMB_AliasEdit(self, event):
241 self.log.log("Enter AliasLib->OnMB_AliasEdit(self, event)", ORPG_DEBUG)
242 if self.aliasIdx != -1: 223 if self.aliasIdx != -1:
243 self.NewEditAliasDialog("Edit") 224 self.NewEditAliasDialog("Edit")
244 self.log.log("Exit AliasLib->OnMB_AliasEdit(self, event)", ORPG_DEBUG)
245 225
246 def NewEditAliasDialog(self, type): 226 def NewEditAliasDialog(self, type):
247 self.log.log("Enter AliasLib->NewEditAliasDialog(self, type)", ORPG_DEBUG)
248 dlg = wx.Dialog(self, wx.ID_ANY, type + " Alias", style=wx.DEFAULT_DIALOG_STYLE|wx.STAY_ON_TOP) 227 dlg = wx.Dialog(self, wx.ID_ANY, type + " Alias", style=wx.DEFAULT_DIALOG_STYLE|wx.STAY_ON_TOP)
249 txt = wx.TextCtrl(dlg, wx.ID_ANY) 228 txt = wx.TextCtrl(dlg, wx.ID_ANY)
250 if type == 'Edit': 229 if type == 'Edit':
251 txt.SetValue(self.alias[0]) 230 txt.SetValue(self.alias[0])
252 self.colorbtn = wx.Button(dlg, wx.ID_ANY, "Default Color") 231 self.colorbtn = wx.Button(dlg, wx.ID_ANY, "Default Color")
277 else: 256 else:
278 self.selectAliasWnd.SetStringItem(i, 1, RGBHex().hexstring(r, g, b)) 257 self.selectAliasWnd.SetStringItem(i, 1, RGBHex().hexstring(r, g, b))
279 self.selectAliasWnd.SetItemTextColour(i, RGBHex().hexstring(r, g, b)) 258 self.selectAliasWnd.SetItemTextColour(i, RGBHex().hexstring(r, g, b))
280 self.selectAliasWnd.RefreshItem(i) 259 self.selectAliasWnd.RefreshItem(i)
281 self.RefreshAliases() 260 self.RefreshAliases()
282 self.log.log("Exit AliasLib->NewEditAliasDialog(self, type)", ORPG_DEBUG)
283 261
284 def ChangeAliasColor(self, event): 262 def ChangeAliasColor(self, event):
285 self.log.log("Enter AliasLib->ChangeAliasColor(self, event)", ORPG_DEBUG)
286 color = RGBHex().do_hex_color_dlg(self) 263 color = RGBHex().do_hex_color_dlg(self)
287 self.colorbtn.SetLabel("Chat Color") 264 self.colorbtn.SetLabel("Chat Color")
288 self.colorbtn.SetForegroundColour(color) 265 self.colorbtn.SetForegroundColour(color)
289 self.log.log("Exit AliasLib->ChangeAliasColor(self, event)", ORPG_DEBUG)
290 266
291 def OnMB_AliasDelete(self, event): 267 def OnMB_AliasDelete(self, event):
292 self.log.log("Enter AliasLib->OnMB_AliasDelete(self, event)", ORPG_DEBUG)
293 if self.aliasIdx != -1: 268 if self.aliasIdx != -1:
294 self.selectAliasWnd.DeleteItem(self.aliasIdx) 269 self.selectAliasWnd.DeleteItem(self.aliasIdx)
295 self.RefreshAliases() 270 self.RefreshAliases()
296 self.log.log("Exit AliasLib->OnMB_AliasDelete(self, event)", ORPG_DEBUG)
297 271
298 def OnMB_FilterNew(self, event): 272 def OnMB_FilterNew(self, event):
299 self.log.log("Enter AliasLib->OnMB_FilterNew(self, event)", ORPG_DEBUG)
300 dlg = wx.TextEntryDialog(self, 'Filter Name: ', 'Please name this filter') 273 dlg = wx.TextEntryDialog(self, 'Filter Name: ', 'Please name this filter')
301 if dlg.ShowModal() != wx.ID_OK: 274 if dlg.ShowModal() != wx.ID_OK:
302 dlg.Destroy() 275 dlg.Destroy()
303 return 276 return
304 filterName = dlg.GetValue() 277 filterName = dlg.GetValue()
305 i = self.selectFilterWnd.InsertStringItem(self.selectFilterWnd.GetItemCount(), filterName) 278 i = self.selectFilterWnd.InsertStringItem(self.selectFilterWnd.GetItemCount(), filterName)
306 self.filter = i 279 self.filter = i
307 self.regExList.append([]) 280 self.regExList.append([])
308 self.OnMB_FilterEdit(None) 281 self.OnMB_FilterEdit(None)
309 self.log.log("Exit AliasLib->OnMB_FilterNew(self, event)", ORPG_DEBUG)
310 282
311 def OnMB_FilterEdit(self, event): 283 def OnMB_FilterEdit(self, event):
312 self.log.log("Enter AliasLib->OnMB_FilterEdit(self, event)", ORPG_DEBUG)
313 wnd = FilterEditWnd(self, self.filter, self.filterRegEx) 284 wnd = FilterEditWnd(self, self.filter, self.filterRegEx)
314 wnd.MakeModal(True) 285 wnd.MakeModal(True)
315 wnd.Show() 286 wnd.Show()
316 self.log.log("Exit AliasLib->OnMB_FilterEdit(self, event)", ORPG_DEBUG)
317 287
318 def OnMB_FilterDelete(self, event): 288 def OnMB_FilterDelete(self, event):
319 self.log.log("Enter AliasLib->OnMB_FilterDelete(self, event)", ORPG_DEBUG)
320 if self.filterIdx != -1: 289 if self.filterIdx != -1:
321 self.selectFilterWnd.DeleteItem(self.filterIdx) 290 self.selectFilterWnd.DeleteItem(self.filterIdx)
322 self.log.log("Exit AliasLib->OnMB_FilterDelete(self, event)", ORPG_DEBUG)
323 291
324 def OnMB_TransmitSend(self, event): 292 def OnMB_TransmitSend(self, event):
325 self.log.log("Enter AliasLib->OnMB_TransmitSend(self, event)", ORPG_DEBUG)
326 self.orpgframe.Freeze() 293 self.orpgframe.Freeze()
327 if self.alias[1] != 'Default': 294 if self.alias[1] != 'Default':
328 defaultcolor = self.settings.get_setting("mytextcolor") 295 defaultcolor = settings.get_setting("mytextcolor")
329 self.settings.set_setting("mytextcolor", self.alias[1]) 296 settings.set_setting("mytextcolor", self.alias[1])
330 self.chat.set_colors() 297 self.chat.set_colors()
331 line = self.textWnd.GetValue().replace("\n", "<br />") 298 line = self.textWnd.GetValue().replace("\n", "<br />")
332 if self.checkFilterText.IsChecked() and self.filter != self.chat.defaultFilterName: 299 if self.checkFilterText.IsChecked() and self.filter != self.chat.defaultFilterName:
333 for rule in self.filterRegEx: 300 for rule in self.filterRegEx: line = re.sub(rule[0], rule[1], line)
334 line = re.sub(rule[0], rule[1], line)
335 if len(line) > 1: 301 if len(line) > 1:
336 if len(line) > 1 and line[0] != "/": 302 if len(line) > 1 and line[0] != "/": self.chat.ParsePost(line, True, True)
337 self.chat.ParsePost(line, True, True) 303 else: self.chat.chat_cmds.docmd(line)
338 else:
339 self.chat.chat_cmds.docmd(line)
340 if self.alias[1] != 'Default': 304 if self.alias[1] != 'Default':
341 self.settings.set_setting("mytextcolor", defaultcolor) 305 settings.set_setting("mytextcolor", defaultcolor)
342 self.chat.set_colors() 306 self.chat.set_colors()
343 if self.checkClearText.IsChecked(): 307 if self.checkClearText.IsChecked():
344 self.textWnd.SetValue("") 308 self.textWnd.SetValue("")
345 top_frame.Thaw() 309 self.orpgframe.Thaw()
346 self.log.log("Exit AliasLib->OnMB_TransmitSend(self, event)", ORPG_DEBUG)
347 310
348 def OnMB_TransmitEmote(self, event): 311 def OnMB_TransmitEmote(self, event):
349 self.log.log("Enter AliasLib->OnMB_TransmitEmote(self, event)", ORPG_DEBUG)
350 self.orpgframe.Freeze() 312 self.orpgframe.Freeze()
351 line = self.textWnd.GetValue().replace("\n", "<br />") 313 line = self.textWnd.GetValue().replace("\n", "<br />")
352 if self.checkFilterText.IsChecked() and self.filter != self.chat.defaultFilterName: 314 if self.checkFilterText.IsChecked() and self.filter != self.chat.defaultFilterName:
353 for rule in self.filterRegEx: 315 for rule in self.filterRegEx: line = re.sub(rule[0], rule[1], line)
354 line = re.sub(rule[0], rule[1], line)
355 self.chat.emote_message(line) 316 self.chat.emote_message(line)
356 if self.checkClearText.IsChecked(): 317 if self.checkClearText.IsChecked():
357 self.textWnd.SetValue("") 318 self.textWnd.SetValue("")
358 top_frame.Thaw() 319 self.orpgframe.Thaw()
359 self.log.log("Exit AliasLib->OnMB_TransmitEmote(self, event)", ORPG_DEBUG)
360 320
361 def OnMB_TransmitWhisper(self, event): 321 def OnMB_TransmitWhisper(self, event):
362 self.log.log("Enter AliasLib->OnMB_TransmitWhisper(self, event)", ORPG_DEBUG)
363 self.orpgframe.Freeze() 322 self.orpgframe.Freeze()
364 players = self.session.get_players() 323 players = self.session.get_players()
365 if self.alias[1] != 'Default': 324 if self.alias[1] != 'Default':
366 defaultcolor = self.settings.get_setting("mytextcolor") 325 defaultcolor = settings.get_setting("mytextcolor")
367 self.settings.set_setting("mytextcolor", self.alias[1]) 326 settings.set_setting("mytextcolor", self.alias[1])
368 self.chat.set_colors() 327 self.chat.set_colors()
369 opts = [] 328 opts = []
370 myid = session.get_id() 329 myid = self.session.get_id()
371 for p in players: 330 for p in players:
372 if p[2] != myid: 331 if p[2] != myid: opts.append("(" + p[2] + ") " + self.chat.html_strip(p[0]))
373 opts.append("(" + p[2] + ") " + self.chat.html_strip(p[0]))
374 dlg = orpgMultiCheckBoxDlg(self, opts, "Select Players:", "Whisper To", []) 332 dlg = orpgMultiCheckBoxDlg(self, opts, "Select Players:", "Whisper To", [])
375 sendto = [] 333 sendto = []
376 if dlg.ShowModal() == wx.ID_OK: 334 if dlg.ShowModal() == wx.ID_OK:
377 selections = dlg.get_selections() 335 selections = dlg.get_selections()
378 for s in selections: 336 for s in selections: sendto.append(players[s][2])
379 sendto.append(players[s][2])
380 line = self.textWnd.GetValue().replace("\n", "<br />") 337 line = self.textWnd.GetValue().replace("\n", "<br />")
381 if self.checkFilterText.IsChecked() and self.filter != self.chat.defaultFilterName: 338 if self.checkFilterText.IsChecked() and self.filter != self.chat.defaultFilterName:
382 for rule in self.filterRegEx: 339 for rule in self.filterRegEx: line = re.sub(rule[0], rule[1], line)
383 line = re.sub(rule[0], rule[1], line) 340 if len(sendto): self.chat.whisper_to_players(line, sendto)
384 if len(sendto):
385 self.chat.whisper_to_players(line, sendto)
386 if self.alias[1] != 'Default': 341 if self.alias[1] != 'Default':
387 self.settings.set_setting("mytextcolor", defaultcolor) 342 settings.set_setting("mytextcolor", defaultcolor)
388 self.chat.set_colors() 343 self.chat.set_colors()
389 if self.checkClearText.IsChecked(): 344 if self.checkClearText.IsChecked(): self.textWnd.SetValue("")
390 self.textWnd.SetValue("") 345 self.orpgframe.Thaw()
391 top_frame.Thaw()
392 self.log.log("Exit AliasLib->OnMB_TransmitWhisper(self, event)", ORPG_DEBUG)
393 346
394 def OnMB_TransmitMacro(self, event): 347 def OnMB_TransmitMacro(self, event):
395 self.log.log("Enter AliasLib->OnMB_TransmitMacro(self, event)", ORPG_DEBUG)
396 self.orpgframe.Freeze() 348 self.orpgframe.Freeze()
397 if self.alias[1] != 'Default': 349 if self.alias[1] != 'Default':
398 defaultcolor = self.settings.get_setting("mytextcolor") 350 defaultcolor = settings.get_setting("mytextcolor")
399 self.settings.set_setting("mytextcolor", self.alias[1]) 351 settings.set_setting("mytextcolor", self.alias[1])
400 self.chat.set_colors() 352 self.chat.set_colors()
401 lines = self.textWnd.GetValue().split("\n") 353 lines = self.textWnd.GetValue().split("\n")
402 if self.checkFilterText.IsChecked() and self.filter != self.chat.defaultFilterName: 354 if self.checkFilterText.IsChecked() and self.filter != self.chat.defaultFilterName:
355 line = self.textWnd.GetValue().replace("\n", "<br />")
403 for rule in self.filterRegEx: 356 for rule in self.filterRegEx:
404 line = re.sub(rule[0], rule[1], line) 357 line = re.sub(rule[0], rule[1], line)
405 for line in lines: 358 for line in lines:
406 if len(line) > 1: 359 if len(line) > 1:
407 if line[0] != "/": 360 if line[0] != "/": self.chat.ParsePost(line, True, True)
408 self.chat.ParsePost(line, True, True) 361 else: self.chat.chat_cmds.docmd(line)
409 else:
410 self.chat.chat_cmds.docmd(line)
411 if self.alias[1] != 'Default': 362 if self.alias[1] != 'Default':
412 self.settings.set_setting("mytextcolor", defaultcolor) 363 settings.set_setting("mytextcolor", defaultcolor)
413 self.chat.set_colors() 364 self.chat.set_colors()
414 if self.checkClearText.IsChecked(): 365 if self.checkClearText.IsChecked(): self.textWnd.SetValue("")
415 self.textWnd.SetValue("") 366 self.orpgframe.Thaw()
416 top_frame.Thaw()
417 self.log.log("Exit AliasLib->OnMB_TransmitMacro(self, event)", ORPG_DEBUG)
418 367
419 def buildButtons(self): 368 def buildButtons(self):
420 self.log.log("Enter AliasLib->buildButtons(self)", ORPG_DEBUG)
421 self.topBtnSizer = wx.BoxSizer(wx.HORIZONTAL) 369 self.topBtnSizer = wx.BoxSizer(wx.HORIZONTAL)
422 self.middleBtnSizer = wx.BoxSizer(wx.HORIZONTAL) 370 self.middleBtnSizer = wx.BoxSizer(wx.HORIZONTAL)
423 self.bottomBtnSizer = wx.BoxSizer(wx.HORIZONTAL) 371 self.bottomBtnSizer = wx.BoxSizer(wx.HORIZONTAL)
424 self.addFromMapBtn = createMaskedButton(self, self.dir_struct["icon"] + 'install.gif', 'Add temporary aliases from map', wx.ID_ANY, "#C0C0C0") 372 self.addFromMapBtn = createMaskedButton(self, dir_struct["icon"] + 'install.gif',
425 self.newAliasBtn = createMaskedButton(self, self.dir_struct["icon"] + 'player.gif', 'Add a new Alias', wx.ID_ANY) 373 'Add temporary aliases from map', wx.ID_ANY, "#C0C0C0")
426 self.delAliasBtn = createMaskedButton(self, self.dir_struct["icon"] + 'noplayer.gif', 'Delete selected Alias', wx.ID_ANY) 374 self.newAliasBtn = createMaskedButton(self, dir_struct["icon"] + 'player.gif', 'Add a new Alias', wx.ID_ANY)
427 self.editAliasBtn = createMaskedButton(self, self.dir_struct["icon"] + 'note.gif', 'Edit selected Alias', wx.ID_ANY) 375 self.delAliasBtn = createMaskedButton(self, dir_struct["icon"] + 'noplayer.gif', 'Delete selected Alias', wx.ID_ANY)
376 self.editAliasBtn = createMaskedButton(self, dir_struct["icon"] + 'note.gif', 'Edit selected Alias', wx.ID_ANY)
428 self.Bind(wx.EVT_BUTTON, self.OnMB_AliasNew, self.newAliasBtn) 377 self.Bind(wx.EVT_BUTTON, self.OnMB_AliasNew, self.newAliasBtn)
429 self.Bind(wx.EVT_BUTTON, self.OnMB_AliasAddTemporary, self.addFromMapBtn) 378 self.Bind(wx.EVT_BUTTON, self.OnMB_AliasAddTemporary, self.addFromMapBtn)
430 self.Bind(wx.EVT_BUTTON, self.OnMB_AliasEdit, self.editAliasBtn) 379 self.Bind(wx.EVT_BUTTON, self.OnMB_AliasEdit, self.editAliasBtn)
431 self.Bind(wx.EVT_BUTTON, self.OnMB_AliasDelete, self.delAliasBtn) 380 self.Bind(wx.EVT_BUTTON, self.OnMB_AliasDelete, self.delAliasBtn)
432 self.newFilterBtn = createMaskedButton(self, self.dir_struct["icon"] + 'add_filter.gif', 'Add a new Filter', wx.ID_ANY, "#0000FF") 381 self.newFilterBtn = createMaskedButton(self, dir_struct["icon"] + 'add_filter.gif',
433 self.editFilterBtn = createMaskedButton(self, self.dir_struct["icon"] + 'edit_filter.gif', 'Edit selected Filter', wx.ID_ANY, "#FF0000") 382 'Add a new Filter', wx.ID_ANY, "#0000FF")
434 self.delFilterBtn = createMaskedButton(self, self.dir_struct["icon"] + 'delete_filter.gif', 'Delete selected Filter', wx.ID_ANY, "#0000FF") 383 self.editFilterBtn = createMaskedButton(self, dir_struct["icon"] + 'edit_filter.gif',
384 'Edit selected Filter', wx.ID_ANY, "#FF0000")
385 self.delFilterBtn = createMaskedButton(self, dir_struct["icon"] + 'delete_filter.gif',
386 'Delete selected Filter', wx.ID_ANY, "#0000FF")
435 self.Bind(wx.EVT_BUTTON, self.OnMB_FilterNew, self.newFilterBtn) 387 self.Bind(wx.EVT_BUTTON, self.OnMB_FilterNew, self.newFilterBtn)
436 self.Bind(wx.EVT_BUTTON, self.OnMB_FilterEdit, self.editFilterBtn) 388 self.Bind(wx.EVT_BUTTON, self.OnMB_FilterEdit, self.editFilterBtn)
437 self.Bind(wx.EVT_BUTTON, self.OnMB_FilterDelete, self.delFilterBtn) 389 self.Bind(wx.EVT_BUTTON, self.OnMB_FilterDelete, self.delFilterBtn)
438 self.textBoldBtn = createMaskedButton(self, self.dir_struct["icon"] + 'bold.gif', 'Bold', wx.ID_ANY, "#BDBDBD") 390 self.textBoldBtn = createMaskedButton(self, dir_struct["icon"] + 'bold.gif', 'Bold', wx.ID_ANY, "#BDBDBD")
439 self.textItalicBtn = createMaskedButton(self, self.dir_struct["icon"] + 'italic.gif', 'Italic', wx.ID_ANY, "#BDBDBD") 391 self.textItalicBtn = createMaskedButton(self, dir_struct["icon"] + 'italic.gif', 'Italic', wx.ID_ANY, "#BDBDBD")
440 self.textUnderlineBtn = createMaskedButton(self, self.dir_struct["icon"] + 'underlined.gif', 'Underline', wx.ID_ANY, "#BDBDBD") 392 self.textUnderlineBtn = createMaskedButton(self, dir_struct["icon"] + 'underlined.gif',
393 'Underline', wx.ID_ANY, "#BDBDBD")
441 self.textColorBtn = wx.Button(self, wx.ID_ANY, "Color") 394 self.textColorBtn = wx.Button(self, wx.ID_ANY, "Color")
442 self.textColorBtn.SetForegroundColour(wx.BLACK) 395 self.textColorBtn.SetForegroundColour(wx.BLACK)
443 self.exportBtn = createMaskedButton(self, self.dir_struct["icon"] + 'grid.gif', 'Export to Tree', wx.ID_ANY) 396 self.exportBtn = createMaskedButton(self, dir_struct["icon"] + 'grid.gif', 'Export to Tree', wx.ID_ANY)
444 self.Bind(wx.EVT_BUTTON, self.FormatText, self.textBoldBtn) 397 self.Bind(wx.EVT_BUTTON, self.FormatText, self.textBoldBtn)
445 self.Bind(wx.EVT_BUTTON, self.FormatText, self.textItalicBtn) 398 self.Bind(wx.EVT_BUTTON, self.FormatText, self.textItalicBtn)
446 self.Bind(wx.EVT_BUTTON, self.FormatText, self.textUnderlineBtn) 399 self.Bind(wx.EVT_BUTTON, self.FormatText, self.textUnderlineBtn)
447 self.Bind(wx.EVT_BUTTON, self.FormatText, self.textColorBtn) 400 self.Bind(wx.EVT_BUTTON, self.FormatText, self.textColorBtn)
448 self.Bind(wx.EVT_BUTTON, self.OnMB_FileExportToTree, self.exportBtn) 401 self.Bind(wx.EVT_BUTTON, self.OnMB_FileExportToTree, self.exportBtn)
476 self.bottomBtnSizer.Add(self.sayBtn, 0, wx.EXPAND) 429 self.bottomBtnSizer.Add(self.sayBtn, 0, wx.EXPAND)
477 self.bottomBtnSizer.Add(self.emoteBtn, 0, wx.EXPAND) 430 self.bottomBtnSizer.Add(self.emoteBtn, 0, wx.EXPAND)
478 self.bottomBtnSizer.Add(self.whisperBtn, 0, wx.EXPAND) 431 self.bottomBtnSizer.Add(self.whisperBtn, 0, wx.EXPAND)
479 self.bottomBtnSizer.Add(self.macroBtn, 0, wx.EXPAND) 432 self.bottomBtnSizer.Add(self.macroBtn, 0, wx.EXPAND)
480 self.bottomBtnSizer.Add(self.doneBtn, 0, wx.EXPAND|wx.ALIGN_RIGHT) 433 self.bottomBtnSizer.Add(self.doneBtn, 0, wx.EXPAND|wx.ALIGN_RIGHT)
481 self.log.log("Exit AliasLib->buildButtons(self)", ORPG_DEBUG)
482 434
483 def buildGUI(self): 435 def buildGUI(self):
484 self.log.log("Enter AliasLib->buildGUI(self)", ORPG_DEBUG)
485 self.sizer = wx.BoxSizer(wx.VERTICAL) 436 self.sizer = wx.BoxSizer(wx.VERTICAL)
486 rightwnd = wx.SplitterWindow(self, wx.ID_ANY, style=wx.SP_LIVE_UPDATE|wx.SP_NO_XP_THEME|wx.SP_3DSASH) 437 rightwnd = wx.SplitterWindow(self, wx.ID_ANY, style=wx.SP_LIVE_UPDATE|wx.SP_NO_XP_THEME|wx.SP_3DSASH)
487 leftwnd = wx.SplitterWindow(rightwnd, wx.ID_ANY, style=wx.SP_LIVE_UPDATE|wx.SP_NO_XP_THEME|wx.SP_3DSASH) 438 leftwnd = wx.SplitterWindow(rightwnd, wx.ID_ANY, style=wx.SP_LIVE_UPDATE|wx.SP_NO_XP_THEME|wx.SP_3DSASH)
488 self.selectAliasWnd = wx.ListCtrl(leftwnd, wx.ID_ANY, style=wx.LC_SINGLE_SEL|wx.LC_REPORT|wx.LC_HRULES) 439 self.selectAliasWnd = wx.ListCtrl(leftwnd, wx.ID_ANY, style=wx.LC_SINGLE_SEL|wx.LC_REPORT|wx.LC_HRULES)
489 self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.NewAliasSelection, self.selectAliasWnd) 440 self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.NewAliasSelection, self.selectAliasWnd)
503 self.sizer.Add(self.middleBtnSizer, 0, wx.EXPAND) 454 self.sizer.Add(self.middleBtnSizer, 0, wx.EXPAND)
504 self.sizer.Add(self.bottomBtnSizer, 0, wx.EXPAND) 455 self.sizer.Add(self.bottomBtnSizer, 0, wx.EXPAND)
505 self.SetSizer(self.sizer) 456 self.SetSizer(self.sizer)
506 self.SetAutoLayout(True) 457 self.SetAutoLayout(True)
507 self.Fit() 458 self.Fit()
508 self.log.log("Exit AliasLib->buildGUI(self)", ORPG_DEBUG)
509 459
510 def loadFile(self): 460 def loadFile(self):
511 self.log.log("Enter AliasLib->loadFile(self)", ORPG_DEBUG) 461 f = open(dir_struct["user"] + self.filename, "r")
512 f = open(self.dir_struct["user"] + self.filename, "r")
513 data = f.read() 462 data = f.read()
514 f.close() 463 f.close()
515 self.alias = -1 464 self.alias = -1
516 self.filter = -1 465 self.filter = -1
517 xml_dom = self.xml.parseXml(data) 466 xml_dom = component.get('xml').parseXml(data)
518 del data 467 del data
519 aliases = xml_dom.getElementsByTagName("alias") 468 aliases = xml_dom.getElementsByTagName("alias")
520 alist = [] 469 alist = []
521 for alias in aliases: 470 for alias in aliases:
522 if alias.hasAttribute("color"): 471 if alias.hasAttribute("color"): color = alias.getAttribute("color")
523 color = alias.getAttribute("color") 472 else: color = 'Default'
524 else:
525 color = 'Default'
526 aname = self.MakeSafeHTML(alias.getAttribute("name")) 473 aname = self.MakeSafeHTML(alias.getAttribute("name"))
527 alist.append([aname, color]) 474 alist.append([aname, color])
528 alist.sort() 475 alist.sort()
529 self.aliasList = alist 476 self.aliasList = alist
530 filters = xml_dom.getElementsByTagName("filter") 477 filters = xml_dom.getElementsByTagName("filter")
532 self.regExList = [] 479 self.regExList = []
533 for filter in filters: 480 for filter in filters:
534 flist.append(filter.getAttribute("name")) 481 flist.append(filter.getAttribute("name"))
535 rules = filter.getElementsByTagName("rule") 482 rules = filter.getElementsByTagName("rule")
536 sub = [] 483 sub = []
537 for rule in rules: 484 for rule in rules: sub.append([self.MakeSafeHTML(rule.getAttribute("match")),
538 sub.append([self.MakeSafeHTML(rule.getAttribute("match")), self.MakeSafeHTML(rule.getAttribute("sub"))]) 485 self.MakeSafeHTML(rule.getAttribute("sub"))])
539 self.regExList.append(sub) 486 self.regExList.append(sub)
540 self.filterList = flist 487 self.filterList = flist
541 xml_dom.unlink() 488 xml_dom.unlink()
542 self.alias = -1 489 self.alias = -1
543 self.filter = -1 490 self.filter = -1
544 self.log.log("Exit AliasLib->loadFile(self)", ORPG_DEBUG)
545 491
546 def MakeSafeHTML(self, str): 492 def MakeSafeHTML(self, str):
547 return str.replace("&amp;", "&").replace("&lt;", "<").replace("&quot;", '"').replace("&gt;", ">").replace("&#39;", "'") 493 return str.replace("&amp;", "&").replace("&lt;", "<").replace("&quot;", '"').replace("&gt;", ">").replace("&#39;", "'")
548 def MakeHTMLSafe(self, str): 494 def MakeHTMLSafe(self, str):
549 return str.replace("&", "&amp;").replace("<", "&lt;").replace('"', "&quot;").replace(">", "&gt;").replace("'", "&#39;") 495 return str.replace("&", "&amp;").replace("<", "&lt;").replace('"', "&quot;").replace(">", "&gt;").replace("'", "&#39;")
550 def ImportFromTree(self, xml_dom): 496 def ImportFromTree(self, xml_dom):
551 self.log.log("Enter AliasLib->ImportFromTree(self, xml_dom)", ORPG_DEBUG)
552 oldfilename = self.filename 497 oldfilename = self.filename
553 if xml_dom.getAttribute('name') == 'Alias Library': 498 if xml_dom.getAttribute('name') == 'Alias Library':
554 dlg = wx.TextEntryDialog(self, "Please Name This Alias Lib", "New Alias Lib") 499 dlg = wx.TextEntryDialog(self, "Please Name This Alias Lib", "New Alias Lib")
555 if dlg.ShowModal() == wx.ID_OK: 500 if dlg.ShowModal() == wx.ID_OK:
556 self.filename = dlg.GetValue() + '.alias' 501 self.filename = dlg.GetValue() + '.alias'
557 dlg.Destroy() 502 dlg.Destroy()
558 else: 503 else:
559 dlg.Destroy() 504 dlg.Destroy()
560 return 505 return
561 else: 506 else: self.filename = xml_dom.getAttribute('name') + '.alias'
562 self.filename = xml_dom.getAttribute('name') + '.alias' 507 settings.set_setting('aliasfile', self.filename[:-6])
563 self.settings.set_setting('aliasfile', self.filename[:-6]) 508 if oldfilename != self.filename: self.OnMB_FileSave(None, oldfilename)
564 if oldfilename != self.filename: 509 f = open(dir_struct["user"] + self.filename, "w")
565 self.OnMB_FileSave(None, oldfilename)
566 f = open(self.dir_struct["user"] + self.filename, "w")
567 f.write(xml_dom.toxml().replace('nodehandler', 'aliaslib').replace('voxchat.', '')) 510 f.write(xml_dom.toxml().replace('nodehandler', 'aliaslib').replace('voxchat.', ''))
568 f.close() 511 f.close()
569 wx.CallAfter(self.loadFile) 512 wx.CallAfter(self.loadFile)
570 self.log.log("Exit AliasLib->ImportFromTree(self, xml_dom)", ORPG_DEBUG)
571 513
572 def NewAliasSelection(self, event): 514 def NewAliasSelection(self, event):
573 self.log.log("Enter AliasLib->NewAliasSelection(self, event)", ORPG_DEBUG)
574 self.alias = event.GetIndex() 515 self.alias = event.GetIndex()
575 wx.CallAfter(self.chat.aliasList.SetStringSelection, self.alias[0]) 516 wx.CallAfter(self.chat.aliasList.SetStringSelection, self.alias[0])
576 self.log.log("Exit AliasLib->NewAliasSelection(self, event)", ORPG_DEBUG)
577 517
578 def NoAliasSelection(self, event): 518 def NoAliasSelection(self, event):
579 self.log.log("Enter AliasLib->NoAliasSelection(self, event)", ORPG_DEBUG)
580 self.aliasIdx = -1 519 self.aliasIdx = -1
581 wx.CallAfter(self.chat.aliasList.SetStringSelection, self.alias[0]) 520 wx.CallAfter(self.chat.aliasList.SetStringSelection, self.alias[0])
582 self.log.log("Exit AliasLib->NoAliasSelection(self, event)", ORPG_DEBUG)
583 521
584 def GetSelectedAlias(self): 522 def GetSelectedAlias(self):
585 self.log.log("Enter AliasLib->GetSelectedAlias(self)", ORPG_DEBUG)
586 self.InitSetup() 523 self.InitSetup()
587 if self.aliasIdx != -1: 524 if self.aliasIdx != -1:
588 self.log.log("Exit AliasLib->GetSelectedAlias(self) return " + str(self.aliasIdx), ORPG_DEBUG) 525 return [self.selectAliasWnd.GetItem(self.aliasIdx, 0).GetText(),
589 return [self.selectAliasWnd.GetItem(self.aliasIdx, 0).GetText(), self.selectAliasWnd.GetItem(self.aliasIdx, 1).GetText()] 526 self.selectAliasWnd.GetItem(self.aliasIdx, 1).GetText()]
590 self.log.log("Exit AliasLib->GetSelectedAlias(self) return " + str(self.aliasIdx), ORPG_DEBUG)
591 return [self.chat.defaultAliasName, "Default"] 527 return [self.chat.defaultAliasName, "Default"]
592 528
593 def SetSelectedAlias(self, alias): 529 def SetSelectedAlias(self, alias):
594 self.log.log("Enter AliasLib->SetSelectedAlias(self, aliasIdx)", ORPG_DEBUG)
595 found = False 530 found = False
596 if isinstance(alias, (int, long)): 531 if isinstance(alias, (int, long)):
597 self.aliasIdx = alias 532 self.aliasIdx = alias
598 found = True 533 found = True
599 else: 534 else:
601 if self.selectAliasWnd.GetItem(n, 0).GetText() == alias: 536 if self.selectAliasWnd.GetItem(n, 0).GetText() == alias:
602 self.aliasIdx = n 537 self.aliasIdx = n
603 found = True 538 found = True
604 if not found: 539 if not found:
605 self.aliasIdx = -1 540 self.aliasIdx = -1
606 self.log.log("Exit AliasLib->SetSelectedAlias(self, aliasIdx)", ORPG_DEBUG)
607 541
608 def GetAliasList(self): 542 def GetAliasList(self):
609 self.log.log("Enter AliasLib->GetAliasList(self)", ORPG_DEBUG)
610 alist = [] 543 alist = []
611 for n in xrange(0, self.selectAliasWnd.GetItemCount()): 544 for n in xrange(0, self.selectAliasWnd.GetItemCount()):
612 self.alias = n 545 self.alias = n
613 alist.append(self.alias[0]) 546 alist.append(self.alias[0])
614 self.log.log("Exit AliasLib->GetAliasList(self)", ORPG_DEBUG)
615 alist.sort() 547 alist.sort()
616 alist.insert(0, self.chat.defaultAliasName) 548 alist.insert(0, self.chat.defaultAliasName)
617 return alist 549 return alist
618 550
619 def SetAliasList(self, alist): 551 def SetAliasList(self, alist):
620 self.log.log("Enter AliasLib->SetAliasList(self, list)", ORPG_DEBUG)
621 self.selectAliasWnd.ClearAll() 552 self.selectAliasWnd.ClearAll()
622 self.selectAliasWnd.InsertColumn(0, "Alias") 553 self.selectAliasWnd.InsertColumn(0, "Alias")
623 self.selectAliasWnd.InsertColumn(1, "Chat Color") 554 self.selectAliasWnd.InsertColumn(1, "Chat Color")
624 for item in alist: 555 for item in alist:
625 i = self.selectAliasWnd.InsertStringItem(self.selectAliasWnd.GetItemCount(), item[0]) 556 i = self.selectAliasWnd.InsertStringItem(self.selectAliasWnd.GetItemCount(), item[0])
626 self.selectAliasWnd.SetStringItem(i, 1, item[1]) 557 self.selectAliasWnd.SetStringItem(i, 1, item[1])
627 if item[1] != 'Default': 558 if item[1] != 'Default': self.selectAliasWnd.SetItemTextColour(i, item[1])
628 self.selectAliasWnd.SetItemTextColour(i, item[1])
629 self.selectAliasWnd.RefreshItem(i) 559 self.selectAliasWnd.RefreshItem(i)
630 self.aliasIdx = -1 560 self.aliasIdx = -1
631 self.RefreshAliases() 561 self.RefreshAliases()
632 self.log.log("Exit AliasLib->SetAliasList(self, list)", ORPG_DEBUG)
633 562
634 def GetAliasColor(self): 563 def GetAliasColor(self):
635 self.log.log("Enter/Exit AliasLib->GetAliasColor(self) return " + self.alias[1], ORPG_DEBUG)
636 return self.alias[1] 564 return self.alias[1]
637 565
638 def RefreshAliases(self): 566 def RefreshAliases(self):
639 self.orpgframe.Freeze() 567 self.orpgframe.Freeze()
640 self.Freeze() 568 self.Freeze()
643 l2 = len(self.filterList) 571 l2 = len(self.filterList)
644 if self.chat != None: 572 if self.chat != None:
645 tmp = self.chat.aliasList.GetStringSelection() 573 tmp = self.chat.aliasList.GetStringSelection()
646 self.alias = tmp 574 self.alias = tmp
647 aidx = self.aliasIdx+1 575 aidx = self.aliasIdx+1
648 if len(self.aliasList) <= aidx: 576 if len(self.aliasList) <= aidx: aidx = 0
649 aidx = 0
650 self.chat.aliasList.Clear() 577 self.chat.aliasList.Clear()
651 for n in xrange(l1): 578 for n in xrange(l1): self.chat.aliasList.Insert(self.aliasList[n], n)
652 self.chat.aliasList.Insert(self.aliasList[n], n)
653 self.chat.aliasList.SetStringSelection(self.aliasList[aidx]) 579 self.chat.aliasList.SetStringSelection(self.aliasList[aidx])
654 fidx = self.chat.filterList.GetSelection() 580 fidx = self.chat.filterList.GetSelection()
655 if len(self.filterList) <= fidx: 581 if len(self.filterList) <= fidx: fidx = 0
656 fidx = 0
657 self.chat.filterList.Clear() 582 self.chat.filterList.Clear()
658 for n in xrange(l2): 583 for n in xrange(l2):
659 self.chat.filterList.Insert(self.filterList[n], n) 584 self.chat.filterList.Insert(self.filterList[n], n)
660 self.chat.filterList.SetStringSelection(self.filterList[fidx]) 585 self.chat.filterList.SetStringSelection(self.filterList[fidx])
661 if self.chat.parent.GMChatPanel != None: 586 if self.chat.parent.GMChatPanel != None:
662 aidx = self.chat.parent.GMChatPanel.aliasList.GetSelection() 587 aidx = self.chat.parent.GMChatPanel.aliasList.GetSelection()
663 if len(self.aliasList) <- aidx: 588 if len(self.aliasList) <- aidx: aidx = 0
664 aidx = 0
665 self.chat.parent.GMChatPanel.aliasList.Clear() 589 self.chat.parent.GMChatPanel.aliasList.Clear()
666 for n in xrange(l1): 590 for n in xrange(l1):
667 self.chat.parent.GMChatPanel.aliasList.Insert(self.aliasList[n], n) 591 self.chat.parent.GMChatPanel.aliasList.Insert(self.aliasList[n], n)
668 self.chat.parent.GMChatPanel.aliasList.SetStringSelection(self.aliasList[aidx]) 592 self.chat.parent.GMChatPanel.aliasList.SetStringSelection(self.aliasList[aidx])
669 fidx = self.chat.parent.GMChatPanel.filterList.GetSelection() 593 fidx = self.chat.parent.GMChatPanel.filterList.GetSelection()
699 tab.filterList.Insert(self.filterList[n], n) 623 tab.filterList.Insert(self.filterList[n], n)
700 tab.filterList.SetStringSelection(self.filterList[fidx]) 624 tab.filterList.SetStringSelection(self.filterList[fidx])
701 625
702 for tab in self.chat.parent.null_tabs: 626 for tab in self.chat.parent.null_tabs:
703 aidx = tab.aliasList.GetSelection() 627 aidx = tab.aliasList.GetSelection()
704 if len(self.aliasList) <= aidx: 628 if len(self.aliasList) <= aidx: aidx = 0
705 aidx = 0
706 tab.aliasList.Clear() 629 tab.aliasList.Clear()
707 for n in xrange(l1): 630 for n in xrange(l1):
708 tab.aliasList.Insert(self.aliasList[n], n) 631 tab.aliasList.Insert(self.aliasList[n], n)
709 tab.aliasList.SetStringSelection(self.aliasList[aidx]) 632 tab.aliasList.SetStringSelection(self.aliasList[aidx])
710 fidx = tab.filterList.GetSelection() 633 fidx = tab.filterList.GetSelection()
714 tab.filterList.SetStringSelection(self.filterList[fidx]) 637 tab.filterList.SetStringSelection(self.filterList[fidx])
715 self.Thaw() 638 self.Thaw()
716 wx.CallAfter(self.orpgframe.Thaw) 639 wx.CallAfter(self.orpgframe.Thaw)
717 640
718 def SetAliasColor(self, color): 641 def SetAliasColor(self, color):
719 self.log.log("Enter AliasLib->SetAliasColor(self, color)", ORPG_DEBUG)
720 if self.aliasIdx != -1: 642 if self.aliasIdx != -1:
721 self.selectAliasWnd.SetStringItem(self.aliasIdx, 1, color) 643 self.selectAliasWnd.SetStringItem(self.aliasIdx, 1, color)
722 self.selectAliasWnd.SetItemTextColour(self.aliasIdx, color) 644 self.selectAliasWnd.SetItemTextColour(self.aliasIdx, color)
723 self.log.log("Exit AliasLib->SetAliasColor(self, color)", ORPG_DEBUG)
724 645
725 def FilterTextChecked(self, event): 646 def FilterTextChecked(self, event):
726 if self.checkFilterText.IsChecked(): 647 if self.checkFilterText.IsChecked():
727 self.chat.filterList.SetStringSelection(self.filter) 648 self.chat.filterList.SetStringSelection(self.filter)
728 else: 649 else: self.chat.filterList.SetStringSelection(self.chat.defaultFilterName)
729 self.chat.filterList.SetStringSelection(self.chat.defaultFilterName)
730 650
731 def NewFilterSelection(self, event): 651 def NewFilterSelection(self, event):
732 self.log.log("Enter AliasLib->NewFilterSelection(self, event)", ORPG_DEBUG)
733 self.filter = event.GetIndex() 652 self.filter = event.GetIndex()
734 if self.checkFilterText.IsChecked(): 653 if self.checkFilterText.IsChecked(): wx.CallAfter(self.chat.filterList.SetStringSelection, self.filter)
735 wx.CallAfter(self.chat.filterList.SetStringSelection, self.filter)
736 self.log.log("Exit AliasLib->NewFilterSelection(self, event)", ORPG_DEBUG)
737 654
738 def NoFilterSelection(self, event): 655 def NoFilterSelection(self, event):
739 self.log.log("Enter AliasLib->NoFilterSelection(self, event)", ORPG_DEBUG)
740 self.filter = -1 656 self.filter = -1
741 wx.CallAfter(self.chat.filterList.SetStringSelection, self.filter) 657 wx.CallAfter(self.chat.filterList.SetStringSelection, self.filter)
742 self.log.log("Exit AliasLib->NoFilterSelection(self, event)", ORPG_DEBUG)
743 658
744 def GetSelectedFilter(self): 659 def GetSelectedFilter(self):
745 self.log.log("Enter AliasLib->GetSelectedFilter(self)", ORPG_DEBUG) 660 if self.filterIdx != -1: return self.selectFilterWnd.GetItem(self.filterIdx, 0).GetText()
746 if self.filterIdx != -1:
747 self.log.log("Exit AliasLib->GetSelectedFilter(self) return " + str(self.filterIdx), ORPG_DEBUG)
748 return self.selectFilterWnd.GetItem(self.filterIdx, 0).GetText()
749 self.log.log("Exit AliasLib->GetSelectedFilter(self) return " + str(self.filterIdx), ORPG_DEBUG)
750 return self.chat.defaultFilterName 661 return self.chat.defaultFilterName
751 662
752 def SetSelectedFilter(self, idx): 663 def SetSelectedFilter(self, idx):
753 self.log.log("Enter AliasLib->SetSelectedFilter(self, filter)", ORPG_DEBUG)
754 self.filterIdx = idx 664 self.filterIdx = idx
755 self.log.log("Exit AliasLib->SetSelectedFilter(self, filter)", ORPG_DEBUG)
756 665
757 def GetFilterList(self): 666 def GetFilterList(self):
758 self.log.log("Enter AliasLib->GetFilterList(self)", ORPG_DEBUG)
759 list = [] 667 list = []
760 for n in xrange(-1, self.selectFilterWnd.GetItemCount()): 668 for n in xrange(-1, self.selectFilterWnd.GetItemCount()):
761 self.filter = n 669 self.filter = n
762 list.append(self.filter) 670 list.append(self.filter)
763 self.log.log("Exit AliasLib->GetFilterList(self)", ORPG_DEBUG)
764 return list 671 return list
765 672
766 def SetFilterList(self, list): 673 def SetFilterList(self, list):
767 self.log.log("Enter AliasLib->SetFilterList(self, list)", ORPG_DEBUG)
768 self.selectFilterWnd.ClearAll() 674 self.selectFilterWnd.ClearAll()
769 self.selectFilterWnd.InsertColumn(0, "Filter Name") 675 self.selectFilterWnd.InsertColumn(0, "Filter Name")
770 for item in list: 676 for item in list:
771 i = self.selectFilterWnd.InsertStringItem(self.selectFilterWnd.GetItemCount(), item) 677 i = self.selectFilterWnd.InsertStringItem(self.selectFilterWnd.GetItemCount(), item)
772 self.selectFilterWnd.RefreshItem(i) 678 self.selectFilterWnd.RefreshItem(i)
773 self.selectFilterWnd.SetColumnWidth(0, wx.LIST_AUTOSIZE) 679 self.selectFilterWnd.SetColumnWidth(0, wx.LIST_AUTOSIZE)
774 self.filter = -1 680 self.filter = -1
775 self.RefreshAliases() 681 self.RefreshAliases()
776 self.log.log("Exit AliasLib->SetFilterList(self, list)", ORPG_DEBUG)
777 682
778 def GetFilterRegEx(self): 683 def GetFilterRegEx(self):
779 if self.filterIdx == -1: 684 if self.filterIdx == -1: return []
780 return []
781 return self.regExList[self.filterIdx] 685 return self.regExList[self.filterIdx]
782 686
783 def SetFilterRegEx(self, list): 687 def SetFilterRegEx(self, list):
784 self.regExList[self.filterIdx] = list 688 self.regExList[self.filterIdx] = list
785 689
787 #self.textColorBtn = wx.Button(self, wx.ID_ANY, "Color") 691 #self.textColorBtn = wx.Button(self, wx.ID_ANY, "Color")
788 #self.textColorBtn.SetForegroundColour(wx.BLACK) 692 #self.textColorBtn.SetForegroundColour(wx.BLACK)
789 id = event.GetId() 693 id = event.GetId()
790 txt = self.textWnd.GetValue() 694 txt = self.textWnd.GetValue()
791 (beg, end) = self.textWnd.GetSelection() 695 (beg, end) = self.textWnd.GetSelection()
792 if beg != end: 696 if beg != end: sel_txt = txt[beg:end]
793 sel_txt = txt[beg:end] 697 else: sel_txt = txt
794 else: 698 if id == self.textBoldBtn.GetId(): sel_txt = "<b>" + sel_txt + "</b>"
795 sel_txt = txt 699 elif id == self.textItalicBtn.GetId(): sel_txt = "<i>" + sel_txt + "</i>"
796 if id == self.textBoldBtn.GetId(): 700 elif id == self.textUnderlineBtn.GetId(): sel_txt = "<u>" + sel_txt + "</u>"
797 sel_txt = "<b>" + sel_txt + "</b>"
798 elif id == self.textItalicBtn.GetId():
799 sel_txt = "<i>" + sel_txt + "</i>"
800 elif id == self.textUnderlineBtn.GetId():
801 sel_txt = "<u>" + sel_txt + "</u>"
802 elif id == self.textColorBtn.GetId(): 701 elif id == self.textColorBtn.GetId():
803 dlg = wx.ColourDialog(self) 702 dlg = wx.ColourDialog(self)
804 if not dlg.ShowModal() == wx.ID_OK: 703 if not dlg.ShowModal() == wx.ID_OK:
805 dlg.Destroy() 704 dlg.Destroy()
806 return 705 return
807 color = dlg.GetColourData().GetColour() 706 color = dlg.GetColourData().GetColour()
808 color = RGBHex().hexstring(color[0], color[1], color[2]) 707 color = RGBHex().hexstring(color[0], color[1], color[2])
809 dlg.Destroy() 708 dlg.Destroy()
810 sel_txt = '<font color="' + color + '">' + sel_txt + '</font>' 709 sel_txt = '<font color="' + color + '">' + sel_txt + '</font>'
811 if beg != end: 710 if beg != end: txt = txt[:beg] + sel_txt + txt[end:]
812 txt = txt[:beg] + sel_txt + txt[end:] 711 else: txt = sel_txt
813 else:
814 txt = sel_txt
815 self.textWnd.SetValue(txt) 712 self.textWnd.SetValue(txt)
816 self.textWnd.SetInsertionPointEnd() 713 self.textWnd.SetInsertionPointEnd()
817 self.textWnd.SetFocus() 714 self.textWnd.SetFocus()
818 715
819 #Properties 716 #Properties
820 alias = property(GetSelectedAlias, SetSelectedAlias) 717 alias = property(GetSelectedAlias, SetSelectedAlias)
821 aliasList = property(GetAliasList, SetAliasList) 718 aliasList = property(GetAliasList, SetAliasList)
822 aliasColor = property(GetAliasColor, SetAliasColor) 719 aliasColor = property(GetAliasColor, SetAliasColor)
823
824 filter = property(GetSelectedFilter, SetSelectedFilter) 720 filter = property(GetSelectedFilter, SetSelectedFilter)
825 filterList = property(GetFilterList, SetFilterList) 721 filterList = property(GetFilterList, SetFilterList)
826 filterRegEx = property(GetFilterRegEx, SetFilterRegEx) 722 filterRegEx = property(GetFilterRegEx, SetFilterRegEx)
827 723
828 724
829
830 class FilterEditWnd(wx.Frame): 725 class FilterEditWnd(wx.Frame):
831 def __init__(self, parent, filterName, filterList): 726 def __init__(self, parent, filterName, filterList):
832 wx.Frame.__init__(self, parent, wx.ID_ANY, "Edit Filter: " + filterName) 727 wx.Frame.__init__(self, parent, wx.ID_ANY, "Edit Filter: " + filterName)
833
834 self.filterList = filterList 728 self.filterList = filterList
835 self.parent = parent 729 self.parent = parent
836
837 self.Freeze() 730 self.Freeze()
838 self.buildGUI() 731 self.buildGUI()
839 self.fillList() 732 self.fillList()
840 self.Layout() 733 self.Layout()
841 self.grid.Select(0) 734 self.grid.Select(0)
842 self.Thaw() 735 self.Thaw()
843
844 self.Bind(wx.EVT_CLOSE, self.OnExit) 736 self.Bind(wx.EVT_CLOSE, self.OnExit)
845 737
846 def buildGUI(self): 738 def buildGUI(self):
847 bsizer = wx.BoxSizer(wx.VERTICAL) 739 bsizer = wx.BoxSizer(wx.VERTICAL)
848 self.panel = wx.Panel(self, wx.ID_ANY) 740 self.panel = wx.Panel(self, wx.ID_ANY)
849 bsizer.Add(self.panel, 1, wx.EXPAND) 741 bsizer.Add(self.panel, 1, wx.EXPAND)
850 self.SetSizer(bsizer) 742 self.SetSizer(bsizer)
851 self.SetAutoLayout(True) 743 self.SetAutoLayout(True)
852
853 self.grid = wx.ListCtrl(self.panel, wx.ID_ANY, style=wx.LC_SINGLE_SEL|wx.LC_REPORT|wx.LC_HRULES) 744 self.grid = wx.ListCtrl(self.panel, wx.ID_ANY, style=wx.LC_SINGLE_SEL|wx.LC_REPORT|wx.LC_HRULES)
854 self.grid.InsertColumn(0, "Replace") 745 self.grid.InsertColumn(0, "Replace")
855 self.grid.InsertColumn(1, "With") 746 self.grid.InsertColumn(1, "With")
856 self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.selectRule, self.grid) 747 self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.selectRule, self.grid)
857 self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.RuleEdit, self.grid) 748 self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.RuleEdit, self.grid)
858
859 self.addBtn = wx.Button(self.panel, wx.ID_ANY, 'Add') 749 self.addBtn = wx.Button(self.panel, wx.ID_ANY, 'Add')
860 self.editBtn = wx.Button(self.panel, wx.ID_ANY, 'Edit') 750 self.editBtn = wx.Button(self.panel, wx.ID_ANY, 'Edit')
861 self.deleteBtn = wx.Button(self.panel, wx.ID_ANY, 'Delete') 751 self.deleteBtn = wx.Button(self.panel, wx.ID_ANY, 'Delete')
862 self.okBtn = wx.Button(self.panel, wx.ID_OK, 'Done') 752 self.okBtn = wx.Button(self.panel, wx.ID_OK, 'Done')
863
864 self.Bind(wx.EVT_BUTTON, self.RuleAdd, self.addBtn) 753 self.Bind(wx.EVT_BUTTON, self.RuleAdd, self.addBtn)
865 self.Bind(wx.EVT_BUTTON, self.RuleEdit, self.editBtn) 754 self.Bind(wx.EVT_BUTTON, self.RuleEdit, self.editBtn)
866 self.Bind(wx.EVT_BUTTON, self.RuleDelete, self.deleteBtn) 755 self.Bind(wx.EVT_BUTTON, self.RuleDelete, self.deleteBtn)
867 self.Bind(wx.EVT_BUTTON, self.OnDone, self.okBtn) 756 self.Bind(wx.EVT_BUTTON, self.OnDone, self.okBtn)
868
869 btsizer = wx.BoxSizer(wx.VERTICAL) 757 btsizer = wx.BoxSizer(wx.VERTICAL)
870 btsizer.Add(self.addBtn, 0, wx.EXPAND) 758 btsizer.Add(self.addBtn, 0, wx.EXPAND)
871 btsizer.Add(self.editBtn, 0, wx.EXPAND) 759 btsizer.Add(self.editBtn, 0, wx.EXPAND)
872 btsizer.Add(self.deleteBtn, 0, wx.EXPAND) 760 btsizer.Add(self.deleteBtn, 0, wx.EXPAND)
873 btsizer.Add(self.okBtn, 0, wx.EXPAND) 761 btsizer.Add(self.okBtn, 0, wx.EXPAND)
874
875 sizer = wx.GridBagSizer(5,5) 762 sizer = wx.GridBagSizer(5,5)
876
877 sizer.Add(self.grid, (0,0), flag=wx.EXPAND) 763 sizer.Add(self.grid, (0,0), flag=wx.EXPAND)
878 sizer.Add(btsizer, (0,1), flag=wx.EXPAND) 764 sizer.Add(btsizer, (0,1), flag=wx.EXPAND)
879
880 sizer.AddGrowableCol(0) 765 sizer.AddGrowableCol(0)
881 sizer.AddGrowableRow(0) 766 sizer.AddGrowableRow(0)
882 sizer.SetEmptyCellSize((0,0)) 767 sizer.SetEmptyCellSize((0,0))
883
884 self.panel.SetSizer(sizer) 768 self.panel.SetSizer(sizer)
885 self.panel.SetAutoLayout(True) 769 self.panel.SetAutoLayout(True)
886 770
887 def fillList(self): 771 def fillList(self):
888 for rule in self.filterList: 772 for rule in self.filterList:
889 i = self.grid.InsertStringItem(self.grid.GetItemCount(), rule[0]) 773 i = self.grid.InsertStringItem(self.grid.GetItemCount(), rule[0])
890 self.grid.SetStringItem(i, 1, rule[1]) 774 self.grid.SetStringItem(i, 1, rule[1])
891
892 self.grid.SetColumnWidth(0, wx.LIST_AUTOSIZE) 775 self.grid.SetColumnWidth(0, wx.LIST_AUTOSIZE)
893 self.grid.SetColumnWidth(1, wx.LIST_AUTOSIZE) 776 self.grid.SetColumnWidth(1, wx.LIST_AUTOSIZE)
894 777
895 def selectRule(self, event): 778 def selectRule(self, event):
896 self.currentIdx = event.GetIndex() 779 self.currentIdx = event.GetIndex()
897 self.Freeze() 780 self.Freeze()
898 for i in xrange(0, self.grid.GetItemCount()): 781 for i in xrange(0, self.grid.GetItemCount()):
899 self.grid.SetItemBackgroundColour(i, (255,255,255)) 782 self.grid.SetItemBackgroundColour(i, (255,255,255))
900
901 self.grid.SetItemBackgroundColour(self.currentIdx, (0,255,0)) 783 self.grid.SetItemBackgroundColour(self.currentIdx, (0,255,0))
902 self.grid.SetItemState(self.currentIdx, 0, wx.LIST_STATE_SELECTED) 784 self.grid.SetItemState(self.currentIdx, 0, wx.LIST_STATE_SELECTED)
903 self.grid.EnsureVisible(self.currentIdx) 785 self.grid.EnsureVisible(self.currentIdx)
904 self.Thaw() 786 self.Thaw()
905 787
912 sizer.Add(wx.StaticText(dlg, wx.ID_ANY, 'With: '), 0, wx.EXPAND) 794 sizer.Add(wx.StaticText(dlg, wx.ID_ANY, 'With: '), 0, wx.EXPAND)
913 withtxt = wx.TextCtrl(dlg, wx.ID_ANY) 795 withtxt = wx.TextCtrl(dlg, wx.ID_ANY)
914 sizer.Add(withtxt, 0, wx.EXPAND) 796 sizer.Add(withtxt, 0, wx.EXPAND)
915 sizer.Add(wx.Button(dlg, wx.ID_OK, 'Ok'), 0, wx.EXPAND) 797 sizer.Add(wx.Button(dlg, wx.ID_OK, 'Ok'), 0, wx.EXPAND)
916 sizer.Add(wx.Button(dlg, wx.ID_CANCEL, 'Cancel'), 0, wx.EXPAND) 798 sizer.Add(wx.Button(dlg, wx.ID_CANCEL, 'Cancel'), 0, wx.EXPAND)
917
918 dlg.SetSizer(sizer) 799 dlg.SetSizer(sizer)
919 dlg.SetAutoLayout(True) 800 dlg.SetAutoLayout(True)
920 dlg.Fit() 801 dlg.Fit()
921
922 rpltxt.SetValue(self.grid.GetItem(self.currentIdx, 0).GetText()) 802 rpltxt.SetValue(self.grid.GetItem(self.currentIdx, 0).GetText())
923 withtxt.SetValue(self.grid.GetItem(self.currentIdx, 1).GetText()) 803 withtxt.SetValue(self.grid.GetItem(self.currentIdx, 1).GetText())
924
925 if dlg.ShowModal() != wx.ID_OK: 804 if dlg.ShowModal() != wx.ID_OK:
926 dlg.Destroy() 805 dlg.Destroy()
927 return 806 return
928
929 self.grid.SetStringItem(self.currentIdx, 0, rpltxt.GetValue()) 807 self.grid.SetStringItem(self.currentIdx, 0, rpltxt.GetValue())
930 self.grid.SetStringItem(self.currentIdx, 1, withtxt.GetValue()) 808 self.grid.SetStringItem(self.currentIdx, 1, withtxt.GetValue())
931 self.grid.RefreshItem(self.currentIdx) 809 self.grid.RefreshItem(self.currentIdx)
932 self.grid.SetColumnWidth(0, wx.LIST_AUTOSIZE) 810 self.grid.SetColumnWidth(0, wx.LIST_AUTOSIZE)
933 self.grid.SetColumnWidth(1, wx.LIST_AUTOSIZE) 811 self.grid.SetColumnWidth(1, wx.LIST_AUTOSIZE)
934
935 dlg.Destroy() 812 dlg.Destroy()
936 813
937 def RuleAdd(self, event): 814 def RuleAdd(self, event):
938 i = self.grid.InsertStringItem(self.grid.GetItemCount(), '') 815 i = self.grid.InsertStringItem(self.grid.GetItemCount(), '')
939 self.grid.SetStringItem(i, 1, '') 816 self.grid.SetStringItem(i, 1, '')
944 self.grid.DeleteItem(self.currentIdx) 821 self.grid.DeleteItem(self.currentIdx)
945 self.grid.Select(0) 822 self.grid.Select(0)
946 823
947 def OnExit(self, event): 824 def OnExit(self, event):
948 self.MakeModal(False) 825 self.MakeModal(False)
949
950 list = [] 826 list = []
951 for i in xrange(0, self.grid.GetItemCount()): 827 for i in xrange(0, self.grid.GetItemCount()):
952 list.append([self.grid.GetItem(i, 0).GetText(), self.grid.GetItem(i, 1).GetText()]) 828 list.append([self.grid.GetItem(i, 0).GetText(), self.grid.GetItem(i, 1).GetText()])
953
954 self.parent.filterRegEx = list 829 self.parent.filterRegEx = list
955 event.Skip() 830 event.Skip()
956 831
957 def OnDone(self, event): 832 def OnDone(self, event):
958 self.Close() 833 self.Close()