diff plugins/xxgsc.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 4385a7d0efd1
children
line wrap: on
line diff
--- a/plugins/xxgsc.py	Fri Jan 15 22:45:51 2010 -0600
+++ b/plugins/xxgsc.py	Sat Jun 12 03:50:37 2010 -0500
@@ -1,9 +1,7 @@
-import os
-from orpg.orpg_wx import *
+import os, wx
 import random
 import orpg.pluginhandler
 
-
 ID_ROLL = wx.NewId()
 
 class Plugin(orpg.pluginhandler.PluginHandler):
@@ -15,7 +13,7 @@
         orpg.pluginhandler.PluginHandler.__init__(self, plugindb, parent)
 
         self.name = 'Game Status Controller'
-        self.author = 'Woody, updated by mDuo13'
+        self.author = 'Woody, updated by mDuo13 and Calchexas'
         self.help = 'This plugin lets you quickly and easily manage a status that includes \n'
         self.help += 'your HP and AC for AD&D 2nd Edition. Type /gsc to open up the manager\n'
         self.help += 'window, and from there just change the values as necessary and the changes\n'
@@ -26,12 +24,14 @@
 
     def plugin_enabled(self):
         self.plugin_addcommand('/gsc', self.on_gsc, '- The GSC command')
-        self.frame = RollerFrame(None, -1, "Game Status Ctrl (GSC)", self)
+        self.frame = RollerFrame(None, -1, "Game Status Controller (GSC)", self)
         self.frame.Hide()
 
-        item = wx.MenuItem(self.menu, wx.ID_ANY, "GSC Window", "GSC Window", wx.ITEM_CHECK)
-        self.topframe.Bind(wx.EVT_MENU, self._toggleWindow, item)
-        self.menu.AppendItem(item)
+    def plugin_menu(self):
+        self.menu = wx.Menu()
+        self.toggle = self.menu.AppendCheckItem(wx.ID_ANY, 'GSC Window')
+        self.topframe.Bind(wx.EVT_MENU, self._toggleWindow, self.toggle)
+        self.toggle.Check(False)
 
     def plugin_disabled(self):
         self.plugin_removecmd('/gsc')
@@ -48,26 +48,26 @@
 
     #Events
     def _toggleWindow(self, evt):
-        id = evt.GetId()
-        item = self.menu.FindItemById(id)
         if self.frame.IsShown():
             self.frame.Hide()
-            item.Check(False)
+            self.toggle.Check(False)
         else:
             self.frame.Show()
-            item.Check(True)
+            self.toggle.Check(True)
 
 
 class RollerFrame(wx.Frame):
     def __init__(self, parent, ID, title, plugin):
         wx.Frame.__init__(self, parent, ID, title,
-                         wx.DefaultPosition, wx.Size(200, 70))
+                         wx.DefaultPosition, wx.Size(250, 110))
 
         self.settings = plugin.settings
         self.session = plugin.session
         self.plugin = plugin
 
         self.panel = wx.Panel(self,-1)
+        sizer = wx.GridBagSizer(1, 2)
+        self.panel.SetSizer(sizer)
         menu = wx.Menu()
         menu.AppendSeparator()
         menu.Append(wx.ID_EXIT, "&Close", "Close this window")
@@ -77,18 +77,42 @@
 
         self.old_idle = self.settings.get_setting('IdleStatusAlias')
 
-        wx.StaticText(self.panel, -1, "AC:", wx.Point(0, 5))
-        self.ac = wx.SpinCtrl(self.panel, ID_ROLL, "", wx.Point(18, 0), wx.Size(45, -1), min = -100, max = 100, initial = 10)
+        ac_text = wx.StaticText(self.panel, -1, "AC:", wx.Point(0, 5))
+        self.ac = wx.SpinCtrl(self.panel, ID_ROLL, "", 
+                                wx.Point(18, 0), wx.Size(45, -1), min = -100, max = 100, initial = 10)
         self.ac.SetValue(10)
 
-        wx.StaticText(self.panel, -1, "/", wx.Point(136, 5))
-        self.max_hp = wx.SpinCtrl(self.panel, ID_ROLL, "", wx.Point(144, 0), wx.Size(48, -1), min = -999, max = 999, initial = 10)
+        touch_text = wx.StaticText(self.panel, -1, "Touch:", wx.Point(0, 25))
+        self.touch = wx.SpinCtrl(self.panel, ID_ROLL, "", 
+                                wx.Point(60, 25), wx.Size(45, -1), min = -100, max = 100, initial = 10)
+        self.touch.SetValue(10)
+
+        ff_text = wx.StaticText(self.panel, -1, "FF:", wx.Point(115, 25))
+        self.ff = wx.SpinCtrl(self.panel, ID_ROLL, "", 
+                                wx.Point(165, 25), wx.Size(45, -1), min = -100, max = 100, initial = 10)
+        self.ff.SetValue(10)
+        
+        max_hp_text = wx.StaticText(self.panel, -1, "/", wx.Point(150, 5))
+        self.max_hp = wx.SpinCtrl(self.panel, ID_ROLL, "", 
+                                wx.Point(158, 0), wx.Size(48, -1), min = -999, max = 999, initial = 10)
         self.max_hp.SetValue(10)
 
-        wx.StaticText(self.panel, -1, "HP:", wx.Point(65, 5))
-        self.hp = wx.SpinCtrl(self.panel, ID_ROLL, "", wx.Point(83, 0), wx.Size(48, -1), min = -999, max = 999, initial = 10)
+        hp_text = wx.StaticText(self.panel, -1, "HP:", wx.Point(80, 5))
+        self.hp = wx.SpinCtrl(self.panel, ID_ROLL, "", 
+                                wx.Point(98, 0), wx.Size(48, -1), min = -999, max = 999, initial = 10)
         self.hp.SetValue(10)
 
+        sizer.Add(ac_text, (1,0), span=(1,1))
+        sizer.Add(self.ac, (1,1), span=(1,1))
+        sizer.Add(touch_text, (1,2), span=(1,1))
+        sizer.Add(self.touch, (1,3), span=(1,1))
+        sizer.Add(ff_text, (1,4), span=(1,1))
+        sizer.Add(self.ff, (1,5), span=(1,1))
+        sizer.Add(hp_text, (0,0), span=(1,1))
+        sizer.Add(self.hp, (0,1), span=(1,1))
+        sizer.Add(max_hp_text, (0,2), span=(1,1))
+        sizer.Add(self.max_hp, (0,3), span=(1,1))
+        self.SetMinSize((350,100))
         self.Bind(wx.EVT_SPINCTRL, self.SetStatus, id=ID_ROLL)
         self.Bind(wx.EVT_TEXT, self.SetStatus, id=ID_ROLL)
         self.Bind(wx.EVT_MENU, self.TimeToQuit, id=wx.ID_EXIT)
@@ -96,7 +120,7 @@
         self.SetStatus(None)
 
     def SetStatus(self, evt):
-        new_status = "AC: " + str(self.ac.GetValue()) + "   HP: " + str(self.hp.GetValue()) + "/" + str(self.max_hp.GetValue())
+        new_status = "AC: " + str(self.ac.GetValue()) + " (Touch: " + str(self.touch.GetValue()) + " FF: " + str(self.ff.GetValue()) + ")" + " HP: " + str(self.hp.GetValue()) + "/" + str(self.max_hp.GetValue())
         self.settings.set_setting('IdleStatusAlias',new_status)
         self.session.set_text_status(new_status)