[issue22226] Refactor dict result handling in Tkinter
Serhiy Storchaka added the comment: Thank you Terry. Fixed style in two methods, added a summary to Treeview.set() docstring and changed returns/sets to return/set. But I disagree with other suggestions. Return value of 3-arg call is insignificant implementation detail. In any case these changes are irrelevant to this issue. -- Added file: http://bugs.python.org/file36558/tkinter_splitdict_3.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22226] Refactor dict result handling in Tkinter
Terry J. Reedy added the comment: looks good to commit. -- stage: patch review - commit review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22226] Refactor dict result handling in Tkinter
Roundup Robot added the comment: New changeset 7b0fdc1e917a by Serhiy Storchaka in branch '2.7': Issue #6: Added private function _splitdict() in the Tkinter module. http://hg.python.org/cpython/rev/7b0fdc1e917a New changeset f89995a4ec11 by Serhiy Storchaka in branch '3.4': Issue #6: Added private function _splitdict() in the Tkinter module. http://hg.python.org/cpython/rev/f89995a4ec11 New changeset 11cf18ec1900 by Serhiy Storchaka in branch 'default': Issue #6: Added private function _splitdict() in the Tkinter module. http://hg.python.org/cpython/rev/11cf18ec1900 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22226] Refactor dict result handling in Tkinter
Serhiy Storchaka added the comment: Thank you Terry for your review. -- resolution: - fixed stage: commit review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22226] Refactor dict result handling in Tkinter
Serhiy Storchaka added the comment: If there are no objections I'll commit the patch soon. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22226] Refactor dict result handling in Tkinter
Terry J. Reedy added the comment: I made two style comments, one an expansion of a previous comment. I believe all other previous comments were handled ok. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22226] Refactor dict result handling in Tkinter
Terry J. Reedy added the comment: The patch expands and fixes buggy ttk._dict_from_tcltuple, renames and moves it to tkinter._splitdict, and replace 4 similar blocks of code in tkinter with calls to _splitdict. Review published. The only substantive comment is about keeping the test, in a new location. Aside from the comments, this is a nice code improvement. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22226] Refactor dict result handling in Tkinter
Serhiy Storchaka added the comment: The patch expands and fixes buggy ttk._dict_from_tcltuple, renames and moves it to tkinter._splitdict There are differences between these functions. tkinter._splitdict calls splitlist on its argument, ttk._dict_from_tcltuple requires argument to be tuple/list. ttk._dict_from_tcltuple calls tclobjs_to_py on the result, tkinter._splitdict left it to the caller. Instead tkinter._splitdict allows you to specify custom function for dict values convertion. Updated patch addresses Terry's comments. Function name is matter of bakeshedding. -- Added file: http://bugs.python.org/file36425/tkinter_splitdict_2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22226] Refactor dict result handling in Tkinter
New submission from Serhiy Storchaka: Proposed patch refactors code which converts the result of Tcl call to Python dict. Added new private function _splitdict() which does this in more robust manner. Also this patch fixes a bug in Treeview.heading(). The heading subcommand of ttk::treeview return options dict in which one key surprisingly was not '-' prefixed. % ttk::treeview t % .t heading #0 -text {} -image {} -anchor center -command {} state {} Current code unconditionally cuts s from the state key. from tkinter import ttk t = ttk.Treeview() t.heading('#0') {'anchor': 'center', 'tate': '', 'image': '', 'text': '', 'command': ''} -- assignee: serhiy.storchaka components: Tkinter files: tkinter_splitdict.diff keywords: patch messages: 225515 nosy: gpolo, serhiy.storchaka, terry.reedy priority: normal severity: normal stage: patch review status: open title: Refactor dict result handling in Tkinter type: behavior versions: Python 2.7, Python 3.4, Python 3.5 Added file: http://bugs.python.org/file36411/tkinter_splitdict.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com