2003-01-10 16:13:57 -04:00
|
|
|
"""IDLE Configuration Dialog: support user customization of IDLE by GUI
|
|
|
|
|
|
|
|
Customize font faces, sizes, and colorization attributes. Set indentation
|
|
|
|
defaults. Customize keybindings. Colorization and keybindings can be
|
|
|
|
saved as user defined sets. Select startup options including shell/editor
|
|
|
|
and default window size. Define additional help sources.
|
|
|
|
|
|
|
|
Note that tab width in IDLE is currently fixed at eight due to Tk issues.
|
2005-01-30 23:34:26 -04:00
|
|
|
Refer to comments in EditorWindow autoindent code for details.
|
2003-01-10 16:13:57 -04:00
|
|
|
|
2001-07-31 03:59:02 -03:00
|
|
|
"""
|
2017-06-26 21:48:39 -03:00
|
|
|
from tkinter import (Toplevel, Frame, LabelFrame, Listbox, Label, Button,
|
|
|
|
Entry, Text, Scale, Radiobutton, Checkbutton, Canvas,
|
|
|
|
StringVar, BooleanVar, IntVar, TRUE, FALSE,
|
|
|
|
TOP, BOTTOM, RIGHT, LEFT, SOLID, GROOVE, NORMAL, DISABLED,
|
|
|
|
NONE, BOTH, X, Y, W, E, EW, NS, NSEW, NW,
|
2017-07-09 20:26:32 -03:00
|
|
|
HORIZONTAL, VERTICAL, ANCHOR, ACTIVE, END)
|
2016-06-10 19:19:21 -03:00
|
|
|
from tkinter.ttk import Scrollbar
|
2008-05-17 15:39:55 -03:00
|
|
|
import tkinter.colorchooser as tkColorChooser
|
|
|
|
import tkinter.font as tkFont
|
2016-08-31 01:50:55 -03:00
|
|
|
import tkinter.messagebox as tkMessageBox
|
2001-07-31 03:59:02 -03:00
|
|
|
|
2017-07-07 17:37:39 -03:00
|
|
|
from idlelib.config import idleConf, ConfigChanges
|
2016-05-28 14:22:31 -03:00
|
|
|
from idlelib.config_key import GetKeysDialog
|
2016-08-31 01:50:55 -03:00
|
|
|
from idlelib.dynoption import DynOptionMenu
|
|
|
|
from idlelib import macosx
|
2016-07-08 01:22:50 -03:00
|
|
|
from idlelib.query import SectionName, HelpSource
|
2014-10-22 21:15:18 -03:00
|
|
|
from idlelib.tabbedpages import TabbedPageSet
|
2016-05-28 14:22:31 -03:00
|
|
|
from idlelib.textview import view_text
|
2015-10-11 23:07:31 -03:00
|
|
|
|
2017-07-07 17:37:39 -03:00
|
|
|
changes = ConfigChanges()
|
|
|
|
|
2017-07-05 01:54:55 -03:00
|
|
|
|
2001-07-31 03:59:02 -03:00
|
|
|
class ConfigDialog(Toplevel):
|
2017-07-05 01:54:55 -03:00
|
|
|
"""Config dialog for IDLE.
|
|
|
|
"""
|
2005-01-30 23:34:26 -04:00
|
|
|
|
2014-10-17 02:31:35 -03:00
|
|
|
def __init__(self, parent, title='', _htest=False, _utest=False):
|
2017-07-05 01:54:55 -03:00
|
|
|
"""Show the tabbed dialog for user configuration.
|
|
|
|
|
|
|
|
parent - parent of this dialog
|
|
|
|
title - string which is the title of this popup dialog
|
2014-05-29 02:46:26 -03:00
|
|
|
_htest - bool, change box location when running htest
|
2014-07-15 00:07:32 -03:00
|
|
|
_utest - bool, don't wait_window when running unittest
|
2014-05-29 02:46:26 -03:00
|
|
|
"""
|
2001-07-31 07:46:53 -03:00
|
|
|
Toplevel.__init__(self, parent)
|
2014-07-30 20:24:32 -03:00
|
|
|
self.parent = parent
|
2014-08-04 00:02:58 -03:00
|
|
|
if _htest:
|
|
|
|
parent.instance_dict = {}
|
2017-06-26 21:48:39 -03:00
|
|
|
self.withdraw()
|
Merged revisions 58221-58741 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r58221 | georg.brandl | 2007-09-20 10:57:59 -0700 (Thu, 20 Sep 2007) | 2 lines
Patch #1181: add os.environ.clear() method.
........
r58225 | sean.reifschneider | 2007-09-20 23:33:28 -0700 (Thu, 20 Sep 2007) | 3 lines
Issue1704287: "make install" fails unless you do "make" first. Make
oldsharedmods and sharedmods in "libinstall".
........
r58232 | guido.van.rossum | 2007-09-22 13:18:03 -0700 (Sat, 22 Sep 2007) | 4 lines
Patch # 188 by Philip Jenvey.
Make tell() mark CRLF as a newline.
With unit test.
........
r58242 | georg.brandl | 2007-09-24 10:55:47 -0700 (Mon, 24 Sep 2007) | 2 lines
Fix typo and double word.
........
r58245 | georg.brandl | 2007-09-24 10:59:28 -0700 (Mon, 24 Sep 2007) | 2 lines
#1196: document default radix for int().
........
r58247 | georg.brandl | 2007-09-24 11:08:24 -0700 (Mon, 24 Sep 2007) | 2 lines
#1177: accept 2xx responses for https too, not only http.
........
r58249 | andrew.kuchling | 2007-09-24 16:45:51 -0700 (Mon, 24 Sep 2007) | 1 line
Remove stray odd character; grammar fix
........
r58250 | andrew.kuchling | 2007-09-24 16:46:28 -0700 (Mon, 24 Sep 2007) | 1 line
Typo fix
........
r58251 | andrew.kuchling | 2007-09-24 17:09:42 -0700 (Mon, 24 Sep 2007) | 1 line
Add various items
........
r58268 | vinay.sajip | 2007-09-26 22:34:45 -0700 (Wed, 26 Sep 2007) | 1 line
Change to flush and close logic to fix #1760556.
........
r58269 | vinay.sajip | 2007-09-26 22:38:51 -0700 (Wed, 26 Sep 2007) | 1 line
Change to basicConfig() to fix #1021.
........
r58270 | georg.brandl | 2007-09-26 23:26:58 -0700 (Wed, 26 Sep 2007) | 2 lines
#1208: document match object's boolean value.
........
r58271 | vinay.sajip | 2007-09-26 23:56:13 -0700 (Wed, 26 Sep 2007) | 1 line
Minor date change.
........
r58272 | vinay.sajip | 2007-09-27 00:35:10 -0700 (Thu, 27 Sep 2007) | 1 line
Change to LogRecord.__init__() to fix #1206. Note that archaic use of type(x) == types.DictType is because of keeping 1.5.2 compatibility. While this is much less relevant these days, there probably needs to be a separate commit for removing all archaic constructs at the same time.
........
r58288 | brett.cannon | 2007-09-30 12:45:10 -0700 (Sun, 30 Sep 2007) | 9 lines
tuple.__repr__ did not consider a reference loop as it is not possible from
Python code; but it is possible from C. object.__str__ had the issue of not
expecting a type to doing something within it's tp_str implementation that
could trigger an infinite recursion, but it could in C code.. Both found
thanks to BaseException and how it handles its repr.
Closes issue #1686386. Thanks to Thomas Herve for taking an initial stab at
coming up with a solution.
........
r58289 | brett.cannon | 2007-09-30 13:37:19 -0700 (Sun, 30 Sep 2007) | 3 lines
Fix error introduced by r58288; if a tuple is length 0 return its repr and
don't worry about any self-referring tuples.
........
r58294 | facundo.batista | 2007-10-02 10:01:24 -0700 (Tue, 02 Oct 2007) | 11 lines
Made the various is_* operations return booleans. This was discussed
with Cawlishaw by mail, and he basically confirmed that to these is_*
operations, there's no need to return Decimal(0) and Decimal(1) if
the language supports the False and True booleans.
Also added a few tests for the these functions in extra.decTest, since
they are mostly untested (apart from the doctests).
Thanks Mark Dickinson
........
r58295 | facundo.batista | 2007-10-02 11:21:18 -0700 (Tue, 02 Oct 2007) | 4 lines
Added a class to store the digits of log(10), so that they can be made
available when necessary without recomputing. Thanks Mark Dickinson
........
r58299 | mark.summerfield | 2007-10-03 01:53:21 -0700 (Wed, 03 Oct 2007) | 4 lines
Added note in footnote about string comparisons about
unicodedata.normalize().
........
r58304 | raymond.hettinger | 2007-10-03 14:18:11 -0700 (Wed, 03 Oct 2007) | 1 line
enumerate() is no longer bounded to using sequences shorter than LONG_MAX. The possibility of overflow was sending some newsgroup posters into a tizzy.
........
r58305 | raymond.hettinger | 2007-10-03 17:20:27 -0700 (Wed, 03 Oct 2007) | 1 line
itertools.count() no longer limited to sys.maxint.
........
r58306 | kurt.kaiser | 2007-10-03 18:49:54 -0700 (Wed, 03 Oct 2007) | 3 lines
Assume that the user knows when he wants to end the line; don't insert
something he didn't select or complete.
........
r58307 | kurt.kaiser | 2007-10-03 19:07:50 -0700 (Wed, 03 Oct 2007) | 2 lines
Remove unused theme that was causing a fault in p3k.
........
r58308 | kurt.kaiser | 2007-10-03 19:09:17 -0700 (Wed, 03 Oct 2007) | 2 lines
Clean up EditorWindow close.
........
r58309 | kurt.kaiser | 2007-10-03 19:53:07 -0700 (Wed, 03 Oct 2007) | 7 lines
textView cleanup. Patch 1718043 Tal Einat.
M idlelib/EditorWindow.py
M idlelib/aboutDialog.py
M idlelib/textView.py
M idlelib/NEWS.txt
........
r58310 | kurt.kaiser | 2007-10-03 20:11:12 -0700 (Wed, 03 Oct 2007) | 3 lines
configDialog cleanup. Patch 1730217 Tal Einat.
........
r58311 | neal.norwitz | 2007-10-03 23:00:48 -0700 (Wed, 03 Oct 2007) | 4 lines
Coverity #151: Remove deadcode.
All this code already exists above starting at line 653.
........
r58325 | fred.drake | 2007-10-04 19:46:12 -0700 (Thu, 04 Oct 2007) | 1 line
wrap lines to <80 characters before fixing errors
........
r58326 | raymond.hettinger | 2007-10-04 19:47:07 -0700 (Thu, 04 Oct 2007) | 6 lines
Add __asdict__() to NamedTuple and refine the docs.
Add maxlen support to deque() and fixup docs.
Partially fix __reduce__(). The None as a third arg was no longer supported.
Still needs work on __reduce__() to handle recursive inputs.
........
r58327 | fred.drake | 2007-10-04 19:48:32 -0700 (Thu, 04 Oct 2007) | 3 lines
move descriptions of ac_(in|out)_buffer_size to the right place
http://bugs.python.org/issue1053
........
r58329 | neal.norwitz | 2007-10-04 20:39:17 -0700 (Thu, 04 Oct 2007) | 3 lines
dict could be NULL, so we need to XDECREF.
Fix a compiler warning about passing a PyTypeObject* instead of PyObject*.
........
r58330 | neal.norwitz | 2007-10-04 20:41:19 -0700 (Thu, 04 Oct 2007) | 2 lines
Fix Coverity #158: Check the correct variable.
........
r58332 | neal.norwitz | 2007-10-04 22:01:38 -0700 (Thu, 04 Oct 2007) | 7 lines
Fix Coverity #159.
This code was broken if save() returned a negative number since i contained
a boolean value and then we compared i < 0 which should never be true.
Will backport (assuming it's necessary)
........
r58334 | neal.norwitz | 2007-10-04 22:29:17 -0700 (Thu, 04 Oct 2007) | 1 line
Add a note about fixing some more warnings found by Coverity.
........
r58338 | raymond.hettinger | 2007-10-05 12:07:31 -0700 (Fri, 05 Oct 2007) | 1 line
Restore BEGIN/END THREADS macros which were squashed in the previous checkin
........
r58343 | gregory.p.smith | 2007-10-06 00:48:10 -0700 (Sat, 06 Oct 2007) | 3 lines
Stab in the dark attempt to fix the test_bsddb3 failure on sparc and S-390
ubuntu buildbots.
........
r58344 | gregory.p.smith | 2007-10-06 00:51:59 -0700 (Sat, 06 Oct 2007) | 2 lines
Allows BerkeleyDB 4.6.x >= 4.6.21 for the bsddb module.
........
r58348 | gregory.p.smith | 2007-10-06 08:47:37 -0700 (Sat, 06 Oct 2007) | 3 lines
Use the host the author likely meant in the first place. pop.gmail.com is
reliable. gmail.org is someones personal domain.
........
r58351 | neal.norwitz | 2007-10-06 12:16:28 -0700 (Sat, 06 Oct 2007) | 3 lines
Ensure that this test will pass even if another test left an unwritable TESTFN.
Also use the safe unlink in test_support instead of rolling our own here.
........
r58368 | georg.brandl | 2007-10-08 00:50:24 -0700 (Mon, 08 Oct 2007) | 3 lines
#1123: fix the docs for the str.split(None, sep) case.
Also expand a few other methods' docs, which had more info in the deprecated string module docs.
........
r58369 | georg.brandl | 2007-10-08 01:06:05 -0700 (Mon, 08 Oct 2007) | 2 lines
Update docstring of sched, also remove an unused assignment.
........
r58370 | raymond.hettinger | 2007-10-08 02:14:28 -0700 (Mon, 08 Oct 2007) | 5 lines
Add comments to NamedTuple code.
Let the field spec be either a string or a non-string sequence (suggested by Martin Blais with use cases).
Improve the error message in the case of a SyntaxError (caused by a duplicate field name).
........
r58371 | raymond.hettinger | 2007-10-08 02:56:29 -0700 (Mon, 08 Oct 2007) | 1 line
Missed a line in the docs
........
r58372 | raymond.hettinger | 2007-10-08 03:11:51 -0700 (Mon, 08 Oct 2007) | 1 line
Better variable names
........
r58376 | georg.brandl | 2007-10-08 07:12:47 -0700 (Mon, 08 Oct 2007) | 3 lines
#1199: docs for tp_as_{number,sequence,mapping}, by Amaury Forgeot d'Arc.
No need to merge this to py3k!
........
r58380 | raymond.hettinger | 2007-10-08 14:26:58 -0700 (Mon, 08 Oct 2007) | 1 line
Eliminate camelcase function name
........
r58381 | andrew.kuchling | 2007-10-08 16:23:03 -0700 (Mon, 08 Oct 2007) | 1 line
Eliminate camelcase function name
........
r58382 | raymond.hettinger | 2007-10-08 18:36:23 -0700 (Mon, 08 Oct 2007) | 1 line
Make the error messages more specific
........
r58384 | gregory.p.smith | 2007-10-08 23:02:21 -0700 (Mon, 08 Oct 2007) | 10 lines
Splits Modules/_bsddb.c up into bsddb.h and _bsddb.c and adds a C API
object available as bsddb.db.api. This is based on the patch submitted
by Duncan Grisby here:
http://sourceforge.net/tracker/index.php?func=detail&aid=1551895&group_id=13900&atid=313900
See this thread for additional info:
http://sourceforge.net/mailarchive/forum.php?thread_name=E1GAVDK-0002rk-Iw%40apasphere.com&forum_name=pybsddb-users
It also cleans up the code a little by removing some ifdef/endifs for
python prior to 2.1 and for unsupported Berkeley DB <= 3.2.
........
r58385 | gregory.p.smith | 2007-10-08 23:50:43 -0700 (Mon, 08 Oct 2007) | 5 lines
Fix a double free when positioning a database cursor to a non-existant
string key (and probably a few other situations with string keys).
This was reported with a patch as pybsddb sourceforge bug 1708868 by
jjjhhhlll at gmail.
........
r58386 | gregory.p.smith | 2007-10-09 00:19:11 -0700 (Tue, 09 Oct 2007) | 3 lines
Use the highest cPickle protocol in bsddb.dbshelve. This comes from
sourceforge pybsddb patch 1551443 by w_barnes.
........
r58394 | gregory.p.smith | 2007-10-09 11:26:02 -0700 (Tue, 09 Oct 2007) | 2 lines
remove another sleepycat reference
........
r58396 | kurt.kaiser | 2007-10-09 12:31:30 -0700 (Tue, 09 Oct 2007) | 3 lines
Allow interrupt only when executing user code in subprocess
Patch 1225 Tal Einat modified from IDLE-Spoon.
........
r58399 | brett.cannon | 2007-10-09 17:07:50 -0700 (Tue, 09 Oct 2007) | 5 lines
Remove file-level typedefs that were inconsistently used throughout the file.
Just move over to the public API names.
Closes issue1238.
........
r58401 | raymond.hettinger | 2007-10-09 17:26:46 -0700 (Tue, 09 Oct 2007) | 1 line
Accept Jim Jewett's api suggestion to use None instead of -1 to indicate unbounded deques.
........
r58403 | kurt.kaiser | 2007-10-09 17:55:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Allow cursor color change w/o restart. Patch 1725576 Tal Einat.
........
r58404 | kurt.kaiser | 2007-10-09 18:06:47 -0700 (Tue, 09 Oct 2007) | 2 lines
show paste if > 80 columns. Patch 1659326 Tal Einat.
........
r58415 | thomas.heller | 2007-10-11 12:51:32 -0700 (Thu, 11 Oct 2007) | 5 lines
On OS X, use os.uname() instead of gestalt.sysv(...) to get the
operating system version. This allows to use ctypes when Python
was configured with --disable-toolbox-glue.
........
r58419 | neal.norwitz | 2007-10-11 20:01:01 -0700 (Thu, 11 Oct 2007) | 1 line
Get rid of warning about not being able to create an existing directory.
........
r58420 | neal.norwitz | 2007-10-11 20:01:30 -0700 (Thu, 11 Oct 2007) | 1 line
Get rid of warnings on a bunch of platforms by using a proper prototype.
........
r58421 | neal.norwitz | 2007-10-11 20:01:54 -0700 (Thu, 11 Oct 2007) | 4 lines
Get rid of compiler warning about retval being used (returned) without
being initialized. (gcc warning and Coverity 202)
........
r58422 | neal.norwitz | 2007-10-11 20:03:23 -0700 (Thu, 11 Oct 2007) | 1 line
Fix Coverity 168: Close the file before returning (exiting).
........
r58423 | neal.norwitz | 2007-10-11 20:04:18 -0700 (Thu, 11 Oct 2007) | 4 lines
Fix Coverity 180: Don't overallocate. We don't need structs, but pointers.
Also fix a memory leak.
........
r58424 | neal.norwitz | 2007-10-11 20:05:19 -0700 (Thu, 11 Oct 2007) | 5 lines
Fix Coverity 185-186: If the passed in FILE is NULL, uninitialized memory
would be accessed.
Will backport.
........
r58425 | neal.norwitz | 2007-10-11 20:52:34 -0700 (Thu, 11 Oct 2007) | 1 line
Get this module to compile with bsddb versions prior to 4.3
........
r58430 | martin.v.loewis | 2007-10-12 01:56:52 -0700 (Fri, 12 Oct 2007) | 3 lines
Bug #1216: Restore support for Visual Studio 2002.
Will backport to 2.5.
........
r58433 | raymond.hettinger | 2007-10-12 10:53:11 -0700 (Fri, 12 Oct 2007) | 1 line
Fix test of count.__repr__() to ignore the 'L' if the count is a long
........
r58434 | gregory.p.smith | 2007-10-12 11:44:06 -0700 (Fri, 12 Oct 2007) | 4 lines
Fixes http://bugs.python.org/issue1233 - bsddb.dbshelve.DBShelf.append
was useless due to inverted logic. Also adds a test case for RECNO dbs
to test_dbshelve.
........
r58445 | georg.brandl | 2007-10-13 06:20:03 -0700 (Sat, 13 Oct 2007) | 2 lines
Fix email example.
........
r58450 | gregory.p.smith | 2007-10-13 16:02:05 -0700 (Sat, 13 Oct 2007) | 2 lines
Fix an uncollectable reference leak in bsddb.db.DBShelf.append
........
r58453 | neal.norwitz | 2007-10-13 17:18:40 -0700 (Sat, 13 Oct 2007) | 8 lines
Let the O/S supply a port if none of the default ports can be used.
This should make the tests more robust at the expense of allowing
tests to be sloppier by not requiring them to cleanup after themselves.
(It will legitamitely help when running two test suites simultaneously
or if another process is already using one of the predefined ports.)
Also simplifies (slightLy) the exception handling elsewhere.
........
r58459 | neal.norwitz | 2007-10-14 11:30:21 -0700 (Sun, 14 Oct 2007) | 2 lines
Don't raise a string exception, they don't work anymore.
........
r58460 | neal.norwitz | 2007-10-14 11:40:37 -0700 (Sun, 14 Oct 2007) | 1 line
Use unittest for assertions
........
r58468 | armin.rigo | 2007-10-15 00:48:35 -0700 (Mon, 15 Oct 2007) | 2 lines
test_bigbits was not testing what it seemed to.
........
r58471 | guido.van.rossum | 2007-10-15 08:54:11 -0700 (Mon, 15 Oct 2007) | 3 lines
Change a PyErr_Print() into a PyErr_Clear(),
per discussion in issue 1031213.
........
r58500 | raymond.hettinger | 2007-10-16 12:18:30 -0700 (Tue, 16 Oct 2007) | 1 line
Improve error messages
........
r58506 | raymond.hettinger | 2007-10-16 14:28:32 -0700 (Tue, 16 Oct 2007) | 1 line
More docs, error messages, and tests
........
r58507 | andrew.kuchling | 2007-10-16 15:58:03 -0700 (Tue, 16 Oct 2007) | 1 line
Add items
........
r58508 | brett.cannon | 2007-10-16 16:24:06 -0700 (Tue, 16 Oct 2007) | 3 lines
Remove ``:const:`` notation on None in parameter list. Since the markup is not
rendered for parameters it just showed up as ``:const:`None` `` in the output.
........
r58509 | brett.cannon | 2007-10-16 16:26:45 -0700 (Tue, 16 Oct 2007) | 3 lines
Re-order some functions whose parameters differ between PyObject and const char
* so that they are next to each other.
........
r58522 | armin.rigo | 2007-10-17 11:46:37 -0700 (Wed, 17 Oct 2007) | 5 lines
Fix the overflow checking of list_repeat.
Introduce overflow checking into list_inplace_repeat.
Backport candidate, possibly.
........
r58530 | facundo.batista | 2007-10-17 20:16:03 -0700 (Wed, 17 Oct 2007) | 7 lines
Issue #1580738. When HTTPConnection reads the whole stream with read(),
it closes itself. When the stream is read in several calls to read(n),
it should behave in the same way if HTTPConnection knows where the end
of the stream is (through self.length). Added a test case for this
behaviour.
........
r58531 | facundo.batista | 2007-10-17 20:44:48 -0700 (Wed, 17 Oct 2007) | 3 lines
Issue 1289, just a typo.
........
r58532 | gregory.p.smith | 2007-10-18 00:56:54 -0700 (Thu, 18 Oct 2007) | 4 lines
cleanup test_dbtables to use mkdtemp. cleanup dbtables to pass txn as a
keyword argument whenever possible to avoid bugs and confusion. (dbtables.py
line 447 self.db.get using txn as a non-keyword was an actual bug due to this)
........
r58533 | gregory.p.smith | 2007-10-18 01:34:20 -0700 (Thu, 18 Oct 2007) | 4 lines
Fix a weird bug in dbtables: if it chose a random rowid string that contained
NULL bytes it would cause the database all sorts of problems in the future
leading to very strange random failures and corrupt dbtables.bsdTableDb dbs.
........
r58534 | gregory.p.smith | 2007-10-18 09:32:02 -0700 (Thu, 18 Oct 2007) | 3 lines
A cleaner fix than the one committed last night. Generate random rowids that
do not contain null bytes.
........
r58537 | gregory.p.smith | 2007-10-18 10:17:57 -0700 (Thu, 18 Oct 2007) | 2 lines
mention bsddb fixes.
........
r58538 | raymond.hettinger | 2007-10-18 14:13:06 -0700 (Thu, 18 Oct 2007) | 1 line
Remove useless warning
........
r58539 | gregory.p.smith | 2007-10-19 00:31:20 -0700 (Fri, 19 Oct 2007) | 2 lines
squelch the warning that this test is supposed to trigger.
........
r58542 | georg.brandl | 2007-10-19 05:32:39 -0700 (Fri, 19 Oct 2007) | 2 lines
Clarify wording for apply().
........
r58544 | mark.summerfield | 2007-10-19 05:48:17 -0700 (Fri, 19 Oct 2007) | 3 lines
Added a cross-ref to each other.
........
r58545 | georg.brandl | 2007-10-19 10:38:49 -0700 (Fri, 19 Oct 2007) | 2 lines
#1284: "S" means "seen", not unread.
........
r58548 | thomas.heller | 2007-10-19 11:11:41 -0700 (Fri, 19 Oct 2007) | 4 lines
Fix ctypes on 32-bit systems when Python is configured --with-system-ffi.
See also https://bugs.launchpad.net/bugs/72505.
Ported from release25-maint branch.
........
r58550 | facundo.batista | 2007-10-19 12:25:57 -0700 (Fri, 19 Oct 2007) | 8 lines
The constructor from tuple was way too permissive: it allowed bad
coefficient numbers, floats in the sign, and other details that
generated directly the wrong number in the best case, or triggered
misfunctionality in the alorithms.
Test cases added for these issues. Thanks Mark Dickinson.
........
r58559 | georg.brandl | 2007-10-20 06:22:53 -0700 (Sat, 20 Oct 2007) | 2 lines
Fix code being interpreted as a target.
........
r58561 | georg.brandl | 2007-10-20 06:36:24 -0700 (Sat, 20 Oct 2007) | 2 lines
Document new "cmdoption" directive.
........
r58562 | georg.brandl | 2007-10-20 08:21:22 -0700 (Sat, 20 Oct 2007) | 2 lines
Make a path more Unix-standardy.
........
r58564 | georg.brandl | 2007-10-20 10:51:39 -0700 (Sat, 20 Oct 2007) | 2 lines
Document new directive "envvar".
........
r58567 | georg.brandl | 2007-10-20 11:08:14 -0700 (Sat, 20 Oct 2007) | 6 lines
* Add new toplevel chapter, "Using Python." (how to install,
configure and setup python on different platforms -- at least
in theory.)
* Move the Python on Mac docs in that chapter.
* Add a new chapter about the command line invocation, by stargaming.
........
r58568 | georg.brandl | 2007-10-20 11:33:20 -0700 (Sat, 20 Oct 2007) | 2 lines
Change title, for now.
........
r58569 | georg.brandl | 2007-10-20 11:39:25 -0700 (Sat, 20 Oct 2007) | 2 lines
Add entry to ACKS.
........
r58570 | georg.brandl | 2007-10-20 12:05:45 -0700 (Sat, 20 Oct 2007) | 2 lines
Clarify -E docs.
........
r58571 | georg.brandl | 2007-10-20 12:08:36 -0700 (Sat, 20 Oct 2007) | 2 lines
Even more clarification.
........
r58572 | andrew.kuchling | 2007-10-20 12:25:37 -0700 (Sat, 20 Oct 2007) | 1 line
Fix protocol name
........
r58573 | andrew.kuchling | 2007-10-20 12:35:18 -0700 (Sat, 20 Oct 2007) | 1 line
Various items
........
r58574 | andrew.kuchling | 2007-10-20 12:39:35 -0700 (Sat, 20 Oct 2007) | 1 line
Use correct header line
........
r58576 | armin.rigo | 2007-10-21 02:14:15 -0700 (Sun, 21 Oct 2007) | 3 lines
Add a crasher for the long-standing issue with closing a file
while another thread uses it.
........
r58577 | georg.brandl | 2007-10-21 03:01:56 -0700 (Sun, 21 Oct 2007) | 2 lines
Remove duplicate crasher.
........
r58578 | georg.brandl | 2007-10-21 03:24:20 -0700 (Sun, 21 Oct 2007) | 2 lines
Unify "byte code" to "bytecode". Also sprinkle :term: markup for it.
........
r58579 | georg.brandl | 2007-10-21 03:32:54 -0700 (Sun, 21 Oct 2007) | 2 lines
Add markup to new function descriptions.
........
r58580 | georg.brandl | 2007-10-21 03:45:46 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for descriptors.
........
r58581 | georg.brandl | 2007-10-21 03:46:24 -0700 (Sun, 21 Oct 2007) | 2 lines
Unify "file-descriptor" to "file descriptor".
........
r58582 | georg.brandl | 2007-10-21 03:52:38 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term: for generators.
........
r58583 | georg.brandl | 2007-10-21 05:10:28 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for iterator.
........
r58584 | georg.brandl | 2007-10-21 05:15:05 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for "new-style class".
........
r58588 | neal.norwitz | 2007-10-21 21:47:54 -0700 (Sun, 21 Oct 2007) | 1 line
Add Chris Monson so he can edit PEPs.
........
r58594 | guido.van.rossum | 2007-10-22 09:27:19 -0700 (Mon, 22 Oct 2007) | 4 lines
Issue #1307, patch by Derek Shockey.
When "MAIL" is received without args, an exception happens instead of
sending a 501 syntax error response.
........
r58598 | travis.oliphant | 2007-10-22 19:40:56 -0700 (Mon, 22 Oct 2007) | 1 line
Add phuang patch from Issue 708374 which adds offset parameter to mmap module.
........
r58601 | neal.norwitz | 2007-10-22 22:44:27 -0700 (Mon, 22 Oct 2007) | 2 lines
Bug #1313, fix typo (wrong variable name) in example.
........
r58609 | georg.brandl | 2007-10-23 11:21:35 -0700 (Tue, 23 Oct 2007) | 2 lines
Update Pygments version from externals.
........
r58618 | guido.van.rossum | 2007-10-23 12:25:41 -0700 (Tue, 23 Oct 2007) | 3 lines
Issue 1307 by Derek Shockey, fox the same bug for RCPT.
Neal: please backport!
........
r58620 | raymond.hettinger | 2007-10-23 13:37:41 -0700 (Tue, 23 Oct 2007) | 1 line
Shorter name for namedtuple()
........
r58621 | andrew.kuchling | 2007-10-23 13:55:47 -0700 (Tue, 23 Oct 2007) | 1 line
Update name
........
r58622 | raymond.hettinger | 2007-10-23 14:23:07 -0700 (Tue, 23 Oct 2007) | 1 line
Fixup news entry
........
r58623 | raymond.hettinger | 2007-10-23 18:28:33 -0700 (Tue, 23 Oct 2007) | 1 line
Optimize sum() for integer and float inputs.
........
r58624 | raymond.hettinger | 2007-10-23 19:05:51 -0700 (Tue, 23 Oct 2007) | 1 line
Fixup error return and add support for intermixed ints and floats/
........
r58628 | vinay.sajip | 2007-10-24 03:47:06 -0700 (Wed, 24 Oct 2007) | 1 line
Bug #1321: Fixed logic error in TimedRotatingFileHandler.__init__()
........
r58641 | facundo.batista | 2007-10-24 12:11:08 -0700 (Wed, 24 Oct 2007) | 4 lines
Issue 1290. CharacterData.__repr__ was constructing a string
in response that keeped having a non-ascii character.
........
r58643 | thomas.heller | 2007-10-24 12:50:45 -0700 (Wed, 24 Oct 2007) | 1 line
Added unittest for calling a function with paramflags (backport from py3k branch).
........
r58645 | matthias.klose | 2007-10-24 13:00:44 -0700 (Wed, 24 Oct 2007) | 2 lines
- Build using system ffi library on arm*-linux*.
........
r58651 | georg.brandl | 2007-10-24 14:40:38 -0700 (Wed, 24 Oct 2007) | 2 lines
Bug #1287: make os.environ.pop() work as expected.
........
r58652 | raymond.hettinger | 2007-10-24 19:26:58 -0700 (Wed, 24 Oct 2007) | 1 line
Missing DECREFs
........
r58653 | matthias.klose | 2007-10-24 23:37:24 -0700 (Wed, 24 Oct 2007) | 2 lines
- Build using system ffi library on arm*-linux*, pass --with-system-ffi to CONFIG_ARGS
........
r58655 | thomas.heller | 2007-10-25 12:47:32 -0700 (Thu, 25 Oct 2007) | 2 lines
ffi_type_longdouble may be already #defined.
See issue 1324.
........
r58656 | kurt.kaiser | 2007-10-25 15:43:45 -0700 (Thu, 25 Oct 2007) | 3 lines
Correct an ancient bug in an unused path by removing that path: register() is
now idempotent.
........
r58660 | kurt.kaiser | 2007-10-25 17:10:09 -0700 (Thu, 25 Oct 2007) | 4 lines
1. Add comments to provide top-level documentation.
2. Refactor to use more descriptive names.
3. Enhance tests in main().
........
r58675 | georg.brandl | 2007-10-26 11:30:41 -0700 (Fri, 26 Oct 2007) | 2 lines
Fix new pop() method on os.environ on ignorecase-platforms.
........
r58696 | neal.norwitz | 2007-10-27 15:32:21 -0700 (Sat, 27 Oct 2007) | 1 line
Update URL for Pygments. 0.8.1 is no longer available
........
r58697 | hyeshik.chang | 2007-10-28 04:19:02 -0700 (Sun, 28 Oct 2007) | 3 lines
- Add support for FreeBSD 8 which is recently forked from FreeBSD 7.
- Regenerate IN module for most recent maintenance tree of FreeBSD 6 and 7.
........
r58698 | hyeshik.chang | 2007-10-28 05:38:09 -0700 (Sun, 28 Oct 2007) | 2 lines
Enable platform-specific tweaks for FreeBSD 8 (exactly same to FreeBSD 7's yet)
........
r58700 | kurt.kaiser | 2007-10-28 12:03:59 -0700 (Sun, 28 Oct 2007) | 2 lines
Add confirmation dialog before printing. Patch 1717170 Tal Einat.
........
r58706 | guido.van.rossum | 2007-10-29 13:52:45 -0700 (Mon, 29 Oct 2007) | 3 lines
Patch 1353 by Jacob Winther.
Add mp4 mapping to mimetypes.py.
........
r58709 | guido.van.rossum | 2007-10-29 15:15:05 -0700 (Mon, 29 Oct 2007) | 6 lines
Backport fixes for the code that decodes octal escapes (and for PyString
also hex escapes) -- this was reaching beyond the end of the input string
buffer, even though it is not supposed to be \0-terminated.
This has no visible effect but is clearly the correct thing to do.
(In 3.0 it had a visible effect after removing ob_sstate from PyString.)
........
r58710 | kurt.kaiser | 2007-10-29 19:38:54 -0700 (Mon, 29 Oct 2007) | 7 lines
check in Tal Einat's update to tabpage.py
Patch 1612746
M configDialog.py
M NEWS.txt
AM tabbedpages.py
........
r58715 | georg.brandl | 2007-10-30 10:51:18 -0700 (Tue, 30 Oct 2007) | 2 lines
Use correct markup.
........
r58716 | georg.brandl | 2007-10-30 10:57:12 -0700 (Tue, 30 Oct 2007) | 2 lines
Make example about hiding None return values at the prompt clearer.
........
r58728 | neal.norwitz | 2007-10-30 23:33:20 -0700 (Tue, 30 Oct 2007) | 1 line
Fix some compiler warnings for signed comparisons on Unix and Windows.
........
r58731 | martin.v.loewis | 2007-10-31 10:19:33 -0700 (Wed, 31 Oct 2007) | 2 lines
Adding Christian Heimes.
........
r58737 | raymond.hettinger | 2007-10-31 14:57:58 -0700 (Wed, 31 Oct 2007) | 1 line
Clarify the reasons why pickle is almost always better than marshal
........
r58739 | raymond.hettinger | 2007-10-31 15:15:49 -0700 (Wed, 31 Oct 2007) | 1 line
Sets are marshalable.
........
2007-11-01 16:42:39 -03:00
|
|
|
|
2001-07-31 07:46:53 -03:00
|
|
|
self.configure(borderwidth=5)
|
2014-10-17 02:31:35 -03:00
|
|
|
self.title(title or 'IDLE Preferences')
|
2017-06-26 21:48:39 -03:00
|
|
|
x = parent.winfo_rootx() + 20
|
|
|
|
y = parent.winfo_rooty() + (30 if not _htest else 150)
|
|
|
|
self.geometry(f'+{x}+{y}')
|
2017-07-05 01:54:55 -03:00
|
|
|
# Each theme element key is its display name.
|
|
|
|
# The first value of the tuple is the sample area tag name.
|
|
|
|
# The second value is the display name list sort index.
|
2017-06-26 21:48:39 -03:00
|
|
|
self.theme_elements={
|
2015-10-02 23:12:17 -03:00
|
|
|
'Normal Text': ('normal', '00'),
|
|
|
|
'Python Keywords': ('keyword', '01'),
|
|
|
|
'Python Definitions': ('definition', '02'),
|
|
|
|
'Python Builtins': ('builtin', '03'),
|
|
|
|
'Python Comments': ('comment', '04'),
|
|
|
|
'Python Strings': ('string', '05'),
|
|
|
|
'Selected Text': ('hilite', '06'),
|
|
|
|
'Found Text': ('hit', '07'),
|
|
|
|
'Cursor': ('cursor', '08'),
|
|
|
|
'Editor Breakpoint': ('break', '09'),
|
|
|
|
'Shell Normal Text': ('console', '10'),
|
|
|
|
'Shell Error Text': ('error', '11'),
|
|
|
|
'Shell Stdout Text': ('stdout', '12'),
|
|
|
|
'Shell Stderr Text': ('stderr', '13'),
|
2004-03-08 14:15:31 -04:00
|
|
|
}
|
2017-06-26 21:48:39 -03:00
|
|
|
self.create_widgets()
|
2014-08-04 00:02:58 -03:00
|
|
|
self.resizable(height=FALSE, width=FALSE)
|
2001-07-31 07:46:53 -03:00
|
|
|
self.transient(parent)
|
|
|
|
self.grab_set()
|
2017-06-26 21:48:39 -03:00
|
|
|
self.protocol("WM_DELETE_WINDOW", self.cancel)
|
2017-07-09 20:26:32 -03:00
|
|
|
self.fontlist.focus_set()
|
2017-07-05 01:54:55 -03:00
|
|
|
# XXX Decide whether to keep or delete these key bindings.
|
|
|
|
# Key bindings for this dialog.
|
|
|
|
# self.bind('<Escape>', self.Cancel) #dismiss dialog, no save
|
|
|
|
# self.bind('<Alt-a>', self.Apply) #apply changes, save
|
|
|
|
# self.bind('<F1>', self.Help) #context help
|
2017-06-26 21:48:39 -03:00
|
|
|
self.load_configs()
|
2017-07-05 01:54:55 -03:00
|
|
|
self.attach_var_callbacks() # Avoid callbacks during load_configs.
|
Merged revisions 58221-58741 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r58221 | georg.brandl | 2007-09-20 10:57:59 -0700 (Thu, 20 Sep 2007) | 2 lines
Patch #1181: add os.environ.clear() method.
........
r58225 | sean.reifschneider | 2007-09-20 23:33:28 -0700 (Thu, 20 Sep 2007) | 3 lines
Issue1704287: "make install" fails unless you do "make" first. Make
oldsharedmods and sharedmods in "libinstall".
........
r58232 | guido.van.rossum | 2007-09-22 13:18:03 -0700 (Sat, 22 Sep 2007) | 4 lines
Patch # 188 by Philip Jenvey.
Make tell() mark CRLF as a newline.
With unit test.
........
r58242 | georg.brandl | 2007-09-24 10:55:47 -0700 (Mon, 24 Sep 2007) | 2 lines
Fix typo and double word.
........
r58245 | georg.brandl | 2007-09-24 10:59:28 -0700 (Mon, 24 Sep 2007) | 2 lines
#1196: document default radix for int().
........
r58247 | georg.brandl | 2007-09-24 11:08:24 -0700 (Mon, 24 Sep 2007) | 2 lines
#1177: accept 2xx responses for https too, not only http.
........
r58249 | andrew.kuchling | 2007-09-24 16:45:51 -0700 (Mon, 24 Sep 2007) | 1 line
Remove stray odd character; grammar fix
........
r58250 | andrew.kuchling | 2007-09-24 16:46:28 -0700 (Mon, 24 Sep 2007) | 1 line
Typo fix
........
r58251 | andrew.kuchling | 2007-09-24 17:09:42 -0700 (Mon, 24 Sep 2007) | 1 line
Add various items
........
r58268 | vinay.sajip | 2007-09-26 22:34:45 -0700 (Wed, 26 Sep 2007) | 1 line
Change to flush and close logic to fix #1760556.
........
r58269 | vinay.sajip | 2007-09-26 22:38:51 -0700 (Wed, 26 Sep 2007) | 1 line
Change to basicConfig() to fix #1021.
........
r58270 | georg.brandl | 2007-09-26 23:26:58 -0700 (Wed, 26 Sep 2007) | 2 lines
#1208: document match object's boolean value.
........
r58271 | vinay.sajip | 2007-09-26 23:56:13 -0700 (Wed, 26 Sep 2007) | 1 line
Minor date change.
........
r58272 | vinay.sajip | 2007-09-27 00:35:10 -0700 (Thu, 27 Sep 2007) | 1 line
Change to LogRecord.__init__() to fix #1206. Note that archaic use of type(x) == types.DictType is because of keeping 1.5.2 compatibility. While this is much less relevant these days, there probably needs to be a separate commit for removing all archaic constructs at the same time.
........
r58288 | brett.cannon | 2007-09-30 12:45:10 -0700 (Sun, 30 Sep 2007) | 9 lines
tuple.__repr__ did not consider a reference loop as it is not possible from
Python code; but it is possible from C. object.__str__ had the issue of not
expecting a type to doing something within it's tp_str implementation that
could trigger an infinite recursion, but it could in C code.. Both found
thanks to BaseException and how it handles its repr.
Closes issue #1686386. Thanks to Thomas Herve for taking an initial stab at
coming up with a solution.
........
r58289 | brett.cannon | 2007-09-30 13:37:19 -0700 (Sun, 30 Sep 2007) | 3 lines
Fix error introduced by r58288; if a tuple is length 0 return its repr and
don't worry about any self-referring tuples.
........
r58294 | facundo.batista | 2007-10-02 10:01:24 -0700 (Tue, 02 Oct 2007) | 11 lines
Made the various is_* operations return booleans. This was discussed
with Cawlishaw by mail, and he basically confirmed that to these is_*
operations, there's no need to return Decimal(0) and Decimal(1) if
the language supports the False and True booleans.
Also added a few tests for the these functions in extra.decTest, since
they are mostly untested (apart from the doctests).
Thanks Mark Dickinson
........
r58295 | facundo.batista | 2007-10-02 11:21:18 -0700 (Tue, 02 Oct 2007) | 4 lines
Added a class to store the digits of log(10), so that they can be made
available when necessary without recomputing. Thanks Mark Dickinson
........
r58299 | mark.summerfield | 2007-10-03 01:53:21 -0700 (Wed, 03 Oct 2007) | 4 lines
Added note in footnote about string comparisons about
unicodedata.normalize().
........
r58304 | raymond.hettinger | 2007-10-03 14:18:11 -0700 (Wed, 03 Oct 2007) | 1 line
enumerate() is no longer bounded to using sequences shorter than LONG_MAX. The possibility of overflow was sending some newsgroup posters into a tizzy.
........
r58305 | raymond.hettinger | 2007-10-03 17:20:27 -0700 (Wed, 03 Oct 2007) | 1 line
itertools.count() no longer limited to sys.maxint.
........
r58306 | kurt.kaiser | 2007-10-03 18:49:54 -0700 (Wed, 03 Oct 2007) | 3 lines
Assume that the user knows when he wants to end the line; don't insert
something he didn't select or complete.
........
r58307 | kurt.kaiser | 2007-10-03 19:07:50 -0700 (Wed, 03 Oct 2007) | 2 lines
Remove unused theme that was causing a fault in p3k.
........
r58308 | kurt.kaiser | 2007-10-03 19:09:17 -0700 (Wed, 03 Oct 2007) | 2 lines
Clean up EditorWindow close.
........
r58309 | kurt.kaiser | 2007-10-03 19:53:07 -0700 (Wed, 03 Oct 2007) | 7 lines
textView cleanup. Patch 1718043 Tal Einat.
M idlelib/EditorWindow.py
M idlelib/aboutDialog.py
M idlelib/textView.py
M idlelib/NEWS.txt
........
r58310 | kurt.kaiser | 2007-10-03 20:11:12 -0700 (Wed, 03 Oct 2007) | 3 lines
configDialog cleanup. Patch 1730217 Tal Einat.
........
r58311 | neal.norwitz | 2007-10-03 23:00:48 -0700 (Wed, 03 Oct 2007) | 4 lines
Coverity #151: Remove deadcode.
All this code already exists above starting at line 653.
........
r58325 | fred.drake | 2007-10-04 19:46:12 -0700 (Thu, 04 Oct 2007) | 1 line
wrap lines to <80 characters before fixing errors
........
r58326 | raymond.hettinger | 2007-10-04 19:47:07 -0700 (Thu, 04 Oct 2007) | 6 lines
Add __asdict__() to NamedTuple and refine the docs.
Add maxlen support to deque() and fixup docs.
Partially fix __reduce__(). The None as a third arg was no longer supported.
Still needs work on __reduce__() to handle recursive inputs.
........
r58327 | fred.drake | 2007-10-04 19:48:32 -0700 (Thu, 04 Oct 2007) | 3 lines
move descriptions of ac_(in|out)_buffer_size to the right place
http://bugs.python.org/issue1053
........
r58329 | neal.norwitz | 2007-10-04 20:39:17 -0700 (Thu, 04 Oct 2007) | 3 lines
dict could be NULL, so we need to XDECREF.
Fix a compiler warning about passing a PyTypeObject* instead of PyObject*.
........
r58330 | neal.norwitz | 2007-10-04 20:41:19 -0700 (Thu, 04 Oct 2007) | 2 lines
Fix Coverity #158: Check the correct variable.
........
r58332 | neal.norwitz | 2007-10-04 22:01:38 -0700 (Thu, 04 Oct 2007) | 7 lines
Fix Coverity #159.
This code was broken if save() returned a negative number since i contained
a boolean value and then we compared i < 0 which should never be true.
Will backport (assuming it's necessary)
........
r58334 | neal.norwitz | 2007-10-04 22:29:17 -0700 (Thu, 04 Oct 2007) | 1 line
Add a note about fixing some more warnings found by Coverity.
........
r58338 | raymond.hettinger | 2007-10-05 12:07:31 -0700 (Fri, 05 Oct 2007) | 1 line
Restore BEGIN/END THREADS macros which were squashed in the previous checkin
........
r58343 | gregory.p.smith | 2007-10-06 00:48:10 -0700 (Sat, 06 Oct 2007) | 3 lines
Stab in the dark attempt to fix the test_bsddb3 failure on sparc and S-390
ubuntu buildbots.
........
r58344 | gregory.p.smith | 2007-10-06 00:51:59 -0700 (Sat, 06 Oct 2007) | 2 lines
Allows BerkeleyDB 4.6.x >= 4.6.21 for the bsddb module.
........
r58348 | gregory.p.smith | 2007-10-06 08:47:37 -0700 (Sat, 06 Oct 2007) | 3 lines
Use the host the author likely meant in the first place. pop.gmail.com is
reliable. gmail.org is someones personal domain.
........
r58351 | neal.norwitz | 2007-10-06 12:16:28 -0700 (Sat, 06 Oct 2007) | 3 lines
Ensure that this test will pass even if another test left an unwritable TESTFN.
Also use the safe unlink in test_support instead of rolling our own here.
........
r58368 | georg.brandl | 2007-10-08 00:50:24 -0700 (Mon, 08 Oct 2007) | 3 lines
#1123: fix the docs for the str.split(None, sep) case.
Also expand a few other methods' docs, which had more info in the deprecated string module docs.
........
r58369 | georg.brandl | 2007-10-08 01:06:05 -0700 (Mon, 08 Oct 2007) | 2 lines
Update docstring of sched, also remove an unused assignment.
........
r58370 | raymond.hettinger | 2007-10-08 02:14:28 -0700 (Mon, 08 Oct 2007) | 5 lines
Add comments to NamedTuple code.
Let the field spec be either a string or a non-string sequence (suggested by Martin Blais with use cases).
Improve the error message in the case of a SyntaxError (caused by a duplicate field name).
........
r58371 | raymond.hettinger | 2007-10-08 02:56:29 -0700 (Mon, 08 Oct 2007) | 1 line
Missed a line in the docs
........
r58372 | raymond.hettinger | 2007-10-08 03:11:51 -0700 (Mon, 08 Oct 2007) | 1 line
Better variable names
........
r58376 | georg.brandl | 2007-10-08 07:12:47 -0700 (Mon, 08 Oct 2007) | 3 lines
#1199: docs for tp_as_{number,sequence,mapping}, by Amaury Forgeot d'Arc.
No need to merge this to py3k!
........
r58380 | raymond.hettinger | 2007-10-08 14:26:58 -0700 (Mon, 08 Oct 2007) | 1 line
Eliminate camelcase function name
........
r58381 | andrew.kuchling | 2007-10-08 16:23:03 -0700 (Mon, 08 Oct 2007) | 1 line
Eliminate camelcase function name
........
r58382 | raymond.hettinger | 2007-10-08 18:36:23 -0700 (Mon, 08 Oct 2007) | 1 line
Make the error messages more specific
........
r58384 | gregory.p.smith | 2007-10-08 23:02:21 -0700 (Mon, 08 Oct 2007) | 10 lines
Splits Modules/_bsddb.c up into bsddb.h and _bsddb.c and adds a C API
object available as bsddb.db.api. This is based on the patch submitted
by Duncan Grisby here:
http://sourceforge.net/tracker/index.php?func=detail&aid=1551895&group_id=13900&atid=313900
See this thread for additional info:
http://sourceforge.net/mailarchive/forum.php?thread_name=E1GAVDK-0002rk-Iw%40apasphere.com&forum_name=pybsddb-users
It also cleans up the code a little by removing some ifdef/endifs for
python prior to 2.1 and for unsupported Berkeley DB <= 3.2.
........
r58385 | gregory.p.smith | 2007-10-08 23:50:43 -0700 (Mon, 08 Oct 2007) | 5 lines
Fix a double free when positioning a database cursor to a non-existant
string key (and probably a few other situations with string keys).
This was reported with a patch as pybsddb sourceforge bug 1708868 by
jjjhhhlll at gmail.
........
r58386 | gregory.p.smith | 2007-10-09 00:19:11 -0700 (Tue, 09 Oct 2007) | 3 lines
Use the highest cPickle protocol in bsddb.dbshelve. This comes from
sourceforge pybsddb patch 1551443 by w_barnes.
........
r58394 | gregory.p.smith | 2007-10-09 11:26:02 -0700 (Tue, 09 Oct 2007) | 2 lines
remove another sleepycat reference
........
r58396 | kurt.kaiser | 2007-10-09 12:31:30 -0700 (Tue, 09 Oct 2007) | 3 lines
Allow interrupt only when executing user code in subprocess
Patch 1225 Tal Einat modified from IDLE-Spoon.
........
r58399 | brett.cannon | 2007-10-09 17:07:50 -0700 (Tue, 09 Oct 2007) | 5 lines
Remove file-level typedefs that were inconsistently used throughout the file.
Just move over to the public API names.
Closes issue1238.
........
r58401 | raymond.hettinger | 2007-10-09 17:26:46 -0700 (Tue, 09 Oct 2007) | 1 line
Accept Jim Jewett's api suggestion to use None instead of -1 to indicate unbounded deques.
........
r58403 | kurt.kaiser | 2007-10-09 17:55:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Allow cursor color change w/o restart. Patch 1725576 Tal Einat.
........
r58404 | kurt.kaiser | 2007-10-09 18:06:47 -0700 (Tue, 09 Oct 2007) | 2 lines
show paste if > 80 columns. Patch 1659326 Tal Einat.
........
r58415 | thomas.heller | 2007-10-11 12:51:32 -0700 (Thu, 11 Oct 2007) | 5 lines
On OS X, use os.uname() instead of gestalt.sysv(...) to get the
operating system version. This allows to use ctypes when Python
was configured with --disable-toolbox-glue.
........
r58419 | neal.norwitz | 2007-10-11 20:01:01 -0700 (Thu, 11 Oct 2007) | 1 line
Get rid of warning about not being able to create an existing directory.
........
r58420 | neal.norwitz | 2007-10-11 20:01:30 -0700 (Thu, 11 Oct 2007) | 1 line
Get rid of warnings on a bunch of platforms by using a proper prototype.
........
r58421 | neal.norwitz | 2007-10-11 20:01:54 -0700 (Thu, 11 Oct 2007) | 4 lines
Get rid of compiler warning about retval being used (returned) without
being initialized. (gcc warning and Coverity 202)
........
r58422 | neal.norwitz | 2007-10-11 20:03:23 -0700 (Thu, 11 Oct 2007) | 1 line
Fix Coverity 168: Close the file before returning (exiting).
........
r58423 | neal.norwitz | 2007-10-11 20:04:18 -0700 (Thu, 11 Oct 2007) | 4 lines
Fix Coverity 180: Don't overallocate. We don't need structs, but pointers.
Also fix a memory leak.
........
r58424 | neal.norwitz | 2007-10-11 20:05:19 -0700 (Thu, 11 Oct 2007) | 5 lines
Fix Coverity 185-186: If the passed in FILE is NULL, uninitialized memory
would be accessed.
Will backport.
........
r58425 | neal.norwitz | 2007-10-11 20:52:34 -0700 (Thu, 11 Oct 2007) | 1 line
Get this module to compile with bsddb versions prior to 4.3
........
r58430 | martin.v.loewis | 2007-10-12 01:56:52 -0700 (Fri, 12 Oct 2007) | 3 lines
Bug #1216: Restore support for Visual Studio 2002.
Will backport to 2.5.
........
r58433 | raymond.hettinger | 2007-10-12 10:53:11 -0700 (Fri, 12 Oct 2007) | 1 line
Fix test of count.__repr__() to ignore the 'L' if the count is a long
........
r58434 | gregory.p.smith | 2007-10-12 11:44:06 -0700 (Fri, 12 Oct 2007) | 4 lines
Fixes http://bugs.python.org/issue1233 - bsddb.dbshelve.DBShelf.append
was useless due to inverted logic. Also adds a test case for RECNO dbs
to test_dbshelve.
........
r58445 | georg.brandl | 2007-10-13 06:20:03 -0700 (Sat, 13 Oct 2007) | 2 lines
Fix email example.
........
r58450 | gregory.p.smith | 2007-10-13 16:02:05 -0700 (Sat, 13 Oct 2007) | 2 lines
Fix an uncollectable reference leak in bsddb.db.DBShelf.append
........
r58453 | neal.norwitz | 2007-10-13 17:18:40 -0700 (Sat, 13 Oct 2007) | 8 lines
Let the O/S supply a port if none of the default ports can be used.
This should make the tests more robust at the expense of allowing
tests to be sloppier by not requiring them to cleanup after themselves.
(It will legitamitely help when running two test suites simultaneously
or if another process is already using one of the predefined ports.)
Also simplifies (slightLy) the exception handling elsewhere.
........
r58459 | neal.norwitz | 2007-10-14 11:30:21 -0700 (Sun, 14 Oct 2007) | 2 lines
Don't raise a string exception, they don't work anymore.
........
r58460 | neal.norwitz | 2007-10-14 11:40:37 -0700 (Sun, 14 Oct 2007) | 1 line
Use unittest for assertions
........
r58468 | armin.rigo | 2007-10-15 00:48:35 -0700 (Mon, 15 Oct 2007) | 2 lines
test_bigbits was not testing what it seemed to.
........
r58471 | guido.van.rossum | 2007-10-15 08:54:11 -0700 (Mon, 15 Oct 2007) | 3 lines
Change a PyErr_Print() into a PyErr_Clear(),
per discussion in issue 1031213.
........
r58500 | raymond.hettinger | 2007-10-16 12:18:30 -0700 (Tue, 16 Oct 2007) | 1 line
Improve error messages
........
r58506 | raymond.hettinger | 2007-10-16 14:28:32 -0700 (Tue, 16 Oct 2007) | 1 line
More docs, error messages, and tests
........
r58507 | andrew.kuchling | 2007-10-16 15:58:03 -0700 (Tue, 16 Oct 2007) | 1 line
Add items
........
r58508 | brett.cannon | 2007-10-16 16:24:06 -0700 (Tue, 16 Oct 2007) | 3 lines
Remove ``:const:`` notation on None in parameter list. Since the markup is not
rendered for parameters it just showed up as ``:const:`None` `` in the output.
........
r58509 | brett.cannon | 2007-10-16 16:26:45 -0700 (Tue, 16 Oct 2007) | 3 lines
Re-order some functions whose parameters differ between PyObject and const char
* so that they are next to each other.
........
r58522 | armin.rigo | 2007-10-17 11:46:37 -0700 (Wed, 17 Oct 2007) | 5 lines
Fix the overflow checking of list_repeat.
Introduce overflow checking into list_inplace_repeat.
Backport candidate, possibly.
........
r58530 | facundo.batista | 2007-10-17 20:16:03 -0700 (Wed, 17 Oct 2007) | 7 lines
Issue #1580738. When HTTPConnection reads the whole stream with read(),
it closes itself. When the stream is read in several calls to read(n),
it should behave in the same way if HTTPConnection knows where the end
of the stream is (through self.length). Added a test case for this
behaviour.
........
r58531 | facundo.batista | 2007-10-17 20:44:48 -0700 (Wed, 17 Oct 2007) | 3 lines
Issue 1289, just a typo.
........
r58532 | gregory.p.smith | 2007-10-18 00:56:54 -0700 (Thu, 18 Oct 2007) | 4 lines
cleanup test_dbtables to use mkdtemp. cleanup dbtables to pass txn as a
keyword argument whenever possible to avoid bugs and confusion. (dbtables.py
line 447 self.db.get using txn as a non-keyword was an actual bug due to this)
........
r58533 | gregory.p.smith | 2007-10-18 01:34:20 -0700 (Thu, 18 Oct 2007) | 4 lines
Fix a weird bug in dbtables: if it chose a random rowid string that contained
NULL bytes it would cause the database all sorts of problems in the future
leading to very strange random failures and corrupt dbtables.bsdTableDb dbs.
........
r58534 | gregory.p.smith | 2007-10-18 09:32:02 -0700 (Thu, 18 Oct 2007) | 3 lines
A cleaner fix than the one committed last night. Generate random rowids that
do not contain null bytes.
........
r58537 | gregory.p.smith | 2007-10-18 10:17:57 -0700 (Thu, 18 Oct 2007) | 2 lines
mention bsddb fixes.
........
r58538 | raymond.hettinger | 2007-10-18 14:13:06 -0700 (Thu, 18 Oct 2007) | 1 line
Remove useless warning
........
r58539 | gregory.p.smith | 2007-10-19 00:31:20 -0700 (Fri, 19 Oct 2007) | 2 lines
squelch the warning that this test is supposed to trigger.
........
r58542 | georg.brandl | 2007-10-19 05:32:39 -0700 (Fri, 19 Oct 2007) | 2 lines
Clarify wording for apply().
........
r58544 | mark.summerfield | 2007-10-19 05:48:17 -0700 (Fri, 19 Oct 2007) | 3 lines
Added a cross-ref to each other.
........
r58545 | georg.brandl | 2007-10-19 10:38:49 -0700 (Fri, 19 Oct 2007) | 2 lines
#1284: "S" means "seen", not unread.
........
r58548 | thomas.heller | 2007-10-19 11:11:41 -0700 (Fri, 19 Oct 2007) | 4 lines
Fix ctypes on 32-bit systems when Python is configured --with-system-ffi.
See also https://bugs.launchpad.net/bugs/72505.
Ported from release25-maint branch.
........
r58550 | facundo.batista | 2007-10-19 12:25:57 -0700 (Fri, 19 Oct 2007) | 8 lines
The constructor from tuple was way too permissive: it allowed bad
coefficient numbers, floats in the sign, and other details that
generated directly the wrong number in the best case, or triggered
misfunctionality in the alorithms.
Test cases added for these issues. Thanks Mark Dickinson.
........
r58559 | georg.brandl | 2007-10-20 06:22:53 -0700 (Sat, 20 Oct 2007) | 2 lines
Fix code being interpreted as a target.
........
r58561 | georg.brandl | 2007-10-20 06:36:24 -0700 (Sat, 20 Oct 2007) | 2 lines
Document new "cmdoption" directive.
........
r58562 | georg.brandl | 2007-10-20 08:21:22 -0700 (Sat, 20 Oct 2007) | 2 lines
Make a path more Unix-standardy.
........
r58564 | georg.brandl | 2007-10-20 10:51:39 -0700 (Sat, 20 Oct 2007) | 2 lines
Document new directive "envvar".
........
r58567 | georg.brandl | 2007-10-20 11:08:14 -0700 (Sat, 20 Oct 2007) | 6 lines
* Add new toplevel chapter, "Using Python." (how to install,
configure and setup python on different platforms -- at least
in theory.)
* Move the Python on Mac docs in that chapter.
* Add a new chapter about the command line invocation, by stargaming.
........
r58568 | georg.brandl | 2007-10-20 11:33:20 -0700 (Sat, 20 Oct 2007) | 2 lines
Change title, for now.
........
r58569 | georg.brandl | 2007-10-20 11:39:25 -0700 (Sat, 20 Oct 2007) | 2 lines
Add entry to ACKS.
........
r58570 | georg.brandl | 2007-10-20 12:05:45 -0700 (Sat, 20 Oct 2007) | 2 lines
Clarify -E docs.
........
r58571 | georg.brandl | 2007-10-20 12:08:36 -0700 (Sat, 20 Oct 2007) | 2 lines
Even more clarification.
........
r58572 | andrew.kuchling | 2007-10-20 12:25:37 -0700 (Sat, 20 Oct 2007) | 1 line
Fix protocol name
........
r58573 | andrew.kuchling | 2007-10-20 12:35:18 -0700 (Sat, 20 Oct 2007) | 1 line
Various items
........
r58574 | andrew.kuchling | 2007-10-20 12:39:35 -0700 (Sat, 20 Oct 2007) | 1 line
Use correct header line
........
r58576 | armin.rigo | 2007-10-21 02:14:15 -0700 (Sun, 21 Oct 2007) | 3 lines
Add a crasher for the long-standing issue with closing a file
while another thread uses it.
........
r58577 | georg.brandl | 2007-10-21 03:01:56 -0700 (Sun, 21 Oct 2007) | 2 lines
Remove duplicate crasher.
........
r58578 | georg.brandl | 2007-10-21 03:24:20 -0700 (Sun, 21 Oct 2007) | 2 lines
Unify "byte code" to "bytecode". Also sprinkle :term: markup for it.
........
r58579 | georg.brandl | 2007-10-21 03:32:54 -0700 (Sun, 21 Oct 2007) | 2 lines
Add markup to new function descriptions.
........
r58580 | georg.brandl | 2007-10-21 03:45:46 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for descriptors.
........
r58581 | georg.brandl | 2007-10-21 03:46:24 -0700 (Sun, 21 Oct 2007) | 2 lines
Unify "file-descriptor" to "file descriptor".
........
r58582 | georg.brandl | 2007-10-21 03:52:38 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term: for generators.
........
r58583 | georg.brandl | 2007-10-21 05:10:28 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for iterator.
........
r58584 | georg.brandl | 2007-10-21 05:15:05 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for "new-style class".
........
r58588 | neal.norwitz | 2007-10-21 21:47:54 -0700 (Sun, 21 Oct 2007) | 1 line
Add Chris Monson so he can edit PEPs.
........
r58594 | guido.van.rossum | 2007-10-22 09:27:19 -0700 (Mon, 22 Oct 2007) | 4 lines
Issue #1307, patch by Derek Shockey.
When "MAIL" is received without args, an exception happens instead of
sending a 501 syntax error response.
........
r58598 | travis.oliphant | 2007-10-22 19:40:56 -0700 (Mon, 22 Oct 2007) | 1 line
Add phuang patch from Issue 708374 which adds offset parameter to mmap module.
........
r58601 | neal.norwitz | 2007-10-22 22:44:27 -0700 (Mon, 22 Oct 2007) | 2 lines
Bug #1313, fix typo (wrong variable name) in example.
........
r58609 | georg.brandl | 2007-10-23 11:21:35 -0700 (Tue, 23 Oct 2007) | 2 lines
Update Pygments version from externals.
........
r58618 | guido.van.rossum | 2007-10-23 12:25:41 -0700 (Tue, 23 Oct 2007) | 3 lines
Issue 1307 by Derek Shockey, fox the same bug for RCPT.
Neal: please backport!
........
r58620 | raymond.hettinger | 2007-10-23 13:37:41 -0700 (Tue, 23 Oct 2007) | 1 line
Shorter name for namedtuple()
........
r58621 | andrew.kuchling | 2007-10-23 13:55:47 -0700 (Tue, 23 Oct 2007) | 1 line
Update name
........
r58622 | raymond.hettinger | 2007-10-23 14:23:07 -0700 (Tue, 23 Oct 2007) | 1 line
Fixup news entry
........
r58623 | raymond.hettinger | 2007-10-23 18:28:33 -0700 (Tue, 23 Oct 2007) | 1 line
Optimize sum() for integer and float inputs.
........
r58624 | raymond.hettinger | 2007-10-23 19:05:51 -0700 (Tue, 23 Oct 2007) | 1 line
Fixup error return and add support for intermixed ints and floats/
........
r58628 | vinay.sajip | 2007-10-24 03:47:06 -0700 (Wed, 24 Oct 2007) | 1 line
Bug #1321: Fixed logic error in TimedRotatingFileHandler.__init__()
........
r58641 | facundo.batista | 2007-10-24 12:11:08 -0700 (Wed, 24 Oct 2007) | 4 lines
Issue 1290. CharacterData.__repr__ was constructing a string
in response that keeped having a non-ascii character.
........
r58643 | thomas.heller | 2007-10-24 12:50:45 -0700 (Wed, 24 Oct 2007) | 1 line
Added unittest for calling a function with paramflags (backport from py3k branch).
........
r58645 | matthias.klose | 2007-10-24 13:00:44 -0700 (Wed, 24 Oct 2007) | 2 lines
- Build using system ffi library on arm*-linux*.
........
r58651 | georg.brandl | 2007-10-24 14:40:38 -0700 (Wed, 24 Oct 2007) | 2 lines
Bug #1287: make os.environ.pop() work as expected.
........
r58652 | raymond.hettinger | 2007-10-24 19:26:58 -0700 (Wed, 24 Oct 2007) | 1 line
Missing DECREFs
........
r58653 | matthias.klose | 2007-10-24 23:37:24 -0700 (Wed, 24 Oct 2007) | 2 lines
- Build using system ffi library on arm*-linux*, pass --with-system-ffi to CONFIG_ARGS
........
r58655 | thomas.heller | 2007-10-25 12:47:32 -0700 (Thu, 25 Oct 2007) | 2 lines
ffi_type_longdouble may be already #defined.
See issue 1324.
........
r58656 | kurt.kaiser | 2007-10-25 15:43:45 -0700 (Thu, 25 Oct 2007) | 3 lines
Correct an ancient bug in an unused path by removing that path: register() is
now idempotent.
........
r58660 | kurt.kaiser | 2007-10-25 17:10:09 -0700 (Thu, 25 Oct 2007) | 4 lines
1. Add comments to provide top-level documentation.
2. Refactor to use more descriptive names.
3. Enhance tests in main().
........
r58675 | georg.brandl | 2007-10-26 11:30:41 -0700 (Fri, 26 Oct 2007) | 2 lines
Fix new pop() method on os.environ on ignorecase-platforms.
........
r58696 | neal.norwitz | 2007-10-27 15:32:21 -0700 (Sat, 27 Oct 2007) | 1 line
Update URL for Pygments. 0.8.1 is no longer available
........
r58697 | hyeshik.chang | 2007-10-28 04:19:02 -0700 (Sun, 28 Oct 2007) | 3 lines
- Add support for FreeBSD 8 which is recently forked from FreeBSD 7.
- Regenerate IN module for most recent maintenance tree of FreeBSD 6 and 7.
........
r58698 | hyeshik.chang | 2007-10-28 05:38:09 -0700 (Sun, 28 Oct 2007) | 2 lines
Enable platform-specific tweaks for FreeBSD 8 (exactly same to FreeBSD 7's yet)
........
r58700 | kurt.kaiser | 2007-10-28 12:03:59 -0700 (Sun, 28 Oct 2007) | 2 lines
Add confirmation dialog before printing. Patch 1717170 Tal Einat.
........
r58706 | guido.van.rossum | 2007-10-29 13:52:45 -0700 (Mon, 29 Oct 2007) | 3 lines
Patch 1353 by Jacob Winther.
Add mp4 mapping to mimetypes.py.
........
r58709 | guido.van.rossum | 2007-10-29 15:15:05 -0700 (Mon, 29 Oct 2007) | 6 lines
Backport fixes for the code that decodes octal escapes (and for PyString
also hex escapes) -- this was reaching beyond the end of the input string
buffer, even though it is not supposed to be \0-terminated.
This has no visible effect but is clearly the correct thing to do.
(In 3.0 it had a visible effect after removing ob_sstate from PyString.)
........
r58710 | kurt.kaiser | 2007-10-29 19:38:54 -0700 (Mon, 29 Oct 2007) | 7 lines
check in Tal Einat's update to tabpage.py
Patch 1612746
M configDialog.py
M NEWS.txt
AM tabbedpages.py
........
r58715 | georg.brandl | 2007-10-30 10:51:18 -0700 (Tue, 30 Oct 2007) | 2 lines
Use correct markup.
........
r58716 | georg.brandl | 2007-10-30 10:57:12 -0700 (Tue, 30 Oct 2007) | 2 lines
Make example about hiding None return values at the prompt clearer.
........
r58728 | neal.norwitz | 2007-10-30 23:33:20 -0700 (Tue, 30 Oct 2007) | 1 line
Fix some compiler warnings for signed comparisons on Unix and Windows.
........
r58731 | martin.v.loewis | 2007-10-31 10:19:33 -0700 (Wed, 31 Oct 2007) | 2 lines
Adding Christian Heimes.
........
r58737 | raymond.hettinger | 2007-10-31 14:57:58 -0700 (Wed, 31 Oct 2007) | 1 line
Clarify the reasons why pickle is almost always better than marshal
........
r58739 | raymond.hettinger | 2007-10-31 15:15:49 -0700 (Wed, 31 Oct 2007) | 1 line
Sets are marshalable.
........
2007-11-01 16:42:39 -03:00
|
|
|
|
2014-07-15 00:07:32 -03:00
|
|
|
if not _utest:
|
|
|
|
self.wm_deiconify()
|
|
|
|
self.wait_window()
|
2002-12-31 12:03:23 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def create_widgets(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Create and place widgets for tabbed dialog."
|
2017-06-26 21:48:39 -03:00
|
|
|
self.tab_pages = TabbedPageSet(self,
|
2015-10-13 23:03:51 -03:00
|
|
|
page_names=['Fonts/Tabs', 'Highlighting', 'Keys', 'General',
|
|
|
|
'Extensions'])
|
2017-06-26 21:48:39 -03:00
|
|
|
self.tab_pages.pack(side=TOP, expand=TRUE, fill=BOTH)
|
|
|
|
self.create_page_font_tab()
|
|
|
|
self.create_page_highlight()
|
|
|
|
self.create_page_keys()
|
|
|
|
self.create_page_general()
|
|
|
|
self.create_page_extensions()
|
2014-10-08 21:29:13 -03:00
|
|
|
self.create_action_buttons().pack(side=BOTTOM)
|
2015-10-11 23:07:31 -03:00
|
|
|
|
2014-10-08 21:29:13 -03:00
|
|
|
def create_action_buttons(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Return frame of action buttons for dialog."
|
2016-05-28 14:22:31 -03:00
|
|
|
if macosx.isAquaTk():
|
2014-07-26 20:40:16 -03:00
|
|
|
# Changing the default padding on OSX results in unreadable
|
2017-07-05 01:54:55 -03:00
|
|
|
# text in the buttons.
|
2017-06-26 21:48:39 -03:00
|
|
|
padding_args = {}
|
2009-02-12 12:02:11 -04:00
|
|
|
else:
|
2017-06-26 21:48:39 -03:00
|
|
|
padding_args = {'padx':6, 'pady':3}
|
2014-10-22 21:15:18 -03:00
|
|
|
outer = Frame(self, pady=2)
|
|
|
|
buttons = Frame(outer, pady=2)
|
2015-10-11 23:07:31 -03:00
|
|
|
for txt, cmd in (
|
2017-06-26 21:48:39 -03:00
|
|
|
('Ok', self.ok),
|
|
|
|
('Apply', self.apply),
|
|
|
|
('Cancel', self.cancel),
|
|
|
|
('Help', self.help)):
|
2015-10-11 23:07:31 -03:00
|
|
|
Button(buttons, text=txt, command=cmd, takefocus=FALSE,
|
2017-06-26 21:48:39 -03:00
|
|
|
**padding_args).pack(side=LEFT, padx=5)
|
2017-07-05 01:54:55 -03:00
|
|
|
# Add space above buttons.
|
2014-10-22 21:15:18 -03:00
|
|
|
Frame(outer, height=2, borderwidth=0).pack(side=TOP)
|
|
|
|
buttons.pack(side=BOTTOM)
|
|
|
|
return outer
|
2015-10-11 23:07:31 -03:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def create_page_font_tab(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"""Return frame of widgets for Font/Tabs tab.
|
|
|
|
|
|
|
|
Configuration attributes:
|
|
|
|
font_size: Font size.
|
|
|
|
font_bold: Select font bold or not.
|
|
|
|
font_name: Font face.
|
|
|
|
space_num: Indentation width.
|
|
|
|
edit_font: Font widget with default font name, size, and weight.
|
|
|
|
"""
|
2014-07-30 20:24:32 -03:00
|
|
|
parent = self.parent
|
2017-06-26 21:48:39 -03:00
|
|
|
self.font_size = StringVar(parent)
|
|
|
|
self.font_bold = BooleanVar(parent)
|
|
|
|
self.font_name = StringVar(parent)
|
|
|
|
self.space_num = IntVar(parent)
|
|
|
|
self.edit_font = tkFont.Font(parent, ('courier', 10, 'normal'))
|
2014-07-30 20:24:32 -03:00
|
|
|
|
2017-07-09 20:26:32 -03:00
|
|
|
# Create widgets.
|
|
|
|
# body and body section frames.
|
2017-06-26 21:48:39 -03:00
|
|
|
frame = self.tab_pages.pages['Fonts/Tabs'].frame
|
|
|
|
frame_font = LabelFrame(
|
2014-08-04 00:02:58 -03:00
|
|
|
frame, borderwidth=2, relief=GROOVE, text=' Base Editor Font ')
|
2017-06-26 21:48:39 -03:00
|
|
|
frame_indent = LabelFrame(
|
2014-08-04 00:02:58 -03:00
|
|
|
frame, borderwidth=2, relief=GROOVE, text=' Indentation Width ')
|
2017-07-09 20:26:32 -03:00
|
|
|
# frame_font
|
2017-06-26 21:48:39 -03:00
|
|
|
frame_font_name = Frame(frame_font)
|
|
|
|
frame_font_param = Frame(frame_font)
|
|
|
|
font_name_title = Label(
|
|
|
|
frame_font_name, justify=LEFT, text='Font Face :')
|
2017-07-09 20:26:32 -03:00
|
|
|
self.fontlist = Listbox(
|
2017-06-26 21:48:39 -03:00
|
|
|
frame_font_name, height=5, takefocus=FALSE, exportselection=FALSE)
|
2017-07-09 20:26:32 -03:00
|
|
|
self.fontlist.bind('<<ListboxSelect>>', self.on_fontlist_select)
|
2017-06-26 21:48:39 -03:00
|
|
|
scroll_font = Scrollbar(frame_font_name)
|
2017-07-09 20:26:32 -03:00
|
|
|
scroll_font.config(command=self.fontlist.yview)
|
|
|
|
self.fontlist.config(yscrollcommand=scroll_font.set)
|
2017-06-26 21:48:39 -03:00
|
|
|
font_size_title = Label(frame_font_param, text='Size :')
|
|
|
|
self.opt_menu_font_size = DynOptionMenu(
|
|
|
|
frame_font_param, self.font_size, None, command=self.set_font_sample)
|
|
|
|
check_font_bold = Checkbutton(
|
|
|
|
frame_font_param, variable=self.font_bold, onvalue=1,
|
|
|
|
offvalue=0, text='Bold', command=self.set_font_sample)
|
|
|
|
frame_font_sample = Frame(frame_font, relief=SOLID, borderwidth=1)
|
|
|
|
self.font_sample = Label(
|
|
|
|
frame_font_sample, justify=LEFT, font=self.edit_font,
|
2014-08-04 00:02:58 -03:00
|
|
|
text='AaBbCcDdEe\nFfGgHhIiJjK\n1234567890\n#:+=(){}[]')
|
2017-07-09 20:26:32 -03:00
|
|
|
# frame_indent
|
2017-06-26 21:48:39 -03:00
|
|
|
frame_indent_size = Frame(frame_indent)
|
|
|
|
indent_size_title = Label(
|
|
|
|
frame_indent_size, justify=LEFT,
|
2014-08-04 00:02:58 -03:00
|
|
|
text='Python Standard: 4 Spaces!')
|
2017-06-26 21:48:39 -03:00
|
|
|
self.scale_indent_size = Scale(
|
|
|
|
frame_indent_size, variable=self.space_num,
|
2014-08-04 00:02:58 -03:00
|
|
|
orient='horizontal', tickinterval=2, from_=2, to=16)
|
2014-07-30 20:24:32 -03:00
|
|
|
|
2017-07-09 20:26:32 -03:00
|
|
|
# Pack widgets.
|
|
|
|
# body
|
2017-06-26 21:48:39 -03:00
|
|
|
frame_font.pack(side=LEFT, padx=5, pady=5, expand=TRUE, fill=BOTH)
|
|
|
|
frame_indent.pack(side=LEFT, padx=5, pady=5, fill=Y)
|
2017-07-09 20:26:32 -03:00
|
|
|
# frame_font
|
2017-06-26 21:48:39 -03:00
|
|
|
frame_font_name.pack(side=TOP, padx=5, pady=5, fill=X)
|
|
|
|
frame_font_param.pack(side=TOP, padx=5, pady=5, fill=X)
|
|
|
|
font_name_title.pack(side=TOP, anchor=W)
|
2017-07-09 20:26:32 -03:00
|
|
|
self.fontlist.pack(side=LEFT, expand=TRUE, fill=X)
|
2017-06-26 21:48:39 -03:00
|
|
|
scroll_font.pack(side=LEFT, fill=Y)
|
|
|
|
font_size_title.pack(side=LEFT, anchor=W)
|
|
|
|
self.opt_menu_font_size.pack(side=LEFT, anchor=W)
|
|
|
|
check_font_bold.pack(side=LEFT, anchor=W, padx=20)
|
|
|
|
frame_font_sample.pack(side=TOP, padx=5, pady=5, expand=TRUE, fill=BOTH)
|
|
|
|
self.font_sample.pack(expand=TRUE, fill=BOTH)
|
2017-07-09 20:26:32 -03:00
|
|
|
# frame_indent
|
2017-06-26 21:48:39 -03:00
|
|
|
frame_indent_size.pack(side=TOP, fill=X)
|
|
|
|
indent_size_title.pack(side=TOP, anchor=W, padx=5)
|
|
|
|
self.scale_indent_size.pack(side=TOP, padx=5, fill=X)
|
2017-07-09 20:26:32 -03:00
|
|
|
|
2001-08-03 01:43:44 -03:00
|
|
|
return frame
|
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def create_page_highlight(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"""Return frame of widgets for Highlighting tab.
|
|
|
|
|
|
|
|
Configuration attributes:
|
|
|
|
builtin_theme: Menu variable for built-in theme.
|
|
|
|
custom_theme: Menu variable for custom theme.
|
|
|
|
fg_bg_toggle: Toggle for foreground/background color.
|
|
|
|
colour: Color of selected target.
|
|
|
|
is_builtin_theme: Selector for built-in or custom theme.
|
|
|
|
highlight_target: Menu variable for the highlight tag target.
|
|
|
|
"""
|
2014-07-30 20:24:32 -03:00
|
|
|
parent = self.parent
|
2017-06-26 21:48:39 -03:00
|
|
|
self.builtin_theme = StringVar(parent)
|
|
|
|
self.custom_theme = StringVar(parent)
|
|
|
|
self.fg_bg_toggle = BooleanVar(parent)
|
2014-07-30 20:24:32 -03:00
|
|
|
self.colour = StringVar(parent)
|
2017-07-05 01:54:55 -03:00
|
|
|
# XXX - font_name is defined in create_page_font_tab. Needed here too?
|
2017-06-26 21:48:39 -03:00
|
|
|
self.font_name = StringVar(parent)
|
|
|
|
self.is_builtin_theme = BooleanVar(parent)
|
|
|
|
self.highlight_target = StringVar(parent)
|
2014-07-30 20:24:32 -03:00
|
|
|
|
2001-08-03 01:43:44 -03:00
|
|
|
##widget creation
|
|
|
|
#body frame
|
2017-06-26 21:48:39 -03:00
|
|
|
frame = self.tab_pages.pages['Highlighting'].frame
|
2001-08-03 01:43:44 -03:00
|
|
|
#body section frames
|
2017-06-26 21:48:39 -03:00
|
|
|
frame_custom = LabelFrame(frame, borderwidth=2, relief=GROOVE,
|
2014-08-04 00:02:58 -03:00
|
|
|
text=' Custom Highlighting ')
|
2017-06-26 21:48:39 -03:00
|
|
|
frame_theme = LabelFrame(frame, borderwidth=2, relief=GROOVE,
|
2014-08-04 00:02:58 -03:00
|
|
|
text=' Highlighting Theme ')
|
2017-06-26 21:48:39 -03:00
|
|
|
#frame_custom
|
|
|
|
self.text_highlight_sample=Text(
|
|
|
|
frame_custom, relief=SOLID, borderwidth=1,
|
2014-08-04 00:02:58 -03:00
|
|
|
font=('courier', 12, ''), cursor='hand2', width=21, height=11,
|
|
|
|
takefocus=FALSE, highlightthickness=0, wrap=NONE)
|
2017-06-26 21:48:39 -03:00
|
|
|
text=self.text_highlight_sample
|
2014-08-04 00:02:58 -03:00
|
|
|
text.bind('<Double-Button-1>', lambda e: 'break')
|
|
|
|
text.bind('<B1-Motion>', lambda e: 'break')
|
2017-06-26 21:48:39 -03:00
|
|
|
text_and_tags=(
|
2014-08-04 00:02:58 -03:00
|
|
|
('#you can click here', 'comment'), ('\n', 'normal'),
|
|
|
|
('#to choose items', 'comment'), ('\n', 'normal'),
|
|
|
|
('def', 'keyword'), (' ', 'normal'),
|
|
|
|
('func', 'definition'), ('(param):\n ', 'normal'),
|
|
|
|
('"""string"""', 'string'), ('\n var0 = ', 'normal'),
|
|
|
|
("'string'", 'string'), ('\n var1 = ', 'normal'),
|
|
|
|
("'selected'", 'hilite'), ('\n var2 = ', 'normal'),
|
|
|
|
("'found'", 'hit'), ('\n var3 = ', 'normal'),
|
|
|
|
('list', 'builtin'), ('(', 'normal'),
|
2015-10-02 23:12:17 -03:00
|
|
|
('None', 'keyword'), (')\n', 'normal'),
|
|
|
|
(' breakpoint("line")', 'break'), ('\n\n', 'normal'),
|
2014-08-04 00:02:58 -03:00
|
|
|
(' error ', 'error'), (' ', 'normal'),
|
|
|
|
('cursor |', 'cursor'), ('\n ', 'normal'),
|
|
|
|
('shell', 'console'), (' ', 'normal'),
|
|
|
|
('stdout', 'stdout'), (' ', 'normal'),
|
|
|
|
('stderr', 'stderr'), ('\n', 'normal'))
|
2017-06-26 21:48:39 -03:00
|
|
|
for texttag in text_and_tags:
|
|
|
|
text.insert(END, texttag[0], texttag[1])
|
|
|
|
for element in self.theme_elements:
|
2014-08-04 00:02:58 -03:00
|
|
|
def tem(event, elem=element):
|
2017-06-26 21:48:39 -03:00
|
|
|
event.widget.winfo_toplevel().highlight_target.set(elem)
|
2014-08-04 00:02:58 -03:00
|
|
|
text.tag_bind(
|
2017-06-26 21:48:39 -03:00
|
|
|
self.theme_elements[element][0], '<ButtonPress-1>', tem)
|
2001-11-03 01:07:28 -04:00
|
|
|
text.config(state=DISABLED)
|
2017-06-26 21:48:39 -03:00
|
|
|
self.frame_colour_set = Frame(frame_custom, relief=SOLID, borderwidth=1)
|
|
|
|
frame_fg_bg_toggle = Frame(frame_custom)
|
|
|
|
button_set_colour = Button(
|
|
|
|
self.frame_colour_set, text='Choose Colour for :',
|
|
|
|
command=self.get_colour, highlightthickness=0)
|
|
|
|
self.opt_menu_highlight_target = DynOptionMenu(
|
|
|
|
self.frame_colour_set, self.highlight_target, None,
|
|
|
|
highlightthickness=0) #, command=self.set_highlight_targetBinding
|
|
|
|
self.radio_fg = Radiobutton(
|
|
|
|
frame_fg_bg_toggle, variable=self.fg_bg_toggle, value=1,
|
|
|
|
text='Foreground', command=self.set_colour_sample_binding)
|
|
|
|
self.radio_bg=Radiobutton(
|
|
|
|
frame_fg_bg_toggle, variable=self.fg_bg_toggle, value=0,
|
|
|
|
text='Background', command=self.set_colour_sample_binding)
|
|
|
|
self.fg_bg_toggle.set(1)
|
|
|
|
button_save_custom_theme = Button(
|
|
|
|
frame_custom, text='Save as New Custom Theme',
|
|
|
|
command=self.save_as_new_theme)
|
|
|
|
#frame_theme
|
|
|
|
theme_type_title = Label(frame_theme, text='Select : ')
|
|
|
|
self.radio_theme_builtin = Radiobutton(
|
|
|
|
frame_theme, variable=self.is_builtin_theme, value=1,
|
|
|
|
command=self.set_theme_type, text='a Built-in Theme')
|
|
|
|
self.radio_theme_custom = Radiobutton(
|
|
|
|
frame_theme, variable=self.is_builtin_theme, value=0,
|
|
|
|
command=self.set_theme_type, text='a Custom Theme')
|
|
|
|
self.opt_menu_theme_builtin = DynOptionMenu(
|
|
|
|
frame_theme, self.builtin_theme, None, command=None)
|
|
|
|
self.opt_menu_theme_custom=DynOptionMenu(
|
|
|
|
frame_theme, self.custom_theme, None, command=None)
|
|
|
|
self.button_delete_custom_theme=Button(
|
|
|
|
frame_theme, text='Delete Custom Theme',
|
|
|
|
command=self.delete_custom_theme)
|
|
|
|
self.new_custom_theme = Label(frame_theme, bd=2)
|
2014-07-30 20:24:32 -03:00
|
|
|
|
2001-08-03 01:43:44 -03:00
|
|
|
##widget packing
|
|
|
|
#body
|
2017-06-26 21:48:39 -03:00
|
|
|
frame_custom.pack(side=LEFT, padx=5, pady=5, expand=TRUE, fill=BOTH)
|
|
|
|
frame_theme.pack(side=LEFT, padx=5, pady=5, fill=Y)
|
|
|
|
#frame_custom
|
|
|
|
self.frame_colour_set.pack(side=TOP, padx=5, pady=5, expand=TRUE, fill=X)
|
|
|
|
frame_fg_bg_toggle.pack(side=TOP, padx=5, pady=0)
|
|
|
|
self.text_highlight_sample.pack(
|
2014-08-04 00:02:58 -03:00
|
|
|
side=TOP, padx=5, pady=5, expand=TRUE, fill=BOTH)
|
2017-06-26 21:48:39 -03:00
|
|
|
button_set_colour.pack(side=TOP, expand=TRUE, fill=X, padx=8, pady=4)
|
|
|
|
self.opt_menu_highlight_target.pack(
|
2014-08-04 00:02:58 -03:00
|
|
|
side=TOP, expand=TRUE, fill=X, padx=8, pady=3)
|
2017-06-26 21:48:39 -03:00
|
|
|
self.radio_fg.pack(side=LEFT, anchor=E)
|
|
|
|
self.radio_bg.pack(side=RIGHT, anchor=W)
|
|
|
|
button_save_custom_theme.pack(side=BOTTOM, fill=X, padx=5, pady=5)
|
|
|
|
#frame_theme
|
|
|
|
theme_type_title.pack(side=TOP, anchor=W, padx=5, pady=5)
|
|
|
|
self.radio_theme_builtin.pack(side=TOP, anchor=W, padx=5)
|
|
|
|
self.radio_theme_custom.pack(side=TOP, anchor=W, padx=5, pady=2)
|
|
|
|
self.opt_menu_theme_builtin.pack(side=TOP, fill=X, padx=5, pady=5)
|
|
|
|
self.opt_menu_theme_custom.pack(side=TOP, fill=X, anchor=W, padx=5, pady=5)
|
|
|
|
self.button_delete_custom_theme.pack(side=TOP, fill=X, padx=5, pady=5)
|
2015-11-12 16:02:57 -04:00
|
|
|
self.new_custom_theme.pack(side=TOP, fill=X, pady=5)
|
2001-08-03 01:43:44 -03:00
|
|
|
return frame
|
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def create_page_keys(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"""Return frame of widgets for Keys tab.
|
|
|
|
|
|
|
|
Configuration attributes:
|
|
|
|
builtin_keys: Menu variable for built-in keybindings.
|
|
|
|
custom_keys: Menu variable for custom keybindings.
|
|
|
|
are_keys_builtin: Selector for built-in or custom keybindings.
|
|
|
|
keybinding: Action/key bindings.
|
|
|
|
"""
|
2014-07-30 20:24:32 -03:00
|
|
|
parent = self.parent
|
2017-07-05 01:54:55 -03:00
|
|
|
# XXX - binding_target isn't used.
|
2017-06-26 21:48:39 -03:00
|
|
|
self.binding_target = StringVar(parent)
|
|
|
|
self.builtin_keys = StringVar(parent)
|
|
|
|
self.custom_keys = StringVar(parent)
|
|
|
|
self.are_keys_builtin = BooleanVar(parent)
|
|
|
|
self.keybinding = StringVar(parent)
|
2014-07-30 20:24:32 -03:00
|
|
|
|
2001-08-04 10:58:22 -03:00
|
|
|
##widget creation
|
|
|
|
#body frame
|
2017-06-26 21:48:39 -03:00
|
|
|
frame = self.tab_pages.pages['Keys'].frame
|
2001-08-04 10:58:22 -03:00
|
|
|
#body section frames
|
2017-06-26 21:48:39 -03:00
|
|
|
frame_custom = LabelFrame(
|
2014-08-04 00:02:58 -03:00
|
|
|
frame, borderwidth=2, relief=GROOVE,
|
|
|
|
text=' Custom Key Bindings ')
|
2017-06-26 21:48:39 -03:00
|
|
|
frame_key_sets = LabelFrame(
|
2014-08-04 00:02:58 -03:00
|
|
|
frame, borderwidth=2, relief=GROOVE, text=' Key Set ')
|
2017-06-26 21:48:39 -03:00
|
|
|
#frame_custom
|
|
|
|
frame_target = Frame(frame_custom)
|
|
|
|
target_title = Label(frame_target, text='Action - Key(s)')
|
|
|
|
scroll_target_y = Scrollbar(frame_target)
|
|
|
|
scroll_target_x = Scrollbar(frame_target, orient=HORIZONTAL)
|
|
|
|
self.list_bindings = Listbox(
|
|
|
|
frame_target, takefocus=FALSE, exportselection=FALSE)
|
|
|
|
self.list_bindings.bind('<ButtonRelease-1>', self.keybinding_selected)
|
|
|
|
scroll_target_y.config(command=self.list_bindings.yview)
|
|
|
|
scroll_target_x.config(command=self.list_bindings.xview)
|
|
|
|
self.list_bindings.config(yscrollcommand=scroll_target_y.set)
|
|
|
|
self.list_bindings.config(xscrollcommand=scroll_target_x.set)
|
|
|
|
self.button_new_keys = Button(
|
|
|
|
frame_custom, text='Get New Keys for Selection',
|
|
|
|
command=self.get_new_keys, state=DISABLED)
|
|
|
|
#frame_key_sets
|
|
|
|
frames = [Frame(frame_key_sets, padx=2, pady=2, borderwidth=0)
|
2007-12-28 10:08:13 -04:00
|
|
|
for i in range(2)]
|
2017-06-26 21:48:39 -03:00
|
|
|
self.radio_keys_builtin = Radiobutton(
|
|
|
|
frames[0], variable=self.are_keys_builtin, value=1,
|
|
|
|
command=self.set_keys_type, text='Use a Built-in Key Set')
|
|
|
|
self.radio_keys_custom = Radiobutton(
|
|
|
|
frames[0], variable=self.are_keys_builtin, value=0,
|
|
|
|
command=self.set_keys_type, text='Use a Custom Key Set')
|
|
|
|
self.opt_menu_keys_builtin = DynOptionMenu(
|
|
|
|
frames[0], self.builtin_keys, None, command=None)
|
|
|
|
self.opt_menu_keys_custom = DynOptionMenu(
|
|
|
|
frames[0], self.custom_keys, None, command=None)
|
|
|
|
self.button_delete_custom_keys = Button(
|
2014-08-04 00:02:58 -03:00
|
|
|
frames[1], text='Delete Custom Key Set',
|
2017-06-26 21:48:39 -03:00
|
|
|
command=self.delete_custom_keys)
|
|
|
|
button_save_custom_keys = Button(
|
2014-08-04 00:02:58 -03:00
|
|
|
frames[1], text='Save as New Custom Key Set',
|
2017-06-26 21:48:39 -03:00
|
|
|
command=self.save_as_new_key_set)
|
2016-07-10 14:46:34 -03:00
|
|
|
self.new_custom_keys = Label(frames[0], bd=2)
|
2014-07-30 20:24:32 -03:00
|
|
|
|
2001-08-04 10:58:22 -03:00
|
|
|
##widget packing
|
|
|
|
#body
|
2017-06-26 21:48:39 -03:00
|
|
|
frame_custom.pack(side=BOTTOM, padx=5, pady=5, expand=TRUE, fill=BOTH)
|
|
|
|
frame_key_sets.pack(side=BOTTOM, padx=5, pady=5, fill=BOTH)
|
|
|
|
#frame_custom
|
|
|
|
self.button_new_keys.pack(side=BOTTOM, fill=X, padx=5, pady=5)
|
|
|
|
frame_target.pack(side=LEFT, padx=5, pady=5, expand=TRUE, fill=BOTH)
|
2002-01-18 20:29:54 -04:00
|
|
|
#frame target
|
2017-06-26 21:48:39 -03:00
|
|
|
frame_target.columnconfigure(0, weight=1)
|
|
|
|
frame_target.rowconfigure(1, weight=1)
|
|
|
|
target_title.grid(row=0, column=0, columnspan=2, sticky=W)
|
|
|
|
self.list_bindings.grid(row=1, column=0, sticky=NSEW)
|
|
|
|
scroll_target_y.grid(row=1, column=1, sticky=NS)
|
|
|
|
scroll_target_x.grid(row=2, column=0, sticky=EW)
|
|
|
|
#frame_key_sets
|
|
|
|
self.radio_keys_builtin.grid(row=0, column=0, sticky=W+NS)
|
|
|
|
self.radio_keys_custom.grid(row=1, column=0, sticky=W+NS)
|
|
|
|
self.opt_menu_keys_builtin.grid(row=0, column=1, sticky=NSEW)
|
|
|
|
self.opt_menu_keys_custom.grid(row=1, column=1, sticky=NSEW)
|
2016-07-10 14:46:34 -03:00
|
|
|
self.new_custom_keys.grid(row=0, column=2, sticky=NSEW, padx=5, pady=5)
|
2017-06-26 21:48:39 -03:00
|
|
|
self.button_delete_custom_keys.pack(side=LEFT, fill=X, expand=True, padx=2)
|
|
|
|
button_save_custom_keys.pack(side=LEFT, fill=X, expand=True, padx=2)
|
2007-12-28 10:08:13 -04:00
|
|
|
frames[0].pack(side=TOP, fill=BOTH, expand=True)
|
|
|
|
frames[1].pack(side=TOP, fill=X, expand=True, pady=2)
|
2001-08-03 01:43:44 -03:00
|
|
|
return frame
|
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def create_page_general(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"""Return frame of widgets for General tab.
|
|
|
|
|
|
|
|
Configuration attributes:
|
|
|
|
win_width: Initial window width in characters.
|
|
|
|
win_height: Initial window height in characters.
|
|
|
|
startup_edit: Selector for opening in editor or shell mode.
|
|
|
|
autosave: Selector for save prompt popup when using Run.
|
|
|
|
encoding: ?
|
|
|
|
"""
|
2014-07-30 20:24:32 -03:00
|
|
|
parent = self.parent
|
2017-06-26 21:48:39 -03:00
|
|
|
self.win_width = StringVar(parent)
|
|
|
|
self.win_height = StringVar(parent)
|
|
|
|
self.startup_edit = IntVar(parent)
|
|
|
|
self.autosave = IntVar(parent)
|
2017-07-05 01:54:55 -03:00
|
|
|
# XXX - encoding isn't on the screen to be set, but is saved to config.
|
2014-07-30 20:24:32 -03:00
|
|
|
self.encoding = StringVar(parent)
|
2017-07-05 01:54:55 -03:00
|
|
|
# XXX - user_help_browser and help_browser aren't used.
|
2017-06-26 21:48:39 -03:00
|
|
|
self.user_help_browser = BooleanVar(parent)
|
|
|
|
self.help_browser = StringVar(parent)
|
2014-07-30 20:24:32 -03:00
|
|
|
|
2001-08-07 00:28:25 -03:00
|
|
|
#widget creation
|
|
|
|
#body
|
2017-06-26 21:48:39 -03:00
|
|
|
frame = self.tab_pages.pages['General'].frame
|
2002-12-31 12:03:23 -04:00
|
|
|
#body section frames
|
2017-06-26 21:48:39 -03:00
|
|
|
frame_run = LabelFrame(frame, borderwidth=2, relief=GROOVE,
|
2014-08-04 00:02:58 -03:00
|
|
|
text=' Startup Preferences ')
|
2017-06-26 21:48:39 -03:00
|
|
|
frame_save = LabelFrame(frame, borderwidth=2, relief=GROOVE,
|
|
|
|
text=' autosave Preferences ')
|
|
|
|
frame_win_size = Frame(frame, borderwidth=2, relief=GROOVE)
|
|
|
|
frame_help = LabelFrame(frame, borderwidth=2, relief=GROOVE,
|
2014-08-04 00:02:58 -03:00
|
|
|
text=' Additional Help Sources ')
|
2017-06-26 21:48:39 -03:00
|
|
|
#frame_run
|
|
|
|
startup_title = Label(frame_run, text='At Startup')
|
|
|
|
self.radio_startup_edit = Radiobutton(
|
|
|
|
frame_run, variable=self.startup_edit, value=1,
|
2016-11-07 18:15:01 -04:00
|
|
|
text="Open Edit Window")
|
2017-06-26 21:48:39 -03:00
|
|
|
self.radio_startup_shell = Radiobutton(
|
|
|
|
frame_run, variable=self.startup_edit, value=0,
|
2016-11-07 18:15:01 -04:00
|
|
|
text='Open Shell Window')
|
2017-06-26 21:48:39 -03:00
|
|
|
#frame_save
|
|
|
|
run_save_title = Label(frame_save, text='At Start of Run (F5) ')
|
|
|
|
self.radio_save_ask = Radiobutton(
|
|
|
|
frame_save, variable=self.autosave, value=0,
|
2016-11-07 18:15:01 -04:00
|
|
|
text="Prompt to Save")
|
2017-06-26 21:48:39 -03:00
|
|
|
self.radio_save_auto = Radiobutton(
|
|
|
|
frame_save, variable=self.autosave, value=1,
|
2016-11-07 18:15:01 -04:00
|
|
|
text='No Prompt')
|
2017-06-26 21:48:39 -03:00
|
|
|
#frame_win_size
|
|
|
|
win_size_title = Label(
|
|
|
|
frame_win_size, text='Initial Window Size (in characters)')
|
|
|
|
win_width_title = Label(frame_win_size, text='Width')
|
|
|
|
self.entry_win_width = Entry(
|
|
|
|
frame_win_size, textvariable=self.win_width, width=3)
|
|
|
|
win_height_title = Label(frame_win_size, text='Height')
|
|
|
|
self.entry_win_height = Entry(
|
|
|
|
frame_win_size, textvariable=self.win_height, width=3)
|
|
|
|
#frame_help
|
|
|
|
frame_helplist = Frame(frame_help)
|
|
|
|
frame_helplist_buttons = Frame(frame_helplist)
|
|
|
|
scroll_helplist = Scrollbar(frame_helplist)
|
|
|
|
self.list_help = Listbox(
|
|
|
|
frame_helplist, height=5, takefocus=FALSE,
|
2002-02-05 00:52:32 -04:00
|
|
|
exportselection=FALSE)
|
2017-06-26 21:48:39 -03:00
|
|
|
scroll_helplist.config(command=self.list_help.yview)
|
|
|
|
self.list_help.config(yscrollcommand=scroll_helplist.set)
|
|
|
|
self.list_help.bind('<ButtonRelease-1>', self.help_source_selected)
|
|
|
|
self.button_helplist_edit = Button(
|
|
|
|
frame_helplist_buttons, text='Edit', state=DISABLED,
|
|
|
|
width=8, command=self.helplist_item_edit)
|
|
|
|
self.button_helplist_add = Button(
|
|
|
|
frame_helplist_buttons, text='Add',
|
|
|
|
width=8, command=self.helplist_item_add)
|
|
|
|
self.button_helplist_remove = Button(
|
|
|
|
frame_helplist_buttons, text='Remove', state=DISABLED,
|
|
|
|
width=8, command=self.helplist_item_remove)
|
2014-07-30 20:24:32 -03:00
|
|
|
|
2001-08-07 00:28:25 -03:00
|
|
|
#widget packing
|
|
|
|
#body
|
2017-06-26 21:48:39 -03:00
|
|
|
frame_run.pack(side=TOP, padx=5, pady=5, fill=X)
|
|
|
|
frame_save.pack(side=TOP, padx=5, pady=5, fill=X)
|
|
|
|
frame_win_size.pack(side=TOP, padx=5, pady=5, fill=X)
|
|
|
|
frame_help.pack(side=TOP, padx=5, pady=5, expand=TRUE, fill=BOTH)
|
|
|
|
#frame_run
|
|
|
|
startup_title.pack(side=LEFT, anchor=W, padx=5, pady=5)
|
|
|
|
self.radio_startup_shell.pack(side=RIGHT, anchor=W, padx=5, pady=5)
|
|
|
|
self.radio_startup_edit.pack(side=RIGHT, anchor=W, padx=5, pady=5)
|
|
|
|
#frame_save
|
|
|
|
run_save_title.pack(side=LEFT, anchor=W, padx=5, pady=5)
|
|
|
|
self.radio_save_auto.pack(side=RIGHT, anchor=W, padx=5, pady=5)
|
|
|
|
self.radio_save_ask.pack(side=RIGHT, anchor=W, padx=5, pady=5)
|
|
|
|
#frame_win_size
|
|
|
|
win_size_title.pack(side=LEFT, anchor=W, padx=5, pady=5)
|
|
|
|
self.entry_win_height.pack(side=RIGHT, anchor=E, padx=10, pady=5)
|
|
|
|
win_height_title.pack(side=RIGHT, anchor=E, pady=5)
|
|
|
|
self.entry_win_width.pack(side=RIGHT, anchor=E, padx=10, pady=5)
|
|
|
|
win_width_title.pack(side=RIGHT, anchor=E, pady=5)
|
|
|
|
#frame_help
|
|
|
|
frame_helplist_buttons.pack(side=RIGHT, padx=5, pady=5, fill=Y)
|
|
|
|
frame_helplist.pack(side=TOP, padx=5, pady=5, expand=TRUE, fill=BOTH)
|
|
|
|
scroll_helplist.pack(side=RIGHT, anchor=W, fill=Y)
|
|
|
|
self.list_help.pack(side=LEFT, anchor=E, expand=TRUE, fill=BOTH)
|
|
|
|
self.button_helplist_edit.pack(side=TOP, anchor=W, pady=5)
|
|
|
|
self.button_helplist_add.pack(side=TOP, anchor=W)
|
|
|
|
self.button_helplist_remove.pack(side=TOP, anchor=W, pady=5)
|
2001-08-03 01:43:44 -03:00
|
|
|
return frame
|
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def attach_var_callbacks(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Attach callbacks to variables that can be changed."
|
2017-06-26 21:48:39 -03:00
|
|
|
self.font_size.trace_add('write', self.var_changed_font)
|
|
|
|
self.font_name.trace_add('write', self.var_changed_font)
|
|
|
|
self.font_bold.trace_add('write', self.var_changed_font)
|
|
|
|
self.space_num.trace_add('write', self.var_changed_space_num)
|
|
|
|
self.colour.trace_add('write', self.var_changed_colour)
|
|
|
|
self.builtin_theme.trace_add('write', self.var_changed_builtin_theme)
|
|
|
|
self.custom_theme.trace_add('write', self.var_changed_custom_theme)
|
|
|
|
self.is_builtin_theme.trace_add('write', self.var_changed_is_builtin_theme)
|
|
|
|
self.highlight_target.trace_add('write', self.var_changed_highlight_target)
|
|
|
|
self.keybinding.trace_add('write', self.var_changed_keybinding)
|
|
|
|
self.builtin_keys.trace_add('write', self.var_changed_builtin_keys)
|
|
|
|
self.custom_keys.trace_add('write', self.var_changed_custom_keys)
|
|
|
|
self.are_keys_builtin.trace_add('write', self.var_changed_are_keys_builtin)
|
|
|
|
self.win_width.trace_add('write', self.var_changed_win_width)
|
|
|
|
self.win_height.trace_add('write', self.var_changed_win_height)
|
|
|
|
self.startup_edit.trace_add('write', self.var_changed_startup_edit)
|
|
|
|
self.autosave.trace_add('write', self.var_changed_autosave)
|
|
|
|
self.encoding.trace_add('write', self.var_changed_encoding)
|
2014-08-04 00:02:58 -03:00
|
|
|
|
2016-05-16 23:27:28 -03:00
|
|
|
def remove_var_callbacks(self):
|
|
|
|
"Remove callbacks to prevent memory leaks."
|
|
|
|
for var in (
|
2017-06-26 21:48:39 -03:00
|
|
|
self.font_size, self.font_name, self.font_bold,
|
|
|
|
self.space_num, self.colour, self.builtin_theme,
|
|
|
|
self.custom_theme, self.is_builtin_theme, self.highlight_target,
|
|
|
|
self.keybinding, self.builtin_keys, self.custom_keys,
|
|
|
|
self.are_keys_builtin, self.win_width, self.win_height,
|
|
|
|
self.startup_edit, self.autosave, self.encoding,):
|
2016-06-26 03:46:57 -03:00
|
|
|
var.trace_remove('write', var.trace_info()[0][1])
|
2016-05-16 23:27:28 -03:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def var_changed_font(self, *params):
|
2017-07-05 01:54:55 -03:00
|
|
|
"""Store changes to font attributes.
|
|
|
|
|
|
|
|
When one font attribute changes, save them all, as they are
|
2015-08-01 19:57:33 -03:00
|
|
|
not independent from each other. In particular, when we are
|
|
|
|
overriding the default font, we need to write out everything.
|
2017-07-05 01:54:55 -03:00
|
|
|
"""
|
2017-06-26 21:48:39 -03:00
|
|
|
value = self.font_name.get()
|
2017-07-07 17:37:39 -03:00
|
|
|
changes.add_option('main', 'EditorWindow', 'font', value)
|
2017-06-26 21:48:39 -03:00
|
|
|
value = self.font_size.get()
|
2017-07-07 17:37:39 -03:00
|
|
|
changes.add_option('main', 'EditorWindow', 'font-size', value)
|
2017-06-26 21:48:39 -03:00
|
|
|
value = self.font_bold.get()
|
2017-07-07 17:37:39 -03:00
|
|
|
changes.add_option('main', 'EditorWindow', 'font-bold', value)
|
2017-06-26 21:48:39 -03:00
|
|
|
|
|
|
|
def var_changed_space_num(self, *params):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Store change to indentation size."
|
2017-06-26 21:48:39 -03:00
|
|
|
value = self.space_num.get()
|
2017-07-07 17:37:39 -03:00
|
|
|
changes.add_option('main', 'Indent', 'num-spaces', value)
|
2017-06-26 21:48:39 -03:00
|
|
|
|
|
|
|
def var_changed_colour(self, *params):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Process change to color choice."
|
2017-06-26 21:48:39 -03:00
|
|
|
self.on_new_colour_set()
|
|
|
|
|
|
|
|
def var_changed_builtin_theme(self, *params):
|
2017-07-05 01:54:55 -03:00
|
|
|
"""Process new builtin theme selection.
|
|
|
|
|
|
|
|
Add the changed theme's name to the changed_items and recreate
|
|
|
|
the sample with the values from the selected theme.
|
|
|
|
"""
|
2017-06-26 21:48:39 -03:00
|
|
|
old_themes = ('IDLE Classic', 'IDLE New')
|
|
|
|
value = self.builtin_theme.get()
|
|
|
|
if value not in old_themes:
|
|
|
|
if idleConf.GetOption('main', 'Theme', 'name') not in old_themes:
|
2017-07-07 17:37:39 -03:00
|
|
|
changes.add_option('main', 'Theme', 'name', old_themes[0])
|
|
|
|
changes.add_option('main', 'Theme', 'name2', value)
|
2015-11-12 16:02:57 -04:00
|
|
|
self.new_custom_theme.config(text='New theme, see Help',
|
|
|
|
fg='#500000')
|
|
|
|
else:
|
2017-07-07 17:37:39 -03:00
|
|
|
changes.add_option('main', 'Theme', 'name', value)
|
|
|
|
changes.add_option('main', 'Theme', 'name2', '')
|
2015-11-12 16:02:57 -04:00
|
|
|
self.new_custom_theme.config(text='', fg='black')
|
2017-06-26 21:48:39 -03:00
|
|
|
self.paint_theme_sample()
|
2002-02-10 22:20:53 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def var_changed_custom_theme(self, *params):
|
2017-07-05 01:54:55 -03:00
|
|
|
"""Process new custom theme selection.
|
|
|
|
|
|
|
|
If a new custom theme is selected, add the name to the
|
|
|
|
changed_items and apply the theme to the sample.
|
|
|
|
"""
|
2017-06-26 21:48:39 -03:00
|
|
|
value = self.custom_theme.get()
|
2002-02-17 21:43:11 -04:00
|
|
|
if value != '- no custom themes -':
|
2017-07-07 17:37:39 -03:00
|
|
|
changes.add_option('main', 'Theme', 'name', value)
|
2017-06-26 21:48:39 -03:00
|
|
|
self.paint_theme_sample()
|
2002-02-10 22:20:53 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def var_changed_is_builtin_theme(self, *params):
|
2017-07-05 01:54:55 -03:00
|
|
|
"""Process toggle between builtin and custom theme.
|
|
|
|
|
|
|
|
Update the default toggle value and apply the newly
|
|
|
|
selected theme type.
|
|
|
|
"""
|
2017-06-26 21:48:39 -03:00
|
|
|
value = self.is_builtin_theme.get()
|
2017-07-07 17:37:39 -03:00
|
|
|
changes.add_option('main', 'Theme', 'default', value)
|
2002-03-04 20:25:58 -04:00
|
|
|
if value:
|
2017-06-26 21:48:39 -03:00
|
|
|
self.var_changed_builtin_theme()
|
2002-03-04 20:25:58 -04:00
|
|
|
else:
|
2017-06-26 21:48:39 -03:00
|
|
|
self.var_changed_custom_theme()
|
2002-02-10 22:20:53 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def var_changed_highlight_target(self, *params):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Process selection of new target tag for highlighting."
|
2017-06-26 21:48:39 -03:00
|
|
|
self.set_highlight_target()
|
2002-12-31 12:03:23 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def var_changed_keybinding(self, *params):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Store change to a keybinding."
|
2017-06-26 21:48:39 -03:00
|
|
|
value = self.keybinding.get()
|
|
|
|
key_set = self.custom_keys.get()
|
|
|
|
event = self.list_bindings.get(ANCHOR).split()[0]
|
2002-01-31 21:33:36 -04:00
|
|
|
if idleConf.IsCoreBinding(event):
|
2017-07-07 17:37:39 -03:00
|
|
|
changes.add_option('keys', key_set, event, value)
|
2017-07-05 01:54:55 -03:00
|
|
|
else: # Event is an extension binding.
|
2017-06-26 21:48:39 -03:00
|
|
|
ext_name = idleConf.GetExtnNameForEvent(event)
|
|
|
|
ext_keybind_section = ext_name + '_cfgBindings'
|
2017-07-07 17:37:39 -03:00
|
|
|
changes.add_option('extensions', ext_keybind_section, event, value)
|
2002-12-31 12:03:23 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def var_changed_builtin_keys(self, *params):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Process selection of builtin key set."
|
2017-06-26 21:48:39 -03:00
|
|
|
old_keys = (
|
2016-07-10 14:46:34 -03:00
|
|
|
'IDLE Classic Windows',
|
|
|
|
'IDLE Classic Unix',
|
|
|
|
'IDLE Classic Mac',
|
|
|
|
'IDLE Classic OSX',
|
|
|
|
)
|
2017-06-26 21:48:39 -03:00
|
|
|
value = self.builtin_keys.get()
|
|
|
|
if value not in old_keys:
|
|
|
|
if idleConf.GetOption('main', 'Keys', 'name') not in old_keys:
|
2017-07-07 17:37:39 -03:00
|
|
|
changes.add_option('main', 'Keys', 'name', old_keys[0])
|
|
|
|
changes.add_option('main', 'Keys', 'name2', value)
|
2016-07-10 14:46:34 -03:00
|
|
|
self.new_custom_keys.config(text='New key set, see Help',
|
|
|
|
fg='#500000')
|
|
|
|
else:
|
2017-07-07 17:37:39 -03:00
|
|
|
changes.add_option('main', 'Keys', 'name', value)
|
|
|
|
changes.add_option('main', 'Keys', 'name2', '')
|
2016-07-10 14:46:34 -03:00
|
|
|
self.new_custom_keys.config(text='', fg='black')
|
2017-06-26 21:48:39 -03:00
|
|
|
self.load_keys_list(value)
|
2002-02-10 22:20:53 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def var_changed_custom_keys(self, *params):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Process selection of custom key set."
|
2017-06-26 21:48:39 -03:00
|
|
|
value = self.custom_keys.get()
|
2002-02-17 21:43:11 -04:00
|
|
|
if value != '- no custom keys -':
|
2017-07-07 17:37:39 -03:00
|
|
|
changes.add_option('main', 'Keys', 'name', value)
|
2017-06-26 21:48:39 -03:00
|
|
|
self.load_keys_list(value)
|
2002-02-10 22:20:53 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def var_changed_are_keys_builtin(self, *params):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Process toggle between builtin key set and custom key set."
|
2017-06-26 21:48:39 -03:00
|
|
|
value = self.are_keys_builtin.get()
|
2017-07-07 17:37:39 -03:00
|
|
|
changes.add_option('main', 'Keys', 'default', value)
|
2002-12-31 12:03:23 -04:00
|
|
|
if value:
|
2017-06-26 21:48:39 -03:00
|
|
|
self.var_changed_builtin_keys()
|
2002-02-10 22:20:53 -04:00
|
|
|
else:
|
2017-06-26 21:48:39 -03:00
|
|
|
self.var_changed_custom_keys()
|
2002-02-10 22:20:53 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def var_changed_win_width(self, *params):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Store change to window width."
|
2017-06-26 21:48:39 -03:00
|
|
|
value = self.win_width.get()
|
2017-07-07 17:37:39 -03:00
|
|
|
changes.add_option('main', 'EditorWindow', 'width', value)
|
2002-01-22 01:56:40 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def var_changed_win_height(self, *params):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Store change to window height."
|
2017-06-26 21:48:39 -03:00
|
|
|
value = self.win_height.get()
|
2017-07-07 17:37:39 -03:00
|
|
|
changes.add_option('main', 'EditorWindow', 'height', value)
|
2002-01-22 01:56:40 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def var_changed_startup_edit(self, *params):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Store change to toggle for starting IDLE in the editor or shell."
|
2017-06-26 21:48:39 -03:00
|
|
|
value = self.startup_edit.get()
|
2017-07-07 17:37:39 -03:00
|
|
|
changes.add_option('main', 'General', 'editor-on-startup', value)
|
2002-01-22 01:56:40 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def var_changed_autosave(self, *params):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Store change to autosave."
|
2017-06-26 21:48:39 -03:00
|
|
|
value = self.autosave.get()
|
2017-07-07 17:37:39 -03:00
|
|
|
changes.add_option('main', 'General', 'autosave', value)
|
2003-05-26 03:23:10 -03:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def var_changed_encoding(self, *params):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Store change to encoding."
|
2014-08-04 00:02:58 -03:00
|
|
|
value = self.encoding.get()
|
2017-07-07 17:37:39 -03:00
|
|
|
changes.add_option('main', 'EditorWindow', 'encoding', value)
|
2017-06-26 21:48:39 -03:00
|
|
|
|
|
|
|
def set_theme_type(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Set available screen options based on builtin or custom theme."
|
2017-06-26 21:48:39 -03:00
|
|
|
if self.is_builtin_theme.get():
|
|
|
|
self.opt_menu_theme_builtin.config(state=NORMAL)
|
|
|
|
self.opt_menu_theme_custom.config(state=DISABLED)
|
|
|
|
self.button_delete_custom_theme.config(state=DISABLED)
|
2002-01-21 02:38:21 -04:00
|
|
|
else:
|
2017-06-26 21:48:39 -03:00
|
|
|
self.opt_menu_theme_builtin.config(state=DISABLED)
|
|
|
|
self.radio_theme_custom.config(state=NORMAL)
|
|
|
|
self.opt_menu_theme_custom.config(state=NORMAL)
|
|
|
|
self.button_delete_custom_theme.config(state=NORMAL)
|
|
|
|
|
|
|
|
def set_keys_type(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Set available screen options based on builtin or custom key set."
|
2017-06-26 21:48:39 -03:00
|
|
|
if self.are_keys_builtin.get():
|
|
|
|
self.opt_menu_keys_builtin.config(state=NORMAL)
|
|
|
|
self.opt_menu_keys_custom.config(state=DISABLED)
|
|
|
|
self.button_delete_custom_keys.config(state=DISABLED)
|
2002-01-21 02:38:21 -04:00
|
|
|
else:
|
2017-06-26 21:48:39 -03:00
|
|
|
self.opt_menu_keys_builtin.config(state=DISABLED)
|
|
|
|
self.radio_keys_custom.config(state=NORMAL)
|
|
|
|
self.opt_menu_keys_custom.config(state=NORMAL)
|
|
|
|
self.button_delete_custom_keys.config(state=NORMAL)
|
|
|
|
|
|
|
|
def get_new_keys(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"""Handle event to change key binding for selected line.
|
|
|
|
|
|
|
|
A selection of a key/binding in the list of current
|
|
|
|
bindings pops up a dialog to enter a new binding. If
|
|
|
|
the current key set is builtin and a binding has
|
|
|
|
changed, then a name for a custom key set needs to be
|
|
|
|
entered for the change to be applied.
|
|
|
|
"""
|
2017-06-26 21:48:39 -03:00
|
|
|
list_index = self.list_bindings.index(ANCHOR)
|
|
|
|
binding = self.list_bindings.get(list_index)
|
2017-07-05 01:54:55 -03:00
|
|
|
bind_name = binding.split()[0]
|
2017-06-26 21:48:39 -03:00
|
|
|
if self.are_keys_builtin.get():
|
|
|
|
current_key_set_name = self.builtin_keys.get()
|
2002-12-31 12:03:23 -04:00
|
|
|
else:
|
2017-06-26 21:48:39 -03:00
|
|
|
current_key_set_name = self.custom_keys.get()
|
|
|
|
current_bindings = idleConf.GetCurrentKeySet()
|
2017-07-07 17:37:39 -03:00
|
|
|
if current_key_set_name in changes['keys']: # unsaved changes
|
|
|
|
key_set_changes = changes['keys'][current_key_set_name]
|
2017-06-26 21:48:39 -03:00
|
|
|
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,
|
|
|
|
current_key_sequences).result
|
2017-07-05 01:54:55 -03:00
|
|
|
if new_keys:
|
|
|
|
if self.are_keys_builtin.get(): # Current key set is a built-in.
|
2014-08-04 00:02:58 -03:00
|
|
|
message = ('Your changes will be saved as a new Custom Key Set.'
|
|
|
|
' Enter a name for your new Custom Key Set below.')
|
2017-06-26 21:48:39 -03:00
|
|
|
new_keyset = self.get_new_keys_name(message)
|
2017-07-05 01:54:55 -03:00
|
|
|
if not new_keyset: # User cancelled custom key set creation.
|
2017-06-26 21:48:39 -03:00
|
|
|
self.list_bindings.select_set(list_index)
|
|
|
|
self.list_bindings.select_anchor(list_index)
|
2002-01-24 02:02:50 -04:00
|
|
|
return
|
2017-07-05 01:54:55 -03:00
|
|
|
else: # Create new custom key set based on previously active key set.
|
2017-06-26 21:48:39 -03:00
|
|
|
self.create_new_key_set(new_keyset)
|
|
|
|
self.list_bindings.delete(list_index)
|
|
|
|
self.list_bindings.insert(list_index, bind_name+' - '+new_keys)
|
|
|
|
self.list_bindings.select_set(list_index)
|
|
|
|
self.list_bindings.select_anchor(list_index)
|
|
|
|
self.keybinding.set(new_keys)
|
2002-01-24 02:02:50 -04:00
|
|
|
else:
|
2017-06-26 21:48:39 -03:00
|
|
|
self.list_bindings.select_set(list_index)
|
|
|
|
self.list_bindings.select_anchor(list_index)
|
2002-01-24 02:02:50 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def get_new_keys_name(self, message):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Return new key set name from query popup."
|
2017-06-26 21:48:39 -03:00
|
|
|
used_names = (idleConf.GetSectionList('user', 'keys') +
|
2014-08-04 00:02:58 -03:00
|
|
|
idleConf.GetSectionList('default', 'keys'))
|
2017-06-26 21:48:39 -03:00
|
|
|
new_keyset = SectionName(
|
|
|
|
self, 'New Custom Key Set', message, used_names).result
|
|
|
|
return new_keyset
|
2002-12-31 12:03:23 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def save_as_new_key_set(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Prompt for name of new key set and save changes using that name."
|
2017-06-26 21:48:39 -03:00
|
|
|
new_keys_name = self.get_new_keys_name('New Key Set Name:')
|
|
|
|
if new_keys_name:
|
|
|
|
self.create_new_key_set(new_keys_name)
|
2002-02-05 00:52:32 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def keybinding_selected(self, event):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Activate button to assign new keys to selected action."
|
2017-06-26 21:48:39 -03:00
|
|
|
self.button_new_keys.config(state=NORMAL)
|
2002-01-24 02:02:50 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def create_new_key_set(self, new_key_set_name):
|
2017-07-05 01:54:55 -03:00
|
|
|
"""Create a new custom key set with the given name.
|
|
|
|
|
|
|
|
Create the new key set based on the previously active set
|
|
|
|
with the current changes applied. Once it is saved, then
|
|
|
|
activate the new key set.
|
|
|
|
"""
|
2017-06-26 21:48:39 -03:00
|
|
|
if self.are_keys_builtin.get():
|
|
|
|
prev_key_set_name = self.builtin_keys.get()
|
2002-12-31 12:03:23 -04:00
|
|
|
else:
|
2017-06-26 21:48:39 -03:00
|
|
|
prev_key_set_name = self.custom_keys.get()
|
|
|
|
prev_keys = idleConf.GetCoreKeys(prev_key_set_name)
|
|
|
|
new_keys = {}
|
2017-07-05 01:54:55 -03:00
|
|
|
for event in prev_keys: # Add key set to changed items.
|
|
|
|
event_name = event[2:-2] # Trim off the angle brackets.
|
2017-06-26 21:48:39 -03:00
|
|
|
binding = ' '.join(prev_keys[event])
|
|
|
|
new_keys[event_name] = binding
|
2017-07-05 01:54:55 -03:00
|
|
|
# Handle any unsaved changes to prev key set.
|
2017-07-07 17:37:39 -03:00
|
|
|
if prev_key_set_name in changes['keys']:
|
|
|
|
key_set_changes = changes['keys'][prev_key_set_name]
|
2017-06-26 21:48:39 -03:00
|
|
|
for event in key_set_changes:
|
|
|
|
new_keys[event] = key_set_changes[event]
|
2017-07-05 01:54:55 -03:00
|
|
|
# Save the new key set.
|
2017-06-26 21:48:39 -03:00
|
|
|
self.save_new_key_set(new_key_set_name, new_keys)
|
2017-07-05 01:54:55 -03:00
|
|
|
# Change GUI over to the new key set.
|
2017-06-26 21:48:39 -03:00
|
|
|
custom_key_list = idleConf.GetSectionList('user', 'keys')
|
|
|
|
custom_key_list.sort()
|
|
|
|
self.opt_menu_keys_custom.SetMenu(custom_key_list, new_key_set_name)
|
|
|
|
self.are_keys_builtin.set(0)
|
|
|
|
self.set_keys_type()
|
2002-12-31 12:03:23 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def load_keys_list(self, keyset_name):
|
2017-07-05 01:54:55 -03:00
|
|
|
"""Reload the list of action/key binding pairs for the active key set.
|
|
|
|
|
|
|
|
An action/key binding can be selected to change the key binding.
|
|
|
|
"""
|
2014-08-04 00:02:58 -03:00
|
|
|
reselect = 0
|
2017-07-05 01:54:55 -03:00
|
|
|
# XXX - new_keyset isn't used in this function.
|
2017-06-26 21:48:39 -03:00
|
|
|
new_keyset = 0
|
|
|
|
if self.list_bindings.curselection():
|
2014-08-04 00:02:58 -03:00
|
|
|
reselect = 1
|
2017-06-26 21:48:39 -03:00
|
|
|
list_index = self.list_bindings.index(ANCHOR)
|
|
|
|
keyset = idleConf.GetKeySet(keyset_name)
|
|
|
|
bind_names = list(keyset.keys())
|
|
|
|
bind_names.sort()
|
|
|
|
self.list_bindings.delete(0, END)
|
|
|
|
for bind_name in bind_names:
|
2017-07-05 01:54:55 -03:00
|
|
|
key = ' '.join(keyset[bind_name])
|
|
|
|
bind_name = bind_name[2:-2] # Trim off the angle brackets.
|
2017-07-07 17:37:39 -03:00
|
|
|
if keyset_name in changes['keys']:
|
2017-07-05 01:54:55 -03:00
|
|
|
# Handle any unsaved changes to this key set.
|
2017-07-07 17:37:39 -03:00
|
|
|
if bind_name in changes['keys'][keyset_name]:
|
|
|
|
key = changes['keys'][keyset_name][bind_name]
|
2017-06-26 21:48:39 -03:00
|
|
|
self.list_bindings.insert(END, bind_name+' - '+key)
|
2002-02-10 22:20:53 -04:00
|
|
|
if reselect:
|
2017-06-26 21:48:39 -03:00
|
|
|
self.list_bindings.see(list_index)
|
|
|
|
self.list_bindings.select_set(list_index)
|
|
|
|
self.list_bindings.select_anchor(list_index)
|
2002-02-10 22:20:53 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def delete_custom_keys(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"""Handle event to delete a custom key set.
|
|
|
|
|
|
|
|
Applying the delete deactivates the current configuration and
|
|
|
|
reverts to the default. The custom key set is permanently
|
|
|
|
deleted from the config file.
|
|
|
|
"""
|
2017-06-26 21:48:39 -03:00
|
|
|
keyset_name=self.custom_keys.get()
|
2014-08-04 00:02:58 -03:00
|
|
|
delmsg = 'Are you sure you wish to delete the key set %r ?'
|
|
|
|
if not tkMessageBox.askyesno(
|
2017-06-26 21:48:39 -03:00
|
|
|
'Delete Key Set', delmsg % keyset_name, parent=self):
|
2002-02-17 21:43:11 -04:00
|
|
|
return
|
2017-06-26 21:48:39 -03:00
|
|
|
self.deactivate_current_config()
|
2017-07-07 17:37:39 -03:00
|
|
|
# Remove key set from changes, config, and file.
|
|
|
|
changes.remove(keyset_name)
|
2017-07-05 01:54:55 -03:00
|
|
|
# Reload user key set list.
|
2017-06-26 21:48:39 -03:00
|
|
|
item_list = idleConf.GetSectionList('user', 'keys')
|
|
|
|
item_list.sort()
|
|
|
|
if not item_list:
|
|
|
|
self.radio_keys_custom.config(state=DISABLED)
|
|
|
|
self.opt_menu_keys_custom.SetMenu(item_list, '- no custom keys -')
|
2002-02-17 21:43:11 -04:00
|
|
|
else:
|
2017-06-26 21:48:39 -03:00
|
|
|
self.opt_menu_keys_custom.SetMenu(item_list, item_list[0])
|
2017-07-05 01:54:55 -03:00
|
|
|
# Revert to default key set.
|
2017-06-26 21:48:39 -03:00
|
|
|
self.are_keys_builtin.set(idleConf.defaultCfg['main']
|
2016-07-10 14:46:34 -03:00
|
|
|
.Get('Keys', 'default'))
|
2017-06-26 21:48:39 -03:00
|
|
|
self.builtin_keys.set(idleConf.defaultCfg['main'].Get('Keys', 'name')
|
2016-07-10 14:46:34 -03:00
|
|
|
or idleConf.default_keys())
|
2017-07-05 01:54:55 -03:00
|
|
|
# User can't back out of these changes, they must be applied now.
|
2017-07-07 17:37:39 -03:00
|
|
|
changes.save_all()
|
|
|
|
self.save_all_changed_extensions()
|
2017-06-26 21:48:39 -03:00
|
|
|
self.activate_config_changes()
|
|
|
|
self.set_keys_type()
|
2002-12-31 12:03:23 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def delete_custom_theme(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"""Handle event to delete custom theme.
|
|
|
|
|
|
|
|
The current theme is deactivated and the default theme is
|
|
|
|
activated. The custom theme is permanently removed from
|
|
|
|
the config file.
|
|
|
|
"""
|
2017-06-26 21:48:39 -03:00
|
|
|
theme_name = self.custom_theme.get()
|
2014-08-04 00:02:58 -03:00
|
|
|
delmsg = 'Are you sure you wish to delete the theme %r ?'
|
|
|
|
if not tkMessageBox.askyesno(
|
2017-06-26 21:48:39 -03:00
|
|
|
'Delete Theme', delmsg % theme_name, parent=self):
|
2002-02-17 21:43:11 -04:00
|
|
|
return
|
2017-06-26 21:48:39 -03:00
|
|
|
self.deactivate_current_config()
|
2017-07-07 17:37:39 -03:00
|
|
|
# Remove theme from changes, config, and file.
|
|
|
|
changes.delete_section('highlight')
|
2017-07-05 01:54:55 -03:00
|
|
|
# Reload user theme list.
|
2017-06-26 21:48:39 -03:00
|
|
|
item_list = idleConf.GetSectionList('user', 'highlight')
|
|
|
|
item_list.sort()
|
|
|
|
if not item_list:
|
|
|
|
self.radio_theme_custom.config(state=DISABLED)
|
|
|
|
self.opt_menu_theme_custom.SetMenu(item_list, '- no custom themes -')
|
2002-02-17 21:43:11 -04:00
|
|
|
else:
|
2017-06-26 21:48:39 -03:00
|
|
|
self.opt_menu_theme_custom.SetMenu(item_list, item_list[0])
|
2017-07-05 01:54:55 -03:00
|
|
|
# Revert to default theme.
|
2017-06-26 21:48:39 -03:00
|
|
|
self.is_builtin_theme.set(idleConf.defaultCfg['main'].Get('Theme', 'default'))
|
|
|
|
self.builtin_theme.set(idleConf.defaultCfg['main'].Get('Theme', 'name'))
|
2017-07-05 01:54:55 -03:00
|
|
|
# User can't back out of these changes, they must be applied now.
|
2017-07-07 17:37:39 -03:00
|
|
|
changes.save_all()
|
|
|
|
self.save_all_changed_extensions()
|
2017-06-26 21:48:39 -03:00
|
|
|
self.activate_config_changes()
|
|
|
|
self.set_theme_type()
|
|
|
|
|
|
|
|
def get_colour(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"""Handle button to select a new color for the target tag.
|
|
|
|
|
|
|
|
If a new color is selected while using a builtin theme, a
|
|
|
|
name must be supplied to create a custom theme.
|
|
|
|
"""
|
2017-06-26 21:48:39 -03:00
|
|
|
target = self.highlight_target.get()
|
|
|
|
prev_colour = self.frame_colour_set.cget('bg')
|
|
|
|
rgbTuplet, colour_string = tkColorChooser.askcolor(
|
2014-08-04 00:02:58 -03:00
|
|
|
parent=self, title='Pick new colour for : '+target,
|
2017-06-26 21:48:39 -03:00
|
|
|
initialcolor=prev_colour)
|
|
|
|
if colour_string and (colour_string != prev_colour):
|
2017-07-05 01:54:55 -03:00
|
|
|
# User didn't cancel and they chose a new colour.
|
|
|
|
if self.is_builtin_theme.get(): # Current theme is a built-in.
|
2014-08-04 00:02:58 -03:00
|
|
|
message = ('Your changes will be saved as a new Custom Theme. '
|
|
|
|
'Enter a name for your new Custom Theme below.')
|
2017-06-26 21:48:39 -03:00
|
|
|
new_theme = self.get_new_theme_name(message)
|
2017-07-05 01:54:55 -03:00
|
|
|
if not new_theme: # User cancelled custom theme creation.
|
2002-01-24 02:02:50 -04:00
|
|
|
return
|
2017-07-05 01:54:55 -03:00
|
|
|
else: # Create new custom theme based on previously active theme.
|
2017-06-26 21:48:39 -03:00
|
|
|
self.create_new_theme(new_theme)
|
|
|
|
self.colour.set(colour_string)
|
2017-07-05 01:54:55 -03:00
|
|
|
else: # Current theme is user defined.
|
2017-06-26 21:48:39 -03:00
|
|
|
self.colour.set(colour_string)
|
|
|
|
|
|
|
|
def on_new_colour_set(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Display sample of new color selection on the dialog."
|
2017-06-26 21:48:39 -03:00
|
|
|
new_colour=self.colour.get()
|
2017-07-05 01:54:55 -03:00
|
|
|
self.frame_colour_set.config(bg=new_colour) # Set sample.
|
2017-06-26 21:48:39 -03:00
|
|
|
plane ='foreground' if self.fg_bg_toggle.get() else 'background'
|
|
|
|
sample_element = self.theme_elements[self.highlight_target.get()][0]
|
|
|
|
self.text_highlight_sample.tag_config(sample_element, **{plane:new_colour})
|
|
|
|
theme = self.custom_theme.get()
|
|
|
|
theme_element = sample_element + '-' + plane
|
2017-07-07 17:37:39 -03:00
|
|
|
changes.add_option('highlight', theme, theme_element, new_colour)
|
2017-06-26 21:48:39 -03:00
|
|
|
|
|
|
|
def get_new_theme_name(self, message):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Return name of new theme from query popup."
|
2017-06-26 21:48:39 -03:00
|
|
|
used_names = (idleConf.GetSectionList('user', 'highlight') +
|
2014-08-04 00:02:58 -03:00
|
|
|
idleConf.GetSectionList('default', 'highlight'))
|
2017-06-26 21:48:39 -03:00
|
|
|
new_theme = SectionName(
|
|
|
|
self, 'New Custom Theme', message, used_names).result
|
|
|
|
return new_theme
|
2002-12-31 12:03:23 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def save_as_new_theme(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Prompt for new theme name and create the theme."
|
2017-06-26 21:48:39 -03:00
|
|
|
new_theme_name = self.get_new_theme_name('New Theme Name:')
|
|
|
|
if new_theme_name:
|
|
|
|
self.create_new_theme(new_theme_name)
|
2002-02-05 00:52:32 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def create_new_theme(self, new_theme_name):
|
2017-07-05 01:54:55 -03:00
|
|
|
"""Create a new custom theme with the given name.
|
|
|
|
|
|
|
|
Create the new theme based on the previously active theme
|
|
|
|
with the current changes applied. Once it is saved, then
|
|
|
|
activate the new theme.
|
|
|
|
"""
|
2017-06-26 21:48:39 -03:00
|
|
|
if self.is_builtin_theme.get():
|
|
|
|
theme_type = 'default'
|
|
|
|
theme_name = self.builtin_theme.get()
|
2002-12-31 12:03:23 -04:00
|
|
|
else:
|
2017-06-26 21:48:39 -03:00
|
|
|
theme_type = 'user'
|
|
|
|
theme_name = self.custom_theme.get()
|
|
|
|
new_theme = idleConf.GetThemeDict(theme_type, theme_name)
|
2017-07-05 01:54:55 -03:00
|
|
|
# Apply any of the old theme's unsaved changes to the new theme.
|
2017-07-07 17:37:39 -03:00
|
|
|
if theme_name in changes['highlight']:
|
|
|
|
theme_changes = changes['highlight'][theme_name]
|
2017-06-26 21:48:39 -03:00
|
|
|
for element in theme_changes:
|
|
|
|
new_theme[element] = theme_changes[element]
|
2017-07-05 01:54:55 -03:00
|
|
|
# Save the new theme.
|
2017-06-26 21:48:39 -03:00
|
|
|
self.save_new_theme(new_theme_name, new_theme)
|
2017-07-05 01:54:55 -03:00
|
|
|
# Change GUI over to the new theme.
|
2017-06-26 21:48:39 -03:00
|
|
|
custom_theme_list = idleConf.GetSectionList('user', 'highlight')
|
|
|
|
custom_theme_list.sort()
|
|
|
|
self.opt_menu_theme_custom.SetMenu(custom_theme_list, new_theme_name)
|
|
|
|
self.is_builtin_theme.set(0)
|
|
|
|
self.set_theme_type()
|
|
|
|
|
2017-07-09 20:26:32 -03:00
|
|
|
def on_fontlist_select(self, event):
|
|
|
|
"""Handle selecting a font from the list.
|
2017-07-05 01:54:55 -03:00
|
|
|
|
2017-07-09 20:26:32 -03:00
|
|
|
Event can result from either mouse click or Up or Down key.
|
|
|
|
Set font_name and example display to selection.
|
2017-07-05 01:54:55 -03:00
|
|
|
"""
|
2017-07-09 20:26:32 -03:00
|
|
|
font = self.fontlist.get(ANCHOR if event.type == 3 else ACTIVE)
|
2017-06-26 21:48:39 -03:00
|
|
|
self.font_name.set(font.lower())
|
|
|
|
self.set_font_sample()
|
|
|
|
|
|
|
|
def set_font_sample(self, event=None):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Update the screen samples with the font settings from the dialog."
|
2017-06-26 21:48:39 -03:00
|
|
|
font_name = self.font_name.get()
|
|
|
|
font_weight = tkFont.BOLD if self.font_bold.get() else tkFont.NORMAL
|
|
|
|
new_font = (font_name, self.font_size.get(), font_weight)
|
|
|
|
self.font_sample.config(font=new_font)
|
|
|
|
self.text_highlight_sample.configure(font=new_font)
|
|
|
|
|
|
|
|
def set_highlight_target(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Set fg/bg toggle and color based on highlight tag target."
|
|
|
|
if self.highlight_target.get() == 'Cursor': # bg not possible
|
2017-06-26 21:48:39 -03:00
|
|
|
self.radio_fg.config(state=DISABLED)
|
|
|
|
self.radio_bg.config(state=DISABLED)
|
|
|
|
self.fg_bg_toggle.set(1)
|
2017-07-05 01:54:55 -03:00
|
|
|
else: # Both fg and bg can be set.
|
2017-06-26 21:48:39 -03:00
|
|
|
self.radio_fg.config(state=NORMAL)
|
|
|
|
self.radio_bg.config(state=NORMAL)
|
|
|
|
self.fg_bg_toggle.set(1)
|
|
|
|
self.set_colour_sample()
|
2002-12-31 12:03:23 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def set_colour_sample_binding(self, *args):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Change color sample based on foreground/background toggle."
|
2017-06-26 21:48:39 -03:00
|
|
|
self.set_colour_sample()
|
2002-12-31 12:03:23 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def set_colour_sample(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Set the color of the frame background to reflect the selected target."
|
|
|
|
# Set the colour sample area.
|
2017-06-26 21:48:39 -03:00
|
|
|
tag = self.theme_elements[self.highlight_target.get()][0]
|
|
|
|
plane = 'foreground' if self.fg_bg_toggle.get() else 'background'
|
|
|
|
colour = self.text_highlight_sample.tag_cget(tag, plane)
|
|
|
|
self.frame_colour_set.config(bg=colour)
|
|
|
|
|
|
|
|
def paint_theme_sample(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Apply the theme colors to each element tag in the sample text."
|
|
|
|
if self.is_builtin_theme.get(): # Default theme
|
2017-06-26 21:48:39 -03:00
|
|
|
theme = self.builtin_theme.get()
|
2017-07-05 01:54:55 -03:00
|
|
|
else: # User theme
|
2017-06-26 21:48:39 -03:00
|
|
|
theme = self.custom_theme.get()
|
|
|
|
for element_title in self.theme_elements:
|
|
|
|
element = self.theme_elements[element_title][0]
|
2014-08-04 00:02:58 -03:00
|
|
|
colours = idleConf.GetHighlight(theme, element)
|
2017-07-05 01:54:55 -03:00
|
|
|
if element == 'cursor': # Cursor sample needs special painting.
|
2014-08-04 00:02:58 -03:00
|
|
|
colours['background'] = idleConf.GetHighlight(
|
|
|
|
theme, 'normal', fgBg='bg')
|
2017-07-05 01:54:55 -03:00
|
|
|
# Handle any unsaved changes to this theme.
|
2017-07-07 17:37:39 -03:00
|
|
|
if theme in changes['highlight']:
|
|
|
|
theme_dict = changes['highlight'][theme]
|
2017-06-26 21:48:39 -03:00
|
|
|
if element + '-foreground' in theme_dict:
|
|
|
|
colours['foreground'] = theme_dict[element + '-foreground']
|
|
|
|
if element + '-background' in theme_dict:
|
|
|
|
colours['background'] = theme_dict[element + '-background']
|
|
|
|
self.text_highlight_sample.tag_config(element, **colours)
|
|
|
|
self.set_colour_sample()
|
|
|
|
|
|
|
|
def help_source_selected(self, event):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Handle event for selecting additional help."
|
2017-06-26 21:48:39 -03:00
|
|
|
self.set_helplist_button_states()
|
|
|
|
|
|
|
|
def set_helplist_button_states(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Toggle the state for the help list buttons based on list entries."
|
|
|
|
if self.list_help.size() < 1: # No entries in list.
|
2017-06-26 21:48:39 -03:00
|
|
|
self.button_helplist_edit.config(state=DISABLED)
|
|
|
|
self.button_helplist_remove.config(state=DISABLED)
|
2017-07-05 01:54:55 -03:00
|
|
|
else: # Some entries.
|
|
|
|
if self.list_help.curselection(): # There currently is a selection.
|
2017-06-26 21:48:39 -03:00
|
|
|
self.button_helplist_edit.config(state=NORMAL)
|
|
|
|
self.button_helplist_remove.config(state=NORMAL)
|
2017-07-05 01:54:55 -03:00
|
|
|
else: # There currently is not a selection.
|
2017-06-26 21:48:39 -03:00
|
|
|
self.button_helplist_edit.config(state=DISABLED)
|
|
|
|
self.button_helplist_remove.config(state=DISABLED)
|
2002-02-05 00:52:32 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def helplist_item_add(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"""Handle add button for the help list.
|
|
|
|
|
|
|
|
Query for name and location of new help sources and add
|
|
|
|
them to the list.
|
|
|
|
"""
|
2017-06-26 21:48:39 -03:00
|
|
|
help_source = HelpSource(self, 'New Help Source',
|
2016-07-08 01:22:50 -03:00
|
|
|
).result
|
2017-06-26 21:48:39 -03:00
|
|
|
if help_source:
|
|
|
|
self.user_helplist.append((help_source[0], help_source[1]))
|
|
|
|
self.list_help.insert(END, help_source[0])
|
|
|
|
self.update_user_help_changed_items()
|
|
|
|
self.set_helplist_button_states()
|
|
|
|
|
|
|
|
def helplist_item_edit(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"""Handle edit button for the help list.
|
|
|
|
|
|
|
|
Query with existing help source information and update
|
|
|
|
config if the values are changed.
|
|
|
|
"""
|
2017-06-26 21:48:39 -03:00
|
|
|
item_index = self.list_help.index(ANCHOR)
|
|
|
|
help_source = self.user_helplist[item_index]
|
|
|
|
new_help_source = HelpSource(
|
2016-07-08 01:22:50 -03:00
|
|
|
self, 'Edit Help Source',
|
2017-06-26 21:48:39 -03:00
|
|
|
menuitem=help_source[0],
|
|
|
|
filepath=help_source[1],
|
2016-07-08 01:22:50 -03:00
|
|
|
).result
|
2017-06-26 21:48:39 -03:00
|
|
|
if new_help_source and new_help_source != help_source:
|
|
|
|
self.user_helplist[item_index] = new_help_source
|
|
|
|
self.list_help.delete(item_index)
|
|
|
|
self.list_help.insert(item_index, new_help_source[0])
|
|
|
|
self.update_user_help_changed_items()
|
|
|
|
self.set_helplist_button_states()
|
|
|
|
|
|
|
|
def helplist_item_remove(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"""Handle remove button for the help list.
|
|
|
|
|
|
|
|
Delete the help list item from config.
|
|
|
|
"""
|
2017-06-26 21:48:39 -03:00
|
|
|
item_index = self.list_help.index(ANCHOR)
|
|
|
|
del(self.user_helplist[item_index])
|
|
|
|
self.list_help.delete(item_index)
|
|
|
|
self.update_user_help_changed_items()
|
|
|
|
self.set_helplist_button_states()
|
|
|
|
|
|
|
|
def update_user_help_changed_items(self):
|
2017-07-07 17:37:39 -03:00
|
|
|
"Clear and rebuild the HelpFiles section in changes"
|
|
|
|
changes['main']['HelpFiles'] = {}
|
2017-06-26 21:48:39 -03:00
|
|
|
for num in range(1, len(self.user_helplist) + 1):
|
2017-07-07 17:37:39 -03:00
|
|
|
changes.add_option(
|
2014-08-04 00:02:58 -03:00
|
|
|
'main', 'HelpFiles', str(num),
|
2017-06-26 21:48:39 -03:00
|
|
|
';'.join(self.user_helplist[num-1][:2]))
|
2002-12-31 12:03:23 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def load_font_cfg(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Load current configuration settings for the font options."
|
|
|
|
# Set base editor font selection list.
|
2014-08-04 00:02:58 -03:00
|
|
|
fonts = list(tkFont.families(self))
|
2001-09-24 06:43:17 -03:00
|
|
|
fonts.sort()
|
|
|
|
for font in fonts:
|
2017-07-09 20:26:32 -03:00
|
|
|
self.fontlist.insert(END, font)
|
2017-06-26 21:48:39 -03:00
|
|
|
configured_font = idleConf.GetFont(self, 'main', 'EditorWindow')
|
|
|
|
font_name = configured_font[0].lower()
|
|
|
|
font_size = configured_font[1]
|
|
|
|
font_bold = configured_font[2]=='bold'
|
|
|
|
self.font_name.set(font_name)
|
2003-05-26 17:35:53 -03:00
|
|
|
lc_fonts = [s.lower() for s in fonts]
|
2015-08-01 19:57:33 -03:00
|
|
|
try:
|
2017-06-26 21:48:39 -03:00
|
|
|
current_font_index = lc_fonts.index(font_name)
|
2017-07-09 20:26:32 -03:00
|
|
|
self.fontlist.see(current_font_index)
|
|
|
|
self.fontlist.select_set(current_font_index)
|
|
|
|
self.fontlist.select_anchor(current_font_index)
|
|
|
|
self.fontlist.activate(current_font_index)
|
2015-08-01 19:57:33 -03:00
|
|
|
except ValueError:
|
|
|
|
pass
|
2017-07-05 01:54:55 -03:00
|
|
|
# Set font size dropdown.
|
2017-06-26 21:48:39 -03:00
|
|
|
self.opt_menu_font_size.SetMenu(('7', '8', '9', '10', '11', '12', '13',
|
2016-08-30 21:19:13 -03:00
|
|
|
'14', '16', '18', '20', '22',
|
2017-06-26 21:48:39 -03:00
|
|
|
'25', '29', '34', '40'), font_size )
|
2017-07-05 01:54:55 -03:00
|
|
|
# Set font weight.
|
2017-06-26 21:48:39 -03:00
|
|
|
self.font_bold.set(font_bold)
|
2017-07-05 01:54:55 -03:00
|
|
|
# Set font sample.
|
2017-06-26 21:48:39 -03:00
|
|
|
self.set_font_sample()
|
2002-12-31 12:03:23 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def load_tab_cfg(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Load current configuration settings for the tab options."
|
|
|
|
# Set indent sizes.
|
2017-06-26 21:48:39 -03:00
|
|
|
space_num = idleConf.GetOption(
|
2014-08-04 00:02:58 -03:00
|
|
|
'main', 'Indent', 'num-spaces', default=4, type='int')
|
2017-06-26 21:48:39 -03:00
|
|
|
self.space_num.set(space_num)
|
2002-12-31 12:03:23 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def load_theme_cfg(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Load current configuration settings for the theme options."
|
|
|
|
# Set current theme type radiobutton.
|
2017-06-26 21:48:39 -03:00
|
|
|
self.is_builtin_theme.set(idleConf.GetOption(
|
2014-08-04 00:02:58 -03:00
|
|
|
'main', 'Theme', 'default', type='bool', default=1))
|
2017-07-05 01:54:55 -03:00
|
|
|
# Set current theme.
|
2017-06-26 21:48:39 -03:00
|
|
|
current_option = idleConf.CurrentTheme()
|
2017-07-05 01:54:55 -03:00
|
|
|
# Load available theme option menus.
|
|
|
|
if self.is_builtin_theme.get(): # Default theme selected.
|
2017-06-26 21:48:39 -03:00
|
|
|
item_list = idleConf.GetSectionList('default', 'highlight')
|
|
|
|
item_list.sort()
|
|
|
|
self.opt_menu_theme_builtin.SetMenu(item_list, current_option)
|
|
|
|
item_list = idleConf.GetSectionList('user', 'highlight')
|
|
|
|
item_list.sort()
|
|
|
|
if not item_list:
|
|
|
|
self.radio_theme_custom.config(state=DISABLED)
|
|
|
|
self.custom_theme.set('- no custom themes -')
|
2001-10-29 04:05:34 -04:00
|
|
|
else:
|
2017-06-26 21:48:39 -03:00
|
|
|
self.opt_menu_theme_custom.SetMenu(item_list, item_list[0])
|
2017-07-05 01:54:55 -03:00
|
|
|
else: # User theme selected.
|
2017-06-26 21:48:39 -03:00
|
|
|
item_list = idleConf.GetSectionList('user', 'highlight')
|
|
|
|
item_list.sort()
|
|
|
|
self.opt_menu_theme_custom.SetMenu(item_list, current_option)
|
|
|
|
item_list = idleConf.GetSectionList('default', 'highlight')
|
|
|
|
item_list.sort()
|
|
|
|
self.opt_menu_theme_builtin.SetMenu(item_list, item_list[0])
|
|
|
|
self.set_theme_type()
|
2017-07-05 01:54:55 -03:00
|
|
|
# Load theme element option menu.
|
2017-06-26 21:48:39 -03:00
|
|
|
theme_names = list(self.theme_elements.keys())
|
|
|
|
theme_names.sort(key=lambda x: self.theme_elements[x][1])
|
|
|
|
self.opt_menu_highlight_target.SetMenu(theme_names, theme_names[0])
|
|
|
|
self.paint_theme_sample()
|
|
|
|
self.set_highlight_target()
|
2002-12-31 12:03:23 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def load_key_cfg(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Load current configuration settings for the keybinding options."
|
|
|
|
# Set current keys type radiobutton.
|
2017-06-26 21:48:39 -03:00
|
|
|
self.are_keys_builtin.set(idleConf.GetOption(
|
2014-08-04 00:02:58 -03:00
|
|
|
'main', 'Keys', 'default', type='bool', default=1))
|
2017-07-05 01:54:55 -03:00
|
|
|
# Set current keys.
|
2017-06-26 21:48:39 -03:00
|
|
|
current_option = idleConf.CurrentKeys()
|
2017-07-05 01:54:55 -03:00
|
|
|
# Load available keyset option menus.
|
|
|
|
if self.are_keys_builtin.get(): # Default theme selected.
|
2017-06-26 21:48:39 -03:00
|
|
|
item_list = idleConf.GetSectionList('default', 'keys')
|
|
|
|
item_list.sort()
|
|
|
|
self.opt_menu_keys_builtin.SetMenu(item_list, current_option)
|
|
|
|
item_list = idleConf.GetSectionList('user', 'keys')
|
|
|
|
item_list.sort()
|
|
|
|
if not item_list:
|
|
|
|
self.radio_keys_custom.config(state=DISABLED)
|
|
|
|
self.custom_keys.set('- no custom keys -')
|
2001-10-29 04:05:34 -04:00
|
|
|
else:
|
2017-06-26 21:48:39 -03:00
|
|
|
self.opt_menu_keys_custom.SetMenu(item_list, item_list[0])
|
2017-07-05 01:54:55 -03:00
|
|
|
else: # User key set selected.
|
2017-06-26 21:48:39 -03:00
|
|
|
item_list = idleConf.GetSectionList('user', 'keys')
|
|
|
|
item_list.sort()
|
|
|
|
self.opt_menu_keys_custom.SetMenu(item_list, current_option)
|
|
|
|
item_list = idleConf.GetSectionList('default', 'keys')
|
|
|
|
item_list.sort()
|
|
|
|
self.opt_menu_keys_builtin.SetMenu(item_list, idleConf.default_keys())
|
|
|
|
self.set_keys_type()
|
2017-07-05 01:54:55 -03:00
|
|
|
# Load keyset element list.
|
2017-06-26 21:48:39 -03:00
|
|
|
keyset_name = idleConf.CurrentKeys()
|
|
|
|
self.load_keys_list(keyset_name)
|
2002-12-31 12:03:23 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def load_general_cfg(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Load current configuration settings for the general options."
|
|
|
|
# Set startup state.
|
2017-06-26 21:48:39 -03:00
|
|
|
self.startup_edit.set(idleConf.GetOption(
|
2014-08-04 00:02:58 -03:00
|
|
|
'main', 'General', 'editor-on-startup', default=1, type='bool'))
|
2017-07-05 01:54:55 -03:00
|
|
|
# Set autosave state.
|
2017-06-26 21:48:39 -03:00
|
|
|
self.autosave.set(idleConf.GetOption(
|
2014-08-04 00:02:58 -03:00
|
|
|
'main', 'General', 'autosave', default=0, type='bool'))
|
2017-07-05 01:54:55 -03:00
|
|
|
# Set initial window size.
|
2017-06-26 21:48:39 -03:00
|
|
|
self.win_width.set(idleConf.GetOption(
|
2014-08-04 00:02:58 -03:00
|
|
|
'main', 'EditorWindow', 'width', type='int'))
|
2017-06-26 21:48:39 -03:00
|
|
|
self.win_height.set(idleConf.GetOption(
|
2014-08-04 00:02:58 -03:00
|
|
|
'main', 'EditorWindow', 'height', type='int'))
|
2017-07-05 01:54:55 -03:00
|
|
|
# Set default source encoding.
|
2014-08-04 00:02:58 -03:00
|
|
|
self.encoding.set(idleConf.GetOption(
|
|
|
|
'main', 'EditorWindow', 'encoding', default='none'))
|
2017-07-05 01:54:55 -03:00
|
|
|
# Set additional help sources.
|
2017-06-26 21:48:39 -03:00
|
|
|
self.user_helplist = idleConf.GetAllExtraHelpSourcesList()
|
|
|
|
for help_item in self.user_helplist:
|
|
|
|
self.list_help.insert(END, help_item[0])
|
|
|
|
self.set_helplist_button_states()
|
2002-12-31 12:03:23 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def load_configs(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"""Load configuration for each page.
|
|
|
|
|
|
|
|
Load configuration from default and user config files and populate
|
2001-10-23 07:42:12 -03:00
|
|
|
the widgets on the config dialog pages.
|
|
|
|
"""
|
2017-06-26 21:48:39 -03:00
|
|
|
self.load_font_cfg()
|
|
|
|
self.load_tab_cfg()
|
|
|
|
self.load_theme_cfg()
|
|
|
|
self.load_key_cfg()
|
|
|
|
self.load_general_cfg()
|
2015-10-13 23:03:51 -03:00
|
|
|
# note: extension page handled separately
|
2002-12-31 12:03:23 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def save_new_key_set(self, keyset_name, keyset):
|
2017-07-05 01:54:55 -03:00
|
|
|
"""Save a newly created core key set.
|
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
keyset_name - string, the name of the new key set
|
|
|
|
keyset - dictionary containing the new key set
|
2002-02-10 22:20:53 -04:00
|
|
|
"""
|
2017-06-26 21:48:39 -03:00
|
|
|
if not idleConf.userCfg['keys'].has_section(keyset_name):
|
|
|
|
idleConf.userCfg['keys'].add_section(keyset_name)
|
|
|
|
for event in keyset:
|
|
|
|
value = keyset[event]
|
|
|
|
idleConf.userCfg['keys'].SetOption(keyset_name, event, value)
|
2002-12-31 12:03:23 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def save_new_theme(self, theme_name, theme):
|
2017-07-05 01:54:55 -03:00
|
|
|
"""Save a newly created theme.
|
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
theme_name - string, the name of the new theme
|
2002-02-10 22:20:53 -04:00
|
|
|
theme - dictionary containing the new theme
|
|
|
|
"""
|
2017-06-26 21:48:39 -03:00
|
|
|
if not idleConf.userCfg['highlight'].has_section(theme_name):
|
|
|
|
idleConf.userCfg['highlight'].add_section(theme_name)
|
2007-08-23 02:25:55 -03:00
|
|
|
for element in theme:
|
2014-08-04 00:02:58 -03:00
|
|
|
value = theme[element]
|
2017-06-26 21:48:39 -03:00
|
|
|
idleConf.userCfg['highlight'].SetOption(theme_name, element, value)
|
2002-12-31 12:03:23 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def deactivate_current_config(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Remove current key bindings."
|
|
|
|
# Before a config is saved, some cleanup of current
|
|
|
|
# config must be done - remove the previous keybindings.
|
2017-06-26 21:48:39 -03:00
|
|
|
win_instances = self.parent.instance_dict.keys()
|
|
|
|
for instance in win_instances:
|
2005-11-18 18:05:48 -04:00
|
|
|
instance.RemoveKeybindings()
|
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def activate_config_changes(self):
|
2005-01-30 23:34:26 -04:00
|
|
|
"Dynamically apply configuration changes"
|
2017-06-26 21:48:39 -03:00
|
|
|
win_instances = self.parent.instance_dict.keys()
|
|
|
|
for instance in win_instances:
|
2002-03-02 03:16:21 -04:00
|
|
|
instance.ResetColorizer()
|
2002-03-11 20:21:56 -04:00
|
|
|
instance.ResetFont()
|
2005-01-30 23:34:26 -04:00
|
|
|
instance.set_notabs_indentwidth()
|
2005-11-18 18:05:48 -04:00
|
|
|
instance.ApplyKeybindings()
|
2003-01-14 18:03:31 -04:00
|
|
|
instance.reset_help_menu_entries()
|
2002-12-31 12:03:23 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def cancel(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Dismiss config dialog."
|
2002-01-21 02:38:21 -04:00
|
|
|
self.destroy()
|
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def ok(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Apply config changes, then dismiss dialog."
|
2017-06-26 21:48:39 -03:00
|
|
|
self.apply()
|
2002-01-21 02:38:21 -04:00
|
|
|
self.destroy()
|
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def apply(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Apply config changes and leave dialog open."
|
2017-06-26 21:48:39 -03:00
|
|
|
self.deactivate_current_config()
|
2017-07-07 17:37:39 -03:00
|
|
|
changes.save_all()
|
|
|
|
self.save_all_changed_extensions()
|
2017-06-26 21:48:39 -03:00
|
|
|
self.activate_config_changes()
|
2002-01-21 02:38:21 -04:00
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def help(self):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Create textview for config dialog help."
|
2017-06-26 21:48:39 -03:00
|
|
|
page = self.tab_pages._current_page
|
2015-10-11 23:07:31 -03:00
|
|
|
view_text(self, title='Help for IDLE preferences',
|
|
|
|
text=help_common+help_pages.get(page, ''))
|
|
|
|
|
2017-06-26 21:48:39 -03:00
|
|
|
def create_page_extensions(self):
|
2015-10-13 23:03:51 -03:00
|
|
|
"""Part of the config dialog used for configuring IDLE extensions.
|
2014-10-22 21:15:18 -03:00
|
|
|
|
2015-10-13 23:03:51 -03:00
|
|
|
This code is generic - it works for any and all IDLE extensions.
|
2014-10-22 21:15:18 -03:00
|
|
|
|
2015-10-13 23:03:51 -03:00
|
|
|
IDLE extensions save their configuration options using idleConf.
|
2015-10-13 23:09:06 -03:00
|
|
|
This code reads the current configuration using idleConf, supplies a
|
2015-10-13 23:03:51 -03:00
|
|
|
GUI interface to change the configuration values, and saves the
|
|
|
|
changes using idleConf.
|
2014-10-22 21:15:18 -03:00
|
|
|
|
2015-10-13 23:03:51 -03:00
|
|
|
Not all changes take effect immediately - some may require restarting IDLE.
|
|
|
|
This depends on each extension's implementation.
|
2014-10-22 21:15:18 -03:00
|
|
|
|
2015-10-13 23:03:51 -03:00
|
|
|
All values are treated as text, and it is up to the user to supply
|
|
|
|
reasonable values. The only exception to this are the 'enable*' options,
|
2016-04-17 02:32:47 -03:00
|
|
|
which are boolean, and can be toggled with a True/False button.
|
2015-10-13 23:03:51 -03:00
|
|
|
"""
|
|
|
|
parent = self.parent
|
2017-06-26 21:48:39 -03:00
|
|
|
frame = self.tab_pages.pages['Extensions'].frame
|
2015-10-13 23:03:51 -03:00
|
|
|
self.ext_defaultCfg = idleConf.defaultCfg['extensions']
|
|
|
|
self.ext_userCfg = idleConf.userCfg['extensions']
|
2014-10-22 21:15:18 -03:00
|
|
|
self.is_int = self.register(is_int)
|
|
|
|
self.load_extensions()
|
2017-07-05 01:54:55 -03:00
|
|
|
# Create widgets - a listbox shows all available extensions, with the
|
|
|
|
# controls for the extension selected in the listbox to the right.
|
2015-10-13 23:03:51 -03:00
|
|
|
self.extension_names = StringVar(self)
|
|
|
|
frame.rowconfigure(0, weight=1)
|
|
|
|
frame.columnconfigure(2, weight=1)
|
|
|
|
self.extension_list = Listbox(frame, listvariable=self.extension_names,
|
|
|
|
selectmode='browse')
|
|
|
|
self.extension_list.bind('<<ListboxSelect>>', self.extension_selected)
|
|
|
|
scroll = Scrollbar(frame, command=self.extension_list.yview)
|
|
|
|
self.extension_list.yscrollcommand=scroll.set
|
|
|
|
self.details_frame = LabelFrame(frame, width=250, height=250)
|
|
|
|
self.extension_list.grid(column=0, row=0, sticky='nws')
|
|
|
|
scroll.grid(column=1, row=0, sticky='ns')
|
|
|
|
self.details_frame.grid(column=2, row=0, sticky='nsew', padx=[10, 0])
|
|
|
|
frame.configure(padx=10, pady=10)
|
|
|
|
self.config_frame = {}
|
|
|
|
self.current_extension = None
|
2014-10-22 21:15:18 -03:00
|
|
|
|
2015-10-13 23:03:51 -03:00
|
|
|
self.outerframe = self # TEMPORARY
|
|
|
|
self.tabbed_page_set = self.extension_list # TEMPORARY
|
|
|
|
|
2017-07-05 01:54:55 -03:00
|
|
|
# Create the frame holding controls for each extension.
|
2015-10-13 23:03:51 -03:00
|
|
|
ext_names = ''
|
|
|
|
for ext_name in sorted(self.extensions):
|
|
|
|
self.create_extension_frame(ext_name)
|
|
|
|
ext_names = ext_names + '{' + ext_name + '} '
|
|
|
|
self.extension_names.set(ext_names)
|
|
|
|
self.extension_list.selection_set(0)
|
|
|
|
self.extension_selected(None)
|
2014-10-22 21:15:18 -03:00
|
|
|
|
|
|
|
def load_extensions(self):
|
|
|
|
"Fill self.extensions with data from the default and user configs."
|
|
|
|
self.extensions = {}
|
|
|
|
for ext_name in idleConf.GetExtensions(active_only=False):
|
|
|
|
self.extensions[ext_name] = []
|
|
|
|
|
|
|
|
for ext_name in self.extensions:
|
2015-10-13 23:03:51 -03:00
|
|
|
opt_list = sorted(self.ext_defaultCfg.GetOptionList(ext_name))
|
2014-10-22 21:15:18 -03:00
|
|
|
|
2017-07-05 01:54:55 -03:00
|
|
|
# Bring 'enable' options to the beginning of the list.
|
2014-10-22 21:15:18 -03:00
|
|
|
enables = [opt_name for opt_name in opt_list
|
|
|
|
if opt_name.startswith('enable')]
|
|
|
|
for opt_name in enables:
|
|
|
|
opt_list.remove(opt_name)
|
|
|
|
opt_list = enables + opt_list
|
|
|
|
|
|
|
|
for opt_name in opt_list:
|
2015-10-13 23:03:51 -03:00
|
|
|
def_str = self.ext_defaultCfg.Get(
|
2014-10-22 21:15:18 -03:00
|
|
|
ext_name, opt_name, raw=True)
|
|
|
|
try:
|
|
|
|
def_obj = {'True':True, 'False':False}[def_str]
|
|
|
|
opt_type = 'bool'
|
|
|
|
except KeyError:
|
|
|
|
try:
|
|
|
|
def_obj = int(def_str)
|
|
|
|
opt_type = 'int'
|
|
|
|
except ValueError:
|
|
|
|
def_obj = def_str
|
|
|
|
opt_type = None
|
|
|
|
try:
|
2015-10-13 23:03:51 -03:00
|
|
|
value = self.ext_userCfg.Get(
|
2014-10-22 21:15:18 -03:00
|
|
|
ext_name, opt_name, type=opt_type, raw=True,
|
|
|
|
default=def_obj)
|
2017-07-05 01:54:55 -03:00
|
|
|
except ValueError: # Need this until .Get fixed.
|
|
|
|
value = def_obj # Bad values overwritten by entry.
|
2014-10-22 21:15:18 -03:00
|
|
|
var = StringVar(self)
|
|
|
|
var.set(str(value))
|
|
|
|
|
|
|
|
self.extensions[ext_name].append({'name': opt_name,
|
|
|
|
'type': opt_type,
|
|
|
|
'default': def_str,
|
|
|
|
'value': value,
|
|
|
|
'var': var,
|
|
|
|
})
|
|
|
|
|
2015-08-27 00:13:22 -03:00
|
|
|
def extension_selected(self, event):
|
2017-07-05 01:54:55 -03:00
|
|
|
"Handle selection of an extension from the list."
|
2015-08-27 00:13:22 -03:00
|
|
|
newsel = self.extension_list.curselection()
|
|
|
|
if newsel:
|
|
|
|
newsel = self.extension_list.get(newsel)
|
|
|
|
if newsel is None or newsel != self.current_extension:
|
|
|
|
if self.current_extension:
|
|
|
|
self.details_frame.config(text='')
|
|
|
|
self.config_frame[self.current_extension].grid_forget()
|
|
|
|
self.current_extension = None
|
|
|
|
if newsel:
|
|
|
|
self.details_frame.config(text=newsel)
|
|
|
|
self.config_frame[newsel].grid(column=0, row=0, sticky='nsew')
|
|
|
|
self.current_extension = newsel
|
2014-10-22 21:15:18 -03:00
|
|
|
|
2015-08-27 00:13:22 -03:00
|
|
|
def create_extension_frame(self, ext_name):
|
|
|
|
"""Create a frame holding the widgets to configure one extension"""
|
|
|
|
f = VerticalScrolledFrame(self.details_frame, height=250, width=250)
|
|
|
|
self.config_frame[ext_name] = f
|
|
|
|
entry_area = f.interior
|
2017-07-05 01:54:55 -03:00
|
|
|
# Create an entry for each configuration option.
|
2014-10-22 21:15:18 -03:00
|
|
|
for row, opt in enumerate(self.extensions[ext_name]):
|
2017-07-05 01:54:55 -03:00
|
|
|
# Create a row with a label and entry/checkbutton.
|
2014-10-22 21:15:18 -03:00
|
|
|
label = Label(entry_area, text=opt['name'])
|
|
|
|
label.grid(row=row, column=0, sticky=NW)
|
|
|
|
var = opt['var']
|
|
|
|
if opt['type'] == 'bool':
|
|
|
|
Checkbutton(entry_area, textvariable=var, variable=var,
|
|
|
|
onvalue='True', offvalue='False',
|
|
|
|
indicatoron=FALSE, selectcolor='', width=8
|
2015-08-27 00:13:22 -03:00
|
|
|
).grid(row=row, column=1, sticky=W, padx=7)
|
2014-10-22 21:15:18 -03:00
|
|
|
elif opt['type'] == 'int':
|
|
|
|
Entry(entry_area, textvariable=var, validate='key',
|
2015-08-27 00:13:22 -03:00
|
|
|
validatecommand=(self.is_int, '%P')
|
|
|
|
).grid(row=row, column=1, sticky=NSEW, padx=7)
|
2014-10-22 21:15:18 -03:00
|
|
|
|
|
|
|
else:
|
|
|
|
Entry(entry_area, textvariable=var
|
2015-08-27 00:13:22 -03:00
|
|
|
).grid(row=row, column=1, sticky=NSEW, padx=7)
|
2014-10-22 21:15:18 -03:00
|
|
|
return
|
|
|
|
|
2015-10-13 23:03:51 -03:00
|
|
|
def set_extension_value(self, section, opt):
|
2017-07-05 01:54:55 -03:00
|
|
|
"""Return True if the configuration was added or changed.
|
|
|
|
|
|
|
|
If the value is the same as the default, then remove it
|
|
|
|
from user config file.
|
|
|
|
"""
|
2014-10-22 21:15:18 -03:00
|
|
|
name = opt['name']
|
|
|
|
default = opt['default']
|
|
|
|
value = opt['var'].get().strip() or default
|
|
|
|
opt['var'].set(value)
|
|
|
|
# if self.defaultCfg.has_section(section):
|
2017-07-05 01:54:55 -03:00
|
|
|
# Currently, always true; if not, indent to return.
|
2014-10-22 21:15:18 -03:00
|
|
|
if (value == default):
|
2015-10-13 23:03:51 -03:00
|
|
|
return self.ext_userCfg.RemoveOption(section, name)
|
2017-07-05 01:54:55 -03:00
|
|
|
# Set the option.
|
2015-10-13 23:03:51 -03:00
|
|
|
return self.ext_userCfg.SetOption(section, name, value)
|
2014-10-22 21:15:18 -03:00
|
|
|
|
2015-10-13 23:03:51 -03:00
|
|
|
def save_all_changed_extensions(self):
|
2014-10-22 21:15:18 -03:00
|
|
|
"""Save configuration changes to the user config file."""
|
|
|
|
has_changes = False
|
|
|
|
for ext_name in self.extensions:
|
|
|
|
options = self.extensions[ext_name]
|
|
|
|
for opt in options:
|
2015-10-13 23:03:51 -03:00
|
|
|
if self.set_extension_value(ext_name, opt):
|
2014-10-22 21:15:18 -03:00
|
|
|
has_changes = True
|
|
|
|
if has_changes:
|
2015-10-13 23:03:51 -03:00
|
|
|
self.ext_userCfg.Save()
|
|
|
|
|
|
|
|
|
|
|
|
help_common = '''\
|
|
|
|
When you click either the Apply or Ok buttons, settings in this
|
|
|
|
dialog that are different from IDLE's default are saved in
|
|
|
|
a .idlerc directory in your home directory. Except as noted,
|
2015-11-12 16:02:57 -04:00
|
|
|
these changes apply to all versions of IDLE installed on this
|
2015-10-13 23:03:51 -03:00
|
|
|
machine. Some do not take affect until IDLE is restarted.
|
|
|
|
[Cancel] only cancels changes made since the last save.
|
|
|
|
'''
|
|
|
|
help_pages = {
|
2016-07-10 14:46:34 -03:00
|
|
|
'Highlighting': '''
|
2015-10-13 23:03:51 -03:00
|
|
|
Highlighting:
|
2015-11-12 16:02:57 -04:00
|
|
|
The IDLE Dark color theme is new in October 2015. It can only
|
2015-10-13 23:03:51 -03:00
|
|
|
be used with older IDLE releases if it is saved as a custom
|
|
|
|
theme, with a different name.
|
2016-07-10 14:46:34 -03:00
|
|
|
''',
|
|
|
|
'Keys': '''
|
|
|
|
Keys:
|
|
|
|
The IDLE Modern Unix key set is new in June 2016. It can only
|
|
|
|
be used with older IDLE releases if it is saved as a custom
|
|
|
|
key set, with a different name.
|
|
|
|
''',
|
2017-06-28 00:02:19 -03:00
|
|
|
'Extensions': '''
|
|
|
|
Extensions:
|
|
|
|
|
|
|
|
Autocomplete: Popupwait is milleseconds to wait after key char, without
|
|
|
|
cursor movement, before popping up completion box. Key char is '.' after
|
|
|
|
identifier or a '/' (or '\\' on Windows) within a string.
|
|
|
|
|
|
|
|
FormatParagraph: Max-width is max chars in lines after re-formatting.
|
|
|
|
Use with paragraphs in both strings and comment blocks.
|
|
|
|
|
|
|
|
ParenMatch: Style indicates what is highlighted when closer is entered:
|
|
|
|
'opener' - opener '({[' corresponding to closer; 'parens' - both chars;
|
|
|
|
'expression' (default) - also everything in between. Flash-delay is how
|
|
|
|
long to highlight if cursor is not moved (0 means forever).
|
|
|
|
'''
|
2015-10-13 23:03:51 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
def is_int(s):
|
|
|
|
"Return 's is blank or represents an int'"
|
|
|
|
if not s:
|
|
|
|
return True
|
|
|
|
try:
|
|
|
|
int(s)
|
|
|
|
return True
|
|
|
|
except ValueError:
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
|
|
class VerticalScrolledFrame(Frame):
|
|
|
|
"""A pure Tkinter vertically scrollable frame.
|
|
|
|
|
|
|
|
* Use the 'interior' attribute to place widgets inside the scrollable frame
|
|
|
|
* Construct and pack/place/grid normally
|
|
|
|
* This frame only allows vertical scrolling
|
|
|
|
"""
|
|
|
|
def __init__(self, parent, *args, **kw):
|
|
|
|
Frame.__init__(self, parent, *args, **kw)
|
|
|
|
|
2017-07-05 01:54:55 -03:00
|
|
|
# Create a canvas object and a vertical scrollbar for scrolling it.
|
2015-10-13 23:03:51 -03:00
|
|
|
vscrollbar = Scrollbar(self, orient=VERTICAL)
|
|
|
|
vscrollbar.pack(fill=Y, side=RIGHT, expand=FALSE)
|
|
|
|
canvas = Canvas(self, bd=0, highlightthickness=0,
|
2015-10-22 04:27:31 -03:00
|
|
|
yscrollcommand=vscrollbar.set, width=240)
|
2015-10-13 23:03:51 -03:00
|
|
|
canvas.pack(side=LEFT, fill=BOTH, expand=TRUE)
|
|
|
|
vscrollbar.config(command=canvas.yview)
|
|
|
|
|
2017-07-05 01:54:55 -03:00
|
|
|
# Reset the view.
|
2015-10-13 23:03:51 -03:00
|
|
|
canvas.xview_moveto(0)
|
|
|
|
canvas.yview_moveto(0)
|
|
|
|
|
2017-07-05 01:54:55 -03:00
|
|
|
# Create a frame inside the canvas which will be scrolled with it.
|
2015-10-13 23:03:51 -03:00
|
|
|
self.interior = interior = Frame(canvas)
|
|
|
|
interior_id = canvas.create_window(0, 0, window=interior, anchor=NW)
|
|
|
|
|
2017-07-05 01:54:55 -03:00
|
|
|
# Track changes to the canvas and frame width and sync them,
|
|
|
|
# also updating the scrollbar.
|
2015-10-13 23:03:51 -03:00
|
|
|
def _configure_interior(event):
|
2017-07-05 01:54:55 -03:00
|
|
|
# Update the scrollbars to match the size of the inner frame.
|
2015-10-13 23:03:51 -03:00
|
|
|
size = (interior.winfo_reqwidth(), interior.winfo_reqheight())
|
|
|
|
canvas.config(scrollregion="0 0 %s %s" % size)
|
|
|
|
interior.bind('<Configure>', _configure_interior)
|
|
|
|
|
|
|
|
def _configure_canvas(event):
|
|
|
|
if interior.winfo_reqwidth() != canvas.winfo_width():
|
2017-07-05 01:54:55 -03:00
|
|
|
# Update the inner frame's width to fill the canvas.
|
2015-10-13 23:03:51 -03:00
|
|
|
canvas.itemconfigure(interior_id, width=canvas.winfo_width())
|
|
|
|
canvas.bind('<Configure>', _configure_canvas)
|
|
|
|
|
|
|
|
return
|
2014-10-22 21:15:18 -03:00
|
|
|
|
|
|
|
|
2001-07-31 03:59:02 -03:00
|
|
|
if __name__ == '__main__':
|
2014-07-15 00:07:32 -03:00
|
|
|
import unittest
|
|
|
|
unittest.main('idlelib.idle_test.test_configdialog',
|
|
|
|
verbosity=2, exit=False)
|
2014-05-29 02:46:26 -03:00
|
|
|
from idlelib.idle_test.htest import run
|
2015-10-20 03:15:28 -03:00
|
|
|
run(ConfigDialog)
|