Commit 2c4df64bf10ef155f2044a4dc33e8c6b80c8e7d7
1 parent
462913dd
Exists in
master
and in
68 other branches
FIX: Add "try.. exception..." temporary to fix error in the execute wx.SafeYield…
…() in the Windowds XP 64 Bits. Is bug wxWidgets.
Showing
2 changed files
with
56 additions
and
46 deletions
Show diff stats
invesalius/gui/dicom_preview_panel.py
@@ -70,14 +70,14 @@ class SingleImagePreview(wx.Panel): | @@ -70,14 +70,14 @@ class SingleImagePreview(wx.Panel): | ||
70 | text_image_location.SetPosition(const.TEXT_POS_LEFT_DOWN) | 70 | text_image_location.SetPosition(const.TEXT_POS_LEFT_DOWN) |
71 | text_image_location.SetValue("localization") | 71 | text_image_location.SetValue("localization") |
72 | self.text_image_location = text_image_location | 72 | self.text_image_location = text_image_location |
73 | - | 73 | + |
74 | value = "id\nprotocol" | 74 | value = "id\nprotocol" |
75 | text_patient = vtku.Text() | 75 | text_patient = vtku.Text() |
76 | text_patient.SetJustificationToRight() | 76 | text_patient.SetJustificationToRight() |
77 | text_patient.SetPosition(const.TEXT_POS_RIGHT_UP) | 77 | text_patient.SetPosition(const.TEXT_POS_RIGHT_UP) |
78 | text_patient.SetValue(value) | 78 | text_patient.SetValue(value) |
79 | self.text_patient = text_patient | 79 | self.text_patient = text_patient |
80 | - | 80 | + |
81 | value = "date time\n Made in InVesalius" | 81 | value = "date time\n Made in InVesalius" |
82 | text_acquisition = vtku.Text() | 82 | text_acquisition = vtku.Text() |
83 | text_acquisition.SetJustificationToRight() | 83 | text_acquisition.SetJustificationToRight() |
@@ -130,7 +130,7 @@ class SingleImagePreview(wx.Panel): | @@ -130,7 +130,7 @@ class SingleImagePreview(wx.Panel): | ||
130 | in_sizer = wx.BoxSizer(wx.HORIZONTAL) | 130 | in_sizer = wx.BoxSizer(wx.HORIZONTAL) |
131 | in_sizer.Add(slider, 1, wx.GROW|wx.EXPAND) | 131 | in_sizer.Add(slider, 1, wx.GROW|wx.EXPAND) |
132 | in_sizer.Add(checkbox, 0) | 132 | in_sizer.Add(checkbox, 0) |
133 | - | 133 | + |
134 | sizer = wx.BoxSizer(wx.VERTICAL) | 134 | sizer = wx.BoxSizer(wx.VERTICAL) |
135 | sizer.Add(self.panel, 20, wx.GROW|wx.EXPAND) | 135 | sizer.Add(self.panel, 20, wx.GROW|wx.EXPAND) |
136 | sizer.Add(in_sizer, 1, wx.GROW|wx.EXPAND) | 136 | sizer.Add(in_sizer, 1, wx.GROW|wx.EXPAND) |
@@ -165,9 +165,15 @@ class SingleImagePreview(wx.Panel): | @@ -165,9 +165,15 @@ class SingleImagePreview(wx.Panel): | ||
165 | self.ShowSlice(pos) | 165 | self.ShowSlice(pos) |
166 | time.sleep(0.2) | 166 | time.sleep(0.2) |
167 | if self.ischecked: | 167 | if self.ischecked: |
168 | - wx.Yield() | ||
169 | - wx.CallAfter(self.OnRun) | ||
170 | - | 168 | + try: |
169 | + wx.Yield() | ||
170 | + #TODO: temporary fix necessary in the Windows XP 64 Bits | ||
171 | + #BUG in wxWidgets http://trac.wxwidgets.org/ticket/10896 | ||
172 | + except(wx._core.PyAssertionError): | ||
173 | + print "wx._core.PyAssertionError" | ||
174 | + finally: | ||
175 | + wx.CallAfter(self.OnRun) | ||
176 | + | ||
171 | def SetDicomGroup(self, group): | 177 | def SetDicomGroup(self, group): |
172 | self.dicom_list = group.GetHandSortedList() | 178 | self.dicom_list = group.GetHandSortedList() |
173 | self.current_index = 0 | 179 | self.current_index = 0 |
@@ -181,7 +187,7 @@ class SingleImagePreview(wx.Panel): | @@ -181,7 +187,7 @@ class SingleImagePreview(wx.Panel): | ||
181 | def ShowSlice(self, index = 0): | 187 | def ShowSlice(self, index = 0): |
182 | print "ShowSlice" | 188 | print "ShowSlice" |
183 | dicom = self.dicom_list[index] | 189 | dicom = self.dicom_list[index] |
184 | - | 190 | + |
185 | # UPDATE GUI | 191 | # UPDATE GUI |
186 | ## Text related to size | 192 | ## Text related to size |
187 | value = STR_SIZE %(dicom.image.size[0], dicom.image.size[1]) | 193 | value = STR_SIZE %(dicom.image.size[0], dicom.image.size[1]) |
@@ -274,10 +280,10 @@ class Preview(wx.Panel): | @@ -274,10 +280,10 @@ class Preview(wx.Panel): | ||
274 | 280 | ||
275 | def _init_ui(self): | 281 | def _init_ui(self): |
276 | 282 | ||
277 | - self.title = wx.StaticText(self, -1, "Image", | 283 | + self.title = wx.StaticText(self, -1, "Image", |
278 | style=wx.ALIGN_CENTER) | 284 | style=wx.ALIGN_CENTER) |
279 | 285 | ||
280 | - self.subtitle = wx.StaticText(self, -1, "Image", | 286 | + self.subtitle = wx.StaticText(self, -1, "Image", |
281 | style=wx.ALIGN_CENTER) | 287 | style=wx.ALIGN_CENTER) |
282 | 288 | ||
283 | self.panel = wx.Panel(self, -1) | 289 | self.panel = wx.Panel(self, -1) |
@@ -306,7 +312,7 @@ class Preview(wx.Panel): | @@ -306,7 +312,7 @@ class Preview(wx.Panel): | ||
306 | def _init_vtk(self): | 312 | def _init_vtk(self): |
307 | 313 | ||
308 | self.interactor = wxVTKRenderWindowInteractor(self.panel, -1, size=(70, 70)) | 314 | self.interactor = wxVTKRenderWindowInteractor(self.panel, -1, size=(70, 70)) |
309 | - | 315 | + |
310 | sizer = wx.BoxSizer(wx.HORIZONTAL) | 316 | sizer = wx.BoxSizer(wx.HORIZONTAL) |
311 | sizer.Add(self.interactor, 1, wx.GROW|wx.EXPAND) | 317 | sizer.Add(self.interactor, 1, wx.GROW|wx.EXPAND) |
312 | sizer.Fit(self.panel) | 318 | sizer.Fit(self.panel) |
@@ -316,7 +322,7 @@ class Preview(wx.Panel): | @@ -316,7 +322,7 @@ class Preview(wx.Panel): | ||
316 | self.panel.Layout() | 322 | self.panel.Layout() |
317 | self.panel.Update() | 323 | self.panel.Update() |
318 | self.panel.SetAutoLayout(1) | 324 | self.panel.SetAutoLayout(1) |
319 | - | 325 | + |
320 | self.actor = vtk.vtkImageActor() | 326 | self.actor = vtk.vtkImageActor() |
321 | 327 | ||
322 | self.render = vtk.vtkRenderer() | 328 | self.render = vtk.vtkRenderer() |
@@ -351,7 +357,7 @@ class Preview(wx.Panel): | @@ -351,7 +357,7 @@ class Preview(wx.Panel): | ||
351 | self.title.Bind(wx.EVT_LEFT_DOWN, self.OnSelect) | 357 | self.title.Bind(wx.EVT_LEFT_DOWN, self.OnSelect) |
352 | self.subtitle.Bind(wx.EVT_LEFT_DOWN, self.OnSelect) | 358 | self.subtitle.Bind(wx.EVT_LEFT_DOWN, self.OnSelect) |
353 | 359 | ||
354 | - | 360 | + |
355 | 361 | ||
356 | 362 | ||
357 | def OnEnter(self, evt): | 363 | def OnEnter(self, evt): |
@@ -422,7 +428,7 @@ class Preview(wx.Panel): | @@ -422,7 +428,7 @@ class Preview(wx.Panel): | ||
422 | image = image_file[0] | 428 | image = image_file[0] |
423 | 429 | ||
424 | scale = image.GetScalarRange() | 430 | scale = image.GetScalarRange() |
425 | - | 431 | + |
426 | cast = vtk.vtkImageMapToWindowLevelColors() | 432 | cast = vtk.vtkImageMapToWindowLevelColors() |
427 | #cast.SetShift(abs(scale[0])) | 433 | #cast.SetShift(abs(scale[0])) |
428 | #cast.SetScale(255.0/(scale[1] - scale[0])) | 434 | #cast.SetScale(255.0/(scale[1] - scale[0])) |
@@ -438,7 +444,7 @@ class Preview(wx.Panel): | @@ -438,7 +444,7 @@ class Preview(wx.Panel): | ||
438 | window = 150 | 444 | window = 150 |
439 | 445 | ||
440 | self.data = image_file[-1] | 446 | self.data = image_file[-1] |
441 | - | 447 | + |
442 | cast.SetWindow(window) | 448 | cast.SetWindow(window) |
443 | cast.SetLevel(level) | 449 | cast.SetLevel(level) |
444 | self.actor.SetInput(cast.GetOutput()) | 450 | self.actor.SetInput(cast.GetOutput()) |
@@ -485,7 +491,7 @@ class Preview(wx.Panel): | @@ -485,7 +491,7 @@ class Preview(wx.Panel): | ||
485 | 491 | ||
486 | 492 | ||
487 | if 1: | 493 | if 1: |
488 | - # Default values for the surronounding rectangle | 494 | + # Default values for the surronounding rectangle |
489 | # around a button | 495 | # around a button |
490 | rectWidth = self._nImgSize * 2 # To avoid the recangle to 'touch' the borders | 496 | rectWidth = self._nImgSize * 2 # To avoid the recangle to 'touch' the borders |
491 | rectHeight = self._nImgSize * 2 | 497 | rectHeight = self._nImgSize * 2 |
@@ -497,7 +503,7 @@ class Preview(wx.Panel): | @@ -497,7 +503,7 @@ class Preview(wx.Panel): | ||
497 | # not ((style & INB_LEFT) or (style & INB_RIGHT)) and \ | 503 | # not ((style & INB_LEFT) or (style & INB_RIGHT)) and \ |
498 | # not self._pagesInfoVec[i].GetCaption() == "" and \ | 504 | # not self._pagesInfoVec[i].GetCaption() == "" and \ |
499 | # not (style & INB_SHOW_ONLY_IMAGES): | 505 | # not (style & INB_SHOW_ONLY_IMAGES): |
500 | - | 506 | + |
501 | 507 | ||
502 | #rectWidth = ((textWidth + nPadding * 2) > rectWidth and [nPadding * 2 + textWidth] or [rectWidth])[0] | 508 | #rectWidth = ((textWidth + nPadding * 2) > rectWidth and [nPadding * 2 + textWidth] or [rectWidth])[0] |
503 | 509 | ||
@@ -509,7 +515,7 @@ class Preview(wx.Panel): | @@ -509,7 +515,7 @@ class Preview(wx.Panel): | ||
509 | # If Pin button is used, consider its space as well (applicable for top/botton style) | 515 | # If Pin button is used, consider its space as well (applicable for top/botton style) |
510 | # since in the left/right, its size is already considered in 'pos' | 516 | # since in the left/right, its size is already considered in 'pos' |
511 | #pinBtnSize = (bUsePin and [20] or [0])[0] | 517 | #pinBtnSize = (bUsePin and [20] or [0])[0] |
512 | - | 518 | + |
513 | #if pos + rectWidth + pinBtnSize > clientSize: | 519 | #if pos + rectWidth + pinBtnSize > clientSize: |
514 | # break | 520 | # break |
515 | 521 | ||
@@ -562,7 +568,7 @@ class DicomPreviewSeries(wx.Panel): | @@ -562,7 +568,7 @@ class DicomPreviewSeries(wx.Panel): | ||
562 | self.SetAutoLayout(1) | 568 | self.SetAutoLayout(1) |
563 | 569 | ||
564 | self.sizer = background_sizer | 570 | self.sizer = background_sizer |
565 | - | 571 | + |
566 | self._Add_Panels_Preview() | 572 | self._Add_Panels_Preview() |
567 | self._bind_events() | 573 | self._bind_events() |
568 | 574 | ||
@@ -579,7 +585,7 @@ class DicomPreviewSeries(wx.Panel): | @@ -579,7 +585,7 @@ class DicomPreviewSeries(wx.Panel): | ||
579 | 585 | ||
580 | #def _show_shadow(self, preview): | 586 | #def _show_shadow(self, preview): |
581 | # preview.ShowShadow() | 587 | # preview.ShowShadow() |
582 | - | 588 | + |
583 | 589 | ||
584 | def _bind_events(self): | 590 | def _bind_events(self): |
585 | # When the user scrolls the window | 591 | # When the user scrolls the window |
@@ -609,7 +615,7 @@ class DicomPreviewSeries(wx.Panel): | @@ -609,7 +615,7 @@ class DicomPreviewSeries(wx.Panel): | ||
609 | group_list) | 615 | group_list) |
610 | self.files.append(info) | 616 | self.files.append(info) |
611 | n+=1 | 617 | n+=1 |
612 | - | 618 | + |
613 | scroll_range = len(self.files)/NCOLS | 619 | scroll_range = len(self.files)/NCOLS |
614 | if scroll_range * NCOLS < len(self.files): | 620 | if scroll_range * NCOLS < len(self.files): |
615 | scroll_range +=1 | 621 | scroll_range +=1 |
@@ -619,7 +625,7 @@ class DicomPreviewSeries(wx.Panel): | @@ -619,7 +625,7 @@ class DicomPreviewSeries(wx.Panel): | ||
619 | def _display_previews(self): | 625 | def _display_previews(self): |
620 | initial = self.displayed_position * NCOLS | 626 | initial = self.displayed_position * NCOLS |
621 | final = initial + MAX_VALUE | 627 | final = initial + MAX_VALUE |
622 | - | 628 | + |
623 | if len(self.files) < final: | 629 | if len(self.files) < final: |
624 | for i in xrange(final-len(self.files)): | 630 | for i in xrange(final-len(self.files)): |
625 | try: | 631 | try: |
@@ -686,7 +692,7 @@ class DicomPreview(wx.Panel): | @@ -686,7 +692,7 @@ class DicomPreview(wx.Panel): | ||
686 | self.SetAutoLayout(1) | 692 | self.SetAutoLayout(1) |
687 | 693 | ||
688 | self.sizer = background_sizer | 694 | self.sizer = background_sizer |
689 | - | 695 | + |
690 | self._Add_Panels_Preview() | 696 | self._Add_Panels_Preview() |
691 | self._bind_events() | 697 | self._bind_events() |
692 | 698 | ||
@@ -767,7 +773,7 @@ class DicomPreview(wx.Panel): | @@ -767,7 +773,7 @@ class DicomPreview(wx.Panel): | ||
767 | initial = self.displayed_position * NCOLS | 773 | initial = self.displayed_position * NCOLS |
768 | final = initial + MAX_VALUE | 774 | final = initial + MAX_VALUE |
769 | print "len:", len(self.files) | 775 | print "len:", len(self.files) |
770 | - | 776 | + |
771 | if len(self.files) < final: | 777 | if len(self.files) < final: |
772 | for i in xrange(final-len(self.files)): | 778 | for i in xrange(final-len(self.files)): |
773 | print "hide ", i | 779 | print "hide ", i |
invesalius/gui/frame.py
@@ -34,7 +34,7 @@ import project as prj | @@ -34,7 +34,7 @@ import project as prj | ||
34 | import session as ses | 34 | import session as ses |
35 | 35 | ||
36 | # Object toolbar | 36 | # Object toolbar |
37 | -#OBJ_TOOLS = [ID_ZOOM, ID_ZOOM_SELECT, ID_ROTATE, ID_MOVE, | 37 | +#OBJ_TOOLS = [ID_ZOOM, ID_ZOOM_SELECT, ID_ROTATE, ID_MOVE, |
38 | #ID_CONTRAST] = [wx.NewId() for number in range(5)] | 38 | #ID_CONTRAST] = [wx.NewId() for number in range(5)] |
39 | #MODE_BY_ID = {ID_ZOOM: const.STATE_ZOOM, | 39 | #MODE_BY_ID = {ID_ZOOM: const.STATE_ZOOM, |
40 | # ID_ZOOM_SELECT: const.STATE_ZOOM_SL, | 40 | # ID_ZOOM_SELECT: const.STATE_ZOOM_SL, |
@@ -111,7 +111,7 @@ class Frame(wx.Frame): | @@ -111,7 +111,7 @@ class Frame(wx.Frame): | ||
111 | self.Bind(wx.EVT_SIZE, self.OnSize) | 111 | self.Bind(wx.EVT_SIZE, self.OnSize) |
112 | self.Bind(wx.EVT_MENU, self.OnMenuClick) | 112 | self.Bind(wx.EVT_MENU, self.OnMenuClick) |
113 | #self.Bind(wx.EVT_CLOSE, self.OnExit) | 113 | #self.Bind(wx.EVT_CLOSE, self.OnExit) |
114 | - | 114 | + |
115 | def __init_aui(self): | 115 | def __init_aui(self): |
116 | 116 | ||
117 | # Tell aui_manager to manage this frame | 117 | # Tell aui_manager to manage this frame |
@@ -127,7 +127,7 @@ class Frame(wx.Frame): | @@ -127,7 +127,7 @@ class Frame(wx.Frame): | ||
127 | #CloseButton(False).Floatable(False). | 127 | #CloseButton(False).Floatable(False). |
128 | #Layer(1).Left().MaximizeButton(False).Name("Task"). | 128 | #Layer(1).Left().MaximizeButton(False).Name("Task"). |
129 | #Position(0)) | 129 | #Position(0)) |
130 | - | 130 | + |
131 | 131 | ||
132 | aui_manager.AddPane(viewers.Panel(self), wx.aui.AuiPaneInfo(). | 132 | aui_manager.AddPane(viewers.Panel(self), wx.aui.AuiPaneInfo(). |
133 | Caption("Data panel").CaptionVisible(False). | 133 | Caption("Data panel").CaptionVisible(False). |
@@ -214,12 +214,12 @@ class Frame(wx.Frame): | @@ -214,12 +214,12 @@ class Frame(wx.Frame): | ||
214 | aui_manager = self.aui_manager | 214 | aui_manager = self.aui_manager |
215 | aui_manager.GetPane("Data").Show(0) | 215 | aui_manager.GetPane("Data").Show(0) |
216 | aui_manager.GetPane("Tasks").Show(1) | 216 | aui_manager.GetPane("Tasks").Show(1) |
217 | - aui_manager.Update() | 217 | + aui_manager.Update() |
218 | 218 | ||
219 | def OnSize(self, evt): | 219 | def OnSize(self, evt): |
220 | ps.Publisher().sendMessage(('ProgressBar Reposition')) | 220 | ps.Publisher().sendMessage(('ProgressBar Reposition')) |
221 | evt.Skip() | 221 | evt.Skip() |
222 | - | 222 | + |
223 | def OnMenuClick(self, evt): | 223 | def OnMenuClick(self, evt): |
224 | id = evt.GetId() | 224 | id = evt.GetId() |
225 | session = ses.Session() | 225 | session = ses.Session() |
@@ -234,7 +234,7 @@ class Frame(wx.Frame): | @@ -234,7 +234,7 @@ class Frame(wx.Frame): | ||
234 | else: | 234 | else: |
235 | self.SaveProject() | 235 | self.SaveProject() |
236 | elif id == const.ID_PROJECT_SAVE_AS: | 236 | elif id == const.ID_PROJECT_SAVE_AS: |
237 | - self.SaveAsProject() | 237 | + self.SaveAsProject() |
238 | elif id == const.ID_PROJECT_CLOSE: | 238 | elif id == const.ID_PROJECT_CLOSE: |
239 | self.CloseProject() | 239 | self.CloseProject() |
240 | #elif id == const.ID_EXIT: | 240 | #elif id == const.ID_EXIT: |
@@ -269,15 +269,15 @@ class Frame(wx.Frame): | @@ -269,15 +269,15 @@ class Frame(wx.Frame): | ||
269 | def Exit(self): | 269 | def Exit(self): |
270 | print "Exit" | 270 | print "Exit" |
271 | ps.Publisher().sendMessage('Close Project') | 271 | ps.Publisher().sendMessage('Close Project') |
272 | - | 272 | + |
273 | def ShowTask(self, pubsub_evt): | 273 | def ShowTask(self, pubsub_evt): |
274 | self.aui_manager.GetPane("Tasks").Show() | 274 | self.aui_manager.GetPane("Tasks").Show() |
275 | self.aui_manager.Update() | 275 | self.aui_manager.Update() |
276 | - | 276 | + |
277 | def HideTask(self, pubsub_evt): | 277 | def HideTask(self, pubsub_evt): |
278 | self.aui_manager.GetPane("Tasks").Hide() | 278 | self.aui_manager.GetPane("Tasks").Hide() |
279 | self.aui_manager.Update() | 279 | self.aui_manager.Update() |
280 | - | 280 | + |
281 | 281 | ||
282 | #def OnClose(self): | 282 | #def OnClose(self): |
283 | # # TODO: implement this, based on wx.Demo | 283 | # # TODO: implement this, based on wx.Demo |
@@ -436,8 +436,12 @@ class StatusBar(wx.StatusBar): | @@ -436,8 +436,12 @@ class StatusBar(wx.StatusBar): | ||
436 | if (int(value) >= 99): | 436 | if (int(value) >= 99): |
437 | self.SetStatusText("",0) | 437 | self.SetStatusText("",0) |
438 | if sys.platform == 'win32': | 438 | if sys.platform == 'win32': |
439 | - wx.SafeYield() | ||
440 | - | 439 | + try: |
440 | + wx.SafeYield() | ||
441 | + #TODO: temporary fix necessary in the Windows XP 64 Bits | ||
442 | + #BUG in wxWidgets http://trac.wxwidgets.org/ticket/10896 | ||
443 | + except(wx._core.PyAssertionError): | ||
444 | + print "wx._core.PyAssertionError" | ||
441 | 445 | ||
442 | def UpdateStatusLabel(self, pubsub_evt): | 446 | def UpdateStatusLabel(self, pubsub_evt): |
443 | label = pubsub_evt.data | 447 | label = pubsub_evt.data |
@@ -476,7 +480,7 @@ class ProjectToolBar(wx.ToolBar): | @@ -476,7 +480,7 @@ class ProjectToolBar(wx.ToolBar): | ||
476 | 480 | ||
477 | self.__init_items() | 481 | self.__init_items() |
478 | self.__bind_events() | 482 | self.__bind_events() |
479 | - | 483 | + |
480 | #FIXME: | 484 | #FIXME: |
481 | self.save_as = True | 485 | self.save_as = True |
482 | 486 | ||
@@ -559,16 +563,16 @@ class ProjectToolBar(wx.ToolBar): | @@ -559,16 +563,16 @@ class ProjectToolBar(wx.ToolBar): | ||
559 | filename = (prj.name).replace(' ','_') | 563 | filename = (prj.name).replace(' ','_') |
560 | if prj.save_as: | 564 | if prj.save_as: |
561 | filename = dlg.ShowSaveAsProjectDialog(filename) | 565 | filename = dlg.ShowSaveAsProjectDialog(filename) |
562 | - if filename: | 566 | + if filename: |
563 | prj.save_as = False | 567 | prj.save_as = False |
564 | else: | 568 | else: |
565 | return | 569 | return |
566 | ps.Publisher().sendMessage('Save Project',filename) | 570 | ps.Publisher().sendMessage('Save Project',filename) |
567 | event.Skip() | 571 | event.Skip() |
568 | - | ||
569 | - | ||
570 | 572 | ||
571 | - | 573 | + |
574 | + | ||
575 | + | ||
572 | # ------------------------------------------------------------------ | 576 | # ------------------------------------------------------------------ |
573 | 577 | ||
574 | class ObjectToolBar(wx.ToolBar): | 578 | class ObjectToolBar(wx.ToolBar): |
@@ -577,7 +581,7 @@ class ObjectToolBar(wx.ToolBar): | @@ -577,7 +581,7 @@ class ObjectToolBar(wx.ToolBar): | ||
577 | wx.DefaultSize, | 581 | wx.DefaultSize, |
578 | wx.TB_FLAT|wx.TB_NODIVIDER | wx.TB_DOCKABLE) | 582 | wx.TB_FLAT|wx.TB_NODIVIDER | wx.TB_DOCKABLE) |
579 | 583 | ||
580 | - self.SetToolBitmapSize(wx.Size(32,32)) | 584 | + self.SetToolBitmapSize(wx.Size(32,32)) |
581 | self.parent = parent | 585 | self.parent = parent |
582 | 586 | ||
583 | self.__init_items() | 587 | self.__init_items() |
@@ -603,7 +607,7 @@ class ObjectToolBar(wx.ToolBar): | @@ -603,7 +607,7 @@ class ObjectToolBar(wx.ToolBar): | ||
603 | "tool_contrast_original.png"), | 607 | "tool_contrast_original.png"), |
604 | wx.BITMAP_TYPE_PNG) | 608 | wx.BITMAP_TYPE_PNG) |
605 | else: | 609 | else: |
606 | - | 610 | + |
607 | BMP_ROTATE = wx.Bitmap(os.path.join(const.ICON_DIR, | 611 | BMP_ROTATE = wx.Bitmap(os.path.join(const.ICON_DIR, |
608 | "tool_rotate.gif"), | 612 | "tool_rotate.gif"), |
609 | wx.BITMAP_TYPE_GIF) | 613 | wx.BITMAP_TYPE_GIF) |
@@ -665,7 +669,7 @@ class ObjectToolBar(wx.ToolBar): | @@ -665,7 +669,7 @@ class ObjectToolBar(wx.ToolBar): | ||
665 | self.ToggleTool(item, False) | 669 | self.ToggleTool(item, False) |
666 | 670 | ||
667 | evt.Skip() | 671 | evt.Skip() |
668 | - | 672 | + |
669 | 673 | ||
670 | def UntoggleAllItems(self, pubsub_evt=None): | 674 | def UntoggleAllItems(self, pubsub_evt=None): |
671 | for id in const.TOOL_STATES: | 675 | for id in const.TOOL_STATES: |
@@ -783,25 +787,25 @@ class LayoutToolBar(wx.ToolBar): | @@ -783,25 +787,25 @@ class LayoutToolBar(wx.ToolBar): | ||
783 | 787 | ||
784 | self.AddLabelTool(ID_LAYOUT, "",bitmap=self.BMP_WITHOUT_MENU, shortHelp= "Hide task panel") | 788 | self.AddLabelTool(ID_LAYOUT, "",bitmap=self.BMP_WITHOUT_MENU, shortHelp= "Hide task panel") |
785 | self.AddCheckTool(ID_TEXT, bitmap=BMP_TEXT, shortHelp= "Hide texts") | 789 | self.AddCheckTool(ID_TEXT, bitmap=BMP_TEXT, shortHelp= "Hide texts") |
786 | - | 790 | + |
787 | self.Realize() | 791 | self.Realize() |
788 | 792 | ||
789 | def __bind_events_wx(self): | 793 | def __bind_events_wx(self): |
790 | self.Bind(wx.EVT_TOOL, self.OnClick) | 794 | self.Bind(wx.EVT_TOOL, self.OnClick) |
791 | - | 795 | + |
792 | def OnClick(self, event): | 796 | def OnClick(self, event): |
793 | id = event.GetId() | 797 | id = event.GetId() |
794 | if id == ID_LAYOUT: | 798 | if id == ID_LAYOUT: |
795 | self.OnTask() | 799 | self.OnTask() |
796 | elif id== ID_TEXT: | 800 | elif id== ID_TEXT: |
797 | self.OnText(event) | 801 | self.OnText(event) |
798 | - | 802 | + |
799 | 803 | ||
800 | for item in VIEW_TOOLS: | 804 | for item in VIEW_TOOLS: |
801 | state = self.GetToolState(item) | 805 | state = self.GetToolState(item) |
802 | if state and (item != id): | 806 | if state and (item != id): |
803 | self.ToggleTool(item, False) | 807 | self.ToggleTool(item, False) |
804 | - | 808 | + |
805 | def OnTask(self): | 809 | def OnTask(self): |
806 | 810 | ||
807 | if self.ontool: | 811 | if self.ontool: |