diff --git a/sloth/gui/annotationscene.py b/sloth/gui/annotationscene.py index 69fc47d..3716bdb 100644 --- a/sloth/gui/annotationscene.py +++ b/sloth/gui/annotationscene.py @@ -1,6 +1,4 @@ """This is the AnnotationScene module""" -from PyQt4.QtGui import * -from PyQt4.QtCore import * from sloth.items import * from sloth.core.exceptions import InvalidArgumentException from sloth.annotations.model import AnnotationModelItem @@ -9,19 +7,20 @@ from sloth.conf import config import logging LOG = logging.getLogger(__name__) + class AnnotationScene(QGraphicsScene): mousePositionChanged = pyqtSignal(float, float) def __init__(self, labeltool, items=None, inserters=None, parent=None): super(AnnotationScene, self).__init__(parent) - self._model = None + self._model = None self._image_item = None - self._inserter = None + self._inserter = None self._scene_item = None - self._message = "" - self._labeltool = labeltool + self._message = "" + self._labeltool = labeltool - self._itemfactory = Factory(items) + self._itemfactory = Factory(items) self._inserterfactory = Factory(inserters) try: @@ -268,7 +267,7 @@ class AnnotationScene(QGraphicsScene): found = False items = [item for item in self.items() - if item.flags() & QGraphicsItem.ItemIsSelectable] * 2 + if item.flags() & QGraphicsItem.ItemIsSelectable] * 2 if reverse: items.reverse() diff --git a/sloth/gui/buttonarea.py b/sloth/gui/buttonarea.py index 7e8e832..d8863b8 100644 --- a/sloth/gui/buttonarea.py +++ b/sloth/gui/buttonarea.py @@ -11,7 +11,8 @@ def unique_list(seq): seen = {} result = [] for item in seq: - if item in seen: continue + if item in seen: + continue seen[item] = 1 result.append(item) return result @@ -186,7 +187,7 @@ class ButtonArea(QWidget): def clickedLabelButton(self, label_name): #button = self.get_checked_label_button() #print button - if label_name != None: + if label_name is not None: LOG.debug("ButtonArea: %s" % label_name) self.show_only_label_properties(label_name) else: diff --git a/sloth/gui/controlbuttons.py b/sloth/gui/controlbuttons.py index 4860903..5ddb06b 100644 --- a/sloth/gui/controlbuttons.py +++ b/sloth/gui/controlbuttons.py @@ -1,7 +1,7 @@ -import sys, os from PyQt4.QtGui import * from PyQt4.QtCore import * + class Label(QLabel): def __init__(self, *args, **kwargs): @@ -12,6 +12,7 @@ class Label(QLabel): menu.addActions(self.actions()) menu.exec_(ev.globalPos()) + class ControlButtonWidget(QWidget): def __init__(self, parent=None): QWidget.__init__(self, parent) diff --git a/sloth/gui/floatinglayout.py b/sloth/gui/floatinglayout.py index 1680125..b64629a 100644 --- a/sloth/gui/floatinglayout.py +++ b/sloth/gui/floatinglayout.py @@ -1,6 +1,7 @@ from PyQt4.QtCore import Qt, QRect, QSize, QPoint from PyQt4.QtGui import QLayout, QSizePolicy, QWidgetItem + class FloatingLayout(QLayout): def __init__(self, parent=None): QLayout.__init__(self, parent) diff --git a/sloth/gui/utils.py b/sloth/gui/utils.py index 766a4b5..28c8f93 100644 --- a/sloth/gui/utils.py +++ b/sloth/gui/utils.py @@ -1,5 +1,6 @@ from PyQt4.QtCore import QSize -from PyQt4.QtGui import QVBoxLayout +from PyQt4.QtGui import QVBoxLayout + # This is really really ugly, but the QDockWidget for some reason does not notice when # its child widget becomes smaller...