Skip to content
Snippets Groups Projects
Commit a1c1ef65 authored by Kentaro Wada's avatar Kentaro Wada
Browse files

Fix for flake8: labelme/zoomWidget.py

parent d800ee1a
No related branches found
No related tags found
No related merge requests found
# flake8: noqa
# #
# Copyright (C) 2011 Michael Pitidis, Hussein Abdulwahid. # Copyright (C) 2011 Michael Pitidis, Hussein Abdulwahid.
# #
...@@ -19,28 +18,29 @@ ...@@ -19,28 +18,29 @@
# #
try: try:
from PyQt5.QtGui import * from PyQt5 import QtCore
from PyQt5.QtCore import * from PyQt5 import QtGui
from PyQt5.QtWidgets import * from PyQt5 import QtWidgets
except ImportError: except ImportError:
from PyQt4.QtGui import * from PyQt4 import QtCore
from PyQt4.QtCore import * from PyQt4 import QtGui
from PyQt4 import QtGui as QtWidgets
class ZoomWidget(QSpinBox): class ZoomWidget(QtWidgets.QSpinBox):
def __init__(self, value=100): def __init__(self, value=100):
super(ZoomWidget, self).__init__() super(ZoomWidget, self).__init__()
self.setButtonSymbols(QAbstractSpinBox.NoButtons) self.setButtonSymbols(QtWidgets.QAbstractSpinBox.NoButtons)
self.setRange(1, 500) self.setRange(1, 500)
self.setSuffix(' %') self.setSuffix(' %')
self.setValue(value) self.setValue(value)
self.setToolTip('Zoom Level') self.setToolTip('Zoom Level')
self.setStatusTip(self.toolTip()) self.setStatusTip(self.toolTip())
self.setAlignment(Qt.AlignCenter) self.setAlignment(QtCore.Qt.AlignCenter)
def minimumSizeHint(self): def minimumSizeHint(self):
height = super(ZoomWidget, self).minimumSizeHint().height() height = super(ZoomWidget, self).minimumSizeHint().height()
fm = QFontMetrics(self.font()) fm = QtGui.QFontMetrics(self.font())
width = fm.width(str(self.maximum())) width = fm.width(str(self.maximum()))
return QSize(width, height) return QtCore.QSize(width, height)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment