Skip to content
This repository has been archived by the owner on Feb 2, 2022. It is now read-only.

Use PySubSub instead of deprecated wx.lib.pubsub #139

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
patreon: bastula
17 changes: 1 addition & 16 deletions dicompyler/baseplugins/2dview.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import wx
from wx.xrc import XmlResource, XRCCTRL, XRCID
from wx.lib.pubsub import pub
from pubsub import pub
from matplotlib import _cntr as cntr
from matplotlib import __version__ as mplversion
import numpy as np
Expand Down Expand Up @@ -589,13 +589,6 @@ def OnZoomOut(self, evt):
def OnKeyDown(self, evt):
"""Change the image when the user presses the appropriate keys."""

# Needed to work around a bug in Windows. See main.py for more details.
if guiutil.IsMSWindows():
try:
evt = evt.data
except AttributeError:
keyname = evt.GetKeyCode()

if len(self.images):
keyname = evt.GetKeyCode()
prevkey = [wx.WXK_UP, wx.WXK_PAGEUP]
Expand Down Expand Up @@ -624,14 +617,6 @@ def OnKeyDown(self, evt):
def OnMouseWheel(self, evt):
"""Change the image when the user scrolls the mouse wheel."""

# Needed to work around a bug in Windows. See main.py for more details.
if guiutil.IsMSWindows():
try:
evt = evt.data
except AttributeError:
delta = evt.GetWheelDelta()
rot = evt.GetWheelRotation()

if len(self.images):
delta = evt.GetWheelDelta()
rot = evt.GetWheelRotation()
Expand Down
2 changes: 1 addition & 1 deletion dicompyler/baseplugins/anonymize.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import wx
from wx.xrc import XmlResource, XRCCTRL, XRCID
from wx.lib.pubsub import pub
from pubsub import pub
import os, threading
from dicompyler import guiutil, util

Expand Down
2 changes: 1 addition & 1 deletion dicompyler/baseplugins/dvh.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import wx
from wx.xrc import XmlResource, XRCCTRL, XRCID
from wx.lib.pubsub import pub
from pubsub import pub
from dicompyler import guiutil, util
from dicompyler import guidvh
import numpy as np
Expand Down
2 changes: 1 addition & 1 deletion dicompyler/baseplugins/quickopen.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import logging
logger = logging.getLogger('dicompyler.quickimport')
import wx
from wx.lib.pubsub import pub
from pubsub import pub
from dicompylercore import dicomparser
from dicompyler import util

Expand Down
2 changes: 1 addition & 1 deletion dicompyler/baseplugins/treeview.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from six.moves import queue
import wx
from wx.xrc import XmlResource, XRCCTRL, XRCID
from wx.lib.pubsub import pub
from pubsub import pub
from wx.dataview import TreeListCtrl as tlc
from dicompyler import guiutil, util
try:
Expand Down
2 changes: 1 addition & 1 deletion dicompyler/dicomgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import hashlib, os, threading
import wx
from wx.xrc import *
from wx.lib.pubsub import pub
from pubsub import pub
import numpy as np
from dicompylercore import dicomparser
from dicompyler import guiutil, util
Expand Down
2 changes: 1 addition & 1 deletion dicompyler/guiutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from dicompyler import util
import wx
from wx.xrc import XmlResource, XRCCTRL, XRCID
from wx.lib.pubsub import pub
from pubsub import pub

def IsMSWindows():
"""Are we running on Windows?
Expand Down
6 changes: 3 additions & 3 deletions dicompyler/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import wx.adv
import wx.lib.dialogs, webbrowser
import pydicom
from wx.lib.pubsub import pub
from pubsub import pub
from dicompylercore import dvhcalc
from dicompyler import __version__
from dicompyler import guiutil, util
Expand Down Expand Up @@ -833,15 +833,15 @@ def OnKeyDown(self, evt):
notebook tab instead of the panel receives focus."""

if guiutil.IsMSWindows():
pub.sendMessage('main.key_down', msg=evt)
pub.sendMessage('main.key_down', evt=evt)

def OnMouseWheel(self, evt):
"""Capture the mousewheel event when the notebook tab is focused.
Currently this is used to workaround a bug in Windows since the
notebook tab instead of the panel receives focus."""

if guiutil.IsMSWindows():
pub.sendMessage('main.mousewheel', msg=evt)
pub.sendMessage('main.mousewheel', evt=evt)

def OnPreferences(self, evt):
"""Load and show the Preferences dialog box."""
Expand Down
2 changes: 1 addition & 1 deletion dicompyler/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import imp, os
import wx
from wx.xrc import *
from wx.lib.pubsub import pub
from pubsub import pub
from dicompyler import guiutil, util

def import_plugins(userpath=None):
Expand Down
4 changes: 2 additions & 2 deletions dicompyler/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import os
import wx
from wx.xrc import *
from wx.lib.pubsub import pub
from pubsub import pub
from dicompyler import guiutil, util

try:
Expand Down Expand Up @@ -377,7 +377,7 @@ def main():

import tempfile, os
import wx
from wx.lib.pubsub import Publisher as pub
from pubsub import pub

app = wx.App(False)

Expand Down
5 changes: 4 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
dicompyler-core[image]>=0.5.2
wxPython>=4.0.0b2
matplotlib>=1.3
matplotlib>=1.3,<2.2
numpy>=1.13.1
https://github.com/darcymason/pydicom/archive/master.zip

# Fix #131
PyPubSub
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from setuptools import setup, find_packages

requires = [
'matplotlib>=1.3.0',
'matplotlib>=1.3.0,<2.2',
'numpy>=1.2.1',
'pillow>=1.0',
'dicompyler-core>=0.5.2',
Expand Down