Giter Site home page Giter Site logo

lock keyboard ability about epymc HOT 1 CLOSED

vtolstov avatar vtolstov commented on September 24, 2024
lock keyboard ability

from epymc.

Comments (1)

DaveMDS avatar DaveMDS commented on September 24, 2024

hehe, this is the strangest feature request I ever received :)
There are various ways to implement it, the simple one is probably to patch the keyboard module like this:

diff --git a/epymc/plugins/input_keyb/keyb.py b/epymc/plugins/input_keyb/keyb.py
index 5290fb1..9996dd1 100644
--- a/epymc/plugins/input_keyb/keyb.py
+++ b/epymc/plugins/input_keyb/keyb.py
@@ -84,6 +84,7 @@ class KeyboardModule(EmcModule):
       DBG('Init module')

       self.grab_key_func = None
+      self.blocked = False

       # set up default bindings
       section = 'keyboard'
@@ -114,6 +115,12 @@ class KeyboardModule(EmcModule):
       key = event.key.lower()
       DBG('Key: %s (%s)' % (key, event.key))

+      if key == 'f12' and event.modifier_is_set("Shift"):
+         self.blocked = not self.blocked
+
+      if self.blocked:
+         return True
+
       # if grabbed request call the grab function, else emit the signal
       if self.grab_key_func and callable(self.grab_key_func):
          self.grab_key_func(key)

If you apply this patch you can block/unblock the keyboard using Shift+F12
Let me know if this solution can work for you

from epymc.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.