diff orpg/mapper/map.py @ 66:c54768cffbd4 ornery-dev

Traipse Dev 'OpenRPG' {090818-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: *Unstable* This is the first wave of Code Refinement updates. Includes new material from Core Beta; new debugger material (partially implemented), beginnings of switch to etree, TerminalWriter, and a little more. open_rpg has been renamed to component; functioning now as component.get(), component.add(), component.delete(). This version has known bugs, specifically with the gametree and nodes. I think the XML files where not removed during testing of Core and switching back.
author sirebral
date Tue, 18 Aug 2009 06:33:37 -0500
parents 072ffc1d466f
children 449a8900f9ac
line wrap: on
line diff
--- a/orpg/mapper/map.py	Mon Aug 17 06:56:31 2009 -0500
+++ b/orpg/mapper/map.py	Tue Aug 18 06:33:37 2009 -0500
@@ -31,7 +31,7 @@
 from map_msg import *
 from min_dialogs import *
 from map_prop_dialog import *
-import orpg.dirpath
+from orpg.dirpath import dir_struct
 import random
 import os
 import thread
@@ -44,7 +44,7 @@
 from images import ImageHandler
 from grid_handler import *
 from map_handler import *
-from orpg.orpgCore import open_rpg
+from orpg.orpgCore import component
 
 # Various marker modes for player tools on the map
 MARKER_MODE_NONE = 0
@@ -55,10 +55,10 @@
 class MapCanvas(wx.ScrolledWindow):
     def __init__(self, parent, ID, isEditor=0):
         self.parent = parent
-        self.log = open_rpg.get_component("log")
+        self.log = component.get("log")
         self.log.log("Enter MapCanvas", ORPG_DEBUG)
-        self.settings = open_rpg.get_component("settings")
-        self.session = open_rpg.get_component("session")
+        self.settings = component.get("settings")
+        self.session = component.get("session")
         wx.ScrolledWindow.__init__(self, parent, ID, 
             style=wx.HSCROLL | wx.VSCROLL | wx.FULL_REPAINT_ON_RESIZE | wx.SUNKEN_BORDER )
         self.frame = parent
@@ -120,7 +120,7 @@
 
     def processImages(self, evt=None):
         self.log.log("Enter MapCanvas->processImages(self)", ORPG_DEBUG)
-        self.session = open_rpg.get_component("session")
+        self.session = component.get("session")
         if self.session.my_role() == self.session.ROLE_LURKER or (str(self.session.group_id) == '0' and str(self.session.status) == '1'):
             cidx = self.parent.get_tab_index("Background")
             self.parent.layer_tabs.EnableTab(cidx, False)
@@ -545,8 +545,8 @@
     def on_left_up(self, evt):
         self.log.log("Enter MapCanvas->on_left_up(self, evt)", ORPG_DEBUG)
         if evt.ShiftDown(): self.on_tape_up(evt)
-        elif open_rpg.get_component("tree").dragging:
-            tree = open_rpg.get_component("tree")
+        elif component.get("tree").dragging:
+            tree = component.get("tree")
             if tree.drag_obj.map_aware():
                 tree.drag_obj.on_send_to_map(evt)
                 tree.dragging = False
@@ -557,7 +557,7 @@
     def on_motion(self, evt):
         self.log.log("Enter MapCanvas->on_motion(self, evt)", ORPG_DEBUG)
         if evt.ShiftDown(): self.on_tape_motion(evt)
-        elif evt.LeftIsDown() and open_rpg.get_component("tree").dragging: pass
+        elif evt.LeftIsDown() and component.get("tree").dragging: pass
         else: self.frame.on_motion(evt)
         self.log.log("Exit MapCanvas->on_motion(self, evt)", ORPG_DEBUG)
 
@@ -628,8 +628,8 @@
 
     def on_prop(self, evt):
         self.log.log("Enter MapCanvas->on_prop(self, evt)", ORPG_DEBUG)
-        self.session = open_rpg.get_component("session")
-        self.chat = open_rpg.get_component("chat")
+        self.session = component.get("session")
+        self.chat = component.get("chat")
         if (self.session.my_role() != self.session.ROLE_GM):
             self.chat.InfoPost("You must be a GM to use this feature")
             self.log.log("Exit MapCanvas->on_prop(self, evt)", ORPG_DEBUG)
@@ -806,14 +806,14 @@
 
 class map_wnd(wx.Panel):
     def __init__(self, parent, id):
-        self.log = open_rpg.get_component('log')
+        self.log = component.get('log')
         self.log.log("Enter map_wnd", ORPG_DEBUG)
         wx.Panel.__init__(self, parent, id)
         self.canvas = MapCanvas(self, -1)
-        self.session = open_rpg.get_component('session')
-        self.settings = open_rpg.get_component('settings')
-        self.chat = open_rpg.get_component('chat')
-        self.top_frame = open_rpg.get_component('frame')
+        self.session = component.get('session')
+        self.settings = component.get('settings')
+        self.chat = component.get('chat')
+        self.top_frame = component.get('frame')
         self.root_dir = os.getcwd()
         self.current_layer = 2
         self.layer_tabs = orpgTabberWnd(self, style=FNB.FNB_NO_X_BUTTON|FNB.FNB_BOTTOM|FNB.FNB_NO_NAV_BUTTONS)
@@ -850,7 +850,7 @@
             self.chat.InfoPost("You must be a GM to use this feature")
             self.log.log("Exit map_wnd->load_default(self)", ORPG_DEBUG)
             return
-        f = open(orpg.dirpath.dir_struct["template"] + "default_map.xml")
+        f = open(dir_struct["template"] + "default_map.xml")
         self.new_data(f.read())
         f.close()
         self.canvas.send_map_data("new")
@@ -870,7 +870,7 @@
             self.chat.InfoPost("You must be a GM to use this feature")
             self.log.log("Exit map_wnd->new_data(self, data)", ORPG_DEBUG)
             return
-        d = wx.FileDialog(self.GetParent(), "Save map data", orpg.dirpath.dir_struct["user"], "", "*.xml", wx.SAVE)
+        d = wx.FileDialog(self.GetParent(), "Save map data", dir_struct["user"], "", "*.xml", wx.SAVE)
         if d.ShowModal() == wx.ID_OK:
             f = open(d.GetPath(), "w")
             data = '<nodehandler class="min_map" icon="compass" module="core" name="miniature Map">'
@@ -889,7 +889,7 @@
             self.chat.InfoPost("You must be a GM to use this feature")
             self.log.log("Exit map_wnd->on_open(self, evt)", ORPG_DEBUG)
             return
-        d = wx.FileDialog(self.GetParent(), "Select a file", orpg.dirpath.dir_struct["user"], "", "*.xml", wx.OPEN)
+        d = wx.FileDialog(self.GetParent(), "Select a file", dir_struct["user"], "", "*.xml", wx.OPEN)
         if d.ShowModal() == wx.ID_OK:
             f = open(d.GetPath())
             map_string = f.read()