From cd3ce6e631cb0627facd4ec554d4a401d6899edc Mon Sep 17 00:00:00 2001 From: Mikhail <-> Date: Thu, 18 Aug 2022 14:01:20 +0300 Subject: [PATCH] Robot.Clipboard is ready for linux --- Sources/GuideSphinx/01_HowToInstall.rst | 3 +- Sources/GuideSphinx/Robot/05_clipboard.rst | 6 ++ Sources/GuideSphinx/Robot/07_screen.rst | 1 + Sources/pyOpenRPA/Robot/Clipboard.py | 6 +- Utils/Jupyter-notebooks/Clipboard.ipynb | 93 ++++++++++++++++++++++ Utils/Jupyter-notebooks/Keyboard.ipynb | 4 +- 6 files changed, 106 insertions(+), 7 deletions(-) create mode 100644 Utils/Jupyter-notebooks/Clipboard.ipynb diff --git a/Sources/GuideSphinx/01_HowToInstall.rst b/Sources/GuideSphinx/01_HowToInstall.rst index 43e943f0..25890c13 100644 --- a/Sources/GuideSphinx/01_HowToInstall.rst +++ b/Sources/GuideSphinx/01_HowToInstall.rst @@ -20,7 +20,8 @@ ************************************************** Первый запуск (Linux) ************************************************** -sudo apt-get scrot (компонент для извлечения скриншотов) +sudo apt-get scrot (компонент для извлечения скриншотов. pyOpenRPA.Robot.Screen) +sudo apt-get install xclip (компонент для работы с буфером обмена. pyOpenRPA.Robot.Clipboard) ************************************************** diff --git a/Sources/GuideSphinx/Robot/05_clipboard.rst b/Sources/GuideSphinx/Robot/05_clipboard.rst index 641979c3..ab711978 100644 --- a/Sources/GuideSphinx/Robot/05_clipboard.rst +++ b/Sources/GuideSphinx/Robot/05_clipboard.rst @@ -4,10 +4,16 @@ 5. Функции Clipboard #################################### +Модуль для взаимодействия с буфером обмена (получить значение из буфера обмена, установить значение в буфер обмена) + +!ВНИМАНИЕ! ПРИ ИСПОЛЬЗОВАНИИ НА LINUX НЕОБХОДИМО ИМЕТЬ ПАКЕТ XCLIP (sudo apt-get install xclip) + ************************************************** Описание функций ************************************************** +Описание каждой функции начинается с обозначения L+,W+, что означает, что функция поддерживается в ОС Linux (L) и Windows (W) + .. automodule:: pyOpenRPA.Robot.Clipboard :members: :autosummary: diff --git a/Sources/GuideSphinx/Robot/07_screen.rst b/Sources/GuideSphinx/Robot/07_screen.rst index bf5031f9..a5e9fc8b 100644 --- a/Sources/GuideSphinx/Robot/07_screen.rst +++ b/Sources/GuideSphinx/Robot/07_screen.rst @@ -7,6 +7,7 @@ ************************ Общее ************************ +!ВНИМАНИЕ! ДЛЯ РАБОТЫ В LINUX ТРЕБУЕТСЯ НАЛИЧИЕ КОМПОНЕНТА SCROT (sudo apt-get scrot) Документация к модулю будет опубликована в Июле 2022. По всем вопросам роботизации WEB приложений обращайтесь в центр поддержки клиентов pyOpenRPA. diff --git a/Sources/pyOpenRPA/Robot/Clipboard.py b/Sources/pyOpenRPA/Robot/Clipboard.py index 786bca2c..01f4654d 100644 --- a/Sources/pyOpenRPA/Robot/Clipboard.py +++ b/Sources/pyOpenRPA/Robot/Clipboard.py @@ -7,8 +7,7 @@ if CrossOS.IS_LINUX_BOOL: import pyclip #CrossOS # GUI Module - interaction with Windows clipboard def Get(): - """ - Получить текстовое содержимое буфера обмена. + """L+,W+: Получить текстовое содержимое буфера обмена. .. code-block:: python @@ -22,8 +21,7 @@ def Get(): return ClipboardGet() def Set(inTextStr:str): - """ - Установить текстовое содержимое в буфер обмена. + """L+,W+: Установить текстовое содержимое в буфер обмена. .. code-block:: python diff --git a/Utils/Jupyter-notebooks/Clipboard.ipynb b/Utils/Jupyter-notebooks/Clipboard.ipynb new file mode 100644 index 00000000..f378845a --- /dev/null +++ b/Utils/Jupyter-notebooks/Clipboard.ipynb @@ -0,0 +1,93 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "f264954d", + "metadata": {}, + "outputs": [], + "source": [ + "import sys\n", + "import os\n", + "#sys.path.insert(0, os.path.abspath(\"..\\\\..\\\\Sources\")) # FOR WINDOWS\n", + "sys.path.insert(0, os.path.abspath(\"../../Sources\")) # FOR LINUX\n", + "import time\n", + "from pyOpenRPA.Robot import Clipboard" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "ad79c144", + "metadata": {}, + "outputs": [], + "source": [ + "# Clipboard: Взаимодействие с буфером\n", + "from pyOpenRPA.Robot import Clipboard\n", + "lClipStr = Clipboard.Get()" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "31993162", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'ipboard'" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "lClipStr" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "6a193b1a", + "metadata": {}, + "outputs": [], + "source": [ + "# Clipboard: Взаимодействие с буфером\n", + "from pyOpenRPA.Robot import Clipboard\n", + "lClipStr = Clipboard.Set(inTextStr=\"123\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fd722cd8", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.5" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/Utils/Jupyter-notebooks/Keyboard.ipynb b/Utils/Jupyter-notebooks/Keyboard.ipynb index d7f83e0b..9a0cf8f9 100644 --- a/Utils/Jupyter-notebooks/Keyboard.ipynb +++ b/Utils/Jupyter-notebooks/Keyboard.ipynb @@ -519,7 +519,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -533,7 +533,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.2" + "version": "3.10.5" }, "varInspector": { "cols": {