Commit 366c43f403f7abcf46e566a94b55e4ee299ed66e
1 parent
345aba65
Exists in
master
and in
6 other branches
STL: Slice editor is using consts (not hardcoded anymore)
Showing
5 changed files
with
100 additions
and
90 deletions
Show diff stats
invesalius/constants.py
... | ... | @@ -43,11 +43,18 @@ MASK_COLOUR = [(0.33, 1, 0.33), |
43 | 43 | #(0.66666666666666663, 0.792156862745098, 1.0)] |
44 | 44 | |
45 | 45 | # Related to slice editor brush |
46 | -BRUSH_FORMAT = 0 # 0: circle, 1: square | |
47 | -BRUSH_SIZE = 30 | |
48 | -BRUSH_OP = 0 # 0: erase, 1: add, 2: threshold | |
49 | -BRUSH_COLOUR = (0,0,1.0) | |
46 | +BRUSH_CIRCLE = 0 # | |
47 | +BRUSH_SQUARE = 1 | |
48 | +DEFAULT_BRUSH_FORMAT = BRUSH_CIRCLE | |
49 | + | |
50 | +BRUSH_DRAW = 0 | |
51 | +BRUSH_ERASE = 1 | |
52 | +BRUSH_THRESH = 2 | |
53 | +DEFAULT_BRUSH_OP = BRUSH_THRESH | |
54 | +BRUSH_OP_NAME = ["Draw", "Erase", "Threshold"] | |
50 | 55 | |
56 | +BRUSH_COLOUR = (0,0,1.0) | |
57 | +BRUSH_SIZE = 30 | |
51 | 58 | |
52 | 59 | # Surface creation values. Each element's list contains: |
53 | 60 | # 0: imagedata reformat ratio | ... | ... |
invesalius/control.py
... | ... | @@ -7,7 +7,7 @@ import data.imagedata_utils as utils |
7 | 7 | import data.surface as surface |
8 | 8 | import data.volume as volume |
9 | 9 | import reader.dicom_reader as dicom |
10 | -#import reader.analyze_reader as analyze | |
10 | +import reader.analyze_reader as analyze | |
11 | 11 | |
12 | 12 | DEFAULT_THRESH_MODE = 0 |
13 | 13 | ... | ... |
invesalius/data/slice_.py
... | ... | @@ -50,6 +50,21 @@ class Slice(object): |
50 | 50 | ps.Publisher().subscribe(self.__edit_mask_pixel, 'Edit mask pixel') |
51 | 51 | ps.Publisher().subscribe(self.__add_mask_pixel, 'Add mask pixel') |
52 | 52 | |
53 | + ps.Publisher().subscribe(self.__set_current_mask_threshold_limits, | |
54 | + 'Update threshold limits') | |
55 | + | |
56 | + def __set_current_mask_threshold_limits(self, pubsub_evt): | |
57 | + thresh_min = pubsub_evt.data[0] | |
58 | + thresh_max = pubsub_evt.data[1] | |
59 | + print "***********" | |
60 | + print thresh_min, thresh_max | |
61 | + print "***********" | |
62 | + if self.current_mask: | |
63 | + index = self.current_mask.index | |
64 | + self.SetMaskEditionThreshold(index, (thresh_min, thresh_max)) | |
65 | + | |
66 | + | |
67 | + | |
53 | 68 | #--------------------------------------------------------------------------- |
54 | 69 | # BEGIN PUBSUB_EVT METHODS |
55 | 70 | #--------------------------------------------------------------------------- |
... | ... | @@ -75,7 +90,6 @@ class Slice(object): |
75 | 90 | def __set_current_mask_threshold(self, evt_pubsub): |
76 | 91 | threshold_range = evt_pubsub.data |
77 | 92 | index = self.current_mask.index |
78 | - self.current_mask.edited_points = {} | |
79 | 93 | self.SetMaskThreshold(index, threshold_range) |
80 | 94 | |
81 | 95 | def __set_current_mask_colour(self, pubsub_evt): |
... | ... | @@ -98,19 +112,16 @@ class Slice(object): |
98 | 112 | self.ShowMask(index, value) |
99 | 113 | #--------------------------------------------------------------------------- |
100 | 114 | def __erase_mask_pixel(self, pubsub_evt): |
101 | - positions = pubsub_evt.data | |
102 | - for position in positions: | |
103 | - self.ErasePixel(position) | |
115 | + position = pubsub_evt.data | |
116 | + self.ErasePixel(position) | |
104 | 117 | |
105 | 118 | def __edit_mask_pixel(self, pubsub_evt): |
106 | - positions = pubsub_evt.data | |
107 | - for position in positions: | |
108 | - self.EditPixelBasedOnThreshold(position) | |
119 | + position = pubsub_evt.data | |
120 | + self.EditPixelBasedOnThreshold(position) | |
109 | 121 | |
110 | 122 | def __add_mask_pixel(self, pubsub_evt): |
111 | - positions = pubsub_evt.data | |
112 | - for position in positions: | |
113 | - self.DrawPixel(position) | |
123 | + position = pubsub_evt.data | |
124 | + self.DrawPixel(position) | |
114 | 125 | #--------------------------------------------------------------------------- |
115 | 126 | # END PUBSUB_EVT METHODS |
116 | 127 | #--------------------------------------------------------------------------- |
... | ... | @@ -191,19 +202,19 @@ class Slice(object): |
191 | 202 | def ErasePixel(self, position): |
192 | 203 | "Delete pixel, based on x, y and z position coordinates." |
193 | 204 | x, y, z = position |
194 | - colour = self.imagedata.GetScalarRange()[0]# - 1 # Important to effect erase | |
205 | + colour = self.imagedata.GetScalarRange()[0] | |
195 | 206 | imagedata = self.current_mask.imagedata |
196 | 207 | imagedata.SetScalarComponentFromDouble(x, y, z, 0, colour) |
197 | - #imagedata.Update() | |
208 | + imagedata.Update() | |
198 | 209 | self.current_mask.edited_points[(x, y, z)] = colour |
199 | 210 | |
200 | 211 | def DrawPixel(self, position, colour=None): |
201 | 212 | "Draw pixel, based on x, y and z position coordinates." |
202 | 213 | x, y, z = position |
203 | - #if not colour: | |
204 | 214 | colour = self.imagedata.GetScalarRange()[1] |
205 | 215 | imagedata = self.current_mask.imagedata |
206 | 216 | imagedata.SetScalarComponentFromDouble(x, y, z, 0, colour) |
217 | + imagedata.Update() | |
207 | 218 | self.current_mask.edited_points[(x, y, z)] = colour |
208 | 219 | |
209 | 220 | def EditPixelBasedOnThreshold(self, position): |
... | ... | @@ -392,7 +403,6 @@ class Slice(object): |
392 | 403 | |
393 | 404 | # if not defined in the method call, this will have been computed on |
394 | 405 | # previous if |
395 | - #future_mask.imagedata = imagedata | |
396 | 406 | future_mask.imagedata = vtk.vtkImageData() |
397 | 407 | future_mask.imagedata.DeepCopy(imagedata) |
398 | 408 | future_mask.imagedata.Update() |
... | ... | @@ -421,7 +431,6 @@ class Slice(object): |
421 | 431 | self.current_mask = future_mask |
422 | 432 | |
423 | 433 | ps.Publisher().sendMessage('Change mask selected', future_mask.index) |
424 | - #ps.Publisher().sendMessage('Show mask', (future_mask.index, 1)) | |
425 | 434 | ps.Publisher().sendMessage('Update slice viewer') |
426 | 435 | |
427 | 436 | ... | ... |
invesalius/data/viewer_slice.py
... | ... | @@ -46,10 +46,10 @@ class Viewer(wx.Panel): |
46 | 46 | self.orientation = orientation |
47 | 47 | self.slice_number = 0 |
48 | 48 | |
49 | - self._brush_cursor_op = 'Draw' | |
50 | - self._brush_cursor_size = 30 | |
51 | - self._brush_cursor_colour = None | |
52 | - self._brush_cursor_type = 'circle' | |
49 | + self._brush_cursor_op = const.DEFAULT_BRUSH_OP | |
50 | + self._brush_cursor_size = const.BRUSH_SIZE | |
51 | + self._brush_cursor_colour = const.BRUSH_COLOUR | |
52 | + self._brush_cursor_type = const.DEFAULT_BRUSH_OP | |
53 | 53 | self.cursor = None |
54 | 54 | # VTK pipeline and actors |
55 | 55 | self.__config_interactor() |
... | ... | @@ -130,7 +130,6 @@ class Viewer(wx.Panel): |
130 | 130 | self.interactor.Render() |
131 | 131 | |
132 | 132 | def ChangeBrushColour(self, pubsub_evt): |
133 | - print "********************* ChangeBrushColour" | |
134 | 133 | vtk_colour = pubsub_evt.data[3] |
135 | 134 | self._brush_cursor_colour = vtk_colour |
136 | 135 | if (self.cursor): |
... | ... | @@ -150,9 +149,9 @@ class Viewer(wx.Panel): |
150 | 149 | self._brush_cursor_type = brush_type |
151 | 150 | self.ren.RemoveActor(self.cursor.actor) |
152 | 151 | |
153 | - if brush_type == 'square': | |
152 | + if brush_type == const.BRUSH_SQUARE: | |
154 | 153 | cursor = ca.CursorRectangle() |
155 | - elif brush_type == 'circle': | |
154 | + elif brush_type == const.BRUSH_CIRCLE: | |
156 | 155 | cursor = ca.CursorCircle() |
157 | 156 | self.cursor = cursor |
158 | 157 | |
... | ... | @@ -188,16 +187,16 @@ class Viewer(wx.Panel): |
188 | 187 | self.__update_cursor_position(coord) |
189 | 188 | self.ren.Render() |
190 | 189 | |
191 | - if self._brush_cursor_op == 'Erase': | |
192 | - evt_msg = 'Erase mask pixel' | |
193 | - elif self._brush_cursor_op == 'Draw': | |
194 | - evt_msg = 'Add mask pixel' | |
195 | - elif self._brush_cursor_op == 'Threshold': | |
196 | - evt_msg = 'Edit mask pixel' | |
190 | + evt_msg = {const.BRUSH_ERASE: 'Erase mask pixel', | |
191 | + const.BRUSH_DRAW: 'Add mask pixel', | |
192 | + const.BRUSH_THRESH: 'Edit mask pixel'} | |
193 | + msg = evt_msg[self._brush_cursor_op] | |
197 | 194 | |
198 | 195 | pixels = itertools.ifilter(self.TestOperationPosition, |
199 | 196 | self.cursor.GetPixels()) |
200 | - ps.Publisher().sendMessage(evt_msg, pixels) | |
197 | + for coord in pixels: | |
198 | + print coord | |
199 | + ps.Publisher().sendMessage(msg, coord) | |
201 | 200 | |
202 | 201 | # FIXME: This is idiot, but is the only way that brush operations are |
203 | 202 | # working when cross is disabled |
... | ... | @@ -212,19 +211,20 @@ class Viewer(wx.Panel): |
212 | 211 | self.cursor.SetEditionPosition(self.GetCoordinateCursorEdition()) |
213 | 212 | self.__update_cursor_position(coord) |
214 | 213 | |
215 | - if self._brush_cursor_op == 'Erase': | |
214 | + if self._brush_cursor_op == const.BRUSH_ERASE: | |
216 | 215 | evt_msg = 'Erase mask pixel' |
217 | - elif self._brush_cursor_op == 'Draw': | |
216 | + elif self._brush_cursor_op == const.BRUSH_DRAW: | |
218 | 217 | evt_msg = 'Add mask pixel' |
219 | - elif self._brush_cursor_op == 'Threshold': | |
218 | + elif self._brush_cursor_op == const.BRUSH_THRESH: | |
220 | 219 | evt_msg = 'Edit mask pixel' |
221 | 220 | |
222 | 221 | if self.mouse_pressed: |
223 | 222 | pixels = itertools.ifilter(self.TestOperationPosition, |
224 | 223 | self.cursor.GetPixels()) |
225 | - ps.Publisher().sendMessage(evt_msg, pixels) | |
226 | - ps.Publisher().sendMessage('Update slice viewer') | |
224 | + for coord in pixels: | |
225 | + ps.Publisher().sendMessage(evt_msg, coord) | |
227 | 226 | self.interactor.Render() |
227 | + ps.Publisher().sendMessage('Update slice viewer') | |
228 | 228 | |
229 | 229 | def OnCrossMove(self, obj, evt_vtk): |
230 | 230 | coord = self.GetCoordinate() |
... | ... | @@ -477,8 +477,9 @@ class Viewer(wx.Panel): |
477 | 477 | "CORONAL": {1: self.slice_number}, |
478 | 478 | "AXIAL": {2: self.slice_number}} |
479 | 479 | |
480 | - ps.Publisher().sendMessage('Update cursor single position in slice', | |
481 | - position[self.orientation]) | |
480 | + if 'DEFAULT' in self.modes: | |
481 | + ps.Publisher().sendMessage('Update cursor single position in slice', | |
482 | + position[self.orientation]) | |
482 | 483 | |
483 | 484 | def ChangeSliceNumber(self, pubsub_evt): |
484 | 485 | index = pubsub_evt.data | ... | ... |
invesalius/gui/task_slice.py
... | ... | @@ -31,21 +31,15 @@ import gui.widgets.foldpanelbar as fpb |
31 | 31 | from project import Project |
32 | 32 | |
33 | 33 | BTN_NEW = wx.NewId() |
34 | -MENU_SQUARE = wx.NewId() | |
35 | -MENU_CIRCLE = wx.NewId() | |
36 | - | |
37 | -#THRESHOLD_LIST = ["Bone (CT)", "Soft Tissue (CT)", "Enamel (CT, Adult)", | |
38 | -# "Enamel (CT, Child)", "Compact Bone (CT, Adult)", | |
39 | -# "Compact Bone (CT, Child)", "Spongial Bone (CT, Adult)", | |
40 | -# "Spongial Bone (CT, Child)", "Muscle Tissue (CT, Adult)", | |
41 | -# "Muscle Tissue (CT, Child)", "Fat Tissue (CT, Adult)", | |
42 | -# "Fat Tissue (CT, Adult)", "Skin Tissue (CT, Adult)", | |
43 | -# "Skin Tissue (CT, Child)"] | |
44 | 34 | |
45 | -MASK_LIST = [] | |
35 | +MENU_BRUSH_SQUARE = wx.NewId() | |
36 | +MENU_BRUSH_CIRCLE = wx.NewId() | |
46 | 37 | |
47 | -OP_LIST = ["Draw", "Erase", "Threshold"] | |
38 | +MENU_BRUSH_ADD = wx.NewId() | |
39 | +MENU_BRUSH_DEL = wx.NewId() | |
40 | +MENU_BRUSH_THRESH = wx.NewId() | |
48 | 41 | |
42 | +MASK_LIST = [] | |
49 | 43 | |
50 | 44 | class TaskPanel(wx.Panel): |
51 | 45 | def __init__(self, parent): |
... | ... | @@ -227,12 +221,10 @@ class MaskProperties(wx.Panel): |
227 | 221 | style=wx.CB_DROPDOWN|wx.CB_READONLY) |
228 | 222 | combo_mask_name.SetSelection(0) # wx.CB_SORT |
229 | 223 | combo_mask_name.SetWindowVariant(wx.WINDOW_VARIANT_SMALL) |
230 | - combo_mask_name.Bind(wx.EVT_COMBOBOX, self.OnComboName) | |
231 | 224 | self.combo_mask_name = combo_mask_name |
232 | 225 | |
233 | 226 | # Mask colour |
234 | 227 | button_colour= csel.ColourSelect(self, 111,colour=(0,255,0),size=(-1,22)) |
235 | - button_colour.Bind(csel.EVT_COLOURSELECT, self.OnSelectColour) | |
236 | 228 | self.button_colour = button_colour |
237 | 229 | |
238 | 230 | # Sizer which represents the first line |
... | ... | @@ -290,21 +282,20 @@ class MaskProperties(wx.Panel): |
290 | 282 | ps.Publisher().subscribe(self.ChangeMaskName, 'Change mask name') |
291 | 283 | |
292 | 284 | def __bind_events_wx(self): |
285 | + self.Bind(grad.EVT_THRESHOLD_CHANGE, self.OnSlideChanged, self.gradient) | |
293 | 286 | self.combo_thresh.Bind(wx.EVT_COMBOBOX, self.OnComboThresh) |
294 | - self.Bind(grad.EVT_THRESHOLD_CHANGE, self.OnSlideChanged, | |
295 | - self.gradient) | |
296 | - | |
287 | + self.combo_mask_name.Bind(wx.EVT_COMBOBOX, self.OnComboName) | |
288 | + self.button_colour.Bind(csel.EVT_COLOURSELECT, self.OnSelectColour) | |
289 | + | |
297 | 290 | def SelectMaskName(self, pubsub_evt): |
298 | 291 | index = pubsub_evt.data |
299 | 292 | self.combo_mask_name.SetSelection(index) |
300 | 293 | |
301 | - | |
302 | 294 | def ChangeMaskName(self, pubsub_evt): |
303 | 295 | index, name = pubsub_evt.data |
304 | 296 | self.combo_mask_name.SetString(index, name) |
305 | 297 | self.combo_mask_name.Refresh() |
306 | 298 | |
307 | - | |
308 | 299 | def SetThresholdValues(self, pubsub_evt): |
309 | 300 | thresh_min, thresh_max = pubsub_evt.data |
310 | 301 | self.bind_evt_gradient = False |
... | ... | @@ -376,42 +367,44 @@ class EditionTools(wx.Panel): |
376 | 367 | text1 = wx.StaticText(self, -1, "Choose brush type, size or operation:") |
377 | 368 | |
378 | 369 | ## LINE 2 |
379 | - | |
380 | - SQUARE_BMP = wx.Bitmap("../icons/brush_square.jpg", wx.BITMAP_TYPE_JPEG) | |
381 | - CIRCLE_BMP = wx.Bitmap("../icons/brush_circle.jpg", wx.BITMAP_TYPE_JPEG) | |
382 | - | |
383 | 370 | menu = wx.Menu() |
384 | - | |
385 | - item = wx.MenuItem(menu, MENU_CIRCLE,"Circle") | |
371 | + | |
372 | + CIRCLE_BMP = wx.Bitmap("../icons/brush_circle.jpg", wx.BITMAP_TYPE_JPEG) | |
373 | + item = wx.MenuItem(menu, MENU_BRUSH_CIRCLE, "Circle") | |
386 | 374 | item.SetBitmap(CIRCLE_BMP) |
387 | - item2 = wx.MenuItem(menu, MENU_SQUARE, "Square") | |
375 | + | |
376 | + SQUARE_BMP = wx.Bitmap("../icons/brush_square.jpg", wx.BITMAP_TYPE_JPEG) | |
377 | + item2 = wx.MenuItem(menu, MENU_BRUSH_SQUARE, "Square") | |
388 | 378 | item2.SetBitmap(SQUARE_BMP) |
389 | - self.Bind(wx.EVT_MENU, self.OnMenu) | |
390 | - | |
379 | + | |
391 | 380 | menu.AppendItem(item) |
392 | 381 | menu.AppendItem(item2) |
393 | 382 | |
394 | - btn_brush_type = pbtn.PlateButton(self, wx.ID_ANY,"", CIRCLE_BMP, | |
383 | + bmp_brush_format = {const.BRUSH_CIRCLE: CIRCLE_BMP, | |
384 | + const.BRUSH_SQUARE: SQUARE_BMP} | |
385 | + selected_bmp = bmp_brush_format[const.DEFAULT_BRUSH_FORMAT] | |
386 | + | |
387 | + btn_brush_format = pbtn.PlateButton(self, wx.ID_ANY,"", selected_bmp, | |
395 | 388 | style=pbtn.PB_STYLE_SQUARE) |
396 | - btn_brush_type.SetMenu(menu) | |
397 | - self.btn_brush_type = btn_brush_type | |
389 | + btn_brush_format.SetMenu(menu) | |
390 | + self.btn_brush_format = btn_brush_format | |
398 | 391 | |
399 | 392 | spin_brush_size = wx.SpinCtrl(self, -1, "", (30, 50)) |
400 | 393 | spin_brush_size.SetRange(1,100) |
401 | - spin_brush_size.SetValue(30) | |
394 | + spin_brush_size.SetValue(const.BRUSH_SIZE) | |
402 | 395 | spin_brush_size.Bind(wx.EVT_TEXT, self.OnBrushSize) |
403 | 396 | self.spin = spin_brush_size |
404 | 397 | |
405 | 398 | combo_brush_op = wx.ComboBox(self, -1, "", size=(15,-1), |
406 | - choices= OP_LIST, | |
407 | - style=wx.CB_DROPDOWN|wx.CB_READONLY) | |
408 | - combo_brush_op.SetSelection(0) | |
399 | + choices = const.BRUSH_OP_NAME, | |
400 | + style = wx.CB_DROPDOWN|wx.CB_READONLY) | |
401 | + combo_brush_op.SetSelection(const.DEFAULT_BRUSH_OP) | |
409 | 402 | combo_brush_op.SetWindowVariant(wx.WINDOW_VARIANT_SMALL) |
410 | - combo_brush_op.Bind(wx.EVT_COMBOBOX, self.OnComboBrushOp) | |
403 | + self.combo_brush_op = combo_brush_op | |
411 | 404 | |
412 | 405 | # Sizer which represents the second line |
413 | 406 | line2 = wx.BoxSizer(wx.HORIZONTAL) |
414 | - line2.Add(btn_brush_type, 0, wx.EXPAND|wx.GROW|wx.TOP|wx.RIGHT, 0) | |
407 | + line2.Add(btn_brush_format, 0, wx.EXPAND|wx.GROW|wx.TOP|wx.RIGHT, 0) | |
415 | 408 | line2.Add(spin_brush_size, 0, wx.RIGHT, 5) |
416 | 409 | line2.Add(combo_brush_op, 1, wx.TOP|wx.RIGHT|wx.LEFT, 5) |
417 | 410 | |
... | ... | @@ -429,7 +422,8 @@ class EditionTools(wx.Panel): |
429 | 422 | sizer.Add(text1, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5) |
430 | 423 | sizer.Add(line2, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5) |
431 | 424 | sizer.Add(text_thresh, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5) |
432 | - sizer.Add(gradient_thresh, 0, wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT|wx.BOTTOM, 6) | |
425 | + sizer.Add(gradient_thresh, 0, wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT| | |
426 | + wx.BOTTOM, 6) | |
433 | 427 | sizer.Fit(self) |
434 | 428 | |
435 | 429 | self.SetSizer(sizer) |
... | ... | @@ -441,14 +435,14 @@ class EditionTools(wx.Panel): |
441 | 435 | |
442 | 436 | |
443 | 437 | def __bind_events_wx(self): |
438 | + self.Bind(wx.EVT_MENU, self.OnMenu) | |
444 | 439 | self.Bind(grad.EVT_THRESHOLD_CHANGE, self.OnGradientChanged, |
445 | 440 | self.gradient_thresh) |
441 | + self.combo_brush_op.Bind(wx.EVT_COMBOBOX, self.OnComboBrushOp) | |
446 | 442 | |
447 | 443 | def __bind_events(self): |
448 | 444 | ps.Publisher().subscribe(self.SetThresholdBounds, |
449 | 445 | 'Update threshold limits') |
450 | - #ps.Publisher().subscribe(self.SetThresholdValues, | |
451 | - # 'Set threshold values in gradient') | |
452 | 446 | ps.Publisher().subscribe(self.ChangeMaskColour, 'Change mask colour') |
453 | 447 | ps.Publisher().subscribe(self.SetGradientColour, 'Add mask') |
454 | 448 | |
... | ... | @@ -471,7 +465,6 @@ class EditionTools(wx.Panel): |
471 | 465 | def SetThresholdBounds(self, pubsub_evt): |
472 | 466 | thresh_min = pubsub_evt.data[0] |
473 | 467 | thresh_max = pubsub_evt.data[1] |
474 | - print thresh_min, thresh_max | |
475 | 468 | self.gradient_thresh.SetMinRange(thresh_min) |
476 | 469 | self.gradient_thresh.SetMaxRange(thresh_max) |
477 | 470 | self.gradient_thresh.SetMinValue(thresh_min) |
... | ... | @@ -485,17 +478,17 @@ class EditionTools(wx.Panel): |
485 | 478 | (thresh_min, thresh_max)) |
486 | 479 | |
487 | 480 | def OnMenu(self, evt): |
488 | - """Button's menu event""" | |
489 | 481 | SQUARE_BMP = wx.Bitmap("../icons/brush_square.jpg", wx.BITMAP_TYPE_JPEG) |
490 | 482 | CIRCLE_BMP = wx.Bitmap("../icons/brush_circle.jpg", wx.BITMAP_TYPE_JPEG) |
491 | 483 | |
492 | - name = {MENU_CIRCLE:"circle", MENU_SQUARE:"square"} | |
493 | - bitmap = {MENU_CIRCLE:CIRCLE_BMP, MENU_SQUARE:SQUARE_BMP} | |
484 | + brush = {MENU_BRUSH_CIRCLE: const.BRUSH_CIRCLE, | |
485 | + MENU_BRUSH_SQUARE: const.BRUSH_SQUARE} | |
486 | + bitmap = {MENU_BRUSH_CIRCLE: CIRCLE_BMP, | |
487 | + MENU_BRUSH_SQUARE: SQUARE_BMP} | |
494 | 488 | |
495 | - self.btn_brush_type.SetBitmap(bitmap[evt.GetId()]) | |
489 | + self.btn_brush_format.SetBitmap(bitmap[evt.GetId()]) | |
496 | 490 | |
497 | - print "TODO: Send Signal - Change brush format to %s"% name[evt.GetId()] | |
498 | - ps.Publisher().sendMessage('Set brush format', name[evt.GetId()]) | |
491 | + ps.Publisher().sendMessage('Set brush format', brush[evt.GetId()]) | |
499 | 492 | |
500 | 493 | def OnBrushSize(self, evt): |
501 | 494 | """ """ |
... | ... | @@ -505,7 +498,7 @@ class EditionTools(wx.Panel): |
505 | 498 | ps.Publisher().sendMessage('Set edition brush size',self.spin.GetValue()) |
506 | 499 | |
507 | 500 | def OnComboBrushOp(self, evt): |
508 | - print "TODO: Send Signal - Change brush operation: %s" %(evt.GetString()) | |
509 | - ps.Publisher().sendMessage('Set edition operation',evt.GetString()) | |
501 | + brush_op_id = evt.GetSelection() | |
502 | + ps.Publisher().sendMessage('Set edition operation', brush_op_id) | |
510 | 503 | |
511 | 504 | ... | ... |