/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * * the files COPYING and Copyright.html. COPYING can be found at the root * * of the source code distribution tree; Copyright.html can be found at the * * root level of an installed copy of the electronic HDF5 document set and * * is linked from the top-level documents page. It can also be found at * * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*------------------------------------------------------------------------- * * Created: H5Onull.c * Aug 6 1997 * Robb Matzke * * Purpose: The null message. * *------------------------------------------------------------------------- */ #define H5O_PACKAGE /*suppress error about including H5Opkg */ #include "H5private.h" /* Generic Functions */ #include "H5Opkg.h" /* Object headers */ /* This message derives from H5O message class */ const H5O_msg_class_t H5O_MSG_NULL[1] = {{ H5O_NULL_ID, /*message id number */ "null", /*message name for debugging */ 0, /*native message size */ 0, /* messages are sharable? */ NULL, /*no decode method */ NULL, /*no encode method */ NULL, /*no copy method */ NULL, /*no size method */ NULL, /*no reset method */ NULL, /*no free method */ NULL, /*no file delete method */ NULL, /*no link method */ NULL, /*no set share method */ NULL, /*no can share method */ NULL, /*no pre copy native value to file */ NULL, /*no copy native value to file */ NULL, /*no post copy native value to file */ NULL, /*no get creation index */ NULL, /*no set creation index */ NULL /*no debug method */ }}; 974575609ebee40c08d81e98493750b7199b1e6'>idlelib
diff options
context:
space:
mode:
authorSteven M. Gava <elguavas@python.net>2002-02-18 01:43:11 (GMT)
committerSteven M. Gava <elguavas@python.net>2002-02-18 01:43:11 (GMT)
commit4974575609ebee40c08d81e98493750b7199b1e6 (patch)
treeebf9154ccab4771f50ad090c29d35b26f7403879 /Lib/idlelib
parent6354386d6568e83e0c81c745e79223b570673fe7 (diff)
downloadcpython-4974575609ebee40c08d81e98493750b7199b1e6.zip
cpython-4974575609ebee40c08d81e98493750b7199b1e6.tar.gz
cpython-4974575609ebee40c08d81e98493750b7199b1e6.tar.bz2
handle user theme and key set deletion
Diffstat (limited to 'Lib/idlelib')
-rw-r--r--Lib/idlelib/config-keys.def2
-rw-r--r--Lib/idlelib/configDialog.py86
-rw-r--r--Lib/idlelib/configHandler.py10
3 files changed, 87 insertions, 11 deletions
diff --git a/Lib/idlelib/config-keys.def b/Lib/idlelib/config-keys.def
index 6e3b8f3..4fd2322 100644
--- a/Lib/idlelib/config-keys.def
+++ b/Lib/idlelib/config-keys.def
@@ -10,7 +10,7 @@
[IDLE Classic Windows]
copy=<Control-Key-c>
cut=<Control-Key-x>
-paste=<Control-Key-v>
+paste=<Control-Key-m>
beginning-of-line= <Key-Home>
center-insert=<Control-Key-l>
close-all-windows=<Control-Key-q>
diff --git a/Lib/idlelib/configDialog.py b/Lib/idlelib/configDialog.py
index 025bf81..aaec2f7 100644
--- a/Lib/idlelib/configDialog.py
+++ b/Lib/idlelib/configDialog.py
@@ -226,7 +226,8 @@ class ConfigDialog(Toplevel):
self.builtinTheme,None,command=None)
self.optMenuThemeCustom=DynOptionMenu(frameTheme,
self.customTheme,None,command=None)
- self.buttonDeleteCustomTheme=Button(frameTheme,text='Delete Custom Theme')
+ self.buttonDeleteCustomTheme=Button(frameTheme,text='Delete Custom Theme',
+ command=self.DeleteCustomTheme)
##widget packing
#body
frameCustom.pack(side=LEFT,padx=5,pady=10,expand=TRUE,fill=BOTH)
@@ -293,7 +294,8 @@ class ConfigDialog(Toplevel):
self.builtinKeys,None,command=None)
self.optMenuKeysCustom=DynOptionMenu(frameKeySets,
self.customKeys,None,command=None)
- self.buttonDeleteCustomKeys=Button(frameKeySets,text='Delete Custom Key Set')
+ self.buttonDeleteCustomKeys=Button(frameKeySets,text='Delete Custom Key Set',
+ command=self.DeleteCustomKeys)
##widget packing
#body
frameCustom.pack(side=LEFT,padx=5,pady=5,expand=TRUE,fill=BOTH)
@@ -456,8 +458,9 @@ class ConfigDialog(Toplevel):
def VarChanged_customTheme(self,*params):
value=self.customTheme.get()
- self.AddChangedItem('main','Theme','name',value)
- self.PaintThemeSample()
+ if value != '- no custom themes -':
+ self.AddChangedItem('main','Theme','name',value)
+ self.PaintThemeSample()
def VarChanged_themeIsBuiltin(self,*params):
value=self.themeIsBuiltin.get()
@@ -486,8 +489,9 @@ class ConfigDialog(Toplevel):
def VarChanged_customKeys(self,*params):
value=self.customKeys.get()
- self.AddChangedItem('main','Keys','name',value)
- self.LoadKeysList(value)
+ if value != '- no custom keys -':
+ self.AddChangedItem('main','Keys','name',value)
+ self.LoadKeysList(value)
def VarChanged_keysAreBuiltin(self,*params):
value=self.keysAreBuiltin.get()
@@ -594,7 +598,8 @@ class ConfigDialog(Toplevel):
self.listBindings.select_anchor(listIndex)
def GetNewKeysName(self,message):
- usedNames=idleConf.GetSectionList('user','keys')
+ usedNames=(idleConf.GetSectionList('user','keys')+
+ idleConf.GetSectionList('default','keys'))
newKeySet=GetCfgSectionNameDialog(self,'New Custom Key Set',
message,usedNames).result
return newKeySet
@@ -657,6 +662,58 @@ class ConfigDialog(Toplevel):
self.listBindings.select_set(listIndex)
self.listBindings.select_anchor(listIndex)
+ def DeleteCustomKeys(self):
+ keySetName=self.customKeys.get()
+ if not tkMessageBox.askyesno('Delete Key Set','Are you sure you wish '+
+ 'to delete the key set '+`keySetName`+' ?'):
+ return
+ #remove key set from config
+ idleConf.userCfg['keys'].remove_section(keySetName)
+ if self.changedItems['keys'].has_key(keySetName):
+ del(self.changedItems['keys'][keySetName])
+ #write changes
+ idleConf.userCfg['keys'].Save()
+ #reload user key set list
+ itemList=idleConf.GetSectionList('user','keys')
+ itemList.sort()
+ if not itemList:
+ self.radioKeysCustom.config(state=DISABLED)
+ self.optMenuKeysCustom.SetMenu(itemList,'- no custom keys -')
+ else:
+ self.optMenuKeysCustom.SetMenu(itemList,itemList[0])
+ #revert to default key set
+ self.keysAreBuiltin.set(idleConf.defaultCfg['main'].Get('Keys','default'))
+ self.builtinKeys.set(idleConf.defaultCfg['main'].Get('Keys','name'))
+ #user can't back out of these changes, they must be applied now
+ self.Apply()
+ self.SetKeysType()
+
+ def DeleteCustomTheme(self):
+ themeName=self.customTheme.get()
+ if not tkMessageBox.askyesno('Delete Theme','Are you sure you wish '+
+ 'to delete the theme '+`themeName`+' ?'):
+ return
+ #remove theme from config
+ idleConf.userCfg['highlight'].remove_section(themeName)
+ if self.changedItems['highlight'].has_key(themeName):
+ del(self.changedItems['highlight'][themeName])
+ #write changes
+ idleConf.userCfg['highlight'].Save()
+ #reload user theme list
+ itemList=idleConf.GetSectionList('user','highlight')
+ itemList.sort()
+ if not itemList:
+ self.radioThemeCustom.config(state=DISABLED)
+ self.optMenuThemeCustom.SetMenu(itemList,'- no custom themes -')
+ else:
+ self.optMenuThemeCustom.SetMenu(itemList,itemList[0])
+ #revert to default theme
+ self.themeIsBuiltin.set(idleConf.defaultCfg['main'].Get('Theme','default'))
+ self.builtinTheme.set(idleConf.defaultCfg['main'].Get('Theme','name'))
+ #user can't back out of these changes, they must be applied now
+ self.Apply()
+ self.SetThemeType()
+
def GetColour(self):
target=self.highlightTarget.get()
prevColour=self.frameColourSet.cget('bg')
@@ -689,7 +746,8 @@ class ConfigDialog(Toplevel):
self.AddChangedItem('highlight',theme,themeElement,newColour)
def GetNewThemeName(self,message):
- usedNames=idleConf.GetSectionList('user','highlight')
+ usedNames=(idleConf.GetSectionList('user','highlight')+
+ idleConf.GetSectionList('default','highlight'))
newTheme=GetCfgSectionNameDialog(self,'New Custom Theme',
message,usedNames).result
return newTheme
@@ -1025,6 +1083,17 @@ class ConfigDialog(Toplevel):
idleConf.userCfg[configType].Save()
self.ResetChangedItems() #clear the changed items dict
+ def ActivateConfigChanges(self):
+ #things that need to be done to make
+ #applied config changes dynamic:
+ #
+ #update editor/shell font and repaint
+ #dynamically update indentation setttings
+ #update theme and repaint
+ #update keybindings and re-bind
+ #update user help sources menu
+ pass
+
def Cancel(self):
self.destroy()
@@ -1034,6 +1103,7 @@ class ConfigDialog(Toplevel):
def Apply(self):
self.SaveAllChangedConfigs()
+ self.ActivateConfigChanges()
def Help(self):
pass
diff --git a/Lib/idlelib/configHandler.py b/Lib/idlelib/configHandler.py