Skip to content

Commit

Permalink
Merge pull request #148 from jpgill86/pyside2
Browse files Browse the repository at this point in the history
Add PySide2 support
  • Loading branch information
jpgill86 committed Feb 8, 2021
2 parents ffd0388 + 7387cdf commit e7bc163
Show file tree
Hide file tree
Showing 12 changed files with 1,332 additions and 134 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/tests.yml
Expand Up @@ -34,6 +34,7 @@ jobs:
strategy:
matrix:
python-version: ['3.5', '3.6', '3.7', '3.8', '3.9']
qt-version: [PyQt5, PySide2]
env:
DISPLAY: ':99.0'
XDG_RUNTIME_DIR: /tmp/runtime-runner
Expand All @@ -56,13 +57,18 @@ jobs:
- name: Install package from repository with test dependencies
run: |
python -m pip install --upgrade pip
pip install ${{ matrix.qt-version }}
pip install -e .[tests]
- name: List pip packages
run: |
pip -V
pip list
- name: Check Qt bindings library
run: |
python -c "from ephyviewer import QT_MODE; assert QT_MODE == '${{ matrix.qt-version }}', 'Wrong Qt bindings: ' + QT_MODE"
- name: Restore cached Neo data files (if available)
# if the data files were recently downloaded during another job, they
# will be available in a cache. otherwise, this step prepares a cache
Expand Down Expand Up @@ -90,7 +96,7 @@ jobs:
env:
COVERALLS_SERVICE_NAME: github
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: test-linux-${{ matrix.python-version }}
COVERALLS_FLAG_NAME: test-linux-${{ matrix.python-version }}-${{ matrix.qt-version }}
COVERALLS_PARALLEL: true

coveralls:
Expand Down
2 changes: 1 addition & 1 deletion doc/installation.rst
Expand Up @@ -9,7 +9,7 @@ Requirements:
* scipy
* matplotlib ≥ 2.0
* pyqtgraph ≥ 0.10.0
* PyQt4 or PyQt5 (manual installation required)
* PyQt5, PySide2, or PyQt4 (manual installation required)

Optional dependencies:
* Neo ≥ 0.6 (standalone app and Neo sources)
Expand Down
10 changes: 5 additions & 5 deletions ephyviewer/epochencoder.py
Expand Up @@ -232,7 +232,7 @@ def set_layout(self):
self.range_group_box.setLayout(range_group_box_layout)

range_shortcut = QT.QShortcut(self)
range_shortcut.setKey('r')
range_shortcut.setKey(QT.QKeySequence('r'))
range_shortcut.activated.connect(self.range_group_toggle)
self.range_group_box.setToolTip('Toggle with shortcut: r')

Expand All @@ -254,12 +254,12 @@ def set_layout(self):
buts[1].clicked.connect(self.set_limit2)

limit1_shortcut = QT.QShortcut(self)
limit1_shortcut.setKey('[')
limit1_shortcut.setKey(QT.QKeySequence('['))
limit1_shortcut.activated.connect(buts[0].click)
buts[0].setToolTip('Set start with shortcut: [')

limit2_shortcut = QT.QShortcut(self)
limit2_shortcut.setKey(']')
limit2_shortcut.setKey(QT.QKeySequence(']'))
limit2_shortcut.activated.connect(buts[1].click)
buts[1].setToolTip('Set stop with shortcut: ]')

Expand Down Expand Up @@ -437,8 +437,8 @@ def assign_label_shortcuts(self, label, key):
shortcut_without_modifier, shortcut_with_modifier = self.label_shortcuts[label]

# set/change the shortcut keys
shortcut_without_modifier.setKey(key)
shortcut_with_modifier .setKey('Shift+' + key)
shortcut_without_modifier.setKey(QT.QKeySequence(key))
shortcut_with_modifier .setKey(QT.QKeySequence('Shift+' + key))

def on_change_keys(self, refresh=True):

Expand Down
20 changes: 9 additions & 11 deletions ephyviewer/icons/__init__.py
@@ -1,13 +1,11 @@
import sys


if sys.version_info > (3,):
# py3x Qt5
from . import icons_py3 as icons
from ephyviewer.myqt import QT_MODE

if QT_MODE == 'PyQt5':
from . import icons_PyQt5 as icons
elif QT_MODE == 'PySide2':
from . import icons_PySide2 as icons
elif QT_MODE == 'PyQt4':
from . import icons_PyQt4 as icons
else:
# py27 Qt4
from . import icons_py2_Qt4 as icons


# TODO : make py3_Qt4 (normally never the case)

raise ValueError('Could not load icons for unrecognized QT_MODE: ' + QT_MODE)
File renamed without changes.

0 comments on commit e7bc163

Please sign in to comment.