Created
October 25, 2014 13:09
-
-
Save sahutd/d478deee6b6225c86587 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r 76ef82ec80a7 Lib/idlelib/ToolTip.py | |
--- a/Lib/idlelib/ToolTip.py Sat Oct 25 05:42:30 2014 +0300 | |
+++ b/Lib/idlelib/ToolTip.py Sat Oct 25 18:38:25 2014 +0530 | |
@@ -7,8 +7,9 @@ | |
class ToolTipBase: | |
- def __init__(self, button): | |
+ def __init__(self, button, delay_ms=1500): | |
self.button = button | |
+ self.delay_ms = delay_ms | |
self.tipwindow = None | |
self.id = None | |
self.x = self.y = 0 | |
@@ -25,7 +26,7 @@ | |
def schedule(self): | |
self.unschedule() | |
- self.id = self.button.after(1500, self.showtip) | |
+ self.id = self.button.after(self.delay_ms, self.showtip) | |
def unschedule(self): | |
id = self.id | |
@@ -60,8 +61,8 @@ | |
tw.destroy() | |
class ToolTip(ToolTipBase): | |
- def __init__(self, button, text): | |
- ToolTipBase.__init__(self, button) | |
+ def __init__(self, button, text, delay_ms=1500): | |
+ ToolTipBase.__init__(self, button, delay_ms) | |
self.text = text | |
def showcontents(self): | |
ToolTipBase.showcontents(self, self.text) | |
diff -r 76ef82ec80a7 Lib/idlelib/config-extensions.def | |
--- a/Lib/idlelib/config-extensions.def Sat Oct 25 05:42:30 2014 +0300 | |
+++ b/Lib/idlelib/config-extensions.def Sat Oct 25 18:38:25 2014 +0530 | |
@@ -34,7 +34,9 @@ | |
[AutoComplete] | |
enable=True | |
+enable_help = sample help for enable | |
popupwait=2000 | |
+popupwait_help=this is sample help for popupwait | |
[AutoComplete_cfgBindings] | |
force-open-completions=<Control-Key-space> | |
[AutoComplete_bindings] | |
@@ -58,9 +60,13 @@ | |
enable=True | |
enable_shell=False | |
numlines=3 | |
+numlines_help=sample help text for numlines code context | |
visible=False | |
+visible_help=sample help text for visible code context | |
bgcolor=LightGray | |
+bgcolor_help=sample help text for bgcolor code context | |
fgcolor=Black | |
+fgcolor_help=sample help text for fgcolor code context | |
[CodeContext_bindings] | |
toggle-code-context= | |
diff -r 76ef82ec80a7 Lib/idlelib/configDialog.py | |
--- a/Lib/idlelib/configDialog.py Sat Oct 25 05:42:30 2014 +0300 | |
+++ b/Lib/idlelib/configDialog.py Sat Oct 25 18:38:25 2014 +0530 | |
@@ -22,6 +22,8 @@ | |
from idlelib.configHelpSourceEdit import GetHelpSourceDialog | |
from idlelib.tabbedpages import TabbedPageSet | |
from idlelib import macosxSupport | |
+from idlelib.ToolTip import ToolTip | |
+ | |
class ConfigDialog(Toplevel): | |
def __init__(self, parent, title='', _htest=False, _utest=False): | |
@@ -1305,6 +1307,9 @@ | |
for ext_name in self.extensions: | |
opt_list = sorted(self.defaultCfg.GetOptionList(ext_name)) | |
+ # remove 'help' option entries | |
+ opt_list = [opt_name for opt_name in opt_list | |
+ if not opt_name.endswith('_help')] | |
# bring 'enable' options to the beginning of the list | |
enables = [opt_name for opt_name in opt_list | |
if opt_name.startswith('enable')] | |
@@ -1331,6 +1336,10 @@ | |
default=def_obj) | |
except ValueError: # Need this until .Get fixed | |
value = def_obj # bad values overwritten by entry | |
+ help_str = self.defaultCfg.Get( | |
+ ext_name, opt_name + '_help', raw=True, | |
+ default='') | |
+ | |
var = StringVar(self) | |
var.set(str(value)) | |
@@ -1339,6 +1348,7 @@ | |
'default': def_str, | |
'value': value, | |
'var': var, | |
+ 'help': help_str, | |
}) | |
def create_widgets(self): | |
@@ -1380,6 +1390,9 @@ | |
# create a row with a label and entry/checkbutton | |
label = Label(entry_area, text=opt['name']) | |
label.grid(row=row, column=0, sticky=NW) | |
+ help_str = opt.get('help') | |
+ if help_str: | |
+ ToolTip(label, help_str, delay_ms=500) | |
var = opt['var'] | |
if opt['type'] == 'bool': | |
Checkbutton(entry_area, textvariable=var, variable=var, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment