Форум русскоязычного сообщества Ubuntu


Хотите сделать посильный вклад в развитие Ubuntu и русскоязычного сообщества?
Помогите нам с документацией!

Автор Тема: Скрипты частично заменяющие или дополняющие функционал программы xNeur.  (Прочитано 678204 раз)

0 Пользователей и 2 Гостей просматривают эту тему.

Оффлайн KOT040188

  • Активист
  • *
  • Сообщений: 325
    • Просмотр профиля
Но можно не вызывать скрипт конвертации выделенного фрагмента, если ничего не выделено. Это решит проблему 
А можно выделять. Ты не понял задумку. Я хочу повесить на одну кнопку переключение раскладки и конвертацию текста. Если выделен текст, он конвертируется. Если не выделен, просто переключается раскладка. Так и работает, но сейчас ещё и срёт из буфера. Можно это убрать?
Хто ты гэткі?

Оффлайн UltraMax

  • Любитель
  • *
  • Сообщений: 90
    • Просмотр профиля
Обнаружил, что в Skype переключает как-то не очень. Бывает так, что набрано в русской раскладке, нажимаешь Break, звучит сигнал отработки скрипта, даже раскладка переключается в Eng, но текст остается в кириллице. Хотя если дальше набирать, то понятно, что набирается в Eng раскладке

Оффлайн qpdb

  • Активист
  • *
  • Сообщений: 619
  • xUbuntu 22.04
    • Просмотр профиля
Обнаружил, что в Skype переключает как-то не очень.

Тут такое дело, что не факт, что везде будет корректно работать😞… Тертминал не рассматриваем, там, естествнно работать не будет, это очевидно. Для терминала если и делать что-то, то только отдельно, но это чисто теоретическая задача, практической ценности почти не имеющая😕…

Уважаемый ffcrus очень увлёкся скоростью исполнения, но это как говорится „требует жертв😞”, если быть менее требовательным к скорости и не „стесняться😇” delay’ев то будет всё работатать практи чески везде.

Мои некрасивые часто с избыточным, с позволения сказать „кодом“ скрипты работают в Skype, специально проверил…

2022 Dec 13; 06:23 PM
Рекомендую ознакомиться с современной трактовкой темы „collective responsibility and the state”, а также темами сопряжёнными с этой… В современных реалиях это может оказаться полезным…

Оффлайн KOT040188

  • Активист
  • *
  • Сообщений: 325
    • Просмотр профиля
Вопрос немного о другом, но тоже касается покойного xneur. У него была настройка переключения раскладки по ctrl, при этом работали все сочетания с ctrl. Если настраивать такое через иксы, то сочетания отваливаются, известная багофича. Так вот до сих пор ищу способ настроить подобное через другие утилиты. Перебираю tapper, keyd, kmonad, ydotool, читаю маны, но пока ничего не понял. Может кто уже решил этот вопрос? Много лет уже не могу справиться с привычкой переключать раскладку по ctrl, да и не хочу ничего менять, мне так удобно.
Хто ты гэткі?

Оффлайн qpdb

  • Активист
  • *
  • Сообщений: 619
  • xUbuntu 22.04
    • Просмотр профиля
Много лет уже не могу справиться с привычкой переключать раскладку по ctrl, да и не хочу ничего менять, мне так удобно.
Будем считать, что переключение раскладки тоже, хотя и  опосредованно, имеет отношение к данной теме…
Так что если слегка отклонимся ничего страшного, все свои😇!
Я правильно понимаю, что речь идёт о переключении только одной клавишей Ctrl, без сочетания с другими?
(Нажмите, чтобы показать/скрыть)
2022 Dec 17; 01:10 PM
Рекомендую ознакомиться с современной трактовкой темы „collective responsibility and the state”, а также темами сопряжёнными с этой… В современных реалиях это может оказаться полезным…

Оффлайн Rootdiv

  • Любитель
  • *
  • Сообщений: 71
    • Просмотр профиля
    • Web-разработчик
KOT040188, я использую модификацию этого https://github.com/scf37/layout-switcher скрипта и переключаю через ctrl+shift
Я кстати об это уже писал на форуме и в теме xNeur
« Последнее редактирование: 18 Декабря 2022, 00:57:45 от Rootdiv »
Ubuntu Mate 22.04.3 64 bit

Оффлайн KOT040188

  • Активист
  • *
  • Сообщений: 325
    • Просмотр профиля
переключаю через ctrl+shift
А мне надо через ctrl, как было в xneur.
Хто ты гэткі?

Оффлайн Rootdiv

  • Любитель
  • *
  • Сообщений: 71
    • Просмотр профиля
    • Web-разработчик
Ubuntu Mate 22.04.3 64 bit

Оффлайн KOT040188

  • Активист
  • *
  • Сообщений: 325
    • Просмотр профиля
Rootdiv, я там был 2 года назад!!! И тогда не понял и сейчас. Написано что скрипт надо переделывать под ctrl, я в скриптах не силён. Скрипт надо вызывать через ctrl? Скрипт будет работать в фоне как приложение? Или как?
Хто ты гэткі?

Оффлайн Rootdiv

  • Любитель
  • *
  • Сообщений: 71
    • Просмотр профиля
    • Web-разработчик
Написано что скрипт надо переделывать под ctrl
Это был первый ответ, потом был второй ответ, где уже выложил модификацию.
Скрипт будет работать в фоне как приложение?
Да, запускать layout_switcher.sh при входе пользователя в систему. При первом использовании запустить layout_switcher_setup.sh чтобы установить необходимый для работы python компонент.
Ubuntu Mate 22.04.3 64 bit

Оффлайн KOT040188

  • Активист
  • *
  • Сообщений: 325
    • Просмотр профиля
Rootdiv, вот теперь понял, а тогда не понял. Завтра попробую.

Пользователь добавил сообщение 18 Декабря 2022, 15:17:26:
Rootdiv, вот что получилось:
kot@192:~$ /home/kot/bin/script/keyboard_layout_switcher/layout_switcher_setup.sh
Defaulting to user installation because normal site-packages is not writeable
Collecting pynput
  Downloading pynput-1.7.6-py2.py3-none-any.whl (89 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 713.5 kB/s eta 0:00:00
Requirement already satisfied: six in /usr/lib/python3.10/site-packages (from pynput) (1.16.0)
Collecting evdev>=1.3
  Downloading evdev-1.6.0.tar.gz (26 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: python-xlib>=0.17 in /usr/lib/python3.10/site-packages (from pynput) (0.31)
Installing collected packages: evdev, pynput
  DEPRECATION: evdev is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for evdev ... error
  error: subprocess-exited-with-error
 
  × Running setup.py install for evdev did not run successfully.
  │ exit code: 1
  ╰─> [31 lines of output]
      running install
      /usr/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-310
      creating build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/util.py -> build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/uinput.py -> build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/genecodes.py -> build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/ff.py -> build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/evtest.py -> build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/events.py -> build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/eventio_async.py -> build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/eventio.py -> build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/ecodes.py -> build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/device.py -> build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/__init__.py -> build/lib.linux-x86_64-cpython-310/evdev
      running build_ext
      running build_ecodes
      writing ecodes.c (using /usr/include/linux/input.h /usr/include/linux/input-event-codes.h /usr/include/linux/uinput.h)
      building 'evdev._input' extension
      creating build/temp.linux-x86_64-cpython-310
      creating build/temp.linux-x86_64-cpython-310/evdev
      gcc -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -g -DOPENSSL_LOAD_CONF -fwrapv -fno-semantic-interposition -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -g -IVendor/ -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -g -IVendor/ -fPIC -I/usr/include/python3.10 -c evdev/input.c -o build/temp.linux-x86_64-cpython-310/evdev/input.o -std=c99 -Wno-error=declaration-after-statement
      evdev/input.c:10:10: fatal error: Python.h: Нет такого файла или каталога
         10 | #include <Python.h>
            |          ^~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]
 
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> evdev

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
kot@192:~$ /home/kot/bin/script/keyboard_layout_switcher/layout_switcher.sh
kot@192:~$ Traceback (most recent call last):
  File "/home/kot/bin/script/keyboard_layout_switcher/./layout_switcher.py", line 3, in <module>
    from pynput import keyboard
ModuleNotFoundError: No module named 'pynput'

« Последнее редактирование: 18 Декабря 2022, 15:17:26 от KOT040188 »
Хто ты гэткі?

Оффлайн Rootdiv

  • Любитель
  • *
  • Сообщений: 71
    • Просмотр профиля
    • Web-разработчик
KOT040188,в layout_switcher_setup.sh только одна команда pip3 install pynput возможно стоит попробовать pip install pynputЭта команда только устанавливает модуль pynput для python, он не необходим для работы скрипта.
Можно также попробовать установить командой sudo apt install python3-pynput установтся глобально и заодно подтянет нужные зависимости.
« Последнее редактирование: 19 Декабря 2022, 00:49:24 от Rootdiv »
Ubuntu Mate 22.04.3 64 bit

Оффлайн KOT040188

  • Активист
  • *
  • Сообщений: 325
    • Просмотр профиля
возможно стоит попробовать pip install pynput
kot@192:~$ pip install pynput
Defaulting to user installation because normal site-packages is not writeable
Collecting pynput
  Using cached pynput-1.7.6-py2.py3-none-any.whl (89 kB)
Requirement already satisfied: six in /usr/lib/python3.10/site-packages (from pynput) (1.16.0)
Collecting evdev>=1.3
  Using cached evdev-1.6.0.tar.gz (26 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: python-xlib>=0.17 in /usr/lib/python3.10/site-packages (from pynput) (0.31)
Installing collected packages: evdev, pynput
  DEPRECATION: evdev is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for evdev ... error
  error: subprocess-exited-with-error
 
  × Running setup.py install for evdev did not run successfully.
  │ exit code: 1
  ╰─> [31 lines of output]
      running install
      /usr/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-310
      creating build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/util.py -> build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/uinput.py -> build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/genecodes.py -> build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/ff.py -> build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/evtest.py -> build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/events.py -> build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/eventio_async.py -> build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/eventio.py -> build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/ecodes.py -> build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/device.py -> build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/__init__.py -> build/lib.linux-x86_64-cpython-310/evdev
      running build_ext
      running build_ecodes
      writing ecodes.c (using /usr/include/linux/input.h /usr/include/linux/input-event-codes.h /usr/include/linux/uinput.h)
      building 'evdev._input' extension
      creating build/temp.linux-x86_64-cpython-310
      creating build/temp.linux-x86_64-cpython-310/evdev
      gcc -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -g -DOPENSSL_LOAD_CONF -fwrapv -fno-semantic-interposition -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -g -IVendor/ -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -g -IVendor/ -fPIC -I/usr/include/python3.10 -c evdev/input.c -o build/temp.linux-x86_64-cpython-310/evdev/input.o -std=c99 -Wno-error=declaration-after-statement
      evdev/input.c:10:10: fatal error: Python.h: Нет такого файла или каталога
         10 | #include <Python.h>
            |          ^~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]
 
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> evdev

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

Пользователь добавил сообщение 19 Декабря 2022, 20:18:09:
sudo apt install python3-pynput
В сусе нет такого пакета.

На форуме запрещено!
2.17. Обсуждение вопросов, напрямую не связанных с использованием дистрибутивов, входящих в официальное семейство Ubuntu.Другие дистрибутивы GNU/Linux и прочие операционные системы следует обсуждать на иных, специализированных ресурсах. Исключением является раздел "Разговоры обо всем". Правила форума
Предупреждаю!!!
-mahinist
« Последнее редактирование: 19 Декабря 2022, 23:01:28 от mahinist »
Хто ты гэткі?

Оффлайн Rootdiv

  • Любитель
  • *
  • Сообщений: 71
    • Просмотр профиля
    • Web-разработчик
KOT040188, скрипт по ссылке выше оказался не отредактированным. Я его отредактировал, проверил и выложил в том же посте, также добавил уточняющую информацию.
« Последнее редактирование: 22 Декабря 2022, 23:08:05 от Rootdiv »
Ubuntu Mate 22.04.3 64 bit

Оффлайн KOT040188

  • Активист
  • *
  • Сообщений: 325
    • Просмотр профиля
Rootdiv,
kot@192:~$ /home/kot/bin/tmp/keyboard_layout_switcher_ctrl/layout_switcher_setup.sh
Defaulting to user installation because normal site-packages is not writeable
Collecting pynput
  Using cached pynput-1.7.6-py2.py3-none-any.whl (89 kB)
Collecting evdev>=1.3
  Using cached evdev-1.6.0.tar.gz (26 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: six in /usr/lib/python3.10/site-packages (from pynput) (1.16.0)
Requirement already satisfied: python-xlib>=0.17 in /usr/lib/python3.10/site-packages (from pynput) (0.31)
Installing collected packages: evdev, pynput
  DEPRECATION: evdev is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for evdev ... error
  error: subprocess-exited-with-error
 
  × Running setup.py install for evdev did not run successfully.
  │ exit code: 1
  ╰─> [31 lines of output]
      running install
      /usr/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-310
      creating build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/util.py -> build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/uinput.py -> build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/genecodes.py -> build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/ff.py -> build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/evtest.py -> build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/events.py -> build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/eventio_async.py -> build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/eventio.py -> build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/ecodes.py -> build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/device.py -> build/lib.linux-x86_64-cpython-310/evdev
      copying evdev/__init__.py -> build/lib.linux-x86_64-cpython-310/evdev
      running build_ext
      running build_ecodes
      writing ecodes.c (using /usr/include/linux/input.h /usr/include/linux/input-event-codes.h /usr/include/linux/uinput.h)
      building 'evdev._input' extension
      creating build/temp.linux-x86_64-cpython-310
      creating build/temp.linux-x86_64-cpython-310/evdev
      gcc -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -g -DOPENSSL_LOAD_CONF -fwrapv -fno-semantic-interposition -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -g -IVendor/ -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -g -IVendor/ -fPIC -I/usr/include/python3.10 -c evdev/input.c -o build/temp.linux-x86_64-cpython-310/evdev/input.o -std=c99 -Wno-error=declaration-after-statement
      evdev/input.c:10:10: fatal error: Python.h: Нет такого файла или каталога
         10 | #include <Python.h>
            |          ^~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]
 
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> evdev

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Хто ты гэткі?

 

Страница сгенерирована за 0.037 секунд. Запросов: 22.