[med-svn] [dicompyler] 01/01: More patches to finally work with wx 3.0

Andreas Tille tille at debian.org
Mon Sep 18 07:57:01 UTC 2017


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository dicompyler.

commit 08e0e30cfb5eab52215e6dcd7a49fa7562290a9d
Author: Andreas Tille <tille at debian.org>
Date:   Mon Sep 18 09:56:51 2017 +0200

    More patches to finally work with wx 3.0
---
 debian/changelog                       |   7 +
 debian/patches/more_wx30_patches.patch | 374 +++++++++++++++++++++++++++++++++
 debian/patches/series                  |   1 +
 3 files changed, 382 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 1c3291a..c212ffe 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+dicompyler (0.4.2-5) UNRELEASED; urgency=medium
+
+  * Team upload
+  * More patches to finally work with wx 3.0
+
+ -- Vojtech Kulvait <kulvait at gmail.com>  Mon, 18 Sep 2017 09:54:37 +0200
+
 dicompyler (0.4.2-4) unstable; urgency=medium
 
   * Fix Open Patient dialog (Thanks for the patch to Vojtech Kulvait
diff --git a/debian/patches/more_wx30_patches.patch b/debian/patches/more_wx30_patches.patch
new file mode 100644
index 0000000..955cb3b
--- /dev/null
+++ b/debian/patches/more_wx30_patches.patch
@@ -0,0 +1,374 @@
+Author: Vojtech Kulvait <kulvait at gmail.com>
+Last-Update: Mon, 18 Sep 2017 00:27:42 +0200
+Bug-Debian: https://bugs.debian.org/854837
+Description: More wx3.0 patches to make dicompyler run
+
+--- a/dicompyler/baseplugins/2dview.py
++++ b/dicompyler/baseplugins/2dview.py
+@@ -10,9 +10,7 @@
+ 
+ import wx
+ from wx.xrc import XmlResource, XRCCTRL, XRCID
+-import wx.lib.pubsub.setuparg1
+-import wx.lib.pubsub.core
+-pub = wx.lib.pubsub.core.Publisher()
++from wx.lib.pubsub import pub
+ from matplotlib import _cntr as cntr
+ from matplotlib import __version__ as mplversion
+ import numpy as np
+@@ -194,18 +192,18 @@ class plugin2DView(wx.Panel):
+         self.Unbind(wx.EVT_RIGHT_DOWN)
+         self.Unbind(wx.EVT_RIGHT_UP)
+         self.Unbind(wx.EVT_MOTION)
+-        pub.unsubscribe(self.OnKeyDown)
+-        pub.unsubscribe(self.OnMouseWheel)
+-        pub.unsubscribe(self.OnRefresh)
++        pub.unsubscribe(self.OnKeyDown, 'main.key_down')
++        pub.unsubscribe(self.OnMouseWheel, 'main.mousewheel')
++        pub.unsubscribe(self.OnRefresh, '2dview.refresh')
+ 
+     def OnDestroy(self, evt):
+         """Unbind to all events before the plugin is destroyed."""
+ 
+-        pub.unsubscribe(self.OnUpdatePatient)
+-        pub.unsubscribe(self.OnStructureCheck)
+-        pub.unsubscribe(self.OnIsodoseCheck)
+-        pub.unsubscribe(self.OnDrawingPrefsChange)
+-        pub.unsubscribe(self.OnPluginLoaded)
++        pub.unsubscribe(self.OnUpdatePatient, 'patient.updated.parsed_data')
++        pub.unsubscribe(self.OnStructureCheck, 'structures.checked')
++        pub.unsubscribe(self.OnIsodoseCheck, 'isodoses.checked')
++        pub.unsubscribe(self.OnDrawingPrefsChange, '2dview.drawingprefs')
++        pub.unsubscribe(self.OnPluginLoaded, 'plugin.loaded.2dview')
+         self.OnUnfocus()
+ 
+     def OnStructureCheck(self, msg):
+--- a/dicompyler/baseplugins/anonymize.py
++++ b/dicompyler/baseplugins/anonymize.py
+@@ -10,9 +10,7 @@
+ 
+ import wx
+ from wx.xrc import XmlResource, XRCCTRL, XRCID
+-import wx.lib.pubsub.setuparg1
+-import wx.lib.pubsub.core
+-pub = wx.lib.pubsub.core.Publisher()
++from wx.lib.pubsub import pub
+ import os, threading
+ from dicompyler import guiutil, util
+ 
+@@ -39,6 +37,7 @@ class plugin:
+         self.parent = parent
+ 
+         # Set up pubsub
++        print "Subscibing from anonymize"
+         pub.subscribe(self.OnUpdatePatient, 'patient.updated.raw_data')
+ 
+         # Load the XRC file for our gui resources
+@@ -333,4 +332,10 @@ class AnonymizeDialog(wx.Dialog):
+         else:
+             self.privatetags = False
+ 
+-        self.EndModal(wx.ID_OK)
+\ No newline at end of file
++        self.EndModal(wx.ID_OK)
++
++    def OnDestroy(self, evt):
++        """Unbind to all events before the plugin is destroyed."""
++        print "Unsubscribing from anonymize"
++        pub.unsubscribe(self.OnUpdatePatient, 'patient.updated.raw_data')
++
+--- a/dicompyler/baseplugins/dvh.py
++++ b/dicompyler/baseplugins/dvh.py
+@@ -12,9 +12,7 @@
+ 
+ import wx
+ from wx.xrc import XmlResource, XRCCTRL, XRCID
+-import wx.lib.pubsub.setuparg1
+-import wx.lib.pubsub.core
+-pub = wx.lib.pubsub.core.Publisher()
++from wx.lib.pubsub import pub
+ from dicompyler import guiutil, util
+ from dicompyler import dvhdata, guidvh
+ from dicompyler import wxmpl
+@@ -134,9 +132,9 @@ class pluginDVH(wx.Panel):
+     def OnDestroy(self, evt):
+         """Unbind to all events before the plugin is destroyed."""
+ 
+-        pub.unsubscribe(self.OnUpdatePatient)
+-        pub.unsubscribe(self.OnStructureCheck)
+-        pub.unsubscribe(self.OnStructureSelect)
++        pub.unsubscribe(self.OnUpdatePatient, 'patient.updated.parsed_data')
++        pub.unsubscribe(self.OnStructureCheck, 'structures.checked')
++        pub.unsubscribe(self.OnStructureSelect, 'structure.selected')
+ 
+     def OnStructureCheck(self, msg):
+         """When a structure changes, update the interface and plot."""
+--- a/dicompyler/baseplugins/quickopen.py
++++ b/dicompyler/baseplugins/quickopen.py
+@@ -11,9 +11,7 @@
+ import logging
+ logger = logging.getLogger('dicompyler.quickimport')
+ import wx
+-import wx.lib.pubsub.setuparg1
+-import wx.lib.pubsub.core
+-pub = wx.lib.pubsub.core.Publisher()
++from wx.lib.pubsub import pub
+ from dicompyler import dicomparser, util
+ import dicom
+ 
+@@ -99,6 +97,7 @@ class plugin:
+                     pub.sendMessage('preferences.updated.value',
+                         {'general.dicom.import_location':dlg.GetDirectory()})
+                     pub.sendMessage('preferences.requested.values', 'general.dicom')
++        print "Sending message raw data from quickopen"
+         pub.sendMessage('patient.updated.raw_data', patient)
+         dlg.Destroy()
+         return
+--- a/dicompyler/baseplugins/treeview.py
++++ b/dicompyler/baseplugins/treeview.py
+@@ -13,9 +13,7 @@ logger = logging.getLogger('dicompyler.t
+ import threading, Queue
+ import wx
+ from wx.xrc import XmlResource, XRCCTRL, XRCID
+-import wx.lib.pubsub.setuparg1
+-import wx.lib.pubsub.core
+-pub = wx.lib.pubsub.core.Publisher()
++from wx.lib.pubsub import pub
+ from wx.gizmos import TreeListCtrl as tlc
+ from dicompyler import guiutil, util
+ import dicom
+@@ -73,6 +71,7 @@ class pluginTreeView(wx.Panel):
+             self.tlcTreeView.SetFont(font)
+ 
+         # Set up pubsub
++        print "Subscribing from treeview"
+         pub.subscribe(self.OnUpdatePatient, 'patient.updated.raw_data')
+ 
+     def OnUpdatePatient(self, msg):
+@@ -98,8 +97,8 @@ class pluginTreeView(wx.Panel):
+ 
+     def OnDestroy(self, evt):
+         """Unbind to all events before the plugin is destroyed."""
+-
+-        pub.unsubscribe(self.OnUpdatePatient)
++        print "Unsubscribing from treeview"
++        pub.unsubscribe(self.OnUpdatePatient, 'patient.updated.raw_data')
+ 
+     def OnLoadTree(self, event):
+         """Update and load the DICOM tree."""
+--- a/dicompyler/dicomgui.py
++++ b/dicompyler/dicomgui.py
+@@ -15,9 +15,7 @@ logger = logging.getLogger('dicompyler.d
+ import hashlib, os, threading
+ import wx
+ from wx.xrc import *
+-import wx.lib.pubsub.setuparg1
+-import wx.lib.pubsub.core
+-pub = wx.lib.pubsub.core.Publisher()
++from wx.lib.pubsub import pub
+ import numpy as np
+ from dicompyler import dicomparser, dvhdoses, guiutil, util
+ 
+@@ -50,8 +48,6 @@ class DicomImporterDialog(wx.Dialog):
+         pre = wx.PreDialog()
+         # the Create step is done by XRC.
+         self.PostCreate(pre)
+-        self.path = "/tmp"
+-        self.import_location_setting = "Remember Last Used"
+ 
+     def Init(self, res):
+         """Method called after the panel has been initialized."""
+--- a/dicompyler/dvhcalc.py
++++ b/dicompyler/dvhcalc.py
+@@ -12,11 +12,6 @@ import logging
+ logger = logging.getLogger('dicompyler.dvhcalc')
+ import numpy as np
+ import numpy.ma as ma
+-import matplotlib
+-if matplotlib.__version__ > '1.2':
+-    from matplotlib.path import Path as mpl_Path
+-else:
+-    from matplotlib import nxutils as nx
+ 
+ def get_dvh(structure, dose, limit=None, callback=None):
+     """Get a calculated cumulative DVH along with the associated parameters."""
+@@ -104,12 +99,6 @@ def calculate_dvh(structure, dose, limit
+             else:
+                 contour['inside'] = False
+                 for point in contour['data']:
+-                    if matplotlib.__version__ > '1.2':
+-                        if mpl_Path(np.array(contours[largestIndex]['data'])).contains_point(point):
+-                            contour['inside'] = True
+-                            # Assume if one point is inside, all will be inside
+-                            break
+-                    else:
+                         if nx.pnpoly(point[0], point[1],
+                                  np.array(contours[largestIndex]['data'])):
+                             contour['inside'] = True
+@@ -171,9 +160,6 @@ def calculate_contour_areas(plane):
+ def get_contour_mask(doselut, dosegridpoints, contour):
+     """Get the mask for the contour with respect to the dose plane."""
+ 
+-    if matplotlib.__version__ > '1.2':
+-        grid = mpl_Path(contour).contains_points(dosegridpoints)
+-    else:
+         grid = nx.points_inside_poly(dosegridpoints, contour)
+     grid = grid.reshape((len(doselut[1]), len(doselut[0])))
+ 
+--- a/dicompyler/guiutil.py
++++ b/dicompyler/guiutil.py
+@@ -10,9 +10,7 @@
+ import util
+ import wx
+ from wx.xrc import XmlResource, XRCCTRL, XRCID
+-import wx.lib.pubsub.setuparg1
+-import wx.lib.pubsub.core
+-pub = wx.lib.pubsub.core.Publisher()
++from wx.lib.pubsub import pub
+ 
+ def IsMSWindows():
+     """Are we running on Windows?
+--- a/dicompyler/main.py
++++ b/dicompyler/main.py
+@@ -19,10 +19,8 @@ import wx
+ from wx.xrc import *
+ import wx.lib.dialogs, webbrowser
+ # Uncomment line to setup pubsub for frozen targets on wxPython 2.8.11 and above
+-# from wx.lib.pubsub import setupv1
+-import wx.lib.pubsub.setuparg1
+-import wx.lib.pubsub.core
+-pub = wx.lib.pubsub.core.Publisher()
++from wx.lib.pubsub import setuparg1
++from wx.lib.pubsub import pub
+ from dicompyler import guiutil, util
+ from dicompyler import dicomgui, dvhdata, dvhdoses, dvhcalc
+ from dicompyler.dicomparser import DicomParser as dp
+@@ -32,7 +30,6 @@ __version__ = "0.4.2"
+ 
+ class MainFrame(wx.Frame):
+     def __init__(self, parent, id, title, res):
+-
+         # Initialize logging
+         logger = logging.getLogger('dicompyler')
+ 
+@@ -275,6 +272,7 @@ class MainFrame(wx.Frame):
+         self.ptdata = {}
+ 
+         # Set up pubsub
++        print "Subscribing from main"
+         pub.subscribe(self.OnLoadPatientData, 'patient.updated.raw_data')
+         pub.subscribe(self.OnStructureCheck, 'colorcheckbox.checked.structure')
+         pub.subscribe(self.OnStructureUncheck, 'colorcheckbox.unchecked.structure')
+@@ -514,6 +512,7 @@ class MainFrame(wx.Frame):
+             self.dvhs = {}
+ 
+         # Re-publish the raw data
++        print "Sending from main"
+         pub.sendMessage('patient.updated.raw_data', self.ptdata)
+         # Publish the parsed data
+         pub.sendMessage('patient.updated.parsed_data', patient)
+@@ -927,7 +926,6 @@ class MainFrame(wx.Frame):
+ 
+ class dicompyler(wx.App):
+     def OnInit(self):
+-        # no-op in wxPython2.8 and later: wx.InitAllImageHandlers()
+         wx.GetApp().SetAppName("dicompyler")
+ 
+         # Load the XRC file for our gui resources
+--- a/dicompyler/plugin.py
++++ b/dicompyler/plugin.py
+@@ -12,9 +12,7 @@ logger = logging.getLogger('dicompyler.p
+ import imp, os
+ import wx
+ from wx.xrc import *
+-import wx.lib.pubsub.setuparg1
+-import wx.lib.pubsub.core
+-pub = wx.lib.pubsub.core.Publisher()
++from wx.lib.pubsub import pub
+ from dicompyler import guiutil, util
+ 
+ def import_plugins(userpath=None):
+--- a/dicompyler/preferences.py
++++ b/dicompyler/preferences.py
+@@ -10,9 +10,7 @@
+ import os
+ import wx
+ from wx.xrc import *
+-import wx.lib.pubsub.setuparg1
+-import wx.lib.pubsub.core
+-pub = wx.lib.pubsub.core.Publisher()
++from wx.lib.pubsub import pub
+ from dicompyler import guiutil, util
+ 
+ try:
+@@ -230,10 +228,10 @@ class PreferencesDialog(wx.Dialog):
+                     c.SetValue(value)
+                     sizer.Add(c, 0, wx.ALIGN_CENTER)
+                     # Remove the label preceding the checkbox
+-                    t = self.FindWindowById(c.PrevControlId(c.GetId()))
+-                    t.SetLabel('')
++                    #t = self.FindWindowById(c.PrevControlId(c.GetId()))
++                    #t.SetLabel('') ... impossible to execute
+                     # Adjust the sizer preceding the label
+-                    fgsizer.GetItem(0).SetSpacer((20,0))
++                    fgsizer.GetItem(0).AssignSpacer((20,0))
+                     # Add control to the callback dict
+                     self.callbackdict[c] = setting['callback']
+                     self.Bind(wx.EVT_CHECKBOX, self.OnUpdateCheckbox, c)
+@@ -376,9 +374,7 @@ def main():
+ 
+     import tempfile, os
+     import wx
+-    import wx.lib.pubsub.setuparg1
+-    import wx.lib.pubsub.core
+-    pub = wx.lib.pubsub.core.Publisher()
++    from wx.lib.pubsub import pub
+ 
+     app = wx.App(False)
+ 
+--- a/dicompyler/resources/guiutil.xrc
++++ b/dicompyler/resources/guiutil.xrc
+@@ -70,6 +70,6 @@
+     </object>
+     <title>Loading...</title>
+     <centered>1</centered>
+-    <style>wxCAPTION|wxSTAY_ON_TOP|wxDIALOG_MODAL</style>
++    <style>wxCAPTION|wxSTAY_ON_TOP</style>
+   </object>
+ </resource>
+\ No newline at end of file
+--- a/dicompyler/wxmpl.py
++++ b/dicompyler/wxmpl.py
+@@ -21,8 +21,9 @@ import weakref
+ 
+ import matplotlib
+ matplotlib.use('WXAgg')
++#import wxmpl
+ import numpy as np
+-from matplotlib.axes import _process_plot_var_args
++#from matplotlib.axes import _process_plot_var_args
+ from matplotlib.backends.backend_agg import RendererAgg
+ from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
+ from matplotlib.figure import Figure
+@@ -1122,7 +1123,11 @@ class PlotPanel(FigureCanvasWxAgg):
+         # find the toplevel parent window and register an activation event
+         # handler that is keyed to the id of this PlotPanel
+         topwin = toplevel_parent_of_window(self)
+-        topwin.Connect(-1, self.GetId(), wx.wxEVT_ACTIVATE, self.OnActivate)
++        ID = self.GetId() 
++	ID = 100
++        print "self.GetId()", ID
++	#print "topwin.GetId()", topwin.GetID()
++	topwin.Connect(-1, ID, wx.wxEVT_ACTIVATE, self.OnActivate)
+ 
+         wx.EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
+         wx.EVT_WINDOW_DESTROY(self, self.OnDestroy)
+@@ -1422,7 +1427,7 @@ class PlotFrame(wx.Frame):
+         fileName = wx.FileSelector('Save Plot', default_extension='png',
+             wildcard=('Portable Network Graphics (*.png)|*.png|'
+                 + 'Encapsulated Postscript (*.eps)|*.eps|All files (*.*)|*.*'),
+-            parent=self, flags=wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT)
++            parent=self, flags=wx.SAVE|wx.OVERWRITE_PROMPT)
+ 
+         if not fileName:
+             return
diff --git a/debian/patches/series b/debian/patches/series
index 735b5c7..3d2c56f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -6,3 +6,4 @@ allow_pillow_instead_of_pil.patch
 enable_later_versions_of_matplotlib.patch
 fix-xrc-errors.patch
 fix_DicomImporterDialog.patch
+more_wx30_patches.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/dicompyler.git



More information about the debian-med-commit mailing list