Mercurial > traipse_dev
diff plugins/xxhiddendice.py @ 227:81d0bfd5e800 alpha
Traipse Alpha 'OpenRPG' {100612-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 (Preparing to close updates)
New Features:
New to Map, can re-order Grid, Miniatures, and Whiteboard layer draw order
Fixes:
Fix to InterParse that was causing an Infernal Loop with Namespace Internal
Fix to XML data, removed old Minidom and switched to Element Tree
Fix to Server that was causing eternal attempt to find a Server ID, in Register Rooms thread
Fix to metaservers.xml file not being created
author | sirebral |
---|---|
date | Sat, 12 Jun 2010 03:50:37 -0500 |
parents | c160f26ecf65 |
children |
line wrap: on
line diff
--- a/plugins/xxhiddendice.py Fri Jan 15 22:45:51 2010 -0600 +++ b/plugins/xxhiddendice.py Sat Jun 12 03:50:37 2010 -0500 @@ -1,6 +1,6 @@ -import os -import re +import os, re, wx import orpg.pluginhandler +from orpg.tools.InterParse import Parse class Plugin(orpg.pluginhandler.PluginHandler): # Initialization subroutine. @@ -23,32 +23,39 @@ self.hiddenrolls = [] self.dicere = "\{([0-9]*d[0-9]*.+)\}" + def plugin_menu(self): + self.menu = wx.Menu() + self.toggle = self.menu.AppendCheckItem(wx.ID_ANY, 'On') + self.topframe.Bind(wx.EVT_MENU, self.plugin_toggle, self.toggle) + self.toggle.Check(True) + + def plugin_toggle(self, evt): + pass def plugin_enabled(self): pass - def plugin_disabled(self): pass - def pre_parse(self, text): - m = re.search(self.dicere, text) - while m: - roll = "[" + m.group(1) + "]" - self.hiddenrolls += [self.chat.ParseDice(roll)] - text = text[:m.start()] + "(hidden roll)" + text[m.end():] + if self.toggle.IsChecked() == True: m = re.search(self.dicere, text) + while m: + roll = "[" + m.group(1) + "]" + self.hiddenrolls += [Parse.Dice(roll)] + text = text[:m.start()] + "(hidden roll)" + text[m.end():] + m = re.search(self.dicere, text) return text def post_msg(self, text, myself): - c = 0 - a = text.find("(hidden roll)") - - while len(self.hiddenrolls) > c and a > -1: - text = text[:a+14].replace("(hidden roll)", self.hiddenrolls[c]) + text[a+14:] + if self.toggle.IsChecked() == True: + c = 0 a = text.find("(hidden roll)") - c += 1 - if c > 0: - self.hiddenrolls = [] + while len(self.hiddenrolls) > c and a > -1: + text = text[:a+14].replace("(hidden roll)", self.hiddenrolls[c]) + text[a+14:] + a = text.find("(hidden roll)") + c += 1 + if c > 0: + self.hiddenrolls = [] return text