[Python-checkins] r63750 - sandbox/trunk/ttk-gsoc/src/idlelib_ttk.diff
guilherme.polo
python-checkins at python.org
Tue May 27 19:39:27 CEST 2008
Author: guilherme.polo
Date: Tue May 27 19:39:27 2008
New Revision: 63750
Log:
Some more appearance fixes;
use-ttk is saved/updated in user configuration files each run.
Modified:
sandbox/trunk/ttk-gsoc/src/idlelib_ttk.diff
Modified: sandbox/trunk/ttk-gsoc/src/idlelib_ttk.diff
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib_ttk.diff (original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib_ttk.diff Tue May 27 19:39:27 2008
@@ -93,7 +93,7 @@
===================================================================
--- Lib/idlelib/PyShell.py (revision 63734)
+++ Lib/idlelib/PyShell.py (working copy)
-@@ -22,14 +22,25 @@
+@@ -22,14 +22,26 @@
print>>sys.__stderr__, "** IDLE can't import Tkinter. " \
"Your Python may not be configured for Tk. **"
sys.exit(1)
@@ -110,6 +110,7 @@
+
+# store ttk availability
+idleConf.SetOption('main', 'General', 'use-ttk', str(TTK))
++idleConf.SaveUserCfgFiles()
+
from EditorWindow import EditorWindow, fixwordbreaks
from FileList import FileList
@@ -120,7 +121,7 @@
import idlever
import rpc
-@@ -1381,6 +1392,19 @@
+@@ -1381,6 +1393,19 @@
# start editor and/or shell windows:
root = Tk(className="Idle")
@@ -144,17 +145,34 @@
===================================================================
--- Lib/idlelib/Debugger.py (revision 63734)
+++ Lib/idlelib/Debugger.py (working copy)
-@@ -5,7 +5,10 @@
+@@ -4,8 +4,11 @@
+ from Tkinter import *
from WindowList import ListedToplevel
from ScrolledList import ScrolledList
++from configHandler import idleConf
import macosxSupport
-+from idlelib.configHandler import idleConf
+if idleConf.GetOption('main', 'General', 'use-ttk', type='int'):
-+ from ttk import *
++ from ttk import Scrollbar
class Idb(bdb.Bdb):
+@@ -155,6 +158,7 @@
+ self.show_locals()
+ if self.vglobals.get():
+ self.show_globals()
++ #
+
+ def interaction(self, message, frame, info=None):
+ self.frame = frame
+@@ -413,6 +417,7 @@
+ height = 20*len(dict) # XXX 20 == observed height of Entry widget
+ self.master = master
+ self.title = title
++
+ import repr
+ self.repr = repr.Repr()
+ self.repr.maxstring = 60
Index: Lib/idlelib/configDialog.py
===================================================================
--- Lib/idlelib/configDialog.py (revision 63734)
@@ -258,7 +276,7 @@
Frame(self, height=2, borderwidth=0).pack(side=BOTTOM)
self.tabPages.pack(side=TOP,expand=TRUE,fill=BOTH)
-@@ -127,7 +152,7 @@
+@@ -127,14 +152,19 @@
frameFontSample=Frame(frameFont,relief=SOLID,borderwidth=1)
self.labelFontSample=Label(frameFontSample,
text='AaBbCcDdEe\nFfGgHhIiJjK\n1234567890\n#:+=(){}[]',
@@ -267,7 +285,21 @@
#frameIndent
frameIndentSize=Frame(frameIndent)
labelSpaceNumTitle=Label(frameIndentSize, justify=LEFT,
-@@ -149,7 +174,7 @@
+ text='Python Standard: 4 Spaces!')
+ self.scaleSpaceNum=Scale(frameIndentSize, variable=self.spaceNum,
+- orient='horizontal',
+- tickinterval=2, from_=2, to=16)
++ orient='horizontal', tickinterval=2,
++ from_=2, to=16)
++ if TTK:
++ self.scaleSpaceNum.configure(
++ bg=self.ttkstyle.configure('.', 'background'),
++ highlightthickness=0)
++
+ #widget packing
+ #body
+ frameFont.pack(side=LEFT,padx=5,pady=5,expand=TRUE,fill=BOTH)
+@@ -149,7 +179,7 @@
self.optMenuFontSize.pack(side=LEFT,anchor=W)
checkFontBold.pack(side=LEFT,anchor=W,padx=20)
frameFontSample.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=BOTH)
@@ -276,7 +308,7 @@
#frameIndent
frameIndentSize.pack(side=TOP,fill=X)
labelSpaceNumTitle.pack(side=TOP,anchor=W,padx=5)
-@@ -174,7 +199,7 @@
+@@ -174,7 +204,7 @@
text=' Highlighting Theme ')
#frameCustom
self.textHighlightSample=Text(frameCustom,relief=SOLID,borderwidth=1,
@@ -285,7 +317,7 @@
takefocus=FALSE,highlightthickness=0,wrap=NONE)
text=self.textHighlightSample
text.bind('<Double-Button-1>',lambda e: 'break')
-@@ -197,12 +222,15 @@
+@@ -197,12 +227,15 @@
lambda event,elem=element: event.widget.winfo_toplevel()
.highlightTarget.set(elem))
text.config(state=DISABLED)
@@ -304,7 +336,7 @@
self.radioFg=Radiobutton(frameFgBg,variable=self.fgHilite,
value=1,text='Foreground',command=self.SetColourSampleBinding)
self.radioBg=Radiobutton(frameFgBg,variable=self.fgHilite,
-@@ -275,8 +303,11 @@
+@@ -275,8 +308,11 @@
self.buttonNewKeys=Button(frameCustom,text='Get New Keys for Selection',
command=self.GetNewKeys,state=DISABLED)
#frameKeySets
@@ -318,7 +350,7 @@
self.radioKeysBuiltin=Radiobutton(frames[0],variable=self.keysAreBuiltin,
value=1,command=self.SetKeysType,text='Use a Built-in Key Set')
self.radioKeysCustom=Radiobutton(frames[0],variable=self.keysAreBuiltin,
-@@ -748,14 +779,14 @@
+@@ -748,14 +784,14 @@
def GetColour(self):
target=self.highlightTarget.get()
@@ -336,7 +368,7 @@
newTheme=self.GetNewThemeName(message)
if not newTheme: #user cancelled custom theme creation
return
-@@ -767,7 +798,7 @@
+@@ -767,7 +803,7 @@
def OnNewColourSet(self):
newColour=self.colour.get()
@@ -345,7 +377,7 @@
if self.fgHilite.get(): plane='foreground'
else: plane='background'
sampleElement=self.themeElements[self.highlightTarget.get()][0]
-@@ -777,6 +808,7 @@
+@@ -777,6 +813,7 @@
self.AddChangedItem('highlight',theme,themeElement,newColour)
def GetNewThemeName(self,message):
@@ -353,7 +385,7 @@
usedNames=(idleConf.GetSectionList('user','highlight')+
idleConf.GetSectionList('default','highlight'))
newTheme=GetCfgSectionNameDialog(self,'New Custom Theme',
-@@ -846,7 +878,7 @@
+@@ -846,7 +883,7 @@
if self.fgHilite.get(): plane='foreground'
else: plane='background'
colour=self.textHighlightSample.tag_cget(tag,plane)
@@ -2164,6 +2196,63 @@
+ labelPgName.pack(padx=5)
+ entryPgName.pack(padx=5)
+ root.mainloop()
+Index: Lib/idlelib/dynOptionMenuWidget.py
+===================================================================
+--- Lib/idlelib/dynOptionMenuWidget.py (revision 63734)
++++ Lib/idlelib/dynOptionMenuWidget.py (working copy)
+@@ -2,34 +2,41 @@
+ OptionMenu widget modified to allow dynamic menu reconfiguration
+ and setting of highlightthickness
+ """
+-from Tkinter import OptionMenu
++from Tkinter import OptionMenu, Menu
+ from Tkinter import _setit
+ import copy
+
++from configHandler import idleConf
++TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int')
++if TTK:
++ from ttk import Style
++
+ class DynOptionMenu(OptionMenu):
+- """
+- unlike OptionMenu, our kwargs can include highlightthickness
+- """
++ """Unlike OptionMenu, our kwargs can include highlightthickness"""
+ def __init__(self, master, variable, value, *values, **kwargs):
+ #get a copy of kwargs before OptionMenu.__init__ munges them
+ kwargsCopy=copy.copy(kwargs)
+ if 'highlightthickness' in kwargs.keys():
+ del(kwargs['highlightthickness'])
++ self.command=kwargs.get('command')
++ self.variable=variable
++
+ OptionMenu.__init__(self, master, variable, value, *values, **kwargs)
+ self.config(highlightthickness=kwargsCopy.get('highlightthickness'))
+- #self.menu=self['menu']
+- self.variable=variable
+- self.command=kwargs.get('command')
++ if TTK: # XXX Ideally this should be a ttk Menubutton
++ bg = Style(master).configure('.', 'background')
++ self.configure(bg=bg, highlightbackground=bg)
+
+- def SetMenu(self,valueList,value=None):
++ def SetMenu(self, valueList, value=None):
+ """
+ clear and reload the menu with a new set of options.
+ valueList - list of new options
+ value - initial value to set the optionmenu's menubutton to
+ """
+- self['menu'].delete(0,'end')
++ menu = self['menu']
++ menu.delete(0,'end')
+ for item in valueList:
+- self['menu'].add_command(label=item,
+- command=_setit(self.variable,item,self.command))
++ menu.add_command(label=item,
++ command=_setit(self.variable,item,self.command))
+ if value:
+ self.variable.set(value)
Index: Lib/idlelib/MultiStatusBar.py
===================================================================
--- Lib/idlelib/MultiStatusBar.py (revision 63734)
More information about the Python-checkins
mailing list