comparison orpg/mapper/map_prop_dialog.py @ 20:072ffc1d466f traipse_dev

2nd attempt. Still untested.
author sirebral
date Sat, 25 Jul 2009 19:23:25 -0500
parents 78407d627cba
children 449a8900f9ac
comparison
equal deleted inserted replaced
19:78407d627cba 20:072ffc1d466f
82 self.ctrls[CTRL_BG_COLOR].SetValue(False) 82 self.ctrls[CTRL_BG_COLOR].SetValue(False)
83 self.ctrls[CTRL_TEXTURE].SetValue(False) 83 self.ctrls[CTRL_TEXTURE].SetValue(False)
84 self.ctrls[CTRL_IMAGE].SetValue(False) 84 self.ctrls[CTRL_IMAGE].SetValue(False)
85 85
86 # Begin ted's changes for map bg persistency. 86 # Begin ted's changes for map bg persistency.
87 if bg_layer.bg_color != None: 87 if bg_layer.bg_color != None: self.ctrls[CTRL_BG_COLOR_VALUE].SetBackgroundColour(bg_layer.bg_color)
88 self.ctrls[CTRL_BG_COLOR_VALUE].SetBackgroundColour(bg_layer.bg_color)
89 if bg_layer.img_path != None: 88 if bg_layer.img_path != None:
90 self.ctrls[CTRL_TEXTURE_PATH].SetValue(bg_layer.img_path) 89 self.ctrls[CTRL_TEXTURE_PATH].SetValue(bg_layer.img_path)
91 self.ctrls[CTRL_IMAGE_PATH].SetValue(bg_layer.img_path) 90 self.ctrls[CTRL_IMAGE_PATH].SetValue(bg_layer.img_path)
92 # End ted's changes 91 # End ted's changes
93 92
94 if bg_layer.type == BG_COLOR: 93 if bg_layer.type == BG_COLOR: self.ctrls[CTRL_BG_COLOR].SetValue(True)
95 self.ctrls[CTRL_BG_COLOR].SetValue(True) 94 elif bg_layer.type == BG_TEXTURE: self.ctrls[CTRL_TEXTURE].SetValue(True)
96 # self.ctrls[CTRL_BG_COLOR_VALUE].SetBackgroundColour(bg_layer.bg_color)
97 elif bg_layer.type == BG_TEXTURE:
98 self.ctrls[CTRL_TEXTURE].SetValue(True)
99 # self.ctrls[CTRL_TEXTURE_PATH].SetValue(bg_layer.img_path)
100 elif bg_layer.type == BG_IMAGE: 95 elif bg_layer.type == BG_IMAGE:
101 self.ctrls[CTRL_WIDTH].Enable(False) 96 self.ctrls[CTRL_WIDTH].Enable(False)
102 self.ctrls[CTRL_HEIGHT].Enable(False) 97 self.ctrls[CTRL_HEIGHT].Enable(False)
103 self.ctrls[CTRL_IMAGE].SetValue(True) 98 self.ctrls[CTRL_IMAGE].SetValue(True)
104 # self.ctrls[CTRL_IMAGE_PATH].SetValue(bg_layer.img_path) 99 # self.ctrls[CTRL_IMAGE_PATH].SetValue(bg_layer.img_path)
205 if dlg.ShowModal() == wx.ID_OK: 200 if dlg.ShowModal() == wx.ID_OK:
206 data = dlg.GetColourData() 201 data = dlg.GetColourData()
207 self.ctrls[CTRL_GRID_COLOR].SetBackgroundColour(data.GetColour()) 202 self.ctrls[CTRL_GRID_COLOR].SetBackgroundColour(data.GetColour())
208 dlg.Destroy() 203 dlg.Destroy()
209 def on_ok(self,evt): 204 def on_ok(self,evt):
210 try: 205 try: self.size = (int(self.ctrls[CTRL_WIDTH].GetValue()),int(self.ctrls[CTRL_HEIGHT].GetValue()))
211 self.size = (int(self.ctrls[CTRL_WIDTH].GetValue()),int(self.ctrls[CTRL_HEIGHT].GetValue())) 206 except: pass
212 except:
213 pass
214 #dlg = wx.MessageDialog(frame, 'Invalid Size',"Error")
215 #dlg.ShowModal()
216 #dlg.Destroy()
217 if self.ctrls[CTRL_BG_COLOR].GetValue() == True: 207 if self.ctrls[CTRL_BG_COLOR].GetValue() == True:
218 self.bg_layer.set_color(self.ctrls[CTRL_BG_COLOR_VALUE].GetBackgroundColour()) 208 self.bg_layer.set_color(self.ctrls[CTRL_BG_COLOR_VALUE].GetBackgroundColour())
219 elif self.ctrls[CTRL_TEXTURE].GetValue() == True: 209 elif self.ctrls[CTRL_TEXTURE].GetValue() == True:
220 self.bg_layer.set_texture(self.ctrls[CTRL_TEXTURE_PATH].GetValue()) 210 self.bg_layer.set_texture(self.ctrls[CTRL_TEXTURE_PATH].GetValue())
221 elif self.ctrls[CTRL_IMAGE].GetValue() == True: 211 elif self.ctrls[CTRL_IMAGE].GetValue() == True:
222 self.size = self.bg_layer.set_image(self.ctrls[CTRL_IMAGE_PATH].GetValue(),self.grid_layer.mapscale) 212 self.size = self.bg_layer.set_image(self.ctrls[CTRL_IMAGE_PATH].GetValue(),self.grid_layer.mapscale)
223 else: 213 else: self.bg_layer.clear()
224 self.bg_layer.clear() 214 if self.ctrls[CTRL_GRID_MODE_RECT].GetValue() == True: grid_mode = GRID_RECTANGLE
225 if self.ctrls[CTRL_GRID_MODE_RECT].GetValue() == True: 215 else: grid_mode = GRID_HEXAGON
226 grid_mode = GRID_RECTANGLE 216 if self.ctrls[CTRL_GRID_LINE_NONE].GetValue() == True: grid_line = LINE_NONE
227 else: 217 elif self.ctrls[CTRL_GRID_LINE_DOTTED].GetValue() == True: grid_line = LINE_DOTTED
228 grid_mode = GRID_HEXAGON 218 else: grid_line = LINE_SOLID
229 if self.ctrls[CTRL_GRID_LINE_NONE].GetValue() == True:
230 grid_line = LINE_NONE
231 elif self.ctrls[CTRL_GRID_LINE_DOTTED].GetValue() == True:
232 grid_line = LINE_DOTTED
233 else:
234 grid_line = LINE_SOLID
235 self.grid_layer.set_grid(int(self.ctrls[CTRL_GRID].GetValue()), 219 self.grid_layer.set_grid(int(self.ctrls[CTRL_GRID].GetValue()),
236 self.ctrls[CTRL_GRID_SNAP].GetValue(), 220 self.ctrls[CTRL_GRID_SNAP].GetValue(),
237 self.ctrls[CTRL_GRID_COLOR].GetBackgroundColour(), 221 self.ctrls[CTRL_GRID_COLOR].GetBackgroundColour(),
238 grid_mode, 222 grid_mode,
239 grid_line) 223 grid_line)