diff orpg/mapper/map.py @ 28:ff154cf3350c ornery-orc

Traipse 'OpenRPG' {100203-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 (Stable) New Features: New Bookmarks Feature New 'boot' command to remote admin New confirmation window for sent nodes Miniatures Layer pop up box allows users to turn off Mini labels, from FlexiRPG New Zoom Mouse plugin added New Images added to Plugin UI Switching to Element Tree New Map efficiency, from FlexiRPG New Status Bar to Update Manager New TrueDebug Class in orpg_log (See documentation for usage) New Portable Mercurial New Tip of the Day, from Core and community New Reference Syntax added for custom PC sheets New Child Reference for gametree New Parent Reference for gametree New Gametree Recursion method, mapping, context sensitivity, and effeciency.. New Features node with bonus nodes and Node Referencing help added New Dieroller structure from Core New DieRoller portability for odd Dice New 7th Sea die roller; ie [7k3] = [7d10.takeHighest(3).open(10)] New 'Mythos' System die roller added New vs. die roller method for WoD; ie [3v3] = [3d10.vs(3)]. Included for Mythos roller also New Warhammer FRPG Die Roller (Special thanks to Puu-san for the support) New EZ_Tree Reference system. Push a button, Traipse the tree, get a reference (Beta!) New Grids act more like Spreadsheets in Use mode, with Auto Calc Fixes: Fix to allow for portability to an OpenSUSE linux OS Fix to mplay_client for Fedora and OpenSUSE Fix to Text based Server Fix to Remote Admin Commands Fix to Pretty Print, from Core Fix to Splitter Nodes not being created Fix to massive amounts of images loading, from Core Fix to Map from gametree not showing to all clients Fix to gametree about menus Fix to Password Manager check on startup Fix to PC Sheets from tool nodes. They now use the tabber_panel Fix to Whiteboard ID to prevent random line or text deleting. Fixes to Server, Remote Server, and Server GUI Fix to Update Manager; cleaner clode for saved repositories Fixes made to Settings Panel and now reactive settings when Ok is pressed Fixes to Alternity roller's attack roll. Uses a simple Tuple instead of a Splice Fix to Use panel of Forms and Tabbers. Now longer enters design mode Fix made Image Fetching. New fetching image and new failed image Fix to whiteboard ID's to prevent non updated clients from ruining the fix. default_manifest.xml renamed to default_upmana.xml
author sirebral
date Wed, 03 Feb 2010 22:16:49 -0600
parents 97265586402b
children fc48380f0c9f
line wrap: on
line diff
--- a/orpg/mapper/map.py	Sat Oct 03 18:49:37 2009 -0500
+++ b/orpg/mapper/map.py	Wed Feb 03 22:16:49 2010 -0600
@@ -21,22 +21,18 @@
 # Author: OpenRPG
 # Maintainer:
 # Version:
-#   $Id: map.py,v 1.73 2007/12/07 20:39:49 digitalxero Exp $
+#   $Id: map.py,v Traipse 'Ornery-Orc' prof.ebral Exp $
 #
 # Description:
 #
-__version__ = "$Id: map.py,v 1.73 2007/12/07 20:39:49 digitalxero Exp $"
+__version__ = "$Id: map.py,v Traipse 'Ornery-Orc' prof.ebral Exp $"
 
 from map_version import MAP_VERSION
 from map_msg import *
 from min_dialogs import *
 from map_prop_dialog import *
 
-import random
-import os
-import thread
-#import gc #Garbage Collecter Needed?
-import traceback
+import random, os, thread, traceback
 
 from miniatures_handler import *
 from whiteboard_handler import *
@@ -160,14 +156,15 @@
             else: pass
         if not ImageHandler.Queue.empty():
             (path, image_type, imageId) = ImageHandler.Queue.get()
-            img = wx.ImageFromMime(path[1], path[2]).ConvertToBitmap()
+            if path == 'failed': img = wx.Image(dir_struct["icon"] + "failed.png", wx.BITMAP_TYPE_PNG)
+            else: img = wx.ImageFromMime(path[1], path[2])
             try:
                 # Now, apply the image to the proper object
                 if image_type == "miniature":
                     min = self.layers['miniatures'].get_miniature_by_id(imageId)
-                    min.set_bmp(img)
+                    if min: min.set_bmp(img)
                 elif image_type == "background" or image_type == "texture":
-                    self.layers['bg'].bg_bmp = img
+                    self.layers['bg'].bg_bmp = img.ConvertToBitmap()
                     if image_type == "background": self.set_size([img.GetWidth(), img.GetHeight()])
             except: pass
             # Flag that we now need to refresh!
@@ -253,9 +250,8 @@
         topleft1 = self.GetViewStart()
         topleft = [topleft1[0]*scrollsize[0], topleft1[1]*scrollsize[1]]
         if (clientsize[0] > 1) and (clientsize[1] > 1):
-            dc = wx.MemoryDC()
-            bmp = wx.EmptyBitmap(clientsize[0]+1, clientsize[1]+1)
-            dc.SelectObject(bmp)
+            self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
+            dc = wx.AutoBufferedPaintDC(self)
             dc.SetPen(wx.TRANSPARENT_PEN)
             dc.SetBrush(wx.Brush(self.GetBackgroundColour(), wx.SOLID))
             dc.DrawRectangle(0,0,clientsize[0]+1,clientsize[1]+1)
@@ -270,20 +266,11 @@
             self.layers['fog'].layerDraw(dc, topleft, clientsize)
             dc.SetPen(wx.NullPen)
             dc.SetBrush(wx.NullBrush)
-            dc.SelectObject(wx.NullBitmap)
-            del dc
-            wdc = self.preppaint()
-            wdc.DrawBitmap(bmp, topleft[0], topleft[1])
             if settings.get_setting("AlwaysShowMapScale") == "1":
-                self.showmapscale(wdc)
+                self.showmapscale(dc)
         try: evt.Skip()
         except: pass
 
-    def preppaint(self):
-        dc = wx.PaintDC(self)
-        self.PrepareDC(dc)
-        return (dc)
-
     def showmapscale(self, dc):
         scalestring = "Scale x" + `self.layers['grid'].mapscale`[:3]
         (textWidth, textHeight) = dc.GetTextExtent(scalestring)
@@ -380,8 +367,6 @@
             dc.SetUserScale(self.layers['grid'].mapscale,self.layers['grid'].mapscale)
             # Grab the current map position
             pos = self.snapMarker( evt.GetLogicalPosition( dc ) )
-            # Enable brush optimizations
-            # dc.SetOptimization( True )
             # Set up the pen used for drawing our marker
             dc.SetPen( wx.Pen(wx.RED, 1, wx.LONG_DASH) )
             # Now, based on the marker mode, draw the right thing
@@ -399,8 +384,6 @@
                 # As long as we are in marker mode, we ned to update the stop point
                 self.markerStop = pos
             dc.SetPen(wx.NullPen)
-            # Disable brush optimizations
-            #dc.SetOptimization( False )
             del dc
 
     def on_tape_down(self, evt):
@@ -416,8 +399,6 @@
         self.markerMode = MARKER_MODE_MEASURE
         # Erase the old line if her have one
         if self.markerStart.x != -1 and self.markerStart.y != -1:
-            # Enable brush optimizations
-            #dc.SetOptimization( True )
             # Set up the pen used for drawing our marker
             dc.SetPen( wx.Pen(wx.RED, 1, wx.LONG_DASH) )
             # Set the DC function that we need
@@ -429,8 +410,6 @@
             # Restore the default DC function and pen
             dc.SetLogicalFunction(wx.COPY)
             dc.SetPen(wx.NullPen)
-            # Disable brush optimizations
-            #dc.SetOptimization( False )
         # Save our current start and reset the stop value
         self.markerStart = pos
         self.markerStop = pos
@@ -486,8 +465,8 @@
 
     def on_left_up(self, evt):
         if evt.ShiftDown(): self.on_tape_up(evt)
-        elif component.get("tree").dragging:
-            tree = component.get("tree")
+        elif component.get('tree_fs').dragging:
+            tree = component.get('tree_fs')
             if tree.drag_obj.map_aware():
                 tree.drag_obj.on_send_to_map(evt)
                 tree.dragging = False
@@ -496,7 +475,7 @@
 
     def on_motion(self, evt):
         if evt.ShiftDown(): self.on_tape_motion(evt)
-        elif evt.LeftIsDown() and component.get("tree").dragging: pass
+        elif evt.LeftIsDown() and component.get('tree_fs').dragging: pass
         else: self.frame.on_motion(evt)
 
     def on_zoom_out(self, evt):
@@ -717,8 +696,8 @@
         wx.Panel.__init__(self, parent, id)
         self.canvas = MapCanvas(self, -1)
         self.session = component.get('session')
-        self.chat = component.get('chat')
         self.top_frame = component.get('frame')
+        self.chat = self.top_frame.chat
         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)
@@ -821,7 +800,6 @@
     def on_left_down(self, evt):
         self.layer_handlers[self.current_layer].on_left_down(evt)
 
-    #double click handler added by Snowdog 5/03
     def on_left_dclick(self, evt):
         self.layer_handlers[self.current_layer].on_left_dclick(evt)