summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/EditorWindow.py
diff options
context:
space:
mode:
authorKurt B. Kaiser <kbk@shore.net>2005-01-31 03:34:26 (GMT)
committerKurt B. Kaiser <kbk@shore.net>2005-01-31 03:34:26 (GMT)
commitacdef858a51f32d2b2c82f3d47025cb26c2a63ee (patch)
treece0c652dcebe1f1a6a129759011fac5f5e86ec81 /Lib/idlelib/EditorWindow.py
parentb5646aa3fb1638763715459400f78c098239f0be (diff)
downloadcpython-acdef858a51f32d2b2c82f3d47025cb26c2a63ee.zip
cpython-acdef858a51f32d2b2c82f3d47025cb26c2a63ee.tar.gz
cpython-acdef858a51f32d2b2c82f3d47025cb26c2a63ee.tar.bz2
Removed ability to configure tabs indent from Options dialog. This 'feature'
has never worked and no one has complained. It is still possible to set a default tabs (v. spaces) indent 'manually' via config-main.def (or to turn on tabs for the current EditorWindow via the Format menu) but IDLE will encourage indentation via spaces. Enable setting the indentation width using the Options dialog. Bug # 783877 Remove some commented out old code from configDialog.py (related to old methods for invoking the HelpBrowser). M EditorWindow.py M NEWS.txt M configHandler.py
Diffstat (limited to 'Lib/idlelib/EditorWindow.py')
-rw-r--r--Lib/idlelib/EditorWindow.py35
1 files changed, 23 insertions, 12 deletions
diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py
index 31f400c..ed6b1a1 100644
--- a/Lib/idlelib/EditorWindow.py
+++ b/Lib/idlelib/EditorWindow.py
@@ -157,12 +157,12 @@ class EditorWindow(object):
vbar['command'] = text.yview
vbar.pack(side=RIGHT, fill=Y)
text['yscrollcommand'] = vbar.set
- fontWeight='normal'
- if idleConf.GetOption('main','EditorWindow','font-bold',type='bool'):
+ fontWeight = 'normal'
+ if idleConf.GetOption('main', 'EditorWindow', 'font-bold', type='bool'):
fontWeight='bold'
- text.config(font=(idleConf.GetOption('main','EditorWindow','font'),
- idleConf.GetOption('main','EditorWindow','font-size'),
- fontWeight))
+ text.config(font=(idleConf.GetOption('main', 'EditorWindow', 'font'),
+ idleConf.GetOption('main', 'EditorWindow', 'font-size'),
+ fontWeight))
text_frame.pack(side=LEFT, fill=BOTH, expand=1)
text.pack(side=TOP, fill=BOTH, expand=1)
text.focus_set()
@@ -173,19 +173,23 @@ class EditorWindow(object):
# which will cause Tabnanny to nag!
# false -> tab characters are converted to spaces by indent
# and dedent cmds, and ditto TAB keystrokes
- self.usetabs = False
-
- # indentwidth is the number of characters per logical indent level.
- # Recommended Python default indent is four spaces.
- self.indentwidth = 4
+ # Although use-spaces=0 can be configured manually in config-main.def,
+ # configuration of tabs v. spaces is not supported in the configuration
+ # dialog. IDLE promotes the preferred Python indentation: use spaces!
+ usespaces = idleConf.GetOption('main', 'Indent', 'use-spaces', type='bool')
+ self.usetabs = not usespaces
# tabwidth is the display width of a literal tab character.
# CAUTION: telling Tk to use anything other than its default
# tab setting causes it to use an entirely different tabbing algorithm,
# treating tab stops as fixed distances from the left margin.
# Nobody expects this, so for now tabwidth should never be changed.
- self.tabwidth = 8 # for IDLE use, must remain 8 until Tk is fixed.
- # indentwidth should be 8 when usetabs is True.
+ self.tabwidth = 8 # must remain 8 until Tk is fixed.
+
+ # indentwidth is the number of screen characters per indent level.
+ # The recommended Python indentation is four spaces.
+ self.indentwidth = self.tabwidth
+ self.set_notabs_indentwidth()
# If context_use_ps1 is true, parsing searches back for a ps1 line;
# else searches for a popular (if, def, ...) Python stmt.
@@ -583,6 +587,13 @@ class EditorWindow(object):
accel=get_accelerator(keydefs, event)
menu.entryconfig(index,accelerator=accel)
+ def set_notabs_indentwidth(self):
+ "Update the indentwidth if changed and not using tabs in this window"
+ # Called from configDialog.py
+ if not self.usetabs:
+ self.indentwidth = idleConf.GetOption('main', 'Indent','num-spaces',
+ type='int')
+
def reset_help_menu_entries(self):
"Update the additional help entries on the Help menu"
help_list = idleConf.GetAllExtraHelpSourcesList()