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
thread
=
threading
.
Thread
winsize
=
(
800
,
500
)
layerindex
=
0
if
os
.
name
==
"nt"
:
winsize
=
(
800
,
530
)
try
:
...
...
@@ -916,18 +917,6 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
def
cbutton_edit
(
self
,
e
,
button
=
None
):
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
:
n
=
button
.
custombutton
bedit
.
name
.
SetValue
(
button
.
properties
[
0
])
...
...
@@ -946,8 +935,15 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
n
=
len
(
self
.
custombuttons
)
while
n
>
0
and
self
.
custombuttons
[
n
-
1
]
is
None
:
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
):
n
=
button
.
custombutton
...
...
@@ -1441,7 +1437,6 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
if
self
.
p
.
online
:
wx
.
CallAfter
(
self
.
printbtn
.
Enable
)
threading
.
Thread
(
target
=
self
.
loadviz
)
.
start
()
dlg
.
Destroy
()
def
loadviz
(
self
):
Xtot
,
Ytot
,
Ztot
,
Xmin
,
Xmax
,
Ymin
,
Ymax
,
Zmin
,
Zmax
=
pronsole
.
measurements
(
self
.
f
)
...
...
@@ -1635,6 +1630,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
class
macroed
(
wx
.
Dialog
):
"""Really simple editor to edit macro definitions"""
def
__init__
(
self
,
macro_name
,
definition
,
callback
,
gcode
=
False
):
self
.
indent_chars
=
" "
title
=
" macro
%
s"
...
...
@@ -1645,19 +1641,22 @@ class macroed(wx.Dialog):
self
.
callback
=
callback
self
.
panel
=
wx
.
Panel
(
self
,
-
1
)
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))
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
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
save
)
self
.
Bind
(
wx
.
EVT_CLOSE
,
self
.
close
)
titlesizer
.
Add
(
self
.
findb
)
titlesizer
.
Add
(
self
.
okb
)
self
.
cancelb
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Cancel"
))
self
.
cancelb
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
close
)
titlesizer
.
Add
(
self
.
cancelb
)
topsizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
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
:
self
.
e
.
SetValue
(
self
.
unindent
(
definition
))
else
:
...
...
@@ -1669,6 +1668,37 @@ class macroed(wx.Dialog):
self
.
Show
()
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
):
self
.
Destroy
()
if
not
self
.
gcode
:
...
...
@@ -1760,8 +1790,6 @@ class ButtonEdit(wx.Dialog):
topsizer
.
Add
(
(
0
,
0
),
1
)
topsizer
.
Add
(
self
.
CreateStdDialogButtonSizer
(
wx
.
OK
|
wx
.
CANCEL
),
0
,
wx
.
ALIGN_CENTER
)
self
.
SetSizer
(
topsizer
)
self
.
handler
=
None
def
macrob_enabler
(
self
,
e
):
macro
=
self
.
command
.
GetValue
()
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