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
92cba52d
Commit
92cba52d
authored
Apr 22, 2012
by
Jeremy Hammett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update pronterface.py
parent
3a0ab157
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
22 deletions
+50
-22
pronterface.py
pronterface.py
+50
-22
No files found.
pronterface.py
View file @
92cba52d
...
@@ -38,6 +38,7 @@ StringIO=cStringIO
...
@@ -38,6 +38,7 @@ StringIO=cStringIO
thread
=
threading
.
Thread
thread
=
threading
.
Thread
winsize
=
(
800
,
500
)
winsize
=
(
800
,
500
)
layerindex
=
0
if
os
.
name
==
"nt"
:
if
os
.
name
==
"nt"
:
winsize
=
(
800
,
530
)
winsize
=
(
800
,
530
)
try
:
try
:
...
@@ -916,18 +917,6 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -916,18 +917,6 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
def
cbutton_edit
(
self
,
e
,
button
=
None
):
def
cbutton_edit
(
self
,
e
,
button
=
None
):
bedit
=
ButtonEdit
(
self
)
bedit
=
ButtonEdit
(
self
)
def
okhandler
(
event
):
if
event
.
GetId
()
==
wx
.
ID_OK
:
if
n
==
len
(
self
.
custombuttons
):
self
.
custombuttons
+=
[
None
]
self
.
custombuttons
[
n
]
=
[
bedit
.
name
.
GetValue
()
.
strip
(),
bedit
.
command
.
GetValue
()
.
strip
()]
if
bedit
.
color
.
GetValue
()
.
strip
()
!=
""
:
self
.
custombuttons
[
n
]
+=
[
bedit
.
color
.
GetValue
()]
self
.
cbutton_save
(
n
,
self
.
custombuttons
[
n
])
bedit
.
Destroy
()
self
.
cbuttons_reload
()
bedit
.
Bind
(
wx
.
EVT_BUTTON
,
okhandler
)
if
button
is
not
None
:
if
button
is
not
None
:
n
=
button
.
custombutton
n
=
button
.
custombutton
bedit
.
name
.
SetValue
(
button
.
properties
[
0
])
bedit
.
name
.
SetValue
(
button
.
properties
[
0
])
...
@@ -946,8 +935,15 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -946,8 +935,15 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
n
=
len
(
self
.
custombuttons
)
n
=
len
(
self
.
custombuttons
)
while
n
>
0
and
self
.
custombuttons
[
n
-
1
]
is
None
:
while
n
>
0
and
self
.
custombuttons
[
n
-
1
]
is
None
:
n
-=
1
n
-=
1
bedit
.
Show
()
if
bedit
.
ShowModal
()
==
wx
.
ID_OK
:
if
n
==
len
(
self
.
custombuttons
):
self
.
custombuttons
+=
[
None
]
self
.
custombuttons
[
n
]
=
[
bedit
.
name
.
GetValue
()
.
strip
(),
bedit
.
command
.
GetValue
()
.
strip
()]
if
bedit
.
color
.
GetValue
()
.
strip
()
!=
""
:
self
.
custombuttons
[
n
]
+=
[
bedit
.
color
.
GetValue
()]
self
.
cbutton_save
(
n
,
self
.
custombuttons
[
n
])
bedit
.
Destroy
()
self
.
cbuttons_reload
()
def
cbutton_remove
(
self
,
e
,
button
):
def
cbutton_remove
(
self
,
e
,
button
):
n
=
button
.
custombutton
n
=
button
.
custombutton
...
@@ -1441,7 +1437,6 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -1441,7 +1437,6 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
if
self
.
p
.
online
:
if
self
.
p
.
online
:
wx
.
CallAfter
(
self
.
printbtn
.
Enable
)
wx
.
CallAfter
(
self
.
printbtn
.
Enable
)
threading
.
Thread
(
target
=
self
.
loadviz
)
.
start
()
threading
.
Thread
(
target
=
self
.
loadviz
)
.
start
()
dlg
.
Destroy
()
def
loadviz
(
self
):
def
loadviz
(
self
):
Xtot
,
Ytot
,
Ztot
,
Xmin
,
Xmax
,
Ymin
,
Ymax
,
Zmin
,
Zmax
=
pronsole
.
measurements
(
self
.
f
)
Xtot
,
Ytot
,
Ztot
,
Xmin
,
Xmax
,
Ymin
,
Ymax
,
Zmin
,
Zmax
=
pronsole
.
measurements
(
self
.
f
)
...
@@ -1635,6 +1630,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -1635,6 +1630,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
class
macroed
(
wx
.
Dialog
):
class
macroed
(
wx
.
Dialog
):
"""Really simple editor to edit macro definitions"""
"""Really simple editor to edit macro definitions"""
def
__init__
(
self
,
macro_name
,
definition
,
callback
,
gcode
=
False
):
def
__init__
(
self
,
macro_name
,
definition
,
callback
,
gcode
=
False
):
self
.
indent_chars
=
" "
self
.
indent_chars
=
" "
title
=
" macro
%
s"
title
=
" macro
%
s"
...
@@ -1645,19 +1641,22 @@ class macroed(wx.Dialog):
...
@@ -1645,19 +1641,22 @@ class macroed(wx.Dialog):
self
.
callback
=
callback
self
.
callback
=
callback
self
.
panel
=
wx
.
Panel
(
self
,
-
1
)
self
.
panel
=
wx
.
Panel
(
self
,
-
1
)
titlesizer
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
titlesizer
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
title
=
wx
.
StaticText
(
self
.
panel
,
-
1
,
title
%
macro_name
)
title
text
=
wx
.
StaticText
(
self
.
panel
,
-
1
,
" _"
)
#
title%macro_name)
#title.SetFont(wx.Font(11,wx.NORMAL,wx.NORMAL,wx.BOLD))
#title.SetFont(wx.Font(11,wx.NORMAL,wx.NORMAL,wx.BOLD))
titlesizer
.
Add
(
title
,
1
)
titlesizer
.
Add
(
titletext
,
1
)
self
.
findb
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Find"
))
#New button for "Find" (Jezmy)
self
.
findb
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
find
)
self
.
okb
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Save"
))
self
.
okb
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Save"
))
self
.
okb
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
save
)
self
.
okb
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
save
)
self
.
Bind
(
wx
.
EVT_CLOSE
,
self
.
close
)
self
.
Bind
(
wx
.
EVT_CLOSE
,
self
.
close
)
titlesizer
.
Add
(
self
.
findb
)
titlesizer
.
Add
(
self
.
okb
)
titlesizer
.
Add
(
self
.
okb
)
self
.
cancelb
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Cancel"
))
self
.
cancelb
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Cancel"
))
self
.
cancelb
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
close
)
self
.
cancelb
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
close
)
titlesizer
.
Add
(
self
.
cancelb
)
titlesizer
.
Add
(
self
.
cancelb
)
topsizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
topsizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
topsizer
.
Add
(
titlesizer
,
0
,
wx
.
EXPAND
)
topsizer
.
Add
(
titlesizer
,
0
,
wx
.
EXPAND
)
self
.
e
=
wx
.
TextCtrl
(
self
.
panel
,
style
=
wx
.
TE_MULTILINE
+
wx
.
HSCROLL
,
size
=
(
200
,
2
00
))
self
.
e
=
wx
.
TextCtrl
(
self
.
panel
,
style
=
wx
.
TE_MULTILINE
+
wx
.
HSCROLL
,
size
=
(
400
,
4
00
))
if
not
self
.
gcode
:
if
not
self
.
gcode
:
self
.
e
.
SetValue
(
self
.
unindent
(
definition
))
self
.
e
.
SetValue
(
self
.
unindent
(
definition
))
else
:
else
:
...
@@ -1669,6 +1668,37 @@ class macroed(wx.Dialog):
...
@@ -1669,6 +1668,37 @@ class macroed(wx.Dialog):
self
.
Show
()
self
.
Show
()
self
.
e
.
SetFocus
()
self
.
e
.
SetFocus
()
def
find
(
self
,
ev
):
# Ask user what to look for, find it and point at it ... (Jezmy)
S
=
self
.
e
.
GetStringSelection
()
if
not
S
:
S
=
"Z"
FindValue
=
wx
.
GetTextFromUser
(
'Please enter a search string:'
,
caption
=
"Search"
,
default_value
=
S
,
parent
=
None
)
somecode
=
self
.
e
.
GetValue
()
numLines
=
len
(
somecode
)
position
=
somecode
.
find
(
FindValue
,
self
.
e
.
GetInsertionPoint
())
if
position
==
-
1
:
# ShowMessage(self,-1, "Not found!")
titletext
=
wx
.
TextCtrl
(
self
.
panel
,
-
1
,
"Not Found!"
)
else
:
# self.title.SetValue("Position : "+str(position))
titletext
=
wx
.
TextCtrl
(
self
.
panel
,
-
1
,
str
(
position
))
# ananswer = wx.MessageBox(str(numLines)+" Lines detected in file\n"+str(position), "OK")
self
.
e
.
SetFocus
()
self
.
e
.
SetInsertionPoint
(
position
)
self
.
e
.
SetSelection
(
position
,
position
+
len
(
FindValue
))
self
.
e
.
ShowPosition
(
position
)
def
ShowMessage
(
self
,
ev
,
message
):
dlg
=
wxMessageDialog
(
self
,
message
,
"Info!"
,
wxOK
|
wxICON_INFORMATION
)
dlg
.
ShowModal
()
dlg
.
Destroy
()
def
save
(
self
,
ev
):
def
save
(
self
,
ev
):
self
.
Destroy
()
self
.
Destroy
()
if
not
self
.
gcode
:
if
not
self
.
gcode
:
...
@@ -1760,8 +1790,6 @@ class ButtonEdit(wx.Dialog):
...
@@ -1760,8 +1790,6 @@ class ButtonEdit(wx.Dialog):
topsizer
.
Add
(
(
0
,
0
),
1
)
topsizer
.
Add
(
(
0
,
0
),
1
)
topsizer
.
Add
(
self
.
CreateStdDialogButtonSizer
(
wx
.
OK
|
wx
.
CANCEL
),
0
,
wx
.
ALIGN_CENTER
)
topsizer
.
Add
(
self
.
CreateStdDialogButtonSizer
(
wx
.
OK
|
wx
.
CANCEL
),
0
,
wx
.
ALIGN_CENTER
)
self
.
SetSizer
(
topsizer
)
self
.
SetSizer
(
topsizer
)
self
.
handler
=
None
def
macrob_enabler
(
self
,
e
):
def
macrob_enabler
(
self
,
e
):
macro
=
self
.
command
.
GetValue
()
macro
=
self
.
command
.
GetValue
()
valid
=
False
valid
=
False
...
...
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