[3.6] bpo-13802: Use non-Latin characters in IDLE's Font settings sam… · python/cpython@ecacbb4 (original) (raw)
`@@ -12,7 +12,7 @@
`
12
12
`from tkinter import (Toplevel, Listbox, Text, Scale, Canvas,
`
13
13
`StringVar, BooleanVar, IntVar, TRUE, FALSE,
`
14
14
`TOP, BOTTOM, RIGHT, LEFT, SOLID, GROOVE, NORMAL, DISABLED,
`
15
``
`-
NONE, BOTH, X, Y, W, E, EW, NS, NSEW, NW,
`
``
15
`+
NONE, BOTH, X, Y, W, E, EW, NS, NSEW, NW, CENTER,
`
16
16
`HORIZONTAL, VERTICAL, ANCHOR, ACTIVE, END)
`
17
17
`from tkinter.ttk import (Button, Checkbutton, Entry, Frame, Label, LabelFrame,
`
18
18
`OptionMenu, Notebook, Radiobutton, Scrollbar, Style)
`
`@@ -479,8 +479,8 @@ def create_page_font_tab(self):
`
479
479
` font_size_title: Label
`
480
480
` (*)sizelist: DynOptionMenu - font_size
`
481
481
` (*)bold_toggle: Checkbutton - font_bold
`
482
``
`-
frame_font_sample: Frame
`
483
``
`-
(*)font_sample: Label
`
``
482
`+
frame_sample: LabelFrame
`
``
483
`+
(*)font_sample: Label
`
484
484
` frame_indent: LabelFrame
`
485
485
` indent_title: Label
`
486
486
` (*)indent_scale: Scale - space_num
`
`@@ -490,18 +490,19 @@ def create_page_font_tab(self):
`
490
490
`self.font_bold = tracers.add(BooleanVar(self), self.var_changed_font)
`
491
491
`self.space_num = tracers.add(IntVar(self), ('main', 'Indent', 'num-spaces'))
`
492
492
``
493
``
`-
Create widgets:
`
494
``
`-
body and body section frames.
`
``
493
`+
Define frames and widgets.
`
495
494
`frame_font = LabelFrame(
`
496
``
`-
self, borderwidth=2, relief=GROOVE, text=' Base Editor Font ')
`
``
495
`+
self, borderwidth=2, relief=GROOVE, text=' Shell/Editor Font ')
`
``
496
`+
frame_sample = LabelFrame(
`
``
497
`+
self, borderwidth=2, relief=GROOVE, text=' Font Sample ')
`
497
498
`frame_indent = LabelFrame(
`
498
499
`self, borderwidth=2, relief=GROOVE, text=' Indentation Width ')
`
499
500
`# frame_font.
`
500
501
`frame_font_name = Frame(frame_font)
`
501
502
`frame_font_param = Frame(frame_font)
`
502
503
`font_name_title = Label(
`
503
504
`frame_font_name, justify=LEFT, text='Font Face :')
`
504
``
`-
self.fontlist = Listbox(frame_font_name, height=5,
`
``
505
`+
self.fontlist = Listbox(frame_font_name, height=15,
`
505
506
`takefocus=True, exportselection=FALSE)
`
506
507
`self.fontlist.bind('', self.on_fontlist_select)
`
507
508
`self.fontlist.bind('', self.on_fontlist_select)
`
`@@ -514,11 +515,37 @@ def create_page_font_tab(self):
`
514
515
`self.bold_toggle = Checkbutton(
`
515
516
`frame_font_param, variable=self.font_bold,
`
516
517
`onvalue=1, offvalue=0, text='Bold')
`
517
``
`-
frame_font_sample = Frame(frame_font, relief=SOLID, borderwidth=1)
`
``
518
`+
frame_sample.
`
``
519
`+
sample = (
`
``
520
`+
'<ASCII/Latin1>\n'
`
``
521
`+
'AaBbCcDdEeFfGgHhIiJj\n1234567890#:+=(){}[]\n'
`
``
522
`+
'\u00a2\u00a3\u00a5\u00a7\u00a9\u00ab\u00ae\u00b6\u00bd\u011e'
`
``
523
`+
'\u00c0\u00c1\u00c2\u00c3\u00c4\u00c5\u00c7\u00d0\u00d8\u00df\n'
`
``
524
`+
'\n<IPA,Greek,Cyrillic>\n'
`
``
525
`+
'\u0250\u0255\u0258\u025e\u025f\u0264\u026b\u026e\u0270\u0277'
`
``
526
`+
'\u027b\u0281\u0283\u0286\u028e\u029e\u02a2\u02ab\u02ad\u02af\n'
`
``
527
`+
'\u0391\u03b1\u0392\u03b2\u0393\u03b3\u0394\u03b4\u0395\u03b5'
`
``
528
`+
'\u0396\u03b6\u0397\u03b7\u0398\u03b8\u0399\u03b9\u039a\u03ba\n'
`
``
529
`+
'\u0411\u0431\u0414\u0434\u0416\u0436\u041f\u043f\u0424\u0444'
`
``
530
`+
'\u0427\u0447\u042a\u044a\u042d\u044d\u0460\u0464\u046c\u04dc\n'
`
``
531
`+
'\n<Hebrew, Arabic>\n'
`
``
532
`+
'\u05d0\u05d1\u05d2\u05d3\u05d4\u05d5\u05d6\u05d7\u05d8\u05d9'
`
``
533
`+
'\u05da\u05db\u05dc\u05dd\u05de\u05df\u05e0\u05e1\u05e2\u05e3\n'
`
``
534
`+
'\u0627\u0628\u062c\u062f\u0647\u0648\u0632\u062d\u0637\u064a'
`
``
535
`+
'\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669\n'
`
``
536
`+
'\n<Devanagari, Tamil>\n'
`
``
537
`+
'\u0966\u0967\u0968\u0969\u096a\u096b\u096c\u096d\u096e\u096f'
`
``
538
`+
'\u0905\u0906\u0907\u0908\u0909\u090a\u090f\u0910\u0913\u0914\n'
`
``
539
`+
'\u0be6\u0be7\u0be8\u0be9\u0bea\u0beb\u0bec\u0bed\u0bee\u0bef'
`
``
540
`+
'\u0b85\u0b87\u0b89\u0b8e\n'
`
``
541
`+
'\n\n'
`
``
542
`+
'\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d\n'
`
``
543
`+
'\u6c49\u5b57\u6f22\u5b57\u4eba\u6728\u706b\u571f\u91d1\u6c34\n'
`
``
544
`+
'\uac00\ub0d0\ub354\ub824\ubaa8\ubd64\uc218\uc720\uc988\uce58\n'
`
``
545
`+
'\u3042\u3044\u3046\u3048\u304a\u30a2\u30a4\u30a6\u30a8\u30aa\n'
`
``
546
`+
)
`
518
547
`temp_font = tkFont.Font(self, ('courier', 10, 'normal'))
`
519
``
`-
self.font_sample = Label(
`
520
``
`-
frame_font_sample, justify=LEFT, font=temp_font,
`
521
``
`-
text='AaBbCcDdEe\nFfGgHhIiJj\n1234567890\n#:+=(){}[]')
`
``
548
`+
self.font_sample = Label(frame_sample, text=sample, font=temp_font)
`
522
549
`# frame_indent.
`
523
550
`indent_title = Label(
`
524
551
`frame_indent, justify=LEFT,
`
`@@ -527,10 +554,12 @@ def create_page_font_tab(self):
`
527
554
`frame_indent, variable=self.space_num,
`
528
555
`orient='horizontal', tickinterval=2, from_=2, to=16)
`
529
556
``
530
``
`-
Pack widgets:
`
531
``
`-
body.
`
532
``
`-
frame_font.pack(side=LEFT, padx=5, pady=5, expand=TRUE, fill=BOTH)
`
533
``
`-
frame_indent.pack(side=LEFT, padx=5, pady=5, fill=Y)
`
``
557
`+
Grid and pack widgets:
`
``
558
`+
self.columnconfigure(1, weight=1)
`
``
559
`+
frame_font.grid(row=0, column=0, padx=5, pady=5)
`
``
560
`+
frame_sample.grid(row=0, column=1, rowspan=2, padx=5, pady=5,
`
``
561
`+
sticky='nsew')
`
``
562
`+
frame_indent.grid(row=1, column=0, padx=5, pady=5, sticky='ew')
`
534
563
`# frame_font.
`
535
564
`frame_font_name.pack(side=TOP, padx=5, pady=5, fill=X)
`
536
565
`frame_font_param.pack(side=TOP, padx=5, pady=5, fill=X)
`
`@@ -540,10 +569,9 @@ def create_page_font_tab(self):
`
540
569
`font_size_title.pack(side=LEFT, anchor=W)
`
541
570
`self.sizelist.pack(side=LEFT, anchor=W)
`
542
571
`self.bold_toggle.pack(side=LEFT, anchor=W, padx=20)
`
543
``
`-
frame_font_sample.pack(side=TOP, padx=5, pady=5, expand=TRUE, fill=BOTH)
`
``
572
`+
frame_sample.
`
544
573
`self.font_sample.pack(expand=TRUE, fill=BOTH)
`
545
574
`# frame_indent.
`
546
``
`-
frame_indent.pack(side=TOP, fill=X)
`
547
575
`indent_title.pack(side=TOP, anchor=W, padx=5)
`
548
576
`self.indent_scale.pack(side=TOP, padx=5, fill=X)
`
549
577
``
`@@ -2108,10 +2136,24 @@ def detach(self):
`
2108
2136
`dialog that are different from IDLE's default are saved in
`
2109
2137
`a .idlerc directory in your home directory. Except as noted,
`
2110
2138
`these changes apply to all versions of IDLE installed on this
`
2111
``
`-
machine. Some do not take affect until IDLE is restarted.
`
2112
``
`-
[Cancel] only cancels changes made since the last save.
`
``
2139
`+
machine. [Cancel] only cancels changes made since the last save.
`
2113
2140
`'''
`
2114
2141
`help_pages = {
`
``
2142
`+
'Fonts/Tabs':'''
`
``
2143
`+
Font sample: This shows what a selection of Basic Multilingual Plane
`
``
2144
`+
unicode characters look like for the current font selection. If the
`
``
2145
`+
selected font does not define a character, Tk attempts to find another
`
``
2146
`+
font that does. Substitute glyphs depend on what is available on a
`
``
2147
`+
particular system and will not necessarily have the same size as the
`
``
2148
`+
font selected. Line contains 20 characters up to Devanagari, 14 for
`
``
2149
`+
Tamil, and 10 for East Asia.
`
``
2150
+
``
2151
`+
Hebrew and Arabic letters should display right to left, starting with
`
``
2152
`+
alef, \u05d0 and \u0627. Arabic digits display left to right. The
`
``
2153
`+
Devanagari and Tamil lines start with digits. The East Asian lines
`
``
2154
`+
are Chinese digits, Chinese Hanzi, Korean Hangul, and Japanese
`
``
2155
`+
Hiragana and Katakana.
`
``
2156
`+
''',
`
2115
2157
`'Highlights': '''
`
2116
2158
`Highlighting:
`
2117
2159
`The IDLE Dark color theme is new in October 2015. It can only
`