Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F90337276
gpy
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Oct 31, 16:17
Size
1 KB
Mime Type
text/x-python
Expires
Sat, Nov 2, 16:17 (2 d)
Engine
blob
Format
Raw Data
Handle
22053973
Attached To
rPNBODY pNbody
gpy
View Options
#!/usr/bin/env python -i
import
os
,
thread
,
sys
,
string
,
time
,
glob
from
Tkinter
import
*
from
tkMessageBox
import
askokcancel
from
tkMessageBox
import
showerror
from
tkFileDialog
import
asksaveasfilename
from
tkFileDialog
import
askopenfilename
from
numpy
import
*
from
pNbody
import
*
from
pNbody
import
param
from
pNbody
import
io
from
pNbody
import
geometry
as
geo
try
:
from
optparse
import
OptionParser
except
ImportError
:
from
optik
import
OptionParser
########################################
#
# parser
#
########################################
def
parse_options
():
usage
=
"usage: %prog [options] file"
parser
=
OptionParser
(
usage
=
usage
)
parser
.
add_option
(
"-t"
,
action
=
"store"
,
dest
=
"ftype"
,
type
=
"string"
,
default
=
None
,
help
=
"type of the file"
,
metavar
=
" TYPE"
)
parser
.
add_option
(
"--exec"
,
action
=
"store"
,
dest
=
"execline"
,
type
=
"string"
,
default
=
None
,
help
=
"give command to execute before"
,
metavar
=
" STRING"
)
(
options
,
args
)
=
parser
.
parse_args
()
if
len
(
args
)
==
0
:
#print "you must specify a filename"
#sys.exit(0)
file
=
None
else
:
file
=
args
return
file
,
options
################################################################################
#
# MAIN
#
################################################################################
file
,
options
=
parse_options
()
execline
=
options
.
execline
nb
=
Nbody
(
file
,
ftype
=
options
.
ftype
)
if
execline
!=
None
:
exec
(
execline
)
Event Timeline
Log In to Comment