@@ -91,9 +91,9 @@ def set_thumbnail(self, pixmap):
9191 :param pixmap: QPixmap to show or None in order to show default one.
9292 """
9393 if pixmap is None :
94- self ._set_screenshot_pixmap (self ._no_thumb_pixmap )
94+ self ._set_screenshot_pixmap (self ._no_thumb_pixmap , emit_signal = False )
9595 else :
96- self ._set_screenshot_pixmap (pixmap )
96+ self ._set_screenshot_pixmap (pixmap , emit_signal = True )
9797
9898 def mousePressEvent (self , event ):
9999 """
@@ -175,14 +175,17 @@ def paintEvent(self, paint_event):
175175 # paint thumbnail
176176 QtGui .QLabel .paintEvent (self , paint_event )
177177
178- def _set_screenshot_pixmap (self , pixmap ):
178+ def _set_screenshot_pixmap (self , pixmap , emit_signal = True ):
179179 """
180180 Takes the given QPixmap and sets it to be the thumbnail
181181 image of the note input widget.
182182
183- Emits thumbnail_changed signal.
183+ Emits thumbnail_changed signal if emit_signal is True. Default is True.
184+ The thumbnail_changed signal should only be emitted if the thumbnail
185+ changed is for the currently selected item.
184186
185187 :param pixmap: A QPixmap object containing the screenshot image.
188+ :param emit_signal: Whether to emit the thumbnail_changed signal.
186189 """
187190 self ._thumbnail = pixmap
188191
@@ -195,4 +198,5 @@ def _set_screenshot_pixmap(self, pixmap):
195198 )
196199
197200 self .setPixmap (thumb )
198- self .thumbnail_changed .emit (pixmap )
201+ if emit_signal :
202+ self .thumbnail_changed .emit (pixmap )
0 commit comments