mirror of
https://github.com/rbreu/beeref.git
synced 2026-03-11 08:54:28 +00:00
Notification when attempt to paste from empty clipboard
This commit is contained in:
parent
7aab1ed38f
commit
113ba39488
3 changed files with 11 additions and 2 deletions
|
|
@ -8,6 +8,8 @@ Added
|
|||
the default arrow cursor.
|
||||
* Added a color sampler which can copy colors from images to the
|
||||
clipboard in hex format (Images -> Sample Color)
|
||||
* Added notification when attempting to paste from an empty or
|
||||
unusable clipboard
|
||||
|
||||
|
||||
Fixed
|
||||
|
|
|
|||
|
|
@ -621,7 +621,10 @@ class BeeGraphicsView(MainControlsMixin,
|
|||
item.setScale(1 / self.get_scale())
|
||||
self.undo_stack.push(commands.InsertItems(self.scene, [item], pos))
|
||||
return
|
||||
logger.info('No image data or text in clipboard')
|
||||
|
||||
msg = 'No image data or text in clipboard'
|
||||
logger.info(msg)
|
||||
widgets.BeeNotification(self, msg)
|
||||
|
||||
def on_action_open_settings_dir(self):
|
||||
dirname = os.path.dirname(self.settings.fileName())
|
||||
|
|
|
|||
|
|
@ -560,12 +560,16 @@ def test_on_action_paste_when_text(img_mock, text_mock, clear_mock, view):
|
|||
@patch('beeref.scene.BeeGraphicsScene.clearSelection')
|
||||
@patch('PyQt6.QtGui.QClipboard.text')
|
||||
@patch('PyQt6.QtGui.QClipboard.image')
|
||||
def test_on_action_paste_when_empty(img_mock, text_mock, clear_mock, view):
|
||||
@patch('beeref.widgets.BeeNotification')
|
||||
def test_on_action_paste_when_empty(
|
||||
notification_mock, img_mock, text_mock, clear_mock, view):
|
||||
view.cancel_active_modes = MagicMock()
|
||||
img_mock.return_value = QtGui.QImage()
|
||||
text_mock.return_value = ''
|
||||
view.on_action_paste()
|
||||
assert len(view.scene.items()) == 0
|
||||
notification_mock.assert_called_once_with(
|
||||
view, 'No image data or text in clipboard')
|
||||
clear_mock.assert_not_called()
|
||||
view.cancel_active_modes.assert_called_once_with()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue