comparison orpg/mapper/background_handler.py @ 18:97265586402b ornery-orc

Traipse 'OpenRPG' {090827-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: Update Manager is now in version 0.8. While not every button works, users can now browse the different revisions and their different changesets. The code has been refined some with feature from Core added to it. A Crash report is now created if the users software crashes. Update Manager has been moved to the Traipse Suite menu item, and a Debug Console as been added as well.
author sirebral
date Thu, 27 Aug 2009 01:04:43 -0500
parents 211ac836b6a0
children 51428d30c59e
comparison
equal deleted inserted replaced
17:265b987cce4f 18:97265586402b
33 from base_handler import * 33 from base_handler import *
34 import mimetypes 34 import mimetypes
35 import os 35 import os
36 from base import * 36 from base import *
37 37
38 from orpg.tools.orpg_settings import settings
39
38 class background_handler(base_layer_handler): 40 class background_handler(base_layer_handler):
39 def __init__(self, parent, id, canvas): 41 def __init__(self, parent, id, canvas):
40 base_layer_handler.__init__(self, parent, id, canvas) 42 base_layer_handler.__init__(self, parent, id, canvas)
41 self.settings = self.canvas.settings 43 self.settings = settings
42 44
43 def build_ctrls(self): 45 def build_ctrls(self):
44 base_layer_handler.build_ctrls(self) 46 base_layer_handler.build_ctrls(self)
45 self.lock = Lock() 47 self.lock = Lock()
46 self.bg_type = wx.Choice(self, wx.ID_ANY, choices = ["Texture", "Image", "Color" ]) 48 self.bg_type = wx.Choice(self, wx.ID_ANY, choices = ["Texture", "Image", "Color" ])
84 86
85 if self.settings.get_setting('LocalorRemote') == 'Remote': 87 if self.settings.get_setting('LocalorRemote') == 'Remote':
86 thread.start_new_thread(self.canvas.layers['bg'].upload, 88 thread.start_new_thread(self.canvas.layers['bg'].upload,
87 (postdata, dlg.GetPath(), self.bg_type.GetStringSelection())) 89 (postdata, dlg.GetPath(), self.bg_type.GetStringSelection()))
88 else: 90 else:
89 try: min_url = open_rpg.get_component("cherrypy") + filename 91 try: min_url = component.get("cherrypy") + filename
90 except: return 92 except: return
91 min_url = dlg.GetDirectory().replace(orpg.dirpath.dir_struct["user"]+'webfiles' + os.sep, 93 min_url = dlg.GetDirectory().replace(orpg.dirpath.dir_struct["user"]+'webfiles' + os.sep,
92 open_rpg.get_component("cherrypy")) + '/' + filename 94 component.get("cherrypy")) + '/' + filename
93 95
94 if self.bg_type.GetStringSelection() == 'Texture': self.canvas.layers['bg'].set_texture(min_url) 96 if self.bg_type.GetStringSelection() == 'Texture': self.canvas.layers['bg'].set_texture(min_url)
95 elif self.bg_type.GetStringSelection() == 'Image': self.size = self.canvas.layers['bg'].set_image(min_url,1) 97 elif self.bg_type.GetStringSelection() == 'Image': self.size = self.canvas.layers['bg'].set_image(min_url,1)
96 self.update_info() 98 self.update_info()
97 self.canvas.send_map_data() 99 self.canvas.send_map_data()
136 self.Layout() 138 self.Layout()
137 139
138 def on_apply(self, evt): 140 def on_apply(self, evt):
139 session=self.canvas.frame.session 141 session=self.canvas.frame.session
140 if (session.my_role() != session.ROLE_GM) and (session.use_roles()): 142 if (session.my_role() != session.ROLE_GM) and (session.use_roles()):
141 open_rpg.get_component("chat").InfoPost("You must be a GM to use this feature") 143 component.get("chat").InfoPost("You must be a GM to use this feature")
142 return 144 return
143 self.canvas.layers['bg'].set_color(self.color_button.GetBackgroundColour()) 145 self.canvas.layers['bg'].set_color(self.color_button.GetBackgroundColour())
144 146
145 if self.bg_type.GetStringSelection() == 'Texture': self.canvas.layers['bg'].set_texture(self.url_path.GetValue()) 147 if self.bg_type.GetStringSelection() == 'Texture': self.canvas.layers['bg'].set_texture(self.url_path.GetValue())
146 elif self.bg_type.GetStringSelection() == 'Image': 148 elif self.bg_type.GetStringSelection() == 'Image':