This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2011年01月29日 04:03 by ned.deily, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| issue11055.txt | ronaldoussoren, 2011年03月15日 22:10 | review | ||
| Messages (10) | |||
|---|---|---|---|
| msg127378 - (view) | Author: Ned Deily (ned.deily) * (Python committer) | Date: 2011年01月29日 04:03 | |
With the menu accelerators corrected (as patched in Issue10940), IDLE 3.2 with Cocoa Tk 8.5 opens two Save As dialog windows instead of one. This doesn't happen when the Save As item is selected with the mouse nor does it happen with Carbon Tk 8.4. The simple workaround is to dismiss the second dialog window. This can be investigated and fixed post 3.2 release. |
|||
| msg130995 - (view) | Author: Ronald Oussoren (ronaldoussoren) * (Python committer) | Date: 2011年03月15日 16:42 | |
To reproduce install ActiveState Tcl 8.5.9 and then build python using: ../configure --enable-framework --enable-universalsdk=/ --with-universal-archs=intel MACOSX_DEPLOYMENT_TARGET=10.6 Both 3.2 and 3.3 fail can be used. Install the framework and then open an existing file, use SHIFT+CMD+S to save the file and you'll see two dialogs (both labelled 'Save'). Some investigation learns that the save_as method in IOBindings gets called twice. The attached patch (for 3.2) is a crude hack, but does result in a working copy of IDLE that doesn't show two save dialogs. I'm inclined to commit the patch, it is a hack but there are already other workarounds for Tk-on-OSX weirdness. Comments? |
|||
| msg131000 - (view) | Author: Ronald Oussoren (ronaldoussoren) * (Python committer) | Date: 2011年03月15日 17:46 | |
Please ignore the patch, it doesn't work after all. It was too good to be true after all. |
|||
| msg131052 - (view) | Author: Ronald Oussoren (ronaldoussoren) * (Python committer) | Date: 2011年03月15日 22:10 | |
This is not caused by unwanted interaction with Tk's default bindings, changing the save-as bindings to Shift+Cmd+M doesn't "fix" the issue. It seems that the save event is generated twice, for reasons I don't yet understand (I'm definitely not enough of a Tkinter user to understand what's going on). I have attached a new patch that fixes the issue for me, by recognizing that a save event is getting in while already saving. The fix is only active on OSX. BTW. This issue probably also affects 2.7, I haven't done a rebuild of 2.7 yet to check that. |
|||
| msg131087 - (view) | Author: Ned Deily (ned.deily) * (Python committer) | Date: 2011年03月16日 03:45 | |
Another data point: the key binding for Undo (Shift-Command-Z) exhibits similar behavior, i.e. it is executed twice. And trying with Python 2.7.1 linked with A/S Tk 8.5 and with the old key bindings where Shift-Command-S is Save Copy rather than Save As, it appears that now two Save Copy events happen. So it appears to happen in general (?) when Shift is combined with another accelerator. But it doesn't happen with Option-Command-S in 3.2. And, using the Wish 8.5 menu demo, I was not able to reproduce the problem there by simply changing the accelerators to from Command-<letter> to Shift-Command-<letter>. So it's hard not to rule out something in IDLE yet. |
|||
| msg131164 - (view) | Author: Ronald Oussoren (ronaldoussoren) * (Python committer) | Date: 2011年03月16日 19:57 | |
The double execution is definitely caused by having multiple event, one of which is a real keyboard event and the other one is a ghost one. I'm seeing calls to save_as with 2 events: the first is a ghost event, with type 35 and '??' as the keycode and keysym. The second one seems to be the real event with type 2, keysym 'S' and keycode 65651. |
|||
| msg131165 - (view) | Author: Ronald Oussoren (ronaldoussoren) * (Python committer) | Date: 2011年03月16日 20:11 | |
It's getting weirder by the minute. Not only do we get multiple events, we also get additional keybindings we never asked for. *Cmd+Ctrl+S also works as save as *Cmd+Shift+S gives two save as events (as was already known) |
|||
| msg131233 - (view) | Author: Ned Deily (ned.deily) * (Python committer) | Date: 2011年03月17日 07:22 | |
The actual unwanted event is being generated as a result of the menu "add command" accelerator. You can see that by playing with Wish.
set w .menu
catch {destroy $w}
toplevel $w
wm title $w "Menu Shift"
menu $w.menu -tearoff 0
set m $w.menu.basic
$w.menu add cascade -label "Basic" -menu $m -underline 0
menu $m -tearoff 0
$m add command -label "Test" \
-command "puts command" -accelerator Command-Shift-A
bind $w <Command-Shift-A> "puts bind"
$w configure -menu $w.menu
It appears that there is a bug in the Cocoa Tk right now where accelerators with "Shift" (at least) in them are not being properly ignored by Tk. In the Carbon Tk and the X11 Tk, I believe the only effect of the "accelerator" definitions on the "add command" is to be used to create the shortcut characters displayed in the menu entry. However, apparently a side effect of using the Cocoa APIs is that the menu definitions now cause notifications back into Tk which are not supposed to be translated into Tcl/Tk events back to the app. For some reason, the shift ones are not being ignored.
https://github.com/das/tcltk/blob/master/tk/macosx/tkMacOSXMenu.c
Also, it seems that with all three of the Tk implementations (Carbon, X11, and Cocoa), using a capital letter for the menu accelerator implies Shift.
|
|||
| msg140559 - (view) | Author: Ned Deily (ned.deily) * (Python committer) | Date: 2011年07月18日 05:25 | |
There is now a patch in the Tcl pipeline for this problem. See: http://permalink.gmane.org/gmane.comp.lang.tcl.mac/6965 |
|||
| msg140854 - (view) | Author: Ned Deily (ned.deily) * (Python committer) | Date: 2011年07月22日 01:38 | |
A fix for this problem has been released in ActiveTcl 8.5.10.1 as of 2011年07月21日. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:12 | admin | set | github: 55264 |
| 2014年07月29日 00:08:34 | ned.deily | link | issue22099 superseder |
| 2011年07月22日 01:38:21 | ned.deily | set | status: open -> closed resolution: out of date messages: + msg140854 stage: needs patch -> resolved |
| 2011年07月18日 05:25:33 | ned.deily | set | messages: + msg140559 |
| 2011年03月17日 07:22:05 | ned.deily | set | messages: + msg131233 |
| 2011年03月16日 20:11:05 | ronaldoussoren | set | messages: + msg131165 |
| 2011年03月16日 19:57:36 | ronaldoussoren | set | messages: + msg131164 |
| 2011年03月16日 03:45:20 | ned.deily | set | messages: + msg131087 |
| 2011年03月15日 22:10:31 | ronaldoussoren | set | files:
+ issue11055.txt messages: + msg131052 |
| 2011年03月15日 22:07:45 | ronaldoussoren | set | files: - issue11055.patch |
| 2011年03月15日 17:46:52 | ronaldoussoren | set | nosy:
- kbk messages: + msg131000 |
| 2011年03月15日 16:42:11 | ronaldoussoren | set | files:
+ issue11055.patch nosy: + kbk, ronaldoussoren messages: + msg130995 keywords: + patch, needs review |
| 2011年01月29日 04:03:38 | ned.deily | create | |