forked from platypush/platypush
Merge pull request '[#240] Migrated clipboard
plugin from pyperclip
to pyclip
' (#241) from 240-migrate-clipboard-integration-to-pyclip into master
Reviewed-on: platypush/platypush#241
This commit is contained in:
commit
792a65df8b
5 changed files with 21 additions and 11 deletions
|
@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
|
||||||
Given the high speed of development in the first phase, changes are being
|
Given the high speed of development in the first phase, changes are being
|
||||||
reported only starting from v0.20.2.
|
reported only starting from v0.20.2.
|
||||||
|
|
||||||
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Migrated the `clipboard` integration from `pyperclip` to `pyclip` (see
|
||||||
|
[#240](https://git.platypush.tech/platypush/platypush/issues/240)).
|
||||||
|
`pyperclip` is unmaintained and largely broken, and `pyclip` seems to be a
|
||||||
|
viable drop-in alternative.
|
||||||
|
|
||||||
## [0.24.5] - 2023-02-22
|
## [0.24.5] - 2023-02-22
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -216,7 +216,7 @@ autodoc_mock_imports = [
|
||||||
'bluetooth',
|
'bluetooth',
|
||||||
'gevent.wsgi',
|
'gevent.wsgi',
|
||||||
'Adafruit_IO',
|
'Adafruit_IO',
|
||||||
'pyperclip',
|
'pyclip',
|
||||||
'pydbus',
|
'pydbus',
|
||||||
'inputs',
|
'inputs',
|
||||||
'inotify',
|
'inotify',
|
||||||
|
|
|
@ -12,7 +12,8 @@ class ClipboardPlugin(RunnablePlugin):
|
||||||
monitor and get the current clipboard content.
|
monitor and get the current clipboard content.
|
||||||
|
|
||||||
Requires:
|
Requires:
|
||||||
- **pyperclip** (``pip install pyperclip``)
|
|
||||||
|
- **pyclip** (``pip install pyclip``)
|
||||||
|
|
||||||
Triggers:
|
Triggers:
|
||||||
|
|
||||||
|
@ -32,27 +33,27 @@ class ClipboardPlugin(RunnablePlugin):
|
||||||
:param text: Text to copy
|
:param text: Text to copy
|
||||||
:type text: str
|
:type text: str
|
||||||
"""
|
"""
|
||||||
import pyperclip
|
import pyclip
|
||||||
|
|
||||||
pyperclip.copy(text)
|
pyclip.copy(text)
|
||||||
|
|
||||||
@action
|
@action
|
||||||
def paste(self):
|
def paste(self):
|
||||||
"""
|
"""
|
||||||
Get the current content of the clipboard
|
Get the current content of the clipboard
|
||||||
"""
|
"""
|
||||||
import pyperclip
|
import pyclip
|
||||||
|
|
||||||
return pyperclip.paste()
|
return pyclip.paste(text=True)
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
import pyperclip
|
import pyclip
|
||||||
|
|
||||||
last_error_time = 0
|
last_error_time = 0
|
||||||
|
|
||||||
while not self.should_stop():
|
while not self.should_stop():
|
||||||
try:
|
try:
|
||||||
text = pyperclip.paste()
|
text = pyclip.paste(text=True)
|
||||||
if text and text != self._last_text:
|
if text and text != self._last_text:
|
||||||
get_bus().post(ClipboardEvent(text=text))
|
get_bus().post(ClipboardEvent(text=text))
|
||||||
self._last_text = text
|
self._last_text = text
|
||||||
|
|
|
@ -3,6 +3,6 @@ manifest:
|
||||||
platypush.message.event.clipboard.ClipboardEvent: on clipboard update.
|
platypush.message.event.clipboard.ClipboardEvent: on clipboard update.
|
||||||
install:
|
install:
|
||||||
pip:
|
pip:
|
||||||
- pyperclip
|
- pyclip
|
||||||
package: platypush.plugins.clipboard
|
package: platypush.plugins.clipboard
|
||||||
type: plugin
|
type: plugin
|
||||||
|
|
4
setup.py
4
setup.py
|
@ -17,7 +17,7 @@ def readfile(fname):
|
||||||
def pkg_files(dir):
|
def pkg_files(dir):
|
||||||
paths = []
|
paths = []
|
||||||
# noinspection PyShadowingNames
|
# noinspection PyShadowingNames
|
||||||
for (path, _, files) in os.walk(dir):
|
for path, _, files in os.walk(dir):
|
||||||
for file in files:
|
for file in files:
|
||||||
paths.append(os.path.join('..', path, file))
|
paths.append(os.path.join('..', path, file))
|
||||||
return paths
|
return paths
|
||||||
|
@ -238,7 +238,7 @@ setup(
|
||||||
# Support for SSH integration
|
# Support for SSH integration
|
||||||
'ssh': ['paramiko'],
|
'ssh': ['paramiko'],
|
||||||
# Support for clipboard integration
|
# Support for clipboard integration
|
||||||
'clipboard': ['pyperclip'],
|
'clipboard': ['pyclip'],
|
||||||
# Support for luma.oled display drivers
|
# Support for luma.oled display drivers
|
||||||
'luma-oled': ['luma.oled @ git+https://github.com/rm-hull/luma.oled'],
|
'luma-oled': ['luma.oled @ git+https://github.com/rm-hull/luma.oled'],
|
||||||
# Support for DBus integration
|
# Support for DBus integration
|
||||||
|
|
Loading…
Reference in a new issue