I've had a look at updating invesalius for wxpython3.0, and made some
progress.
However, the startup still isn't clean - the splash screen throws up
several errors - see invesalius.wxpy3.0.log - and once the app fires up,
there are clearly issues with the sizing of widgets, to the extent that
it isn't usable. I'm not sure if these are as a result of the splash
screen errors or not.
The logic in the splashscreen code seems hard to follow, relying on
several different delayed callbacks. I wonder if it's just inherently
racy, and a timing difference causes the failures with wxpython 3.0.
Anyway, I'm giving up on this one for the moment, but thought I should
at least send the patch I have so far to avoid duplicated effort if you
were also looking at it.
Cheers,
Olly
diff -Nru invesalius-3.0~b5/debian/changelog invesalius-3.0~b5/debian/changelog
--- invesalius-3.0~b5/debian/changelog 2014-06-16 09:01:59.000000000 -0300
+++ invesalius-3.0~b5/debian/changelog 2014-09-09 21:00:48.000000000 -0300
@@ -1,3 +1,11 @@
+invesalius (3.0~b5-3.1) unstable; urgency=medium
+
+ * Non-maintainer upload.
+ * Update for wxPython 3.0 (Closes: #759060):
+ + New patch: wxpython3.0.patch
+
+ -- Olly Betts <[email protected]> Wed, 10 Sep 2014 00:00:33 +0000
+
invesalius (3.0~b5-3) unstable; urgency=low
[ Thiago Franco de Moraes ]
diff -Nru invesalius-3.0~b5/debian/control invesalius-3.0~b5/debian/control
--- invesalius-3.0~b5/debian/control 2014-06-16 09:00:44.000000000 -0300
+++ invesalius-3.0~b5/debian/control 2014-09-09 20:03:09.000000000 -0300
@@ -22,7 +22,7 @@
${misc:Depends},
python-numpy,
python-scipy,
- python-wxgtk2.8 (>= 2.8.12),
+ python-wxgtk3.0,
python-imaging,
python-vtk,
python-gdcm,
diff -Nru invesalius-3.0~b5/debian/patches/series invesalius-3.0~b5/debian/patches/series
--- invesalius-3.0~b5/debian/patches/series 2014-04-28 13:21:20.000000000 -0300
+++ invesalius-3.0~b5/debian/patches/series 2014-09-09 20:03:43.000000000 -0300
@@ -1,2 +1,3 @@
10_sample_path.patch
10_import_mips.patch
+wxpython3.0.patch
diff -Nru invesalius-3.0~b5/debian/patches/wxpython3.0.patch invesalius-3.0~b5/debian/patches/wxpython3.0.patch
--- invesalius-3.0~b5/debian/patches/wxpython3.0.patch 1969-12-31 21:00:00.000000000 -0300
+++ invesalius-3.0~b5/debian/patches/wxpython3.0.patch 2014-09-09 21:00:03.000000000 -0300
@@ -0,0 +1,114 @@
+Description: Update for wxPython 3.0
+ These changes should remain compatible with wxPython 2.8, aside from the
+ wxversion change in the last hunk.
+ .
+ We can't simply drop the wxversion.select() call and use
+ .
+ wxversion.ensureMinimal('2.8-unicode', optionsRequired=True)
+ .
+ because 3.0 is always Unicode, and the "-unicode" option has been dropped,
+ but wxversion isn't smart enough to know to allow for this when matching
+ options.
+Bug-Debian: https://bugs.debian.org/759060
+Forwarded: no
+Last-Update: 2014-09-09
+
+--- invesalius-3.0~b5.orig/invesalius/gui/dialogs.py
++++ invesalius-3.0~b5/invesalius/gui/dialogs.py
+@@ -214,7 +214,7 @@ def ShowOpenProjectDialog():
+ dlg = wx.FileDialog(None, message=_("Open InVesalius 3 project..."),
+ defaultDir="",
+ defaultFile="", wildcard=WILDCARD_OPEN,
+- style=wx.OPEN|wx.CHANGE_DIR)
++ style=wx.FD_OPEN|wx.FD_CHANGE_DIR)
+
+ # inv3 filter is default
+ dlg.SetFilterIndex(0)
+@@ -242,7 +242,7 @@ def ShowOpenAnalyzeDialog():
+ dlg = wx.FileDialog(None, message=_("Open Analyze file"),
+ defaultDir="",
+ defaultFile="", wildcard=WILDCARD_ANALYZE,
+- style=wx.OPEN|wx.CHANGE_DIR)
++ style=wx.FD_OPEN|wx.FD_CHANGE_DIR)
+
+ # inv3 filter is default
+ dlg.SetFilterIndex(0)
+@@ -312,7 +312,7 @@ def ShowSaveAsProjectDialog(default_file
+ "", # last used directory
+ default_filename,
+ _("InVesalius project (*.inv3)|*.inv3"),
+- wx.SAVE|wx.OVERWRITE_PROMPT)
++ wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT)
+ #dlg.SetFilterIndex(0) # default is VTI
+
+ filename = None
+@@ -972,7 +972,7 @@ def ExportPicture(type_=""):
+ "", # last used directory
+ project_name, # filename
+ WILDCARD_SAVE_PICTURE,
+- wx.SAVE|wx.OVERWRITE_PROMPT)
++ wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT)
+ dlg.SetFilterIndex(1) # default is VTI
+
+ if dlg.ShowModal() == wx.ID_OK:
+--- invesalius-3.0~b5.orig/invesalius/gui/task_exporter.py
++++ invesalius-3.0~b5/invesalius/gui/task_exporter.py
+@@ -276,7 +276,7 @@ class InnerTaskPanel(wx.Panel):
+ "", # last used directory
+ project_name, # filename
+ WILDCARD_SAVE_MASK,
+- wx.SAVE|wx.OVERWRITE_PROMPT)
++ wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT)
+ dlg.SetFilterIndex(0) # default is VTI
+
+ if dlg.ShowModal() == wx.ID_OK:
+@@ -312,7 +312,7 @@ class InnerTaskPanel(wx.Panel):
+ "", # last used directory
+ project_name, # filename
+ WILDCARD_SAVE_3D,
+- wx.SAVE|wx.OVERWRITE_PROMPT)
++ wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT)
+ dlg.SetFilterIndex(3) # default is STL
+
+ if dlg.ShowModal() == wx.ID_OK:
+--- invesalius-3.0~b5.orig/invesalius/gui/widgets/platebtn.py
++++ invesalius-3.0~b5/invesalius/gui/widgets/platebtn.py
+@@ -626,7 +626,7 @@ class PlateButton(wx.PyControl):
+
+ def SetPressColor(self, color):
+ """Set the color used for highlighting the pressed state
+- @param color: wx.Color
++ @param color: wx.Colour
+ @note: also resets all text colours as necessary
+
+ """
+--- invesalius-3.0~b5.orig/invesalius/invesalius.py
++++ invesalius-3.0~b5/invesalius/invesalius.py
+@@ -30,8 +30,7 @@ if sys.platform == 'win32':
+ else:
+ if sys.platform != 'darwin':
+ import wxversion
+- wxversion.ensureMinimal('2.8-unicode', optionsRequired=True)
+- wxversion.select('2.8-unicode', optionsRequired=True)
++ wxversion.ensureMinimal('3.0')
+
+ import wx
+ #from wx.lib.pubsub import setupv1 #new wx
+--- invesalius-3.0~b5.orig/invesalius/gui/frame.py
++++ invesalius-3.0~b5/invesalius/gui/frame.py
+@@ -560,13 +560,13 @@
+
+ file_edit_item_undo = wx.MenuItem(file_edit, wx.ID_UNDO, _("Undo\tCtrl+Z"))
+ file_edit_item_undo.SetBitmap(self.BMP_UNDO)
+- file_edit_item_undo.Enable(False)
+ file_edit.AppendItem(file_edit_item_undo)
++ file_edit_item_undo.Enable(False)
+
+ file_edit_item_redo = wx.MenuItem(file_edit, wx.ID_REDO, _("Redo\tCtrl+Y"))
+ file_edit_item_redo.SetBitmap(self.BMP_REDO)
+- file_edit_item_redo.Enable(False)
+ file_edit.AppendItem(file_edit_item_redo)
++ file_edit_item_redo.Enable(False)
+ else:
+ file_edit.Append(wx.ID_UNDO, _("Undo\tCtrl+Z")).Enable(False)
+ file_edit.Append(wx.ID_REDO, _("Redo\tCtrl+Y")).Enable(False)
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/wx-3.0-gtk2/wx/_misc.py", line 1367,
in Notify
self.notify()
File "/usr/lib/python2.7/dist-packages/wx-3.0-gtk2/wx/_core.py", line 16869,
in Notify
self.result = self.callable(*self.args, **self.kwargs)
File "invesalius.py", line 177, in Startup
self.main = Frame(None)
File "/usr/share/invesalius/invesalius/gui/frame.py", line 85, in __init__
self.__init_aui()
File "/usr/share/invesalius/invesalius/gui/frame.py", line 140, in __init_aui
aui_manager.AddPane(viewers.Panel(self), wx.aui.AuiPaneInfo().
File "/usr/share/invesalius/invesalius/gui/default_viewers.py", line 41, in
__init__
self.__init_aui_manager()
File "/usr/share/invesalius/invesalius/gui/default_viewers.py", line 77, in
__init_aui_manager
p1 = slice_viewer.Viewer(self, "AXIAL")
File "/usr/share/invesalius/invesalius/data/viewer_slice.py", line 184, in
__init__
self.__init_gui()
File "/usr/share/invesalius/invesalius/data/viewer_slice.py", line 205, in
__init_gui
self.interactor = wxVTKRenderWindowInteractor(self, -1, size=self.GetSize())
File "/usr/lib/pymodules/python2.7/vtk/wx/wxVTKRenderWindowInteractor.py",
line 175, in __init__
attribList=attribList)
File "/usr/lib/python2.7/dist-packages/wx-3.0-gtk2/wx/glcanvas.py", line 106,
in __init__
_glcanvas.GLCanvas_swiginit(self,_glcanvas.new_GLCanvas(*args, **kwargs))
TypeError: Argument given by name ('attribList') and position (3)
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/wx-3.0-gtk2/wx/_misc.py", line 1367,
in Notify
self.notify()
File "/usr/lib/python2.7/dist-packages/wx-3.0-gtk2/wx/_core.py", line 16869,
in Notify
self.result = self.callable(*self.args, **self.kwargs)
File "invesalius.py", line 81, in Startup2
self.control = self.splash.control
AttributeError: 'SplashScreen' object has no attribute 'control'
Traceback (most recent call last):
File "invesalius.py", line 196, in OnClose
if self.fc.IsRunning():
AttributeError: 'SplashScreen' object has no attribute 'fc'