# -*- coding: iso-8859-7 -*-
from p_ggen import inpDoubleR,medDoubleR
from openfile import openFile1,closeFiles1,setPar
#==========================================================================
depek=50.0; apmin=18.0; apmax=20.0; vMel=50.0
def test():
setPar(openfileParTest)
openFile1(0, ' ', ' ', 0, ' ')
openFile1(1, 'tri', 'old', 1, '/ ')
openFile1(1, 'nb1', 'old', 1, ' BREAKLINES idbrk')
openFile1(1, 'brw', ' ', 2, ' BREAKLINES')
openFile1(1, 'ptn', 'old',-1, ' ')
openFile1(1, 'con', ' ', -1, ' ')
frw = openFile1(888, ' ', ' ', 0, ' ')
ftri = frw["tri"]
fnb1 = frw["nb1"]
fbrw = frw["brw"]
fbrw.write('brw')
closeFiles1()
def openfileParTest(icod1, un):
"Read parameters from keyboard."
global depek, apmin, apmax, vMel
if icod1 == 0:
print
apmin = inpDoubleR('Min . (m) (enter=18): ',
1.0e-6, 1.0e6, 18.0)
apmax = inpDoubleR(' Max . (m) (enter=20): ',
1.0e-6, 1.0e6, 20.0)
vMel = inpDoubleR(' (km/hr) (enter=30): ',
1.0e-6, 1.0e6, 30.0)
depek = inpDoubleR(' . (m) (enter=50): ',
1.0e-6, 1.0e6, 50.0)
arxika= True
#--Read parameters from unit un (file="mediate.tmp")
elif icod1 == 1:
depek = medDoubleR(un, ' . (m)=',
1.0e-6, 1.0e6, 50.0)
apmin = medDoubleR(un, ' Min . (m) =',
1.0e-6, 1.0e6, 18.0)
apmax = medDoubleR(un, ' Max . (m) =',
1.0e-6, 1.0e6, 20.0)
vMel = medDoubleR(un, ' (km/hr) =',
1.0e-6, 1.0e6, 30.0)
#---Write parameters to unit un (file="mediate.tmp")
elif icod1 == 2:
un.write("%15.3f\n"*4 % (depek, apmin, apmax, vMel))
#---Write any direction to the user of the program
# icod1 = -1 : Greek
# icod1 = -2 : English
elif icod1 < 0:
if icod1 == -1: print grp('\n . .\n')
else: print grp('\nThis program was made by T. Stamos.\n')
#---Error messages
else:
assert False, 'Sr openFilePar: Fildat library error: unknown code!'
test()
|