Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-74696: Pass root_dir to custom archivers which support it #94251

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

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
e5ebb8d
gh-74696: Pass root_dir to custom archivers which support it
serhiy-storchaka Jun 22, 2022
563b0f5
Update Doc/library/shutil.rst
serhiy-storchaka Jun 25, 2022
2190304
Merge branch 'main' into shutil-register_archive_format-supports_root…
merwok Sep 29, 2022
7dc8fb3
closes gh-97650: correct sphinx executable (gh-97651)
NoSuck Sep 29, 2022
679cf96
gh-96397: Document that attributes need not be identifiers (#96454)
jeff5 Sep 29, 2022
3c84af2
gh-96348: Deprecate the 3-arg signature of coroutine.throw and genera…
ofey404 Sep 30, 2022
8a0ad46
Use SyntaxError invalid range in tutorial introduction example (GH-93…
ehebert Sep 30, 2022
182755f
gh-97649: The Tools directory is no longer installed on Windows (GH-9…
zooba Sep 30, 2022
b1a9de0
gh-90989: Install Windows launcher per-user, and clarify some install…
zooba Sep 30, 2022
cc1e8e0
gh-94526: getpath_dirname() no longer encodes the path (#97645)
vstinner Sep 30, 2022
8fd0e86
bpo-35675: IDLE - separate config_key window and frame (#11427)
csabella Sep 30, 2022
d1d6b31
gh-87597: Document TimeoutExpired.stdout & .stderr types (#97685)
gpshead Sep 30, 2022
c6203f8
GH-96827: Don't touch closed loops from executor threads (#96837)
gvanrossum Sep 30, 2022
67851dc
GH-97592: Fix crash in C remove_done_callback due to evil code (#97660)
gvanrossum Sep 30, 2022
4c95e50
gh-90110: Update the c-analyzer Tool (gh-97695)
ericsnowcurrently Oct 1, 2022
fb39e7f
gh-90908: Document asyncio.Task.cancelling() and asyncio.Task.uncance…
ambv Oct 1, 2022
0bb7e71
Fix capitalization of Unix in documentation (#96913)
hawkinsw Oct 1, 2022
5ffc011
gh-95588: Drop the safety claim from `ast.literal_eval` docs. (#95919)
gpshead Oct 2, 2022
e401b65
gh-97591: In `Exception.__setstate__()` acquire strong references bef…
ofey404 Oct 2, 2022
879e866
gh-95975: Move except/*/finally ref labels to more precise locations …
CAM-Gerlach Oct 2, 2022
299dd41
gh-97607: Fix content parsing in the impl-detail reST directive (#97652)
CAM-Gerlach Oct 2, 2022
551b707
[docs] Update logging cookbook with recipe for using a logger like an…
vsajip Oct 2, 2022
b37f2cd
Refactor tests.
serhiy-storchaka Oct 2, 2022
bf58b11
Merge branch 'main' into shutil-register_archive_format-supports_root…
serhiy-storchaka Oct 2, 2022
9980c8c
Apply suggestions from code review
serhiy-storchaka Oct 4, 2022
5160cb7
fix markup
merwok Oct 4, 2022
701f896
Update Doc/whatsnew/3.12.rst
serhiy-storchaka Oct 5, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
bpo-35675: IDLE - separate config_key window and frame (#11427)
bpo-35598: IDLE: Refactor window and frame class

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
  • Loading branch information
2 people authored and serhiy-storchaka committed Oct 2, 2022
commit 8fd0e8618c5d995458ed58553f7023789cb310a1
137 changes: 82 additions & 55 deletions 137 Lib/idlelib/config_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,32 +41,22 @@ def translate_key(key, modifiers):
return f'Key-{key}'


class GetKeysDialog(Toplevel):
class GetKeysFrame(Frame):

# Dialog title for invalid key sequence
keyerror_title = 'Key Sequence Error'

def __init__(self, parent, title, action, current_key_sequences,
*, _htest=False, _utest=False):
def __init__(self, parent, action, current_key_sequences):
"""
parent - parent of this dialog
title - string which is the title of the popup dialog
action - string, the name of the virtual event these keys will be
action - the name of the virtual event these keys will be
mapped to
current_key_sequences - list, a list of all key sequence lists
current_key_sequences - a list of all key sequence lists
currently mapped to virtual events, for overlap checking
_htest - bool, change box location when running htest
_utest - bool, do not wait when running unittest
"""
Toplevel.__init__(self, parent)
self.withdraw() # Hide while setting geometry.
self.configure(borderwidth=5)
self.resizable(height=False, width=False)
self.title(title)
self.transient(parent)
_setup_dialog(self)
self.grab_set()
self.protocol("WM_DELETE_WINDOW", self.cancel)
super().__init__(parent)
self['borderwidth'] = 2
self['relief'] = 'sunken'
self.parent = parent
self.action = action
self.current_key_sequences = current_key_sequences
Expand All @@ -82,39 +72,14 @@ def __init__(self, parent, title, action, current_key_sequences,
self.modifier_vars.append(variable)
self.advanced = False
self.create_widgets()
self.update_idletasks()
self.geometry(
"+%d+%d" % (
parent.winfo_rootx() +
(parent.winfo_width()/2 - self.winfo_reqwidth()/2),
parent.winfo_rooty() +
((parent.winfo_height()/2 - self.winfo_reqheight()/2)
if not _htest else 150)
) ) # Center dialog over parent (or below htest box).
if not _utest:
self.deiconify() # Geometry set, unhide.
self.wait_window()

def showerror(self, *args, **kwargs):
# Make testing easier. Replace in #30751.
messagebox.showerror(*args, **kwargs)

def create_widgets(self):
self.frame = frame = Frame(self, borderwidth=2, relief='sunken')
frame.pack(side='top', expand=True, fill='both')

frame_buttons = Frame(self)
frame_buttons.pack(side='bottom', fill='x')

self.button_ok = Button(frame_buttons, text='OK',
width=8, command=self.ok)
self.button_ok.grid(row=0, column=0, padx=5, pady=5)
self.button_cancel = Button(frame_buttons, text='Cancel',
width=8, command=self.cancel)
self.button_cancel.grid(row=0, column=1, padx=5, pady=5)

# Basic entry key sequence.
self.frame_keyseq_basic = Frame(frame, name='keyseq_basic')
self.frame_keyseq_basic = Frame(self, name='keyseq_basic')
self.frame_keyseq_basic.grid(row=0, column=0, sticky='nsew',
padx=5, pady=5)
basic_title = Label(self.frame_keyseq_basic,
Expand All @@ -127,7 +92,7 @@ def create_widgets(self):
basic_keys.pack(ipadx=5, ipady=5, fill='x')

# Basic entry controls.
self.frame_controls_basic = Frame(frame)
self.frame_controls_basic = Frame(self)
self.frame_controls_basic.grid(row=1, column=0, sticky='nsew', padx=5)

# Basic entry modifiers.
Expand Down Expand Up @@ -169,7 +134,7 @@ def create_widgets(self):
self.button_clear.grid(row=2, column=0, columnspan=4)

# Advanced entry key sequence.
self.frame_keyseq_advanced = Frame(frame, name='keyseq_advanced')
self.frame_keyseq_advanced = Frame(self, name='keyseq_advanced')
self.frame_keyseq_advanced.grid(row=0, column=0, sticky='nsew',
padx=5, pady=5)
advanced_title = Label(self.frame_keyseq_advanced, justify='left',
Expand All @@ -181,7 +146,7 @@ def create_widgets(self):
self.advanced_keys.pack(fill='x')

# Advanced entry help text.
self.frame_help_advanced = Frame(frame)
self.frame_help_advanced = Frame(self)
self.frame_help_advanced.grid(row=1, column=0, sticky='nsew', padx=5)
help_advanced = Label(self.frame_help_advanced, justify='left',
text="Key bindings are specified using Tkinter keysyms as\n"+
Expand All @@ -196,7 +161,7 @@ def create_widgets(self):
help_advanced.grid(row=0, column=0, sticky='nsew')

# Switch between basic and advanced.
self.button_level = Button(frame, command=self.toggle_level,
self.button_level = Button(self, command=self.toggle_level,
text='<< Basic Key Binding Entry')
self.button_level.grid(row=2, column=0, stick='ew', padx=5, pady=5)
self.toggle_level()
Expand Down Expand Up @@ -257,21 +222,16 @@ def clear_key_seq(self):
variable.set('')
self.key_string.set('')

def ok(self, event=None):
def ok(self):
self.result = ''
keys = self.key_string.get().strip()
if not keys:
self.showerror(title=self.keyerror_title, parent=self,
message="No key specified.")
return
if (self.advanced or self.keys_ok(keys)) and self.bind_ok(keys):
self.result = keys
self.grab_release()
self.destroy()

def cancel(self, event=None):
self.result = ''
self.grab_release()
self.destroy()
return

def keys_ok(self, keys):
"""Validity check on user's 'basic' keybinding selection.
Expand Down Expand Up @@ -319,6 +279,73 @@ def bind_ok(self, keys):
return True


class GetKeysWindow(Toplevel):

def __init__(self, parent, title, action, current_key_sequences,
*, _htest=False, _utest=False):
"""
parent - parent of this dialog
title - string which is the title of the popup dialog
action - string, the name of the virtual event these keys will be
mapped to
current_key_sequences - list, a list of all key sequence lists
currently mapped to virtual events, for overlap checking
_htest - bool, change box location when running htest
_utest - bool, do not wait when running unittest
"""
super().__init__(parent)
self.withdraw() # Hide while setting geometry.
self['borderwidth'] = 5
self.resizable(height=False, width=False)
# Needed for winfo_reqwidth().
self.update_idletasks()
# Center dialog over parent (or below htest box).
x = (parent.winfo_rootx() +
(parent.winfo_width()//2 - self.winfo_reqwidth()//2))
y = (parent.winfo_rooty() +
((parent.winfo_height()//2 - self.winfo_reqheight()//2)
if not _htest else 150))
self.geometry(f"+{x}+{y}")

self.title(title)
self.frame = frame = GetKeysFrame(self, action, current_key_sequences)
self.protocol("WM_DELETE_WINDOW", self.cancel)
frame_buttons = Frame(self)
self.button_ok = Button(frame_buttons, text='OK',
width=8, command=self.ok)
self.button_cancel = Button(frame_buttons, text='Cancel',
width=8, command=self.cancel)
self.button_ok.grid(row=0, column=0, padx=5, pady=5)
self.button_cancel.grid(row=0, column=1, padx=5, pady=5)
frame.pack(side='top', expand=True, fill='both')
frame_buttons.pack(side='bottom', fill='x')

self.transient(parent)
_setup_dialog(self)
self.grab_set()
if not _utest:
self.deiconify() # Geometry set, unhide.
self.wait_window()

@property
def result(self):
return self.frame.result

@result.setter
def result(self, value):
self.frame.result = value

def ok(self, event=None):
self.frame.ok()
self.grab_release()
self.destroy()

def cancel(self, event=None):
self.result = ''
self.grab_release()
self.destroy()


if __name__ == '__main__':
from unittest import main
main('idlelib.idle_test.test_config_key', verbosity=2, exit=False)
Expand Down
4 changes: 2 additions & 2 deletions 4 Lib/idlelib/configdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from tkinter import messagebox

from idlelib.config import idleConf, ConfigChanges
from idlelib.config_key import GetKeysDialog
from idlelib.config_key import GetKeysWindow
from idlelib.dynoption import DynOptionMenu
from idlelib import macosx
from idlelib.query import SectionName, HelpSource
Expand Down Expand Up @@ -1397,7 +1397,7 @@ def get_new_keys(self):
for event in key_set_changes:
current_bindings[event] = key_set_changes[event].split()
current_key_sequences = list(current_bindings.values())
new_keys = GetKeysDialog(self, 'Get New Keys', bind_name,
new_keys = GetKeysWindow(self, 'Get New Keys', bind_name,
current_key_sequences).result
if new_keys:
if self.keyset_source.get(): # Current key set is a built-in.
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.