annotate plugins/bcg/tokens_msg.py @ 167:5c9a118476b2 alpha

Traipse Alpha 'OpenRPG' {091210-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 (Keeping up with Beta) New Features: Added Bookmarks 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 New TrueDebug Class in orpg_log (See documentation for usage) Portable Mercurial Tip of the Day added, from Core and community New Reference Syntax added for custom PC sheets New Child Reference for gametree New Parent Reference for gametree New Gametree Recursion method, mapping, context sensitivity, and effeciency.. New Features node with bonus nodes and Node Referencing help added Dieroller structure from Core Added 7th Sea die roller method; ie [7k3] = [7d10.takeHighest(3).open(10)] New 'Mythos' System die roller added Added new vs. die roller method for WoD; ie [3v3] = [3d10.vs(3)]. Includes support for Mythos roller Fixes: Fix to Text based Server Fix to Remote Admin Commands Fix to Pretty Print, from Core Fix to Splitter Nodes not being created Fix to massive amounts of images loading, from Core Fix to Map from gametree not showing to all clients Fix to gametree about menus Fix to Password Manager check on startup Fix to PC Sheets from tool nodes. They now use the tabber_panel Fixed Whiteboard ID to prevent random line or text deleting. Modified ID's to prevent non updated clients from ruining the fix. default_manifest.xml renamed to default_upmana.xml Fix to Update Manager; cleaner clode for saved repositories Fixes made to Settings Panel and no reactive settings when Ok is pressed Fixes to Alternity roller's attack roll. Uses a simple Tuple instead of a Splice
author sirebral
date Thu, 10 Dec 2009 10:53:33 -0600
parents 2f2bebe9c77f
children
rev   line source
105
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
1 # Copyright (C) 2000-2001 The OpenRPG Project
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
2 #
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
3 # openrpg-dev@lists.sourceforge.net
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
4 #
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
5 # This program is free software; you can redistribute it and/or modify
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
6 # it under the terms of the GNU General Public License as published by
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
7 # the Free Software Foundation; either version 2 of the License, or
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
8 # (at your option) any later version.
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
9 #
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
10 # This program is distributed in the hope that it will be useful,
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
13 # GNU General Public License for more details.
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
14 #
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
15 # You should have received a copy of the GNU General Public License
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
16 # along with this program; if not, write to the Free Software
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
18 # --
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
19 #
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
20 # File: mapper/tokens_msg.py
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
21 # Author: Chris Davis
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
22 # Maintainer:
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
23 # Version:
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
24 # $Id: tokens_msg.py,v 1.8 2006/11/04 21:24:21 digitalxero Exp $
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
25 #
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
26 # Description: This file contains some of the basic definitions for the chat
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
27 # utilities in the orpg project.
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
28 #
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
29 __version__ = "$Id: tokens_msg.py,v 1.8 2006/11/04 21:24:21 digitalxero Exp $"
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
30
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
31 from base_msg import *
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
32
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
33 class mini_msg(map_element_msg_base):
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
34
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
35 def __init__(self,reentrant_lock_object = None):
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
36 self.tagname = "token" # set this to be for minis. Tagname gets used in some base class functions.
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
37 map_element_msg_base.__init__(self,reentrant_lock_object) # call base class
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
38
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
39 # convenience method to use if only this mini is modified
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
40 # outputs a <map/> element containing only the changes to this mini
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
41 def standalone_update_text(self,update_id_string):
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
42 buffer = "<map id='" + update_id_string + "'>"
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
43 buffer += "<tokens>"
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
44 buffer += self.get_changed_xml()
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
45 buffer += "</tokens></map>"
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
46 return buffer
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
47
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
48 # convenience method to use if only this mini is modified
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
49 # outputs a <map/> element that deletes this mini
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
50 def standalone_delete_text(self,update_id_string):
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
51 buffer = None
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
52 if self._props.has_key("id"):
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
53 buffer = "<map id='" + update_id_string + "'>"
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
54 buffer += "<tokens>"
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
55 buffer += "<token action='del' id='" + self._props("id") + "'/>"
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
56 buffer += "</tokens></map>"
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
57 return buffer
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
58
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
59 # convenience method to use if only this mini is modified
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
60 # outputs a <map/> element to add this mini
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
61 def standalone_add_text(self,update_id_string):
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
62 buffer = "<map id='" + update_id_string + "'>"
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
63 buffer += "<tokens>"
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
64 buffer += self.get_all_xml()
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
65 buffer += "</tokens></map>"
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
66 return buffer
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
67
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
68 def get_all_xml(self,action="new",output_action=1):
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
69 return map_element_msg_base.get_all_xml(self,action,output_action)
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
70
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
71 def get_changed_xml(self,action="update",output_action=1):
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
72 return map_element_msg_base.get_changed_xml(self,action,output_action)
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
73
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
74 class minis_msg(map_element_msg_base):
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
75
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
76 def __init__(self,reentrant_lock_object = None):
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
77 self.tagname = "tokens"
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
78 map_element_msg_base.__init__(self,reentrant_lock_object)
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
79
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
80 def init_from_dom(self,xml_dom):
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
81 self.p_lock.acquire()
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
82 if xml_dom.tagName == self.tagname:
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
83 if xml_dom.getAttributeKeys():
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
84 for k in xml_dom.getAttributeKeys():
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
85 self.init_prop(k,xml_dom.getAttribute(k))
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
86
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
87 for c in xml_dom._get_childNodes():
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
88 mini = mini_msg(self.p_lock)
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
89 try: mini.init_from_dom(c)
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
90 except Exception, e: print e; continue
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
91 id = mini.get_prop("id")
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
92 action = mini.get_prop("action")
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
93
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
94 if action == "new": self.children[id] = mini
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
95 elif action == "del":
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
96 if self.children.has_key(id):
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
97 self.children[id] = None
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
98 del self.children[id]
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
99
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
100 elif action == "update":
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
101 if self.children.has_key(id):
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
102 self.children[id].init_props(mini.get_all_props())
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
103 else:
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
104 self.p_lock.release()
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
105 raise Exception, "Error attempting to initialize a " + self.tagname + " from a non-<" + self.tagname + "/> element"
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
106 self.p_lock.release()
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
107
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
108 def set_from_dom(self,xml_dom):
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
109 self.p_lock.acquire()
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
110 if xml_dom.tagName == self.tagname:
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
111 if xml_dom.getAttributeKeys():
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
112 for k in xml_dom.getAttributeKeys():
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
113 self.set_prop(k,xml_dom.getAttribute(k))
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
114
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
115 for c in xml_dom._get_childNodes():
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
116 mini = mini_msg(self.p_lock)
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
117
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
118 try: mini.set_from_dom(c)
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
119 except Exception, e: print e; continue
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
120 id = mini.get_prop("id")
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
121 action = mini.get_prop("action")
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
122 if action == "new": self.children[id] = mini
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
123 elif action == "del":
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
124 if self.children.has_key(id):
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
125 self.children[id] = None
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
126 del self.children[id]
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
127 elif action == "update":
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
128 if self.children.has_key(id):
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
129 self.children[id].set_props(mini.get_all_props())
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
130 else:
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
131 self.p_lock.release()
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
132 raise Exception, "Error attempting to set a " + self.tagname + " from a non-<" + self.tagname + "/> element"
2f2bebe9c77f Traipse Alpha 'OpenRPG' {091006-03}
sirebral
parents:
diff changeset
133 self.p_lock.release()