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
7333e93c
Commit
7333e93c
authored
Sep 10, 2012
by
kliment
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #286 from iXce/split-gui
GUI creation split
parents
ab7c2782
9c55677e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
348 additions
and
477 deletions
+348
-477
graph.py
printrun/graph.py
+0
-12
gui.py
printrun/gui.py
+287
-0
pronterface_widgets.py
printrun/pronterface_widgets.py
+21
-108
pronterface.py
pronterface.py
+40
-357
No files found.
printrun/graph.py
View file @
7333e93c
...
@@ -51,13 +51,10 @@ class Graph(BufferedCanvas):
...
@@ -51,13 +51,10 @@ class Graph(BufferedCanvas):
self
.
_lastyvalue
=
0
self
.
_lastyvalue
=
0
#self.sizer = wx.BoxSizer(wx.HORIZONTAL)
#self.sizer = wx.BoxSizer(wx.HORIZONTAL)
#self.sizer.Add(wx.Button(self, -1, "Button1", (0, 0)))
#self.sizer.Add(wx.Button(self, -1, "Button1", (0, 0)))
#self.SetSizer(self.sizer)
#self.SetSizer(self.sizer)
def
OnPaint
(
self
,
evt
):
def
OnPaint
(
self
,
evt
):
dc
=
wx
.
PaintDC
(
self
)
dc
=
wx
.
PaintDC
(
self
)
gc
=
wx
.
GraphicsContext
.
Create
(
dc
)
gc
=
wx
.
GraphicsContext
.
Create
(
dc
)
...
@@ -66,7 +63,6 @@ class Graph(BufferedCanvas):
...
@@ -66,7 +63,6 @@ class Graph(BufferedCanvas):
#call the super method
#call the super method
super
(
wx
.
Panel
,
self
)
.
Destroy
()
super
(
wx
.
Panel
,
self
)
.
Destroy
()
def
updateTemperatures
(
self
,
event
):
def
updateTemperatures
(
self
,
event
):
self
.
AddBedTemperature
(
self
.
bedtemps
[
-
1
])
self
.
AddBedTemperature
(
self
.
bedtemps
[
-
1
])
self
.
AddBedTargetTemperature
(
self
.
bedtargettemps
[
-
1
])
self
.
AddBedTargetTemperature
(
self
.
bedtargettemps
[
-
1
])
...
@@ -76,7 +72,6 @@ class Graph(BufferedCanvas):
...
@@ -76,7 +72,6 @@ class Graph(BufferedCanvas):
#self.AddExtruder1TargetTemperature(self.extruder1targettemps[-1])
#self.AddExtruder1TargetTemperature(self.extruder1targettemps[-1])
self
.
Refresh
()
self
.
Refresh
()
def
drawgrid
(
self
,
dc
,
gc
):
def
drawgrid
(
self
,
dc
,
gc
):
#cold, medium, hot = wx.Colour(0, 167, 223), wx.Colour(239, 233, 119), wx.Colour(210, 50.100)
#cold, medium, hot = wx.Colour(0, 167, 223), wx.Colour(239, 233, 119), wx.Colour(210, 50.100)
#col1 = wx.Colour(255, 0, 0, 255)
#col1 = wx.Colour(255, 0, 0, 255)
...
@@ -105,7 +100,6 @@ class Graph(BufferedCanvas):
...
@@ -105,7 +100,6 @@ class Graph(BufferedCanvas):
#gc.DrawPath(path)
#gc.DrawPath(path)
#gc.StrokePath(path)
#gc.StrokePath(path)
font
=
wx
.
Font
(
10
,
wx
.
DEFAULT
,
wx
.
NORMAL
,
wx
.
BOLD
)
font
=
wx
.
Font
(
10
,
wx
.
DEFAULT
,
wx
.
NORMAL
,
wx
.
BOLD
)
gc
.
SetFont
(
font
,
wx
.
Colour
(
23
,
44
,
44
))
gc
.
SetFont
(
font
,
wx
.
Colour
(
23
,
44
,
44
))
...
@@ -192,7 +186,6 @@ class Graph(BufferedCanvas):
...
@@ -192,7 +186,6 @@ class Graph(BufferedCanvas):
if
(
len
(
self
.
bedtemps
)
-
1
)
*
float
(
self
.
width
)
/
self
.
xsteps
>
self
.
width
:
if
(
len
(
self
.
bedtemps
)
-
1
)
*
float
(
self
.
width
)
/
self
.
xsteps
>
self
.
width
:
self
.
bedtemps
.
pop
(
0
)
self
.
bedtemps
.
pop
(
0
)
def
SetBedTargetTemperature
(
self
,
value
):
def
SetBedTargetTemperature
(
self
,
value
):
self
.
bedtargettemps
.
pop
()
self
.
bedtargettemps
.
pop
()
self
.
bedtargettemps
.
append
(
value
)
self
.
bedtargettemps
.
append
(
value
)
...
@@ -202,7 +195,6 @@ class Graph(BufferedCanvas):
...
@@ -202,7 +195,6 @@ class Graph(BufferedCanvas):
if
(
len
(
self
.
bedtargettemps
)
-
1
)
*
float
(
self
.
width
)
/
self
.
xsteps
>
self
.
width
:
if
(
len
(
self
.
bedtargettemps
)
-
1
)
*
float
(
self
.
width
)
/
self
.
xsteps
>
self
.
width
:
self
.
bedtargettemps
.
pop
(
0
)
self
.
bedtargettemps
.
pop
(
0
)
def
SetExtruder0Temperature
(
self
,
value
):
def
SetExtruder0Temperature
(
self
,
value
):
self
.
extruder0temps
.
pop
()
self
.
extruder0temps
.
pop
()
self
.
extruder0temps
.
append
(
value
)
self
.
extruder0temps
.
append
(
value
)
...
@@ -212,7 +204,6 @@ class Graph(BufferedCanvas):
...
@@ -212,7 +204,6 @@ class Graph(BufferedCanvas):
if
(
len
(
self
.
extruder0temps
)
-
1
)
*
float
(
self
.
width
)
/
self
.
xsteps
>
self
.
width
:
if
(
len
(
self
.
extruder0temps
)
-
1
)
*
float
(
self
.
width
)
/
self
.
xsteps
>
self
.
width
:
self
.
extruder0temps
.
pop
(
0
)
self
.
extruder0temps
.
pop
(
0
)
def
SetExtruder0TargetTemperature
(
self
,
value
):
def
SetExtruder0TargetTemperature
(
self
,
value
):
self
.
extruder0targettemps
.
pop
()
self
.
extruder0targettemps
.
pop
()
self
.
extruder0targettemps
.
append
(
value
)
self
.
extruder0targettemps
.
append
(
value
)
...
@@ -222,7 +213,6 @@ class Graph(BufferedCanvas):
...
@@ -222,7 +213,6 @@ class Graph(BufferedCanvas):
if
(
len
(
self
.
extruder0targettemps
)
-
1
)
*
float
(
self
.
width
)
/
self
.
xsteps
>
self
.
width
:
if
(
len
(
self
.
extruder0targettemps
)
-
1
)
*
float
(
self
.
width
)
/
self
.
xsteps
>
self
.
width
:
self
.
extruder0targettemps
.
pop
(
0
)
self
.
extruder0targettemps
.
pop
(
0
)
def
SetExtruder1Temperature
(
self
,
value
):
def
SetExtruder1Temperature
(
self
,
value
):
self
.
extruder1temps
.
pop
()
self
.
extruder1temps
.
pop
()
self
.
extruder1temps
.
append
(
value
)
self
.
extruder1temps
.
append
(
value
)
...
@@ -232,7 +222,6 @@ class Graph(BufferedCanvas):
...
@@ -232,7 +222,6 @@ class Graph(BufferedCanvas):
if
(
len
(
self
.
extruder1temps
)
-
1
)
*
float
(
self
.
width
)
/
self
.
xsteps
>
self
.
width
:
if
(
len
(
self
.
extruder1temps
)
-
1
)
*
float
(
self
.
width
)
/
self
.
xsteps
>
self
.
width
:
self
.
extruder1temps
.
pop
(
0
)
self
.
extruder1temps
.
pop
(
0
)
def
SetExtruder1TargetTemperature
(
self
,
value
):
def
SetExtruder1TargetTemperature
(
self
,
value
):
self
.
extruder1targettemps
.
pop
()
self
.
extruder1targettemps
.
pop
()
self
.
extruder1targettemps
.
append
(
value
)
self
.
extruder1targettemps
.
append
(
value
)
...
@@ -242,7 +231,6 @@ class Graph(BufferedCanvas):
...
@@ -242,7 +231,6 @@ class Graph(BufferedCanvas):
if
(
len
(
self
.
extruder1targettemps
)
-
1
)
*
float
(
self
.
width
)
/
self
.
xsteps
>
self
.
width
:
if
(
len
(
self
.
extruder1targettemps
)
-
1
)
*
float
(
self
.
width
)
/
self
.
xsteps
>
self
.
width
:
self
.
extruder1targettemps
.
pop
(
0
)
self
.
extruder1targettemps
.
pop
(
0
)
def
StartPlotting
(
self
,
time
):
def
StartPlotting
(
self
,
time
):
self
.
Refresh
()
self
.
Refresh
()
self
.
timer
.
Start
(
time
)
self
.
timer
.
Start
(
time
)
...
...
printrun/gui.py
0 → 100644
View file @
7333e93c
# This file is part of the Printrun suite.
#
# Printrun is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Printrun is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Printrun. If not, see <http://www.gnu.org/licenses/>.
try
:
import
wx
except
:
print
_
(
"WX is not installed. This program requires WX to run."
)
raise
global
buttonSize
buttonSize
=
(
70
,
25
)
# Define sizes for the buttons on top rows
from
printrun
import
gviz
from
printrun.xybuttons
import
XYButtons
from
printrun.zbuttons
import
ZButtons
from
printrun.graph
import
Graph
def
make_button
(
parent
,
label
,
callback
,
tooltip
,
container
=
None
,
size
=
wx
.
DefaultSize
,
style
=
0
):
button
=
wx
.
Button
(
parent
,
-
1
,
label
,
style
=
style
,
size
=
size
)
button
.
Bind
(
wx
.
EVT_BUTTON
,
callback
)
button
.
SetToolTip
(
wx
.
ToolTip
(
tooltip
))
if
container
:
container
.
Add
(
button
)
return
button
def
make_sized_button
(
*
args
):
return
make_button
(
*
args
,
size
=
buttonSize
)
def
make_autosize_button
(
*
args
):
return
make_button
(
*
args
,
size
=
(
-
1
,
buttonSize
[
1
]),
style
=
wx
.
BU_EXACTFIT
)
class
XYZControlsSizer
(
wx
.
GridBagSizer
):
def
__init__
(
self
,
root
):
super
(
XYZControlsSizer
,
self
)
.
__init__
()
root
.
xyb
=
XYButtons
(
root
.
panel
,
root
.
moveXY
,
root
.
homeButtonClicked
,
root
.
spacebarAction
,
root
.
settings
.
bgcolor
)
self
.
Add
(
root
.
xyb
,
pos
=
(
0
,
1
),
flag
=
wx
.
ALIGN_CENTER
)
root
.
zb
=
ZButtons
(
root
.
panel
,
root
.
moveZ
,
root
.
settings
.
bgcolor
)
self
.
Add
(
root
.
zb
,
pos
=
(
0
,
2
),
flag
=
wx
.
ALIGN_CENTER
)
wx
.
CallAfter
(
root
.
xyb
.
SetFocus
)
class
LeftPane
(
wx
.
GridBagSizer
):
def
__init__
(
self
,
root
):
super
(
LeftPane
,
self
)
.
__init__
()
llts
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
self
.
Add
(
llts
,
pos
=
(
0
,
0
),
span
=
(
1
,
9
))
self
.
xyzsizer
=
XYZControlsSizer
(
root
)
self
.
Add
(
self
.
xyzsizer
,
pos
=
(
1
,
0
),
span
=
(
1
,
8
),
flag
=
wx
.
ALIGN_CENTER
)
for
i
in
root
.
cpbuttons
:
btn
=
make_button
(
root
.
panel
,
i
.
label
,
root
.
procbutton
,
i
.
tooltip
,
style
=
wx
.
BU_EXACTFIT
)
btn
.
SetBackgroundColour
(
i
.
background
)
btn
.
SetForegroundColour
(
"black"
)
btn
.
properties
=
i
root
.
btndict
[
i
.
command
]
=
btn
root
.
printerControls
.
append
(
btn
)
if
i
.
pos
==
None
:
if
i
.
span
==
0
:
llts
.
Add
(
btn
)
else
:
self
.
Add
(
btn
,
pos
=
i
.
pos
,
span
=
i
.
span
)
root
.
xyfeedc
=
wx
.
SpinCtrl
(
root
.
panel
,
-
1
,
str
(
root
.
settings
.
xy_feedrate
),
min
=
0
,
max
=
50000
,
size
=
(
70
,
-
1
))
root
.
xyfeedc
.
SetToolTip
(
wx
.
ToolTip
(
"Set Maximum Speed for X & Y axes (mm/min)"
))
llts
.
Add
(
wx
.
StaticText
(
root
.
panel
,
-
1
,
_
(
"XY:"
)),
flag
=
wx
.
ALIGN_RIGHT
|
wx
.
ALIGN_CENTER_VERTICAL
)
llts
.
Add
(
root
.
xyfeedc
)
llts
.
Add
(
wx
.
StaticText
(
root
.
panel
,
-
1
,
_
(
"mm/min Z:"
)),
flag
=
wx
.
ALIGN_RIGHT
|
wx
.
ALIGN_CENTER_VERTICAL
)
root
.
zfeedc
=
wx
.
SpinCtrl
(
root
.
panel
,
-
1
,
str
(
root
.
settings
.
z_feedrate
),
min
=
0
,
max
=
50000
,
size
=
(
70
,
-
1
))
root
.
zfeedc
.
SetToolTip
(
wx
.
ToolTip
(
"Set Maximum Speed for Z axis (mm/min)"
))
llts
.
Add
(
root
.
zfeedc
,)
root
.
monitorbox
=
wx
.
CheckBox
(
root
.
panel
,
-
1
,
_
(
"Watch"
))
root
.
monitorbox
.
SetToolTip
(
wx
.
ToolTip
(
"Monitor Temperatures in Graph"
))
self
.
Add
(
root
.
monitorbox
,
pos
=
(
2
,
6
))
root
.
monitorbox
.
Bind
(
wx
.
EVT_CHECKBOX
,
root
.
setmonitor
)
self
.
Add
(
wx
.
StaticText
(
root
.
panel
,
-
1
,
_
(
"Heat:"
)),
pos
=
(
2
,
0
),
span
=
(
1
,
1
),
flag
=
wx
.
ALIGN_CENTER_VERTICAL
|
wx
.
ALIGN_RIGHT
)
htemp_choices
=
[
root
.
temps
[
i
]
+
" ("
+
i
+
")"
for
i
in
sorted
(
root
.
temps
.
keys
(),
key
=
lambda
x
:
root
.
temps
[
x
])]
root
.
settoff
=
make_button
(
root
.
panel
,
_
(
"Off"
),
lambda
e
:
root
.
do_settemp
(
"off"
),
_
(
"Switch Hotend Off"
),
size
=
(
36
,
-
1
),
style
=
wx
.
BU_EXACTFIT
)
root
.
printerControls
.
append
(
root
.
settoff
)
self
.
Add
(
root
.
settoff
,
pos
=
(
2
,
1
),
span
=
(
1
,
1
))
if
root
.
settings
.
last_temperature
not
in
map
(
float
,
root
.
temps
.
values
()):
htemp_choices
=
[
str
(
root
.
settings
.
last_temperature
)]
+
htemp_choices
root
.
htemp
=
wx
.
ComboBox
(
root
.
panel
,
-
1
,
choices
=
htemp_choices
,
style
=
wx
.
CB_DROPDOWN
,
size
=
(
70
,
-
1
))
root
.
htemp
.
SetToolTip
(
wx
.
ToolTip
(
"Select Temperature for Hotend"
))
root
.
htemp
.
Bind
(
wx
.
EVT_COMBOBOX
,
root
.
htemp_change
)
self
.
Add
(
root
.
htemp
,
pos
=
(
2
,
2
),
span
=
(
1
,
2
))
root
.
settbtn
=
make_button
(
root
.
panel
,
_
(
"Set"
),
root
.
do_settemp
,
_
(
"Switch Hotend On"
),
size
=
(
38
,
-
1
),
style
=
wx
.
BU_EXACTFIT
)
root
.
printerControls
.
append
(
root
.
settbtn
)
self
.
Add
(
root
.
settbtn
,
pos
=
(
2
,
4
),
span
=
(
1
,
1
))
self
.
Add
(
wx
.
StaticText
(
root
.
panel
,
-
1
,
_
(
"Bed:"
)),
pos
=
(
3
,
0
),
span
=
(
1
,
1
),
flag
=
wx
.
ALIGN_CENTER_VERTICAL
|
wx
.
ALIGN_RIGHT
)
btemp_choices
=
[
root
.
bedtemps
[
i
]
+
" ("
+
i
+
")"
for
i
in
sorted
(
root
.
bedtemps
.
keys
(),
key
=
lambda
x
:
root
.
temps
[
x
])]
root
.
setboff
=
make_button
(
root
.
panel
,
_
(
"Off"
),
lambda
e
:
root
.
do_bedtemp
(
"off"
),
_
(
"Switch Heated Bed Off"
),
size
=
(
36
,
-
1
),
style
=
wx
.
BU_EXACTFIT
)
root
.
printerControls
.
append
(
root
.
setboff
)
self
.
Add
(
root
.
setboff
,
pos
=
(
3
,
1
),
span
=
(
1
,
1
))
if
root
.
settings
.
last_bed_temperature
not
in
map
(
float
,
root
.
bedtemps
.
values
()):
btemp_choices
=
[
str
(
root
.
settings
.
last_bed_temperature
)]
+
btemp_choices
root
.
btemp
=
wx
.
ComboBox
(
root
.
panel
,
-
1
,
choices
=
btemp_choices
,
style
=
wx
.
CB_DROPDOWN
,
size
=
(
70
,
-
1
))
root
.
btemp
.
SetToolTip
(
wx
.
ToolTip
(
"Select Temperature for Heated Bed"
))
root
.
btemp
.
Bind
(
wx
.
EVT_COMBOBOX
,
root
.
btemp_change
)
self
.
Add
(
root
.
btemp
,
pos
=
(
3
,
2
),
span
=
(
1
,
2
))
root
.
setbbtn
=
make_button
(
root
.
panel
,
_
(
"Set"
),
root
.
do_bedtemp
,
(
"Switch Heated Bed On"
),
size
=
(
38
,
-
1
),
style
=
wx
.
BU_EXACTFIT
)
root
.
printerControls
.
append
(
root
.
setbbtn
)
self
.
Add
(
root
.
setbbtn
,
pos
=
(
3
,
4
),
span
=
(
1
,
1
))
root
.
btemp
.
SetValue
(
str
(
root
.
settings
.
last_bed_temperature
))
root
.
htemp
.
SetValue
(
str
(
root
.
settings
.
last_temperature
))
## added for an error where only the bed would get (pla) or (abs).
#This ensures, if last temp is a default pla or abs, it will be marked so.
# if it is not, then a (user) remark is added. This denotes a manual entry
for
i
in
btemp_choices
:
if
i
.
split
()[
0
]
==
str
(
root
.
settings
.
last_bed_temperature
)
.
split
(
'.'
)[
0
]
or
i
.
split
()[
0
]
==
str
(
root
.
settings
.
last_bed_temperature
):
root
.
btemp
.
SetValue
(
i
)
for
i
in
htemp_choices
:
if
i
.
split
()[
0
]
==
str
(
root
.
settings
.
last_temperature
)
.
split
(
'.'
)[
0
]
or
i
.
split
()[
0
]
==
str
(
root
.
settings
.
last_temperature
)
:
root
.
htemp
.
SetValue
(
i
)
if
(
'('
not
in
root
.
btemp
.
Value
):
root
.
btemp
.
SetValue
(
root
.
btemp
.
Value
+
' (user)'
)
if
(
'('
not
in
root
.
htemp
.
Value
):
root
.
htemp
.
SetValue
(
root
.
htemp
.
Value
+
' (user)'
)
root
.
tempdisp
=
wx
.
StaticText
(
root
.
panel
,
-
1
,
""
)
root
.
edist
=
wx
.
SpinCtrl
(
root
.
panel
,
-
1
,
"5"
,
min
=
0
,
max
=
1000
,
size
=
(
60
,
-
1
))
root
.
edist
.
SetBackgroundColour
((
225
,
200
,
200
))
root
.
edist
.
SetForegroundColour
(
"black"
)
self
.
Add
(
root
.
edist
,
pos
=
(
4
,
2
),
span
=
(
1
,
2
))
self
.
Add
(
wx
.
StaticText
(
root
.
panel
,
-
1
,
_
(
"mm"
)),
pos
=
(
4
,
4
),
span
=
(
1
,
1
))
root
.
edist
.
SetToolTip
(
wx
.
ToolTip
(
"Amount to Extrude or Retract (mm)"
))
root
.
efeedc
=
wx
.
SpinCtrl
(
root
.
panel
,
-
1
,
str
(
root
.
settings
.
e_feedrate
),
min
=
0
,
max
=
50000
,
size
=
(
60
,
-
1
))
root
.
efeedc
.
SetToolTip
(
wx
.
ToolTip
(
"Extrude / Retract speed (mm/min)"
))
root
.
efeedc
.
SetBackgroundColour
((
225
,
200
,
200
))
root
.
efeedc
.
SetForegroundColour
(
"black"
)
root
.
efeedc
.
Bind
(
wx
.
EVT_SPINCTRL
,
root
.
setfeeds
)
self
.
Add
(
root
.
efeedc
,
pos
=
(
5
,
2
),
span
=
(
1
,
2
))
self
.
Add
(
wx
.
StaticText
(
root
.
panel
,
-
1
,
_
(
"mm/
\n
min"
)),
pos
=
(
5
,
4
),
span
=
(
1
,
1
))
root
.
xyfeedc
.
Bind
(
wx
.
EVT_SPINCTRL
,
root
.
setfeeds
)
root
.
zfeedc
.
Bind
(
wx
.
EVT_SPINCTRL
,
root
.
setfeeds
)
root
.
zfeedc
.
SetBackgroundColour
((
180
,
255
,
180
))
root
.
zfeedc
.
SetForegroundColour
(
"black"
)
root
.
graph
=
Graph
(
root
.
panel
,
wx
.
ID_ANY
)
self
.
Add
(
root
.
graph
,
pos
=
(
3
,
5
),
span
=
(
3
,
3
))
self
.
Add
(
root
.
tempdisp
,
pos
=
(
6
,
0
),
span
=
(
1
,
9
))
class
VizPane
(
wx
.
BoxSizer
):
def
__init__
(
self
,
root
):
super
(
VizPane
,
self
)
.
__init__
(
wx
.
VERTICAL
)
root
.
gviz
=
gviz
.
gviz
(
root
.
panel
,
(
300
,
300
),
build_dimensions
=
root
.
build_dimensions_list
,
grid
=
(
root
.
settings
.
preview_grid_step1
,
root
.
settings
.
preview_grid_step2
),
extrusion_width
=
root
.
settings
.
preview_extrusion_width
)
root
.
gviz
.
SetToolTip
(
wx
.
ToolTip
(
"Click to examine / edit
\n
layers of loaded file"
))
root
.
gviz
.
showall
=
1
try
:
raise
""
import
printrun.stlview
root
.
gwindow
=
printrun
.
stlview
.
GCFrame
(
None
,
wx
.
ID_ANY
,
'Gcode view, shift to move view, mousewheel to set layer'
,
size
=
(
600
,
600
))
except
:
root
.
gwindow
=
gviz
.
window
([],
build_dimensions
=
root
.
build_dimensions_list
,
grid
=
(
root
.
settings
.
preview_grid_step1
,
root
.
settings
.
preview_grid_step2
),
extrusion_width
=
root
.
settings
.
preview_extrusion_width
)
root
.
gviz
.
Bind
(
wx
.
EVT_LEFT_DOWN
,
root
.
showwin
)
root
.
gwindow
.
Bind
(
wx
.
EVT_CLOSE
,
lambda
x
:
root
.
gwindow
.
Hide
())
self
.
Add
(
root
.
gviz
,
1
,
flag
=
wx
.
SHAPED
)
cs
=
root
.
centersizer
=
wx
.
GridBagSizer
()
self
.
Add
(
cs
,
0
,
flag
=
wx
.
EXPAND
)
class
LogPane
(
wx
.
BoxSizer
):
def
__init__
(
self
,
root
):
super
(
LogPane
,
self
)
.
__init__
(
wx
.
VERTICAL
)
root
.
lowerrsizer
=
self
root
.
logbox
=
wx
.
TextCtrl
(
root
.
panel
,
style
=
wx
.
TE_MULTILINE
,
size
=
(
350
,
-
1
))
root
.
logbox
.
SetEditable
(
0
)
self
.
Add
(
root
.
logbox
,
1
,
wx
.
EXPAND
)
lbrs
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
root
.
commandbox
=
wx
.
TextCtrl
(
root
.
panel
,
style
=
wx
.
TE_PROCESS_ENTER
)
root
.
commandbox
.
SetToolTip
(
wx
.
ToolTip
(
"Send commands to printer
\n
(Type 'help' for simple
\n
help function)"
))
root
.
commandbox
.
Bind
(
wx
.
EVT_TEXT_ENTER
,
root
.
sendline
)
root
.
commandbox
.
Bind
(
wx
.
EVT_CHAR
,
root
.
cbkey
)
root
.
commandbox
.
history
=
[
u""
]
root
.
commandbox
.
histindex
=
1
#root.printerControls.append(root.commandbox)
lbrs
.
Add
(
root
.
commandbox
,
1
)
root
.
sendbtn
=
make_button
(
root
.
panel
,
_
(
"Send"
),
root
.
sendline
,
_
(
"Send Command to Printer"
),
style
=
wx
.
BU_EXACTFIT
,
container
=
lbrs
)
#root.printerControls.append(root.sendbtn)
self
.
Add
(
lbrs
,
0
,
wx
.
EXPAND
)
class
MainToolbar
(
wx
.
BoxSizer
):
def
__init__
(
self
,
root
):
super
(
MainToolbar
,
self
)
.
__init__
(
wx
.
HORIZONTAL
)
root
.
rescanbtn
=
make_sized_button
(
root
.
panel
,
_
(
"Port"
),
root
.
rescanports
,
_
(
"Communication Settings
\n
Click to rescan ports"
))
self
.
Add
(
root
.
rescanbtn
,
0
,
wx
.
TOP
|
wx
.
LEFT
,
0
)
root
.
serialport
=
wx
.
ComboBox
(
root
.
panel
,
-
1
,
choices
=
root
.
scanserial
(),
style
=
wx
.
CB_DROPDOWN
,
size
=
(
100
,
25
))
root
.
serialport
.
SetToolTip
(
wx
.
ToolTip
(
"Select Port Printer is connected to"
))
root
.
rescanports
()
self
.
Add
(
root
.
serialport
)
self
.
Add
(
wx
.
StaticText
(
root
.
panel
,
-
1
,
"@"
),
0
,
wx
.
RIGHT
|
wx
.
ALIGN_CENTER
,
0
)
root
.
baud
=
wx
.
ComboBox
(
root
.
panel
,
-
1
,
choices
=
[
"2400"
,
"9600"
,
"19200"
,
"38400"
,
"57600"
,
"115200"
,
"250000"
],
style
=
wx
.
CB_DROPDOWN
,
size
=
(
100
,
25
))
root
.
baud
.
SetToolTip
(
wx
.
ToolTip
(
"Select Baud rate for printer communication"
))
try
:
root
.
baud
.
SetValue
(
"115200"
)
root
.
baud
.
SetValue
(
str
(
root
.
settings
.
baudrate
))
except
:
pass
self
.
Add
(
root
.
baud
)
root
.
connectbtn
=
make_sized_button
(
root
.
panel
,
_
(
"Connect"
),
root
.
connect
,
_
(
"Connect to the printer"
),
self
)
root
.
resetbtn
=
make_autosize_button
(
root
.
panel
,
_
(
"Reset"
),
root
.
reset
,
_
(
"Reset the printer"
),
self
)
root
.
loadbtn
=
make_autosize_button
(
root
.
panel
,
_
(
"Load file"
),
root
.
loadfile
,
_
(
"Load a 3D model file"
),
self
)
root
.
platebtn
=
make_autosize_button
(
root
.
panel
,
_
(
"Compose"
),
root
.
plate
,
_
(
"Simple Plater System"
),
self
)
root
.
sdbtn
=
make_autosize_button
(
root
.
panel
,
_
(
"SD"
),
root
.
sdmenu
,
_
(
"SD Card Printing"
),
self
)
root
.
printerControls
.
append
(
root
.
sdbtn
)
root
.
printbtn
=
make_sized_button
(
root
.
panel
,
_
(
"Print"
),
root
.
printfile
,
_
(
"Start Printing Loaded File"
),
self
)
root
.
printbtn
.
Disable
()
root
.
pausebtn
=
make_sized_button
(
root
.
panel
,
_
(
"Pause"
),
root
.
pause
,
_
(
"Pause Current Print"
),
self
)
root
.
recoverbtn
=
make_sized_button
(
root
.
panel
,
_
(
"Recover"
),
root
.
recover
,
_
(
"Recover previous Print"
),
self
)
class
MainWindow
(
wx
.
Frame
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
MainWindow
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
# this list will contain all controls that should be only enabled
# when we're connected to a printer
self
.
printerControls
=
[]
def
createGui
(
self
):
self
.
mainsizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
self
.
uppersizer
=
MainToolbar
(
self
)
self
.
lowersizer
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
self
.
lowersizer
.
Add
(
LeftPane
(
self
))
self
.
lowersizer
.
Add
(
VizPane
(
self
),
1
,
wx
.
EXPAND
|
wx
.
ALIGN_CENTER_HORIZONTAL
)
self
.
lowersizer
.
Add
(
LogPane
(
self
),
0
,
wx
.
EXPAND
)
self
.
mainsizer
.
Add
(
self
.
uppersizer
)
self
.
mainsizer
.
Add
(
self
.
lowersizer
,
1
,
wx
.
EXPAND
)
self
.
panel
.
SetSizer
(
self
.
mainsizer
)
self
.
status
=
self
.
CreateStatusBar
()
self
.
status
.
SetStatusText
(
_
(
"Not connected to printer."
))
self
.
panel
.
Bind
(
wx
.
EVT_MOUSE_EVENTS
,
self
.
editbutton
)
self
.
Bind
(
wx
.
EVT_CLOSE
,
self
.
kill
)
self
.
mainsizer
.
Layout
()
self
.
mainsizer
.
Fit
(
self
)
# disable all printer controls until we connect to a printer
self
.
pausebtn
.
Disable
()
self
.
recoverbtn
.
Disable
()
for
i
in
self
.
printerControls
:
i
.
Disable
()
#self.panel.Fit()
self
.
cbuttons_reload
()
printrun/pronterface_widgets.py
View file @
7333e93c
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
import
wx
import
wx
import
re
import
re
class
macroed
(
wx
.
Dialog
):
class
MacroEditor
(
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
):
...
@@ -91,10 +91,10 @@ class macroed(wx.Dialog):
...
@@ -91,10 +91,10 @@ class macroed(wx.Dialog):
self
.
callback
(
self
.
reindent
(
self
.
e
.
GetValue
()))
self
.
callback
(
self
.
reindent
(
self
.
e
.
GetValue
()))
else
:
else
:
self
.
callback
(
self
.
e
.
GetValue
()
.
split
(
"
\n
"
))
self
.
callback
(
self
.
e
.
GetValue
()
.
split
(
"
\n
"
))
def
close
(
self
,
ev
):
def
close
(
self
,
ev
):
self
.
Destroy
()
self
.
Destroy
()
if
self
.
webInterface
:
webinterface
.
KillWebInterfaceThread
()
def
unindent
(
self
,
text
):
def
unindent
(
self
,
text
):
self
.
indent_chars
=
text
[:
len
(
text
)
-
len
(
text
.
lstrip
())]
self
.
indent_chars
=
text
[:
len
(
text
)
-
len
(
text
.
lstrip
())]
if
len
(
self
.
indent_chars
)
==
0
:
if
len
(
self
.
indent_chars
)
==
0
:
...
@@ -211,108 +211,21 @@ class ButtonEdit(wx.Dialog):
...
@@ -211,108 +211,21 @@ class ButtonEdit(wx.Dialog):
if
self
.
name
.
GetValue
()
==
""
:
if
self
.
name
.
GetValue
()
==
""
:
self
.
name
.
SetValue
(
macro
)
self
.
name
.
SetValue
(
macro
)
class
TempGauge
(
wx
.
Panel
):
class
SpecialButton
(
object
):
def
__init__
(
self
,
parent
,
size
=
(
200
,
22
),
title
=
""
,
maxval
=
240
,
gaugeColour
=
None
):
label
=
None
wx
.
Panel
.
__init__
(
self
,
parent
,
-
1
,
size
=
size
)
command
=
None
self
.
Bind
(
wx
.
EVT_PAINT
,
self
.
paint
)
background
=
None
self
.
SetBackgroundStyle
(
wx
.
BG_STYLE_CUSTOM
)
pos
=
None
self
.
width
,
self
.
height
=
size
span
=
None
self
.
title
=
title
tooltip
=
None
self
.
max
=
maxval
custom
=
None
self
.
gaugeColour
=
gaugeColour
self
.
value
=
0
def
__init__
(
self
,
label
,
command
,
background
=
None
,
pos
=
None
,
span
=
None
,
tooltip
=
None
,
custom
=
False
):
self
.
setpoint
=
0
self
.
label
=
label
self
.
recalc
()
self
.
command
=
command
self
.
pos
=
pos
def
recalc
(
self
):
self
.
background
=
background
mmax
=
max
(
int
(
self
.
setpoint
*
1.05
),
self
.
max
)
self
.
span
=
span
self
.
scale
=
float
(
self
.
width
-
2
)
/
float
(
mmax
)
self
.
tooltip
=
tooltip
self
.
ypt
=
max
(
16
,
int
(
self
.
scale
*
max
(
self
.
setpoint
,
self
.
max
/
6
)))
self
.
custom
=
custom
def
SetValue
(
self
,
value
):
self
.
value
=
value
wx
.
CallAfter
(
self
.
Refresh
)
def
SetTarget
(
self
,
value
):
self
.
setpoint
=
value
self
.
recalc
()
wx
.
CallAfter
(
self
.
Refresh
)
def
interpolatedColour
(
self
,
val
,
vmin
,
vmid
,
vmax
,
cmin
,
cmid
,
cmax
):
if
val
<
vmin
:
return
cmin
if
val
>
vmax
:
return
cmax
if
val
<=
vmid
:
lo
,
hi
,
val
,
valhi
=
cmin
,
cmid
,
val
-
vmin
,
vmid
-
vmin
else
:
lo
,
hi
,
val
,
valhi
=
cmid
,
cmax
,
val
-
vmid
,
vmax
-
vmid
vv
=
float
(
val
)
/
valhi
rgb
=
lo
.
Red
()
+
(
hi
.
Red
()
-
lo
.
Red
())
*
vv
,
lo
.
Green
()
+
(
hi
.
Green
()
-
lo
.
Green
())
*
vv
,
lo
.
Blue
()
+
(
hi
.
Blue
()
-
lo
.
Blue
())
*
vv
rgb
=
map
(
lambda
x
:
x
*
0.8
,
rgb
)
return
wx
.
Colour
(
*
map
(
int
,
rgb
))
def
paint
(
self
,
ev
):
x0
,
y0
,
x1
,
y1
,
xE
,
yE
=
1
,
1
,
self
.
ypt
+
1
,
1
,
self
.
width
+
1
-
2
,
20
dc
=
wx
.
PaintDC
(
self
)
dc
.
SetBackground
(
wx
.
Brush
((
255
,
255
,
255
)))
dc
.
Clear
()
cold
,
medium
,
hot
=
wx
.
Colour
(
0
,
167
,
223
),
wx
.
Colour
(
239
,
233
,
119
),
wx
.
Colour
(
210
,
50.100
)
gauge1
,
gauge2
=
wx
.
Colour
(
255
,
255
,
210
),
(
self
.
gaugeColour
or
wx
.
Colour
(
234
,
82
,
0
))
shadow1
,
shadow2
=
wx
.
Colour
(
110
,
110
,
110
),
wx
.
Colour
(
255
,
255
,
255
)
gc
=
wx
.
GraphicsContext
.
Create
(
dc
)
# draw shadow first
# corners
gc
.
SetBrush
(
gc
.
CreateRadialGradientBrush
(
xE
-
7
,
9
,
xE
-
7
,
9
,
8
,
shadow1
,
shadow2
))
gc
.
DrawRectangle
(
xE
-
7
,
1
,
8
,
8
)
gc
.
SetBrush
(
gc
.
CreateRadialGradientBrush
(
xE
-
7
,
17
,
xE
-
7
,
17
,
8
,
shadow1
,
shadow2
))
gc
.
DrawRectangle
(
xE
-
7
,
17
,
8
,
8
)
gc
.
SetBrush
(
gc
.
CreateRadialGradientBrush
(
x0
+
6
,
17
,
x0
+
6
,
17
,
8
,
shadow1
,
shadow2
))
gc
.
DrawRectangle
(
0
,
17
,
x0
+
6
,
8
)
# edges
gc
.
SetBrush
(
gc
.
CreateLinearGradientBrush
(
xE
-
13
,
0
,
xE
-
6
,
0
,
shadow1
,
shadow2
))
gc
.
DrawRectangle
(
xE
-
6
,
9
,
10
,
8
)
gc
.
SetBrush
(
gc
.
CreateLinearGradientBrush
(
x0
,
yE
-
2
,
x0
,
yE
+
5
,
shadow1
,
shadow2
))
gc
.
DrawRectangle
(
x0
+
6
,
yE
-
2
,
xE
-
12
,
7
)
# draw gauge background
gc
.
SetBrush
(
gc
.
CreateLinearGradientBrush
(
x0
,
y0
,
x1
+
1
,
y1
,
cold
,
medium
))
gc
.
DrawRoundedRectangle
(
x0
,
y0
,
x1
+
4
,
yE
,
6
)
gc
.
SetBrush
(
gc
.
CreateLinearGradientBrush
(
x1
-
2
,
y1
,
xE
,
y1
,
medium
,
hot
))
gc
.
DrawRoundedRectangle
(
x1
-
2
,
y1
,
xE
-
x1
,
yE
,
6
)
# draw gauge
width
=
12
w1
=
y0
+
9
-
width
/
2
w2
=
w1
+
width
value
=
x0
+
max
(
10
,
min
(
self
.
width
+
1
-
2
,
int
(
self
.
value
*
self
.
scale
)))
#gc.SetBrush(gc.CreateLinearGradientBrush(x0, y0+3, x0, y0+15, gauge1, gauge2))
#gc.SetBrush(gc.CreateLinearGradientBrush(0, 3, 0, 15, wx.Colour(255, 255, 255), wx.Colour(255, 90, 32)))
gc
.
SetBrush
(
gc
.
CreateLinearGradientBrush
(
x0
,
y0
+
3
,
x0
,
y0
+
15
,
gauge1
,
self
.
interpolatedColour
(
value
,
x0
,
x1
,
xE
,
cold
,
medium
,
hot
)))
val_path
=
gc
.
CreatePath
()
val_path
.
MoveToPoint
(
x0
,
w1
)
val_path
.
AddLineToPoint
(
value
,
w1
)
val_path
.
AddLineToPoint
(
value
+
2
,
w1
+
width
/
4
)
val_path
.
AddLineToPoint
(
value
+
2
,
w2
-
width
/
4
)
val_path
.
AddLineToPoint
(
value
,
w2
)
#val_path.AddLineToPoint(value-4, 10)
val_path
.
AddLineToPoint
(
x0
,
w2
)
gc
.
DrawPath
(
val_path
)
# draw setpoint markers
setpoint
=
x0
+
max
(
10
,
int
(
self
.
setpoint
*
self
.
scale
))
gc
.
SetBrush
(
gc
.
CreateBrush
(
wx
.
Brush
(
wx
.
Colour
(
0
,
0
,
0
))))
setp_path
=
gc
.
CreatePath
()
setp_path
.
MoveToPoint
(
setpoint
-
4
,
y0
)
setp_path
.
AddLineToPoint
(
setpoint
+
4
,
y0
)
setp_path
.
AddLineToPoint
(
setpoint
,
y0
+
5
)
setp_path
.
MoveToPoint
(
setpoint
-
4
,
yE
)
setp_path
.
AddLineToPoint
(
setpoint
+
4
,
yE
)
setp_path
.
AddLineToPoint
(
setpoint
,
yE
-
5
)
gc
.
DrawPath
(
setp_path
)
# draw readout
text
=
u"T
\u00B0
%
u/
%
u"
%
(
self
.
value
,
self
.
setpoint
)
#gc.SetFont(gc.CreateFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD), wx.WHITE))
#gc.DrawText(text, 29,-2)
gc
.
SetFont
(
gc
.
CreateFont
(
wx
.
Font
(
10
,
wx
.
FONTFAMILY_DEFAULT
,
wx
.
FONTSTYLE_NORMAL
,
wx
.
FONTWEIGHT_BOLD
),
wx
.
WHITE
))
gc
.
DrawText
(
self
.
title
,
x0
+
19
,
y0
+
4
)
gc
.
DrawText
(
text
,
x0
+
119
,
y0
+
4
)
gc
.
SetFont
(
gc
.
CreateFont
(
wx
.
Font
(
10
,
wx
.
FONTFAMILY_DEFAULT
,
wx
.
FONTSTYLE_NORMAL
,
wx
.
FONTWEIGHT_BOLD
)))
gc
.
DrawText
(
self
.
title
,
x0
+
18
,
y0
+
3
)
gc
.
DrawText
(
text
,
x0
+
118
,
y0
+
3
)
pronterface.py
View file @
7333e93c
...
@@ -33,8 +33,6 @@ StringIO = cStringIO
...
@@ -33,8 +33,6 @@ StringIO = cStringIO
winsize
=
(
800
,
500
)
winsize
=
(
800
,
500
)
layerindex
=
0
layerindex
=
0
global
buttonSize
buttonSize
=
(
70
,
25
)
# Define sizes for the buttons on top rows
if
os
.
name
==
"nt"
:
if
os
.
name
==
"nt"
:
winsize
=
(
800
,
530
)
winsize
=
(
800
,
530
)
try
:
try
:
...
@@ -43,11 +41,8 @@ if os.name == "nt":
...
@@ -43,11 +41,8 @@ if os.name == "nt":
pass
pass
import
printcore
import
printcore
from
printrun
import
gviz
from
printrun.xybuttons
import
XYButtons
from
printrun.zbuttons
import
ZButtons
from
printrun.graph
import
Graph
from
printrun.printrun_utils
import
pixmapfile
,
configfile
from
printrun.printrun_utils
import
pixmapfile
,
configfile
from
printrun.gui
import
MainWindow
import
pronsole
import
pronsole
def
dosify
(
name
):
def
dosify
(
name
):
...
@@ -82,7 +77,7 @@ class Tee(object):
...
@@ -82,7 +77,7 @@ class Tee(object):
self
.
stdout
.
flush
()
self
.
stdout
.
flush
()
class
PronterWindow
(
wx
.
Frame
,
pronsole
.
pronsole
):
class
PronterWindow
(
MainWindow
,
pronsole
.
pronsole
):
def
__init__
(
self
,
filename
=
None
,
size
=
winsize
):
def
__init__
(
self
,
filename
=
None
,
size
=
winsize
):
pronsole
.
pronsole
.
__init__
(
self
)
pronsole
.
pronsole
.
__init__
(
self
)
self
.
settings
.
build_dimensions
=
'200x200x100+0+0+0'
#default build dimensions are 200x200x100 with 0, 0, 0 in the corner of the bed
self
.
settings
.
build_dimensions
=
'200x200x100+0+0+0'
#default build dimensions are 200x200x100 with 0, 0, 0 in the corner of the bed
...
@@ -103,7 +98,7 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
...
@@ -103,7 +98,7 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
self
.
helpdict
[
"bgcolor"
]
=
_
(
"Pronterface background color (default: #FFFFFF)"
)
self
.
helpdict
[
"bgcolor"
]
=
_
(
"Pronterface background color (default: #FFFFFF)"
)
self
.
filename
=
filename
self
.
filename
=
filename
os
.
putenv
(
"UBUNTU_MENUPROXY"
,
"0"
)
os
.
putenv
(
"UBUNTU_MENUPROXY"
,
"0"
)
wx
.
Frame
.
__init__
(
self
,
None
,
title
=
_
(
"Printer Interface"
),
size
=
size
);
MainWindow
.
__init__
(
self
,
None
,
title
=
_
(
"Printer Interface"
),
size
=
size
);
self
.
SetIcon
(
wx
.
Icon
(
pixmapfile
(
"P-face.ico"
),
wx
.
BITMAP_TYPE_ICO
))
self
.
SetIcon
(
wx
.
Icon
(
pixmapfile
(
"P-face.ico"
),
wx
.
BITMAP_TYPE_ICO
))
self
.
panel
=
wx
.
Panel
(
self
,
-
1
,
size
=
size
)
self
.
panel
=
wx
.
Panel
(
self
,
-
1
,
size
=
size
)
...
@@ -118,14 +113,11 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
...
@@ -118,14 +113,11 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
self
.
monitor_interval
=
3
self
.
monitor_interval
=
3
self
.
paused
=
False
self
.
paused
=
False
self
.
sentlines
=
Queue
.
Queue
(
30
)
self
.
sentlines
=
Queue
.
Queue
(
30
)
xcol
=
(
245
,
245
,
108
)
ycol
=
(
180
,
180
,
255
)
zcol
=
(
180
,
255
,
180
)
self
.
cpbuttons
=
[
self
.
cpbuttons
=
[
[
_
(
"Motors off"
),
(
"M84"
),
None
,
(
250
,
250
,
250
),
0
,
_
(
"Switch all motors off"
)]
,
SpecialButton
(
_
(
"Motors off"
),
(
"M84"
),
(
250
,
250
,
250
),
None
,
0
,
_
(
"Switch all motors off"
))
,
[
_
(
"Check temp"
),
(
"M105"
),
(
2
,
5
),
(
225
,
200
,
200
),
(
1
,
1
),
_
(
"Check current hotend temperature"
)]
,
SpecialButton
(
_
(
"Check temp"
),
(
"M105"
),
(
225
,
200
,
200
),
(
2
,
5
),
(
1
,
1
),
_
(
"Check current hotend temperature"
))
,
[
_
(
"Extrude"
),
(
"extrude"
),
(
4
,
0
),
(
225
,
200
,
200
),
(
1
,
2
),
_
(
"Advance extruder by set length"
)]
,
SpecialButton
(
_
(
"Extrude"
),
(
"extrude"
),
(
225
,
200
,
200
),
(
4
,
0
),
(
1
,
2
),
_
(
"Advance extruder by set length"
))
,
[
_
(
"Reverse"
),
(
"reverse"
),
(
5
,
0
),
(
225
,
200
,
200
),
(
1
,
2
),
_
(
"Reverse extruder by set length"
)]
,
SpecialButton
(
_
(
"Reverse"
),
(
"reverse"
),
(
225
,
200
,
200
),
(
5
,
0
),
(
1
,
2
),
_
(
"Reverse extruder by set length"
))
,
]
]
self
.
custombuttons
=
[]
self
.
custombuttons
=
[]
self
.
btndict
=
{}
self
.
btndict
=
{}
...
@@ -154,7 +146,7 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
...
@@ -154,7 +146,7 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
except
:
except
:
pass
pass
self
.
popmenu
()
self
.
popmenu
()
self
.
popwindow
()
self
.
createGui
()
self
.
t
=
Tee
(
self
.
catchprint
)
self
.
t
=
Tee
(
self
.
catchprint
)
self
.
stdout
=
sys
.
stdout
self
.
stdout
=
sys
.
stdout
self
.
skeining
=
0
self
.
skeining
=
0
...
@@ -245,7 +237,6 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
...
@@ -245,7 +237,6 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
if
"S"
in
line
:
if
"S"
in
line
:
try
:
try
:
temp
=
float
(
line
.
split
(
"S"
)[
1
]
.
split
(
"*"
)[
0
])
temp
=
float
(
line
.
split
(
"S"
)[
1
]
.
split
(
"*"
)[
0
])
#self.hottgauge.SetTarget(temp)
wx
.
CallAfter
(
self
.
graph
.
SetExtruder0TargetTemperature
,
temp
)
wx
.
CallAfter
(
self
.
graph
.
SetExtruder0TargetTemperature
,
temp
)
except
:
except
:
pass
pass
...
@@ -257,7 +248,6 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
...
@@ -257,7 +248,6 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
if
"S"
in
line
:
if
"S"
in
line
:
try
:
try
:
temp
=
float
(
line
.
split
(
"S"
)[
1
]
.
split
(
"*"
)[
0
])
temp
=
float
(
line
.
split
(
"S"
)[
1
]
.
split
(
"*"
)[
0
])
#self.bedtgauge.SetTarget(temp)
wx
.
CallAfter
(
self
.
graph
.
SetBedTargetTemperature
,
temp
)
wx
.
CallAfter
(
self
.
graph
.
SetBedTargetTemperature
,
temp
)
except
:
except
:
pass
pass
...
@@ -284,7 +274,6 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
...
@@ -284,7 +274,6 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
def
setbedgui
(
self
,
f
):
def
setbedgui
(
self
,
f
):
self
.
bsetpoint
=
f
self
.
bsetpoint
=
f
#self.bedtgauge.SetTarget(int(f))
wx
.
CallAfter
(
self
.
graph
.
SetBedTargetTemperature
,
int
(
f
))
wx
.
CallAfter
(
self
.
graph
.
SetBedTargetTemperature
,
int
(
f
))
if
f
>
0
:
if
f
>
0
:
wx
.
CallAfter
(
self
.
btemp
.
SetValue
,
str
(
f
))
wx
.
CallAfter
(
self
.
btemp
.
SetValue
,
str
(
f
))
...
@@ -304,7 +293,6 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
...
@@ -304,7 +293,6 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
def
sethotendgui
(
self
,
f
):
def
sethotendgui
(
self
,
f
):
self
.
hsetpoint
=
f
self
.
hsetpoint
=
f
#self.hottgauge.SetTarget(int(f))
wx
.
CallAfter
(
self
.
graph
.
SetExtruder0TargetTemperature
,
int
(
f
))
wx
.
CallAfter
(
self
.
graph
.
SetExtruder0TargetTemperature
,
int
(
f
))
if
f
>
0
:
if
f
>
0
:
wx
.
CallAfter
(
self
.
htemp
.
SetValue
,
str
(
f
))
wx
.
CallAfter
(
self
.
htemp
.
SetValue
,
str
(
f
))
...
@@ -394,7 +382,7 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
...
@@ -394,7 +382,7 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
self
.
cur_macro_name
=
macro_name
self
.
cur_macro_name
=
macro_name
self
.
cur_macro_def
=
definition
self
.
cur_macro_def
=
definition
self
.
end_macro
()
self
.
end_macro
()
macroed
(
macro_name
,
old_macro_definition
,
cb
)
MacroEditor
(
macro_name
,
old_macro_definition
,
cb
)
else
:
else
:
pronsole
.
pronsole
.
start_macro
(
self
,
macro_name
,
old_macro_definition
)
pronsole
.
pronsole
.
start_macro
(
self
,
macro_name
,
old_macro_definition
)
...
@@ -475,7 +463,7 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
...
@@ -475,7 +463,7 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
def
do_editgcode
(
self
,
e
=
None
):
def
do_editgcode
(
self
,
e
=
None
):
if
self
.
filename
is
not
None
:
if
self
.
filename
is
not
None
:
macroed
(
self
.
filename
,
self
.
f
,
self
.
doneediting
,
1
)
MacroEditor
(
self
.
filename
,
self
.
f
,
self
.
doneediting
,
1
)
def
new_macro
(
self
,
e
=
None
):
def
new_macro
(
self
,
e
=
None
):
dialog
=
wx
.
Dialog
(
self
,
-
1
,
_
(
"Enter macro name"
),
size
=
(
260
,
85
))
dialog
=
wx
.
Dialog
(
self
,
-
1
,
_
(
"Enter macro name"
),
size
=
(
260
,
85
))
...
@@ -549,308 +537,6 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
...
@@ -549,308 +537,6 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
except
:
except
:
pass
pass
def
popwindow
(
self
):
# this list will contain all controls that should be only enabled
# when we're connected to a printer
self
.
printerControls
=
[]
#sizer layout: topsizer is a column sizer containing two sections
#upper section contains the mini view buttons
#lower section contains the rest of the window - manual controls, console, visualizations
#TOP ROW:
uts
=
self
.
uppertopsizer
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
self
.
rescanbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Port"
),
size
=
buttonSize
)
self
.
rescanbtn
.
SetToolTip
(
wx
.
ToolTip
(
"Communication Settings
\n
Click to rescan ports"
))
self
.
rescanbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
rescanports
)
uts
.
Add
(
self
.
rescanbtn
,
0
,
wx
.
TOP
|
wx
.
LEFT
,
0
)
self
.
serialport
=
wx
.
ComboBox
(
self
.
panel
,
-
1
,
choices
=
self
.
scanserial
(),
style
=
wx
.
CB_DROPDOWN
,
size
=
(
100
,
25
))
self
.
serialport
.
SetToolTip
(
wx
.
ToolTip
(
"Select Port Printer is connected to"
))
self
.
rescanports
()
uts
.
Add
(
self
.
serialport
)
uts
.
Add
(
wx
.
StaticText
(
self
.
panel
,
-
1
,
"@"
),
0
,
wx
.
RIGHT
|
wx
.
ALIGN_CENTER
,
0
)
self
.
baud
=
wx
.
ComboBox
(
self
.
panel
,
-
1
,
choices
=
[
"2400"
,
"9600"
,
"19200"
,
"38400"
,
"57600"
,
"115200"
,
"250000"
],
style
=
wx
.
CB_DROPDOWN
,
size
=
(
100
,
25
))
self
.
baud
.
SetToolTip
(
wx
.
ToolTip
(
"Select Baud rate for printer communication"
))
try
:
self
.
baud
.
SetValue
(
"115200"
)
self
.
baud
.
SetValue
(
str
(
self
.
settings
.
baudrate
))
except
:
pass
uts
.
Add
(
self
.
baud
)
self
.
connectbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Connect"
),
size
=
buttonSize
)
self
.
connectbtn
.
SetToolTip
(
wx
.
ToolTip
(
"Connect to the printer"
))
self
.
connectbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
connect
)
uts
.
Add
(
self
.
connectbtn
)
self
.
resetbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Reset"
),
style
=
wx
.
BU_EXACTFIT
,
size
=
(
-
1
,
buttonSize
[
1
]))
self
.
resetbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
reset
)
self
.
resetbtn
.
SetToolTip
(
wx
.
ToolTip
(
"Reset the printer"
))
uts
.
Add
(
self
.
resetbtn
)
#uts.Add((25,-1))
#uts.Add((15,-1), flag = wx.EXPAND)
#self.minibtn = wx.Button(self.panel,-1, _("Mini mode"), style = wx.BU_EXACTFIT)
#self.minibtn.Bind(wx.EVT_BUTTON, self.toggleview)
#uts.Add(self.minibtn, 0, wx.ALIGN_CENTER)
#SECOND ROW
ubs
=
self
.
upperbottomsizer
=
uts
#wx.BoxSizer(wx.HORIZONTAL)
self
.
loadbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Load file"
),
style
=
wx
.
BU_EXACTFIT
,
size
=
(
-
1
,
buttonSize
[
1
]))
self
.
loadbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
loadfile
)
self
.
loadbtn
.
SetToolTip
(
wx
.
ToolTip
(
"Load a 3D model file"
))
ubs
.
Add
(
self
.
loadbtn
)
self
.
platebtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Compose"
),
style
=
wx
.
BU_EXACTFIT
,
size
=
(
-
1
,
buttonSize
[
1
]))
self
.
platebtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
plate
)
self
.
platebtn
.
SetToolTip
(
wx
.
ToolTip
(
"Simple Plater System"
))
#self.printerControls.append(self.uploadbtn)
ubs
.
Add
(
self
.
platebtn
)
self
.
sdbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"SD"
),
style
=
wx
.
BU_EXACTFIT
,
size
=
(
-
1
,
buttonSize
[
1
]))
self
.
sdbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
sdmenu
)
self
.
sdbtn
.
SetToolTip
(
wx
.
ToolTip
(
"SD Card Printing"
))
self
.
printerControls
.
append
(
self
.
sdbtn
)
ubs
.
Add
(
self
.
sdbtn
)
self
.
printbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Print"
),
size
=
buttonSize
)
self
.
printbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
printfile
)
self
.
printbtn
.
SetToolTip
(
wx
.
ToolTip
(
"Start Printing Loaded File"
))
self
.
printbtn
.
Disable
()
ubs
.
Add
(
self
.
printbtn
)
self
.
pausebtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Pause"
),
size
=
buttonSize
)
self
.
pausebtn
.
SetToolTip
(
wx
.
ToolTip
(
"Pause Current Print"
))
self
.
pausebtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
pause
)
ubs
.
Add
(
self
.
pausebtn
)
self
.
recoverbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Recover"
),
size
=
buttonSize
)
self
.
recoverbtn
.
SetToolTip
(
wx
.
ToolTip
(
"Recover previous Print"
))
self
.
recoverbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
recover
)
ubs
.
Add
(
self
.
recoverbtn
)
#Right full view
lrs
=
self
.
lowerrsizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
self
.
logbox
=
wx
.
TextCtrl
(
self
.
panel
,
style
=
wx
.
TE_MULTILINE
,
size
=
(
350
,
-
1
))
self
.
logbox
.
SetEditable
(
0
)
lrs
.
Add
(
self
.
logbox
,
1
,
wx
.
EXPAND
)
lbrs
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
self
.
commandbox
=
wx
.
TextCtrl
(
self
.
panel
,
style
=
wx
.
TE_PROCESS_ENTER
)
self
.
commandbox
.
SetToolTip
(
wx
.
ToolTip
(
"Send commands to printer
\n
(Type 'help' for simple
\n
help function)"
))
self
.
commandbox
.
Bind
(
wx
.
EVT_TEXT_ENTER
,
self
.
sendline
)
self
.
commandbox
.
Bind
(
wx
.
EVT_CHAR
,
self
.
cbkey
)
self
.
commandbox
.
history
=
[
u""
]
self
.
commandbox
.
histindex
=
1
#self.printerControls.append(self.commandbox)
lbrs
.
Add
(
self
.
commandbox
,
1
)
self
.
sendbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Send"
),
style
=
wx
.
BU_EXACTFIT
)
self
.
sendbtn
.
SetToolTip
(
wx
.
ToolTip
(
"Send Command to Printer"
))
self
.
sendbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
sendline
)
#self.printerControls.append(self.sendbtn)
lbrs
.
Add
(
self
.
sendbtn
)
lrs
.
Add
(
lbrs
,
0
,
wx
.
EXPAND
)
#left pane
lls
=
self
.
lowerlsizer
=
wx
.
GridBagSizer
()
llts
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
#lls.Add(wx.StaticText(self.panel,-1, _("mm/min")), pos = (0, 4), span = (1, 4))
lls
.
Add
(
llts
,
pos
=
(
0
,
0
),
span
=
(
1
,
9
))
#lls.Add((200, 375))
szbuttons
=
wx
.
GridBagSizer
()
self
.
xyb
=
XYButtons
(
self
.
panel
,
self
.
moveXY
,
self
.
homeButtonClicked
,
self
.
spacebarAction
,
self
.
settings
.
bgcolor
)
szbuttons
.
Add
(
self
.
xyb
,
pos
=
(
0
,
1
),
flag
=
wx
.
ALIGN_CENTER
)
self
.
zb
=
ZButtons
(
self
.
panel
,
self
.
moveZ
,
self
.
settings
.
bgcolor
)
szbuttons
.
Add
(
self
.
zb
,
pos
=
(
0
,
2
),
flag
=
wx
.
ALIGN_CENTER
)
#lls.Add(self.zb, pos = (2, 6), span = (1, 1), flag = wx.ALIGN_CENTER)
wx
.
CallAfter
(
self
.
xyb
.
SetFocus
)
lls
.
Add
(
szbuttons
,
pos
=
(
1
,
0
),
span
=
(
1
,
8
),
flag
=
wx
.
ALIGN_CENTER
)
for
i
in
self
.
cpbuttons
:
btn
=
wx
.
Button
(
self
.
panel
,
-
1
,
i
[
0
],
style
=
wx
.
BU_EXACTFIT
)
btn
.
SetToolTip
(
wx
.
ToolTip
(
i
[
5
]))
btn
.
SetBackgroundColour
(
i
[
3
])
btn
.
SetForegroundColour
(
"black"
)
btn
.
properties
=
i
btn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
procbutton
)
self
.
btndict
[
i
[
1
]]
=
btn
self
.
printerControls
.
append
(
btn
)
if
i
[
2
]
==
None
:
if
i
[
4
]
==
0
:
llts
.
Add
(
btn
)
else
:
lls
.
Add
(
btn
,
pos
=
i
[
2
],
span
=
i
[
4
])
self
.
xyfeedc
=
wx
.
SpinCtrl
(
self
.
panel
,
-
1
,
str
(
self
.
settings
.
xy_feedrate
),
min
=
0
,
max
=
50000
,
size
=
(
70
,
-
1
))
self
.
xyfeedc
.
SetToolTip
(
wx
.
ToolTip
(
"Set Maximum Speed for X & Y axes (mm/min)"
))
llts
.
Add
(
wx
.
StaticText
(
self
.
panel
,
-
1
,
_
(
"XY:"
)),
flag
=
wx
.
ALIGN_RIGHT
|
wx
.
ALIGN_CENTER_VERTICAL
)
llts
.
Add
(
self
.
xyfeedc
)
llts
.
Add
(
wx
.
StaticText
(
self
.
panel
,
-
1
,
_
(
"mm/min Z:"
)),
flag
=
wx
.
ALIGN_RIGHT
|
wx
.
ALIGN_CENTER_VERTICAL
)
self
.
zfeedc
=
wx
.
SpinCtrl
(
self
.
panel
,
-
1
,
str
(
self
.
settings
.
z_feedrate
),
min
=
0
,
max
=
50000
,
size
=
(
70
,
-
1
))
self
.
zfeedc
.
SetToolTip
(
wx
.
ToolTip
(
"Set Maximum Speed for Z axis (mm/min)"
))
llts
.
Add
(
self
.
zfeedc
,)
self
.
monitorbox
=
wx
.
CheckBox
(
self
.
panel
,
-
1
,
_
(
"Watch"
))
self
.
monitorbox
.
SetToolTip
(
wx
.
ToolTip
(
"Monitor Temperatures in Graph"
))
lls
.
Add
(
self
.
monitorbox
,
pos
=
(
2
,
6
))
self
.
monitorbox
.
Bind
(
wx
.
EVT_CHECKBOX
,
self
.
setmonitor
)
lls
.
Add
(
wx
.
StaticText
(
self
.
panel
,
-
1
,
_
(
"Heat:"
)),
pos
=
(
2
,
0
),
span
=
(
1
,
1
),
flag
=
wx
.
ALIGN_CENTER_VERTICAL
|
wx
.
ALIGN_RIGHT
)
htemp_choices
=
[
self
.
temps
[
i
]
+
" ("
+
i
+
")"
for
i
in
sorted
(
self
.
temps
.
keys
(),
key
=
lambda
x
:
self
.
temps
[
x
])]
self
.
settoff
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Off"
),
size
=
(
36
,
-
1
),
style
=
wx
.
BU_EXACTFIT
)
self
.
settoff
.
SetToolTip
(
wx
.
ToolTip
(
"Switch Hotend Off"
))
self
.
settoff
.
Bind
(
wx
.
EVT_BUTTON
,
lambda
e
:
self
.
do_settemp
(
"off"
))
self
.
printerControls
.
append
(
self
.
settoff
)
lls
.
Add
(
self
.
settoff
,
pos
=
(
2
,
1
),
span
=
(
1
,
1
))
if
self
.
settings
.
last_temperature
not
in
map
(
float
,
self
.
temps
.
values
()):
htemp_choices
=
[
str
(
self
.
settings
.
last_temperature
)]
+
htemp_choices
self
.
htemp
=
wx
.
ComboBox
(
self
.
panel
,
-
1
,
choices
=
htemp_choices
,
style
=
wx
.
CB_DROPDOWN
,
size
=
(
70
,
-
1
))
self
.
htemp
.
SetToolTip
(
wx
.
ToolTip
(
"Select Temperature for Hotend"
))
self
.
htemp
.
Bind
(
wx
.
EVT_COMBOBOX
,
self
.
htemp_change
)
lls
.
Add
(
self
.
htemp
,
pos
=
(
2
,
2
),
span
=
(
1
,
2
))
self
.
settbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Set"
),
size
=
(
38
,
-
1
),
style
=
wx
.
BU_EXACTFIT
)
self
.
settbtn
.
SetToolTip
(
wx
.
ToolTip
(
"Switch Hotend On"
))
self
.
settbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
do_settemp
)
self
.
printerControls
.
append
(
self
.
settbtn
)
lls
.
Add
(
self
.
settbtn
,
pos
=
(
2
,
4
),
span
=
(
1
,
1
))
lls
.
Add
(
wx
.
StaticText
(
self
.
panel
,
-
1
,
_
(
"Bed:"
)),
pos
=
(
3
,
0
),
span
=
(
1
,
1
),
flag
=
wx
.
ALIGN_CENTER_VERTICAL
|
wx
.
ALIGN_RIGHT
)
btemp_choices
=
[
self
.
bedtemps
[
i
]
+
" ("
+
i
+
")"
for
i
in
sorted
(
self
.
bedtemps
.
keys
(),
key
=
lambda
x
:
self
.
temps
[
x
])]
self
.
setboff
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Off"
),
size
=
(
36
,
-
1
),
style
=
wx
.
BU_EXACTFIT
)
self
.
setboff
.
SetToolTip
(
wx
.
ToolTip
(
"Switch Heated Bed Off"
))
self
.
setboff
.
Bind
(
wx
.
EVT_BUTTON
,
lambda
e
:
self
.
do_bedtemp
(
"off"
))
self
.
printerControls
.
append
(
self
.
setboff
)
lls
.
Add
(
self
.
setboff
,
pos
=
(
3
,
1
),
span
=
(
1
,
1
))
if
self
.
settings
.
last_bed_temperature
not
in
map
(
float
,
self
.
bedtemps
.
values
()):
btemp_choices
=
[
str
(
self
.
settings
.
last_bed_temperature
)]
+
btemp_choices
self
.
btemp
=
wx
.
ComboBox
(
self
.
panel
,
-
1
,
choices
=
btemp_choices
,
style
=
wx
.
CB_DROPDOWN
,
size
=
(
70
,
-
1
))
self
.
btemp
.
SetToolTip
(
wx
.
ToolTip
(
"Select Temperature for Heated Bed"
))
self
.
btemp
.
Bind
(
wx
.
EVT_COMBOBOX
,
self
.
btemp_change
)
lls
.
Add
(
self
.
btemp
,
pos
=
(
3
,
2
),
span
=
(
1
,
2
))
self
.
setbbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Set"
),
size
=
(
38
,
-
1
),
style
=
wx
.
BU_EXACTFIT
)
self
.
setbbtn
.
SetToolTip
(
wx
.
ToolTip
(
"Switch Heated Bed On"
))
self
.
setbbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
do_bedtemp
)
self
.
printerControls
.
append
(
self
.
setbbtn
)
lls
.
Add
(
self
.
setbbtn
,
pos
=
(
3
,
4
),
span
=
(
1
,
1
))
self
.
btemp
.
SetValue
(
str
(
self
.
settings
.
last_bed_temperature
))
self
.
htemp
.
SetValue
(
str
(
self
.
settings
.
last_temperature
))
## added for an error where only the bed would get (pla) or (abs).
#This ensures, if last temp is a default pla or abs, it will be marked so.
# if it is not, then a (user) remark is added. This denotes a manual entry
for
i
in
btemp_choices
:
if
i
.
split
()[
0
]
==
str
(
self
.
settings
.
last_bed_temperature
)
.
split
(
'.'
)[
0
]
or
i
.
split
()[
0
]
==
str
(
self
.
settings
.
last_bed_temperature
):
self
.
btemp
.
SetValue
(
i
)
for
i
in
htemp_choices
:
if
i
.
split
()[
0
]
==
str
(
self
.
settings
.
last_temperature
)
.
split
(
'.'
)[
0
]
or
i
.
split
()[
0
]
==
str
(
self
.
settings
.
last_temperature
)
:
self
.
htemp
.
SetValue
(
i
)
if
(
'('
not
in
self
.
btemp
.
Value
):
self
.
btemp
.
SetValue
(
self
.
btemp
.
Value
+
' (user)'
)
if
(
'('
not
in
self
.
htemp
.
Value
):
self
.
htemp
.
SetValue
(
self
.
htemp
.
Value
+
' (user)'
)
#lls.Add(self.btemp, pos = (4, 1), span = (1, 3))
#lls.Add(self.setbbtn, pos = (4, 4), span = (1, 2))
self
.
tempdisp
=
wx
.
StaticText
(
self
.
panel
,
-
1
,
""
)
self
.
edist
=
wx
.
SpinCtrl
(
self
.
panel
,
-
1
,
"5"
,
min
=
0
,
max
=
1000
,
size
=
(
60
,
-
1
))
self
.
edist
.
SetBackgroundColour
((
225
,
200
,
200
))
self
.
edist
.
SetForegroundColour
(
"black"
)
lls
.
Add
(
self
.
edist
,
pos
=
(
4
,
2
),
span
=
(
1
,
2
))
lls
.
Add
(
wx
.
StaticText
(
self
.
panel
,
-
1
,
_
(
"mm"
)),
pos
=
(
4
,
4
),
span
=
(
1
,
1
))
self
.
edist
.
SetToolTip
(
wx
.
ToolTip
(
"Amount to Extrude or Retract (mm)"
))
self
.
efeedc
=
wx
.
SpinCtrl
(
self
.
panel
,
-
1
,
str
(
self
.
settings
.
e_feedrate
),
min
=
0
,
max
=
50000
,
size
=
(
60
,
-
1
))
self
.
efeedc
.
SetToolTip
(
wx
.
ToolTip
(
"Extrude / Retract speed (mm/min)"
))
self
.
efeedc
.
SetBackgroundColour
((
225
,
200
,
200
))
self
.
efeedc
.
SetForegroundColour
(
"black"
)
self
.
efeedc
.
Bind
(
wx
.
EVT_SPINCTRL
,
self
.
setfeeds
)
lls
.
Add
(
self
.
efeedc
,
pos
=
(
5
,
2
),
span
=
(
1
,
2
))
lls
.
Add
(
wx
.
StaticText
(
self
.
panel
,
-
1
,
_
(
"mm/
\n
min"
)),
pos
=
(
5
,
4
),
span
=
(
1
,
1
))
self
.
xyfeedc
.
Bind
(
wx
.
EVT_SPINCTRL
,
self
.
setfeeds
)
self
.
zfeedc
.
Bind
(
wx
.
EVT_SPINCTRL
,
self
.
setfeeds
)
self
.
zfeedc
.
SetBackgroundColour
((
180
,
255
,
180
))
self
.
zfeedc
.
SetForegroundColour
(
"black"
)
# lls.Add((10, 0), pos = (0, 11), span = (1, 1))
#self.hottgauge = TempGauge(self.panel, size = (200, 24), title = _("Heater:"), maxval = 230)
#lls.Add(self.hottgauge, pos = (7, 0), span = (1, 4))
#self.bedtgauge = TempGauge(self.panel, size = (200, 24), title = _("Bed:"), maxval = 130)
#lls.Add(self.bedtgauge, pos = (8, 0), span = (1, 4))
#def scroll_setpoint(e):
# if e.GetWheelRotation()>0:
# self.do_settemp(str(self.hsetpoint+1))
# elif e.GetWheelRotation()<0:
# self.do_settemp(str(max(0, self.hsetpoint-1)))
#self.tgauge.Bind(wx.EVT_MOUSEWHEEL, scroll_setpoint)
self
.
graph
=
Graph
(
self
.
panel
,
wx
.
ID_ANY
)
lls
.
Add
(
self
.
graph
,
pos
=
(
3
,
5
),
span
=
(
3
,
3
))
lls
.
Add
(
self
.
tempdisp
,
pos
=
(
6
,
0
),
span
=
(
1
,
9
))
self
.
gviz
=
gviz
.
gviz
(
self
.
panel
,
(
300
,
300
),
build_dimensions
=
self
.
build_dimensions_list
,
grid
=
(
self
.
settings
.
preview_grid_step1
,
self
.
settings
.
preview_grid_step2
),
extrusion_width
=
self
.
settings
.
preview_extrusion_width
)
self
.
gviz
.
SetToolTip
(
wx
.
ToolTip
(
"Click to examine / edit
\n
layers of loaded file"
))
self
.
gviz
.
showall
=
1
try
:
raise
""
import
printrun.stlview
self
.
gwindow
=
printrun
.
stlview
.
GCFrame
(
None
,
wx
.
ID_ANY
,
'Gcode view, shift to move view, mousewheel to set layer'
,
size
=
(
600
,
600
))
except
:
self
.
gwindow
=
gviz
.
window
([],
build_dimensions
=
self
.
build_dimensions_list
,
grid
=
(
self
.
settings
.
preview_grid_step1
,
self
.
settings
.
preview_grid_step2
),
extrusion_width
=
self
.
settings
.
preview_extrusion_width
)
self
.
gviz
.
Bind
(
wx
.
EVT_LEFT_DOWN
,
self
.
showwin
)
self
.
gwindow
.
Bind
(
wx
.
EVT_CLOSE
,
lambda
x
:
self
.
gwindow
.
Hide
())
vcs
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
vcs
.
Add
(
self
.
gviz
,
1
,
flag
=
wx
.
SHAPED
)
cs
=
self
.
centersizer
=
wx
.
GridBagSizer
()
vcs
.
Add
(
cs
,
0
,
flag
=
wx
.
EXPAND
)
self
.
uppersizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
self
.
uppersizer
.
Add
(
self
.
uppertopsizer
)
#self.uppersizer.Add(self.upperbottomsizer)
self
.
lowersizer
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
self
.
lowersizer
.
Add
(
lls
)
self
.
lowersizer
.
Add
(
vcs
,
1
,
wx
.
EXPAND
|
wx
.
ALIGN_CENTER_HORIZONTAL
)
self
.
lowersizer
.
Add
(
lrs
,
0
,
wx
.
EXPAND
)
self
.
topsizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
self
.
topsizer
.
Add
(
self
.
uppersizer
)
self
.
topsizer
.
Add
(
self
.
lowersizer
,
1
,
wx
.
EXPAND
)
self
.
panel
.
SetSizer
(
self
.
topsizer
)
self
.
status
=
self
.
CreateStatusBar
()
self
.
status
.
SetStatusText
(
_
(
"Not connected to printer."
))
self
.
panel
.
Bind
(
wx
.
EVT_MOUSE_EVENTS
,
self
.
editbutton
)
self
.
Bind
(
wx
.
EVT_CLOSE
,
self
.
kill
)
self
.
topsizer
.
Layout
()
self
.
topsizer
.
Fit
(
self
)
# disable all printer controls until we connect to a printer
self
.
pausebtn
.
Disable
()
self
.
recoverbtn
.
Disable
()
for
i
in
self
.
printerControls
:
i
.
Disable
()
#self.panel.Fit()
#uts.Layout()
self
.
cbuttons_reload
()
def
cbkey
(
self
,
e
):
def
cbkey
(
self
,
e
):
if
e
.
GetKeyCode
()
==
wx
.
WXK_UP
:
if
e
.
GetKeyCode
()
==
wx
.
WXK_UP
:
if
self
.
commandbox
.
histindex
==
len
(
self
.
commandbox
.
history
):
if
self
.
commandbox
.
histindex
==
len
(
self
.
commandbox
.
history
):
...
@@ -924,7 +610,7 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
...
@@ -924,7 +610,7 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
def
toggleview
(
self
,
e
):
def
toggleview
(
self
,
e
):
if
(
self
.
mini
):
if
(
self
.
mini
):
self
.
mini
=
False
self
.
mini
=
False
self
.
top
sizer
.
Fit
(
self
)
self
.
main
sizer
.
Fit
(
self
)
#self.SetSize(winsize)
#self.SetSize(winsize)
wx
.
CallAfter
(
self
.
minibtn
.
SetLabel
,
_
(
"Mini mode"
))
wx
.
CallAfter
(
self
.
minibtn
.
SetLabel
,
_
(
"Mini mode"
))
...
@@ -938,7 +624,7 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
...
@@ -938,7 +624,7 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
def
cbuttons_reload
(
self
):
def
cbuttons_reload
(
self
):
allcbs
=
[]
allcbs
=
[]
ubs
=
self
.
upper
bottom
sizer
ubs
=
self
.
uppersizer
cs
=
self
.
centersizer
cs
=
self
.
centersizer
#for item in ubs.GetChildren():
#for item in ubs.GetChildren():
# if hasattr(item.GetWindow(),"custombutton"):
# if hasattr(item.GetWindow(),"custombutton"):
...
@@ -958,16 +644,16 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
...
@@ -958,16 +644,16 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
for
i
in
xrange
(
len
(
self
.
custombuttons
)):
for
i
in
xrange
(
len
(
self
.
custombuttons
)):
btndef
=
self
.
custombuttons
[
i
]
btndef
=
self
.
custombuttons
[
i
]
try
:
try
:
b
=
wx
.
Button
(
self
.
panel
,
-
1
,
btndef
[
0
]
,
style
=
wx
.
BU_EXACTFIT
)
b
=
wx
.
Button
(
self
.
panel
,
-
1
,
btndef
.
label
,
style
=
wx
.
BU_EXACTFIT
)
b
.
SetToolTip
(
wx
.
ToolTip
(
_
(
"Execute command: "
)
+
btndef
[
1
]
))
b
.
SetToolTip
(
wx
.
ToolTip
(
_
(
"Execute command: "
)
+
btndef
.
command
))
if
len
(
btndef
)
>
2
:
if
btndef
.
background
:
b
.
SetBackgroundColour
(
btndef
[
2
]
)
b
.
SetBackgroundColour
(
btndef
.
background
)
rr
,
gg
,
bb
=
b
.
GetBackgroundColour
()
.
Get
()
rr
,
gg
,
bb
=
b
.
GetBackgroundColour
()
.
Get
()
if
0.3
*
rr
+
0.59
*
gg
+
0.11
*
bb
<
60
:
if
0.3
*
rr
+
0.59
*
gg
+
0.11
*
bb
<
60
:
b
.
SetForegroundColour
(
"#ffffff"
)
b
.
SetForegroundColour
(
"#ffffff"
)
except
:
except
:
if
i
==
newbuttonbuttonindex
:
if
i
==
newbuttonbuttonindex
:
self
.
newbuttonbutton
=
b
=
wx
.
Button
(
self
.
panel
,
-
1
,
"+"
,
size
=
(
19
,
18
),
style
=
wx
.
BU_EXACTFIT
)
self
.
newbuttonbutton
=
b
=
wx
.
Button
(
self
.
panel
,
-
1
,
"+"
,
size
=
(
19
,
18
),
style
=
wx
.
BU_EXACTFIT
)
#b.SetFont(wx.Font(12, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD))
#b.SetFont(wx.Font(12, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD))
b
.
SetForegroundColour
(
"#4444ff"
)
b
.
SetForegroundColour
(
"#4444ff"
)
b
.
SetToolTip
(
wx
.
ToolTip
(
_
(
"click to add new custom button"
)))
b
.
SetToolTip
(
wx
.
ToolTip
(
_
(
"click to add new custom button"
)))
...
@@ -989,7 +675,7 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
...
@@ -989,7 +675,7 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
# ubs.Add(b)
# ubs.Add(b)
#else:
#else:
cs
.
Add
(
b
,
pos
=
((
i
)
/
4
,
(
i
)
%
4
))
cs
.
Add
(
b
,
pos
=
((
i
)
/
4
,
(
i
)
%
4
))
self
.
top
sizer
.
Layout
()
self
.
main
sizer
.
Layout
()
def
help_button
(
self
):
def
help_button
(
self
):
print
_
(
'Defines custom button. Usage: button <num> "title" [/c "colour"] command'
)
print
_
(
'Defines custom button. Usage: button <num> "title" [/c "colour"] command'
)
...
@@ -1021,10 +707,10 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
...
@@ -1021,10 +707,10 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
self
.
webInterface
.
AddLog
(
"Custom button number should be between 0 and 63"
)
self
.
webInterface
.
AddLog
(
"Custom button number should be between 0 and 63"
)
return
return
while
num
>=
len
(
self
.
custombuttons
):
while
num
>=
len
(
self
.
custombuttons
):
self
.
custombuttons
+=
[
None
]
self
.
custombuttons
.
append
(
None
)
self
.
custombuttons
[
num
]
=
[
title
,
command
]
self
.
custombuttons
[
num
]
=
SpecialButton
(
title
,
command
)
if
colour
is
not
None
:
if
colour
is
not
None
:
self
.
custombuttons
[
num
]
+=
[
colour
]
self
.
custombuttons
[
num
]
.
background
=
colour
if
not
self
.
processing_rc
:
if
not
self
.
processing_rc
:
self
.
cbuttons_reload
()
self
.
cbuttons_reload
()
#except Exception, x:
#except Exception, x:
...
@@ -1035,8 +721,8 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
...
@@ -1035,8 +721,8 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
if
new_n
is
None
:
new_n
=
n
if
new_n
is
None
:
new_n
=
n
if
bdef
is
None
or
bdef
==
""
:
if
bdef
is
None
or
bdef
==
""
:
self
.
save_in_rc
((
"button
%
d"
%
n
),
''
)
self
.
save_in_rc
((
"button
%
d"
%
n
),
''
)
elif
len
(
bdef
)
>
2
:
elif
bdef
.
background
:
colour
=
bdef
[
2
]
colour
=
bdef
.
background
if
type
(
colour
)
not
in
(
str
,
unicode
):
if
type
(
colour
)
not
in
(
str
,
unicode
):
#print type(colour), map(type, colour)
#print type(colour), map(type, colour)
if
type
(
colour
)
==
tuple
and
tuple
(
map
(
type
,
colour
))
==
(
int
,
int
,
int
):
if
type
(
colour
)
==
tuple
and
tuple
(
map
(
type
,
colour
))
==
(
int
,
int
,
int
):
...
@@ -1044,18 +730,18 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
...
@@ -1044,18 +730,18 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
colour
=
wx
.
Colour
(
*
colour
)
.
GetAsString
(
wx
.
C2S_NAME
|
wx
.
C2S_HTML_SYNTAX
)
colour
=
wx
.
Colour
(
*
colour
)
.
GetAsString
(
wx
.
C2S_NAME
|
wx
.
C2S_HTML_SYNTAX
)
else
:
else
:
colour
=
wx
.
Colour
(
colour
)
.
GetAsString
(
wx
.
C2S_NAME
|
wx
.
C2S_HTML_SYNTAX
)
colour
=
wx
.
Colour
(
colour
)
.
GetAsString
(
wx
.
C2S_NAME
|
wx
.
C2S_HTML_SYNTAX
)
self
.
save_in_rc
((
"button
%
d"
%
n
),
'button
%
d "
%
s" /c "
%
s"
%
s'
%
(
new_n
,
bdef
[
0
],
colour
,
bdef
[
1
]
))
self
.
save_in_rc
((
"button
%
d"
%
n
),
'button
%
d "
%
s" /c "
%
s"
%
s'
%
(
new_n
,
bdef
.
label
,
colour
,
bdef
.
command
))
else
:
else
:
self
.
save_in_rc
((
"button
%
d"
%
n
),
'button
%
d "
%
s"
%
s'
%
(
new_n
,
bdef
[
0
],
bdef
[
1
]
))
self
.
save_in_rc
((
"button
%
d"
%
n
),
'button
%
d "
%
s"
%
s'
%
(
new_n
,
bdef
.
label
,
bdef
.
command
))
def
cbutton_edit
(
self
,
e
,
button
=
None
):
def
cbutton_edit
(
self
,
e
,
button
=
None
):
bedit
=
ButtonEdit
(
self
)
bedit
=
ButtonEdit
(
self
)
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
.
label
)
bedit
.
command
.
SetValue
(
button
.
properties
[
1
]
)
bedit
.
command
.
SetValue
(
button
.
properties
.
command
)
if
len
(
button
.
properties
)
>
2
:
if
button
.
properties
.
background
:
colour
=
button
.
properties
[
2
]
colour
=
button
.
properties
.
background
if
type
(
colour
)
not
in
(
str
,
unicode
):
if
type
(
colour
)
not
in
(
str
,
unicode
):
#print type(colour)
#print type(colour)
if
type
(
colour
)
==
tuple
and
tuple
(
map
(
type
,
colour
))
==
(
int
,
int
,
int
):
if
type
(
colour
)
==
tuple
and
tuple
(
map
(
type
,
colour
))
==
(
int
,
int
,
int
):
...
@@ -1071,9 +757,9 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
...
@@ -1071,9 +757,9 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
if
bedit
.
ShowModal
()
==
wx
.
ID_OK
:
if
bedit
.
ShowModal
()
==
wx
.
ID_OK
:
if
n
==
len
(
self
.
custombuttons
):
if
n
==
len
(
self
.
custombuttons
):
self
.
custombuttons
+=
[
None
]
self
.
custombuttons
+=
[
None
]
self
.
custombuttons
[
n
]
=
[
bedit
.
name
.
GetValue
()
.
strip
(),
bedit
.
command
.
GetValue
()
.
strip
()]
self
.
custombuttons
[
n
]
=
SpecialButton
(
bedit
.
name
.
GetValue
()
.
strip
(),
bedit
.
command
.
GetValue
()
.
strip
(),
custom
=
True
)
if
bedit
.
color
.
GetValue
()
.
strip
()
!=
""
:
if
bedit
.
color
.
GetValue
()
.
strip
()
!=
""
:
self
.
custombuttons
[
n
]
+=
[
bedit
.
color
.
GetValue
()]
self
.
custombuttons
[
n
]
.
background
=
bedit
.
color
.
GetValue
()
self
.
cbutton_save
(
n
,
self
.
custombuttons
[
n
])
self
.
cbutton_save
(
n
,
self
.
custombuttons
[
n
])
bedit
.
Destroy
()
bedit
.
Destroy
()
self
.
cbuttons_reload
()
self
.
cbuttons_reload
()
...
@@ -1143,9 +829,9 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
...
@@ -1143,9 +829,9 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
#self.newbuttonbutton.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
#self.newbuttonbutton.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
#self.newbuttonbutton.SetForegroundColour("black")
#self.newbuttonbutton.SetForegroundColour("black")
#self.newbuttonbutton.SetSize(obj.GetSize())
#self.newbuttonbutton.SetSize(obj.GetSize())
#if self.upper
bottom
sizer.GetItem(self.newbuttonbutton) is not None:
#if self.uppersizer.GetItem(self.newbuttonbutton) is not None:
# self.upper
bottom
sizer.SetItemMinSize(self.newbuttonbutton, obj.GetSize())
# self.uppersizer.SetItemMinSize(self.newbuttonbutton, obj.GetSize())
# self.
top
sizer.Layout()
# self.
main
sizer.Layout()
for
b
in
self
.
custombuttonbuttons
:
for
b
in
self
.
custombuttonbuttons
:
#if b.IsFrozen(): b.Thaw()
#if b.IsFrozen(): b.Thaw()
if
b
.
properties
is
None
:
if
b
.
properties
is
None
:
...
@@ -1154,9 +840,9 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
...
@@ -1154,9 +840,9 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
b
.
SetFont
(
wx
.
Font
(
10
,
wx
.
FONTFAMILY_DEFAULT
,
wx
.
FONTSTYLE_NORMAL
,
wx
.
FONTWEIGHT_NORMAL
))
b
.
SetFont
(
wx
.
Font
(
10
,
wx
.
FONTFAMILY_DEFAULT
,
wx
.
FONTSTYLE_NORMAL
,
wx
.
FONTWEIGHT_NORMAL
))
b
.
SetForegroundColour
(
"black"
)
b
.
SetForegroundColour
(
"black"
)
b
.
SetSize
(
obj
.
GetSize
())
b
.
SetSize
(
obj
.
GetSize
())
if
self
.
upper
bottom
sizer
.
GetItem
(
b
)
is
not
None
:
if
self
.
uppersizer
.
GetItem
(
b
)
is
not
None
:
self
.
upper
bottom
sizer
.
SetItemMinSize
(
b
,
obj
.
GetSize
())
self
.
uppersizer
.
SetItemMinSize
(
b
,
obj
.
GetSize
())
self
.
top
sizer
.
Layout
()
self
.
main
sizer
.
Layout
()
# b.SetStyle(wx.ALIGN_CENTRE+wx.ST_NO_AUTORESIZE+wx.SIMPLE_BORDER)
# b.SetStyle(wx.ALIGN_CENTRE+wx.ST_NO_AUTORESIZE+wx.SIMPLE_BORDER)
self
.
dragging
=
wx
.
Button
(
self
.
panel
,
-
1
,
obj
.
GetLabel
(),
style
=
wx
.
BU_EXACTFIT
)
self
.
dragging
=
wx
.
Button
(
self
.
panel
,
-
1
,
obj
.
GetLabel
(),
style
=
wx
.
BU_EXACTFIT
)
self
.
dragging
.
SetBackgroundColour
(
obj
.
GetBackgroundColour
())
self
.
dragging
.
SetBackgroundColour
(
obj
.
GetBackgroundColour
())
...
@@ -1183,9 +869,9 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
...
@@ -1183,9 +869,9 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
break
break
#if dst is None and self.panel.GetScreenRect().Contains(scrpos):
#if dst is None and self.panel.GetScreenRect().Contains(scrpos):
# # try to check if it is after buttons at the end
# # try to check if it is after buttons at the end
# tspos = self.panel.ClientToScreen(self.upper
bottom
sizer.GetPosition())
# tspos = self.panel.ClientToScreen(self.uppersizer.GetPosition())
# bspos = self.panel.ClientToScreen(self.centersizer.GetPosition())
# bspos = self.panel.ClientToScreen(self.centersizer.GetPosition())
# tsrect = wx.Rect(*(tspos.Get()+self.upper
bottom
sizer.GetSize().Get()))
# tsrect = wx.Rect(*(tspos.Get()+self.uppersizer.GetSize().Get()))
# bsrect = wx.Rect(*(bspos.Get()+self.centersizer.GetSize().Get()))
# bsrect = wx.Rect(*(bspos.Get()+self.centersizer.GetSize().Get()))
# lbrect = btns[-1].GetScreenRect()
# lbrect = btns[-1].GetScreenRect()
# p = scrpos.Get()
# p = scrpos.Get()
...
@@ -1280,7 +966,7 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
...
@@ -1280,7 +966,7 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
if
wx
.
GetKeyState
(
wx
.
WXK_CONTROL
)
or
wx
.
GetKeyState
(
wx
.
WXK_ALT
):
if
wx
.
GetKeyState
(
wx
.
WXK_CONTROL
)
or
wx
.
GetKeyState
(
wx
.
WXK_ALT
):
return
self
.
editbutton
(
e
)
return
self
.
editbutton
(
e
)
self
.
cur_button
=
e
.
GetEventObject
()
.
custombutton
self
.
cur_button
=
e
.
GetEventObject
()
.
custombutton
self
.
onecmd
(
e
.
GetEventObject
()
.
properties
[
1
]
)
self
.
onecmd
(
e
.
GetEventObject
()
.
properties
.
command
)
self
.
cur_button
=
None
self
.
cur_button
=
None
except
:
except
:
print
_
(
"event object missing"
)
print
_
(
"event object missing"
)
...
@@ -1369,9 +1055,7 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
...
@@ -1369,9 +1055,7 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
string
=
""
string
=
""
wx
.
CallAfter
(
self
.
tempdisp
.
SetLabel
,
self
.
tempreport
.
strip
()
.
replace
(
"ok "
,
""
))
wx
.
CallAfter
(
self
.
tempdisp
.
SetLabel
,
self
.
tempreport
.
strip
()
.
replace
(
"ok "
,
""
))
try
:
try
:
#self.hottgauge.SetValue(parse_temperature_report(self.tempreport, "T:"))
wx
.
CallAfter
(
self
.
graph
.
SetExtruder0Temperature
,
parse_temperature_report
(
self
.
tempreport
,
"T:"
))
wx
.
CallAfter
(
self
.
graph
.
SetExtruder0Temperature
,
parse_temperature_report
(
self
.
tempreport
,
"T:"
))
#self.bedtgauge.SetValue(parse_temperature_report(self.tempreport, "B:"))
wx
.
CallAfter
(
self
.
graph
.
SetBedTemperature
,
parse_temperature_report
(
self
.
tempreport
,
"B:"
))
wx
.
CallAfter
(
self
.
graph
.
SetBedTemperature
,
parse_temperature_report
(
self
.
tempreport
,
"B:"
))
except
:
except
:
pass
pass
...
@@ -1436,7 +1120,6 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
...
@@ -1436,7 +1120,6 @@ class PronterWindow(wx.Frame, pronsole.pronsole):
self
.
tempreport
=
l
self
.
tempreport
=
l
wx
.
CallAfter
(
self
.
tempdisp
.
SetLabel
,
self
.
tempreport
.
strip
()
.
replace
(
"ok "
,
""
))
wx
.
CallAfter
(
self
.
tempdisp
.
SetLabel
,
self
.
tempreport
.
strip
()
.
replace
(
"ok "
,
""
))
try
:
try
:
#self.hottgauge.SetValue(parse_temperature_report(self.tempreport, "T:"))
wx
.
CallAfter
(
self
.
graph
.
SetExtruder0Temperature
,
parse_temperature_report
(
self
.
tempreport
,
"T:"
))
wx
.
CallAfter
(
self
.
graph
.
SetExtruder0Temperature
,
parse_temperature_report
(
self
.
tempreport
,
"T:"
))
wx
.
CallAfter
(
self
.
graph
.
SetBedTemperature
,
parse_temperature_report
(
self
.
tempreport
,
"B:"
))
wx
.
CallAfter
(
self
.
graph
.
SetBedTemperature
,
parse_temperature_report
(
self
.
tempreport
,
"B:"
))
except
:
except
:
...
...
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