Kaydet (Commit) 611b9f66 authored tarafından Jack Jansen's avatar Jack Jansen

Added "Open File by Name" command which presens a filename dialog. If

the clipboard contains a filename that filename is used as the default.
üst d424836f
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment