mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Signal to notify when selection state changes
This commit is contained in:
parent
107cfa8f1e
commit
f1b59e849d
@ -11,7 +11,7 @@ from functools import wraps
|
||||
|
||||
from PyQt4.Qt import (
|
||||
QWidget, QImage, QPainter, QColor, QApplication, Qt, QPixmap, QRectF,
|
||||
QPointF, QPen)
|
||||
QPointF, QPen, pyqtSignal)
|
||||
|
||||
from calibre import fit_image
|
||||
|
||||
@ -52,6 +52,12 @@ class Canvas(QWidget):
|
||||
SHADE_COLOR = QColor(0, 0, 0, 180)
|
||||
SELECT_PEN = QPen(QColor(Qt.white))
|
||||
|
||||
selection_state_changed = pyqtSignal(object)
|
||||
|
||||
@property
|
||||
def has_selection(self):
|
||||
return self.selection_state.current_mode == 'selected'
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QWidget.__init__(self, parent)
|
||||
self.setMouseTracking(True)
|
||||
@ -209,6 +215,7 @@ class Canvas(QWidget):
|
||||
self.selection_state.reset(full=False)
|
||||
if self.selection_state.current_mode == 'select':
|
||||
self.selection_state.current_mode = 'selected'
|
||||
self.selection_state_changed.emit(True)
|
||||
self.update()
|
||||
|
||||
@painter
|
||||
|
Loading…
x
Reference in New Issue
Block a user