Mercurial > traipse_dev
comparison orpg/mapper/background_handler.py @ 20:072ffc1d466f traipse_dev
2nd attempt. Still untested.
author | sirebral |
---|---|
date | Sat, 25 Jul 2009 19:23:25 -0500 |
parents | 78407d627cba |
children | c54768cffbd4 |
comparison
equal
deleted
inserted
replaced
19:78407d627cba | 20:072ffc1d466f |
---|---|
84 | 84 |
85 if self.settings.get_setting('LocalorRemote') == 'Remote': | 85 if self.settings.get_setting('LocalorRemote') == 'Remote': |
86 thread.start_new_thread(self.canvas.layers['bg'].upload, | 86 thread.start_new_thread(self.canvas.layers['bg'].upload, |
87 (postdata, dlg.GetPath(), self.bg_type.GetStringSelection())) | 87 (postdata, dlg.GetPath(), self.bg_type.GetStringSelection())) |
88 else: | 88 else: |
89 try: | 89 try: min_url = open_rpg.get_component("cherrypy") + filename |
90 min_url = open_rpg.get_component("cherrypy") + filename | 90 except: return |
91 except: | |
92 return | |
93 min_url = dlg.GetDirectory().replace(orpg.dirpath.dir_struct["user"]+'webfiles' + os.sep, | 91 min_url = dlg.GetDirectory().replace(orpg.dirpath.dir_struct["user"]+'webfiles' + os.sep, |
94 open_rpg.get_component("cherrypy")) + '/' + filename | 92 open_rpg.get_component("cherrypy")) + '/' + filename |
95 | 93 |
96 if self.bg_type.GetStringSelection() == 'Texture': | 94 if self.bg_type.GetStringSelection() == 'Texture': self.canvas.layers['bg'].set_texture(min_url) |
97 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) |
98 elif self.bg_type.GetStringSelection() == 'Image': | |
99 self.size = self.canvas.layers['bg'].set_image(min_url,1) | |
100 self.update_info() | 96 self.update_info() |
101 self.canvas.send_map_data() | 97 self.canvas.send_map_data() |
102 self.canvas.Refresh(False) | 98 self.canvas.Refresh(False) |
103 | 99 |
104 def update_info(self): | 100 def update_info(self): |
105 bg_type = self.canvas.layers['bg'].get_type() | 101 bg_type = self.canvas.layers['bg'].get_type() |
106 session=self.canvas.frame.session | 102 session=self.canvas.frame.session |
107 if (session.my_role() != session.ROLE_GM): | 103 if (session.my_role() != session.ROLE_GM): self.url_path.Hide() |
108 self.url_path.Hide() | |
109 else: | 104 else: |
110 self.url_path.Show() | 105 self.url_path.Show() |
111 self.url_path.Enable(BG_COLOR!=bg_type) | 106 self.url_path.Enable(BG_COLOR!=bg_type) |
112 self.color_button.SetBackgroundColour(self.canvas.layers['bg'].get_color()) | 107 self.color_button.SetBackgroundColour(self.canvas.layers['bg'].get_color()) |
113 self.url_path.SetValue(self.canvas.layers['bg'].get_img_path()) | 108 self.url_path.SetValue(self.canvas.layers['bg'].get_img_path()) |
145 if (session.my_role() != session.ROLE_GM) and (session.use_roles()): | 140 if (session.my_role() != session.ROLE_GM) and (session.use_roles()): |
146 open_rpg.get_component("chat").InfoPost("You must be a GM to use this feature") | 141 open_rpg.get_component("chat").InfoPost("You must be a GM to use this feature") |
147 return | 142 return |
148 self.canvas.layers['bg'].set_color(self.color_button.GetBackgroundColour()) | 143 self.canvas.layers['bg'].set_color(self.color_button.GetBackgroundColour()) |
149 | 144 |
150 if self.bg_type.GetStringSelection() == 'Texture': | 145 if self.bg_type.GetStringSelection() == 'Texture': self.canvas.layers['bg'].set_texture(self.url_path.GetValue()) |
151 self.canvas.layers['bg'].set_texture(self.url_path.GetValue()) | 146 elif self.bg_type.GetStringSelection() == 'Image': |
152 elif self.bg_type.GetStringSelection() == 'Image': | |
153 self.size = self.canvas.layers['bg'].set_image(self.url_path.GetValue(),1) | 147 self.size = self.canvas.layers['bg'].set_image(self.url_path.GetValue(),1) |
154 | 148 |
155 self.update_info() | 149 self.update_info() |
156 self.canvas.send_map_data() | 150 self.canvas.send_map_data() |
157 self.canvas.Refresh(False) | 151 self.canvas.Refresh(False) |