diff orpg/tools/pluginui.py @ 112:61fc775862f7 alpha

Traipse Alpha 'OpenRPG' {091009-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: {091006} 00: Adds Bookmarks (Alpha) with cool Smiley Star and Plus Symbol images! 03: Changes made to the map for increased portability. SnowDog has changes planned in Core, though. Added an initial push to the BCG. Not much to see, just shows off how it is re-writing Main code. {091008} 00: Fix to remote admin commands 01: Minor fix to texted based server, works in /System/ folder Some Core changes to gametree to correctly disply Pretty Print, thanks David! {091009} 00: Fix to Splitter Nodes not being created. Plugin Control panel works with images now Fix to massive amounts of images loading; from Core
author sirebral
date Fri, 09 Oct 2009 23:26:21 -0500
parents 8e2b7da4f509
children 217fb049bd00
line wrap: on
line diff
--- a/orpg/tools/pluginui.py	Thu Oct 08 09:10:55 2009 -0500
+++ b/orpg/tools/pluginui.py	Fri Oct 09 23:26:21 2009 -0500
@@ -51,9 +51,9 @@
         self.err_sizer.Add(self.errorMessage, 0, wx.EXPAND)
         self.main_sizer.Add(self.err_sizer, 0, wx.EXPAND)
         self.pluginList = wx.ListCtrl(self.panel, wx.ID_ANY, style=wx.LC_SINGLE_SEL|wx.LC_REPORT|wx.LC_HRULES|wx.LC_SORT_ASCENDING)
-        self.pluginList.InsertColumn(0, "Autostart")
-        self.pluginList.InsertColumn(1, "Name")
-        self.pluginList.InsertColumn(2, "Author")
+        #self.pluginList.InsertColumn(0, "Autostart")
+        self.pluginList.InsertColumn(0, "Name")
+        self.pluginList.InsertColumn(1, "Author")
         self.Bind(wx.EVT_LIST_ITEM_SELECTED, self._selectPlugin, self.pluginList)
         self.Bind(wx.EVT_LIST_ITEM_DESELECTED, self._deselectPlugin, self.pluginList)
         self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self._togglePlugin, self.pluginList)
@@ -166,14 +166,14 @@
     def _selectPlugin(self, evt):
         self._selectedPlugin = evt.GetIndex()
         self.__enablePluginBtns()
-        pname = self.pluginList.GetItem(self._selectedPlugin, 1).GetText()
+        pname = self.pluginList.GetItem(self._selectedPlugin, 0).GetText()
         info = self.available_plugins[pname]
 
         if info[0] in self.enabled_plugins:
             self.enableBtn.Disable()
         else:
             self.disableBtn.Disable()
-        if self.pluginList.GetItem(self._selectedPlugin, 0).GetText() == "X":
+        if pname in self.startplugs:
             self.autostartBtn.Label = "Disable Autostart"
 
         self.__doLayout()
@@ -185,14 +185,12 @@
 
     def _togglePlugin(self, evt):
         idx = evt.GetIndex()
-        pname = self.pluginList.GetItem(idx, 0).GetText()
+        pname = self.pluginList.GetItem(idx, 1).GetText()
         info = self.available_plugins[pname]
-
         if info[0] in self.enabled_plugins:
             self._disable(idx)
         else:
             self._enable(idx)
-
         self.pluginList.SetItemState(self._selectedPlugin, 0, wx.LIST_STATE_SELECTED)
 
     def _enableAll(self, evt):
@@ -206,7 +204,7 @@
         idx = self.__checkIdx(evt)
         if idx is None:
             return
-        pname = self.pluginList.GetItem(idx, 1).GetText()
+        pname = self.pluginList.GetItem(idx, 0).GetText()
         info = self.available_plugins[pname]
         info[1].menu_start()
 
@@ -227,14 +225,16 @@
 
     def _disableAll(self, evt):
         for entry in self.enabled_plugins.keys():
-            #idx = self.pluginList.FindItem(1, self.enabled_plugins[entry].name) #Old Method
-            self._disable(self.enabled_plugins[entry]) #New Method
+            #print self.pluginList.FindItem(1, self.enabled_plugins[entry])
+            idx = self.pluginList.FindItem(0, self.enabled_plugins[entry].name)
+            print self.pluginList
+            self._disable(idx) #New Method
 
     def _disable(self, evt):
         idx = self.__checkIdx(evt)
         if idx is None:
             return
-        pname = self.pluginList.GetItem(idx, 1).GetText()
+        pname = self.pluginList.GetItem(idx, 0).GetText()
         info = self.available_plugins[pname]
         info[1].menu_cleanup()
         try:
@@ -254,12 +254,12 @@
         idx = self.__checkIdx(evt)
         if idx is None:
             return
-        if self.pluginList.GetItem(idx, 1).GetText() in self.startplugs:
-            self.startplugs.remove(self.pluginList.GetItem(idx, 1).GetText())
+        if self.pluginList.GetItem(idx, 0).GetText() in self.startplugs:
+            self.startplugs.remove(self.pluginList.GetItem(idx, 0).GetText())
             self.pluginList.SetItemImage(idx, 0, 0)
             self.autostartBtn.Label = "Autostart"
         else:
-            self.startplugs.append(self.pluginList.GetItem(idx, 1).GetText())
+            self.startplugs.append(self.pluginList.GetItem(idx, 0).GetText())
             self.pluginList.SetItemImage(idx, 1, 0)
             self.autostartBtn.Label = "Disable Autostart"
 
@@ -304,15 +304,17 @@
         i = 0
         for plugname, info in self.available_plugins.iteritems():
             self.pluginNames.append(plugname)
-            idx = self.pluginList.InsertImageItem(self.pluginList.GetItemCount(), 0)
-            self.pluginList.SetStringItem(idx, 2, info[2])
-            self.pluginList.SetStringItem(idx, 1, plugname)
+            #idx = self.pluginList.InsertImageItem(self.pluginList.GetItemCount(), 0)
+            idx = self.pluginList.InsertStringItem(self.pluginList.GetItemCount(), plugname)
+            self.pluginList.SetStringItem(idx, 1, info[2])
+            self.pluginList.SetItemImage(idx, 0, 0)
+            #self.pluginList.SetStringItem(idx, 1, plugname)
             if plugname in self.startplugs:
                 self.pluginList.SetItemImage(idx, 1, 0)
                 self._enable(idx)
             self.pluginList.SetItemData(idx, i)
             i += 1
-        self.pluginList.SetColumnWidth(0, 75)
+        self.pluginList.SetColumnWidth(0, wx.LIST_AUTOSIZE)
         self.pluginList.SetColumnWidth(1, wx.LIST_AUTOSIZE)
         self.pluginList.SetColumnWidth(2, wx.LIST_AUTOSIZE)
         self.__doLayout()