Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Sebastian Steinlechner
pykat
Commits
c7194e77
Commit
c7194e77
authored
Feb 22, 2014
by
Andreas Freise
Browse files
change order of blocks when generating script. First come
all the read FTblocks, followed by the NO_BLOCK bits.
parent
2c40a2e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
pykat/finesse.py
View file @
c7194e77
...
...
@@ -805,22 +805,12 @@ class kat(object):
if
fragment
in
obj
:
print
" ** removing line '{0}'"
.
format
(
obj
)
objs
.
remove
(
obj
)
def
generateKatScript
(
self
)
:
""" Generates the kat file which can then be run """
out
=
[]
import
datetime
strtoday
=
datetime
.
datetime
.
now
()
out
.
append
(
strtoday
.
strftime
(
"%% Generated by PyKat %d.%m.%Y %H:%M:%S
\n
"
)
)
for
key
in
self
.
__blocks
:
objs
=
self
.
__blocks
[
key
].
contents
out
.
append
(
"
\n
"
)
if
key
!=
NO_BLOCK
and
np
.
size
(
objs
)
>
0
:
out
.
append
(
"%%% FTblock "
+
key
+
"
\n
"
)
def
writeBlock
():
for
obj
in
objs
:
if
isinstance
(
obj
,
str
):
out
.
append
(
obj
+
'
\n
'
)
...
...
@@ -835,9 +825,33 @@ class kat(object):
else
:
out
.
append
(
txt
+
"
\n
"
)
if
key
!=
NO_BLOCK
and
np
.
size
(
objs
)
>
0
:
out
.
append
(
"%%% FTend "
+
key
+
"
\n
"
)
out
=
[]
import
datetime
strtoday
=
datetime
.
datetime
.
now
()
out
.
append
(
strtoday
.
strftime
(
"%% Generated by PyKat %d.%m.%Y %H:%M:%S
\n
"
)
)
# write the FTblocks
for
key
in
self
.
__blocks
:
objs
=
self
.
__blocks
[
key
].
contents
if
key
!=
NO_BLOCK
:
if
np
.
size
(
objs
)
>
0
:
out
.
append
(
"
\n
"
)
out
.
append
(
"%%% FTblock "
+
key
+
"
\n
"
)
writeBlock
()
out
.
append
(
"%%% FTend "
+
key
+
"
\n
"
)
# write the NO_BLOCK blocks
for
key
in
self
.
__blocks
:
objs
=
self
.
__blocks
[
key
].
contents
if
key
==
NO_BLOCK
:
if
np
.
size
(
objs
)
>
0
:
out
.
append
(
"
\n
"
)
writeBlock
()
# now loop through all the nodes and get any gauss commands
for
key
in
self
.
nodes
.
getNodes
():
txt
=
self
.
nodes
.
getNodes
()[
key
].
getFinesseText
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment