Commit 903ccf9e00cb740d35dd99217e6de3b9d8e9d792
1 parent
af872b98
Exists in
master
and in
67 other branches
ENH: Changed call of the Pubsub because wxPython 2.8.12.1. "ps.Pusub(). to Pusub…
…." and "import wx.lib.pubsub as ps" to "from wx.lib.pubsub import pub as Publisher", tested in windows and ubuntu 11.10.
Showing
35 changed files
with
623 additions
and
619 deletions
Show diff stats
invesalius/control.py
... | ... | @@ -21,7 +21,7 @@ import os |
21 | 21 | import plistlib |
22 | 22 | |
23 | 23 | import numpy |
24 | -import wx.lib.pubsub as ps | |
24 | +from wx.lib.pubsub import pub as Publisher | |
25 | 25 | |
26 | 26 | import constants as const |
27 | 27 | import data.imagedata_utils as utils |
... | ... | @@ -54,35 +54,35 @@ class Controller(): |
54 | 54 | session = ses.Session() |
55 | 55 | self.measure_manager = data.measures.MeasurementManager() |
56 | 56 | |
57 | - ps.Publisher().sendMessage('Load Preferences') | |
57 | + Publisher.sendMessage('Load Preferences') | |
58 | 58 | |
59 | 59 | |
60 | 60 | def __bind_events(self): |
61 | - ps.Publisher().subscribe(self.OnImportMedicalImages, 'Import directory') | |
62 | - ps.Publisher().subscribe(self.OnShowDialogImportDirectory, | |
61 | + Publisher.subscribe(self.OnImportMedicalImages, 'Import directory') | |
62 | + Publisher.subscribe(self.OnShowDialogImportDirectory, | |
63 | 63 | 'Show import directory dialog') |
64 | - ps.Publisher().subscribe(self.OnShowDialogOpenProject, | |
64 | + Publisher.subscribe(self.OnShowDialogOpenProject, | |
65 | 65 | 'Show open project dialog') |
66 | 66 | |
67 | - ps.Publisher().subscribe(self.OnShowDialogSaveProject, 'Show save dialog') | |
67 | + Publisher.subscribe(self.OnShowDialogSaveProject, 'Show save dialog') | |
68 | 68 | |
69 | - ps.Publisher().subscribe(self.LoadRaycastingPreset, | |
69 | + Publisher.subscribe(self.LoadRaycastingPreset, | |
70 | 70 | 'Load raycasting preset') |
71 | - ps.Publisher().subscribe(self.SaveRaycastingPreset, | |
71 | + Publisher.subscribe(self.SaveRaycastingPreset, | |
72 | 72 | 'Save raycasting preset') |
73 | - ps.Publisher().subscribe(self.OnOpenDicomGroup, | |
73 | + Publisher.subscribe(self.OnOpenDicomGroup, | |
74 | 74 | 'Open DICOM group') |
75 | - ps.Publisher().subscribe(self.Progress, "Update dicom load") | |
76 | - ps.Publisher().subscribe(self.OnLoadImportPanel, "End dicom load") | |
77 | - ps.Publisher().subscribe(self.OnCancelImport, 'Cancel DICOM load') | |
78 | - ps.Publisher().subscribe(self.OnShowDialogCloseProject, 'Close Project') | |
79 | - ps.Publisher().subscribe(self.OnOpenProject, 'Open project') | |
80 | - ps.Publisher().subscribe(self.OnOpenRecentProject, 'Open recent project') | |
81 | - ps.Publisher().subscribe(self.OnShowAnalyzeFile, 'Show analyze dialog') | |
75 | + Publisher.subscribe(self.Progress, "Update dicom load") | |
76 | + Publisher.subscribe(self.OnLoadImportPanel, "End dicom load") | |
77 | + Publisher.subscribe(self.OnCancelImport, 'Cancel DICOM load') | |
78 | + Publisher.subscribe(self.OnShowDialogCloseProject, 'Close Project') | |
79 | + Publisher.subscribe(self.OnOpenProject, 'Open project') | |
80 | + Publisher.subscribe(self.OnOpenRecentProject, 'Open recent project') | |
81 | + Publisher.subscribe(self.OnShowAnalyzeFile, 'Show analyze dialog') | |
82 | 82 | |
83 | 83 | def OnCancelImport(self, pubsub_evt): |
84 | 84 | #self.cancel_import = True |
85 | - ps.Publisher().sendMessage('Hide import panel') | |
85 | + Publisher.sendMessage('Hide import panel') | |
86 | 86 | |
87 | 87 | |
88 | 88 | ########################### |
... | ... | @@ -108,7 +108,7 @@ class Controller(): |
108 | 108 | self.CreateAnalyzeProject(imagedata) |
109 | 109 | |
110 | 110 | self.LoadProject() |
111 | - ps.Publisher().sendMessage("Enable state project", True) | |
111 | + Publisher.sendMessage("Enable state project", True) | |
112 | 112 | |
113 | 113 | |
114 | 114 | ########################### |
... | ... | @@ -128,7 +128,7 @@ class Controller(): |
128 | 128 | dialog.ImportEmptyDirectory(dirpath) |
129 | 129 | elif dirpath: |
130 | 130 | self.StartImportPanel(dirpath) |
131 | - ps.Publisher().sendMessage("Load data to import panel", dirpath) | |
131 | + Publisher.sendMessage("Load data to import panel", dirpath) | |
132 | 132 | |
133 | 133 | def ShowDialogOpenProject(self): |
134 | 134 | # Offer to save current project if necessary |
... | ... | @@ -180,30 +180,30 @@ class Controller(): |
180 | 180 | if not answer: |
181 | 181 | debug("Close without changes") |
182 | 182 | self.CloseProject() |
183 | - ps.Publisher().sendMessage("Enable state project", False) | |
184 | - ps.Publisher().sendMessage('Set project name') | |
185 | - ps.Publisher().sendMessage("Stop Config Recording") | |
186 | - ps.Publisher().sendMessage("Exit") | |
183 | + Publisher.sendMessage("Enable state project", False) | |
184 | + Publisher.sendMessage('Set project name') | |
185 | + Publisher.sendMessage("Stop Config Recording") | |
186 | + Publisher.sendMessage("Exit") | |
187 | 187 | elif answer == 1: |
188 | 188 | self.ShowDialogSaveProject() |
189 | 189 | debug("Save changes and close") |
190 | 190 | self.CloseProject() |
191 | - ps.Publisher().sendMessage("Enable state project", False) | |
192 | - ps.Publisher().sendMessage('Set project name') | |
193 | - ps.Publisher().sendMessage("Stop Config Recording") | |
194 | - ps.Publisher().sendMessage("Exit") | |
191 | + Publisher.sendMessage("Enable state project", False) | |
192 | + Publisher.sendMessage('Set project name') | |
193 | + Publisher.sendMessage("Stop Config Recording") | |
194 | + Publisher.sendMessage("Exit") | |
195 | 195 | elif answer == -1: |
196 | 196 | debug("Cancel") |
197 | 197 | else: |
198 | 198 | self.CloseProject() |
199 | - ps.Publisher().sendMessage("Enable state project", False) | |
200 | - ps.Publisher().sendMessage('Set project name') | |
201 | - ps.Publisher().sendMessage("Stop Config Recording") | |
202 | - ps.Publisher().sendMessage("Exit") | |
199 | + Publisher.sendMessage("Enable state project", False) | |
200 | + Publisher.sendMessage('Set project name') | |
201 | + Publisher.sendMessage("Stop Config Recording") | |
202 | + Publisher.sendMessage("Exit") | |
203 | 203 | |
204 | 204 | else: |
205 | - ps.Publisher().sendMessage('Stop Config Recording') | |
206 | - ps.Publisher().sendMessage('Exit') | |
205 | + Publisher.sendMessage('Stop Config Recording') | |
206 | + Publisher.sendMessage('Exit') | |
207 | 207 | |
208 | 208 | |
209 | 209 | ########################### |
... | ... | @@ -230,7 +230,7 @@ class Controller(): |
230 | 230 | |
231 | 231 | |
232 | 232 | def OpenProject(self, filepath): |
233 | - ps.Publisher().sendMessage('Begin busy cursor') | |
233 | + Publisher.sendMessage('Begin busy cursor') | |
234 | 234 | path = os.path.abspath(filepath) |
235 | 235 | |
236 | 236 | proj = prj.Project() |
... | ... | @@ -253,14 +253,14 @@ class Controller(): |
253 | 253 | |
254 | 254 | self.LoadProject() |
255 | 255 | |
256 | - ps.Publisher().sendMessage('Update threshold limits', | |
256 | + Publisher.sendMessage('Update threshold limits', | |
257 | 257 | proj.threshold_range) |
258 | 258 | session = ses.Session() |
259 | 259 | session.OpenProject(filepath) |
260 | - ps.Publisher().sendMessage("Enable state project", True) | |
260 | + Publisher.sendMessage("Enable state project", True) | |
261 | 261 | |
262 | 262 | def SaveProject(self, path=None): |
263 | - ps.Publisher().sendMessage('Begin busy cursor') | |
263 | + Publisher.sendMessage('Begin busy cursor') | |
264 | 264 | session = ses.Session() |
265 | 265 | if path: |
266 | 266 | dirpath, filename = os.path.split(path) |
... | ... | @@ -272,14 +272,14 @@ class Controller(): |
272 | 272 | prj.Project().SavePlistProject(dirpath, filename) |
273 | 273 | |
274 | 274 | session.SaveProject() |
275 | - ps.Publisher().sendMessage('End busy cursor') | |
275 | + Publisher.sendMessage('End busy cursor') | |
276 | 276 | |
277 | 277 | def CloseProject(self): |
278 | 278 | proj = prj.Project() |
279 | 279 | proj.Close() |
280 | 280 | |
281 | - ps.Publisher().sendMessage('Hide content panel') | |
282 | - ps.Publisher().sendMessage('Close project data') | |
281 | + Publisher.sendMessage('Hide content panel') | |
282 | + Publisher.sendMessage('Close project data') | |
283 | 283 | session = ses.Session() |
284 | 284 | session.CloseProject() |
285 | 285 | |
... | ... | @@ -292,7 +292,7 @@ class Controller(): |
292 | 292 | reader = dcm.ProgressDicomReader() |
293 | 293 | reader.SetWindowEvent(self.frame) |
294 | 294 | reader.SetDirectoryPath(path) |
295 | - ps.Publisher().sendMessage('End busy cursor') | |
295 | + Publisher.sendMessage('End busy cursor') | |
296 | 296 | |
297 | 297 | def Progress(self, evt): |
298 | 298 | data = evt.data |
... | ... | @@ -305,7 +305,7 @@ class Controller(): |
305 | 305 | if not(self.progress_dialog.Update(data[0],message)): |
306 | 306 | self.progress_dialog.Close() |
307 | 307 | self.progress_dialog = None |
308 | - ps.Publisher().sendMessage('Begin busy cursor') | |
308 | + Publisher.sendMessage('Begin busy cursor') | |
309 | 309 | else: |
310 | 310 | #Is None if user canceled the load |
311 | 311 | self.progress_dialog.Close() |
... | ... | @@ -315,15 +315,15 @@ class Controller(): |
315 | 315 | patient_series = evt.data |
316 | 316 | ok = self.LoadImportPanel(patient_series) |
317 | 317 | if ok: |
318 | - ps.Publisher().sendMessage('Show import panel') | |
319 | - ps.Publisher().sendMessage("Show import panel in frame") | |
318 | + Publisher.sendMessage('Show import panel') | |
319 | + Publisher.sendMessage("Show import panel in frame") | |
320 | 320 | |
321 | 321 | |
322 | 322 | def LoadImportPanel(self, patient_series): |
323 | 323 | if patient_series and isinstance(patient_series, list): |
324 | - ps.Publisher().sendMessage("Load import panel", patient_series) | |
324 | + Publisher.sendMessage("Load import panel", patient_series) | |
325 | 325 | first_patient = patient_series[0] |
326 | - ps.Publisher().sendMessage("Load dicom preview", first_patient) | |
326 | + Publisher.sendMessage("Load dicom preview", first_patient) | |
327 | 327 | return True |
328 | 328 | else: |
329 | 329 | dialog.ImportInvalidFiles() |
... | ... | @@ -350,7 +350,7 @@ class Controller(): |
350 | 350 | debug("No medical images found on given directory") |
351 | 351 | return |
352 | 352 | self.LoadProject() |
353 | - ps.Publisher().sendMessage("Enable state project", True) | |
353 | + Publisher.sendMessage("Enable state project", True) | |
354 | 354 | |
355 | 355 | def LoadProject(self): |
356 | 356 | proj = prj.Project() |
... | ... | @@ -364,50 +364,50 @@ class Controller(): |
364 | 364 | self.Slice = sl.Slice() |
365 | 365 | self.Slice.spacing = proj.spacing |
366 | 366 | |
367 | - ps.Publisher().sendMessage('Load slice to viewer', | |
367 | + Publisher.sendMessage('Load slice to viewer', | |
368 | 368 | (proj.imagedata, |
369 | 369 | proj.mask_dict)) |
370 | 370 | |
371 | 371 | |
372 | - ps.Publisher().sendMessage('Load slice plane') | |
372 | + Publisher.sendMessage('Load slice plane') | |
373 | 373 | |
374 | - ps.Publisher().sendMessage('Bright and contrast adjustment image',\ | |
374 | + Publisher.sendMessage('Bright and contrast adjustment image',\ | |
375 | 375 | (proj.window, proj.level)) |
376 | - ps.Publisher().sendMessage('Update window level value',\ | |
376 | + Publisher.sendMessage('Update window level value',\ | |
377 | 377 | (proj.window, proj.level)) |
378 | 378 | |
379 | - ps.Publisher().sendMessage('Set project name', proj.name) | |
380 | - ps.Publisher().sendMessage('Load surface dict', | |
379 | + Publisher.sendMessage('Set project name', proj.name) | |
380 | + Publisher.sendMessage('Load surface dict', | |
381 | 381 | proj.surface_dict) |
382 | - ps.Publisher().sendMessage('Hide surface items', | |
382 | + Publisher.sendMessage('Hide surface items', | |
383 | 383 | proj.surface_dict) |
384 | 384 | self.LoadImagedataInfo() # TODO: where do we insert this <<<? |
385 | 385 | |
386 | - ps.Publisher().sendMessage('Show content panel') | |
387 | - ps.Publisher().sendMessage('Update AUI') | |
386 | + Publisher.sendMessage('Show content panel') | |
387 | + Publisher.sendMessage('Update AUI') | |
388 | 388 | |
389 | 389 | if len(proj.mask_dict): |
390 | 390 | mask_index = len(proj.mask_dict) -1 |
391 | 391 | for m in proj.mask_dict.values(): |
392 | - ps.Publisher().sendMessage('Add mask', | |
392 | + Publisher.sendMessage('Add mask', | |
393 | 393 | (m.index, m.name, |
394 | 394 | m.threshold_range, m.colour)) |
395 | 395 | self.Slice.current_mask = proj.mask_dict[mask_index] |
396 | - ps.Publisher().sendMessage('Show mask', (mask_index, True)) | |
396 | + Publisher.sendMessage('Show mask', (mask_index, True)) | |
397 | 397 | else: |
398 | 398 | mask_name = const.MASK_NAME_PATTERN % (1,) |
399 | 399 | thresh = const.THRESHOLD_RANGE |
400 | 400 | colour = const.MASK_COLOUR[0] |
401 | 401 | |
402 | - ps.Publisher().sendMessage('Create new mask', | |
402 | + Publisher.sendMessage('Create new mask', | |
403 | 403 | (mask_name, thresh, colour)) |
404 | 404 | |
405 | - ps.Publisher().sendMessage('Load measurement dict', | |
405 | + Publisher.sendMessage('Load measurement dict', | |
406 | 406 | proj.measurement_dict) |
407 | 407 | |
408 | 408 | proj.presets.thresh_ct[_('Custom')] = proj.threshold_range |
409 | 409 | |
410 | - ps.Publisher().sendMessage('End busy cursor') | |
410 | + Publisher.sendMessage('End busy cursor') | |
411 | 411 | |
412 | 412 | def CreateAnalyzeProject(self, imagedata): |
413 | 413 | header = imagedata.get_header() |
... | ... | @@ -441,7 +441,7 @@ class Controller(): |
441 | 441 | self.Slice.window_width = proj.window |
442 | 442 | self.Slice.spacing = header.get_zooms()[:3] |
443 | 443 | |
444 | - ps.Publisher().sendMessage('Update threshold limits', | |
444 | + Publisher.sendMessage('Update threshold limits', | |
445 | 445 | proj.threshold_range) |
446 | 446 | |
447 | 447 | def CreateDicomProject(self, dicom, matrix, matrix_filename): |
... | ... | @@ -479,7 +479,7 @@ class Controller(): |
479 | 479 | matrix, matrix_filename, dicom = self.OpenDicomGroup(group, interval, file_range, gui=True) |
480 | 480 | self.CreateDicomProject(dicom, matrix, matrix_filename) |
481 | 481 | self.LoadProject() |
482 | - ps.Publisher().sendMessage("Enable state project", True) | |
482 | + Publisher.sendMessage("Enable state project", True) | |
483 | 483 | |
484 | 484 | def OpenDicomGroup(self, dicom_group, interval, file_range, gui=True): |
485 | 485 | # Retrieve general DICOM headers |
... | ... | @@ -544,7 +544,7 @@ class Controller(): |
544 | 544 | self.Slice.window_level = wl |
545 | 545 | self.Slice.window_width = ww |
546 | 546 | |
547 | - ps.Publisher().sendMessage('Update threshold limits', scalar_range) | |
547 | + Publisher.sendMessage('Update threshold limits', scalar_range) | |
548 | 548 | |
549 | 549 | return self.matrix, self.filename, dicom |
550 | 550 | |
... | ... | @@ -567,7 +567,7 @@ class Controller(): |
567 | 567 | default_threshold[1] = max_ |
568 | 568 | [a,b] = default_threshold |
569 | 569 | default_threshold = (a,b) |
570 | - ps.Publisher().sendMessage('Set threshold modes', | |
570 | + Publisher.sendMessage('Set threshold modes', | |
571 | 571 | (thresh_modes,default_threshold)) |
572 | 572 | |
573 | 573 | def LoadRaycastingPreset(self, pubsub_evt=None): |
... | ... | @@ -590,11 +590,11 @@ class Controller(): |
590 | 590 | prj.Project().raycasting_preset = preset |
591 | 591 | # Notify volume |
592 | 592 | # TODO: Chamar grafico tb! |
593 | - ps.Publisher().sendMessage('Update raycasting preset') | |
593 | + Publisher.sendMessage('Update raycasting preset') | |
594 | 594 | else: |
595 | 595 | prj.Project().raycasting_preset = 0 |
596 | - ps.Publisher().sendMessage('Update raycasting preset') | |
597 | - ps.Publisher().sendMessage("Hide raycasting volume") | |
596 | + Publisher.sendMessage('Update raycasting preset') | |
597 | + Publisher.sendMessage("Hide raycasting volume") | |
598 | 598 | |
599 | 599 | def SaveRaycastingPreset(self, pubsub_evt): |
600 | 600 | preset_name = pubsub_evt.data | ... | ... |
invesalius/data/co_registration.py
... | ... | @@ -2,7 +2,7 @@ import threading |
2 | 2 | |
3 | 3 | import serial |
4 | 4 | import wx |
5 | -import wx.lib.pubsub as ps | |
5 | +from wx.lib.pubsub import pub as Publisher | |
6 | 6 | |
7 | 7 | from numpy import * |
8 | 8 | from math import sqrt |
... | ... | @@ -55,10 +55,10 @@ class Corregister(threading.Thread): |
55 | 55 | img = self.q1 + (self.Minv*self.N)*(tracker - self.q2) |
56 | 56 | coord = [float(img[0]), float(img[1]), float(img[2])] |
57 | 57 | coord_cam = float(img[0]), float(img[1]), float(img[2]) |
58 | - ps.Publisher().sendMessage('Set ball reference position based on bound', coord_cam) | |
59 | - ps.Publisher().sendMessage('Set camera in volume', coord_cam) | |
60 | - wx.CallAfter(ps.Publisher().sendMessage, 'Render volume viewer') | |
61 | - wx.CallAfter(ps.Publisher().sendMessage, 'Co-registered Points', coord) | |
58 | + Publisher.sendMessage('Set ball reference position based on bound', coord_cam) | |
59 | + Publisher.sendMessage('Set camera in volume', coord_cam) | |
60 | + wx.CallAfter(Publisher.sendMessage, 'Render volume viewer') | |
61 | + wx.CallAfter(Publisher.sendMessage, 'Co-registered Points', coord) | |
62 | 62 | sleep(0.005) |
63 | 63 | |
64 | 64 | if self._pause_: | ... | ... |
invesalius/data/editor.py
... | ... | @@ -18,7 +18,7 @@ |
18 | 18 | #-------------------------------------------------------------------------- |
19 | 19 | |
20 | 20 | import math |
21 | -import wx.lib.pubsub as ps | |
21 | +from wx.lib.pubsub import pub as Publisher | |
22 | 22 | import vtk |
23 | 23 | |
24 | 24 | AXIAL = 2 |
... | ... | @@ -120,8 +120,8 @@ class Editor: |
120 | 120 | print "Comecei" |
121 | 121 | self.DoOperation(wx, wy, wz) |
122 | 122 | print "Terminei" |
123 | - ps.Publisher().sendMessage('Update images', self.image) | |
124 | - ps.Publisher().sendMessage('Update viewer', None) | |
123 | + Publisher.sendMessage('Update images', self.image) | |
124 | + Publisher.sendMessage('Update viewer', None) | |
125 | 125 | |
126 | 126 | #self.cursor.Update() |
127 | 127 | obj.OnMouseMove() | ... | ... |
invesalius/data/imagedata_utils.py
... | ... | @@ -25,7 +25,7 @@ import gdcm |
25 | 25 | import numpy |
26 | 26 | import vtk |
27 | 27 | import vtkgdcm |
28 | -import wx.lib.pubsub as ps | |
28 | +from wx.lib.pubsub import pub as Publisher | |
29 | 29 | |
30 | 30 | from vtk.util import numpy_support |
31 | 31 | |
... | ... | @@ -361,7 +361,7 @@ def CreateImageData(filelist, zspacing, xyspacing,size, |
361 | 361 | class ImageCreator: |
362 | 362 | def __init__(self): |
363 | 363 | self.running = True |
364 | - ps.Publisher().subscribe(self.CancelImageDataLoad, "Cancel DICOM load") | |
364 | + Publisher.subscribe(self.CancelImageDataLoad, "Cancel DICOM load") | |
365 | 365 | |
366 | 366 | def CancelImageDataLoad(self, evt_pusub): |
367 | 367 | utils.debug("Canceling") | ... | ... |
invesalius/data/measures.py
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 | import math |
5 | 5 | import random |
6 | 6 | |
7 | -import wx.lib.pubsub as ps | |
7 | +from wx.lib.pubsub import pub as Publisher | |
8 | 8 | import vtk |
9 | 9 | |
10 | 10 | import constants as const |
... | ... | @@ -32,11 +32,11 @@ class MeasurementManager(object): |
32 | 32 | self._bind_events() |
33 | 33 | |
34 | 34 | def _bind_events(self): |
35 | - ps.Publisher().subscribe(self._add_point, "Add measurement point") | |
36 | - ps.Publisher().subscribe(self._change_name, "Change measurement name") | |
37 | - ps.Publisher().subscribe(self._remove_measurements, "Remove measurements") | |
38 | - ps.Publisher().subscribe(self._set_visibility, "Show measurement") | |
39 | - ps.Publisher().subscribe(self._load_measurements, "Load measurement dict") | |
35 | + Publisher.subscribe(self._add_point, "Add measurement point") | |
36 | + Publisher.subscribe(self._change_name, "Change measurement name") | |
37 | + Publisher.subscribe(self._remove_measurements, "Remove measurements") | |
38 | + Publisher.subscribe(self._set_visibility, "Show measurement") | |
39 | + Publisher.subscribe(self._load_measurements, "Load measurement dict") | |
40 | 40 | |
41 | 41 | def _load_measurements(self, pubsub_evt): |
42 | 42 | dict = pubsub_evt.data |
... | ... | @@ -51,16 +51,16 @@ class MeasurementManager(object): |
51 | 51 | for point in m.points: |
52 | 52 | x, y, z = point |
53 | 53 | actors = mr.AddPoint(x, y, z) |
54 | - ps.Publisher().sendMessage(("Add actors", m.location), | |
54 | + Publisher.sendMessage(("Add actors", m.location), | |
55 | 55 | (actors, m.slice_number)) |
56 | 56 | self.current = None |
57 | 57 | |
58 | 58 | if not m.is_shown: |
59 | 59 | mr.SetVisibility(False) |
60 | 60 | if m.location == const.SURFACE: |
61 | - ps.Publisher().sendMessage('Render volume viewer') | |
61 | + Publisher.sendMessage('Render volume viewer') | |
62 | 62 | else: |
63 | - ps.Publisher().sendMessage('Update slice viewer') | |
63 | + Publisher.sendMessage('Update slice viewer') | |
64 | 64 | |
65 | 65 | def _add_point(self, pubsub_evt): |
66 | 66 | position = pubsub_evt.data[0] |
... | ... | @@ -103,12 +103,12 @@ class MeasurementManager(object): |
103 | 103 | print "---To REMOVE" |
104 | 104 | actors = self.current[1].GetActors() |
105 | 105 | slice_number = self.current[0].slice_number |
106 | - ps.Publisher().sendMessage(('Remove actors', | |
106 | + Publisher.sendMessage(('Remove actors', | |
107 | 107 | self.current[0].location), (actors, slice_number)) |
108 | 108 | if self.current[0].location == const.SURFACE: |
109 | - ps.Publisher().sendMessage('Render volume viewer') | |
109 | + Publisher.sendMessage('Render volume viewer') | |
110 | 110 | else: |
111 | - ps.Publisher().sendMessage('Update slice viewer') | |
111 | + Publisher.sendMessage('Update slice viewer') | |
112 | 112 | |
113 | 113 | session = ses.Session() |
114 | 114 | session.ChangeProject() |
... | ... | @@ -121,7 +121,7 @@ class MeasurementManager(object): |
121 | 121 | x, y, z = position |
122 | 122 | actors = mr.AddPoint(x, y, z) |
123 | 123 | m.points.append(position) |
124 | - ps.Publisher().sendMessage(("Add actors", location), | |
124 | + Publisher.sendMessage(("Add actors", location), | |
125 | 125 | (actors, m.slice_number)) |
126 | 126 | |
127 | 127 | if mr.IsComplete(): |
... | ... | @@ -139,7 +139,7 @@ class MeasurementManager(object): |
139 | 139 | value = u"%.2f°"% m.value |
140 | 140 | |
141 | 141 | msg = 'Update measurement info in GUI', |
142 | - ps.Publisher().sendMessage(msg, | |
142 | + Publisher.sendMessage(msg, | |
143 | 143 | (index, name, colour, |
144 | 144 | type_, location, |
145 | 145 | value)) |
... | ... | @@ -156,10 +156,10 @@ class MeasurementManager(object): |
156 | 156 | m, mr = self.measures.pop(index) |
157 | 157 | actors = mr.GetActors() |
158 | 158 | prj.Project().RemoveMeasurement(index) |
159 | - ps.Publisher().sendMessage(('Remove actors', m.location), | |
159 | + Publisher.sendMessage(('Remove actors', m.location), | |
160 | 160 | (actors, m.slice_number)) |
161 | - ps.Publisher().sendMessage('Update slice viewer') | |
162 | - ps.Publisher().sendMessage('Render volume viewer') | |
161 | + Publisher.sendMessage('Update slice viewer') | |
162 | + Publisher.sendMessage('Render volume viewer') | |
163 | 163 | |
164 | 164 | session = ses.Session() |
165 | 165 | session.ChangeProject() |
... | ... | @@ -170,9 +170,9 @@ class MeasurementManager(object): |
170 | 170 | m.is_shown = visibility |
171 | 171 | mr.SetVisibility(visibility) |
172 | 172 | if m.location == const.SURFACE: |
173 | - ps.Publisher().sendMessage('Render volume viewer') | |
173 | + Publisher.sendMessage('Render volume viewer') | |
174 | 174 | else: |
175 | - ps.Publisher().sendMessage('Update slice viewer') | |
175 | + Publisher.sendMessage('Update slice viewer') | |
176 | 176 | |
177 | 177 | |
178 | 178 | class Measurement(): | ... | ... |
invesalius/data/polydata_utils.py
invesalius/data/slice_.py
... | ... | @@ -20,7 +20,7 @@ import math |
20 | 20 | |
21 | 21 | import numpy |
22 | 22 | import vtk |
23 | -import wx.lib.pubsub as ps | |
23 | +from wx.lib.pubsub import pub as Publisher | |
24 | 24 | |
25 | 25 | import constants as const |
26 | 26 | import converters |
... | ... | @@ -93,45 +93,45 @@ class Slice(object): |
93 | 93 | |
94 | 94 | def __bind_events(self): |
95 | 95 | # General slice control |
96 | - ps.Publisher().subscribe(self.CreateSurfaceFromIndex, | |
96 | + Publisher.subscribe(self.CreateSurfaceFromIndex, | |
97 | 97 | 'Create surface from index') |
98 | 98 | # Mask control |
99 | - ps.Publisher().subscribe(self.__add_mask_thresh, 'Create new mask') | |
100 | - ps.Publisher().subscribe(self.__select_current_mask, | |
99 | + Publisher.subscribe(self.__add_mask_thresh, 'Create new mask') | |
100 | + Publisher.subscribe(self.__select_current_mask, | |
101 | 101 | 'Change mask selected') |
102 | 102 | # Mask properties |
103 | - ps.Publisher().subscribe(self.__set_current_mask_edition_threshold, | |
103 | + Publisher.subscribe(self.__set_current_mask_edition_threshold, | |
104 | 104 | 'Set edition threshold values') |
105 | - ps.Publisher().subscribe(self.__set_current_mask_threshold, | |
105 | + Publisher.subscribe(self.__set_current_mask_threshold, | |
106 | 106 | 'Set threshold values') |
107 | - ps.Publisher().subscribe(self.__set_current_mask_threshold_actual_slice, | |
107 | + Publisher.subscribe(self.__set_current_mask_threshold_actual_slice, | |
108 | 108 | 'Changing threshold values') |
109 | - ps.Publisher().subscribe(self.__set_current_mask_colour, | |
109 | + Publisher.subscribe(self.__set_current_mask_colour, | |
110 | 110 | 'Change mask colour') |
111 | - ps.Publisher().subscribe(self.__set_mask_name, 'Change mask name') | |
112 | - ps.Publisher().subscribe(self.__show_mask, 'Show mask') | |
111 | + Publisher.subscribe(self.__set_mask_name, 'Change mask name') | |
112 | + Publisher.subscribe(self.__show_mask, 'Show mask') | |
113 | 113 | |
114 | - ps.Publisher().subscribe(self.__set_current_mask_threshold_limits, | |
114 | + Publisher.subscribe(self.__set_current_mask_threshold_limits, | |
115 | 115 | 'Update threshold limits') |
116 | 116 | |
117 | - ps.Publisher().subscribe(self.UpdateWindowLevelBackground,\ | |
117 | + Publisher.subscribe(self.UpdateWindowLevelBackground,\ | |
118 | 118 | 'Bright and contrast adjustment image') |
119 | 119 | |
120 | - ps.Publisher().subscribe(self.UpdateColourTableBackground,\ | |
120 | + Publisher.subscribe(self.UpdateColourTableBackground,\ | |
121 | 121 | 'Change colour table from background image') |
122 | 122 | |
123 | - ps.Publisher().subscribe(self.InputImageWidget, 'Input Image in the widget') | |
123 | + Publisher.subscribe(self.InputImageWidget, 'Input Image in the widget') | |
124 | 124 | |
125 | - ps.Publisher().subscribe(self.OnExportMask,'Export mask to file') | |
125 | + Publisher.subscribe(self.OnExportMask,'Export mask to file') | |
126 | 126 | |
127 | - ps.Publisher().subscribe(self.OnCloseProject, 'Close project data') | |
127 | + Publisher.subscribe(self.OnCloseProject, 'Close project data') | |
128 | 128 | |
129 | - ps.Publisher().subscribe(self.OnEnableStyle, 'Enable style') | |
130 | - ps.Publisher().subscribe(self.OnDisableStyle, 'Disable style') | |
129 | + Publisher.subscribe(self.OnEnableStyle, 'Enable style') | |
130 | + Publisher.subscribe(self.OnDisableStyle, 'Disable style') | |
131 | 131 | |
132 | - ps.Publisher().subscribe(self.OnRemoveMasks, 'Remove masks') | |
133 | - ps.Publisher().subscribe(self.OnDuplicateMasks, 'Duplicate masks') | |
134 | - ps.Publisher().subscribe(self.UpdateSlice3D,'Update slice 3D') | |
132 | + Publisher.subscribe(self.OnRemoveMasks, 'Remove masks') | |
133 | + Publisher.subscribe(self.OnDuplicateMasks, 'Duplicate masks') | |
134 | + Publisher.subscribe(self.UpdateSlice3D,'Update slice 3D') | |
135 | 135 | |
136 | 136 | def GetMaxSliceNumber(self, orientation): |
137 | 137 | shape = self.matrix.shape |
... | ... | @@ -160,7 +160,7 @@ class Slice(object): |
160 | 160 | buffer_.discard_vtk_mask() |
161 | 161 | buffer_.discard_mask() |
162 | 162 | |
163 | - ps.Publisher().sendMessage('Reload actual slice') | |
163 | + Publisher.sendMessage('Reload actual slice') | |
164 | 164 | |
165 | 165 | def OnDuplicateMasks(self, pubsub_evt): |
166 | 166 | selected_items = pubsub_evt.data |
... | ... | @@ -185,16 +185,16 @@ class Slice(object): |
185 | 185 | state = pubsub_evt.data |
186 | 186 | if (state in const.SLICE_STYLES): |
187 | 187 | new_state = self.interaction_style.AddState(state) |
188 | - ps.Publisher().sendMessage('Set slice interaction style', new_state) | |
188 | + Publisher.sendMessage('Set slice interaction style', new_state) | |
189 | 189 | |
190 | 190 | def OnDisableStyle(self, pubsub_evt): |
191 | 191 | state = pubsub_evt.data |
192 | 192 | if (state in const.SLICE_STYLES): |
193 | 193 | new_state = self.interaction_style.RemoveState(state) |
194 | - ps.Publisher().sendMessage('Set slice interaction style', new_state) | |
194 | + Publisher.sendMessage('Set slice interaction style', new_state) | |
195 | 195 | |
196 | 196 | if (state == const.SLICE_STATE_EDITOR): |
197 | - ps.Publisher().sendMessage('Set interactor default cursor') | |
197 | + Publisher.sendMessage('Set interactor default cursor') | |
198 | 198 | |
199 | 199 | def OnCloseProject(self, pubsub_evt): |
200 | 200 | self.CloseProject() |
... | ... | @@ -202,7 +202,7 @@ class Slice(object): |
202 | 202 | def CloseProject(self): |
203 | 203 | self.imagedata = None |
204 | 204 | self.current_mask = None |
205 | - ps.Publisher().sendMessage('Select first item from slice menu') | |
205 | + Publisher.sendMessage('Select first item from slice menu') | |
206 | 206 | #self.blend_filter = None |
207 | 207 | #self.blend_filter = None |
208 | 208 | #self.num_gradient = 0 |
... | ... | @@ -230,7 +230,7 @@ class Slice(object): |
230 | 230 | self.CreateMask(name=mask_name, threshold_range=thresh, colour =colour) |
231 | 231 | self.SetMaskColour(self.current_mask.index, self.current_mask.colour) |
232 | 232 | self.SelectCurrentMask(self.current_mask.index) |
233 | - ps.Publisher().sendMessage('Reload actual slice') | |
233 | + Publisher.sendMessage('Reload actual slice') | |
234 | 234 | |
235 | 235 | def __select_current_mask(self, pubsub_evt): |
236 | 236 | mask_index = pubsub_evt.data |
... | ... | @@ -258,7 +258,7 @@ class Slice(object): |
258 | 258 | orientation) |
259 | 259 | self.num_gradient += 1 |
260 | 260 | |
261 | - ps.Publisher().sendMessage('Reload actual slice') | |
261 | + Publisher.sendMessage('Reload actual slice') | |
262 | 262 | |
263 | 263 | def __set_current_mask_colour(self, pubsub_evt): |
264 | 264 | # "if" is necessary because wx events are calling this before any mask |
... | ... | @@ -482,14 +482,14 @@ class Slice(object): |
482 | 482 | |
483 | 483 | (r,g,b) = colour |
484 | 484 | colour_wx = [r*255, g*255, b*255] |
485 | - ps.Publisher().sendMessage('Change mask colour in notebook', | |
485 | + Publisher.sendMessage('Change mask colour in notebook', | |
486 | 486 | (index, (r,g,b))) |
487 | - ps.Publisher().sendMessage('Set GUI items colour', colour_wx) | |
487 | + Publisher.sendMessage('Set GUI items colour', colour_wx) | |
488 | 488 | if update: |
489 | 489 | # Updating mask colour on vtkimagedata. |
490 | 490 | for buffer_ in self.buffer_slices.values(): |
491 | 491 | buffer_.discard_vtk_mask() |
492 | - ps.Publisher().sendMessage('Reload actual slice') | |
492 | + Publisher.sendMessage('Reload actual slice') | |
493 | 493 | |
494 | 494 | session = ses.Session() |
495 | 495 | session.ChangeProject() |
... | ... | @@ -535,10 +535,10 @@ class Slice(object): |
535 | 535 | self.buffer_slices[orientation].mask = (255 * ((slice_ >= thresh_min) & (slice_ <= thresh_max))).astype('uint8') |
536 | 536 | |
537 | 537 | # Update viewer |
538 | - #ps.Publisher().sendMessage('Update slice viewer') | |
538 | + #Publisher.sendMessage('Update slice viewer') | |
539 | 539 | |
540 | 540 | # Update data notebook (GUI) |
541 | - ps.Publisher().sendMessage('Set mask threshold in notebook', | |
541 | + Publisher.sendMessage('Set mask threshold in notebook', | |
542 | 542 | (self.current_mask.index, |
543 | 543 | self.current_mask.threshold_range)) |
544 | 544 | else: |
... | ... | @@ -557,7 +557,7 @@ class Slice(object): |
557 | 557 | for buffer_ in self.buffer_slices.values(): |
558 | 558 | buffer_.discard_vtk_mask() |
559 | 559 | buffer_.discard_mask() |
560 | - ps.Publisher().sendMessage('Reload actual slice') | |
560 | + Publisher.sendMessage('Reload actual slice') | |
561 | 561 | #--------------------------------------------------------------------------- |
562 | 562 | |
563 | 563 | def SelectCurrentMask(self, index): |
... | ... | @@ -581,13 +581,13 @@ class Slice(object): |
581 | 581 | "CORONAL": SliceBuffer(), |
582 | 582 | "SAGITAL": SliceBuffer()} |
583 | 583 | |
584 | - ps.Publisher().sendMessage('Set mask threshold in notebook', | |
584 | + Publisher.sendMessage('Set mask threshold in notebook', | |
585 | 585 | (index, |
586 | 586 | self.current_mask.threshold_range)) |
587 | - ps.Publisher().sendMessage('Set threshold values in gradient', | |
587 | + Publisher.sendMessage('Set threshold values in gradient', | |
588 | 588 | self.current_mask.threshold_range) |
589 | - ps.Publisher().sendMessage('Select mask name in combo', index) | |
590 | - ps.Publisher().sendMessage('Update slice viewer') | |
589 | + Publisher.sendMessage('Select mask name in combo', index) | |
590 | + Publisher.sendMessage('Update slice viewer') | |
591 | 591 | #--------------------------------------------------------------------------- |
592 | 592 | |
593 | 593 | def CreateSurfaceFromIndex(self, pubsub_evt): |
... | ... | @@ -606,7 +606,7 @@ class Slice(object): |
606 | 606 | |
607 | 607 | mask.matrix.flush() |
608 | 608 | |
609 | - ps.Publisher().sendMessage('Create surface', (algorithm, options, | |
609 | + Publisher.sendMessage('Create surface', (algorithm, options, | |
610 | 610 | self.matrix, |
611 | 611 | self.matrix_filename, |
612 | 612 | mask, self.spacing, |
... | ... | @@ -649,7 +649,7 @@ class Slice(object): |
649 | 649 | |
650 | 650 | def __create_background(self, imagedata): |
651 | 651 | thresh_min, thresh_max = imagedata.GetScalarRange() |
652 | - ps.Publisher().sendMessage('Update threshold limits list', (thresh_min, | |
652 | + Publisher.sendMessage('Update threshold limits list', (thresh_min, | |
653 | 653 | thresh_max)) |
654 | 654 | |
655 | 655 | # map scalar values into colors |
... | ... | @@ -676,7 +676,7 @@ class Slice(object): |
676 | 676 | for buffer_ in self.buffer_slices.values(): |
677 | 677 | buffer_.discard_vtk_image() |
678 | 678 | |
679 | - ps.Publisher().sendMessage('Reload actual slice') | |
679 | + Publisher.sendMessage('Reload actual slice') | |
680 | 680 | |
681 | 681 | def UpdateColourTableBackground(self, pubsub_evt): |
682 | 682 | values = pubsub_evt.data |
... | ... | @@ -686,7 +686,7 @@ class Slice(object): |
686 | 686 | self.value_range = values[3] |
687 | 687 | for buffer_ in self.buffer_slices.values(): |
688 | 688 | buffer_.discard_vtk_image() |
689 | - ps.Publisher().sendMessage('Reload actual slice') | |
689 | + Publisher.sendMessage('Reload actual slice') | |
690 | 690 | |
691 | 691 | def InputImageWidget(self, pubsub_evt): |
692 | 692 | widget, orientation = pubsub_evt.data |
... | ... | @@ -759,7 +759,7 @@ class Slice(object): |
759 | 759 | future_mask.index = index |
760 | 760 | |
761 | 761 | ## update gui related to mask |
762 | - ps.Publisher().sendMessage('Add mask', | |
762 | + Publisher.sendMessage('Add mask', | |
763 | 763 | (future_mask.index, |
764 | 764 | future_mask.name, |
765 | 765 | future_mask.threshold_range, |
... | ... | @@ -767,8 +767,8 @@ class Slice(object): |
767 | 767 | |
768 | 768 | self.current_mask = future_mask |
769 | 769 | |
770 | - ps.Publisher().sendMessage('Change mask selected', future_mask.index) | |
771 | - ps.Publisher().sendMessage('Update slice viewer') | |
770 | + Publisher.sendMessage('Change mask selected', future_mask.index) | |
771 | + Publisher.sendMessage('Update slice viewer') | |
772 | 772 | |
773 | 773 | def __load_masks(self, imagedata, mask_dict): |
774 | 774 | keys = mask_dict.keys() |
... | ... | @@ -779,7 +779,7 @@ class Slice(object): |
779 | 779 | # update gui related to mask |
780 | 780 | utils.debug("__load_masks") |
781 | 781 | utils.debug('THRESHOLD_RANGE %s'% mask.threshold_range) |
782 | - ps.Publisher().sendMessage('Add mask', | |
782 | + Publisher.sendMessage('Add mask', | |
783 | 783 | (mask.index, |
784 | 784 | mask.name, |
785 | 785 | mask.threshold_range, |
... | ... | @@ -788,8 +788,8 @@ class Slice(object): |
788 | 788 | self.current_mask = mask |
789 | 789 | self.__build_mask(imagedata, False) |
790 | 790 | |
791 | - ps.Publisher().sendMessage('Change mask selected', mask.index) | |
792 | - ps.Publisher().sendMessage('Update slice viewer') | |
791 | + Publisher.sendMessage('Change mask selected', mask.index) | |
792 | + Publisher.sendMessage('Update slice viewer') | |
793 | 793 | |
794 | 794 | def do_ww_wl(self, image): |
795 | 795 | colorer = vtk.vtkImageMapToWindowLevelColors() |
... | ... | @@ -891,7 +891,7 @@ class Slice(object): |
891 | 891 | if o != orientation: |
892 | 892 | self.buffer_slices[o].discard_mask() |
893 | 893 | self.buffer_slices[o].discard_vtk_mask() |
894 | - ps.Publisher().sendMessage('Reload actual slice') | |
894 | + Publisher.sendMessage('Reload actual slice') | |
895 | 895 | |
896 | 896 | def __build_mask(self, imagedata, create=True): |
897 | 897 | # create new mask instance and insert it into project | ... | ... |
invesalius/data/surface.py
... | ... | @@ -23,7 +23,7 @@ import plistlib |
23 | 23 | import random |
24 | 24 | |
25 | 25 | import vtk |
26 | -import wx.lib.pubsub as ps | |
26 | +from wx.lib.pubsub import pub as Publisher | |
27 | 27 | |
28 | 28 | import constants as const |
29 | 29 | import imagedata_utils as iu |
... | ... | @@ -107,27 +107,27 @@ class SurfaceManager(): |
107 | 107 | self.__bind_events() |
108 | 108 | |
109 | 109 | def __bind_events(self): |
110 | - ps.Publisher().subscribe(self.AddNewActor, 'Create surface') | |
111 | - ps.Publisher().subscribe(self.SetActorTransparency, | |
110 | + Publisher.subscribe(self.AddNewActor, 'Create surface') | |
111 | + Publisher.subscribe(self.SetActorTransparency, | |
112 | 112 | 'Set surface transparency') |
113 | - ps.Publisher().subscribe(self.SetActorColour, | |
113 | + Publisher.subscribe(self.SetActorColour, | |
114 | 114 | 'Set surface colour') |
115 | 115 | |
116 | - ps.Publisher().subscribe(self.OnChangeSurfaceName, 'Change surface name') | |
117 | - ps.Publisher().subscribe(self.OnShowSurface, 'Show surface') | |
118 | - ps.Publisher().subscribe(self.OnExportSurface,'Export surface to file') | |
119 | - ps.Publisher().subscribe(self.OnLoadSurfaceDict, 'Load surface dict') | |
120 | - ps.Publisher().subscribe(self.OnCloseProject, 'Close project data') | |
121 | - ps.Publisher().subscribe(self.OnSelectSurface, 'Change surface selected') | |
116 | + Publisher.subscribe(self.OnChangeSurfaceName, 'Change surface name') | |
117 | + Publisher.subscribe(self.OnShowSurface, 'Show surface') | |
118 | + Publisher.subscribe(self.OnExportSurface,'Export surface to file') | |
119 | + Publisher.subscribe(self.OnLoadSurfaceDict, 'Load surface dict') | |
120 | + Publisher.subscribe(self.OnCloseProject, 'Close project data') | |
121 | + Publisher.subscribe(self.OnSelectSurface, 'Change surface selected') | |
122 | 122 | #---- |
123 | - ps.Publisher().subscribe(self.OnSplitSurface, 'Split surface') | |
124 | - ps.Publisher().subscribe(self.OnLargestSurface, | |
123 | + Publisher.subscribe(self.OnSplitSurface, 'Split surface') | |
124 | + Publisher.subscribe(self.OnLargestSurface, | |
125 | 125 | 'Create surface from largest region') |
126 | - ps.Publisher().subscribe(self.OnSeedSurface, "Create surface from seeds") | |
126 | + Publisher.subscribe(self.OnSeedSurface, "Create surface from seeds") | |
127 | 127 | |
128 | - ps.Publisher().subscribe(self.OnDuplicate, "Duplicate surfaces") | |
129 | - ps.Publisher().subscribe(self.OnRemove,"Remove surfaces") | |
130 | - ps.Publisher().subscribe(self.UpdateSurfaceInterpolation, 'Update Surface Interpolation') | |
128 | + Publisher.subscribe(self.OnDuplicate, "Duplicate surfaces") | |
129 | + Publisher.subscribe(self.OnRemove,"Remove surfaces") | |
130 | + Publisher.subscribe(self.UpdateSurfaceInterpolation, 'Update Surface Interpolation') | |
131 | 131 | |
132 | 132 | def OnDuplicate(self, pubsub_evt): |
133 | 133 | selected_items = pubsub_evt.data |
... | ... | @@ -163,7 +163,7 @@ class SurfaceManager(): |
163 | 163 | if i > index: |
164 | 164 | new_dict[i-1] = old_dict[i] |
165 | 165 | old_dict = new_dict |
166 | - ps.Publisher().sendMessage('Remove surface actor from viewer', actor) | |
166 | + Publisher.sendMessage('Remove surface actor from viewer', actor) | |
167 | 167 | self.actors_dict = new_dict |
168 | 168 | |
169 | 169 | if self.last_surface_index in selected_items: |
... | ... | @@ -185,7 +185,7 @@ class SurfaceManager(): |
185 | 185 | new_polydata = pu.JoinSeedsParts(surface.polydata, |
186 | 186 | points_id_list) |
187 | 187 | index = self.CreateSurfaceFromPolydata(new_polydata) |
188 | - ps.Publisher().sendMessage('Show single surface', (index, True)) | |
188 | + Publisher.sendMessage('Show single surface', (index, True)) | |
189 | 189 | #self.ShowActor(index, True) |
190 | 190 | |
191 | 191 | def OnSplitSurface(self, pubsub_evt): |
... | ... | @@ -204,7 +204,7 @@ class SurfaceManager(): |
204 | 204 | index_list.append(index) |
205 | 205 | #self.ShowActor(index, True) |
206 | 206 | |
207 | - ps.Publisher().sendMessage('Show multiple surfaces', (index_list, True)) | |
207 | + Publisher.sendMessage('Show multiple surfaces', (index_list, True)) | |
208 | 208 | |
209 | 209 | def OnLargestSurface(self, pubsub_evt): |
210 | 210 | """ |
... | ... | @@ -217,7 +217,7 @@ class SurfaceManager(): |
217 | 217 | |
218 | 218 | new_polydata = pu.SelectLargestPart(surface.polydata) |
219 | 219 | new_index = self.CreateSurfaceFromPolydata(new_polydata) |
220 | - ps.Publisher().sendMessage('Show single surface', (new_index, True)) | |
220 | + Publisher.sendMessage('Show single surface', (new_index, True)) | |
221 | 221 | |
222 | 222 | def CreateSurfaceFromPolydata(self, polydata, overwrite=False, |
223 | 223 | name=None, colour=None, |
... | ... | @@ -279,9 +279,9 @@ class SurfaceManager(): |
279 | 279 | surface.volume = volume |
280 | 280 | self.last_surface_index = surface.index |
281 | 281 | |
282 | - ps.Publisher().sendMessage('Load surface actor into viewer', actor) | |
282 | + Publisher.sendMessage('Load surface actor into viewer', actor) | |
283 | 283 | |
284 | - ps.Publisher().sendMessage('Update surface info in GUI', | |
284 | + Publisher.sendMessage('Update surface info in GUI', | |
285 | 285 | (surface.index, surface.name, |
286 | 286 | surface.colour, surface.volume, |
287 | 287 | surface.transparency)) |
... | ... | @@ -292,7 +292,7 @@ class SurfaceManager(): |
292 | 292 | |
293 | 293 | def CloseProject(self): |
294 | 294 | for index in self.actors_dict: |
295 | - ps.Publisher().sendMessage('Remove surface actor from viewer', self.actors_dict[index]) | |
295 | + Publisher.sendMessage('Remove surface actor from viewer', self.actors_dict[index]) | |
296 | 296 | del self.actors_dict |
297 | 297 | self.actors_dict = {} |
298 | 298 | |
... | ... | @@ -302,7 +302,7 @@ class SurfaceManager(): |
302 | 302 | # self.actors_dict. |
303 | 303 | proj = prj.Project() |
304 | 304 | surface = proj.surface_dict[index] |
305 | - ps.Publisher().sendMessage('Update surface info in GUI', | |
305 | + Publisher.sendMessage('Update surface info in GUI', | |
306 | 306 | (index, surface.name, |
307 | 307 | surface.colour, surface.volume, |
308 | 308 | surface.transparency)) |
... | ... | @@ -342,13 +342,13 @@ class SurfaceManager(): |
342 | 342 | self.actors_dict[surface.index] = actor |
343 | 343 | |
344 | 344 | # Send actor by pubsub to viewer's render |
345 | - ps.Publisher().sendMessage('Load surface actor into viewer', (actor)) | |
345 | + Publisher.sendMessage('Load surface actor into viewer', (actor)) | |
346 | 346 | |
347 | - ps.Publisher().sendMessage('Update status text in GUI', | |
347 | + Publisher.sendMessage('Update status text in GUI', | |
348 | 348 | _("Ready")) |
349 | 349 | |
350 | 350 | # The following lines have to be here, otherwise all volumes disappear |
351 | - ps.Publisher().sendMessage('Update surface info in GUI', | |
351 | + Publisher.sendMessage('Update surface info in GUI', | |
352 | 352 | (surface.index, surface.name, |
353 | 353 | surface.colour, surface.volume, |
354 | 354 | surface.transparency)) |
... | ... | @@ -623,17 +623,17 @@ class SurfaceManager(): |
623 | 623 | surface.volume = volume |
624 | 624 | self.last_surface_index = surface.index |
625 | 625 | |
626 | - ps.Publisher().sendMessage('Load surface actor into viewer', actor) | |
626 | + Publisher.sendMessage('Load surface actor into viewer', actor) | |
627 | 627 | |
628 | 628 | # Send actor by pubsub to viewer's render |
629 | 629 | if overwrite and self.actors_dict.keys(): |
630 | 630 | old_actor = self.actors_dict[self.last_surface_index] |
631 | - ps.Publisher().sendMessage('Remove surface actor from viewer', old_actor) | |
631 | + Publisher.sendMessage('Remove surface actor from viewer', old_actor) | |
632 | 632 | |
633 | 633 | # Save actor for future management tasks |
634 | 634 | self.actors_dict[surface.index] = actor |
635 | 635 | |
636 | - ps.Publisher().sendMessage('Update surface info in GUI', | |
636 | + Publisher.sendMessage('Update surface info in GUI', | |
637 | 637 | (surface.index, surface.name, |
638 | 638 | surface.colour, surface.volume, |
639 | 639 | surface.transparency)) |
... | ... | @@ -641,10 +641,10 @@ class SurfaceManager(): |
641 | 641 | #When you finalize the progress. The bar is cleaned. |
642 | 642 | UpdateProgress = vu.ShowProgress(1) |
643 | 643 | UpdateProgress(0, _("Ready")) |
644 | - ps.Publisher().sendMessage('Update status text in GUI', | |
644 | + Publisher.sendMessage('Update status text in GUI', | |
645 | 645 | _("Ready")) |
646 | 646 | |
647 | - ps.Publisher().sendMessage('End busy cursor') | |
647 | + Publisher.sendMessage('End busy cursor') | |
648 | 648 | |
649 | 649 | def UpdateSurfaceInterpolation(self, pub_evt): |
650 | 650 | interpolation = int(ses.Session().surface_interpolation) |
... | ... | @@ -652,13 +652,13 @@ class SurfaceManager(): |
652 | 652 | |
653 | 653 | for key in self.actors_dict: |
654 | 654 | self.actors_dict[key].GetProperty().SetInterpolation(interpolation) |
655 | - ps.Publisher().sendMessage('Render volume viewer') | |
655 | + Publisher.sendMessage('Render volume viewer') | |
656 | 656 | |
657 | 657 | def RemoveActor(self, index): |
658 | 658 | """ |
659 | 659 | Remove actor, according to given actor index. |
660 | 660 | """ |
661 | - ps.Publisher().sendMessage('Remove surface actor from viewer', (index)) | |
661 | + Publisher.sendMessage('Remove surface actor from viewer', (index)) | |
662 | 662 | self.actors_dict.pop(index) |
663 | 663 | # Remove surface from project's surface_dict |
664 | 664 | proj = prj.Project() |
... | ... | @@ -681,7 +681,7 @@ class SurfaceManager(): |
681 | 681 | # Update value in project's surface_dict |
682 | 682 | proj = prj.Project() |
683 | 683 | proj.surface_dict[index].is_shown = value |
684 | - ps.Publisher().sendMessage('Render volume viewer') | |
684 | + Publisher.sendMessage('Render volume viewer') | |
685 | 685 | |
686 | 686 | def SetActorTransparency(self, pubsub_evt): |
687 | 687 | """ |
... | ... | @@ -693,7 +693,7 @@ class SurfaceManager(): |
693 | 693 | # Update value in project's surface_dict |
694 | 694 | proj = prj.Project() |
695 | 695 | proj.surface_dict[index].transparency = value |
696 | - ps.Publisher().sendMessage('Render volume viewer') | |
696 | + Publisher.sendMessage('Render volume viewer') | |
697 | 697 | |
698 | 698 | def SetActorColour(self, pubsub_evt): |
699 | 699 | """ |
... | ... | @@ -703,7 +703,7 @@ class SurfaceManager(): |
703 | 703 | # Update value in project's surface_dict |
704 | 704 | proj = prj.Project() |
705 | 705 | proj.surface_dict[index].colour = colour |
706 | - ps.Publisher().sendMessage('Render volume viewer') | |
706 | + Publisher.sendMessage('Render volume viewer') | |
707 | 707 | |
708 | 708 | def OnExportSurface(self, pubsub_evt): |
709 | 709 | filename, filetype = pubsub_evt.data | ... | ... |
invesalius/data/surface_process.py
... | ... | @@ -119,8 +119,8 @@ class SurfaceProcess(multiprocessing.Process): |
119 | 119 | contour.ComputeScalarsOn() |
120 | 120 | contour.ComputeGradientsOn() |
121 | 121 | contour.ComputeNormalsOn() |
122 | - contour.AddObserver("ProgressEvent", lambda obj,evt: | |
123 | - self.SendProgress(obj, _("Generating 3D surface..."))) | |
122 | + #contour.AddObserver("ProgressEvent", lambda obj,evt: | |
123 | + # self.SendProgress(obj, _("Generating 3D surface..."))) | |
124 | 124 | polydata = contour.GetOutput() |
125 | 125 | #else: #mode == "GRAYSCALE": |
126 | 126 | #mcubes = vtk.vtkMarchingCubes() | ... | ... |
invesalius/data/viewer_slice.py
... | ... | @@ -27,7 +27,7 @@ import vtk |
27 | 27 | from vtk.wx.wxVTKRenderWindowInteractor import wxVTKRenderWindowInteractor |
28 | 28 | |
29 | 29 | import wx |
30 | -import wx.lib.pubsub as ps | |
30 | +from wx.lib.pubsub import pub as Publisher | |
31 | 31 | |
32 | 32 | import constants as const |
33 | 33 | import cursor_actors as ca |
... | ... | @@ -229,10 +229,10 @@ class Viewer(wx.Panel): |
229 | 229 | |
230 | 230 | if state == const.SLICE_STATE_CROSS: |
231 | 231 | self.__set_cross_visibility(1) |
232 | - ps.Publisher().sendMessage('Activate ball reference') | |
232 | + Publisher.sendMessage('Activate ball reference') | |
233 | 233 | else: |
234 | 234 | self.__set_cross_visibility(0) |
235 | - ps.Publisher().sendMessage('Deactivate ball reference') | |
235 | + Publisher.sendMessage('Deactivate ball reference') | |
236 | 236 | |
237 | 237 | if state == const.STATE_WL: |
238 | 238 | self.on_wl = True |
... | ... | @@ -322,7 +322,7 @@ class Viewer(wx.Panel): |
322 | 322 | |
323 | 323 | def OnReleaseRightButton(self, evt, obj): |
324 | 324 | self.right_pressed = 0 |
325 | - ps.Publisher().sendMessage('Update slice viewer') | |
325 | + Publisher.sendMessage('Update slice viewer') | |
326 | 326 | |
327 | 327 | def OnLeftClick(self, evt, obj): |
328 | 328 | self.left_pressed = 1 |
... | ... | @@ -332,7 +332,7 @@ class Viewer(wx.Panel): |
332 | 332 | |
333 | 333 | def OnReleaseLeftButton(self, evt, obj): |
334 | 334 | self.left_pressed = 0 |
335 | - ps.Publisher().sendMessage('Update slice viewer') | |
335 | + Publisher.sendMessage('Update slice viewer') | |
336 | 336 | |
337 | 337 | def OnWindowLevelMove(self, evt, obj): |
338 | 338 | if (self.left_pressed): |
... | ... | @@ -342,7 +342,7 @@ class Viewer(wx.Panel): |
342 | 342 | self.acum_achange_level += mouse_y - self.last_y |
343 | 343 | self.last_x, self.last_y = mouse_x, mouse_y |
344 | 344 | |
345 | - ps.Publisher().sendMessage('Bright and contrast adjustment image', | |
345 | + Publisher.sendMessage('Bright and contrast adjustment image', | |
346 | 346 | (self.acum_achange_window, self.acum_achange_level)) |
347 | 347 | |
348 | 348 | #self.SetWLText(self.acum_achange_level, |
... | ... | @@ -350,12 +350,12 @@ class Viewer(wx.Panel): |
350 | 350 | |
351 | 351 | const.WINDOW_LEVEL['Manual'] = (self.acum_achange_window,\ |
352 | 352 | self.acum_achange_level) |
353 | - ps.Publisher().sendMessage('Check window and level other') | |
354 | - ps.Publisher().sendMessage('Update window level value',(self.acum_achange_window, | |
353 | + Publisher.sendMessage('Check window and level other') | |
354 | + Publisher.sendMessage('Update window level value',(self.acum_achange_window, | |
355 | 355 | self.acum_achange_level)) |
356 | 356 | #Necessary update the slice plane in the volume case exists |
357 | - ps.Publisher().sendMessage('Update slice viewer') | |
358 | - ps.Publisher().sendMessage('Render volume viewer') | |
357 | + Publisher.sendMessage('Update slice viewer') | |
358 | + Publisher.sendMessage('Render volume viewer') | |
359 | 359 | |
360 | 360 | def OnWindowLevelClick(self, evt, obj): |
361 | 361 | self.last_x, self.last_y = self.interactor.GetLastEventPosition() |
... | ... | @@ -364,7 +364,7 @@ class Viewer(wx.Panel): |
364 | 364 | window, level = pubsub_evt.data |
365 | 365 | self.acum_achange_window, self.acum_achange_level = (window, level) |
366 | 366 | self.SetWLText(window, level) |
367 | - ps.Publisher().sendMessage('Update all slice') | |
367 | + Publisher.sendMessage('Update all slice') | |
368 | 368 | |
369 | 369 | |
370 | 370 | def OnChangeSliceMove(self, evt, obj): |
... | ... | @@ -816,11 +816,11 @@ class Viewer(wx.Panel): |
816 | 816 | coord = self.calcultate_scroll_position(position) |
817 | 817 | self.ScrollSlice(coord) |
818 | 818 | |
819 | - ps.Publisher().sendMessage('Update cross position', coord_cross) | |
820 | - ps.Publisher().sendMessage('Set ball reference position based on bound', | |
819 | + Publisher.sendMessage('Update cross position', coord_cross) | |
820 | + Publisher.sendMessage('Set ball reference position based on bound', | |
821 | 821 | coord_cross) |
822 | - ps.Publisher().sendMessage('Set camera in volume', coord_cross) | |
823 | - ps.Publisher().sendMessage('Render volume viewer') | |
822 | + Publisher.sendMessage('Set camera in volume', coord_cross) | |
823 | + Publisher.sendMessage('Render volume viewer') | |
824 | 824 | |
825 | 825 | self.interactor.Render() |
826 | 826 | |
... | ... | @@ -831,26 +831,26 @@ class Viewer(wx.Panel): |
831 | 831 | position = self.slice_data.actor.GetInput().FindPoint(x, y, z) |
832 | 832 | coord_cross = self.slice_data.actor.GetInput().GetPoint(position) |
833 | 833 | coord = self.calcultate_scroll_position(position) |
834 | - ps.Publisher().sendMessage('Update cross position', coord_cross) | |
834 | + Publisher.sendMessage('Update cross position', coord_cross) | |
835 | 835 | |
836 | 836 | self.ScrollSlice(coord) |
837 | 837 | self.interactor.Render() |
838 | 838 | |
839 | 839 | def ScrollSlice(self, coord): |
840 | 840 | if self.orientation == "AXIAL": |
841 | - ps.Publisher().sendMessage(('Set scroll position', 'SAGITAL'), | |
841 | + Publisher.sendMessage(('Set scroll position', 'SAGITAL'), | |
842 | 842 | coord[0]) |
843 | - ps.Publisher().sendMessage(('Set scroll position', 'CORONAL'), | |
843 | + Publisher.sendMessage(('Set scroll position', 'CORONAL'), | |
844 | 844 | coord[1]) |
845 | 845 | elif self.orientation == "SAGITAL": |
846 | - ps.Publisher().sendMessage(('Set scroll position', 'AXIAL'), | |
846 | + Publisher.sendMessage(('Set scroll position', 'AXIAL'), | |
847 | 847 | coord[2]) |
848 | - ps.Publisher().sendMessage(('Set scroll position', 'CORONAL'), | |
848 | + Publisher.sendMessage(('Set scroll position', 'CORONAL'), | |
849 | 849 | coord[1]) |
850 | 850 | elif self.orientation == "CORONAL": |
851 | - ps.Publisher().sendMessage(('Set scroll position', 'AXIAL'), | |
851 | + Publisher.sendMessage(('Set scroll position', 'AXIAL'), | |
852 | 852 | coord[2]) |
853 | - ps.Publisher().sendMessage(('Set scroll position', 'SAGITAL'), | |
853 | + Publisher.sendMessage(('Set scroll position', 'SAGITAL'), | |
854 | 854 | coord[0]) |
855 | 855 | |
856 | 856 | def OnZoomMoveRight(self, evt, obj): |
... | ... | @@ -952,61 +952,61 @@ class Viewer(wx.Panel): |
952 | 952 | return x, y, z |
953 | 953 | |
954 | 954 | def __bind_events(self): |
955 | - ps.Publisher().subscribe(self.LoadImagedata, | |
955 | + Publisher.subscribe(self.LoadImagedata, | |
956 | 956 | 'Load slice to viewer') |
957 | - ps.Publisher().subscribe(self.SetBrushColour, | |
957 | + Publisher.subscribe(self.SetBrushColour, | |
958 | 958 | 'Change mask colour') |
959 | - ps.Publisher().subscribe(self.UpdateRender, | |
959 | + Publisher.subscribe(self.UpdateRender, | |
960 | 960 | 'Update slice viewer') |
961 | - ps.Publisher().subscribe(self.ChangeSliceNumber, | |
961 | + Publisher.subscribe(self.ChangeSliceNumber, | |
962 | 962 | ('Set scroll position', |
963 | 963 | self.orientation)) |
964 | - ps.Publisher().subscribe(self.__update_cross_position, | |
964 | + Publisher.subscribe(self.__update_cross_position, | |
965 | 965 | 'Update cross position') |
966 | - ps.Publisher().subscribe(self.Navigation, | |
966 | + Publisher.subscribe(self.Navigation, | |
967 | 967 | 'Co-registered Points') |
968 | 968 | ### |
969 | - ps.Publisher().subscribe(self.ChangeBrushSize, | |
969 | + Publisher.subscribe(self.ChangeBrushSize, | |
970 | 970 | 'Set edition brush size') |
971 | - ps.Publisher().subscribe(self.ChangeBrushColour, | |
971 | + Publisher.subscribe(self.ChangeBrushColour, | |
972 | 972 | 'Add mask') |
973 | - ps.Publisher().subscribe(self.ChangeBrushActor, | |
973 | + Publisher.subscribe(self.ChangeBrushActor, | |
974 | 974 | 'Set brush format') |
975 | - ps.Publisher().subscribe(self.ChangeBrushOperation, | |
975 | + Publisher.subscribe(self.ChangeBrushOperation, | |
976 | 976 | 'Set edition operation') |
977 | 977 | |
978 | - ps.Publisher().subscribe(self.UpdateWindowLevelValue,\ | |
978 | + Publisher.subscribe(self.UpdateWindowLevelValue,\ | |
979 | 979 | 'Update window level value') |
980 | 980 | |
981 | - #ps.Publisher().subscribe(self.__set_cross_visibility,\ | |
981 | + #Publisher.subscribe(self.__set_cross_visibility,\ | |
982 | 982 | # 'Set cross visibility') |
983 | 983 | ### |
984 | - ps.Publisher().subscribe(self.__set_layout, | |
984 | + Publisher.subscribe(self.__set_layout, | |
985 | 985 | 'Set slice viewer layout') |
986 | 986 | |
987 | - ps.Publisher().subscribe(self.OnSetInteractorStyle, | |
987 | + Publisher.subscribe(self.OnSetInteractorStyle, | |
988 | 988 | 'Set slice interaction style') |
989 | - ps.Publisher().subscribe(self.OnCloseProject, 'Close project data') | |
989 | + Publisher.subscribe(self.OnCloseProject, 'Close project data') | |
990 | 990 | |
991 | 991 | ##### |
992 | - ps.Publisher().subscribe(self.OnShowText, | |
992 | + Publisher.subscribe(self.OnShowText, | |
993 | 993 | 'Show text actors on viewers') |
994 | - ps.Publisher().subscribe(self.OnHideText, | |
994 | + Publisher.subscribe(self.OnHideText, | |
995 | 995 | 'Hide text actors on viewers') |
996 | - ps.Publisher().subscribe(self.OnExportPicture,'Export picture to file') | |
997 | - ps.Publisher().subscribe(self.SetDefaultCursor, 'Set interactor default cursor') | |
996 | + Publisher.subscribe(self.OnExportPicture,'Export picture to file') | |
997 | + Publisher.subscribe(self.SetDefaultCursor, 'Set interactor default cursor') | |
998 | 998 | |
999 | - ps.Publisher().subscribe(self.AddActors, ('Add actors', ORIENTATIONS[self.orientation])) | |
1000 | - ps.Publisher().subscribe(self.RemoveActors, ('Remove actors', ORIENTATIONS[self.orientation])) | |
999 | + Publisher.subscribe(self.AddActors, 'Add actors ' + str(ORIENTATIONS[self.orientation])) | |
1000 | + Publisher.subscribe(self.RemoveActors, 'Remove actors ' + str(ORIENTATIONS[self.orientation])) | |
1001 | 1001 | |
1002 | - ps.Publisher().subscribe(self.ReloadActualSlice, 'Reload actual slice') | |
1002 | + Publisher.subscribe(self.ReloadActualSlice, 'Reload actual slice') | |
1003 | 1003 | |
1004 | 1004 | |
1005 | 1005 | def SetDefaultCursor(self, pusub_evt): |
1006 | 1006 | self.interactor.SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT)) |
1007 | 1007 | |
1008 | 1008 | def OnExportPicture(self, pubsub_evt): |
1009 | - ps.Publisher().sendMessage('Begin busy cursor') | |
1009 | + Publisher.sendMessage('Begin busy cursor') | |
1010 | 1010 | view_prop_list = [] |
1011 | 1011 | for slice_data in self.slice_data_list: |
1012 | 1012 | view_prop_list.append(slice_data.box_actor) |
... | ... | @@ -1055,7 +1055,7 @@ class Viewer(wx.Panel): |
1055 | 1055 | for actor in view_prop_list: |
1056 | 1056 | self.ren.AddViewProp(actor) |
1057 | 1057 | |
1058 | - ps.Publisher().sendMessage('End busy cursor') | |
1058 | + Publisher.sendMessage('End busy cursor') | |
1059 | 1059 | |
1060 | 1060 | def OnShowText(self, pubsub_evt): |
1061 | 1061 | self.ShowTextActors() |
... | ... | @@ -1084,7 +1084,7 @@ class Viewer(wx.Panel): |
1084 | 1084 | self.SetInteractorStyle(state) |
1085 | 1085 | |
1086 | 1086 | if (state != const.SLICE_STATE_EDITOR): |
1087 | - ps.Publisher().sendMessage('Set interactor default cursor') | |
1087 | + Publisher.sendMessage('Set interactor default cursor') | |
1088 | 1088 | |
1089 | 1089 | def ChangeBrushOperation(self, pubsub_evt): |
1090 | 1090 | self._brush_cursor_op = pubsub_evt.data |
... | ... | @@ -1342,7 +1342,7 @@ class Viewer(wx.Panel): |
1342 | 1342 | def UpdateSlice3D(self, pos): |
1343 | 1343 | original_orientation = project.Project().original_orientation |
1344 | 1344 | pos = self.scroll.GetThumbPosition() |
1345 | - ps.Publisher().sendMessage('Change slice from slice plane',\ | |
1345 | + Publisher.sendMessage('Change slice from slice plane',\ | |
1346 | 1346 | (self.orientation, pos)) |
1347 | 1347 | |
1348 | 1348 | def OnScrollBar(self, evt=None, update3D=True): |
... | ... | @@ -1354,8 +1354,8 @@ class Viewer(wx.Panel): |
1354 | 1354 | # Update other slice's cross according to the new focal point from |
1355 | 1355 | # the actual orientation. |
1356 | 1356 | focal_point = self.cross.GetFocalPoint() |
1357 | - ps.Publisher().sendMessage('Update cross position', focal_point) | |
1358 | - ps.Publisher().sendMessage('Update slice viewer') | |
1357 | + Publisher.sendMessage('Update cross position', focal_point) | |
1358 | + Publisher.sendMessage('Update slice viewer') | |
1359 | 1359 | else: |
1360 | 1360 | self.interactor.Render() |
1361 | 1361 | if evt: |
... | ... | @@ -1465,7 +1465,7 @@ class Viewer(wx.Panel): |
1465 | 1465 | print x, y, z |
1466 | 1466 | if self.pick.GetViewProp(): |
1467 | 1467 | self.render_to_add = slice_data.renderer |
1468 | - ps.Publisher().sendMessage("Add measurement point", | |
1468 | + Publisher.sendMessage("Add measurement point", | |
1469 | 1469 | ((x, y,z), const.LINEAR, ORIENTATIONS[self.orientation], |
1470 | 1470 | slice_number)) |
1471 | 1471 | self.interactor.Render() |
... | ... | @@ -1479,7 +1479,7 @@ class Viewer(wx.Panel): |
1479 | 1479 | x, y, z = self.pick.GetPickPosition() |
1480 | 1480 | if self.pick.GetViewProp(): |
1481 | 1481 | self.render_to_add = slice_data.renderer |
1482 | - ps.Publisher().sendMessage("Add measurement point", | |
1482 | + Publisher.sendMessage("Add measurement point", | |
1483 | 1483 | ((x, y,z), const.ANGULAR, ORIENTATIONS[self.orientation], |
1484 | 1484 | slice_number)) |
1485 | 1485 | self.interactor.Render() | ... | ... |
invesalius/data/viewer_volume.py
... | ... | @@ -26,7 +26,7 @@ import numpy |
26 | 26 | import wx |
27 | 27 | import vtk |
28 | 28 | from vtk.wx.wxVTKRenderWindowInteractor import wxVTKRenderWindowInteractor |
29 | -import wx.lib.pubsub as ps | |
29 | +from wx.lib.pubsub import pub as Publisher | |
30 | 30 | |
31 | 31 | import constants as const |
32 | 32 | import data.bases as bases |
... | ... | @@ -111,75 +111,74 @@ class Viewer(wx.Panel): |
111 | 111 | self.added_actor = 0 |
112 | 112 | |
113 | 113 | def __bind_events(self): |
114 | - ps.Publisher().subscribe(self.LoadActor, | |
114 | + Publisher.subscribe(self.LoadActor, | |
115 | 115 | 'Load surface actor into viewer') |
116 | - ps.Publisher().subscribe(self.RemoveActor, | |
116 | + Publisher.subscribe(self.RemoveActor, | |
117 | 117 | 'Remove surface actor from viewer') |
118 | - ps.Publisher().subscribe(self.UpdateRender, | |
118 | + Publisher.subscribe(self.UpdateRender, | |
119 | 119 | 'Render volume viewer') |
120 | - ps.Publisher().subscribe(self.ChangeBackgroundColour, | |
120 | + Publisher.subscribe(self.ChangeBackgroundColour, | |
121 | 121 | 'Change volume viewer background colour') |
122 | 122 | # Raycating - related |
123 | - ps.Publisher().subscribe(self.LoadVolume, | |
123 | + Publisher.subscribe(self.LoadVolume, | |
124 | 124 | 'Load volume into viewer') |
125 | - ps.Publisher().subscribe(self.OnSetWindowLevelText, | |
125 | + Publisher.subscribe(self.OnSetWindowLevelText, | |
126 | 126 | 'Set volume window and level text') |
127 | - ps.Publisher().subscribe(self.OnHideRaycasting, | |
127 | + Publisher.subscribe(self.OnHideRaycasting, | |
128 | 128 | 'Hide raycasting volume') |
129 | - ps.Publisher().subscribe(self.OnShowRaycasting, | |
129 | + Publisher.subscribe(self.OnShowRaycasting, | |
130 | 130 | 'Update raycasting preset') |
131 | 131 | ### |
132 | - ps.Publisher().subscribe(self.AppendActor,'AppendActor') | |
133 | - ps.Publisher().subscribe(self.SetWidgetInteractor, | |
132 | + Publisher.subscribe(self.AppendActor,'AppendActor') | |
133 | + Publisher.subscribe(self.SetWidgetInteractor, | |
134 | 134 | 'Set Widget Interactor') |
135 | - ps.Publisher().subscribe(self.OnSetViewAngle, | |
135 | + Publisher.subscribe(self.OnSetViewAngle, | |
136 | 136 | 'Set volume view angle') |
137 | 137 | |
138 | - ps.Publisher().subscribe(self.OnDisableBrightContrast, | |
139 | - ('Set interaction mode', | |
140 | - const.MODE_SLICE_EDITOR)) | |
138 | + Publisher.subscribe(self.OnDisableBrightContrast, | |
139 | + 'Set interaction mode '+ | |
140 | + str(const.MODE_SLICE_EDITOR)) | |
141 | 141 | |
142 | - ps.Publisher().subscribe(self.OnExportSurface, 'Export surface to file') | |
142 | + Publisher.subscribe(self.OnExportSurface, 'Export surface to file') | |
143 | 143 | |
144 | - ps.Publisher().subscribe(self.LoadSlicePlane, 'Load slice plane') | |
144 | + Publisher.subscribe(self.LoadSlicePlane, 'Load slice plane') | |
145 | 145 | |
146 | - ps.Publisher().subscribe(self.ResetCamClippingRange, 'Reset cam clipping range') | |
147 | - ps.Publisher().subscribe(self.SetVolumeCamera, 'Set camera in volume') | |
146 | + Publisher.subscribe(self.ResetCamClippingRange, 'Reset cam clipping range') | |
147 | + Publisher.subscribe(self.SetVolumeCamera, 'Set camera in volume') | |
148 | 148 | |
149 | - ps.Publisher().subscribe(self.OnEnableStyle, 'Enable style') | |
150 | - ps.Publisher().subscribe(self.OnDisableStyle, 'Disable style') | |
149 | + Publisher.subscribe(self.OnEnableStyle, 'Enable style') | |
150 | + Publisher.subscribe(self.OnDisableStyle, 'Disable style') | |
151 | 151 | |
152 | - ps.Publisher().subscribe(self.OnHideText, | |
152 | + Publisher.subscribe(self.OnHideText, | |
153 | 153 | 'Hide text actors on viewers') |
154 | 154 | |
155 | - ps.Publisher().subscribe(self.AddActors, ('Add actors', const.SURFACE)) | |
156 | - ps.Publisher().subscribe(self.RemoveActors, ('Remove actors', | |
157 | - const.SURFACE)) | |
155 | + Publisher.subscribe(self.AddActors, 'Add actors ' + str(const.SURFACE)) | |
156 | + Publisher.subscribe(self.RemoveActors, 'Remove actors ' + str(const.SURFACE)) | |
158 | 157 | |
159 | - ps.Publisher().subscribe(self.OnShowText, | |
158 | + Publisher.subscribe(self.OnShowText, | |
160 | 159 | 'Show text actors on viewers') |
161 | - ps.Publisher().subscribe(self.OnCloseProject, 'Close project data') | |
160 | + Publisher.subscribe(self.OnCloseProject, 'Close project data') | |
162 | 161 | |
163 | - ps.Publisher().subscribe(self.RemoveAllActor, 'Remove all volume actors') | |
162 | + Publisher.subscribe(self.RemoveAllActor, 'Remove all volume actors') | |
164 | 163 | |
165 | - ps.Publisher().subscribe(self.OnExportPicture,'Export picture to file') | |
164 | + Publisher.subscribe(self.OnExportPicture,'Export picture to file') | |
166 | 165 | |
167 | - ps.Publisher().subscribe(self.OnStartSeed,'Create surface by seeding - start') | |
168 | - ps.Publisher().subscribe(self.OnEndSeed,'Create surface by seeding - end') | |
166 | + Publisher.subscribe(self.OnStartSeed,'Create surface by seeding - start') | |
167 | + Publisher.subscribe(self.OnEndSeed,'Create surface by seeding - end') | |
169 | 168 | |
170 | - ps.Publisher().subscribe(self.ActivateBallReference, | |
169 | + Publisher.subscribe(self.ActivateBallReference, | |
171 | 170 | 'Activate ball reference') |
172 | - ps.Publisher().subscribe(self.DeactivateBallReference, | |
171 | + Publisher.subscribe(self.DeactivateBallReference, | |
173 | 172 | 'Deactivate ball reference') |
174 | - ps.Publisher().subscribe(self.SetBallReferencePosition, | |
173 | + Publisher.subscribe(self.SetBallReferencePosition, | |
175 | 174 | 'Set ball reference position') |
176 | - ps.Publisher().subscribe(self.SetBallReferencePositionBasedOnBound, | |
175 | + Publisher.subscribe(self.SetBallReferencePositionBasedOnBound, | |
177 | 176 | 'Set ball reference position based on bound') |
178 | - ps.Publisher().subscribe(self.SetStereoMode, 'Set stereo mode') | |
177 | + Publisher.subscribe(self.SetStereoMode, 'Set stereo mode') | |
179 | 178 | |
180 | - ps.Publisher().subscribe(self.Reposition3DPlane, 'Reposition 3D Plane') | |
179 | + Publisher.subscribe(self.Reposition3DPlane, 'Reposition 3D Plane') | |
181 | 180 | |
182 | - ps.Publisher().subscribe(self.RemoveVolume, 'Remove Volume') | |
181 | + Publisher.subscribe(self.RemoveVolume, 'Remove Volume') | |
183 | 182 | |
184 | 183 | |
185 | 184 | |
... | ... | @@ -249,11 +248,11 @@ class Viewer(wx.Panel): |
249 | 248 | self.seed_points = [] |
250 | 249 | |
251 | 250 | def OnEndSeed(self, pubsub_evt): |
252 | - ps.Publisher().sendMessage("Create surface from seeds", | |
251 | + Publisher.sendMessage("Create surface from seeds", | |
253 | 252 | self.seed_points) |
254 | 253 | |
255 | 254 | def OnExportPicture(self, pubsub_evt): |
256 | - ps.Publisher().sendMessage('Begin busy cursor') | |
255 | + Publisher.sendMessage('Begin busy cursor') | |
257 | 256 | id, filename, filetype = pubsub_evt.data |
258 | 257 | if id == const.VOLUME: |
259 | 258 | if filetype == const.FILETYPE_POV: |
... | ... | @@ -289,7 +288,7 @@ class Viewer(wx.Panel): |
289 | 288 | writer.SetInput(image) |
290 | 289 | writer.SetFileName(filename) |
291 | 290 | writer.Write() |
292 | - ps.Publisher().sendMessage('End busy cursor') | |
291 | + Publisher.sendMessage('End busy cursor') | |
293 | 292 | |
294 | 293 | |
295 | 294 | |
... | ... | @@ -301,7 +300,7 @@ class Viewer(wx.Panel): |
301 | 300 | self.slice_plane.Disable() |
302 | 301 | self.slice_plane.DeletePlanes() |
303 | 302 | del self.slice_plane |
304 | - ps.Publisher().sendMessage('Uncheck image plane menu') | |
303 | + Publisher.sendMessage('Uncheck image plane menu') | |
305 | 304 | self.mouse_pressed = 0 |
306 | 305 | self.on_wl = False |
307 | 306 | self.slice_plane = 0 |
... | ... | @@ -499,9 +498,9 @@ class Viewer(wx.Panel): |
499 | 498 | diff_x = mouse_x - self.last_x |
500 | 499 | diff_y = mouse_y - self.last_y |
501 | 500 | self.last_x, self.last_y = mouse_x, mouse_y |
502 | - ps.Publisher().sendMessage('Set raycasting relative window and level', | |
501 | + Publisher.sendMessage('Set raycasting relative window and level', | |
503 | 502 | (diff_x, diff_y)) |
504 | - ps.Publisher().sendMessage('Refresh raycasting widget points', None) | |
503 | + Publisher.sendMessage('Refresh raycasting widget points', None) | |
505 | 504 | self.interactor.Render() |
506 | 505 | |
507 | 506 | def OnWindowLevelClick(self, obj, evt): |
... | ... | @@ -655,7 +654,7 @@ class Viewer(wx.Panel): |
655 | 654 | def RemoveAllActor(self, pubsub_evt): |
656 | 655 | utils.debug("RemoveAllActor") |
657 | 656 | self.ren.RemoveAllProps() |
658 | - ps.Publisher().sendMessage('Render volume viewer') | |
657 | + Publisher.sendMessage('Render volume viewer') | |
659 | 658 | |
660 | 659 | |
661 | 660 | def LoadSlicePlane(self, pubsub_evt): |
... | ... | @@ -775,9 +774,9 @@ class Viewer(wx.Panel): |
775 | 774 | # m = self.measures[-1] |
776 | 775 | # m.AddPoint(x, y, z) |
777 | 776 | # if m.IsComplete(): |
778 | - # ps.Publisher().sendMessage("Add measure to list", | |
777 | + # Publisher.sendMessage("Add measure to list", | |
779 | 778 | # (u"3D", _(u"%.3f mm" % m.GetValue()))) |
780 | - ps.Publisher().sendMessage("Add measurement point", | |
779 | + Publisher.sendMessage("Add measurement point", | |
781 | 780 | ((x, y,z), const.LINEAR, const.SURFACE)) |
782 | 781 | self.interactor.Render() |
783 | 782 | |
... | ... | @@ -802,11 +801,11 @@ class Viewer(wx.Panel): |
802 | 801 | # location = u"3D" |
803 | 802 | # value = u"%.2f˚"% m.GetValue() |
804 | 803 | # msg = 'Update measurement info in GUI', |
805 | - # ps.Publisher().sendMessage(msg, | |
804 | + # Publisher.sendMessage(msg, | |
806 | 805 | # (index, name, colour, |
807 | 806 | # type_, location, |
808 | 807 | # value)) |
809 | - ps.Publisher().sendMessage("Add measurement point", | |
808 | + Publisher.sendMessage("Add measurement point", | |
810 | 809 | ((x, y,z), const.ANGULAR, const.SURFACE)) |
811 | 810 | self.interactor.Render() |
812 | 811 | |
... | ... | @@ -837,15 +836,15 @@ class SlicePlane: |
837 | 836 | self.__bind_evt() |
838 | 837 | |
839 | 838 | def __bind_evt(self): |
840 | - ps.Publisher().subscribe(self.Enable, 'Enable plane') | |
841 | - ps.Publisher().subscribe(self.Disable, 'Disable plane') | |
842 | - ps.Publisher().subscribe(self.ChangeSlice, 'Change slice from slice plane') | |
843 | - ps.Publisher().subscribe(self.UpdateAllSlice, 'Update all slice') | |
839 | + Publisher.subscribe(self.Enable, 'Enable plane') | |
840 | + Publisher.subscribe(self.Disable, 'Disable plane') | |
841 | + Publisher.subscribe(self.ChangeSlice, 'Change slice from slice plane') | |
842 | + Publisher.subscribe(self.UpdateAllSlice, 'Update all slice') | |
844 | 843 | |
845 | 844 | def Create(self): |
846 | 845 | plane_x = self.plane_x = vtk.vtkImagePlaneWidget() |
847 | 846 | plane_x.InteractionOff() |
848 | - ps.Publisher().sendMessage('Input Image in the widget', | |
847 | + Publisher.sendMessage('Input Image in the widget', | |
849 | 848 | (plane_x, 'SAGITAL')) |
850 | 849 | plane_x.SetPlaneOrientationToXAxes() |
851 | 850 | plane_x.TextureVisibilityOn() |
... | ... | @@ -857,7 +856,7 @@ class SlicePlane: |
857 | 856 | |
858 | 857 | plane_y = self.plane_y = vtk.vtkImagePlaneWidget() |
859 | 858 | plane_y.DisplayTextOff() |
860 | - ps.Publisher().sendMessage('Input Image in the widget', | |
859 | + Publisher.sendMessage('Input Image in the widget', | |
861 | 860 | (plane_y, 'CORONAL')) |
862 | 861 | plane_y.SetPlaneOrientationToYAxes() |
863 | 862 | plane_y.TextureVisibilityOn() |
... | ... | @@ -870,7 +869,7 @@ class SlicePlane: |
870 | 869 | |
871 | 870 | plane_z = self.plane_z = vtk.vtkImagePlaneWidget() |
872 | 871 | plane_z.InteractionOff() |
873 | - ps.Publisher().sendMessage('Input Image in the widget', | |
872 | + Publisher.sendMessage('Input Image in the widget', | |
874 | 873 | (plane_z, 'AXIAL')) |
875 | 874 | plane_z.SetPlaneOrientationToZAxes() |
876 | 875 | plane_z.TextureVisibilityOn() |
... | ... | @@ -900,9 +899,9 @@ class SlicePlane: |
900 | 899 | selected_prop2 = plane_y.GetSelectedPlaneProperty() |
901 | 900 | selected_prop2.SetColor(0, 1, 0) |
902 | 901 | |
903 | - ps.Publisher().sendMessage('Set Widget Interactor', plane_x) | |
904 | - ps.Publisher().sendMessage('Set Widget Interactor', plane_y) | |
905 | - ps.Publisher().sendMessage('Set Widget Interactor', plane_z) | |
902 | + Publisher.sendMessage('Set Widget Interactor', plane_x) | |
903 | + Publisher.sendMessage('Set Widget Interactor', plane_y) | |
904 | + Publisher.sendMessage('Set Widget Interactor', plane_z) | |
906 | 905 | |
907 | 906 | self.Render() |
908 | 907 | |
... | ... | @@ -916,13 +915,13 @@ class SlicePlane: |
916 | 915 | elif(label == "Sagital"): |
917 | 916 | self.plane_x.On() |
918 | 917 | |
919 | - ps.Publisher().sendMessage('Reposition 3D Plane', label) | |
918 | + Publisher.sendMessage('Reposition 3D Plane', label) | |
920 | 919 | |
921 | 920 | else: |
922 | 921 | self.plane_z.On() |
923 | 922 | self.plane_x.On() |
924 | 923 | self.plane_y.On() |
925 | - ps.Publisher().sendMessage('Set volume view angle', const.VOL_ISO) | |
924 | + Publisher.sendMessage('Set volume view angle', const.VOL_ISO) | |
926 | 925 | self.Render() |
927 | 926 | |
928 | 927 | def Disable(self, evt_pubsub=None): |
... | ... | @@ -942,25 +941,25 @@ class SlicePlane: |
942 | 941 | self.Render() |
943 | 942 | |
944 | 943 | def Render(self): |
945 | - ps.Publisher().sendMessage('Render volume viewer') | |
944 | + Publisher.sendMessage('Render volume viewer') | |
946 | 945 | |
947 | 946 | def ChangeSlice(self, pubsub_evt = None): |
948 | 947 | orientation, number = pubsub_evt.data |
949 | 948 | |
950 | 949 | if orientation == "CORONAL" and self.plane_y.GetEnabled(): |
951 | - ps.Publisher().sendMessage('Update slice 3D', (self.plane_y,orientation)) | |
950 | + Publisher.sendMessage('Update slice 3D', (self.plane_y,orientation)) | |
952 | 951 | self.Render() |
953 | 952 | elif orientation == "SAGITAL" and self.plane_x.GetEnabled(): |
954 | - ps.Publisher().sendMessage('Update slice 3D', (self.plane_x,orientation)) | |
953 | + Publisher.sendMessage('Update slice 3D', (self.plane_x,orientation)) | |
955 | 954 | self.Render() |
956 | 955 | elif orientation == 'AXIAL' and self.plane_z.GetEnabled() : |
957 | - ps.Publisher().sendMessage('Update slice 3D', (self.plane_z,orientation)) | |
956 | + Publisher.sendMessage('Update slice 3D', (self.plane_z,orientation)) | |
958 | 957 | self.Render() |
959 | 958 | |
960 | 959 | def UpdateAllSlice(self, pubsub_evt): |
961 | - ps.Publisher().sendMessage('Update slice 3D', (self.plane_y,"CORONAL")) | |
962 | - ps.Publisher().sendMessage('Update slice 3D', (self.plane_x,"SAGITAL")) | |
963 | - ps.Publisher().sendMessage('Update slice 3D', (self.plane_z,"AXIAL")) | |
960 | + Publisher.sendMessage('Update slice 3D', (self.plane_y,"CORONAL")) | |
961 | + Publisher.sendMessage('Update slice 3D', (self.plane_x,"SAGITAL")) | |
962 | + Publisher.sendMessage('Update slice 3D', (self.plane_z,"AXIAL")) | |
964 | 963 | |
965 | 964 | |
966 | 965 | def DeletePlanes(self): | ... | ... |
invesalius/data/volume.py
... | ... | @@ -22,7 +22,7 @@ import os |
22 | 22 | import numpy |
23 | 23 | import vtk |
24 | 24 | import wx |
25 | -import wx.lib.pubsub as ps | |
25 | +from wx.lib.pubsub import pub as Publisher | |
26 | 26 | |
27 | 27 | import constants as const |
28 | 28 | import project as prj |
... | ... | @@ -89,25 +89,25 @@ class Volume(): |
89 | 89 | self.__bind_events() |
90 | 90 | |
91 | 91 | def __bind_events(self): |
92 | - ps.Publisher().subscribe(self.OnHideVolume, | |
92 | + Publisher.subscribe(self.OnHideVolume, | |
93 | 93 | 'Hide raycasting volume') |
94 | - ps.Publisher().subscribe(self.OnUpdatePreset, | |
94 | + Publisher.subscribe(self.OnUpdatePreset, | |
95 | 95 | 'Update raycasting preset') |
96 | - ps.Publisher().subscribe(self.OnSetCurve, | |
96 | + Publisher.subscribe(self.OnSetCurve, | |
97 | 97 | 'Set raycasting curve') |
98 | - ps.Publisher().subscribe(self.OnSetWindowLevel, | |
98 | + Publisher.subscribe(self.OnSetWindowLevel, | |
99 | 99 | 'Set raycasting wwwl') |
100 | - ps.Publisher().subscribe(self.Refresh, | |
100 | + Publisher.subscribe(self.Refresh, | |
101 | 101 | 'Set raycasting refresh') |
102 | - ps.Publisher().subscribe(self.OnSetRelativeWindowLevel, | |
102 | + Publisher.subscribe(self.OnSetRelativeWindowLevel, | |
103 | 103 | 'Set raycasting relative window and level') |
104 | - ps.Publisher().subscribe(self.OnEnableTool, | |
104 | + Publisher.subscribe(self.OnEnableTool, | |
105 | 105 | 'Enable raycasting tool') |
106 | - ps.Publisher().subscribe(self.OnCloseProject, 'Close project data') | |
107 | - ps.Publisher().subscribe(self.ChangeBackgroundColour, | |
106 | + Publisher.subscribe(self.OnCloseProject, 'Close project data') | |
107 | + Publisher.subscribe(self.ChangeBackgroundColour, | |
108 | 108 | 'Change volume viewer background colour') |
109 | 109 | |
110 | - ps.Publisher().subscribe(self.ResetRayCasting, 'Reset Reaycasting') | |
110 | + Publisher.subscribe(self.ResetRayCasting, 'Reset Reaycasting') | |
111 | 111 | |
112 | 112 | def ResetRayCasting(self, pub_evt): |
113 | 113 | if self.exist: |
... | ... | @@ -121,7 +121,7 @@ class Volume(): |
121 | 121 | def CloseProject(self): |
122 | 122 | #if self.plane: |
123 | 123 | # self.plane = None |
124 | - # ps.Publisher().sendMessage('Remove surface actor from viewer', self.plane_actor) | |
124 | + # Publisher.sendMessage('Remove surface actor from viewer', self.plane_actor) | |
125 | 125 | if self.plane: |
126 | 126 | self.plane.DestroyObjs() |
127 | 127 | del self.plane |
... | ... | @@ -129,8 +129,8 @@ class Volume(): |
129 | 129 | |
130 | 130 | if self.exist: |
131 | 131 | self.exist = None |
132 | - ps.Publisher().sendMessage('Remove surface actor from viewer', self.volume) | |
133 | - ps.Publisher().sendMessage('Disable volume cut menu') | |
132 | + Publisher.sendMessage('Remove surface actor from viewer', self.volume) | |
133 | + Publisher.sendMessage('Disable volume cut menu') | |
134 | 134 | |
135 | 135 | def OnLoadVolume(self, pubsub_evt): |
136 | 136 | label = pubsub_evt.data |
... | ... | @@ -141,16 +141,16 @@ class Volume(): |
141 | 141 | self.volume.SetVisibility(0) |
142 | 142 | if (self.plane and self.plane_on): |
143 | 143 | self.plane.Disable() |
144 | - ps.Publisher().sendMessage('Render volume viewer') | |
144 | + Publisher.sendMessage('Render volume viewer') | |
145 | 145 | |
146 | 146 | def OnShowVolume(self, pubsub_evt = None): |
147 | 147 | if self.exist: |
148 | 148 | self.volume.SetVisibility(1) |
149 | 149 | if (self.plane and self.plane_on): |
150 | 150 | self.plane.Enable() |
151 | - ps.Publisher().sendMessage('Render volume viewer') | |
151 | + Publisher.sendMessage('Render volume viewer') | |
152 | 152 | else: |
153 | - ps.Publisher.sendMessage('Load raycasting preset', const.RAYCASTING_LABEL) | |
153 | + Publisher.sendMessage('Load raycasting preset', const.RAYCASTING_LABEL) | |
154 | 154 | self.LoadConfig() |
155 | 155 | self.LoadVolume() |
156 | 156 | self.exist = 1 |
... | ... | @@ -162,15 +162,15 @@ class Volume(): |
162 | 162 | if self.exist: |
163 | 163 | self.__load_preset() |
164 | 164 | self.volume.SetVisibility(1) |
165 | - #ps.Publisher().sendMessage('Render volume viewer') | |
165 | + #Publisher.sendMessage('Render volume viewer') | |
166 | 166 | else: |
167 | 167 | self.LoadVolume() |
168 | 168 | self.CalculateHistogram() |
169 | 169 | self.exist = 1 |
170 | 170 | |
171 | 171 | colour = self.GetBackgroundColour() |
172 | - ps.Publisher.sendMessage('Change volume viewer background colour', colour) | |
173 | - ps.Publisher.sendMessage('Change volume viewer gui colour', colour) | |
172 | + Publisher.sendMessage('Change volume viewer background colour', colour) | |
173 | + Publisher.sendMessage('Change volume viewer gui colour', colour) | |
174 | 174 | |
175 | 175 | def __load_preset_config(self): |
176 | 176 | self.config = prj.Project().raycasting_preset |
... | ... | @@ -203,14 +203,14 @@ class Volume(): |
203 | 203 | self.CalculateWWWL() |
204 | 204 | ww = self.ww |
205 | 205 | wl = self.wl |
206 | - ps.Publisher().sendMessage('Set volume window and level text', | |
206 | + Publisher.sendMessage('Set volume window and level text', | |
207 | 207 | (ww, wl)) |
208 | 208 | |
209 | 209 | def OnSetRelativeWindowLevel(self, pubsub_evt): |
210 | 210 | diff_wl, diff_ww = pubsub_evt.data |
211 | 211 | ww = self.ww + diff_ww |
212 | 212 | wl = self.wl + diff_wl |
213 | - ps.Publisher().sendMessage('Set volume window and level text', | |
213 | + Publisher.sendMessage('Set volume window and level text', | |
214 | 214 | (ww, wl)) |
215 | 215 | self.SetWWWL(ww, wl) |
216 | 216 | self.ww = ww |
... | ... | @@ -593,7 +593,7 @@ class Volume(): |
593 | 593 | |
594 | 594 | self.exist = 1 |
595 | 595 | |
596 | - ps.Publisher().sendMessage('Load volume into viewer', | |
596 | + Publisher.sendMessage('Load volume into viewer', | |
597 | 597 | (volume, colour, (self.ww, self.wl))) |
598 | 598 | |
599 | 599 | def OnEnableTool(self, pubsub_evt): |
... | ... | @@ -621,7 +621,7 @@ class Volume(): |
621 | 621 | accumulate.SetComponentOrigin(image.GetScalarRange()[0], 0, 0) |
622 | 622 | accumulate.Update() |
623 | 623 | n_image = numpy_support.vtk_to_numpy(accumulate.GetOutput().GetPointData().GetScalars()) |
624 | - ps.Publisher().sendMessage('Load histogram', (n_image, | |
624 | + Publisher.sendMessage('Load histogram', (n_image, | |
625 | 625 | image.GetScalarRange())) |
626 | 626 | |
627 | 627 | def TranslateScale(self, scale, value): |
... | ... | @@ -640,11 +640,11 @@ class CutPlane: |
640 | 640 | self.__bind_events() |
641 | 641 | |
642 | 642 | def __bind_events(self): |
643 | - ps.Publisher().subscribe(self.Reset, | |
643 | + Publisher.subscribe(self.Reset, | |
644 | 644 | 'Reset Cut Plane') |
645 | - ps.Publisher().subscribe(self.Enable, | |
645 | + Publisher.subscribe(self.Enable, | |
646 | 646 | 'Enable Cut Plane') |
647 | - ps.Publisher().subscribe(self.Disable, | |
647 | + Publisher.subscribe(self.Disable, | |
648 | 648 | 'Disable Cut Plane') |
649 | 649 | |
650 | 650 | def Create(self): |
... | ... | @@ -673,8 +673,8 @@ class CutPlane: |
673 | 673 | plane_actor.GetProperty().BackfaceCullingOn() |
674 | 674 | plane_actor.GetProperty().SetOpacity(0) |
675 | 675 | plane_widget.AddObserver("InteractionEvent", self.Update) |
676 | - ps.Publisher().sendMessage('AppendActor', self.plane_actor) | |
677 | - ps.Publisher().sendMessage('Set Widget Interactor', self.plane_widget) | |
676 | + Publisher.sendMessage('AppendActor', self.plane_actor) | |
677 | + Publisher.sendMessage('Set Widget Interactor', self.plane_widget) | |
678 | 678 | plane_actor.SetVisibility(1) |
679 | 679 | plane_widget.On() |
680 | 680 | self.plane = plane = vtk.vtkPlane() |
... | ... | @@ -697,19 +697,19 @@ class CutPlane: |
697 | 697 | self.plane_actor.VisibilityOn() |
698 | 698 | self.plane.SetNormal(plane_source.GetNormal()) |
699 | 699 | self.plane.SetOrigin(plane_source.GetOrigin()) |
700 | - ps.Publisher().sendMessage('Render volume viewer', None) | |
700 | + Publisher.sendMessage('Render volume viewer', None) | |
701 | 701 | |
702 | 702 | def Enable(self, evt_pubsub=None): |
703 | 703 | self.plane_widget.On() |
704 | 704 | self.plane_actor.VisibilityOn() |
705 | 705 | self.volume_mapper.AddClippingPlane(self.plane) |
706 | - ps.Publisher().sendMessage('Render volume viewer', None) | |
706 | + Publisher.sendMessage('Render volume viewer', None) | |
707 | 707 | |
708 | 708 | def Disable(self,evt_pubsub=None): |
709 | 709 | self.plane_widget.Off() |
710 | 710 | self.plane_actor.VisibilityOff() |
711 | 711 | self.volume_mapper.RemoveClippingPlane(self.plane) |
712 | - ps.Publisher().sendMessage('Render volume viewer', None) | |
712 | + Publisher.sendMessage('Render volume viewer', None) | |
713 | 713 | |
714 | 714 | def Reset(self, evt_pubsub=None): |
715 | 715 | plane_source = self.plane_source |
... | ... | @@ -721,10 +721,10 @@ class CutPlane: |
721 | 721 | self.plane_actor.VisibilityOn() |
722 | 722 | self.plane.SetNormal(self.normal) |
723 | 723 | self.plane.SetOrigin(self.origin) |
724 | - ps.Publisher().sendMessage('Render volume viewer', None) | |
724 | + Publisher.sendMessage('Render volume viewer', None) | |
725 | 725 | |
726 | 726 | def DestroyObjs(self): |
727 | - ps.Publisher().sendMessage('Remove surface actor from viewer', self.plane_actor) | |
727 | + Publisher.sendMessage('Remove surface actor from viewer', self.plane_actor) | |
728 | 728 | self.Disable() |
729 | 729 | del self.plane_widget |
730 | 730 | del self.plane_source | ... | ... |
invesalius/data/vtk_utils.py
... | ... | @@ -19,7 +19,7 @@ |
19 | 19 | import sys |
20 | 20 | |
21 | 21 | import vtk |
22 | -import wx.lib.pubsub as ps | |
22 | +from wx.lib.pubsub import pub as Publisher | |
23 | 23 | |
24 | 24 | import constants as const |
25 | 25 | from gui.dialogs import ProgressDialog |
... | ... | @@ -76,7 +76,7 @@ def ShowProgress(number_of_filters = 1, |
76 | 76 | progress[0] = progress[0] + ratio*difference |
77 | 77 | # Tell GUI to update progress status value |
78 | 78 | if (dialog_type == "GaugeProgress"): |
79 | - ps.Publisher().sendMessage('Update status in GUI', | |
79 | + Publisher.sendMessage('Update status in GUI', | |
80 | 80 | (progress[0], label)) |
81 | 81 | else: |
82 | 82 | if (progress[0] >= 99.999): | ... | ... |
invesalius/gui/data_notebook.py
... | ... | @@ -26,7 +26,7 @@ import wx |
26 | 26 | import wx.grid |
27 | 27 | import wx.lib.flatnotebook as fnb |
28 | 28 | import wx.lib.platebtn as pbtn |
29 | -import wx.lib.pubsub as ps | |
29 | +from wx.lib.pubsub import pub as Publisher | |
30 | 30 | |
31 | 31 | import constants as const |
32 | 32 | import gui.dialogs as dlg |
... | ... | @@ -76,15 +76,15 @@ class NotebookPanel(wx.Panel): |
76 | 76 | self.__bind_events() |
77 | 77 | |
78 | 78 | def __bind_events(self): |
79 | - ps.Publisher().subscribe(self._FoldSurface, | |
79 | + Publisher.subscribe(self._FoldSurface, | |
80 | 80 | 'Fold surface task') |
81 | - ps.Publisher().subscribe(self._FoldSurface, | |
81 | + Publisher.subscribe(self._FoldSurface, | |
82 | 82 | 'Fold surface page') |
83 | - ps.Publisher().subscribe(self._FoldMeasure, | |
83 | + Publisher.subscribe(self._FoldMeasure, | |
84 | 84 | 'Fold measure task') |
85 | - ps.Publisher().subscribe(self._FoldMask, | |
85 | + Publisher.subscribe(self._FoldMask, | |
86 | 86 | 'Fold mask task') |
87 | - ps.Publisher().subscribe(self._FoldMask, | |
87 | + Publisher.subscribe(self._FoldMask, | |
88 | 88 | 'Fold mask page') |
89 | 89 | |
90 | 90 | |
... | ... | @@ -205,9 +205,9 @@ class MeasureButtonControlPanel(wx.Panel): |
205 | 205 | def OnMenu(self, evt): |
206 | 206 | id = evt.GetId() |
207 | 207 | if id == const.MEASURE_LINEAR: |
208 | - ps.Publisher().sendMessage('Set tool linear measure') | |
208 | + Publisher.sendMessage('Set tool linear measure') | |
209 | 209 | else: |
210 | - ps.Publisher().sendMessage('Set tool angular measure') | |
210 | + Publisher.sendMessage('Set tool angular measure') | |
211 | 211 | |
212 | 212 | def OnRemove(self): |
213 | 213 | self.parent.listctrl.RemoveMeasurements() |
... | ... | @@ -215,7 +215,7 @@ class MeasureButtonControlPanel(wx.Panel): |
215 | 215 | def OnDuplicate(self): |
216 | 216 | selected_items = self.parent.listctrl.GetSelected() |
217 | 217 | if selected_items: |
218 | - ps.Publisher().sendMessage('Duplicate measurement', selected_items) | |
218 | + Publisher.sendMessage('Duplicate measurement', selected_items) | |
219 | 219 | else: |
220 | 220 | dlg.MaskSelectionRequiredForDuplication() |
221 | 221 | |
... | ... | @@ -315,7 +315,7 @@ class ButtonControlPanel(wx.Panel): |
315 | 315 | if ok: |
316 | 316 | mask_name, thresh, colour = dialog.GetValue() |
317 | 317 | if mask_name: |
318 | - ps.Publisher().sendMessage('Create new mask', | |
318 | + Publisher.sendMessage('Create new mask', | |
319 | 319 | (mask_name, thresh, colour)) |
320 | 320 | |
321 | 321 | def OnRemove(self): |
... | ... | @@ -324,7 +324,7 @@ class ButtonControlPanel(wx.Panel): |
324 | 324 | def OnDuplicate(self): |
325 | 325 | selected_items = self.parent.listctrl.GetSelected() |
326 | 326 | if selected_items: |
327 | - ps.Publisher().sendMessage('Duplicate masks', selected_items) | |
327 | + Publisher.sendMessage('Duplicate masks', selected_items) | |
328 | 328 | else: |
329 | 329 | dlg.MaskSelectionRequiredForDuplication() |
330 | 330 | |
... | ... | @@ -353,14 +353,14 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): |
353 | 353 | |
354 | 354 | |
355 | 355 | def __bind_events(self): |
356 | - ps.Publisher().subscribe(self.AddMask, 'Add mask') | |
357 | - ps.Publisher().subscribe(self.EditMaskThreshold, | |
356 | + Publisher.subscribe(self.AddMask, 'Add mask') | |
357 | + Publisher.subscribe(self.EditMaskThreshold, | |
358 | 358 | 'Set mask threshold in notebook') |
359 | - ps.Publisher().subscribe(self.EditMaskColour, | |
359 | + Publisher.subscribe(self.EditMaskColour, | |
360 | 360 | 'Change mask colour in notebook') |
361 | 361 | |
362 | - ps.Publisher().subscribe(self.OnChangeCurrentMask, 'Change mask selected') | |
363 | - ps.Publisher().subscribe(self.OnCloseProject, 'Close project data') | |
362 | + Publisher.subscribe(self.OnChangeCurrentMask, 'Change mask selected') | |
363 | + Publisher.subscribe(self.OnCloseProject, 'Close project data') | |
364 | 364 | |
365 | 365 | def OnKeyEvent(self, event): |
366 | 366 | keycode = event.GetKeyCode() |
... | ... | @@ -377,7 +377,7 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): |
377 | 377 | selected_items = self.GetSelected() |
378 | 378 | |
379 | 379 | if selected_items: |
380 | - ps.Publisher().sendMessage('Remove masks', selected_items) | |
380 | + Publisher.sendMessage('Remove masks', selected_items) | |
381 | 381 | else: |
382 | 382 | dlg.MaskSelectionRequiredForRemoval() |
383 | 383 | return |
... | ... | @@ -400,8 +400,8 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): |
400 | 400 | if new_dict: |
401 | 401 | if index == self.current_index: |
402 | 402 | self.SetItemImage(0, 1) |
403 | - ps.Publisher().sendMessage('Show mask', (0, 1)) | |
404 | - ps.Publisher().sendMessage('Change mask selected', 0) | |
403 | + Publisher.sendMessage('Show mask', (0, 1)) | |
404 | + Publisher.sendMessage('Change mask selected', 0) | |
405 | 405 | for key in new_dict: |
406 | 406 | if key: |
407 | 407 | self.SetItemImage(key, 0) |
... | ... | @@ -457,7 +457,7 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): |
457 | 457 | self.image_gray = Image.open("../icons/object_colour.jpg") |
458 | 458 | |
459 | 459 | def OnEditLabel(self, evt): |
460 | - ps.Publisher().sendMessage('Change mask name', | |
460 | + Publisher.sendMessage('Change mask name', | |
461 | 461 | (evt.GetIndex(), evt.GetLabel())) |
462 | 462 | evt.Skip() |
463 | 463 | |
... | ... | @@ -469,9 +469,9 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): |
469 | 469 | for key in self.mask_list_index.keys(): |
470 | 470 | if key != index: |
471 | 471 | self.SetItemImage(key, 0) |
472 | - ps.Publisher().sendMessage('Change mask selected',index) | |
472 | + Publisher.sendMessage('Change mask selected',index) | |
473 | 473 | self.current_index = index |
474 | - ps.Publisher().sendMessage('Show mask', (index, flag)) | |
474 | + Publisher.sendMessage('Show mask', (index, flag)) | |
475 | 475 | |
476 | 476 | def CreateColourBitmap(self, colour): |
477 | 477 | """ |
... | ... | @@ -645,7 +645,7 @@ class SurfaceButtonControlPanel(wx.Panel): |
645 | 645 | fill_holes, |
646 | 646 | keep_largest] |
647 | 647 | |
648 | - ps.Publisher().sendMessage('Create surface', surface_data) | |
648 | + Publisher.sendMessage('Create surface', surface_data) | |
649 | 649 | |
650 | 650 | def OnRemove(self): |
651 | 651 | self.parent.listctrl.RemoveSurfaces() |
... | ... | @@ -654,7 +654,7 @@ class SurfaceButtonControlPanel(wx.Panel): |
654 | 654 | def OnDuplicate(self): |
655 | 655 | selected_items = self.parent.listctrl.GetSelected() |
656 | 656 | if selected_items: |
657 | - ps.Publisher().sendMessage('Duplicate surfaces', selected_items) | |
657 | + Publisher.sendMessage('Duplicate surfaces', selected_items) | |
658 | 658 | else: |
659 | 659 | dlg.SurfaceSelectionRequiredForDuplication() |
660 | 660 | |
... | ... | @@ -679,17 +679,17 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): |
679 | 679 | self.surface_bmp_idx_to_name = {} |
680 | 680 | |
681 | 681 | def __init_evt(self): |
682 | - ps.Publisher().subscribe(self.AddSurface, | |
682 | + Publisher.subscribe(self.AddSurface, | |
683 | 683 | 'Update surface info in GUI') |
684 | - ps.Publisher().subscribe(self.EditSurfaceTransparency, | |
684 | + Publisher.subscribe(self.EditSurfaceTransparency, | |
685 | 685 | 'Set surface transparency') |
686 | - ps.Publisher().subscribe(self.EditSurfaceColour, | |
686 | + Publisher.subscribe(self.EditSurfaceColour, | |
687 | 687 | 'Set surface colour') |
688 | - ps.Publisher().subscribe(self.OnCloseProject, 'Close project data') | |
689 | - ps.Publisher().subscribe(self.OnHideSurface, 'Hide surface items') | |
688 | + Publisher.subscribe(self.OnCloseProject, 'Close project data') | |
689 | + Publisher.subscribe(self.OnHideSurface, 'Hide surface items') | |
690 | 690 | |
691 | - ps.Publisher().subscribe(self.OnShowSingle, 'Show single surface') | |
692 | - ps.Publisher().subscribe(self.OnShowMultiple, 'Show multiple surfaces') | |
691 | + Publisher.subscribe(self.OnShowSingle, 'Show single surface') | |
692 | + Publisher.subscribe(self.OnShowMultiple, 'Show multiple surfaces') | |
693 | 693 | |
694 | 694 | def __bind_events_wx(self): |
695 | 695 | self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated) |
... | ... | @@ -734,7 +734,7 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): |
734 | 734 | old_dict = new_dict |
735 | 735 | self.surface_list_index = new_dict |
736 | 736 | |
737 | - ps.Publisher().sendMessage('Remove surfaces', selected_items) | |
737 | + Publisher.sendMessage('Remove surfaces', selected_items) | |
738 | 738 | else: |
739 | 739 | dlg.SurfaceSelectionRequiredForRemoval() |
740 | 740 | |
... | ... | @@ -750,7 +750,7 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): |
750 | 750 | # things will stop working, e.g.: OnCheckItem |
751 | 751 | |
752 | 752 | last_surface_index = evt.m_itemIndex |
753 | - ps.Publisher().sendMessage('Change surface selected', | |
753 | + Publisher.sendMessage('Change surface selected', | |
754 | 754 | last_surface_index) |
755 | 755 | evt.Skip() |
756 | 756 | |
... | ... | @@ -801,7 +801,7 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): |
801 | 801 | |
802 | 802 | |
803 | 803 | def OnEditLabel(self, evt): |
804 | - ps.Publisher().sendMessage('Change surface name', (evt.GetIndex(), evt.GetLabel())) | |
804 | + Publisher.sendMessage('Change surface name', (evt.GetIndex(), evt.GetLabel())) | |
805 | 805 | evt.Skip() |
806 | 806 | |
807 | 807 | def OnItemActivated(self, evt): |
... | ... | @@ -810,17 +810,17 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): |
810 | 810 | |
811 | 811 | |
812 | 812 | def OnCheckItem(self, index, flag): |
813 | - ps.Publisher().sendMessage('Show surface', (index, flag)) | |
813 | + Publisher.sendMessage('Show surface', (index, flag)) | |
814 | 814 | |
815 | 815 | def OnShowSingle(self, pubsub_evt): |
816 | 816 | index, visibility = pubsub_evt.data |
817 | 817 | for key in self.surface_list_index.keys(): |
818 | 818 | if key != index: |
819 | 819 | self.SetItemImage(key, not visibility) |
820 | - ps.Publisher().sendMessage('Show surface', | |
820 | + Publisher.sendMessage('Show surface', | |
821 | 821 | (key, not visibility)) |
822 | 822 | self.SetItemImage(index, visibility) |
823 | - ps.Publisher().sendMessage('Show surface', | |
823 | + Publisher.sendMessage('Show surface', | |
824 | 824 | (index, visibility)) |
825 | 825 | |
826 | 826 | def OnShowMultiple(self, pubsub_evt): |
... | ... | @@ -828,11 +828,11 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): |
828 | 828 | for key in self.surface_list_index.keys(): |
829 | 829 | if key not in index_list: |
830 | 830 | self.SetItemImage(key, not visibility) |
831 | - ps.Publisher().sendMessage('Show surface', | |
831 | + Publisher.sendMessage('Show surface', | |
832 | 832 | (key, not visibility)) |
833 | 833 | for index in index_list: |
834 | 834 | self.SetItemImage(index, visibility) |
835 | - ps.Publisher().sendMessage('Show surface', | |
835 | + Publisher.sendMessage('Show surface', | |
836 | 836 | (index, visibility)) |
837 | 837 | |
838 | 838 | def AddSurface(self, pubsub_evt): |
... | ... | @@ -935,14 +935,14 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): |
935 | 935 | self._bmp_idx_to_name = {} |
936 | 936 | |
937 | 937 | def __init_evt(self): |
938 | - ps.Publisher().subscribe(self.AddItem_, | |
938 | + Publisher.subscribe(self.AddItem_, | |
939 | 939 | 'Update measurement info in GUI') |
940 | - ps.Publisher().subscribe(self.EditItemColour, | |
940 | + Publisher.subscribe(self.EditItemColour, | |
941 | 941 | 'Set measurement colour') |
942 | - ps.Publisher().subscribe(self.OnCloseProject, 'Close project data') | |
943 | - ps.Publisher().subscribe(self.OnShowSingle, 'Show single measurement') | |
944 | - ps.Publisher().subscribe(self.OnShowMultiple, 'Show multiple measurements') | |
945 | - ps.Publisher().subscribe(self.OnLoadData, 'Load measurement dict') | |
942 | + Publisher.subscribe(self.OnCloseProject, 'Close project data') | |
943 | + Publisher.subscribe(self.OnShowSingle, 'Show single measurement') | |
944 | + Publisher.subscribe(self.OnShowMultiple, 'Show multiple measurements') | |
945 | + Publisher.subscribe(self.OnLoadData, 'Load measurement dict') | |
946 | 946 | |
947 | 947 | def __bind_events_wx(self): |
948 | 948 | self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated) |
... | ... | @@ -980,7 +980,7 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): |
980 | 980 | new_dict[i-1] = old_dict[i] |
981 | 981 | old_dict = new_dict |
982 | 982 | self._list_index = new_dict |
983 | - ps.Publisher().sendMessage('Remove measurements', selected_items) | |
983 | + Publisher.sendMessage('Remove measurements', selected_items) | |
984 | 984 | else: |
985 | 985 | dlg.MeasureSelectionRequiredForRemoval() |
986 | 986 | |
... | ... | @@ -996,7 +996,7 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): |
996 | 996 | # things will stop working, e.g.: OnCheckItem |
997 | 997 | |
998 | 998 | last_index = evt.m_itemIndex |
999 | - ps.Publisher().sendMessage('Change measurement selected', | |
999 | + Publisher.sendMessage('Change measurement selected', | |
1000 | 1000 | last_index) |
1001 | 1001 | evt.Skip() |
1002 | 1002 | |
... | ... | @@ -1049,7 +1049,7 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): |
1049 | 1049 | |
1050 | 1050 | |
1051 | 1051 | def OnEditLabel(self, evt): |
1052 | - ps.Publisher().sendMessage('Change measurement name', (evt.GetIndex(), evt.GetLabel())) | |
1052 | + Publisher.sendMessage('Change measurement name', (evt.GetIndex(), evt.GetLabel())) | |
1053 | 1053 | evt.Skip() |
1054 | 1054 | |
1055 | 1055 | def OnItemActivated(self, evt): |
... | ... | @@ -1058,17 +1058,17 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): |
1058 | 1058 | |
1059 | 1059 | |
1060 | 1060 | def OnCheckItem(self, index, flag): |
1061 | - ps.Publisher().sendMessage('Show measurement', (index, flag)) | |
1061 | + Publisher.sendMessage('Show measurement', (index, flag)) | |
1062 | 1062 | |
1063 | 1063 | def OnShowSingle(self, pubsub_evt): |
1064 | 1064 | index, visibility = pubsub_evt.data |
1065 | 1065 | for key in self._list_index.keys(): |
1066 | 1066 | if key != index: |
1067 | 1067 | self.SetItemImage(key, not visibility) |
1068 | - ps.Publisher().sendMessage('Show measurement', | |
1068 | + Publisher.sendMessage('Show measurement', | |
1069 | 1069 | (key, not visibility)) |
1070 | 1070 | self.SetItemImage(index, visibility) |
1071 | - ps.Publisher().sendMessage('Show measurement', | |
1071 | + Publisher.sendMessage('Show measurement', | |
1072 | 1072 | (index, visibility)) |
1073 | 1073 | |
1074 | 1074 | def OnShowMultiple(self, pubsub_evt): |
... | ... | @@ -1076,11 +1076,11 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): |
1076 | 1076 | for key in self._list_index.keys(): |
1077 | 1077 | if key not in index_list: |
1078 | 1078 | self.SetItemImage(key, not visibility) |
1079 | - ps.Publisher().sendMessage('Show measurement', | |
1079 | + Publisher.sendMessage('Show measurement', | |
1080 | 1080 | (key, not visibility)) |
1081 | 1081 | for index in index_list: |
1082 | 1082 | self.SetItemImage(index, visibility) |
1083 | - ps.Publisher().sendMessage('Show measurement', | |
1083 | + Publisher.sendMessage('Show measurement', | |
1084 | 1084 | (index, visibility)) |
1085 | 1085 | |
1086 | 1086 | def OnLoadData(self, pubsub_evt): | ... | ... |
invesalius/gui/default_tasks.py
... | ... | @@ -19,7 +19,7 @@ |
19 | 19 | |
20 | 20 | import wx |
21 | 21 | import wx.lib.foldpanelbar as fpb |
22 | -import wx.lib.pubsub as ps | |
22 | +from wx.lib.pubsub import pub as Publisher | |
23 | 23 | |
24 | 24 | import constants as const |
25 | 25 | import data_notebook as nb |
... | ... | @@ -139,7 +139,7 @@ class LowerTaskPanel(wx.Panel): |
139 | 139 | col = style.GetFirstColour() |
140 | 140 | self.enable_items.append(item) |
141 | 141 | |
142 | - fold_panel.AddFoldPanelWindow(item, nb.NotebookPanel(item), Spacing= 0, | |
142 | + fold_panel.AddFoldPanelWindow(item, nb.NotebookPanel(item), #Spacing= 0, | |
143 | 143 | leftSpacing=0, rightSpacing=0) |
144 | 144 | fold_panel.Expand(fold_panel.GetFoldPanel(0)) |
145 | 145 | |
... | ... | @@ -161,7 +161,7 @@ class LowerTaskPanel(wx.Panel): |
161 | 161 | |
162 | 162 | |
163 | 163 | def __bind_events(self): |
164 | - ps.Publisher().subscribe(self.OnEnableState, "Enable state project") | |
164 | + Publisher.subscribe(self.OnEnableState, "Enable state project") | |
165 | 165 | |
166 | 166 | def OnEnableState(self, pubsub_evt): |
167 | 167 | state = pubsub_evt.data |
... | ... | @@ -229,7 +229,7 @@ class UpperTaskPanel(wx.Panel): |
229 | 229 | # Add panel to FoldPanel |
230 | 230 | fold_panel.AddFoldPanelWindow(item, |
231 | 231 | panel(item), |
232 | - Spacing= 0, | |
232 | + #Spacing= 0, | |
233 | 233 | leftSpacing=0, |
234 | 234 | rightSpacing=0) |
235 | 235 | |
... | ... | @@ -254,10 +254,10 @@ class UpperTaskPanel(wx.Panel): |
254 | 254 | |
255 | 255 | def __bind_events(self): |
256 | 256 | self.fold_panel.Bind(fpb.EVT_CAPTIONBAR, self.OnFoldPressCaption) |
257 | - ps.Publisher().subscribe(self.OnEnableState, "Enable state project") | |
258 | - ps.Publisher().subscribe(self.OnOverwrite, 'Create surface from index') | |
259 | - ps.Publisher().subscribe(self.OnFoldSurface, 'Fold surface task') | |
260 | - ps.Publisher().subscribe(self.OnFoldExport, 'Fold export task') | |
257 | + Publisher.subscribe(self.OnEnableState, "Enable state project") | |
258 | + Publisher.subscribe(self.OnOverwrite, 'Create surface from index') | |
259 | + Publisher.subscribe(self.OnFoldSurface, 'Fold surface task') | |
260 | + Publisher.subscribe(self.OnFoldExport, 'Fold export task') | |
261 | 261 | |
262 | 262 | def OnOverwrite(self, pubsub_evt): |
263 | 263 | self.overwrite = pubsub_evt.data[1] |
... | ... | @@ -291,12 +291,12 @@ class UpperTaskPanel(wx.Panel): |
291 | 291 | closed = evt.GetFoldStatus() |
292 | 292 | |
293 | 293 | if id == self.__id_slice: |
294 | - ps.Publisher().sendMessage('Retrieve task slice style') | |
295 | - ps.Publisher().sendMessage('Fold mask page') | |
294 | + Publisher.sendMessage('Retrieve task slice style') | |
295 | + Publisher.sendMessage('Fold mask page') | |
296 | 296 | elif id == self.__id_surface: |
297 | - ps.Publisher().sendMessage('Fold surface page') | |
297 | + Publisher.sendMessage('Fold surface page') | |
298 | 298 | else: |
299 | - ps.Publisher().sendMessage('Disable task slice style') | |
299 | + Publisher.sendMessage('Disable task slice style') | |
300 | 300 | |
301 | 301 | |
302 | 302 | evt.Skip() | ... | ... |
invesalius/gui/default_viewers.py
... | ... | @@ -20,7 +20,7 @@ import sys |
20 | 20 | |
21 | 21 | import wx |
22 | 22 | import wx.lib.agw.fourwaysplitter as fws |
23 | -import wx.lib.pubsub as ps | |
23 | +from wx.lib.pubsub import pub as Publisher | |
24 | 24 | |
25 | 25 | import data.viewer_slice as slice_viewer |
26 | 26 | import data.viewer_volume as volume_viewer |
... | ... | @@ -123,11 +123,11 @@ class Panel(wx.Panel): |
123 | 123 | |
124 | 124 | def OnMaximize(self, evt): |
125 | 125 | if evt.GetPane().name == self.s4.name: |
126 | - ps.Publisher().sendMessage('Show raycasting widget', None) | |
126 | + Publisher.sendMessage('Show raycasting widget', None) | |
127 | 127 | |
128 | 128 | def OnRestore(self, evt): |
129 | 129 | if evt.GetPane().name == self.s4.name: |
130 | - ps.Publisher().sendMessage('Hide raycasting widget', None) | |
130 | + Publisher.sendMessage('Hide raycasting widget', None) | |
131 | 131 | |
132 | 132 | def __init_four_way_splitter(self): |
133 | 133 | |
... | ... | @@ -233,20 +233,20 @@ class VolumeInteraction(wx.Panel): |
233 | 233 | #self.Bind(wx.EVT_MAXIMIZE, self.OnMaximize) |
234 | 234 | |
235 | 235 | def __bind_events(self): |
236 | - ps.Publisher().subscribe(self.ShowRaycastingWidget, | |
236 | + Publisher.subscribe(self.ShowRaycastingWidget, | |
237 | 237 | 'Show raycasting widget') |
238 | - ps.Publisher().subscribe(self.HideRaycastingWidget, | |
238 | + Publisher.subscribe(self.HideRaycastingWidget, | |
239 | 239 | 'Hide raycasting widget') |
240 | - ps.Publisher().subscribe(self.OnSetRaycastPreset, | |
240 | + Publisher.subscribe(self.OnSetRaycastPreset, | |
241 | 241 | 'Update raycasting preset') |
242 | - ps.Publisher().subscribe(self.RefreshPoints, | |
242 | + Publisher.subscribe(self.RefreshPoints, | |
243 | 243 | 'Refresh raycasting widget points') |
244 | - ps.Publisher().subscribe(self.LoadHistogram, | |
244 | + Publisher.subscribe(self.LoadHistogram, | |
245 | 245 | 'Load histogram') |
246 | 246 | |
247 | 247 | def __update_curve_wwwl_text(self, curve): |
248 | 248 | ww, wl = self.clut_raycasting.GetCurveWWWl(curve) |
249 | - ps.Publisher().sendMessage('Set raycasting wwwl', (ww, wl, curve)) | |
249 | + Publisher.sendMessage('Set raycasting wwwl', (ww, wl, curve)) | |
250 | 250 | |
251 | 251 | def ShowRaycastingWidget(self, evt_pubsub=None): |
252 | 252 | self.can_show_raycasting_widget = 1 |
... | ... | @@ -262,18 +262,18 @@ class VolumeInteraction(wx.Panel): |
262 | 262 | self.aui_manager.Update() |
263 | 263 | |
264 | 264 | def OnPointChanged(self, evt): |
265 | - ps.Publisher.sendMessage('Set raycasting refresh', None) | |
266 | - ps.Publisher.sendMessage('Set raycasting curve', evt.GetCurve()) | |
267 | - ps.Publisher().sendMessage('Render volume viewer') | |
265 | + Publisher.sendMessage('Set raycasting refresh', None) | |
266 | + Publisher.sendMessage('Set raycasting curve', evt.GetCurve()) | |
267 | + Publisher.sendMessage('Render volume viewer') | |
268 | 268 | |
269 | 269 | def OnCurveSelected(self, evt): |
270 | - ps.Publisher.sendMessage('Set raycasting curve', evt.GetCurve()) | |
271 | - ps.Publisher().sendMessage('Render volume viewer') | |
270 | + Publisher.sendMessage('Set raycasting curve', evt.GetCurve()) | |
271 | + Publisher.sendMessage('Render volume viewer') | |
272 | 272 | |
273 | 273 | def OnChangeCurveWL(self, evt): |
274 | 274 | curve = evt.GetCurve() |
275 | 275 | self.__update_curve_wwwl_text(curve) |
276 | - ps.Publisher().sendMessage('Render volume viewer') | |
276 | + Publisher.sendMessage('Render volume viewer') | |
277 | 277 | |
278 | 278 | def OnSetRaycastPreset(self, evt_pubsub): |
279 | 279 | preset = project.Project().raycasting_preset |
... | ... | @@ -400,11 +400,11 @@ class VolumeToolPanel(wx.Panel): |
400 | 400 | self.__bind_events_wx() |
401 | 401 | |
402 | 402 | def __bind_events(self): |
403 | - ps.Publisher().subscribe(self.ChangeButtonColour, | |
403 | + Publisher.subscribe(self.ChangeButtonColour, | |
404 | 404 | 'Change volume viewer gui colour') |
405 | - ps.Publisher().subscribe(self.DisablePreset, 'Close project data') | |
406 | - ps.Publisher().subscribe(self.Uncheck, 'Uncheck image plane menu') | |
407 | - ps.Publisher().subscribe(self.DisableVolumeCutMenu, 'Disable volume cut menu') | |
405 | + Publisher.subscribe(self.DisablePreset, 'Close project data') | |
406 | + Publisher.subscribe(self.Uncheck, 'Uncheck image plane menu') | |
407 | + Publisher.subscribe(self.DisableVolumeCutMenu, 'Disable volume cut menu') | |
408 | 408 | |
409 | 409 | def DisablePreset(self, pubsub_evt): |
410 | 410 | self.off_item.Check(1) |
... | ... | @@ -434,7 +434,7 @@ class VolumeToolPanel(wx.Panel): |
434 | 434 | d = wx.TextEntryDialog(self, _("Preset name")) |
435 | 435 | if d.ShowModal() == wx.ID_OK: |
436 | 436 | preset_name = d.GetValue() |
437 | - ps.Publisher().sendMessage(_("Save raycasting preset"), | |
437 | + Publisher.sendMessage(_("Save raycasting preset"), | |
438 | 438 | preset_name) |
439 | 439 | |
440 | 440 | def __init_menus(self, pubsub_evt=None): |
... | ... | @@ -541,14 +541,14 @@ class VolumeToolPanel(wx.Panel): |
541 | 541 | label = item.GetLabel() |
542 | 542 | |
543 | 543 | if not (checked): |
544 | - ps.Publisher().sendMessage('Disable plane', label) | |
544 | + Publisher.sendMessage('Disable plane', label) | |
545 | 545 | else: |
546 | - ps.Publisher().sendMessage('Enable plane', label) | |
546 | + Publisher.sendMessage('Enable plane', label) | |
547 | 547 | |
548 | 548 | def OnMenuStereo(self, evt): |
549 | 549 | id = evt.GetId() |
550 | 550 | mode = ID_TO_STEREO_NAME[id] |
551 | - ps.Publisher().sendMessage('Set stereo mode', mode) | |
551 | + Publisher.sendMessage('Set stereo mode', mode) | |
552 | 552 | |
553 | 553 | |
554 | 554 | def Uncheck(self, pubsub_evt): |
... | ... | @@ -566,7 +566,7 @@ class VolumeToolPanel(wx.Panel): |
566 | 566 | if id in ID_TO_NAME.keys(): |
567 | 567 | # Raycassting type was selected |
568 | 568 | name = ID_TO_NAME[id] |
569 | - ps.Publisher().sendMessage('Load raycasting preset', | |
569 | + Publisher.sendMessage('Load raycasting preset', | |
570 | 570 | ID_TO_NAME[id]) |
571 | 571 | # Enable or disable tools |
572 | 572 | if name != const.RAYCASTING_OFF_LABEL: |
... | ... | @@ -583,12 +583,12 @@ class VolumeToolPanel(wx.Panel): |
583 | 583 | # if i is not item: |
584 | 584 | # i.Check(0) |
585 | 585 | if not TOOL_STATE[id]: |
586 | - ps.Publisher().sendMessage('Enable raycasting tool', | |
586 | + Publisher.sendMessage('Enable raycasting tool', | |
587 | 587 | [ID_TO_TOOL[id],1]) |
588 | 588 | TOOL_STATE[id] = True |
589 | 589 | item.Check(1) |
590 | 590 | else: |
591 | - ps.Publisher().sendMessage('Enable raycasting tool', | |
591 | + Publisher.sendMessage('Enable raycasting tool', | |
592 | 592 | [ID_TO_TOOL[id],0]) |
593 | 593 | TOOL_STATE[id] = False |
594 | 594 | item.Check(0) |
... | ... | @@ -599,11 +599,11 @@ class VolumeToolPanel(wx.Panel): |
599 | 599 | bmp = wx.Bitmap(ID_TO_BMP[evt.GetId()][1], wx.BITMAP_TYPE_PNG) |
600 | 600 | self.button_view.SetBitmapSelected(bmp) |
601 | 601 | |
602 | - ps.Publisher().sendMessage('Set volume view angle', | |
602 | + Publisher.sendMessage('Set volume view angle', | |
603 | 603 | evt.GetId()) |
604 | 604 | self.Refresh() |
605 | 605 | |
606 | 606 | def OnSelectColour(self, evt): |
607 | 607 | colour = c = [i/255.0 for i in evt.GetValue()] |
608 | - ps.Publisher().sendMessage('Change volume viewer background colour', colour) | |
608 | + Publisher.sendMessage('Change volume viewer background colour', colour) | |
609 | 609 | ... | ... |
invesalius/gui/dialogs.py
... | ... | @@ -26,7 +26,7 @@ import wx |
26 | 26 | from wx.lib import masked |
27 | 27 | from wx.lib.agw import floatspin |
28 | 28 | from wx.lib.wordwrap import wordwrap |
29 | -import wx.lib.pubsub as ps | |
29 | +from wx.lib.pubsub import pub as Publisher | |
30 | 30 | |
31 | 31 | import constants as const |
32 | 32 | import gui.widgets.gradient as grad |
... | ... | @@ -113,7 +113,7 @@ class ProgressDialog(object): |
113 | 113 | self.dlg.SetSize(wx.Size(250,150)) |
114 | 114 | |
115 | 115 | def Cancel(self, evt): |
116 | - ps.Publisher().sendMessage("Cancel DICOM load") | |
116 | + Publisher.sendMessage("Cancel DICOM load") | |
117 | 117 | |
118 | 118 | def Update(self, value, message): |
119 | 119 | if(int(value) != self.maximum): | ... | ... |
invesalius/gui/dicom_preview_panel.py
... | ... | @@ -29,7 +29,7 @@ import vtk |
29 | 29 | |
30 | 30 | from vtk.util import numpy_support |
31 | 31 | from vtk.wx.wxVTKRenderWindowInteractor import wxVTKRenderWindowInteractor |
32 | -import wx.lib.pubsub as ps | |
32 | +from wx.lib.pubsub import pub as Publisher | |
33 | 33 | |
34 | 34 | import constants as const |
35 | 35 | from reader import dicom_reader |
... | ... | @@ -646,7 +646,7 @@ class DicomPreviewSlice(wx.Panel): |
646 | 646 | self.selected_dicom = self.selected_panel.dicom_info |
647 | 647 | self.GetEventHandler().ProcessEvent(my_evt) |
648 | 648 | |
649 | - ps.Publisher().sendMessage("Selected Import Images", [self.first_selection, \ | |
649 | + Publisher.sendMessage("Selected Import Images", [self.first_selection, \ | |
650 | 650 | self.last_selection]) |
651 | 651 | |
652 | 652 | def OnScroll(self, evt=None): | ... | ... |
invesalius/gui/frame.py
... | ... | @@ -25,7 +25,7 @@ import webbrowser |
25 | 25 | |
26 | 26 | import wx |
27 | 27 | import wx.aui |
28 | -import wx.lib.pubsub as ps | |
28 | +from wx.lib.pubsub import pub as Publisher | |
29 | 29 | |
30 | 30 | import constants as const |
31 | 31 | import default_tasks as tasks |
... | ... | @@ -85,7 +85,7 @@ class Frame(wx.Frame): |
85 | 85 | """ |
86 | 86 | Bind events related to pubsub. |
87 | 87 | """ |
88 | - sub = ps.Publisher().subscribe | |
88 | + sub = Publisher.subscribe | |
89 | 89 | sub(self._BeginBusyCursor, 'Begin busy cursor') |
90 | 90 | sub(self._ShowContentPanel, 'Cancel DICOM load') |
91 | 91 | sub(self._EndBusyCursor, 'End busy cursor') |
... | ... | @@ -254,7 +254,7 @@ class Frame(wx.Frame): |
254 | 254 | """ |
255 | 255 | Show viewers and task, hide import panel. |
256 | 256 | """ |
257 | - ps.Publisher().sendMessage("Set layout button full") | |
257 | + Publisher.sendMessage("Set layout button full") | |
258 | 258 | aui_manager = self.aui_manager |
259 | 259 | aui_manager.GetPane("Import").Show(0) |
260 | 260 | aui_manager.GetPane("Data").Show(1) |
... | ... | @@ -265,7 +265,7 @@ class Frame(wx.Frame): |
265 | 265 | """ |
266 | 266 | Show viewers and task, hide import panel. |
267 | 267 | """ |
268 | - ps.Publisher().sendMessage("Set layout button full") | |
268 | + Publisher.sendMessage("Set layout button full") | |
269 | 269 | aui_manager = self.aui_manager |
270 | 270 | aui_manager.GetPane("Retrieve").Show(1) |
271 | 271 | aui_manager.GetPane("Data").Show(0) |
... | ... | @@ -277,7 +277,7 @@ class Frame(wx.Frame): |
277 | 277 | """ |
278 | 278 | Show only DICOM import panel. |
279 | 279 | """ |
280 | - ps.Publisher().sendMessage("Set layout button data only") | |
280 | + Publisher.sendMessage("Set layout button data only") | |
281 | 281 | aui_manager = self.aui_manager |
282 | 282 | aui_manager.GetPane("Import").Show(1) |
283 | 283 | aui_manager.GetPane("Data").Show(0) |
... | ... | @@ -298,13 +298,13 @@ class Frame(wx.Frame): |
298 | 298 | self.aui_manager.Update() |
299 | 299 | |
300 | 300 | def CloseProject(self): |
301 | - ps.Publisher().sendMessage('Close Project') | |
301 | + Publisher.sendMessage('Close Project') | |
302 | 302 | |
303 | 303 | def OnClose(self, evt): |
304 | 304 | """ |
305 | 305 | Close all project data. |
306 | 306 | """ |
307 | - ps.Publisher().sendMessage('Close Project') | |
307 | + Publisher.sendMessage('Close Project') | |
308 | 308 | |
309 | 309 | def OnMenuClick(self, evt): |
310 | 310 | """ |
... | ... | @@ -344,7 +344,7 @@ class Frame(wx.Frame): |
344 | 344 | """ |
345 | 345 | Refresh GUI when frame is resized. |
346 | 346 | """ |
347 | - ps.Publisher().sendMessage(('ProgressBar Reposition')) | |
347 | + Publisher.sendMessage(('ProgressBar Reposition')) | |
348 | 348 | evt.Skip() |
349 | 349 | |
350 | 350 | def ShowPreferences(self): |
... | ... | @@ -357,9 +357,9 @@ class Frame(wx.Frame): |
357 | 357 | ses.Session().surface_interpolation = values[const.SURFACE_INTERPOLATION] |
358 | 358 | ses.Session().language = values[const.LANGUAGE] |
359 | 359 | |
360 | - ps.Publisher().sendMessage('Remove Volume') | |
361 | - ps.Publisher().sendMessage('Reset Reaycasting') | |
362 | - ps.Publisher().sendMessage('Update Surface Interpolation') | |
360 | + Publisher.sendMessage('Remove Volume') | |
361 | + Publisher.sendMessage('Reset Reaycasting') | |
362 | + Publisher.sendMessage('Update Surface Interpolation') | |
363 | 363 | |
364 | 364 | def ShowAbout(self): |
365 | 365 | """ |
... | ... | @@ -371,7 +371,7 @@ class Frame(wx.Frame): |
371 | 371 | """ |
372 | 372 | Save project. |
373 | 373 | """ |
374 | - ps.Publisher().sendMessage('Show save dialog', False) | |
374 | + Publisher.sendMessage('Show save dialog', False) | |
375 | 375 | |
376 | 376 | def ShowGettingStarted(self): |
377 | 377 | """ |
... | ... | @@ -385,29 +385,29 @@ class Frame(wx.Frame): |
385 | 385 | """ |
386 | 386 | Show import DICOM panel. |
387 | 387 | """ |
388 | - ps.Publisher().sendMessage('Show import directory dialog') | |
388 | + Publisher.sendMessage('Show import directory dialog') | |
389 | 389 | |
390 | 390 | def ShowRetrieveDicomPanel(self): |
391 | 391 | print "teste.............." |
392 | - ps.Publisher().sendMessage('Show retrieve dicom panel') | |
392 | + Publisher.sendMessage('Show retrieve dicom panel') | |
393 | 393 | |
394 | 394 | def ShowOpenProject(self): |
395 | 395 | """ |
396 | 396 | Show open project dialog. |
397 | 397 | """ |
398 | - ps.Publisher().sendMessage('Show open project dialog') | |
398 | + Publisher.sendMessage('Show open project dialog') | |
399 | 399 | |
400 | 400 | def ShowSaveAsProject(self): |
401 | 401 | """ |
402 | 402 | Show save as dialog. |
403 | 403 | """ |
404 | - ps.Publisher().sendMessage('Show save dialog', True) | |
404 | + Publisher.sendMessage('Show save dialog', True) | |
405 | 405 | |
406 | 406 | def ShowAnalyzeImporter(self): |
407 | 407 | """ |
408 | 408 | Show save as dialog. |
409 | 409 | """ |
410 | - ps.Publisher().sendMessage('Show analyze dialog', True) | |
410 | + Publisher.sendMessage('Show analyze dialog', True) | |
411 | 411 | |
412 | 412 | # ------------------------------------------------------------------ |
413 | 413 | # ------------------------------------------------------------------ |
... | ... | @@ -441,7 +441,7 @@ class MenuBar(wx.MenuBar): |
441 | 441 | # events should be binded directly from wx.Menu / wx.MenuBar |
442 | 442 | # message "Binding events of wx.MenuBar" on [wxpython-users] |
443 | 443 | # mail list in Oct 20 2008 |
444 | - sub = ps.Publisher().subscribe | |
444 | + sub = Publisher.subscribe | |
445 | 445 | sub(self.OnEnableState, "Enable state project") |
446 | 446 | |
447 | 447 | def __init_items(self): |
... | ... | @@ -578,7 +578,7 @@ class ProgressBar(wx.Gauge): |
578 | 578 | """ |
579 | 579 | Bind events related to pubsub. |
580 | 580 | """ |
581 | - sub = ps.Publisher().subscribe | |
581 | + sub = Publisher.subscribe | |
582 | 582 | sub(self._Layout, 'ProgressBar Reposition') |
583 | 583 | |
584 | 584 | def _Layout(self, evt_pubsub=None): |
... | ... | @@ -626,7 +626,7 @@ class StatusBar(wx.StatusBar): |
626 | 626 | """ |
627 | 627 | Bind events related to pubsub. |
628 | 628 | """ |
629 | - sub = ps.Publisher().subscribe | |
629 | + sub = Publisher.subscribe | |
630 | 630 | sub(self._SetProgressValue, 'Update status in GUI') |
631 | 631 | sub(self._SetProgressLabel, 'Update status text in GUI') |
632 | 632 | |
... | ... | @@ -714,7 +714,7 @@ class ProjectToolBar(wx.ToolBar): |
714 | 714 | """ |
715 | 715 | Bind events related to pubsub. |
716 | 716 | """ |
717 | - sub = ps.Publisher().subscribe | |
717 | + sub = Publisher.subscribe | |
718 | 718 | sub(self._EnableState, "Enable state project") |
719 | 719 | |
720 | 720 | def __init_items(self): |
... | ... | @@ -846,7 +846,7 @@ class ObjectToolBar(wx.ToolBar): |
846 | 846 | """ |
847 | 847 | Bind events related to pubsub. |
848 | 848 | """ |
849 | - sub = ps.Publisher().subscribe | |
849 | + sub = Publisher.subscribe | |
850 | 850 | sub(self._EnableState, "Enable state project") |
851 | 851 | sub(self._UntoggleAllItems, 'Untoggle object toolbar items') |
852 | 852 | sub(self._ToggleLinearMeasure, "Set tool linear measure") |
... | ... | @@ -982,8 +982,8 @@ class ObjectToolBar(wx.ToolBar): |
982 | 982 | """ |
983 | 983 | id = const.STATE_MEASURE_DISTANCE |
984 | 984 | self.ToggleTool(id, True) |
985 | - ps.Publisher().sendMessage('Enable style', id) | |
986 | - ps.Publisher().sendMessage('Untoggle slice toolbar items') | |
985 | + Publisher.sendMessage('Enable style', id) | |
986 | + Publisher.sendMessage('Untoggle slice toolbar items') | |
987 | 987 | for item in const.TOOL_STATES: |
988 | 988 | state = self.GetToolState(item) |
989 | 989 | if state and (item != id): |
... | ... | @@ -997,8 +997,8 @@ class ObjectToolBar(wx.ToolBar): |
997 | 997 | """ |
998 | 998 | id = const.STATE_MEASURE_ANGLE |
999 | 999 | self.ToggleTool(id, True) |
1000 | - ps.Publisher().sendMessage('Enable style', id) | |
1001 | - ps.Publisher().sendMessage('Untoggle slice toolbar items') | |
1000 | + Publisher.sendMessage('Enable style', id) | |
1001 | + Publisher.sendMessage('Untoggle slice toolbar items') | |
1002 | 1002 | for item in const.TOOL_STATES: |
1003 | 1003 | state = self.GetToolState(item) |
1004 | 1004 | if state and (item != id): |
... | ... | @@ -1013,13 +1013,13 @@ class ObjectToolBar(wx.ToolBar): |
1013 | 1013 | state = self.GetToolState(id) |
1014 | 1014 | if state and ((id == const.STATE_MEASURE_DISTANCE) or\ |
1015 | 1015 | (id == const.STATE_MEASURE_ANGLE)): |
1016 | - ps.Publisher().sendMessage('Fold measure task') | |
1016 | + Publisher.sendMessage('Fold measure task') | |
1017 | 1017 | |
1018 | 1018 | if state: |
1019 | - ps.Publisher().sendMessage('Enable style', id) | |
1020 | - ps.Publisher().sendMessage('Untoggle slice toolbar items') | |
1019 | + Publisher.sendMessage('Enable style', id) | |
1020 | + Publisher.sendMessage('Untoggle slice toolbar items') | |
1021 | 1021 | else: |
1022 | - ps.Publisher().sendMessage('Disable style', id) | |
1022 | + Publisher.sendMessage('Disable style', id) | |
1023 | 1023 | |
1024 | 1024 | for item in const.TOOL_STATES: |
1025 | 1025 | state = self.GetToolState(item) |
... | ... | @@ -1099,7 +1099,7 @@ class SliceToolBar(wx.ToolBar): |
1099 | 1099 | """ |
1100 | 1100 | Bind events related to pubsub. |
1101 | 1101 | """ |
1102 | - sub = ps.Publisher().subscribe | |
1102 | + sub = Publisher.subscribe | |
1103 | 1103 | sub(self._EnableState, "Enable state project") |
1104 | 1104 | sub(self._UntoggleAllItems, 'Untoggle slice toolbar items') |
1105 | 1105 | |
... | ... | @@ -1131,7 +1131,7 @@ class SliceToolBar(wx.ToolBar): |
1131 | 1131 | self.ToggleTool(id, False) |
1132 | 1132 | if id == const.SLICE_STATE_CROSS: |
1133 | 1133 | msg = 'Set cross visibility' |
1134 | - ps.Publisher().sendMessage(msg, 0) | |
1134 | + Publisher.sendMessage(msg, 0) | |
1135 | 1135 | |
1136 | 1136 | def OnToggle(self, evt): |
1137 | 1137 | """ |
... | ... | @@ -1142,10 +1142,10 @@ class SliceToolBar(wx.ToolBar): |
1142 | 1142 | state = self.GetToolState(id) |
1143 | 1143 | |
1144 | 1144 | if state: |
1145 | - ps.Publisher().sendMessage('Enable style', id) | |
1146 | - ps.Publisher().sendMessage('Untoggle object toolbar items') | |
1145 | + Publisher.sendMessage('Enable style', id) | |
1146 | + Publisher.sendMessage('Untoggle object toolbar items') | |
1147 | 1147 | else: |
1148 | - ps.Publisher().sendMessage('Disable style', id) | |
1148 | + Publisher.sendMessage('Disable style', id) | |
1149 | 1149 | |
1150 | 1150 | for item in const.TOOL_SLICE_STATES: |
1151 | 1151 | state = self.GetToolState(item) |
... | ... | @@ -1201,7 +1201,7 @@ class LayoutToolBar(wx.ToolBar): |
1201 | 1201 | """ |
1202 | 1202 | Bind events related to pubsub. |
1203 | 1203 | """ |
1204 | - sub = ps.Publisher().subscribe | |
1204 | + sub = Publisher.subscribe | |
1205 | 1205 | sub(self._EnableState, "Enable state project") |
1206 | 1206 | sub(self._SetLayoutWithTask, "Set layout button data only") |
1207 | 1207 | sub(self._SetLayoutWithoutTask, "Set layout button full") |
... | ... | @@ -1318,13 +1318,13 @@ class LayoutToolBar(wx.ToolBar): |
1318 | 1318 | """ |
1319 | 1319 | if self.ontool_layout: |
1320 | 1320 | self.SetToolNormalBitmap(ID_LAYOUT,self.BMP_WITHOUT_MENU) |
1321 | - ps.Publisher().sendMessage('Show task panel') | |
1321 | + Publisher.sendMessage('Show task panel') | |
1322 | 1322 | self.SetToolShortHelp(ID_LAYOUT,_("Hide task panel")) |
1323 | 1323 | self.ontool_layout = False |
1324 | 1324 | else: |
1325 | 1325 | self.bitmap = self.BMP_WITH_MENU |
1326 | 1326 | self.SetToolNormalBitmap(ID_LAYOUT,self.BMP_WITH_MENU) |
1327 | - ps.Publisher().sendMessage('Hide task panel') | |
1327 | + Publisher.sendMessage('Hide task panel') | |
1328 | 1328 | self.SetToolShortHelp(ID_LAYOUT, _("Show task panel")) |
1329 | 1329 | self.ontool_layout = True |
1330 | 1330 | |
... | ... | @@ -1334,14 +1334,14 @@ class LayoutToolBar(wx.ToolBar): |
1334 | 1334 | """ |
1335 | 1335 | if self.ontool_text: |
1336 | 1336 | self.SetToolNormalBitmap(ID_TEXT,self.BMP_WITH_TEXT) |
1337 | - ps.Publisher().sendMessage('Hide text actors on viewers') | |
1337 | + Publisher.sendMessage('Hide text actors on viewers') | |
1338 | 1338 | self.SetToolShortHelp(ID_TEXT,_("Show text")) |
1339 | - ps.Publisher().sendMessage('Update AUI') | |
1339 | + Publisher.sendMessage('Update AUI') | |
1340 | 1340 | self.ontool_text = False |
1341 | 1341 | else: |
1342 | 1342 | self.SetToolNormalBitmap(ID_TEXT, self.BMP_WITHOUT_TEXT) |
1343 | - ps.Publisher().sendMessage('Show text actors on viewers') | |
1343 | + Publisher.sendMessage('Show text actors on viewers') | |
1344 | 1344 | self.SetToolShortHelp(ID_TEXT,_("Hide text")) |
1345 | - ps.Publisher().sendMessage('Update AUI') | |
1345 | + Publisher.sendMessage('Update AUI') | |
1346 | 1346 | self.ontool_text = True |
1347 | 1347 | ... | ... |
invesalius/gui/import_network_panel.py
... | ... | @@ -19,7 +19,7 @@ |
19 | 19 | import wx |
20 | 20 | import sys |
21 | 21 | import wx.gizmos as gizmos |
22 | -import wx.lib.pubsub as ps | |
22 | +from wx.lib.pubsub import pub as Publisher | |
23 | 23 | import wx.lib.splitter as spl |
24 | 24 | |
25 | 25 | import constants as const |
... | ... | @@ -134,8 +134,8 @@ class InnerPanel(wx.Panel): |
134 | 134 | self.SetAutoLayout(1) |
135 | 135 | |
136 | 136 | def _bind_pubsubevt(self): |
137 | - #ps.Publisher().subscribe(self.ShowDicomPreview, "Load import panel") | |
138 | - #ps.Publisher().subscribe(self.GetSelectedImages ,"Selected Import Images") | |
137 | + #Publisher.subscribe(self.ShowDicomPreview, "Load import panel") | |
138 | + #Publisher.subscribe(self.GetSelectedImages ,"Selected Import Images") | |
139 | 139 | pass |
140 | 140 | |
141 | 141 | def GetSelectedImages(self, pubsub_evt): |
... | ... | @@ -181,7 +181,7 @@ class InnerPanel(wx.Panel): |
181 | 181 | self.LoadDicom(group) |
182 | 182 | |
183 | 183 | def OnClickCancel(self, evt): |
184 | - #ps.Publisher().sendMessage("Cancel DICOM load") | |
184 | + #Publisher.sendMessage("Cancel DICOM load") | |
185 | 185 | pass |
186 | 186 | |
187 | 187 | def LoadDicom(self, group): |
... | ... | @@ -199,7 +199,7 @@ class InnerPanel(wx.Panel): |
199 | 199 | |
200 | 200 | nslices_result = slice_amont / (interval + 1) |
201 | 201 | if (nslices_result > 1): |
202 | - #ps.Publisher().sendMessage('Open DICOM group', (group, interval, | |
202 | + #Publisher.sendMessage('Open DICOM group', (group, interval, | |
203 | 203 | # [self.first_image_selection, self.last_image_selection])) |
204 | 204 | pass |
205 | 205 | else: |
... | ... | @@ -218,9 +218,9 @@ class TextPanel(wx.Panel): |
218 | 218 | self.__bind_pubsub_evt() |
219 | 219 | |
220 | 220 | def __bind_pubsub_evt(self): |
221 | - #ps.Publisher().subscribe(self.SelectSeries, 'Select series in import panel') | |
222 | - ps.Publisher().subscribe(self.Populate, 'Populate tree') | |
223 | - ps.Publisher().subscribe(self.SetHostsList, 'Set FindPanel hosts list') | |
221 | + #Publisher.subscribe(self.SelectSeries, 'Select series in import panel') | |
222 | + Publisher.subscribe(self.Populate, 'Populate tree') | |
223 | + Publisher.subscribe(self.SetHostsList, 'Set FindPanel hosts list') | |
224 | 224 | |
225 | 225 | def __bind_events_wx(self): |
226 | 226 | self.Bind(wx.EVT_SIZE, self.OnSize) |
... | ... | @@ -405,7 +405,7 @@ class TextPanel(wx.Panel): |
405 | 405 | self.hosts = evt_pub.data |
406 | 406 | |
407 | 407 | def GetHostList(self): |
408 | - ps.Publisher().sendMessage('Get NodesPanel host list') | |
408 | + Publisher.sendMessage('Get NodesPanel host list') | |
409 | 409 | return self.hosts |
410 | 410 | |
411 | 411 | def OnSelChanged(self, evt): |
... | ... | @@ -413,7 +413,7 @@ class TextPanel(wx.Panel): |
413 | 413 | if self._selected_by_user: |
414 | 414 | group = self.tree.GetItemPyData(item) |
415 | 415 | if isinstance(group, dcm.DicomGroup): |
416 | - #ps.Publisher().sendMessage('Load group into import panel', | |
416 | + #Publisher.sendMessage('Load group into import panel', | |
417 | 417 | # group) |
418 | 418 | pass |
419 | 419 | |
... | ... | @@ -423,7 +423,7 @@ class TextPanel(wx.Panel): |
423 | 423 | my_evt.SetSelectedID(id) |
424 | 424 | self.GetEventHandler().ProcessEvent(my_evt) |
425 | 425 | |
426 | - #ps.Publisher().sendMessage('Load patient into import panel', | |
426 | + #Publisher.sendMessage('Load patient into import panel', | |
427 | 427 | # group) |
428 | 428 | else: |
429 | 429 | parent_id = self.tree.GetItemParent(item) |
... | ... | @@ -449,7 +449,7 @@ class TextPanel(wx.Panel): |
449 | 449 | dn.RunCMove((patient_id, serie_id)) |
450 | 450 | #dn.SetSearchWord(self.find_txt.GetValue()) |
451 | 451 | |
452 | - #ps.Publisher().sendMessage('Populate tree', dn.RunCFind()) | |
452 | + #Publisher.sendMessage('Populate tree', dn.RunCFind()) | |
453 | 453 | |
454 | 454 | |
455 | 455 | |
... | ... | @@ -522,10 +522,10 @@ class FindPanel(wx.Panel): |
522 | 522 | self._bind_gui_evt() |
523 | 523 | |
524 | 524 | def __bind_evt(self): |
525 | - ps.Publisher().subscribe(self.SetHostsList, 'Set FindPanel hosts list') | |
526 | - #ps.Publisher().subscribe(self.ShowDicomSeries, 'Load dicom preview') | |
527 | - #ps.Publisher().subscribe(self.SetDicomSeries, 'Load group into import panel') | |
528 | - #ps.Publisher().subscribe(self.SetPatientSeries, 'Load patient into import panel') | |
525 | + Publisher.subscribe(self.SetHostsList, 'Set FindPanel hosts list') | |
526 | + #Publisher.subscribe(self.ShowDicomSeries, 'Load dicom preview') | |
527 | + #Publisher.subscribe(self.SetDicomSeries, 'Load group into import panel') | |
528 | + #Publisher.subscribe(self.SetPatientSeries, 'Load patient into import panel') | |
529 | 529 | pass |
530 | 530 | |
531 | 531 | def _bind_gui_evt(self): |
... | ... | @@ -545,14 +545,14 @@ class FindPanel(wx.Panel): |
545 | 545 | dn.SetAETitle(self.hosts[0][3]) |
546 | 546 | dn.SetSearchWord(self.find_txt.GetValue()) |
547 | 547 | |
548 | - ps.Publisher().sendMessage('Populate tree', dn.RunCFind()) | |
548 | + Publisher.sendMessage('Populate tree', dn.RunCFind()) | |
549 | 549 | |
550 | 550 | |
551 | 551 | def SetHostsList(self, evt_pub): |
552 | 552 | self.hosts = evt_pub.data |
553 | 553 | |
554 | 554 | def GetHostList(self): |
555 | - ps.Publisher().sendMessage('Get NodesPanel host list') | |
555 | + Publisher.sendMessage('Get NodesPanel host list') | |
556 | 556 | return self.hosts |
557 | 557 | |
558 | 558 | class HostFindPanel(wx.Panel): |
... | ... | @@ -612,7 +612,7 @@ class NodesTree(wx.ListCtrl, CheckListCtrlMixin,listmix.ListCtrlAutoWidthMixin, |
612 | 612 | listmix.TextEditMixin.__init__(self) |
613 | 613 | |
614 | 614 | def OnCheckItem(self, index, flag): |
615 | - ps.Publisher().sendMessage("Check item dict", [index, flag]) | |
615 | + Publisher.sendMessage("Check item dict", [index, flag]) | |
616 | 616 | |
617 | 617 | def OpenEditor(self, col, row): |
618 | 618 | |
... | ... | @@ -650,9 +650,9 @@ class NodesPanel(wx.Panel): |
650 | 650 | |
651 | 651 | self.Bind(wx.EVT_LIST_END_LABEL_EDIT, self.EndEdition, self.tree_node) |
652 | 652 | |
653 | - ps.Publisher().subscribe(self.CheckItemDict, "Check item dict") | |
654 | - ps.Publisher().subscribe(self.GetHostsList, "Get NodesPanel host list") | |
655 | - #ps.Publisher().subscribe(self.UnCheckItemDict, "Uncheck item dict") | |
653 | + Publisher.subscribe(self.CheckItemDict, "Check item dict") | |
654 | + Publisher.subscribe(self.GetHostsList, "Get NodesPanel host list") | |
655 | + #Publisher.subscribe(self.UnCheckItemDict, "Uncheck item dict") | |
656 | 656 | |
657 | 657 | |
658 | 658 | def __init_gui(self): |
... | ... | @@ -711,7 +711,7 @@ class NodesPanel(wx.Panel): |
711 | 711 | self.sizer = sizer |
712 | 712 | |
713 | 713 | def GetHostsList(self, pub_evt): |
714 | - ps.Publisher().sendMessage('Set FindPanel hosts list', self.hosts) | |
714 | + Publisher.sendMessage('Set FindPanel hosts list', self.hosts) | |
715 | 715 | |
716 | 716 | |
717 | 717 | def EndEdition(self, evt): | ... | ... |
invesalius/gui/import_panel.py
... | ... | @@ -18,7 +18,7 @@ |
18 | 18 | #-------------------------------------------------------------------------- |
19 | 19 | import wx |
20 | 20 | import wx.gizmos as gizmos |
21 | -import wx.lib.pubsub as ps | |
21 | +from wx.lib.pubsub import pub as Publisher | |
22 | 22 | import wx.lib.splitter as spl |
23 | 23 | |
24 | 24 | import constants as const |
... | ... | @@ -126,8 +126,8 @@ class InnerPanel(wx.Panel): |
126 | 126 | self.SetAutoLayout(1) |
127 | 127 | |
128 | 128 | def _bind_pubsubevt(self): |
129 | - ps.Publisher().subscribe(self.ShowDicomPreview, "Load import panel") | |
130 | - ps.Publisher().subscribe(self.GetSelectedImages ,"Selected Import Images") | |
129 | + Publisher.subscribe(self.ShowDicomPreview, "Load import panel") | |
130 | + Publisher.subscribe(self.GetSelectedImages ,"Selected Import Images") | |
131 | 131 | |
132 | 132 | def GetSelectedImages(self, pubsub_evt): |
133 | 133 | self.first_image_selection = pubsub_evt.data[0] |
... | ... | @@ -171,7 +171,7 @@ class InnerPanel(wx.Panel): |
171 | 171 | self.LoadDicom(group) |
172 | 172 | |
173 | 173 | def OnClickCancel(self, evt): |
174 | - ps.Publisher().sendMessage("Cancel DICOM load") | |
174 | + Publisher.sendMessage("Cancel DICOM load") | |
175 | 175 | |
176 | 176 | def LoadDicom(self, group): |
177 | 177 | interval = self.combo_interval.GetSelection() |
... | ... | @@ -187,7 +187,7 @@ class InnerPanel(wx.Panel): |
187 | 187 | |
188 | 188 | nslices_result = slice_amont / (interval + 1) |
189 | 189 | if (nslices_result > 1): |
190 | - ps.Publisher().sendMessage('Open DICOM group', (group, interval, | |
190 | + Publisher.sendMessage('Open DICOM group', (group, interval, | |
191 | 191 | [self.first_image_selection, self.last_image_selection])) |
192 | 192 | else: |
193 | 193 | dlg.MissingFilesForReconstruction() |
... | ... | @@ -205,7 +205,7 @@ class TextPanel(wx.Panel): |
205 | 205 | self.__bind_pubsub_evt() |
206 | 206 | |
207 | 207 | def __bind_pubsub_evt(self): |
208 | - ps.Publisher().subscribe(self.SelectSeries, 'Select series in import panel') | |
208 | + Publisher.subscribe(self.SelectSeries, 'Select series in import panel') | |
209 | 209 | |
210 | 210 | def __bind_events_wx(self): |
211 | 211 | self.Bind(wx.EVT_SIZE, self.OnSize) |
... | ... | @@ -312,7 +312,7 @@ class TextPanel(wx.Panel): |
312 | 312 | if self._selected_by_user: |
313 | 313 | group = self.tree.GetItemPyData(item) |
314 | 314 | if isinstance(group, dcm.DicomGroup): |
315 | - ps.Publisher().sendMessage('Load group into import panel', | |
315 | + Publisher.sendMessage('Load group into import panel', | |
316 | 316 | group) |
317 | 317 | |
318 | 318 | elif isinstance(group, dcm.PatientGroup): |
... | ... | @@ -321,7 +321,7 @@ class TextPanel(wx.Panel): |
321 | 321 | my_evt.SetSelectedID(id) |
322 | 322 | self.GetEventHandler().ProcessEvent(my_evt) |
323 | 323 | |
324 | - ps.Publisher().sendMessage('Load patient into import panel', | |
324 | + Publisher.sendMessage('Load patient into import panel', | |
325 | 325 | group) |
326 | 326 | else: |
327 | 327 | parent_id = self.tree.GetItemParent(item) |
... | ... | @@ -421,9 +421,9 @@ class SeriesPanel(wx.Panel): |
421 | 421 | self._bind_gui_evt() |
422 | 422 | |
423 | 423 | def __bind_evt(self): |
424 | - ps.Publisher().subscribe(self.ShowDicomSeries, 'Load dicom preview') | |
425 | - ps.Publisher().subscribe(self.SetDicomSeries, 'Load group into import panel') | |
426 | - ps.Publisher().subscribe(self.SetPatientSeries, 'Load patient into import panel') | |
424 | + Publisher.subscribe(self.ShowDicomSeries, 'Load dicom preview') | |
425 | + Publisher.subscribe(self.SetDicomSeries, 'Load group into import panel') | |
426 | + Publisher.subscribe(self.SetPatientSeries, 'Load patient into import panel') | |
427 | 427 | |
428 | 428 | def _bind_gui_evt(self): |
429 | 429 | self.serie_preview.Bind(dpp.EVT_CLICK_SERIE, self.OnSelectSerie) |
... | ... | @@ -487,9 +487,9 @@ class SlicePanel(wx.Panel): |
487 | 487 | self.__bind_evt() |
488 | 488 | |
489 | 489 | def __bind_evt(self): |
490 | - ps.Publisher().subscribe(self.ShowDicomSeries, 'Load dicom preview') | |
491 | - ps.Publisher().subscribe(self.SetDicomSeries, 'Load group into import panel') | |
492 | - ps.Publisher().subscribe(self.SetPatientSeries, 'Load patient into import panel') | |
490 | + Publisher.subscribe(self.ShowDicomSeries, 'Load dicom preview') | |
491 | + Publisher.subscribe(self.SetDicomSeries, 'Load group into import panel') | |
492 | + Publisher.subscribe(self.SetPatientSeries, 'Load patient into import panel') | |
493 | 493 | |
494 | 494 | def __init_gui(self): |
495 | 495 | self.SetBackgroundColour((255,255,255)) | ... | ... |
invesalius/gui/preferences.py
1 | 1 | import wx |
2 | 2 | import constants as const |
3 | -import wx.lib.pubsub as ps | |
3 | +from wx.lib.pubsub import pub as Publisher | |
4 | 4 | import session as ses |
5 | 5 | from language_dialog import ComboBoxLanguage |
6 | 6 | |
... | ... | @@ -62,7 +62,7 @@ class Preferences(wx.Dialog): |
62 | 62 | self.__bind_events() |
63 | 63 | |
64 | 64 | def __bind_events(self): |
65 | - ps.Publisher().subscribe(self.LoadPreferences, 'Load Preferences') | |
65 | + Publisher.subscribe(self.LoadPreferences, 'Load Preferences') | |
66 | 66 | |
67 | 67 | |
68 | 68 | def GetPreferences(self): | ... | ... |
invesalius/gui/task_exporter.py
... | ... | @@ -23,7 +23,7 @@ import sys |
23 | 23 | import wx |
24 | 24 | import wx.lib.hyperlink as hl |
25 | 25 | import wx.lib.platebtn as pbtn |
26 | -import wx.lib.pubsub as ps | |
26 | +from wx.lib.pubsub import pub as Publisher | |
27 | 27 | |
28 | 28 | import constants as const |
29 | 29 | import gui.dialogs as dlg |
... | ... | @@ -253,7 +253,7 @@ class InnerTaskPanel(wx.Panel): |
253 | 253 | value = dlg.ExportPicture(self.id_to_name[id]) |
254 | 254 | if value: |
255 | 255 | filename, filetype = value |
256 | - ps.Publisher().sendMessage('Export picture to file', | |
256 | + Publisher.sendMessage('Export picture to file', | |
257 | 257 | (id, filename, filetype)) |
258 | 258 | |
259 | 259 | |
... | ... | @@ -287,7 +287,7 @@ class InnerTaskPanel(wx.Panel): |
287 | 287 | if filename.split(".")[-1] != extension: |
288 | 288 | filename = filename + "."+ extension |
289 | 289 | filetype = const.FILETYPE_IMAGEDATA |
290 | - ps.Publisher().sendMessage('Export mask to file', | |
290 | + Publisher.sendMessage('Export mask to file', | |
291 | 291 | (filename, filetype)) |
292 | 292 | |
293 | 293 | |
... | ... | @@ -323,7 +323,7 @@ class InnerTaskPanel(wx.Panel): |
323 | 323 | if sys.platform != 'win32': |
324 | 324 | if filename.split(".")[-1] != extension: |
325 | 325 | filename = filename + "."+ extension |
326 | - ps.Publisher().sendMessage('Export surface to file', | |
326 | + Publisher.sendMessage('Export surface to file', | |
327 | 327 | (filename, filetype)) |
328 | 328 | else: |
329 | 329 | dlg = wx.MessageDialog(None, | ... | ... |
invesalius/gui/task_importer.py
... | ... | @@ -22,7 +22,7 @@ import sys |
22 | 22 | import wx |
23 | 23 | import wx.lib.hyperlink as hl |
24 | 24 | import wx.lib.platebtn as pbtn |
25 | -import wx.lib.pubsub as ps | |
25 | +from wx.lib.pubsub import pub as Publisher | |
26 | 26 | |
27 | 27 | import constants as const |
28 | 28 | import gui.dialogs as dlg |
... | ... | @@ -140,7 +140,7 @@ class InnerTaskPanel(wx.Panel): |
140 | 140 | #self.__bind_events() |
141 | 141 | |
142 | 142 | #def __bind_events(self): |
143 | - # ps.Publisher().subscribe(self.OnLoadRecentProjects, "Load recent projects") | |
143 | + # Publisher.subscribe(self.OnLoadRecentProjects, "Load recent projects") | |
144 | 144 | |
145 | 145 | #def OnLoadRecentProjects(self, pubsub_evt): |
146 | 146 | # projects = pubsub_evt.data |
... | ... | @@ -217,22 +217,22 @@ class InnerTaskPanel(wx.Panel): |
217 | 217 | |
218 | 218 | ####### |
219 | 219 | def ImportDicom(self): |
220 | - ps.Publisher().sendMessage('Show import directory dialog') | |
220 | + Publisher.sendMessage('Show import directory dialog') | |
221 | 221 | |
222 | 222 | def OpenProject(self, path=None): |
223 | 223 | if path: |
224 | - ps.Publisher().sendMessage('Open recent project', path) | |
224 | + Publisher.sendMessage('Open recent project', path) | |
225 | 225 | else: |
226 | - ps.Publisher().sendMessage('Show open project dialog') | |
226 | + Publisher.sendMessage('Show open project dialog') | |
227 | 227 | |
228 | 228 | def SaveAsProject(self): |
229 | - ps.Publisher().sendMessage('Show save dialog', True) | |
229 | + Publisher.sendMessage('Show save dialog', True) | |
230 | 230 | |
231 | 231 | def SaveProject(self): |
232 | - ps.Publisher().sendMessage('Show save dialog', False) | |
232 | + Publisher.sendMessage('Show save dialog', False) | |
233 | 233 | |
234 | 234 | def CloseProject(self): |
235 | - ps.Publisher().sendMessage('Close Project') | |
235 | + Publisher.sendMessage('Close Project') | |
236 | 236 | ####### |
237 | 237 | |
238 | 238 | def OnButton(self, evt): | ... | ... |
invesalius/gui/task_navigator.py
... | ... | @@ -25,7 +25,7 @@ import wx |
25 | 25 | import wx.lib.hyperlink as hl |
26 | 26 | import wx.lib.masked.numctrl |
27 | 27 | import wx.lib.platebtn as pbtn |
28 | -import wx.lib.pubsub as ps | |
28 | +from wx.lib.pubsub import pub as Publisher | |
29 | 29 | |
30 | 30 | import data.bases as db |
31 | 31 | import data.co_registration as dcr |
... | ... | @@ -286,8 +286,8 @@ class InnerTaskPanel(wx.Panel): |
286 | 286 | self.button_getpoint.SetToolTip(tooltip) |
287 | 287 | |
288 | 288 | def __bind_events(self): |
289 | - ps.Publisher().subscribe(self.__update_points_img, 'Update cross position') | |
290 | - ps.Publisher().subscribe(self.__update_points_plh, 'Update plh position') | |
289 | + Publisher.subscribe(self.__update_points_img, 'Update cross position') | |
290 | + Publisher.subscribe(self.__update_points_plh, 'Update plh position') | |
291 | 291 | |
292 | 292 | def __update_points_img(self, pubsub_evt): |
293 | 293 | x, y, z = pubsub_evt.data[1] |
... | ... | @@ -355,7 +355,7 @@ class InnerTaskPanel(wx.Panel): |
355 | 355 | self.N, self.q2, self.Ninv = db.Bases(self.coord1b, self.coord2b, self.coord3b).Basecreation() |
356 | 356 | |
357 | 357 | if self.aux_plh_ref1 == 0 or self.aux_plh_ref2 == 0 or self.aux_plh_ref3 == 0: |
358 | - ps.Publisher().sendMessage('Update plh position', coord) | |
358 | + Publisher.sendMessage('Update plh position', coord) | |
359 | 359 | |
360 | 360 | def Coordinates(self): |
361 | 361 | #Get Polhemus points for base creation | ... | ... |
invesalius/gui/task_slice.py
... | ... | @@ -22,7 +22,7 @@ import sys |
22 | 22 | import wx |
23 | 23 | import wx.lib.hyperlink as hl |
24 | 24 | import wx.lib.platebtn as pbtn |
25 | -import wx.lib.pubsub as ps | |
25 | +from wx.lib.pubsub import pub as Publisher | |
26 | 26 | |
27 | 27 | import data.mask as mask |
28 | 28 | import data.slice_ as slice_ |
... | ... | @@ -155,10 +155,10 @@ class InnerTaskPanel(wx.Panel): |
155 | 155 | options = dlgs.GetOptions() |
156 | 156 | else: |
157 | 157 | return |
158 | - ps.Publisher().sendMessage('Create surface from index', | |
158 | + Publisher.sendMessage('Create surface from index', | |
159 | 159 | (self.GetMaskSelected(), |
160 | 160 | overwrite, algorithm, options)) |
161 | - ps.Publisher().sendMessage('Fold surface task') | |
161 | + Publisher.sendMessage('Fold surface task') | |
162 | 162 | else: |
163 | 163 | dlg.InexistentMask() |
164 | 164 | |
... | ... | @@ -176,7 +176,7 @@ class InnerTaskPanel(wx.Panel): |
176 | 176 | if ok: |
177 | 177 | mask_name, thresh, colour = dialog.GetValue() |
178 | 178 | if mask_name: |
179 | - ps.Publisher().sendMessage('Create new mask', | |
179 | + Publisher.sendMessage('Create new mask', | |
180 | 180 | (mask_name, thresh, colour)) |
181 | 181 | |
182 | 182 | def GetMaskSelected(self): |
... | ... | @@ -260,8 +260,8 @@ class InnerFoldPanel(wx.Panel): |
260 | 260 | self.fold_panel.Bind(fpb.EVT_CAPTIONBAR, self.OnFoldPressCaption) |
261 | 261 | |
262 | 262 | def __bind_pubsub_evt(self): |
263 | - ps.Publisher().subscribe(self.OnRetrieveStyle, 'Retrieve task slice style') | |
264 | - ps.Publisher().subscribe(self.OnDisableStyle, 'Disable task slice style') | |
263 | + Publisher.subscribe(self.OnRetrieveStyle, 'Retrieve task slice style') | |
264 | + Publisher.subscribe(self.OnDisableStyle, 'Disable task slice style') | |
265 | 265 | |
266 | 266 | def OnFoldPressCaption(self, evt): |
267 | 267 | id = evt.GetTag().GetId() |
... | ... | @@ -269,24 +269,24 @@ class InnerFoldPanel(wx.Panel): |
269 | 269 | |
270 | 270 | if self.__id_editor == id: |
271 | 271 | if closed: |
272 | - ps.Publisher().sendMessage('Disable style', const.SLICE_STATE_EDITOR) | |
272 | + Publisher.sendMessage('Disable style', const.SLICE_STATE_EDITOR) | |
273 | 273 | self.last_style = None |
274 | 274 | else: |
275 | - ps.Publisher().sendMessage('Enable style', const.SLICE_STATE_EDITOR) | |
275 | + Publisher.sendMessage('Enable style', const.SLICE_STATE_EDITOR) | |
276 | 276 | self.last_style = const.SLICE_STATE_EDITOR |
277 | 277 | else: |
278 | - ps.Publisher().sendMessage('Disable style', const.SLICE_STATE_EDITOR) | |
278 | + Publisher.sendMessage('Disable style', const.SLICE_STATE_EDITOR) | |
279 | 279 | self.last_style = None |
280 | 280 | |
281 | 281 | evt.Skip() |
282 | 282 | |
283 | 283 | def OnRetrieveStyle(self, pubsub_evt): |
284 | 284 | if (self.last_style == const.SLICE_STATE_EDITOR): |
285 | - ps.Publisher().sendMessage('Enable style', const.SLICE_STATE_EDITOR) | |
285 | + Publisher.sendMessage('Enable style', const.SLICE_STATE_EDITOR) | |
286 | 286 | |
287 | 287 | def OnDisableStyle(self, pubsub_evt): |
288 | 288 | if (self.last_style == const.SLICE_STATE_EDITOR): |
289 | - ps.Publisher().sendMessage('Disable style', const.SLICE_STATE_EDITOR) | |
289 | + Publisher.sendMessage('Disable style', const.SLICE_STATE_EDITOR) | |
290 | 290 | |
291 | 291 | def GetMaskSelected(self): |
292 | 292 | x= self.mask_prop_panel.GetMaskSelected() |
... | ... | @@ -356,19 +356,19 @@ class MaskProperties(wx.Panel): |
356 | 356 | |
357 | 357 | |
358 | 358 | def __bind_events(self): |
359 | - ps.Publisher().subscribe(self.AddMask, 'Add mask') | |
359 | + Publisher.subscribe(self.AddMask, 'Add mask') | |
360 | 360 | # TODO: Uncomment |
361 | - ps.Publisher().subscribe(self.SetThresholdBounds, | |
361 | + Publisher.subscribe(self.SetThresholdBounds, | |
362 | 362 | 'Update threshold limits') |
363 | - ps.Publisher().subscribe(self.SetThresholdModes, 'Set threshold modes') | |
364 | - ps.Publisher().subscribe(self.SetItemsColour, 'Set GUI items colour') | |
365 | - ps.Publisher().subscribe(self.SetThresholdValues, | |
363 | + Publisher.subscribe(self.SetThresholdModes, 'Set threshold modes') | |
364 | + Publisher.subscribe(self.SetItemsColour, 'Set GUI items colour') | |
365 | + Publisher.subscribe(self.SetThresholdValues, | |
366 | 366 | 'Set threshold values in gradient') |
367 | - ps.Publisher().subscribe(self.SelectMaskName, 'Select mask name in combo') | |
368 | - ps.Publisher().subscribe(self.ChangeMaskName, 'Change mask name') | |
369 | - ps.Publisher().subscribe(self.OnRemoveMasks, 'Remove masks') | |
370 | - ps.Publisher().subscribe(self.OnCloseProject, 'Close project data') | |
371 | - ps.Publisher().subscribe(self.SetThresholdValues2, 'Set threshold values') | |
367 | + Publisher.subscribe(self.SelectMaskName, 'Select mask name in combo') | |
368 | + Publisher.subscribe(self.ChangeMaskName, 'Change mask name') | |
369 | + Publisher.subscribe(self.OnRemoveMasks, 'Remove masks') | |
370 | + Publisher.subscribe(self.OnCloseProject, 'Close project data') | |
371 | + Publisher.subscribe(self.SetThresholdValues2, 'Set threshold values') | |
372 | 372 | |
373 | 373 | def OnCloseProject(self, pubsub_evt): |
374 | 374 | self.CloseProject() |
... | ... | @@ -484,7 +484,7 @@ class MaskProperties(wx.Panel): |
484 | 484 | def OnComboName(self, evt): |
485 | 485 | mask_name = evt.GetString() |
486 | 486 | mask_index = evt.GetSelection() |
487 | - ps.Publisher().sendMessage('Change mask selected', mask_index) | |
487 | + Publisher.sendMessage('Change mask selected', mask_index) | |
488 | 488 | |
489 | 489 | def OnComboThresh(self, evt): |
490 | 490 | (thresh_min, thresh_max) = Project().threshold_modes[evt.GetString()] |
... | ... | @@ -496,7 +496,7 @@ class MaskProperties(wx.Panel): |
496 | 496 | def OnSlideChanged(self, evt): |
497 | 497 | thresh_min = self.gradient.GetMinValue() |
498 | 498 | thresh_max = self.gradient.GetMaxValue() |
499 | - ps.Publisher().sendMessage('Set threshold values', | |
499 | + Publisher.sendMessage('Set threshold values', | |
500 | 500 | (thresh_min, thresh_max)) |
501 | 501 | session = ses.Session() |
502 | 502 | session.ChangeProject() |
... | ... | @@ -504,7 +504,7 @@ class MaskProperties(wx.Panel): |
504 | 504 | def OnSlideChanging(self, evt): |
505 | 505 | thresh_min = self.gradient.GetMinValue() |
506 | 506 | thresh_max = self.gradient.GetMaxValue() |
507 | - ps.Publisher().sendMessage('Changing threshold values', | |
507 | + Publisher.sendMessage('Changing threshold values', | |
508 | 508 | (thresh_min, thresh_max)) |
509 | 509 | session = ses.Session() |
510 | 510 | session.ChangeProject() |
... | ... | @@ -512,7 +512,7 @@ class MaskProperties(wx.Panel): |
512 | 512 | def OnSelectColour(self, evt): |
513 | 513 | colour = evt.GetValue() |
514 | 514 | self.gradient.SetColour(colour) |
515 | - ps.Publisher().sendMessage('Change mask colour', colour) | |
515 | + Publisher.sendMessage('Change mask colour', colour) | |
516 | 516 | |
517 | 517 | class EditionTools(wx.Panel): |
518 | 518 | def __init__(self, parent): |
... | ... | @@ -599,10 +599,10 @@ class EditionTools(wx.Panel): |
599 | 599 | self.combo_brush_op.Bind(wx.EVT_COMBOBOX, self.OnComboBrushOp) |
600 | 600 | |
601 | 601 | def __bind_events(self): |
602 | - ps.Publisher().subscribe(self.SetThresholdBounds, | |
602 | + Publisher.subscribe(self.SetThresholdBounds, | |
603 | 603 | 'Update threshold limits') |
604 | - ps.Publisher().subscribe(self.ChangeMaskColour, 'Change mask colour') | |
605 | - ps.Publisher().subscribe(self.SetGradientColour, 'Add mask') | |
604 | + Publisher.subscribe(self.ChangeMaskColour, 'Change mask colour') | |
605 | + Publisher.subscribe(self.SetGradientColour, 'Add mask') | |
606 | 606 | |
607 | 607 | def ChangeMaskColour(self, pubsub_evt): |
608 | 608 | colour = pubsub_evt.data |
... | ... | @@ -632,7 +632,7 @@ class EditionTools(wx.Panel): |
632 | 632 | thresh_min = self.gradient_thresh.GetMinValue() |
633 | 633 | thresh_max = self.gradient_thresh.GetMaxValue() |
634 | 634 | if self.bind_evt_gradient: |
635 | - ps.Publisher().sendMessage('Set edition threshold values', | |
635 | + Publisher.sendMessage('Set edition threshold values', | |
636 | 636 | (thresh_min, thresh_max)) |
637 | 637 | |
638 | 638 | def OnMenu(self, evt): |
... | ... | @@ -646,17 +646,17 @@ class EditionTools(wx.Panel): |
646 | 646 | |
647 | 647 | self.btn_brush_format.SetBitmap(bitmap[evt.GetId()]) |
648 | 648 | |
649 | - ps.Publisher().sendMessage('Set brush format', brush[evt.GetId()]) | |
649 | + Publisher.sendMessage('Set brush format', brush[evt.GetId()]) | |
650 | 650 | |
651 | 651 | def OnBrushSize(self, evt): |
652 | 652 | """ """ |
653 | 653 | # FIXME: Using wx.EVT_SPINCTRL in MacOS it doesnt capture changes only |
654 | 654 | # in the text ctrl - so we are capturing only changes on text |
655 | 655 | # Strangelly this is being called twice |
656 | - ps.Publisher().sendMessage('Set edition brush size',self.spin.GetValue()) | |
656 | + Publisher.sendMessage('Set edition brush size',self.spin.GetValue()) | |
657 | 657 | |
658 | 658 | def OnComboBrushOp(self, evt): |
659 | 659 | brush_op_id = evt.GetSelection() |
660 | - ps.Publisher().sendMessage('Set edition operation', brush_op_id) | |
660 | + Publisher.sendMessage('Set edition operation', brush_op_id) | |
661 | 661 | |
662 | 662 | ... | ... |
invesalius/gui/task_surface.py
... | ... | @@ -20,7 +20,7 @@ import sys |
20 | 20 | |
21 | 21 | import wx |
22 | 22 | import wx.lib.hyperlink as hl |
23 | -import wx.lib.pubsub as ps | |
23 | +from wx.lib.pubsub import pub as Publisher | |
24 | 24 | |
25 | 25 | import constants as const |
26 | 26 | import gui.dialogs as dlg |
... | ... | @@ -126,7 +126,7 @@ class InnerTaskPanel(wx.Panel): |
126 | 126 | |
127 | 127 | def OnButtonNextTask(self, evt): |
128 | 128 | if evt: |
129 | - ps.Publisher().sendMessage('Fold export task') | |
129 | + Publisher.sendMessage('Fold export task') | |
130 | 130 | evt.Skip() |
131 | 131 | |
132 | 132 | def OnLinkNewSurface(self, evt=None): |
... | ... | @@ -161,7 +161,7 @@ class InnerTaskPanel(wx.Panel): |
161 | 161 | fill_holes, |
162 | 162 | keep_largest] |
163 | 163 | |
164 | - ps.Publisher().sendMessage('Create surface', surface_data) | |
164 | + Publisher.sendMessage('Create surface', surface_data) | |
165 | 165 | dialog.Destroy() |
166 | 166 | if evt: |
167 | 167 | evt.Skip() |
... | ... | @@ -346,10 +346,10 @@ class SurfaceTools(wx.Panel): |
346 | 346 | self.SelectSeed() |
347 | 347 | |
348 | 348 | def SelectLargest(self): |
349 | - ps.Publisher().sendMessage('Create surface from largest region') | |
349 | + Publisher.sendMessage('Create surface from largest region') | |
350 | 350 | |
351 | 351 | def SplitSurface(self): |
352 | - ps.Publisher().sendMessage('Split surface') | |
352 | + Publisher.sendMessage('Split surface') | |
353 | 353 | |
354 | 354 | def SelectSeed(self): |
355 | 355 | if self.button_seeds.IsPressed(): |
... | ... | @@ -358,12 +358,12 @@ class SurfaceTools(wx.Panel): |
358 | 358 | self.EndSeeding() |
359 | 359 | |
360 | 360 | def StartSeeding(self): |
361 | - ps.Publisher().sendMessage('Enable style', const.VOLUME_STATE_SEED) | |
362 | - ps.Publisher().sendMessage('Create surface by seeding - start') | |
361 | + Publisher.sendMessage('Enable style', const.VOLUME_STATE_SEED) | |
362 | + Publisher.sendMessage('Create surface by seeding - start') | |
363 | 363 | |
364 | 364 | def EndSeeding(self): |
365 | - ps.Publisher().sendMessage('Disable style', const.VOLUME_STATE_SEED) | |
366 | - ps.Publisher().sendMessage('Create surface by seeding - end') | |
365 | + Publisher.sendMessage('Disable style', const.VOLUME_STATE_SEED) | |
366 | + Publisher.sendMessage('Create surface by seeding - end') | |
367 | 367 | |
368 | 368 | |
369 | 369 | |
... | ... | @@ -437,12 +437,12 @@ class SurfaceProperties(wx.Panel): |
437 | 437 | self.__bind_events() |
438 | 438 | |
439 | 439 | def __bind_events(self): |
440 | - ps.Publisher().subscribe(self.InsertNewSurface, | |
440 | + Publisher.subscribe(self.InsertNewSurface, | |
441 | 441 | 'Update surface info in GUI') |
442 | - ps.Publisher().subscribe(self.ChangeSurfaceName, | |
442 | + Publisher.subscribe(self.ChangeSurfaceName, | |
443 | 443 | 'Change surface name') |
444 | - ps.Publisher().subscribe(self.OnCloseProject, 'Close project data') | |
445 | - ps.Publisher().subscribe(self.OnRemoveSurfaces, 'Remove surfaces') | |
444 | + Publisher.subscribe(self.OnCloseProject, 'Close project data') | |
445 | + Publisher.subscribe(self.OnRemoveSurfaces, 'Remove surfaces') | |
446 | 446 | |
447 | 447 | |
448 | 448 | def OnRemoveSurfaces(self, pubsub_evt): |
... | ... | @@ -497,11 +497,11 @@ class SurfaceProperties(wx.Panel): |
497 | 497 | def OnComboName(self, evt): |
498 | 498 | surface_name = evt.GetString() |
499 | 499 | surface_index = evt.GetSelection() |
500 | - ps.Publisher().sendMessage('Change surface selected', surface_index) | |
500 | + Publisher.sendMessage('Change surface selected', surface_index) | |
501 | 501 | |
502 | 502 | def OnSelectColour(self, evt): |
503 | 503 | colour = [value/255.0 for value in evt.GetValue()] |
504 | - ps.Publisher().sendMessage('Set surface colour', | |
504 | + Publisher.sendMessage('Set surface colour', | |
505 | 505 | (self.combo_surface_name.GetSelection(), |
506 | 506 | colour)) |
507 | 507 | |
... | ... | @@ -512,7 +512,7 @@ class SurfaceProperties(wx.Panel): |
512 | 512 | # This problem is in wx.Widgets and therefore we'll simply overcome it: |
513 | 513 | if (wx.Platform == "__WXMAC__"): |
514 | 514 | transparency = evt.GetInt()/(0.96*float(MAX_TRANSPARENCY)) |
515 | - ps.Publisher().sendMessage('Set surface transparency', | |
515 | + Publisher.sendMessage('Set surface transparency', | |
516 | 516 | (self.combo_surface_name.GetSelection(), |
517 | 517 | transparency)) |
518 | 518 | ... | ... |
invesalius/gui/task_tools.py
... | ... | @@ -21,7 +21,7 @@ import wx |
21 | 21 | import wx.lib.embeddedimage as emb |
22 | 22 | import wx.lib.hyperlink as hl |
23 | 23 | import wx.lib.platebtn as pbtn |
24 | -import wx.lib.pubsub as ps | |
24 | +from wx.lib.pubsub import pub as Publisher | |
25 | 25 | |
26 | 26 | import constants |
27 | 27 | |
... | ... | @@ -121,11 +121,11 @@ class InnerTaskPanel(wx.Panel): |
121 | 121 | print "TODO: Send Signal - Add text annotation (both 2d and 3d)" |
122 | 122 | |
123 | 123 | def OnLinkLinearMeasure(self): |
124 | - ps.Publisher().sendMessage('Enable style', | |
124 | + Publisher.sendMessage('Enable style', | |
125 | 125 | constants.STATE_MEASURE_DISTANCE) |
126 | 126 | |
127 | 127 | def OnLinkAngularMeasure(self): |
128 | - ps.Publisher().sendMessage('Enable style', | |
128 | + Publisher.sendMessage('Enable style', | |
129 | 129 | constants.STATE_MEASURE_ANGLE) |
130 | 130 | |
131 | 131 | def OnButton(self, evt): | ... | ... |
invesalius/gui/widgets/slice_menu.py
... | ... | @@ -22,7 +22,7 @@ |
22 | 22 | import sys |
23 | 23 | |
24 | 24 | import wx |
25 | -import wx.lib.pubsub as ps | |
25 | +from wx.lib.pubsub import pub as Publisher | |
26 | 26 | import constants as const |
27 | 27 | |
28 | 28 | class SliceMenu(wx.Menu): |
... | ... | @@ -116,8 +116,8 @@ class SliceMenu(wx.Menu): |
116 | 116 | self.__bind_events() |
117 | 117 | |
118 | 118 | def __bind_events(self): |
119 | - ps.Publisher().subscribe(self.CheckWindowLevelOther, 'Check window and level other') | |
120 | - ps.Publisher().subscribe(self.FirstItemSelect, 'Select first item from slice menu') | |
119 | + Publisher.subscribe(self.CheckWindowLevelOther, 'Check window and level other') | |
120 | + Publisher.subscribe(self.FirstItemSelect, 'Select first item from slice menu') | |
121 | 121 | |
122 | 122 | def FirstItemSelect(self, pusub_evt): |
123 | 123 | |
... | ... | @@ -143,28 +143,28 @@ class SliceMenu(wx.Menu): |
143 | 143 | if(key in const.WINDOW_LEVEL.keys()): |
144 | 144 | print "a" |
145 | 145 | window, level = const.WINDOW_LEVEL[key] |
146 | - ps.Publisher().sendMessage('Bright and contrast adjustment image', | |
146 | + Publisher.sendMessage('Bright and contrast adjustment image', | |
147 | 147 | (window, level)) |
148 | - ps.Publisher().sendMessage('Update window level value',\ | |
148 | + Publisher.sendMessage('Update window level value',\ | |
149 | 149 | (window, level)) |
150 | - ps.Publisher().sendMessage('Update window and level text',\ | |
150 | + Publisher.sendMessage('Update window and level text',\ | |
151 | 151 | "WL: %d WW: %d"%(level, window)) |
152 | - ps.Publisher().sendMessage('Update slice viewer') | |
152 | + Publisher.sendMessage('Update slice viewer') | |
153 | 153 | |
154 | 154 | #Necessary update the slice plane in the volume case exists |
155 | - ps.Publisher().sendMessage('Render volume viewer') | |
155 | + Publisher.sendMessage('Render volume viewer') | |
156 | 156 | |
157 | 157 | elif(key in const.SLICE_COLOR_TABLE.keys()): |
158 | 158 | print "b" |
159 | 159 | values = const.SLICE_COLOR_TABLE[key] |
160 | - ps.Publisher().sendMessage('Change colour table from background image', values) | |
161 | - ps.Publisher().sendMessage('Update slice viewer') | |
160 | + Publisher.sendMessage('Change colour table from background image', values) | |
161 | + Publisher.sendMessage('Update slice viewer') | |
162 | 162 | |
163 | 163 | elif(key in const.IMAGE_TILING.keys()): |
164 | 164 | print "c" |
165 | 165 | values = const.IMAGE_TILING[key] |
166 | - ps.Publisher().sendMessage('Set slice viewer layout', values) | |
167 | - ps.Publisher().sendMessage('Update slice viewer') | |
166 | + Publisher.sendMessage('Set slice viewer layout', values) | |
167 | + Publisher.sendMessage('Update slice viewer') | |
168 | 168 | |
169 | 169 | evt.Skip() |
170 | 170 | ... | ... |
invesalius/invesalius.py
... | ... | @@ -34,8 +34,11 @@ else: |
34 | 34 | wxversion.select('2.8-unicode', optionsRequired=True) |
35 | 35 | |
36 | 36 | import wx |
37 | -from wx.lib.pubsub import setupv1 | |
38 | -import wx.lib.pubsub as ps | |
37 | +#from wx.lib.pubsub import setupv1 #new wx | |
38 | +from wx.lib.pubsub import setuparg1# as psv1 | |
39 | +#from wx.lib.pubsub import Publisher | |
40 | +#import wx.lib.pubsub as ps | |
41 | +from wx.lib.pubsub import pub as Publisher | |
39 | 42 | import wx.lib.agw.advancedsplash as agw |
40 | 43 | |
41 | 44 | if sys.platform == 'linux2': |
... | ... | @@ -71,7 +74,7 @@ class InVesalius(wx.App): |
71 | 74 | Open drag & drop files under darwin |
72 | 75 | """ |
73 | 76 | path = os.path.abspath(filename) |
74 | - ps.Publisher().sendMessage('Open project', path) | |
77 | + Publisher.sendMessage('Open project', path) | |
75 | 78 | |
76 | 79 | # ------------------------------------------------------------------ |
77 | 80 | |
... | ... | @@ -215,13 +218,13 @@ def parse_comand_line(): |
215 | 218 | |
216 | 219 | # If debug argument... |
217 | 220 | if options.debug: |
218 | - ps.Publisher().subscribe(print_events, '') | |
221 | + Publisher.subscribe(print_events, '') | |
219 | 222 | session.debug = 1 |
220 | 223 | |
221 | 224 | # If import DICOM argument... |
222 | 225 | if options.dicom_dir: |
223 | 226 | import_dir = options.dicom_dir |
224 | - ps.Publisher().sendMessage('Import directory', import_dir) | |
227 | + Publisher().sendMessage('Import directory', import_dir) | |
225 | 228 | return True |
226 | 229 | |
227 | 230 | # Check if there is a file path somewhere in what the user wrote |
... | ... | @@ -233,7 +236,7 @@ def parse_comand_line(): |
233 | 236 | file = args[i] |
234 | 237 | if os.path.isfile(file): |
235 | 238 | path = os.path.abspath(file) |
236 | - ps.Publisher().sendMessage('Open project', path) | |
239 | + Publisher.sendMessage('Open project', path) | |
237 | 240 | i = 0 |
238 | 241 | return True |
239 | 242 | return False |
... | ... | @@ -255,7 +258,8 @@ def main(): |
255 | 258 | |
256 | 259 | if __name__ == '__main__': |
257 | 260 | # Needed in win 32 exe |
258 | - if hasattr(sys,"frozen") and sys.frozen == "windows_exe": | |
261 | + if hasattr(sys,"frozen") and (sys.frozen == "windows_exe"\ | |
262 | + or sys.frozen == "console_exe"): | |
259 | 263 | multiprocessing.freeze_support() |
260 | 264 | |
261 | 265 | #Click in the .inv3 file support | ... | ... |
invesalius/presets.py
... | ... | @@ -19,7 +19,7 @@ |
19 | 19 | import os |
20 | 20 | import plistlib |
21 | 21 | |
22 | -import wx.lib.pubsub as ps | |
22 | +from wx.lib.pubsub import pub as Publisher | |
23 | 23 | |
24 | 24 | from utils import TwoWaysDictionary |
25 | 25 | |
... | ... | @@ -64,7 +64,7 @@ class Presets(): |
64 | 64 | self.__bind_events() |
65 | 65 | |
66 | 66 | def __bind_events(self): |
67 | - ps.Publisher.subscribe(self.UpdateThresholdModes, | |
67 | + Publisher.subscribe(self.UpdateThresholdModes, | |
68 | 68 | 'Update threshold limits list') |
69 | 69 | |
70 | 70 | def UpdateThresholdModes(self, evt): |
... | ... | @@ -93,7 +93,7 @@ class Presets(): |
93 | 93 | |
94 | 94 | presets[key] = (t_min, t_max) |
95 | 95 | |
96 | - ps.Publisher().sendMessage('Update threshold limits', (thresh_min, | |
96 | + Publisher.sendMessage('Update threshold limits', (thresh_min, | |
97 | 97 | thresh_max)) |
98 | 98 | |
99 | 99 | def SavePlist(self, filename): | ... | ... |
invesalius/project.py
... | ... | @@ -26,7 +26,7 @@ import tarfile |
26 | 26 | import tempfile |
27 | 27 | |
28 | 28 | import wx |
29 | -import wx.lib.pubsub as ps | |
29 | +from wx.lib.pubsub import pub as Publisher | |
30 | 30 | import vtk |
31 | 31 | |
32 | 32 | import constants as const |
... | ... | @@ -184,7 +184,7 @@ class Project(object): |
184 | 184 | def SetRaycastPreset(self, label): |
185 | 185 | path = os.path.join(RAYCASTING_PRESETS_DIRECTORY, label + '.plist') |
186 | 186 | preset = plistlib.readPlist(path) |
187 | - ps.Publisher.sendMessage('Set raycasting preset', preset) | |
187 | + Publisher.sendMessage('Set raycasting preset', preset) | |
188 | 188 | |
189 | 189 | def GetMeasuresDict(self): |
190 | 190 | measures = {} | ... | ... |
invesalius/reader/dicom_reader.py
... | ... | @@ -27,7 +27,7 @@ from multiprocessing import cpu_count |
27 | 27 | import vtk |
28 | 28 | import vtkgdcm |
29 | 29 | import gdcm |
30 | -import wx.lib.pubsub as ps | |
30 | +from wx.lib.pubsub import pub as Publisher | |
31 | 31 | |
32 | 32 | import constants as const |
33 | 33 | import dicom |
... | ... | @@ -317,7 +317,7 @@ def GetDicomGroups(directory, recursive=True): |
317 | 317 | |
318 | 318 | class ProgressDicomReader: |
319 | 319 | def __init__(self): |
320 | - ps.Publisher().subscribe(self.CancelLoad, "Cancel DICOM load") | |
320 | + Publisher.subscribe(self.CancelLoad, "Cancel DICOM load") | |
321 | 321 | |
322 | 322 | def CancelLoad(self, evt_pubsub): |
323 | 323 | self.running = False |
... | ... | @@ -332,10 +332,10 @@ class ProgressDicomReader: |
332 | 332 | self.GetDicomGroups(path,recursive) |
333 | 333 | |
334 | 334 | def UpdateLoadFileProgress(self,cont_progress): |
335 | - ps.Publisher().sendMessage("Update dicom load", cont_progress) | |
335 | + Publisher.sendMessage("Update dicom load", cont_progress) | |
336 | 336 | |
337 | 337 | def EndLoadFile(self, patient_list): |
338 | - ps.Publisher().sendMessage("End dicom load", patient_list) | |
338 | + Publisher.sendMessage("End dicom load", patient_list) | |
339 | 339 | |
340 | 340 | def GetDicomGroups(self, path, recursive): |
341 | 341 | ... | ... |
invesalius/session.py
... | ... | @@ -24,7 +24,8 @@ import sys |
24 | 24 | from threading import Thread |
25 | 25 | import time |
26 | 26 | |
27 | -import wx.lib.pubsub as ps | |
27 | +#import wx.lib.pubsub as ps | |
28 | +from wx.lib.pubsub import pub as Publisher | |
28 | 29 | |
29 | 30 | from utils import Singleton, debug |
30 | 31 | |
... | ... | @@ -38,7 +39,7 @@ class Session(object): |
38 | 39 | |
39 | 40 | ws = self.ws = WriteSession(self) |
40 | 41 | ws.start() |
41 | - ps.Publisher().subscribe(self.StopRecording, "Stop Config Recording") | |
42 | + Publisher.subscribe(self.StopRecording, "Stop Config Recording") | |
42 | 43 | |
43 | 44 | def CreateItens(self): |
44 | 45 | import constants as const |
... | ... | @@ -117,7 +118,7 @@ class Session(object): |
117 | 118 | def CreateProject(self, filename): |
118 | 119 | import constants as const |
119 | 120 | debug("Session.CreateProject") |
120 | - ps.Publisher().sendMessage('Begin busy cursor') | |
121 | + Publisher.sendMessage('Begin busy cursor') | |
121 | 122 | # Set session info |
122 | 123 | self.project_path = (self.tempdir, filename) |
123 | 124 | self.project_status = const.PROJ_NEW | ... | ... |