[med-svn] [dicompyler] 04/15: New patches
Vojtech Kulvait
kulvait-guest at moszumanska.debian.org
Tue Sep 19 22:19:09 UTC 2017
This is an automated email from the git hooks/post-receive script.
kulvait-guest pushed a commit to branch master
in repository dicompyler.
commit fa56e3878de4c57ec6935cbc5474119478213998
Author: Vojtěch Kulvait <kulvait at gmail.com>
Date: Tue Sep 19 00:15:28 2017 +0200
New patches
---
debian/patches/092017A_fixpubsub.patch | 2 +-
debian/patches/092017B_fiximportasterixs.patch | 2 +-
debian/patches/092017C_fixwx30.patch | 22 +++
debian/patches/092017DEBUG_main.patch | 201 +++++++++++++++++++++++++
debian/patches/092017E_newwxmpl.patch | 157 +++++++++++++++++++
debian/patches/series | 2 +
debian/patches/{series => series_DEBUG} | 1 +
7 files changed, 385 insertions(+), 2 deletions(-)
diff --git a/debian/patches/092017A_fixpubsub.patch b/debian/patches/092017A_fixpubsub.patch
index d226eb1..e9dc02b 100644
--- a/debian/patches/092017A_fixpubsub.patch
+++ b/debian/patches/092017A_fixpubsub.patch
@@ -1,5 +1,5 @@
Author: Vojtěch Kulvait <kulvait at gmail.com>
-Last-Update: Mon Sep 18
+Last-Update: Mon Sep 18 10:00:00 CEST 2017
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=854837
Description: wx.lib.pubsub fix according to https://wxpython.org/Phoenix/docs/html/wx.lib.pubsub.setuparg1.html
diff --git a/debian/patches/092017B_fiximportasterixs.patch b/debian/patches/092017B_fiximportasterixs.patch
index d8ae30e..87c109d 100644
--- a/debian/patches/092017B_fiximportasterixs.patch
+++ b/debian/patches/092017B_fiximportasterixs.patch
@@ -1,5 +1,5 @@
Author: Vojtěch Kulvait <kulvait at gmail.com>
-Last-Update: Mon Sep 18
+Last-Update: Mon Sep 18 15:00:00 CEST 2017
Description: Adds to code redability and warnings when importing only used object from library
Index: dicompyler/dicompyler/dicomgui.py
diff --git a/debian/patches/092017C_fixwx30.patch b/debian/patches/092017C_fixwx30.patch
new file mode 100644
index 0000000..8964f07
--- /dev/null
+++ b/debian/patches/092017C_fixwx30.patch
@@ -0,0 +1,22 @@
+Author: Vojtěch Kulvait <kulvait at gmail.com>
+Last-Update: Mon Sep 18 23:00:00 CEST 2017
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=854837
+Description: PrevControlId is no longer method of wx.Window, SetSpacer become AssignSpacer
+
+diff --git a/dicompyler/preferences.py b/dicompyler/preferences.py
+index 82ce7a3..7086af2 100755
+--- a/dicompyler/preferences.py
++++ b/dicompyler/preferences.py
+@@ -229,10 +229,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 = c.GetPrevSibling()
+ t.SetLabel('')
+ # 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)
diff --git a/debian/patches/092017DEBUG_main.patch b/debian/patches/092017DEBUG_main.patch
new file mode 100644
index 0000000..58d7ce8
--- /dev/null
+++ b/debian/patches/092017DEBUG_main.patch
@@ -0,0 +1,201 @@
+diff --git a/dicompyler/main.py b/dicompyler/main.py
+index a067e8d..1f1393e 100644
+--- a/dicompyler/main.py
++++ b/dicompyler/main.py
+@@ -9,9 +9,13 @@
+ # available at http://code.google.com/p/dicompyler/
+
+ # Configure logging for dicompyler
++DEBUG = True
+ import logging, logging.handlers
+ logger = logging.getLogger('dicompyler')
+ logger.setLevel(logging.DEBUG)
++#If doing debugging, print messages to the console
++if DEBUG:
++ logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG)
+
+ import os, threading
+ import sys, traceback
+@@ -31,10 +35,9 @@ __version__ = "0.4.2"
+
+ class MainFrame(wx.Frame):
+ def __init__(self, parent, id, title, res):
+-
+ # Initialize logging
+ logger = logging.getLogger('dicompyler')
+-
++ logger.debug("MainFrame:__init__")
+ # Configure the exception hook to process threads as well
+ self.InstallThreadExcepthook()
+
+@@ -44,9 +47,8 @@ class MainFrame(wx.Frame):
+ text = "".join(traceback.format_exception(*exc_info))
+ logger.error("Unhandled exception: %s", text)
+ pub.sendMessage('logging.exception', text)
+-
+ sys.excepthook = LogExcepthook
+-
++
+ # Modify the logging system from pydicom to capture important messages
+ pydicom_logger = logging.getLogger('pydicom')
+ for l in pydicom_logger.handlers:
+@@ -54,6 +56,7 @@ class MainFrame(wx.Frame):
+
+ # Add file logger
+ logpath = os.path.join(guiutil.get_data_dir(), 'logs')
++ logger.info('App logs are stored in %s.', logpath)
+ if not os.path.exists(logpath):
+ os.makedirs(logpath)
+ self.fh = logging.handlers.RotatingFileHandler(
+@@ -61,34 +64,37 @@ class MainFrame(wx.Frame):
+ maxBytes=524288, backupCount=7)
+ self.fh.setFormatter(logging.Formatter(
+ '%(asctime)s - %(name)s - %(levelname)s - %(message)s'))
+- self.fh.setLevel(logging.WARNING)
++ if not DEBUG:
++ self.fh.setLevel(logging.WARNING)
++ else:
++ self.fh.setLevel(logging.DEBUG)
+ logger.addHandler(self.fh)
+ pydicom_logger.addHandler(self.fh)
+-
++ logger.debug("MainFrame:__init__1")
+ # Add console logger if not frozen
+- if not util.main_is_frozen():
+- self.ch = logging.StreamHandler()
+- self.ch.setFormatter(logging.Formatter(
+- '%(levelname)s: %(message)s'))
+- self.ch.setLevel(logging.WARNING)
+- logger.addHandler(self.ch)
+- pydicom_logger.addHandler(self.ch)
+- # Otherwise if frozen, send stdout/stderror to /dev/null since
+- # logging the messages seems to cause instability due to recursion
+- else:
+- devnull = open(os.devnull, 'w')
+- sys.stdout = devnull
+- sys.stderr = devnull
+-
++ if not DEBUG:
++ if not util.main_is_frozen():
++ self.ch = logging.StreamHandler()
++ self.ch.setFormatter(logging.Formatter(
++ '%(levelname)s: %(message)s'))
++ self.ch.setLevel(logging.WARNING)
++ logger.addHandler(self.ch)
++ pydicom_logger.addHandler(self.ch)
++ # Otherwise if frozen, send stdout/stderror to /dev/null since
++ # logging the messages seems to cause instability due to recursion
++ else:
++ devnull = open(os.devnull, 'w')
++ sys.stdout = devnull
++ sys.stderr = devnull
+ # Set the window size
+ if guiutil.IsMac():
+ size=(900, 700)
+ else:
+ size=(850, 625)
+-
++ logger.debug("MainFrame:__init__2")
+ wx.Frame.__init__(self, parent, id, title, pos=wx.DefaultPosition,
+ size=size, style=wx.DEFAULT_FRAME_STYLE)
+-
++ logger.debug("MainFrame:__init__3")
+ # Set up the status bar
+ self.sb = self.CreateStatusBar(3)
+
+@@ -101,7 +107,7 @@ class MainFrame(wx.Frame):
+
+ # Load the main panel for the program
+ self.panelGeneral = self.res.LoadPanel(self, 'panelGeneral')
+-
++ logger.debug("MainFrame:__init__4")
+ # Initialize the General panel controls
+ self.notebook = XRCCTRL(self, 'notebook')
+ self.notebookTools = XRCCTRL(self, 'notebookTools')
+@@ -118,7 +124,7 @@ class MainFrame(wx.Frame):
+ self.lblStructureMeanDose = XRCCTRL(self, 'lblStructureMeanDose')
+ self.cclbStructures = guiutil.ColorCheckListBox(self.notebookTools, 'structure')
+ self.cclbIsodoses = guiutil.ColorCheckListBox(self.notebookTools, 'isodose')
+-
++ logger.debug("MainFrame:__init__5")
+ # Modify the control and font size on Mac
+ controls = [self.notebookTools, self.choiceStructure]
+
+@@ -128,7 +134,7 @@ class MainFrame(wx.Frame):
+ for control in controls:
+ control.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
+ control.SetFont(font)
+-
++ logger.debug("MainFrame:__init__6")
+ # Setup the layout for the frame
+ mainGrid = wx.BoxSizer(wx.VERTICAL)
+ hGrid = wx.BoxSizer(wx.HORIZONTAL)
+@@ -147,7 +153,7 @@ class MainFrame(wx.Frame):
+ wx.App_SetMacAboutMenuItemId(XRCID('menuAbout'))
+ wx.App_SetMacPreferencesMenuItemId(XRCID('menuPreferences'))
+ wx.App_SetMacExitMenuItemId(XRCID('menuExit'))
+-
++ logger.debug("MainFrame:__init__7")
+ # Set the menu as the default menu for this frame
+ self.SetMenuBar(menuMain)
+
+@@ -176,7 +182,7 @@ class MainFrame(wx.Frame):
+ wx.EVT_MENU(self, XRCID('menuAbout'), self.OnAbout)
+ wx.EVT_MENU(self, XRCID('menuHomepage'), self.OnHomepage)
+ wx.EVT_MENU(self, XRCID('menuLicense'), self.OnLicense)
+-
++ logger.debug("MainFrame:__init__8")
+ # Load the toolbar for the frame
+ toolbarMain = self.res.LoadToolBar(self, 'toolbarMain')
+ self.SetToolBar(toolbarMain)
+@@ -207,7 +213,7 @@ class MainFrame(wx.Frame):
+
+ self.SetSizer(mainGrid)
+ self.Layout()
+-
++ logger.debug("MainFrame:__init__9")
+ #Set the Minumum size
+ self.SetMinSize(size)
+ self.Centre(wx.BOTH)
+@@ -235,6 +241,7 @@ class MainFrame(wx.Frame):
+ self.prefmgr = preferences.PreferencesManager(
+ parent = None, appname = 'dicompyler', name = 'Options')
+ sp = wx.StandardPaths.Get()
++ logger.debug("MainFrame:__init__10")
+ self.generalpreftemplate = [
+ {'DICOM Import Settings':
+ [{'name':'Import Location',
+@@ -268,12 +275,15 @@ class MainFrame(wx.Frame):
+ 'callback':'general.advanced.detailed_logging'}]
+ }]
+ self.preftemplate = [{'General':self.generalpreftemplate}]
++ logger.debug("MainFrame:__init__11")
+ pub.sendMessage('preferences.updated.template', self.preftemplate)
+-
++ logger.debug("MainFrame:__init__12")
+ # Initialize variables
+ self.ptdata = {}
+
+ # Set up pubsub
++ if DEBUG:
++ logger.info("Subscription from main.")
+ pub.subscribe(self.OnLoadPatientData, 'patient.updated.raw_data')
+ pub.subscribe(self.OnStructureCheck, 'colorcheckbox.checked.structure')
+ pub.subscribe(self.OnStructureUncheck, 'colorcheckbox.unchecked.structure')
+@@ -285,6 +295,8 @@ class MainFrame(wx.Frame):
+ pub.subscribe(self.OnOpenPatient, 'dicomgui.show')
+
+ # Send a message to the logging system to turn on/off detailed logging
++ if DEBUG:
++ logger.info("Sending message from main.")
+ pub.sendMessage('preferences.requested.value',
+ 'general.advanced.detailed_logging')
+
+@@ -926,6 +938,7 @@ class MainFrame(wx.Frame):
+
+ class dicompyler(wx.App):
+ def OnInit(self):
++ logger.debug("dicompyler:OnInit")
+ # no-op in wxPython2.8 and later: wx.InitAllImageHandlers()
+ wx.GetApp().SetAppName("dicompyler")
+
diff --git a/debian/patches/092017E_newwxmpl.patch b/debian/patches/092017E_newwxmpl.patch
new file mode 100644
index 0000000..6961627
--- /dev/null
+++ b/debian/patches/092017E_newwxmpl.patch
@@ -0,0 +1,157 @@
+Author: Vojtěch Kulvait <kulvait at gmail.com>
+Last-Update: Mon Sep 18 23:15:00 CEST 2017
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=854837
+Description: wxmpl file was outdated, so it was updated to github.com/NOAA-ORR-ERD/wxmpl version "2.1.0dev1" including patch matplotlib.1069221.n5.nabble.com/wxMPL-patch-td34955.html
+
+Index: dicompyler/dicompyler/wxmpl.py
+===================================================================
+--- dicompyler.orig/dicompyler/wxmpl.py
++++ dicompyler/dicompyler/wxmpl.py
+@@ -1,6 +1,5 @@
+ # Purpose: painless matplotlib embedding for wxPython
+ # Author: Ken McIvor <mcivor at iit.edu>
+-# Portions modified by Aditya Panchal
+ #
+ # Copyright 2005-2009 Illinois Institute of Technology
+ #
+@@ -16,20 +15,23 @@ missing features in the form of a better
+
+
+ import wx
++import sys
+ import os.path
+ import weakref
+
+ import matplotlib
+ matplotlib.use('WXAgg')
+-import numpy as np
+-from matplotlib.axes import _process_plot_var_args
+-from matplotlib.backends.backend_agg import RendererAgg
++import numpy as NumPy
++from matplotlib.axes._base import _process_plot_var_args
++from matplotlib.backend_bases import FigureCanvasBase
++from matplotlib.backends.backend_agg import FigureCanvasAgg, RendererAgg
+ from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
+ from matplotlib.figure import Figure
+ from matplotlib.font_manager import FontProperties
++from matplotlib.projections.polar import PolarAxes
+ from matplotlib.transforms import Bbox
+
+-__version__ = '1.3.1'
++__version__ = '2.1.0dev1'
+
+ __all__ = ['PlotPanel', 'PlotFrame', 'PlotApp', 'StripCharter', 'Channel',
+ 'FigurePrinter', 'PointEvent', 'EVT_POINT', 'SelectionEvent',
+@@ -1122,7 +1124,8 @@ 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)
++ #Patch of wxMPL to make it work with wxPython 2.9 due to http://matplotlib.1069221.n5.nabble.com/wxMPL-patch-td34955.html
++ topwin.Connect(self.GetId(), wx.ID_ANY, wx.wxEVT_ACTIVATE, self.OnActivate)
+
+ wx.EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
+ wx.EVT_WINDOW_DESTROY(self, self.OnDestroy)
+@@ -1131,8 +1134,6 @@ class PlotPanel(FigureCanvasWxAgg):
+ """
+ Handles the wxPython window activation event.
+ """
+- if not isinstance(self, FigureCanvasWxAgg):
+- return
+ if not evt.GetActive():
+ self.cursor.setNormal()
+ self.location.clear()
+@@ -1422,7 +1423,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
+@@ -1649,7 +1650,7 @@ class VectorBuffer:
+ accomodate new entries.
+ """
+ def __init__(self):
+- self.data = np.zeros((16,), np.Float)
++ self.data = NumPy.zeros((16,), dtype=float)
+ self.nextRow = 0
+
+ def clear(self):
+@@ -1663,7 +1664,7 @@ class VectorBuffer:
+ """
+ Zero and reset this buffer, releasing the underlying array.
+ """
+- self.data = np.zeros((16,), np.Float)
++ self.data = NumPy.zeros((16,), dtype=float)
+ self.nextRow = 0
+
+ def append(self, point):
+@@ -1675,11 +1676,11 @@ class VectorBuffer:
+
+ resize = False
+ if nextRow == data.shape[0]:
+- nR = int(np.ceil(self.data.shape[0]*1.5))
++ nR = int(NumPy.ceil(self.data.shape[0]*1.5))
+ resize = True
+
+ if resize:
+- self.data = np.zeros((nR,), np.Float)
++ self.data = NumPy.zeros((nR,), dtype=float)
+ self.data[0:data.shape[0]] = data
+
+ self.data[nextRow] = point
+@@ -1701,7 +1702,7 @@ class MatrixBuffer:
+ accomodate new rows of entries.
+ """
+ def __init__(self):
+- self.data = np.zeros((16, 1), np.Float)
++ self.data = NumPy.zeros((16, 1), dtype=float)
+ self.nextRow = 0
+
+ def clear(self):
+@@ -1715,14 +1716,14 @@ class MatrixBuffer:
+ """
+ Zero and reset this buffer, releasing the underlying array.
+ """
+- self.data = np.zeros((16, 1), np.Float)
++ self.data = NumPy.zeros((16, 1), dtype=float)
+ self.nextRow = 0
+
+ def append(self, row):
+ """
+ Append a new row of entries to the end of this buffer's matrix.
+ """
+- row = np.asarray(row, np.Float)
++ row = NumPy.asarray(row, dtype=float)
+ nextRow = self.nextRow
+ data = self.data
+ nPts = row.shape[0]
+@@ -1733,7 +1734,7 @@ class MatrixBuffer:
+ resize = True
+ if nextRow == data.shape[0]:
+ nC = data.shape[1]
+- nR = int(np.ceil(self.data.shape[0]*1.5))
++ nR = int(NumPy.ceil(self.data.shape[0]*1.5))
+ if nC < nPts:
+ nC = nPts
+ elif data.shape[1] < nPts:
+@@ -1743,7 +1744,7 @@ class MatrixBuffer:
+ resize = False
+
+ if resize:
+- self.data = np.zeros((nR, nC), np.Float)
++ self.data = NumPy.zeros((nR, nC), dtype=float)
+ rowEnd, colEnd = data.shape
+ self.data[0:rowEnd, 0:colEnd] = data
+
+@@ -1935,7 +1936,7 @@ class StripCharter:
+ xys = axes._get_verts_in_data_coords(
+ line.get_transform(), zip(x, y))
+ else:
+- xys = np.zeros((x.shape[0], 2), np.Float)
++ xys = NumPy.zeros((x.shape[0], 2), dtype=float)
+ xys[:,0] = x
+ xys[:,1] = y
+ axes.update_datalim(xys)
diff --git a/debian/patches/series b/debian/patches/series
index 71d9b16..a5056fd 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -8,3 +8,5 @@ fix-xrc-errors.patch
fix_DicomImporterDialog.patch
092017A_fixpubsub.patch
092017B_fiximportasterixs.patch
+092017C_fixwx30.patch
+092017E_newwxmpl.patch
diff --git a/debian/patches/series b/debian/patches/series_DEBUG
similarity index 92%
copy from debian/patches/series
copy to debian/patches/series_DEBUG
index 71d9b16..cff589b 100644
--- a/debian/patches/series
+++ b/debian/patches/series_DEBUG
@@ -8,3 +8,4 @@ fix-xrc-errors.patch
fix_DicomImporterDialog.patch
092017A_fixpubsub.patch
092017B_fiximportasterixs.patch
+092017DEBUG_main.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