Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
Printrun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
Printrun
Commits
1d5ce77a
Commit
1d5ce77a
authored
Jul 15, 2011
by
Keegi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some fixes to macro editor routines
parent
2834e563
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
7 deletions
+18
-7
pronsole.py
pronsole.py
+2
-2
pronterface.py
pronterface.py
+16
-5
No files found.
pronsole.py
View file @
1d5ce77a
...
...
@@ -182,8 +182,8 @@ class pronsole(cmd.Cmd):
print
"Empty macro - cancelled"
del
self
.
cur_macro
,
self
.
cur_macro_name
,
self
.
cur_macro_def
def
start_macro
(
self
,
macro_name
,
prev_definition
=
""
):
if
not
self
.
processing_rc
:
def
start_macro
(
self
,
macro_name
,
prev_definition
=
""
,
suppress_instructions
=
False
):
if
not
self
.
processing_rc
and
not
suppress_instructions
:
print
"Enter macro using indented lines, end with empty line"
self
.
cur_macro_name
=
macro_name
self
.
cur_macro_def
=
""
...
...
pronterface.py
View file @
1d5ce77a
...
...
@@ -180,15 +180,24 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
def
start_macro
(
self
,
macro_name
,
old_macro_definition
=
""
):
if
not
self
.
processing_rc
:
import
macroed
def
cb
(
definition
):
pronsole
.
pronsole
.
start_macro
(
self
,
macro_name
)
if
"
\n
"
not
in
definition
and
len
(
definition
.
strip
())
>
0
:
macro_def
=
definition
.
strip
()
self
.
cur_macro_def
=
macro_def
self
.
cur_macro_name
=
macro_name
if
macro_def
.
startswith
(
"!"
):
self
.
cur_macro
=
"def macro(self,*arg):
\n
"
+
macro_def
[
1
:]
+
"
\n
"
else
:
self
.
cur_macro
=
"def macro(self,*arg):
\n
self.onecmd('"
+
macro_def
+
"'.format(*arg))
\n
"
self
.
end_macro
()
return
pronsole
.
pronsole
.
start_macro
(
self
,
macro_name
,
True
)
for
line
in
definition
.
split
(
"
\n
"
):
if
hasattr
(
self
,
"cur_macro_def"
):
self
.
hook_macro
(
line
)
if
hasattr
(
self
,
"cur_macro_def"
):
self
.
end_macro
()
macroed
.
macroed
(
macro_name
,
old_macro_definition
,
cb
)
macroed
(
macro_name
,
old_macro_definition
,
cb
)
else
:
pronsole
.
pronsole
.
start_macro
(
self
,
macro_name
,
old_macro_definition
)
...
...
@@ -875,7 +884,8 @@ class macroed(wx.Frame):
import
re
self
.
indent_chars
=
text
[:
len
(
text
)
-
len
(
text
.
lstrip
())]
unindented
=
""
lines
=
re
.
split
(
r"(\r\n?|\n)"
,
text
)
lines
=
re
.
split
(
r"(?:\r\n?|\n)"
,
text
)
#print lines
if
len
(
lines
)
<=
1
:
return
text
for
line
in
lines
:
...
...
@@ -885,7 +895,8 @@ class macroed(wx.Frame):
unindented
+=
line
+
"
\n
"
return
unindented
def
reindent
(
self
,
text
):
lines
=
re
.
split
(
r"(\r\n?|\n)"
,
text
)
import
re
lines
=
re
.
split
(
r"(?:\r\n?|\n)"
,
text
)
if
len
(
lines
)
<=
1
:
return
text
reindented
=
""
...
...
Write
Preview
Markdown
is supported
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