bug fix on auto detect keybord for windows system
This commit is contained in:
@@ -118,14 +118,15 @@ def autoDetectKeyboardLayout():
|
|||||||
return "fr"
|
return "fr"
|
||||||
elif os.name == 'nt':
|
elif os.name == 'nt':
|
||||||
import win32api, win32con, win32process
|
import win32api, win32con, win32process
|
||||||
import ctypes.windll.user32 as user32
|
from ctypes import windll
|
||||||
w = user32.GetForegroundWindow()
|
w = windll.user32.GetForegroundWindow()
|
||||||
tid = user32.GetWindowThreadProcessId(w, 0)
|
tid = windll.user32.GetWindowThreadProcessId(w, 0)
|
||||||
result = user32.GetKeyboardLayout(tid)
|
result = windll.user32.GetKeyboardLayout(tid)
|
||||||
if result == 0x409409:
|
log.info(result)
|
||||||
|
if result == 0x40c040c:
|
||||||
return "fr"
|
return "fr"
|
||||||
except:
|
except Exception as e:
|
||||||
log.info("failed to auto detect keyboard layout")
|
log.info("failed to auto detect keyboard layout " + str(e))
|
||||||
pass
|
pass
|
||||||
return "en"
|
return "en"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user