Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hot keys must work in any keyboard layout #46127

Closed
Nashev mannequin opened this issue Jan 11, 2008 · 15 comments
Closed

Hot keys must work in any keyboard layout #46127

Nashev mannequin opened this issue Jan 11, 2008 · 15 comments
Labels
topic-IDLE type-feature A feature request or enhancement

Comments

@Nashev
Copy link
Mannequin

Nashev mannequin commented Jan 11, 2008

BPO 1794
Nosy @gvanrossum, @birkenfeld, @rhettinger, @kbkaiser, @taleinat, @tiran, @bitdancer

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2010-09-24.03:07:25.589>
created_at = <Date 2008-01-11.16:58:17.426>
labels = ['expert-IDLE', 'type-feature']
title = 'Hot keys must work in any keyboard layout'
updated_at = <Date 2015-11-15.09:01:39.437>
user = 'https://bugs.python.org/Nashev'

bugs.python.org fields:

activity = <Date 2015-11-15.09:01:39.437>
actor = 'THRlWiTi'
assignee = 'none'
closed = True
closed_date = <Date 2010-09-24.03:07:25.589>
closer = 'r.david.murray'
components = ['IDLE']
creation = <Date 2008-01-11.16:58:17.426>
creator = 'Nashev'
dependencies = []
files = []
hgrepos = []
issue_num = 1794
keywords = []
message_count = 15.0
messages = ['59720', '59722', '59724', '59726', '59729', '59731', '59736', '59742', '59746', '59749', '62215', '67117', '86386', '116864', '117259']
nosy_count = 10.0
nosy_names = ['gvanrossum', 'georg.brandl', 'rhettinger', 'kbk', 'taleinat', 'christian.heimes', 'Nashev', 'gpolo', 'r.david.murray', 'THRlWiTi']
pr_nums = []
priority = 'low'
resolution = 'rejected'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue1794'
versions = []

@Nashev
Copy link
Mannequin Author

Nashev mannequin commented Jan 11, 2008

In most platform-depended applications hot keys are working by the
specified keys on a keyboard, independent of a current keyboard layout.
Not by the specified char.

Some application menus is displaying keyboard shortcut localized to main
layout for current language. But still working in any layout of keyboard
currently selected.

IDLE is not. :(

Can any one do something with it unpleasant situation?

@gvanrossum
Copy link
Member

Not being familiar with localized keyboards, I don't understand your
question. Can you provide some screen dumps of what you see and explain
what you expected to see?

PS. What OS?

@tiran
Copy link
Member

tiran commented Jan 11, 2008

I *think* Nashev is talking about assigning hot keys by scan code rather
than by character code.

E.g. on a German keyboard the 'z' and 'y' are switched and the 'z' key
is left to the 't' key. If a program assigns a hot key to 'z' by
character code than the user has to press the 'z' key which is a
different key on the German keyboard. However if a hot key is assigned
by scan code (not sure if it's the right term) than the hot key is still
assigned the physical key in the lower left corner.

@gvanrossum
Copy link
Member

So what's a hot key? Now I'm really confused. I don't recall anything
using scan codes in IDLE, at least not for the memory shortcuts etc.

@birkenfeld
Copy link
Member

Christian Heimes schrieb:

Christian Heimes added the comment:

I *think* Nashev is talking about assigning hot keys by scan code rather
than by character code.

E.g. on a German keyboard the 'z' and 'y' are switched and the 'z' key
is left to the 't' key. If a program assigns a hot key to 'z' by
character code than the user has to press the 'z' key which is a
different key on the German keyboard. However if a hot key is assigned
by scan code (not sure if it's the right term) than the hot key is still
assigned the physical key in the lower left corner.

On which platforms do hotkeys have that behavior? I've never seen it.

@tiran
Copy link
Member

tiran commented Jan 11, 2008

On which platforms do hotkeys have that behavior? I've never seen it.

Some computer games define hot keys by scan code rather than by
character. I'm not sure if it's a good idea for IDLE but for games it
often makes sense.

@Nashev
Copy link
Mannequin Author

Nashev mannequin commented Jan 11, 2008

WOW, so active discussion!

OS - Windows & Mac OS X, both

Programs - most system and many others.

Keyboard layouts - I mean mostly non latin (see
http://en.wikipedia.org/wiki/Keyboard_layout#Keyboard_layouts_for_non-Roman_alphabetic_scripts)

In case of russian keyboard layout i have in place of latin char 'x'
russian letter 'ч', and want to call <<Cut>> command by pressing this
hot key when keyboard really sent to application some like Ctrl+Ч too

In Windows we have messages WM_KeyDown and WM_KeyUp that send always key
index, stored as constants (defined in windows.h or messages.h) like
wk_return, wk_F1, etc. For letter keys, messages come with codes that
always equal to index of similar uppercase latin chars. for example,
first key code in middle row equal ord ('A') = 65. And in context of
russian layout this code translated to Cyrillic letter Ф and sent to
window with next message wm_char. Hot key handling based on WM_KeyDown,
nor WM_Char

P.S.: Samples of localized showing of the hot keys in menu based on
interface language or current keyboard layout I can't find right now,
but i remember that I have this experience. This is feature not
necessary, because reading some like Ctrl+Ч near menu Cut is really
frustrating.

@gvanrossum
Copy link
Member

IDLE is written using Tkinter, not native Windows UI programming APIs, I
don't know if the scan code is available in the keyboard events.

If you want something to happen on this, I suggest you try to create a
patch to IDLE yourself -- it's unlikely that any of the current
developers has the time to figure this out, given that we don't have
Russian keyboards nor Russian versions of Windows or Mac.

@rhettinger
Copy link
Contributor

IDLE lets you configure your own mappings without doing any programming.

From the menu, pick Options, Configure Idle and goto the Keys tab.

@Nashev
Copy link
Mannequin Author

Nashev mannequin commented Jan 11, 2008

Guido, I think now it is must be suggestion to TK team, in they's issue
tracker...

Raymond, I know I can make try localized hot key mapping for my keyboard
layout for my self, but i think the best way is - help to make our
public libraries better for all. But any way, Thank You for try solve my
local problem.

@taleinat
Copy link
Contributor

taleinat commented Feb 9, 2008

(sorry to be joining in late, but I just happened upon this...)

Nashev, if you configured your IDLE's keys to fit a Russian keyboard
layout, then you could post your config-keys.cfg file (from your .idlerc
directory) on the internet for others to enjoy. (this is the file where
user-configured key bindings are saved)

IMHO, specifically in the case of IDLE, binding to scan codes instead of
characters would be harmful, since it would be harder for users not
familiar with scan codes to understand and tweak.

@Nashev
Copy link
Mannequin Author

Nashev mannequin commented May 20, 2008

https://bugzilla.mozilla.org/show_bug.cgi?id=69230 - it is the same
bugreport for other program. It is contain many comments and explains :)

@gpolo
Copy link
Mannequin

gpolo mannequin commented Apr 23, 2009

That bug report is talking about gtk and modifiers affecting bindings
(in the first comments at least), or maybe it even talks about your
problem but it is so long that I would ask to include the relevant parts
here.

Nevertheless, after reading your comments I came to the conclusion that
doing what you want is very unlikely to happen. To bind something in Tk
you have to a specify a string like "<Control-x>", but to do what you
want, it would have to change to:

import Tkinter

def test(event):
    if event.keysym_num == ord('x') and event.state & 4:
        print "Ctrl-x!"

root = Tkinter.Tk()
root.bind('<KeyPress>', test)
root.mainloop()

Maybe you can test this and verify if it works like you wanted. But I
really don't see IDLE changing to work like that.

@gpolo gpolo mannequin added topic-IDLE type-feature A feature request or enhancement and removed topic-tkinter labels Apr 23, 2009
@BreamoreBoy
Copy link
Mannequin

BreamoreBoy mannequin commented Sep 19, 2010

From msg86386 "Nevertheless, after reading your comments I came to the conclusion that doing what you want is very unlikely to happen." so closing.

@bitdancer
Copy link
Member

it does seem that the consensus is that this is not a generally desirable feature.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-IDLE type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

7 participants