summaryrefslogtreecommitdiffstats
path: root/Mac
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2003-02-05 15:41:09 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2003-02-05 15:41:09 (GMT)
commit611b9f669777a18736bf1bafa03f4e965d8640a2 (patch)
tree409cb7067e7e08a88cf91d8f16de1088e6d334a9 /Mac
parentd424836f3ac5dad044f131ea77edb1a84ba1a56e (diff)
downloadcpython-611b9f669777a18736bf1bafa03f4e965d8640a2.zip
cpython-611b9f669777a18736bf1bafa03f4e965d8640a2.tar.gz
cpython-611b9f669777a18736bf1bafa03f4e965d8640a2.tar.bz2
Added "Open File by Name" command which presens a filename dialog. If
the clipboard contains a filename that filename is used as the default.
Diffstat (limited to 'Mac')
-rw-r--r--Mac/Tools/IDE/PythonIDEMain.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Mac/Tools/IDE/PythonIDEMain.py b/Mac/Tools/IDE/PythonIDEMain.py
index 5b9376b..765d988 100644
--- a/Mac/Tools/IDE/PythonIDEMain.py
+++ b/Mac/Tools/IDE/PythonIDEMain.py
@@ -70,6 +70,7 @@ class PythonIDE(Wapplication.Application):
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 @@ class PythonIDE(Wapplication.Application):
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