diff orpg/mapper/background.py @ 140:e842a5f1b775 beta

Traipse Beta 'OpenRPG' {091123-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 (Beta) Added Bookmarks Fix to Remote Admin Commands Minor fix to text based Server Fix to Pretty Print, from Core Fix to Splitter Nodes not being created Fix to massive amounts of images loading, from Core Added 'boot' command to remote admin Added confirmation window for sent nodes Minor changes to allow for portability to an OpenSUSE linux OS Miniatures Layer pop up box allows users to turn off Mini labels, from FlexiRPG Zoom Mouse plugin added Images added to Plugin UI Switching to Element Tree Map efficiency, from FlexiRPG Added Status Bar to Update Manager default_manifest.xml renamed to default_upmana.xml Cleaner clode for saved repositories New TrueDebug Class in orpg_log (See documentation for usage) Mercurial's hgweb folder is ported to upmana Pretty important update that can help remove thousands of dead children from your gametree. Children, <forms />, <group_atts />, <horizontal />, <cols />, <rows />, <height />, etc... are all tags now. Check your gametree and look for dead children!! New Gametree Recursion method, mapping, and context sensitivity. !Infinite Loops return error instead of freezing the software! New Syntax added for custom PC sheets Tip of the Day added, from Core and community Fixed Whiteboard ID to prevent random line or text deleting. Modified ID's to prevent non updated clients from ruining the fix.
author sirebral
date Mon, 23 Nov 2009 03:36:26 -0600
parents dcf4fbe09b70
children 6081bdc2b8d5
line wrap: on
line diff
--- a/orpg/mapper/background.py	Tue Nov 10 14:11:28 2009 -0600
+++ b/orpg/mapper/background.py	Mon Nov 23 03:36:26 2009 -0600
@@ -50,7 +50,7 @@
 BG_COLOR = 3
 
 class layer_back_ground(layer_base):
-    @debugging
+
     def __init__(self, canvas):
         self.canvas = canvas
         self.log = component.get('log')
@@ -59,14 +59,14 @@
         self.r_h = RGBHex()
         self.clear()
 
-    @debugging
+
     def error_loading_image(self, image):
         msg = "Unable to load image:" + `image`
         dlg = wx.MessageDialog(self.canvas,msg,'File not Found',wx.ICON_EXCLAMATION)
         dlg.ShowModal()
         dlg.Destroy()
 
-    @debugging
+
     def clear(self):
         self.type = BG_NONE
         self.bg_bmp = None
@@ -77,16 +77,16 @@
         self.localTime = -1
         self.isUpdated = True
 
-    @debugging
+
     def get_type(self):
         return self.type
 
-    @debugging
+
     def get_img_path(self):
         if self.img_path: return self.img_path
         else: return ""
 
-    @debugging
+
     def get_color(self):
         hexcolor = "#FFFFFF"
         if self.bg_color:
@@ -94,25 +94,25 @@
             hexcolor = self.r_h.hexstring(red, green, blue)
         return hexcolor
 
-    @debugging
+
     def set_texture(self, path):
         self.isUpdated = True
         self.type = BG_TEXTURE
         if self.img_path != path:
             try:
-                self.bg_bmp = ImageHandler.load(path, "texture", 0)
+                self.bg_bmp = ImageHandler.load(path, "texture", 0).ConvertToBitmap()
                 if self.bg_bmp == None:
                     logger.general("Invalid image type!")
                     raise Exception, "Invalid image type!"
             except: self.error_loading_image(path)
         self.img_path = path
 
-    @debugging
+
     def set_image(self, path, scale):
         self.isUpdated = True
         self.type = BG_IMAGE
         if self.img_path != path:
-            self.bg_bmp = ImageHandler.load(path, "background", 0)
+            self.bg_bmp = ImageHandler.load(path, "background", 0).ConvertToBitmap()
             try:
                 if self.bg_bmp == None:
                     logger.general("Invalid image type!")
@@ -121,7 +121,7 @@
         self.img_path = path
         return (self.bg_bmp.GetWidth(),self.bg_bmp.GetHeight())
 
-    @debugging
+
     def set_color(self, color):
         self.isUpdated = True
         self.type = BG_COLOR
@@ -129,17 +129,11 @@
         self.bg_color = cmpColour(r,g,b)
         self.canvas.SetBackgroundColour(self.bg_color)
 
-    @debugging
+
     def layerDraw(self, dc, scale, topleft, size):
         if self.bg_bmp == None or not self.bg_bmp.Ok() or ((self.type != BG_TEXTURE) and (self.type != BG_IMAGE)):
             return False
         dc2 = wx.MemoryDC()
-        
-        ### Temporary ###
-        try: self.bg_bmp = self.bg_bmp.ConvertToBitmap()
-        except: pass
-        #################
-        
         dc2.SelectObject(self.bg_bmp)
         topLeft = [int(topleft[0]/scale), int(topleft[1]/scale)]
         topRight = [int((topleft[0]+size[0]+1)/scale)+1, int((topleft[1]+size[1]+1)/scale)+1]
@@ -210,7 +204,7 @@
         del dc2
         return True
 
-    @debugging
+
     def layerToXML(self, action="update"):
         xml_str = "<bg"
         if self.bg_color != None:
@@ -230,7 +224,7 @@
             return xml_str
         else: return ''
 
-    @debugging
+
     def layerTakeDOM(self, xml_dom):
         type = BG_COLOR
         color = xml_dom.getAttribute("color")
@@ -263,7 +257,7 @@
                 postdata = urllib.urlencode({'filename':filename[1], 'imgdata':imgdata, 'imgtype':imgtype})
                 thread.start_new_thread(self.upload, (postdata, self.localPath, type))
 
-    @debugging
+
     def upload(self, postdata, filename, type):
         self.lock.acquire()
         if type == 'Image' or type == 'Texture':