Commit 2f686c76354dd4c43f86ce6904c80537cb0bc9da
1 parent
2c5267ea
Exists in
master
wx.lib.pubsub is deprecated because it's being removed from wx so InVesalius is …
…using pubsub directly from PubSub lib
Showing
49 changed files
with
76 additions
and
87 deletions
Show diff stats
app.py
| ... | ... | @@ -46,11 +46,8 @@ try: |
| 46 | 46 | from wx.adv import SplashScreen |
| 47 | 47 | except ImportError: |
| 48 | 48 | from wx import SplashScreen |
| 49 | -#from wx.lib.pubsub import setupv1 #new wx | |
| 50 | -# from wx.lib.pubsub import setuparg1# as psv1 | |
| 51 | -#from wx.lib.pubsub import Publisher | |
| 52 | -#import wx.lib.pubsub as ps | |
| 53 | -from wx.lib.pubsub import pub as Publisher | |
| 49 | + | |
| 50 | +from pubsub import pub as Publisher | |
| 54 | 51 | |
| 55 | 52 | #import wx.lib.agw.advancedsplash as agw |
| 56 | 53 | #if sys.platform.startswith('linux'): | ... | ... |
docs/devel/example_pubsub.py
| ... | ... | @@ -3,60 +3,58 @@ |
| 3 | 3 | # More information about this design pattern can be found at: |
| 4 | 4 | # http://wiki.wxpython.org/ModelViewController |
| 5 | 5 | # http://wiki.wxpython.org/PubSub |
| 6 | -import wx.lib.pubsub as ps | |
| 6 | +from pubsub import pub as Publisher | |
| 7 | + | |
| 7 | 8 | # The maintainer of Pubsub module is Oliver Schoenborn. |
| 8 | 9 | # Since the end of 2006 Pubsub is now maintained separately on SourceForge at: |
| 9 | 10 | # http://pubsub.sourceforge.net/ |
| 10 | 11 | |
| 11 | -class Student(): | |
| 12 | + | |
| 13 | +class Student: | |
| 12 | 14 | def __init__(self, name): |
| 13 | 15 | self.name = name |
| 14 | 16 | self.mood = ":|" |
| 15 | 17 | self.__bind_events() |
| 16 | - | |
| 18 | + | |
| 17 | 19 | def __bind_events(self): |
| 18 | - ps.Publisher().subscribe(self.ReceiveProject, | |
| 19 | - 'Set Student Project') | |
| 20 | - ps.Publisher().subscribe(self.ReceiveGrade, | |
| 21 | - 'Set Student Grade') | |
| 20 | + Publisher.subscribe(self.ReceiveProject, "Set Student Project") | |
| 21 | + Publisher.subscribe(self.ReceiveGrade, "Set Student Grade") | |
| 22 | 22 | |
| 23 | 23 | def ReceiveProject(self, pubsub_evt): |
| 24 | 24 | projects_dict = pubsub_evt.data |
| 25 | 25 | self.project = projects_dict[self.name] |
| 26 | - print "%s: I've received the project %s" %(self.name, | |
| 27 | - self.project) | |
| 28 | - | |
| 26 | + print "%s: I've received the project %s" % (self.name, self.project) | |
| 27 | + | |
| 29 | 28 | def ReceiveGrade(self, pubsub_evt): |
| 30 | 29 | grades_dict = pubsub_evt.data |
| 31 | 30 | self.grade = grades_dict[self.name] |
| 32 | - if (self.grade > 6): | |
| 31 | + if self.grade > 6: | |
| 33 | 32 | self.mood = ":)" |
| 34 | 33 | else: |
| 35 | 34 | self.mood = ":(" |
| 36 | - print "%s: I've received the grade %d %s" %(self.name, | |
| 37 | - self.grade, | |
| 38 | - self.mood) | |
| 39 | - | |
| 40 | -class Teacher(): | |
| 35 | + print "%s: I've received the grade %d %s" % (self.name, self.grade, self.mood) | |
| 36 | + | |
| 37 | + | |
| 38 | +class Teacher: | |
| 41 | 39 | def __init__(self, name, course): |
| 42 | 40 | self.name = name |
| 43 | 41 | self.course = course |
| 44 | 42 | |
| 45 | 43 | def SendMessage(self): |
| 46 | - print "%s: Telling students the projects" %(self.name) | |
| 47 | - ps.Publisher().sendMessage('Set Student Project', | |
| 48 | - self.course.projects_dict) | |
| 49 | - | |
| 50 | - print "\n%s: Telling students the grades" %(self.name) | |
| 51 | - ps.Publisher().sendMessage('Set Student Grade', | |
| 52 | - self.course.grades_dict) | |
| 53 | - | |
| 54 | -class Course(): | |
| 44 | + print "%s: Telling students the projects" % (self.name) | |
| 45 | + Publisher.sendMessage("Set Student Project", self.course.projects_dict) | |
| 46 | + | |
| 47 | + print "\n%s: Telling students the grades" % (self.name) | |
| 48 | + Publisher.sendMessage("Set Student Grade", self.course.grades_dict) | |
| 49 | + | |
| 50 | + | |
| 51 | +class Course: | |
| 55 | 52 | def __init__(self, subject): |
| 56 | 53 | self.subject = subject |
| 57 | 54 | self.grades_dict = {} |
| 58 | 55 | self.projects_dict = {} |
| 59 | 56 | |
| 57 | + | |
| 60 | 58 | # Create students: |
| 61 | 59 | s1 = Student("Coelho") |
| 62 | 60 | s2 = Student("Victor") |
| ... | ... | @@ -64,17 +62,11 @@ s3 = Student("Thomaz") |
| 64 | 62 | |
| 65 | 63 | # Create subject: |
| 66 | 64 | cs102 = Course("InVesalius") |
| 67 | -cs102.projects_dict = {"Coelho":"wxPython", | |
| 68 | - "Victor":"VTK", | |
| 69 | - "Thomaz":"PIL"} | |
| 70 | -cs102.grades_dict = {"Coelho":7, | |
| 71 | - "Victor":6.5, | |
| 72 | - "Thomaz":4} | |
| 65 | +cs102.projects_dict = {"Coelho": "wxPython", "Victor": "VTK", "Thomaz": "PIL"} | |
| 66 | +cs102.grades_dict = {"Coelho": 7, "Victor": 6.5, "Thomaz": 4} | |
| 73 | 67 | |
| 74 | 68 | # Create teacher: |
| 75 | 69 | andre = Teacher("Andre", cs102) |
| 76 | 70 | |
| 77 | 71 | |
| 78 | - | |
| 79 | - | |
| 80 | 72 | andre.SendMessage() | ... | ... |
docs/devel/example_singleton_pubsub.py
invesalius/control.py
invesalius/data/coordinates.py
invesalius/data/coregistration.py
| ... | ... | @@ -22,7 +22,7 @@ from time import sleep |
| 22 | 22 | |
| 23 | 23 | from numpy import asmatrix, mat, degrees, radians, identity |
| 24 | 24 | import wx |
| 25 | -from wx.lib.pubsub import pub as Publisher | |
| 25 | +from pubsub import pub as Publisher | |
| 26 | 26 | |
| 27 | 27 | import invesalius.data.coordinates as dco |
| 28 | 28 | import invesalius.data.transformations as tr | ... | ... |
invesalius/data/editor.py
invesalius/data/geometry.py
invesalius/data/imagedata_utils.py
invesalius/data/mask.py
invesalius/data/measures.py
invesalius/data/polydata_utils.py
invesalius/data/record_coords.py
| ... | ... | @@ -23,7 +23,7 @@ import time |
| 23 | 23 | import wx |
| 24 | 24 | from numpy import array, savetxt, hstack,vstack, asarray |
| 25 | 25 | import invesalius.gui.dialogs as dlg |
| 26 | -from wx.lib.pubsub import pub as Publisher | |
| 26 | +from pubsub import pub as Publisher | |
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | class Record(threading.Thread): | ... | ... |
invesalius/data/slice_.py
| ... | ... | @@ -23,7 +23,7 @@ import numpy as np |
| 23 | 23 | import vtk |
| 24 | 24 | from scipy import ndimage |
| 25 | 25 | from six import with_metaclass |
| 26 | -from wx.lib.pubsub import pub as Publisher | |
| 26 | +from pubsub import pub as Publisher | |
| 27 | 27 | |
| 28 | 28 | import invesalius.constants as const |
| 29 | 29 | import invesalius.data.converters as converters | ... | ... |
invesalius/data/styles.py
| ... | ... | @@ -32,7 +32,7 @@ from imageio import imsave |
| 32 | 32 | from scipy.ndimage import generate_binary_structure, watershed_ift |
| 33 | 33 | from six import with_metaclass |
| 34 | 34 | from skimage.morphology import watershed |
| 35 | -from wx.lib.pubsub import pub as Publisher | |
| 35 | +from pubsub import pub as Publisher | |
| 36 | 36 | |
| 37 | 37 | import invesalius.constants as const |
| 38 | 38 | import invesalius.data.converters as converters | ... | ... |
invesalius/data/surface.py
invesalius/data/trigger.py
invesalius/data/viewer_slice.py
| ... | ... | @@ -31,7 +31,7 @@ from vtk.wx.wxVTKRenderWindowInteractor import wxVTKRenderWindowInteractor |
| 31 | 31 | import invesalius.data.styles as styles |
| 32 | 32 | import wx |
| 33 | 33 | import sys |
| 34 | -from wx.lib.pubsub import pub as Publisher | |
| 34 | +from pubsub import pub as Publisher | |
| 35 | 35 | |
| 36 | 36 | try: |
| 37 | 37 | from agw import floatspin as FS | ... | ... |
invesalius/data/viewer_volume.py
| ... | ... | @@ -28,7 +28,7 @@ from numpy.core.umath_tests import inner1d |
| 28 | 28 | import wx |
| 29 | 29 | import vtk |
| 30 | 30 | from vtk.wx.wxVTKRenderWindowInteractor import wxVTKRenderWindowInteractor |
| 31 | -from wx.lib.pubsub import pub as Publisher | |
| 31 | +from pubsub import pub as Publisher | |
| 32 | 32 | import random |
| 33 | 33 | from scipy.spatial import distance |
| 34 | 34 | ... | ... |
invesalius/data/volume.py
invesalius/data/vtk_utils.py
invesalius/gui/bitmap_preview_panel.py
| ... | ... | @@ -5,7 +5,7 @@ import numpy |
| 5 | 5 | |
| 6 | 6 | from vtk.util import numpy_support |
| 7 | 7 | from vtk.wx.wxVTKRenderWindowInteractor import wxVTKRenderWindowInteractor |
| 8 | -from wx.lib.pubsub import pub as Publisher | |
| 8 | +from pubsub import pub as Publisher | |
| 9 | 9 | |
| 10 | 10 | import invesalius.constants as const |
| 11 | 11 | import invesalius.data.vtk_utils as vtku | ... | ... |
invesalius/gui/brain_seg_dialog.py
invesalius/gui/data_notebook.py
| ... | ... | @@ -34,7 +34,7 @@ except ImportError: |
| 34 | 34 | import wx.lib.flatnotebook as fnb |
| 35 | 35 | |
| 36 | 36 | import wx.lib.platebtn as pbtn |
| 37 | -from wx.lib.pubsub import pub as Publisher | |
| 37 | +from pubsub import pub as Publisher | |
| 38 | 38 | |
| 39 | 39 | import invesalius.constants as const |
| 40 | 40 | import invesalius.data.slice_ as slice_ | ... | ... |
invesalius/gui/default_tasks.py
| ... | ... | @@ -22,7 +22,7 @@ try: |
| 22 | 22 | import wx.lib.agw.foldpanelbar as fpb |
| 23 | 23 | except ModuleNotFoundError: |
| 24 | 24 | import wx.lib.foldpanelbar as fpb |
| 25 | -from wx.lib.pubsub import pub as Publisher | |
| 25 | +from pubsub import pub as Publisher | |
| 26 | 26 | |
| 27 | 27 | import invesalius.constants as const |
| 28 | 28 | import invesalius.gui.data_notebook as nb | ... | ... |
invesalius/gui/default_viewers.py
| ... | ... | @@ -21,7 +21,7 @@ import os |
| 21 | 21 | |
| 22 | 22 | import wx |
| 23 | 23 | import wx.lib.agw.fourwaysplitter as fws |
| 24 | -from wx.lib.pubsub import pub as Publisher | |
| 24 | +from pubsub import pub as Publisher | |
| 25 | 25 | |
| 26 | 26 | import invesalius.data.viewer_slice as slice_viewer |
| 27 | 27 | import invesalius.data.viewer_volume as volume_viewer |
| ... | ... | @@ -316,7 +316,7 @@ class VolumeInteraction(wx.Panel): |
| 316 | 316 | |
| 317 | 317 | import wx.lib.platebtn as pbtn |
| 318 | 318 | import wx.lib.buttons as btn |
| 319 | -import wx.lib.pubsub as ps | |
| 319 | +from pubsub import pub as Publisher | |
| 320 | 320 | import wx.lib.colourselect as csel |
| 321 | 321 | |
| 322 | 322 | [BUTTON_RAYCASTING, BUTTON_VIEW, BUTTON_SLICE_PLANE, BUTTON_3D_STEREO, BUTTON_TARGET] = [wx.NewId() for num in range(5)] | ... | ... |
invesalius/gui/dialogs.py
| ... | ... | @@ -46,7 +46,7 @@ from vtk.wx.wxVTKRenderWindowInteractor import wxVTKRenderWindowInteractor |
| 46 | 46 | from wx.lib import masked |
| 47 | 47 | from wx.lib.agw import floatspin |
| 48 | 48 | from wx.lib.wordwrap import wordwrap |
| 49 | -from wx.lib.pubsub import pub as Publisher | |
| 49 | +from pubsub import pub as Publisher | |
| 50 | 50 | |
| 51 | 51 | try: |
| 52 | 52 | from wx.adv import AboutDialogInfo, AboutBox | ... | ... |
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 | -from wx.lib.pubsub import pub as Publisher | |
| 32 | +from pubsub import pub as Publisher | |
| 33 | 33 | |
| 34 | 34 | import invesalius.constants as const |
| 35 | 35 | import invesalius.reader.dicom_reader as dicom_reader | ... | ... |
invesalius/gui/frame.py
| ... | ... | @@ -41,7 +41,7 @@ import wx.lib.agw.toasterbox as TB |
| 41 | 41 | import wx.lib.popupctl as pc |
| 42 | 42 | from invesalius import inv_paths |
| 43 | 43 | from wx.lib.agw.aui.auibar import AUI_TB_PLAIN_BACKGROUND, AuiToolBar |
| 44 | -from wx.lib.pubsub import pub as Publisher | |
| 44 | +from pubsub import pub as Publisher | |
| 45 | 45 | |
| 46 | 46 | try: |
| 47 | 47 | from wx.adv import TaskBarIcon as wx_TaskBarIcon | ... | ... |
invesalius/gui/import_bitmap_panel.py
| ... | ... | @@ -18,7 +18,7 @@ |
| 18 | 18 | #-------------------------------------------------------------------------- |
| 19 | 19 | import wx |
| 20 | 20 | import wx.gizmos as gizmos |
| 21 | -from wx.lib.pubsub import pub as Publisher | |
| 21 | +from pubsub import pub as Publisher | |
| 22 | 22 | import wx.lib.splitter as spl |
| 23 | 23 | |
| 24 | 24 | import invesalius.constants as const | ... | ... |
invesalius/gui/import_network_panel.py
invesalius/gui/import_panel.py
| ... | ... | @@ -18,7 +18,7 @@ |
| 18 | 18 | #-------------------------------------------------------------------------- |
| 19 | 19 | import wx |
| 20 | 20 | import wx.gizmos as gizmos |
| 21 | -from wx.lib.pubsub import pub as Publisher | |
| 21 | +from pubsub import pub as Publisher | |
| 22 | 22 | import wx.lib.splitter as spl |
| 23 | 23 | |
| 24 | 24 | import invesalius.constants as const | ... | ... |
invesalius/gui/preferences.py
| ... | ... | @@ -2,7 +2,7 @@ import invesalius.constants as const |
| 2 | 2 | import invesalius.session as ses |
| 3 | 3 | import wx |
| 4 | 4 | from invesalius.gui.language_dialog import ComboBoxLanguage |
| 5 | -from wx.lib.pubsub import pub as Publisher | |
| 5 | +from pubsub import pub as Publisher | |
| 6 | 6 | |
| 7 | 7 | try: |
| 8 | 8 | from agw import flatnotebook as fnb | ... | ... |
invesalius/gui/task_exporter.py
| ... | ... | @@ -29,7 +29,7 @@ except ImportError: |
| 29 | 29 | import wx.lib.hyperlink as hl |
| 30 | 30 | |
| 31 | 31 | import wx.lib.platebtn as pbtn |
| 32 | -from wx.lib.pubsub import pub as Publisher | |
| 32 | +from pubsub import pub as Publisher | |
| 33 | 33 | |
| 34 | 34 | import invesalius.constants as const |
| 35 | 35 | import invesalius.gui.dialogs as dlg | ... | ... |
invesalius/gui/task_importer.py
| ... | ... | @@ -26,7 +26,7 @@ except ImportError: |
| 26 | 26 | import wx.lib.hyperlink as hl |
| 27 | 27 | import wx.lib.platebtn as pbtn |
| 28 | 28 | |
| 29 | -from wx.lib.pubsub import pub as Publisher | |
| 29 | +from pubsub import pub as Publisher | |
| 30 | 30 | |
| 31 | 31 | import invesalius.constants as const |
| 32 | 32 | import invesalius.gui.dialogs as dlg | ... | ... |
invesalius/gui/task_navigator.py
| ... | ... | @@ -32,7 +32,7 @@ except ImportError: |
| 32 | 32 | import wx.lib.foldpanelbar as fpb |
| 33 | 33 | |
| 34 | 34 | import wx.lib.masked.numctrl |
| 35 | -from wx.lib.pubsub import pub as Publisher | |
| 35 | +from pubsub import pub as Publisher | |
| 36 | 36 | import wx.lib.colourselect as csel |
| 37 | 37 | import wx.lib.platebtn as pbtn |
| 38 | 38 | ... | ... |
invesalius/gui/task_slice.py
| ... | ... | @@ -31,7 +31,7 @@ except ImportError: |
| 31 | 31 | |
| 32 | 32 | import wx.lib.platebtn as pbtn |
| 33 | 33 | import wx.lib.colourselect as csel |
| 34 | -from wx.lib.pubsub import pub as Publisher | |
| 34 | +from pubsub import pub as Publisher | |
| 35 | 35 | |
| 36 | 36 | import invesalius.data.mask as mask |
| 37 | 37 | import invesalius.data.slice_ as slice_ | ... | ... |
invesalius/gui/task_surface.py
| ... | ... | @@ -28,7 +28,7 @@ except ImportError: |
| 28 | 28 | import wx.lib.hyperlink as hl |
| 29 | 29 | import wx.lib.foldpanelbar as fpb |
| 30 | 30 | |
| 31 | -from wx.lib.pubsub import pub as Publisher | |
| 31 | +from pubsub import pub as Publisher | |
| 32 | 32 | import wx.lib.colourselect as csel |
| 33 | 33 | |
| 34 | 34 | import invesalius.constants as const | ... | ... |
invesalius/gui/task_tools.py
| ... | ... | @@ -27,7 +27,7 @@ except ImportError: |
| 27 | 27 | import wx.lib.hyperlink as hl |
| 28 | 28 | |
| 29 | 29 | import wx.lib.platebtn as pbtn |
| 30 | -from wx.lib.pubsub import pub as Publisher | |
| 30 | +from pubsub import pub as Publisher | |
| 31 | 31 | |
| 32 | 32 | import invesalius.constants as constants |
| 33 | 33 | import invesalius.constants as const | ... | ... |
invesalius/gui/widgets/canvas_renderer.py
invesalius/gui/widgets/clut_raycasting.py
invesalius/gui/widgets/slice_menu.py
invesalius/plugins.py
invesalius/presets.py
invesalius/project.py
| ... | ... | @@ -30,7 +30,8 @@ import numpy as np |
| 30 | 30 | import vtk |
| 31 | 31 | import wx |
| 32 | 32 | from six import with_metaclass |
| 33 | -from wx.lib.pubsub import pub as Publisher | |
| 33 | + | |
| 34 | +from pubsub import pub as Publisher | |
| 34 | 35 | |
| 35 | 36 | import invesalius.constants as const |
| 36 | 37 | import invesalius.data.polydata_utils as pu | ... | ... |
invesalius/reader/bitmap_reader.py
invesalius/reader/dicom_reader.py
| ... | ... | @@ -28,7 +28,7 @@ import gdcm |
| 28 | 28 | # Not showing GDCM warning and debug messages |
| 29 | 29 | gdcm.Trace_DebugOff() |
| 30 | 30 | gdcm.Trace_WarningOff() |
| 31 | -from wx.lib.pubsub import pub as Publisher | |
| 31 | +from pubsub import pub as Publisher | |
| 32 | 32 | |
| 33 | 33 | import invesalius.constants as const |
| 34 | 34 | import invesalius.reader.dicom as dicom | ... | ... |
invesalius/session.py
invesalius/style.py