Mercurial > cpython-lru_cache-weakref
diff Mac/Tools/IDE/PythonIDEMain.py @ 27697:43143d4dd6b1 legacy-trunk
Added "Open File by Name" command which presens a filename dialog. If
the clipboard contains a filename that filename is used as the default.
| author | Jack Jansen <jack.jansen@cwi.nl> |
|---|---|
| date | Wed, 05 Feb 2003 15:41:09 +0000 |
| parents | ea5ee3e7bfb1 |
| children | 4367f805db09 |
line wrap: on
line diff
--- a/Mac/Tools/IDE/PythonIDEMain.py Wed Feb 05 15:40:05 2003 +0000 +++ b/Mac/Tools/IDE/PythonIDEMain.py Wed Feb 05 15:41:09 2003 +0000 @@ -70,6 +70,7 @@ m = Wapplication.Menu(self.menubar, "File") newitem = FrameWork.MenuItem(m, "New", "N", 'new') openitem = FrameWork.MenuItem(m, "Open"+ELIPSES, "O", 'open') + openbynameitem = FrameWork.MenuItem(m, "Open File by Name"+ELIPSES, "D", 'openbyname') FrameWork.Separator(m) closeitem = FrameWork.MenuItem(m, "Close", "W", 'close') saveitem = FrameWork.MenuItem(m, "Save", "S", 'save') @@ -210,6 +211,22 @@ if filename: self.openscript(filename) + def domenu_openbyname(self, *args): + # Open a file by name. If the clipboard contains a filename + # use that as the default. + from Carbon import Scrap + try: + sc = Scrap.GetCurrentScrap() + dft = sc.GetScrapFlavorData("TEXT") + except Scrap.Error: + dft = "" + else: + if not os.path.exists(dft): + dft = "" + filename = EasyDialogs.AskString("Open File Named:", default=dft, ok="Open") + if filename: + self.openscript(filename) + def domenu_new(self, *args): W.SetCursor('watch') import PyEdit
