diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2003-01-26 21:40:00 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2003-01-26 21:40:00 (GMT) |
commit | b340acf9fd893140efd65a56134a814a8d9bac73 (patch) | |
tree | c991a32a9d7b34262675c1cd97969c352c43f74e /Mac/Demo | |
parent | d9db3a67138deec981184c173c290025e9760f1d (diff) | |
download | cpython-b340acf9fd893140efd65a56134a814a8d9bac73.zip cpython-b340acf9fd893140efd65a56134a814a8d9bac73.tar.gz cpython-b340acf9fd893140efd65a56134a814a8d9bac73.tar.bz2 |
Use new file dialogs.
Diffstat (limited to 'Mac/Demo')
-rw-r--r-- | Mac/Demo/imgbrowse/imgbrowse.py | 8 | ||||
-rw-r--r-- | Mac/Demo/mlte/mlted.py | 12 | ||||
-rw-r--r-- | Mac/Demo/quicktime/MovieInWindow.py | 7 | ||||
-rw-r--r-- | Mac/Demo/quicktime/VerySimplePlayer.py | 7 | ||||
-rw-r--r-- | Mac/Demo/textedit/ped.py | 11 | ||||
-rw-r--r-- | Mac/Demo/waste/htmled.py | 25 | ||||
-rw-r--r-- | Mac/Demo/waste/swed.py | 14 | ||||
-rw-r--r-- | Mac/Demo/waste/wed.py | 13 |
8 files changed, 44 insertions, 53 deletions
diff --git a/Mac/Demo/imgbrowse/imgbrowse.py b/Mac/Demo/imgbrowse/imgbrowse.py index b54f82b..d8164ea 100644 --- a/Mac/Demo/imgbrowse/imgbrowse.py +++ b/Mac/Demo/imgbrowse/imgbrowse.py @@ -1,4 +1,4 @@ -GetPortBounds()"""imgbrowse - Display pictures using img""" +"""imgbrowse - Display pictures using img""" import FrameWork import EasyDialogs @@ -11,7 +11,6 @@ import sys import struct import img import imgformat -import macfs import struct import mac_image @@ -47,11 +46,10 @@ class imgbrowse(FrameWork.Application): 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: diff --git a/Mac/Demo/mlte/mlted.py b/Mac/Demo/mlte/mlted.py index 3f77eee..53f9f5d 100644 --- a/Mac/Demo/mlte/mlted.py +++ b/Mac/Demo/mlte/mlted.py @@ -11,7 +11,6 @@ from Carbon import Qd from Carbon import Res from Carbon import Scrap import os -import macfs from Carbon import MacTextEditor from Carbon import Mlte @@ -92,9 +91,9 @@ class MlteWindow(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() @@ -268,10 +267,9 @@ class Mlted(Application): 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 diff --git a/Mac/Demo/quicktime/MovieInWindow.py b/Mac/Demo/quicktime/MovieInWindow.py index 620c16c..0df30a4 100644 --- a/Mac/Demo/quicktime/MovieInWindow.py +++ b/Mac/Demo/quicktime/MovieInWindow.py @@ -11,7 +11,8 @@ from Carbon import Evt from Carbon import Events from Carbon import Win from Carbon import Windows -import macfs +from Carbon import File +import EasyDialogs import sys @@ -21,8 +22,8 @@ def main(): 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 diff --git a/Mac/Demo/quicktime/VerySimplePlayer.py b/Mac/Demo/quicktime/VerySimplePlayer.py index aca977f..de64e3f 100644 --- a/Mac/Demo/quicktime/VerySimplePlayer.py +++ b/Mac/Demo/quicktime/VerySimplePlayer.py @@ -11,7 +11,8 @@ from Carbon import Evt 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) @@ -23,8 +24,8 @@ def main(): 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 diff --git a/Mac/Demo/textedit/ped.py b/Mac/Demo/textedit/ped.py index 6666158..80cf7e5 100644 --- a/Mac/Demo/textedit/ped.py +++ b/Mac/Demo/textedit/ped.py @@ -131,9 +131,9 @@ class TEWindow(ScrolledWindow): 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() @@ -265,10 +265,9 @@ class Ped(Application): 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 diff --git a/Mac/Demo/waste/htmled.py b/Mac/Demo/waste/htmled.py index 3abbafa..d415de1 100644 --- a/Mac/Demo/waste/htmled.py +++ b/Mac/Demo/waste/htmled.py @@ -13,8 +13,8 @@ import waste import WASTEconst from Carbon import Scrap import os +import EasyDialogs import macfs -import MACFS import string import htmllib @@ -243,7 +243,7 @@ class WasteWindow(ScrolledWindow): 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('') @@ -256,9 +256,9 @@ class WasteWindow(ScrolledWindow): 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() @@ -661,10 +661,9 @@ class Wed(Application): 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 @@ -683,10 +682,9 @@ class Wed(Application): 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: @@ -698,10 +696,9 @@ class Wed(Application): 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: diff --git a/Mac/Demo/waste/swed.py b/Mac/Demo/waste/swed.py index 083a04c..c85cb21 100644 --- a/Mac/Demo/waste/swed.py +++ b/Mac/Demo/waste/swed.py @@ -14,7 +14,6 @@ import WASTEconst from Carbon import Scrap import os import macfs -import MACFS UNDOLABELS = [ # Indexed by WEGetUndoInfo() value None, "", "typing", "Cut", "Paste", "Clear", "Drag", "Style"] @@ -213,7 +212,7 @@ class WasteWindow(ScrolledWindow): 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('') @@ -226,9 +225,9 @@ class WasteWindow(ScrolledWindow): 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() @@ -521,10 +520,9 @@ class Wed(Application): 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 diff --git a/Mac/Demo/waste/wed.py b/Mac/Demo/waste/wed.py index 199201b..7161ae5 100644 --- a/Mac/Demo/waste/wed.py +++ b/Mac/Demo/waste/wed.py @@ -12,7 +12,7 @@ import waste import WASTEconst from Carbon import Scrap import os -import macfs +import EasyDialogs UNDOLABELS = [ # Indexed by WEGetUndoInfo() value None, "", "typing", "Cut", "Paste", "Clear", "Drag", "Style"] @@ -181,9 +181,9 @@ class WasteWindow(ScrolledWindow): 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() @@ -329,10 +329,9 @@ class Wed(Application): 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 |