[Python-checkins] python/dist/src/Mac/Demo/waste wed.py,1.9,1.10 htmled.py,1.12,1.13 swed.py,1.13,1.14

jackjansen@users.sourceforge.net jackjansen@users.sourceforge.net
Sun, 26 Jan 2003 13:36:29 -0800


Update of /cvsroot/python/python/dist/src/Mac/Demo/waste
In directory sc8-pr-cvs1:/tmp/cvs-serv24069

Modified Files:
	wed.py htmled.py swed.py 
Log Message:
Use new file dialogs.

Index: wed.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Demo/waste/wed.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** wed.py	30 Nov 2002 00:01:22 -0000	1.9
--- wed.py	26 Jan 2003 21:36:26 -0000	1.10
***************
*** 13,17 ****
  from Carbon import Scrap
  import os
! import macfs
  
  UNDOLABELS = [ # Indexed by WEGetUndoInfo() value
--- 13,17 ----
  from Carbon import Scrap
  import os
! import EasyDialogs
  
  UNDOLABELS = [ # Indexed by WEGetUndoInfo() value
***************
*** 182,188 ****
  		
  	def menu_save_as(self):
! 		fss, ok = macfs.StandardPutFile('Save as:')
! 		if not ok: return
! 		self.path = fss.as_pathname()
  		self.name = os.path.split(self.path)[-1]
  		self.wid.SetWTitle(self.name)
--- 182,188 ----
  		
  	def menu_save_as(self):
! 		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)
***************
*** 330,337 ****
  	def _open(self, askfile):
  		if askfile:
! 			fss, ok = macfs.StandardGetFile('TEXT')
! 			if not ok:
  				return
- 			path = fss.as_pathname()
  			name = os.path.split(path)[-1]
  			try:
--- 330,336 ----
  	def _open(self, askfile):
  		if askfile:
! 			path = EasyDialogs.AskFileForOpen(typeList=('TEXT',))
! 			if not path:
  				return
  			name = os.path.split(path)[-1]
  			try:

Index: htmled.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Demo/waste/htmled.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** htmled.py	30 Nov 2002 00:01:21 -0000	1.12
--- htmled.py	26 Jan 2003 21:36:26 -0000	1.13
***************
*** 14,19 ****
  from Carbon import Scrap
  import os
  import macfs
- import MACFS
  import string
  import htmllib
--- 14,19 ----
  from Carbon import Scrap
  import os
+ import EasyDialogs
  import macfs
  import string
  import htmllib
***************
*** 244,248 ****
  			rf = Res.FSpOpenResFile(self.path, 3)
  		except Res.Error:
! 			Res.FSpCreateResFile(self.path, '????', 'TEXT', MACFS.smAllScripts)
  			rf = Res.FSpOpenResFile(self.path, 3)
  		styles = Res.Resource('')
--- 244,248 ----
  			rf = Res.FSpOpenResFile(self.path, 3)
  		except Res.Error:
! 			Res.FSpCreateResFile(self.path, '????', 'TEXT', macfs.smAllScripts)
  			rf = Res.FSpOpenResFile(self.path, 3)
  		styles = Res.Resource('')
***************
*** 257,263 ****
  		
  	def menu_save_as(self):
! 		fss, ok = macfs.StandardPutFile('Save as:')
! 		if not ok: return
! 		self.path = fss.as_pathname()
  		self.name = os.path.split(self.path)[-1]
  		self.wid.SetWTitle(self.name)
--- 257,263 ----
  		
  	def menu_save_as(self):
! 		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)
***************
*** 662,669 ****
  	def _open(self, askfile):
  		if askfile:
! 			fss, ok = macfs.StandardGetFile('TEXT')
! 			if not ok:
  				return
- 			path = fss.as_pathname()
  			name = os.path.split(path)[-1]
  			try:
--- 662,668 ----
  	def _open(self, askfile):
  		if askfile:
! 			path = EasyDialogs.AskFileForOpen(typeList=('TEXT',))
! 			if not path:
  				return
  			name = os.path.split(path)[-1]
  			try:
***************
*** 684,691 ****
  	def insertfile(self, *args):
  		if self.active:
! 			fss, ok = macfs.StandardGetFile('TEXT')
! 			if not ok:
  				return
- 			path = fss.as_pathname()
  			try:
  				fp = open(path, 'rb') # NOTE binary, we need cr as end-of-line
--- 683,689 ----
  	def insertfile(self, *args):
  		if self.active:
! 			path = EasyDialogs.AskFileForOpen(typeList=('TEXT',))
! 			if not path:
  				return
  			try:
  				fp = open(path, 'rb') # NOTE binary, we need cr as end-of-line
***************
*** 699,706 ****
  	def inserthtml(self, *args):
  		if self.active:
! 			fss, ok = macfs.StandardGetFile('TEXT')
! 			if not ok:
  				return
- 			path = fss.as_pathname()
  			try:
  				fp = open(path, 'r')
--- 697,703 ----
  	def inserthtml(self, *args):
  		if self.active:
! 			path = EasyDialogs.AskFileForOpen(typeList=('TEXT',))
! 			if not path:
  				return
  			try:
  				fp = open(path, 'r')

Index: swed.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Demo/waste/swed.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** swed.py	30 Nov 2002 00:01:22 -0000	1.13
--- swed.py	26 Jan 2003 21:36:26 -0000	1.14
***************
*** 15,19 ****
  import os
  import macfs
- import MACFS
  
  UNDOLABELS = [ # Indexed by WEGetUndoInfo() value
--- 15,18 ----
***************
*** 214,218 ****
  			rf = Res.FSpOpenResFile(self.path, 3)
  		except Res.Error:
! 			Res.FSpCreateResFile(self.path, '????', 'TEXT', MACFS.smAllScripts)
  			rf = Res.FSpOpenResFile(self.path, 3)
  		styles = Res.Resource('')
--- 213,217 ----
  			rf = Res.FSpOpenResFile(self.path, 3)
  		except Res.Error:
! 			Res.FSpCreateResFile(self.path, '????', 'TEXT', macfs.smAllScripts)
  			rf = Res.FSpOpenResFile(self.path, 3)
  		styles = Res.Resource('')
***************
*** 227,233 ****
  		
  	def menu_save_as(self):
! 		fss, ok = macfs.StandardPutFile('Save as:')
! 		if not ok: return
! 		self.path = fss.as_pathname()
  		self.name = os.path.split(self.path)[-1]
  		self.wid.SetWTitle(self.name)
--- 226,232 ----
  		
  	def menu_save_as(self):
! 		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)
***************
*** 522,529 ****
  	def _open(self, askfile):
  		if askfile:
! 			fss, ok = macfs.StandardGetFile('TEXT')
! 			if not ok:
  				return
- 			path = fss.as_pathname()
  			name = os.path.split(path)[-1]
  			try:
--- 521,527 ----
  	def _open(self, askfile):
  		if askfile:
! 			path = EasyDialogs.AskFileForOpen(typeList=('TEXT',))
! 			if not path:
  				return
  			name = os.path.split(path)[-1]
  			try: