Skip to content

Commit

Permalink
Merge pull request #409 from NaturalHistoryMuseum/feature/405-remove-…
Browse files Browse the repository at this point in the history
…qtpy

[#405] Remove qtpy
  • Loading branch information
quicklizard99 authored Dec 12, 2016
2 parents 3f31031 + 366d54f commit 4e42030
Show file tree
Hide file tree
Showing 61 changed files with 128 additions and 137 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ This is an overview of major changes. Refer to the git repository for a full log

Version 0.1.35
-------------
- #405 Remove qtpy
- #401 Support new pyzbar and pylibdmtx
- #397 Couple of problems with keyboard shortcuts box
- #395 PyQt5
Expand Down
17 changes: 6 additions & 11 deletions inselect/gui/about.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@

import humanize
import psutil
import qtpy
import qtpy.QtCore

from qtpy import QtWidgets
from qtpy.QtCore import Qt
from qtpy.QtWidgets import QDialog, QLabel, QPushButton, QSizePolicy, QVBoxLayout
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtWidgets import (QDialog, QLabel, QPushButton, QSizePolicy,
QVBoxLayout)

from inselect.gui.utils import HTML_LINK_TEMPLATE

Expand Down Expand Up @@ -41,11 +39,8 @@ def _environment():
('Python', '{0} ({1})'.format(platform.python_version(), python_bit_depth)),
('Numpy', np.version.version),
('OpenCV', cv2.__version__),
(
qtpy.API_NAME,
qtpy.PYQT_VERSION if (qtpy.PYQT4 or qtpy.PYQT5) else qtpy.PYSIDE_VERSION
),
('Qt', qtpy.QT_VERSION),
('PyQt5', QtCore.PYQT_VERSION_STR),
('Qt', QtCore.qVersion()),
('scikit-learn', sklearn.__version__),
('SciPy', scipy.__version__),
]
Expand Down Expand Up @@ -139,7 +134,7 @@ def show_about_box(parent=None):
close.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
close.setDefault(True)
close.clicked.connect(box.close)
vlayout.addWidget(close, alignment=Qt.AlignHCenter)
vlayout.addWidget(close, alignment=QtCore.Qt.AlignHCenter)

box.setLayout(vlayout)

Expand Down
6 changes: 3 additions & 3 deletions inselect/gui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

from pathlib import Path

from qtpy import QtWidgets
from qtpy.QtCore import QCoreApplication, QLocale, QSettings, QSize, QTimer
from qtpy.QtGui import QIcon
from PyQt5 import QtWidgets
from PyQt5.QtCore import QCoreApplication, QLocale, QSettings, QSize, QTimer
from PyQt5.QtGui import QIcon

import inselect

Expand Down
6 changes: 3 additions & 3 deletions inselect/gui/colours.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from qtpy.QtCore import QObject, QSettings, Signal
from qtpy.QtGui import QColor
from PyQt5.QtCore import QObject, QSettings, pyqtSignal
from PyQt5.QtGui import QColor


LIGHT_BACKGROUND = {
Expand Down Expand Up @@ -38,7 +38,7 @@ class ColourSchemeChoice(QObject):
KEY = 'colour_scheme'

# Emitted when the user picks a new colour scheme
colour_scheme_changed = Signal()
colour_scheme_changed = pyqtSignal()

def __init__(self):
super(ColourSchemeChoice, self).__init__()
Expand Down
4 changes: 2 additions & 2 deletions inselect/gui/cookie_cutter_choice.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from pathlib import Path

from qtpy.QtCore import QObject, QSettings, Signal, QStandardPaths
from PyQt5.QtCore import QObject, QSettings, pyqtSignal, QStandardPaths

from inselect.lib.cookie_cutter import CookieCutter
from inselect.lib.utils import debug_print
Expand All @@ -25,7 +25,7 @@ class CookieCutterChoice(QObject):
DIRECTORY_KEY = 'cookie_cutter_last_directory'

# Emitted when the user picks a new file
cookie_cutter_changed = Signal()
cookie_cutter_changed = pyqtSignal()

def __init__(self):
super(CookieCutterChoice, self).__init__()
Expand Down
6 changes: 3 additions & 3 deletions inselect/gui/cookie_cutter_widget.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from qtpy.QtCore import Qt, QObject
from qtpy.QtGui import QFontMetrics
from qtpy.QtWidgets import QAction, QFileDialog, QMenu
from PyQt5.QtCore import Qt, QObject
from PyQt5.QtGui import QFontMetrics
from PyQt5.QtWidgets import QAction, QFileDialog, QMenu

from inselect.lib.cookie_cutter import CookieCutter
from inselect.lib.utils import debug_print
Expand Down
2 changes: 1 addition & 1 deletion inselect/gui/copy_box.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from functools import partial

from qtpy.QtWidgets import QApplication, QMessageBox
from PyQt5.QtWidgets import QApplication, QMessageBox


def copy_to_clipboard(text):
Expand Down
4 changes: 2 additions & 2 deletions inselect/gui/info_widget.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import humanize
import locale
from qtpy.QtCore import Qt
from qtpy.QtWidgets import QFormLayout, QLabel, QWidget
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QFormLayout, QLabel, QWidget

from inselect.lib.utils import format_dt_display
from inselect.gui.utils import BoldLabel, HorizontalLine, reveal_path
Expand Down
16 changes: 8 additions & 8 deletions inselect/gui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
from itertools import count
from pathlib import Path

from qtpy import QtWidgets
from qtpy.QtCore import (Qt, QEvent, QSettings, QItemSelection,
QItemSelectionModel, QStandardPaths)
from qtpy.QtGui import (QColor, QFont, QIcon, QImageWriter, QKeySequence,
QPixmap, QScreen)
from qtpy.QtWidgets import (QAction, QActionGroup, QFileDialog, QLabel,
QMainWindow, QMenu, QMessageBox, QSizePolicy,
QSplitter, QStackedWidget, QVBoxLayout, QWidget)
from PyQt5 import QtWidgets
from PyQt5.QtCore import (Qt, QEvent, QSettings, QItemSelection,
QItemSelectionModel, QStandardPaths)
from PyQt5.QtGui import (QColor, QFont, QIcon, QImageWriter, QKeySequence,
QPixmap, QScreen)
from PyQt5.QtWidgets import (QAction, QActionGroup, QFileDialog, QLabel,
QMainWindow, QMenu, QMessageBox, QSizePolicy,
QSplitter, QStackedWidget, QVBoxLayout, QWidget)

# This import is to register our icon resources with QT
import inselect.gui.icons # noqa
Expand Down
6 changes: 3 additions & 3 deletions inselect/gui/model.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from copy import deepcopy

from qtpy.QtCore import Qt, QAbstractItemModel, QModelIndex, QRect, Signal
from qtpy.QtGui import QPixmap
from PyQt5.QtCore import Qt, QAbstractItemModel, QModelIndex, QRect, pyqtSignal
from PyQt5.QtGui import QPixmap

from inselect.lib.utils import debug_print

Expand All @@ -19,7 +19,7 @@ class Model(QAbstractItemModel):
# TODO LH Plugins should operate on Model, not InselectDocument

# Emitted when modified status changes
modified_changed = Signal()
modified_changed = pyqtSignal()

DISPLAY_TEMPLATE = '{0} {1}'
LEADING_ZEROES = '{0:04d}'
Expand Down
6 changes: 3 additions & 3 deletions inselect/gui/navigator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from qtpy.QtCore import QModelIndex, Qt, QRect, QRectF
from qtpy.QtGui import QBrush, QColor, QPainter, QPen
from qtpy.QtWidgets import QAbstractItemView, QVBoxLayout, QWidget
from PyQt5.QtCore import QModelIndex, Qt, QRect, QRectF
from PyQt5.QtGui import QBrush, QColor, QPainter, QPen
from PyQt5.QtWidgets import QAbstractItemView, QVBoxLayout, QWidget

from .popup_panel import PopupPanel
from .roles import PixmapRole
Expand Down
2 changes: 1 addition & 1 deletion inselect/gui/plugins/barcode.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from itertools import count

from qtpy.QtWidgets import QMessageBox
from PyQt5.QtWidgets import QMessageBox

import inselect.lib.utils

Expand Down
4 changes: 2 additions & 2 deletions inselect/gui/plugins/barcode_dialog.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from qtpy.QtWidgets import (QDialog, QRadioButton, QVBoxLayout, QLabel, QWidget,
QDialogButtonBox)
from PyQt5.QtWidgets import (QDialog, QRadioButton, QVBoxLayout, QLabel,
QWidget, QDialogButtonBox)

from inselect.lib.utils import debug_print
from inselect.gui.utils import HTML_LINK_TEMPLATE, HorizontalLine
Expand Down
2 changes: 1 addition & 1 deletion inselect/gui/plugins/barcode_settings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from qtpy.QtCore import QSettings
from PyQt5.QtCore import QSettings

from inselect.lib.inselect_error import InselectError
from inselect.lib.utils import debug_print
Expand Down
2 changes: 1 addition & 1 deletion inselect/gui/plugins/segment.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from qtpy.QtWidgets import QMessageBox
from PyQt5.QtWidgets import QMessageBox

from inselect.lib.segment_document import SegmentDocument
from inselect.lib.utils import debug_print
Expand Down
2 changes: 1 addition & 1 deletion inselect/gui/plugins/subsegment.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from qtpy.QtWidgets import QMessageBox
from PyQt5.QtWidgets import QMessageBox

from inselect.lib.segment_document import SegmentDocument
from inselect.lib.utils import debug_print
Expand Down
4 changes: 2 additions & 2 deletions inselect/gui/popup_panel.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from qtpy.QtCore import Qt
from qtpy.QtWidgets import QGroupBox, QVBoxLayout, QFrame
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QGroupBox, QVBoxLayout, QFrame

from .toggle_widget_label import ToggleWidgetLabel

Expand Down
4 changes: 2 additions & 2 deletions inselect/gui/progress_dialog.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from qtpy.QtCore import Qt
from qtpy.QtWidgets import QProgressDialog
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QProgressDialog

from inselect.lib.utils import debug_print

Expand Down
2 changes: 1 addition & 1 deletion inselect/gui/recent_documents.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from pathlib import Path

from qtpy.QtCore import QSettings
from PyQt5.QtCore import QSettings

from inselect.lib.utils import debug_print

Expand Down
4 changes: 2 additions & 2 deletions inselect/gui/ribbon.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from qtpy.QtGui import QBrush, QPainter, QPen
from qtpy.QtWidgets import QSizePolicy, QTabBar, QTabWidget
from PyQt5.QtGui import QBrush, QPainter, QPen
from PyQt5.QtWidgets import QSizePolicy, QTabBar, QTabWidget


class Ribbon(QTabWidget):
Expand Down
2 changes: 1 addition & 1 deletion inselect/gui/roles.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from itertools import count

from qtpy.QtCore import Qt
from PyQt5.QtCore import Qt


_role = count(start=int(Qt.UserRole))
Expand Down
9 changes: 4 additions & 5 deletions inselect/gui/shortcuts_help.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
"""Dialog showing a list of shortcuts
"""
from qtpy.QtCore import Qt, QSettings
from qtpy.QtWidgets import (QCheckBox, QDialog, QGridLayout, QHBoxLayout,
QLabel, QPushButton, QSizePolicy, QVBoxLayout,
QWidget)

from PyQt5.QtCore import Qt, QSettings
from PyQt5.QtWidgets import (QCheckBox, QDialog, QGridLayout, QHBoxLayout,
QLabel, QPushButton, QSizePolicy, QVBoxLayout,
QWidget)

from inselect.gui.utils import HorizontalLine, VerticalLine
from inselect.gui.prompts import format_action_shortcuts, BOXES_VIEW_SHORTCUTS
Expand Down
4 changes: 2 additions & 2 deletions inselect/gui/sidebar.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from qtpy.QtCore import Qt
from qtpy.QtWidgets import QScrollArea, QSizePolicy
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QScrollArea, QSizePolicy


class SideBar(QScrollArea):
Expand Down
2 changes: 1 addition & 1 deletion inselect/gui/sort_document_items.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from qtpy.QtCore import QSettings
from PyQt5.QtCore import QSettings

from inselect.lib.sort_document_items import sort_document_items

Expand Down
6 changes: 3 additions & 3 deletions inselect/gui/toggle_widget_label.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from qtpy.QtCore import Qt
from qtpy.QtGui import QPixmap
from qtpy.QtWidgets import QHBoxLayout, QLabel, QWidget
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPixmap
from PyQt5.QtWidgets import QHBoxLayout, QLabel, QWidget


class ToggleWidgetLabel(QWidget):
Expand Down
6 changes: 3 additions & 3 deletions inselect/gui/toolbar_ribbon.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from qtpy.QtCore import Qt, QSize
from qtpy.QtWidgets import (QGridLayout, QSizePolicy, QToolBar, QToolButton,
QWidget)
from PyQt5.QtCore import Qt, QSize
from PyQt5.QtWidgets import (QGridLayout, QSizePolicy, QToolBar, QToolButton,
QWidget)

from .ribbon import Ribbon

Expand Down
4 changes: 2 additions & 2 deletions inselect/gui/user_template_choice.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from pathlib import Path

from qtpy.QtCore import QObject, QSettings, Signal, QStandardPaths
from PyQt5.QtCore import QObject, QSettings, pyqtSignal, QStandardPaths

from inselect.lib.templates.dwc import DWC
from inselect.lib.user_template import UserTemplate
Expand Down Expand Up @@ -28,7 +28,7 @@ class UserTemplateChoice(QObject):
DEFAULT = DWC

# Emitted when the user picks a new template
template_changed = Signal()
template_changed = pyqtSignal()

def __init__(self):
super(UserTemplateChoice, self).__init__()
Expand Down
2 changes: 1 addition & 1 deletion inselect/gui/user_template_popup_button.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from qtpy.QtWidgets import QAction, QFileDialog, QMenu, QPushButton
from PyQt5.QtWidgets import QAction, QFileDialog, QMenu, QPushButton

from inselect.lib.user_template import UserTemplate
from inselect.lib.utils import debug_print
Expand Down
6 changes: 3 additions & 3 deletions inselect/gui/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

import sip

from qtpy.QtCore import Qt, QItemSelection, QItemSelectionModel
from qtpy.QtGui import QColor, QIcon, QImage, QPainter, QPixmap
from qtpy.QtWidgets import QFrame, QLabel, QMessageBox, QWidget
from PyQt5.QtCore import Qt, QItemSelection, QItemSelectionModel
from PyQt5.QtGui import QColor, QIcon, QImage, QPainter, QPixmap
from PyQt5.QtWidgets import QFrame, QLabel, QMessageBox, QWidget

from . import copy_box
from functools import reduce
Expand Down
6 changes: 3 additions & 3 deletions inselect/gui/views/boxes/box_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

from itertools import chain

from qtpy.QtCore import Qt, QRect, QRectF
from qtpy.QtGui import QPen, QBrush
from qtpy.QtWidgets import QGraphicsItem, QGraphicsRectItem
from PyQt5.QtCore import Qt, QRect, QRectF
from PyQt5.QtGui import QPen, QBrush
from PyQt5.QtWidgets import QGraphicsItem, QGraphicsRectItem

from inselect.lib.utils import debug_print
from inselect.gui.colours import colour_scheme_choice
Expand Down
7 changes: 2 additions & 5 deletions inselect/gui/views/boxes/boxes_scene.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@



from qtpy.QtCore import Qt
from qtpy.QtWidgets import QGraphicsScene, QGraphicsItem, QGraphicsPixmapItem
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QGraphicsScene, QGraphicsItem, QGraphicsPixmapItem

from inselect.lib.utils import debug_print

Expand Down
8 changes: 4 additions & 4 deletions inselect/gui/views/boxes/boxes_view.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from qtpy.QtCore import Qt, QRectF, QSizeF, Signal
from qtpy.QtGui import QCursor, QPen, QTransform
from qtpy.QtWidgets import QGraphicsView
from PyQt5.QtCore import Qt, QRectF, QSizeF, pyqtSignal
from PyQt5.QtGui import QCursor, QPen, QTransform
from PyQt5.QtWidgets import QGraphicsView

from inselect.lib.utils import debug_print
from inselect.gui.utils import unite_rects
Expand All @@ -15,7 +15,7 @@ class BoxesView(QGraphicsView):
# 1.8 was chosen through experimentation to fix #331
MAXIMUM_ZOOM = 1.8

viewport_changed = Signal(QRectF)
viewport_changed = pyqtSignal(QRectF)

def __init__(self, scene, parent=None):
super(BoxesView, self).__init__(scene, parent)
Expand Down
6 changes: 2 additions & 4 deletions inselect/gui/views/boxes/graphics_item_view.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@


from qtpy.QtCore import QModelIndex, QRect
from qtpy.QtWidgets import QAbstractItemView
from PyQt5.QtCore import QModelIndex, QRect
from PyQt5.QtWidgets import QAbstractItemView

from inselect.lib.inselect_error import InselectError
from inselect.lib.utils import debug_print
Expand Down
4 changes: 2 additions & 2 deletions inselect/gui/views/boxes/resize_handle.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from qtpy.QtCore import Qt, QRectF
from qtpy.QtWidgets import QGraphicsItem
from PyQt5.QtCore import Qt, QRectF
from PyQt5.QtWidgets import QGraphicsItem

from inselect.lib.utils import debug_print

Expand Down
Loading

0 comments on commit 4e42030

Please sign in to comment.