home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 5
/
DATAFILE_PDCD5.iso
/
utilities
/
p
/
python
/
!Py_New
/
pyc
/
Py_New
(
.txt
)
Wrap
Python Compiled Bytecode
|
1997-02-17
|
4KB
|
118 lines
# Source Generated with Decompyle++
# File: in.pyc (Python 1.4)
import tbevent
import riscospath
import os
import regsub
import sprite
import sys
exit
import saveas
name = 'App'
date = 'Today'
def copyfile(inn, out):
os.system('copy ' + inn + ' ' + out + ' A~C~DF~L~N~P~Q~R~S~T~V')
def savesprite(inn, out):
print 'ss', inn, out
sa = sprite.Area(500)
sa.load(inn)
s = sprite.Sprite(sa, '!name')
s.rename('!' + name)
s = sprite.Sprite(sa, 'sm!name')
s.rename('sm!' + name)
sa.save(out)
def translate(inn, out, type):
print 'translate', inn, out, type
infile = open(inn, 'r')
outfile = open(out, 'w')
while 1:
r = infile.readline()
if r == '':
break
r = regsub.gsub('<NAME>', name, r)
r = regsub.gsub('<DATE>', date, r)
outfile.write(r)
infile.close()
outfile.close()
os.settype(out, type)
def dosave(dir):
print 'dosave', dir, name
os.mkdir(dir + '.!' + name, 0)
outpath = dir + '.!' + name + '.'
inpath = '<Py_New$Dir>.model.'
os.mkdir(outpath + 'py', 0)
os.mkdir(outpath + 'pyc', 0)
translate(inpath + '!Boot', outpath + '!Boot', 'Obey')
translate(inpath + '!Run', outpath + '!Run', 'Obey')
translate(inpath + '!RunImage', outpath + '!RunImage', 'Text')
translate(inpath + 'Messages', outpath + 'Messages', 'Text')
translate(inpath + 'py.NAME', outpath + 'py.' + name, 'Text')
translate(inpath + 'py.events', outpath + 'py.events', 'Text')
savesprite(inpath + '!Sprites', outpath + '!Sprites')
savesprite(inpath + '!Sprites22', outpath + '!Sprites22')
copyfile(inpath + 'res', outpath + 'res')
return 1
def save(box):
global date, name
date = os.getenv('sys$date')
try:
fname = box.getfilename()
(dir, leaf) = riscospath.split(fname)
name = leaf[1:]
good = dosave(dir)
except:
print 'failed'
print sys.exc_type
print sys.exc_value
print sys.exc_traceback
good = 0
try:
box.filesavecompleted(good, name)
except:
pass
class Orphans:
actions = { }
def __init__(self):
tbevent.tbclasses[0] = self
def E_SaveToFile(self):
save(self.box)
def E_ObjectAutoCreated(self):
s = tbevent.wblock.nullstring(16)
if s == 'SaveAs':
self.box = saveas.SaveAs(tbevent.idblock[4])
def E_Q_Quit(self):
exit()
tbevent.initialise('<Py_New$Dir>')
oi = Orphans()
while 1:
tbevent.poll()
continue
argv