-GetPortBounds()"""imgbrowse - Display pictures using img"""
+"""imgbrowse - Display pictures using img"""
import FrameWork
import EasyDialogs
import struct
import img
import imgformat
-import macfs
import struct
import mac_image
self._quit()
def opendoc(self, *args):
- fss, ok = macfs.StandardGetFile() # Any file type
- if not ok:
+ pathname = EasyDialogs.AskFileForOpen() # Any file type
+ if not pathname:
return
bar = EasyDialogs.ProgressBar('Reading and converting...')
- pathname = fss.as_pathname()
try:
rdr = img.reader(imgformat.macrgb16, pathname)
except img.error, arg:
from Carbon import Res
from Carbon import Scrap
import os
-import macfs
from Carbon import MacTextEditor
from Carbon import Mlte
self.changed = 0
def menu_save_as(self):
- fss, ok = macfs.StandardPutFile('Save as:')
- if not ok: return
- self.path = fss.as_pathname()
+ path = EasyDialogs.AskFileForSave(message='Save as:')
+ if not path: return
+ self.path = path
self.name = os.path.split(self.path)[-1]
self.wid.SetWTitle(self.name)
self.menu_save()
def _open(self, askfile):
if askfile:
- fss, ok = macfs.StandardGetFile('TEXT')
- if not ok:
+ path = EasyDialogs.AskFileForOpen(typeList=('TEXT',))
+ if not path:
return
- path = fss.as_pathname()
name = os.path.split(path)[-1]
try:
fp = open(path, 'rb') # NOTE binary, we need cr as end-of-line
from Carbon import Events
from Carbon import Win
from Carbon import Windows
-import macfs
+from Carbon import File
+import EasyDialogs
import sys
Qt.EnterMovies()
# Get the movie file
- fss, ok = macfs.StandardGetFile() # Was: QuickTime.MovieFileType
- if not ok:
+ fss = EasyDialogs.AskFileForOpen(wanted=File.FSSpec) # Was: QuickTime.MovieFileType
+ if not fss:
sys.exit(0)
# Open the window
from Carbon import Events
from Carbon import Win
from Carbon import Windows
-import macfs
+from Carbon import File
+import EasyDialogs
import sys
# XXXX maxbounds = (40, 40, 1000, 1000)
Qt.EnterMovies()
# Get the movie file
- fss, ok = macfs.StandardGetFile(QuickTime.MovieFileType)
- if not ok:
+ fss = EasyDialogs.AskFileForOpen(wanted=File.FSSpec) # Was: QuickTime.MovieFileType
+ if not fss:
sys.exit(0)
# Open the window
self.changed = 0
def menu_save_as(self):
- fss, ok = macfs.StandardPutFile('Save as:')
- if not ok: return
- self.path = fss.as_pathname()
+ path = EasyDialogs.AskFileForSave(message='Save as:')
+ if not path: return
+ self.path = path
self.name = os.path.split(self.path)[-1]
self.wid.SetWTitle(self.name)
self.menu_save()
def _open(self, askfile):
if askfile:
- fss, ok = macfs.StandardGetFile('TEXT')
- if not ok:
+ path = EasyDialogs.AskFileForOpen(typeList=('TEXT',))
+ if not path:
return
- path = fss.as_pathname()
name = os.path.split(path)[-1]
try:
fp = open(path, 'rb') # NOTE binary, we need cr as end-of-line
import WASTEconst
from Carbon import Scrap
import os
+import EasyDialogs
import macfs
-import MACFS
import string
import htmllib
try:
rf = Res.FSpOpenResFile(self.path, 3)
except Res.Error:
- Res.FSpCreateResFile(self.path, '????', 'TEXT', MACFS.smAllScripts)
+ Res.FSpCreateResFile(self.path, '????', 'TEXT', macfs.smAllScripts)
rf = Res.FSpOpenResFile(self.path, 3)
styles = Res.Resource('')
soup = Res.Resource('')
self.ted.WEResetModCount()
def menu_save_as(self):
- fss, ok = macfs.StandardPutFile('Save as:')
- if not ok: return
- self.path = fss.as_pathname()
+ path = EasyDialogs.AskFileForSave(message='Save as:')
+ if not path: return
+ self.path = path
self.name = os.path.split(self.path)[-1]
self.wid.SetWTitle(self.name)
self.menu_save()
def _open(self, askfile):
if askfile:
- fss, ok = macfs.StandardGetFile('TEXT')
- if not ok:
+ path = EasyDialogs.AskFileForOpen(typeList=('TEXT',))
+ if not path:
return
- path = fss.as_pathname()
name = os.path.split(path)[-1]
try:
fp = open(path, 'rb') # NOTE binary, we need cr as end-of-line
def insertfile(self, *args):
if self.active:
- fss, ok = macfs.StandardGetFile('TEXT')
- if not ok:
+ path = EasyDialogs.AskFileForOpen(typeList=('TEXT',))
+ if not path:
return
- path = fss.as_pathname()
try:
fp = open(path, 'rb') # NOTE binary, we need cr as end-of-line
except IOError, arg:
def inserthtml(self, *args):
if self.active:
- fss, ok = macfs.StandardGetFile('TEXT')
- if not ok:
+ path = EasyDialogs.AskFileForOpen(typeList=('TEXT',))
+ if not path:
return
- path = fss.as_pathname()
try:
fp = open(path, 'r')
except IOError, arg:
from Carbon import Scrap
import os
import macfs
-import MACFS
UNDOLABELS = [ # Indexed by WEGetUndoInfo() value
None, "", "typing", "Cut", "Paste", "Clear", "Drag", "Style"]
try:
rf = Res.FSpOpenResFile(self.path, 3)
except Res.Error:
- Res.FSpCreateResFile(self.path, '????', 'TEXT', MACFS.smAllScripts)
+ Res.FSpCreateResFile(self.path, '????', 'TEXT', macfs.smAllScripts)
rf = Res.FSpOpenResFile(self.path, 3)
styles = Res.Resource('')
soup = Res.Resource('')
self.ted.WEResetModCount()
def menu_save_as(self):
- fss, ok = macfs.StandardPutFile('Save as:')
- if not ok: return
- self.path = fss.as_pathname()
+ path = EasyDialogs.AskFileForSave(message='Save as:')
+ if not path: return
+ self.path = path
self.name = os.path.split(self.path)[-1]
self.wid.SetWTitle(self.name)
self.menu_save()
def _open(self, askfile):
if askfile:
- fss, ok = macfs.StandardGetFile('TEXT')
- if not ok:
+ path = EasyDialogs.AskFileForOpen(typeList=('TEXT',))
+ if not path:
return
- path = fss.as_pathname()
name = os.path.split(path)[-1]
try:
fp = open(path, 'rb') # NOTE binary, we need cr as end-of-line
import WASTEconst
from Carbon import Scrap
import os
-import macfs
+import EasyDialogs
UNDOLABELS = [ # Indexed by WEGetUndoInfo() value
None, "", "typing", "Cut", "Paste", "Clear", "Drag", "Style"]
self.changed = 0
def menu_save_as(self):
- fss, ok = macfs.StandardPutFile('Save as:')
- if not ok: return
- self.path = fss.as_pathname()
+ path = EasyDialogs.AskFileForSave(message='Save as:')
+ if not path: return
+ self.path = path
self.name = os.path.split(self.path)[-1]
self.wid.SetWTitle(self.name)
self.menu_save()
def _open(self, askfile):
if askfile:
- fss, ok = macfs.StandardGetFile('TEXT')
- if not ok:
+ path = EasyDialogs.AskFileForOpen(typeList=('TEXT',))
+ if not path:
return
- path = fss.as_pathname()
name = os.path.split(path)[-1]
try:
fp = open(path, 'rb') # NOTE binary, we need cr as end-of-line
raise "Unknown MacOS.runtimemodel", MacOS.runtimemodel
corepath = os.path.join(extpath, corename)
if not os.path.exists(corepath):
- fss, ok = macfs.PromptGetFile("Please locate PythonCore:", "shlb")
- if not ok:
+ corepath = EasyDialogs.AskFileForOpen(message="Please locate PythonCore:",
+ typeList=("shlb",))
+ if not corepath:
raise KeyboardInterrupt, "cancelled"
- corepath = fss.as_pathname()
return resolvealiasfile(corepath)
def resolvealiasfile(path):
## if n == REVERT_ITEM:
## return [], pythondir
if n == DIR_ITEM:
- fss, ok = macfs.GetDirectory('Select python home folder:')
+ fss = EasyDialogs.AskFolder(message='Select python home folder:',
+ wanted=macfs.FSSpec)
if ok:
options['dir'] = fss
elif n == HELP_ITEM and Help:
By Just, with a little glue by Jack"""
+import EasyDialogs
import macfs
import re
import os
pos = j
def main():
- fss, ok = macfs.GetDirectory()
- if ok:
- walk(fss.as_pathname())
+ pathname = EasyDialogs.AskFolder()
+ if pathname:
+ walk(pathname)
if __name__ == '__main__':
main()
#
import os
import macfs
+import EasyDialogs
import sys
import macostools
walktree(os.path.join(name, f), change)
def run(change):
- fss, ok = macfs.GetDirectory('Folder to search:')
- if not ok:
+ pathname = EasyDialogs.AskFolder(message='Folder to search:')
+ if not pathname:
sys.exit(0)
- walktree(fss.as_pathname(), change)
+ walktree(pathname, change)
if __name__ == '__main__':
run(1)
def main():
macresource.need('DLOG', DIALOG_ID, 'fullbuild.rsrc')
- dir, ok = macfs.GetDirectory('Python source folder:')
- if not ok:
+ dir = EasyDialogs.AskFolder(message='Python source folder:')
+ if not dir:
sys.exit(0)
- dir = dir.as_pathname()
# Set genpluginprojects to use this folder (slight hack)
genpluginprojects.PYTHONDIR = dir
"""
import macfs
+import EasyDialogs
import os
import sys
import re
remove(top)
-fss, ok = macfs.GetDirectory("Please locate the Python home directory")
-if ok:
- walk(fss.as_pathname())
+pathname = EasyDialogs.AskFolder(message="Please locate the Python home directory")
+if pathname:
+ walk(pathname)
sys.exit(1) # so we see the results
# >>> unshar.unshar(f)
import string
+import EasyDialogs
def unshar(fp, verbose=0, overwrite=0):
ofp = None
unshar(fp)
else:
import macfs
- fss, ok = macfs.StandardGetFile('TEXT')
- if not ok:
+ fname = EasyDialogs.AskFileForOpen()
+ if not fname:
sys.exit(0)
- fname = fss.as_pathname()
fp = open(fname, 'r')
- fss, ok = macfs.GetDirectory('Folder to save files in:')
- if not ok:
+ dirname = EasyDialogs.AskFolder(message='Folder to save files in:')
+ if not dirname:
sys.exit(0)
- os.chdir(fss.as_pathname())
+ os.chdir(dirname)
unshar(fp)
if __name__ == '__main__':
"""Recursively zap all .pyc and .pyo files"""
import os
import sys
+import EasyDialogs
# set doit true to actually delete files
# set doit false to just print what would be deleted
if not sys.argv[1:]:
if os.name == 'mac':
import macfs
- fss, ok = macfs.GetDirectory('Directory to zap pyc files in')
- if not ok:
+ dir = EasyDialogs.AskFolder(message='Directory to zap pyc files in')
+ if not dir:
sys.exit(0)
- dir = fss.as_pathname()
zappyc(dir)
else:
print 'Usage: zappyc dir ...'