diff orpg/main.py @ 119:9314d63c0941 alpha

Traipse Alpha 'OpenRPG' {091029-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: Adds Bookmarks (Alpha) with cool Smiley Star and Plus Symbol images! 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. Fix to remote admin commands Minor fix to texted based server, works in /System/ folder Some Core changes to gametree to correctly disply Pretty Print, thanks David! Fix to Splitter Nodes not being created. Added images to Plugin Control panel for Autostart feature Fix to massive amounts of images loading; from Core fix to gsclient so with_statement imports Added 'boot' command to remote admin Prep work in Pass tool for remote admin rankings and different passwords, ei, Server, Admin, Moderator, etc. Remote Admin Commands more organized, more prep work. Added Confirmation window for sent nodes. Minor changes to allow for portability to an OpenSUSE linux OS (hopefully without breaking) {091028} 00: Made changes to gametree to start working with Element Tree, mostly from Core Minor changes to Map to start working with Element Tree, from Core Preliminary changes to map efficiency, from FlexiRPG Miniatures Layer pop up box allows users to turn off Mini labels, from FlexiRPG Changes to main.py to start working with Element Tree {091029} 00: Changes made to server to start working with Element Tree. Changes made to Meta Server Lib. Prepping test work for a multi meta network page. Minor bug fixed with mini to gametree Zoom Mouse plugin added. Known Issue: Disconnecting causes an server side error. XML data is not being passed correctly.
author sirebral
date Thu, 29 Oct 2009 20:35:28 -0500
parents 217fb049bd00
children 8827271fbe1b
line wrap: on
line diff
--- a/orpg/main.py	Wed Oct 28 14:24:54 2009 -0500
+++ b/orpg/main.py	Thu Oct 29 20:35:28 2009 -0500
@@ -96,7 +96,7 @@
                 "on_password_signal":self.on_password_signal,
                 "orpgFrame":self}
         self.settings = component.get('settings') #Arbitrary until settings updated with Core.
-        self.session = orpg.networking.mplay_client.mplay_client(self.settings.get_setting("player"), call_backs)
+        self.session = orpg.networking.mplay_client.mplay_client(self.settings.get("player"), call_backs)
         self.poll_timer = wx.Timer(self, wx.NewId())
         self.Bind(wx.EVT_TIMER, self.session.poll, self.poll_timer)
         self.poll_timer.Start(100)
@@ -104,7 +104,7 @@
         self.Bind(wx.EVT_TIMER, self.session.update, self.ping_timer)
 
         # create roller manager
-        self.DiceManager = DiceManager(settings.get_setting("dieroller"))
+        self.DiceManager = DiceManager(settings.get("dieroller"))
         component.add('DiceManager', self.DiceManager)
 
         #create password manager --SD 8/03
@@ -123,7 +123,7 @@
         component.add("alias", self.aliaslib)
 
         logger.debug("openrpg components all added")
-        self.tree.load_tree(settings.get_setting("gametree"))
+        self.tree.load_tree(settings.get("gametree"))
         logger.debug("Tree Loaded")
         self.players.size_cols()
 
@@ -235,10 +235,10 @@
                 ]]
 
         self.mainmenu = MenuBarEx(self, menu)
-        if settings.get_setting('Heartbeat') == '1':
+        if settings.get('Heartbeat') == '1':
             self.mainmenu.SetMenuState("GameServerServerHeartbeat", True)
 
-        tabtheme = settings.get_setting('TabTheme')  #This change is stable. TaS.
+        tabtheme = settings.get('TabTheme')  #This change is stable. TaS.
         self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", tabtheme == 'slanted&colorful')
         self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", tabtheme == 'slanted&bw')
         self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", tabtheme == 'slanted&aqua')
@@ -247,7 +247,7 @@
         self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedCustom", tabtheme == 'customslant')
         self.mainmenu.SetMenuState("OpenRPGTabStylesFlatCustom", tabtheme == 'customflat')
 
-        lvl = int(settings.get_setting('LoggingLevel'))
+        lvl = int(settings.get('LoggingLevel'))
         if lvl & ORPG_DEBUG: self.mainmenu.SetMenuState("ToolsLoggingLevelDebug", True)
         if lvl & ORPG_DEBUG: self.mainmenu.SetMenuState("ToolsLoggingLevelNote", True)
         if lvl & ORPG_INFO: self.mainmenu.SetMenuState("ToolsLoggingLevelInfo", True)
@@ -303,7 +303,7 @@
     @debugging
     def SetTabStyles(self, *args, **kwargs):
 
-        tabtheme = settings.get_setting('TabTheme')  #This change is stable. TaS.
+        tabtheme = settings.get('TabTheme')  #This change is stable. TaS.
         self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", tabtheme == 'slanted&colorful')
         self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", tabtheme == 'slanted&bw')
         self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", tabtheme == 'slanted&aqua')
@@ -338,7 +338,7 @@
         component.add("tabbedWindows", tabbedwindows)
 
         #Run though the new list and set the proper styles
-        tabbg = settings.get_setting('TabBackgroundGradient')
+        tabbg = settings.get('TabBackgroundGradient')
         (red, green, blue) = self.rgb.rgb_tuple(tabbg)
 
         for wnd in tabbedwindows:
@@ -361,14 +361,14 @@
     @debugging
     def OnMB_OpenRPGTabStylesSlantedColorful(self):
         if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedColorful"):
-            settings.set_setting('TabTheme', 'slanted&colorful')
+            settings.change('TabTheme', 'slanted&colorful')
             self.SetTabStyles("OpenRPGTabStylesSlantedColorful", FNB.FNB_VC8|FNB.FNB_COLORFUL_TABS)
         else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", True)
 
     @debugging
     def OnMB_OpenRPGTabStylesSlantedBlackandWhite(self):
         if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedBlackandWhite"):
-            settings.set_setting('TabTheme', 'slanted&bw')
+            settings.change('TabTheme', 'slanted&bw')
             self.SetTabStyles("OpenRPGTabStylesSlantedBlackandWhite", 
                 FNB.FNB_VC8, graidentTo=wx.WHITE, graidentFrom=wx.WHITE, textColor=wx.BLACK)
         else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", True)
@@ -376,7 +376,7 @@
     @debugging
     def OnMB_OpenRPGTabStylesSlantedAqua(self):
         if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedAqua"):
-            settings.set_setting('TabTheme', 'slanted&aqua')
+            settings.change('TabTheme', 'slanted&aqua')
             self.SetTabStyles("OpenRPGTabStylesSlantedAqua", FNB.FNB_VC8, 
                 graidentTo=wx.Color(0, 128, 255), graidentFrom=wx.WHITE, textColor=wx.BLACK)
         else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", True)
@@ -384,14 +384,14 @@
     @debugging
     def OnMB_OpenRPGTabStylesSlantedCustom(self):
         if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedCustom"):
-            settings.set_setting('TabTheme', 'customslant')
-            gfrom = settings.get_setting('TabGradientFrom')
+            settings.change('TabTheme', 'customslant')
+            gfrom = settings.get('TabGradientFrom')
             (fred, fgreen, fblue) = self.rgb.rgb_tuple(gfrom)
-            gto = settings.get_setting('TabGradientTo')
+            gto = settings.get('TabGradientTo')
             (tored, togreen, toblue) = self.rgb.rgb_tuple(gto)
-            tabtext = settings.get_setting('TabTextColor')
+            tabtext = settings.get('TabTextColor')
             (tred, tgreen, tblue) = self.rgb.rgb_tuple(tabtext)
-            tabbg = settings.get_setting('TabBackgroundGradient')
+            tabbg = settings.get('TabBackgroundGradient')
             (red, green, blue) = self.rgb.rgb_tuple(tabbg)
             self.SetTabStyles("OpenRPGTabStylesSlantedCustom", FNB.FNB_VC8, 
                 graidentTo=wx.Color(tored, togreen, toblue), graidentFrom=wx.Color(fred, fgreen, fblue), 
@@ -401,7 +401,7 @@
     @debugging
     def OnMB_OpenRPGTabStylesFlatBlackandWhite(self):
         if self.mainmenu.GetMenuState("OpenRPGTabStylesFlatBlackandWhite"):
-            settings.set_setting('TabTheme', 'flat&bw')
+            settings.change('TabTheme', 'flat&bw')
             self.SetTabStyles("OpenRPGTabStylesFlatBlackandWhite", FNB.FNB_FANCY_TABS, 
                 graidentTo=wx.WHITE, graidentFrom=wx.WHITE, textColor=wx.BLACK)
         else: self.mainmenu.SetMenuState("OpenRPGTabStylesFlatBlackandWhite", True)
@@ -409,7 +409,7 @@
     @debugging
     def OnMB_OpenRPGTabStylesFlatAqua(self):
         if self.mainmenu.GetMenuState("OpenRPGTabStylesFlatAqua"):
-            settings.set_setting('TabTheme', 'flat&aqua')
+            settings.change('TabTheme', 'flat&aqua')
             self.SetTabStyles("OpenRPGTabStylesFlatAqua", FNB.FNB_FANCY_TABS, 
                 graidentTo=wx.Color(0, 128, 255), graidentFrom=wx.WHITE, textColor=wx.BLACK)
         else: self.mainmenu.SetMenuState("OpenRPGTabStylesFlatAqua", True)
@@ -417,14 +417,14 @@
     @debugging
     def OnMB_OpenRPGTabStylesFlatCustom(self):
         if self.mainmenu.GetMenuState("OpenRPGTabStylesFlatCustom"):
-            settings.set_setting('TabTheme', 'customflat')
-            gfrom = settings.get_setting('TabGradientFrom')
+            settings.change('TabTheme', 'customflat')
+            gfrom = settings.get('TabGradientFrom')
             (fred, fgreen, fblue) = self.rgb.rgb_tuple(gfrom)
-            gto = settings.get_setting('TabGradientTo')
+            gto = settings.get('TabGradientTo')
             (tored, togreen, toblue) = self.rgb.rgb_tuple(gto)
-            tabtext = settings.get_setting('TabTextColor')
+            tabtext = settings.get('TabTextColor')
             (tred, tgreen, tblue) = self.rgb.rgb_tuple(tabtext)
-            tabbg = settings.get_setting('TabBackgroundGradient')
+            tabbg = settings.get('TabBackgroundGradient')
             (red, green, blue) = self.rgb.rgb_tuple(tabbg)
             self.SetTabStyles("OpenRPGTabStylesFlatCustom", FNB.FNB_FANCY_TABS, 
                 graidentTo=wx.Color(tored, togreen, toblue), graidentFrom=wx.Color(fred, fgreen, fblue), 
@@ -463,8 +463,8 @@
 
     @debugging
     def OnMB_GameServerServerHeartbeat(self):
-        if self.mainmenu.GetMenuState("GameServerServerHeartbeat"): settings.set_setting('Heartbeat', '1')
-        else: settings.set_setting('Heartbeat', '0')
+        if self.mainmenu.GetMenuState("GameServerServerHeartbeat"): settings.change('Heartbeat', '1')
+        else: settings.change('Heartbeat', '0')
 
     @debugging
     def OnMB_GameServerStartServer(self):
@@ -807,9 +807,9 @@
         elif name == "tree":
             temp_wnd = orpg.gametree.gametree.game_tree(parent_wnd, -1)
             self.tree = temp_wnd
-            if settings.get_setting('ColorTree') == '1':
-                self.tree.SetBackgroundColour(settings.get_setting('bgcolor'))
-                self.tree.SetForegroundColour(settings.get_setting('textcolor'))
+            if settings.get('ColorTree') == '1':
+                self.tree.SetBackgroundColour(settings.get('bgcolor'))
+                self.tree.SetForegroundColour(settings.get('textcolor'))
             else:
                 self.tree.SetBackgroundColour('white')
                 self.tree.SetForegroundColour('black')
@@ -822,9 +822,9 @@
         elif name == "player":
             temp_wnd = orpg.player_list.player_list(parent_wnd)
             self.players = temp_wnd
-            if settings.get_setting('ColorTree') == '1':
-                self.players.SetBackgroundColour(settings.get_setting('bgcolor'))
-                self.players.SetForegroundColour(settings.get_setting('textcolor'))
+            if settings.get('ColorTree') == '1':
+                self.players.SetBackgroundColour(settings.get('bgcolor'))
+                self.players.SetForegroundColour(settings.get('textcolor'))
             else:
                 self.players.SetBackgroundColour('white')
                 self.players.SetForegroundColour('black')
@@ -914,7 +914,7 @@
     def start_timer(self):
         self.poll_timer.Start(100)
         s = component.get('settings')
-        if s.get_setting("Heartbeat") == "1":
+        if s.get("Heartbeat") == "1":
             self.ping_timer.Start(1000*60)
             logger.debug("starting heartbeat...", True)
 
@@ -1032,18 +1032,19 @@
         ####Begin changes for Custom Exit Message by mDuo13######
         elif id == orpg.networking.mplay_client.MPLAY_DISCONNECTING:
             settings = component.get('settings')
-            custom_msg = settings.get_setting("dcmsg")
+            custom_msg = settings.get("dcmsg")
             custom_msg=custom_msg[:80]
             if custom_msg[:3]=="/me": self.chat.send_chat_message(custom_msg[3:], 3)
             else: self.chat.system_message(custom_msg)
         #####End Changes for Custom Exit Message by mDuo13
 
-        elif id== orpg.networking.mplay_client.MPLAY_GROUP_CHANGE:
+        elif id == orpg.networking.mplay_client.MPLAY_GROUP_CHANGE:
             group = evt.get_data()
+            print 'main ', group
             self.chat.InfoPost("Moving to room '"+group[1]+"'..")
             if self.gs : self.gs.set_cur_room_text(group[1])
             self.players.reset()
-        elif id== orpg.networking.mplay_client.MPLAY_GROUP_CHANGE_F:
+        elif id == orpg.networking.mplay_client.MPLAY_GROUP_CHANGE_F:
             self.chat.SystemPost("Room access denied!")
 
     @debugging
@@ -1076,9 +1077,9 @@
             logger.general("[WARNING] Map error pre_exit_cleanup()", True)
 
         try:
-            save_tree = string.upper(settings.get_setting("SaveGameTreeOnExit"))
+            save_tree = string.upper(settings.get("SaveGameTreeOnExit"))
             if  (save_tree != "0") and (save_tree != "False") and (save_tree != "NO"):
-                self.tree.save_tree(settings.get_setting("gametree"))
+                self.tree.save_tree(settings.get("gametree"))
         except Exception:
             logger.general("[WARNING] Error saving gametree", True)
 
@@ -1200,7 +1201,7 @@
         component.add('validate', validate)
         component.add("tabbedWindows", [])
 
-        logger._set_log_level = int(settings.get_setting('LoggingLevel'))
+        logger._set_log_level = int(settings.get('LoggingLevel'))
         logger._set_log_to_console(False)
 
 	#Update Manager