Mercurial > openrpg
changeset 562:a095896cdd8a
fixed multicheckbox and some string.functions()
author | davidbyron |
---|---|
date | Sat, 10 Apr 2010 17:56:36 -0500 |
parents | 1359862ed024 |
children | b69b7409e0f3 |
files | orpg/gametree/gametree.py |
diffstat | 1 files changed, 26 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/orpg/gametree/gametree.py Fri Apr 09 00:12:57 2010 -0500 +++ b/orpg/gametree/gametree.py Sat Apr 10 17:56:36 2010 -0500 @@ -36,6 +36,7 @@ import wx from wx.lib.filebrowsebutton import * +from orpg.ui.util.dlg import MultiCheckBoxDlg from orpg.ui.util.misc import ImageHelper from orpg.orpgCore import open_rpg, ParserContext from orpg.dirpath import dir_struct @@ -467,8 +468,8 @@ if ET.iselement(data): data = ET.tostring(data) - beg = string.find(data,"<tree>") - end = string.rfind(data,"</tree>") + beg = data.find("<tree>") + end = data.rfind("</tree>") data = data[6:end] self.insert_xml(data) @@ -492,18 +493,18 @@ if len(opts): players.remove(me) if len(opts): - dlg = orpgMultiCheckBoxDlg(self.GetParent(),opts,"Select Players:","Whisper To",[]) - if dlg.ShowModal() == wx.ID_OK: - item = self.GetSelection() - obj = self.GetPyData(item) - selections = dlg.get_selections() - if len(selections) == len(opts): - open_rpg.get_component('chat').ParsePost(obj.tohtml(), True, True, ParserContext(obj)) - else: - player_ids = [] - for s in selections: - player_ids.append(players[s][2]) - open_rpg.get_component('chat').whisper_to_players(obj.tohtml(), player_ids, ParserContext(obj)) + with MultiCheckBoxDlg(self, opts, "Select Players:", "Whisper To", []) as dlg: + if dlg.ShowModal() == wx.ID_OK: + item = self.GetSelection() + obj = self.GetPyData(item) + selections = dlg.get_selections() + if len(selections) == len(opts): + open_rpg.get_component('chat').ParsePost(obj.tohtml(), True, True, ParserContext(obj)) + else: + player_ids = [] + for s in selections: + player_ids.append(players[s][2]) + open_rpg.get_component('chat').whisper_to_players(obj.tohtml(), player_ids, ParserContext(obj)) @debugging def on_export_html(self, evt): @@ -559,18 +560,17 @@ me = p if len(opts): players.remove(me) - dlg = orpgMultiCheckBoxDlg(None, opts, "Select Players:", "Send To", []) - if dlg.ShowModal() == wx.ID_OK: - item = self.GetSelection() - obj = self.GetPyData(item) - xmldata = "<tree>" + ET.tostring(obj.xml) + "</tree>" - selections = dlg.get_selections() - if len(selections) == len(opts): - self.session.send(xmldata) - else: - for s in selections: - self.session.send(xmldata,players[s][2]) - dlg.Destroy() + with MultiCheckBoxDlg(self, opts, "Select Players:", "Send To", []) as dlg: + if dlg.ShowModal() == wx.ID_OK: + item = self.GetSelection() + obj = self.GetPyData(item) + xmldata = "<tree>" + ET.tostring(obj.xml) + "</tree>" + selections = dlg.get_selections() + if len(selections) == len(opts): + self.session.send(xmldata) + else: + for s in selections: + self.session.send(xmldata,players[s][2]) @debugging def on_icon(self, evt):