1"Example extension, also used for testing." 2 3from idlelib.config import idleConf 4 5ztext = idleConf.GetOption('extensions', 'ZzDummy', 'z-text') 6 7 8class ZzDummy: 9 10## menudefs = [ 11## ('format', [ 12## ('Z in', '<<z-in>>'), 13## ('Z out', '<<z-out>>'), 14## ] ) 15## ] 16 17 def __init__(self, editwin): 18 self.text = editwin.text 19 z_in = False 20 21 @classmethod 22 def reload(cls): 23 cls.ztext = idleConf.GetOption('extensions', 'ZzDummy', 'z-text') 24 25 def z_in_event(self, event): 26 """ 27 """ 28 text = self.text 29 text.undo_block_start() 30 for line in range(1, text.index('end')): 31 text.insert('%d.0', ztest) 32 text.undo_block_stop() 33 return "break" 34 35 def z_out_event(self, event): pass 36 37ZzDummy.reload() 38 39##if __name__ == "__main__": 40## import unittest 41## unittest.main('idlelib.idle_test.test_zzdummy', 42## verbosity=2, exit=False) 43