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
0e4ada2e
Commit
0e4ada2e
authored
Jun 23, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add standalone temp graph visualization
parent
47ca683e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
graph.py
printrun/graph.py
+31
-0
gui.py
printrun/gui.py
+1
-0
No files found.
printrun/graph.py
View file @
0e4ada2e
...
@@ -20,6 +20,15 @@ from math import log10, floor, ceil
...
@@ -20,6 +20,15 @@ from math import log10, floor, ceil
from
bufferedcanvas
import
*
from
bufferedcanvas
import
*
class
GraphWindow
(
wx
.
Frame
):
def
__init__
(
self
,
root
,
size
=
(
600
,
600
)):
wx
.
Frame
.
__init__
(
self
,
None
,
title
=
_
(
"Temperature graph"
),
size
=
size
)
panel
=
wx
.
Panel
(
self
,
-
1
)
vbox
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
self
.
graph
=
Graph
(
panel
,
wx
.
ID_ANY
,
root
)
vbox
.
Add
(
self
.
graph
,
1
,
wx
.
EXPAND
)
panel
.
SetSizer
(
vbox
)
class
Graph
(
BufferedCanvas
):
class
Graph
(
BufferedCanvas
):
'''A class to show a Graph with Pronterface.'''
'''A class to show a Graph with Pronterface.'''
...
@@ -52,6 +61,20 @@ class Graph(BufferedCanvas):
...
@@ -52,6 +61,20 @@ class Graph(BufferedCanvas):
self
.
xbars
=
6
# One bar per 10 second
self
.
xbars
=
6
# One bar per 10 second
self
.
xsteps
=
60
# Covering 1 minute in the graph
self
.
xsteps
=
60
# Covering 1 minute in the graph
self
.
window
=
None
def
showwin
(
self
,
event
=
None
):
if
not
self
.
window
:
self
.
window
=
GraphWindow
(
self
.
root
)
self
.
window
.
Show
()
if
self
.
timer
.
IsRunning
():
self
.
window
.
graph
.
StartPlotting
(
self
.
timer
.
Interval
)
else
:
self
.
window
.
Raise
()
def
__del__
(
self
):
if
self
.
window
:
self
.
window
.
Close
()
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
)
...
@@ -197,6 +220,7 @@ class Graph(BufferedCanvas):
...
@@ -197,6 +220,7 @@ class Graph(BufferedCanvas):
def
SetBedTemperature
(
self
,
value
):
def
SetBedTemperature
(
self
,
value
):
self
.
bedtemps
.
pop
()
self
.
bedtemps
.
pop
()
self
.
bedtemps
.
append
(
value
)
self
.
bedtemps
.
append
(
value
)
if
self
.
window
:
self
.
window
.
graph
.
SetBedTemperature
(
value
)
def
AddBedTemperature
(
self
,
value
):
def
AddBedTemperature
(
self
,
value
):
self
.
bedtemps
.
append
(
value
)
self
.
bedtemps
.
append
(
value
)
...
@@ -206,6 +230,7 @@ class Graph(BufferedCanvas):
...
@@ -206,6 +230,7 @@ class Graph(BufferedCanvas):
def
SetBedTargetTemperature
(
self
,
value
):
def
SetBedTargetTemperature
(
self
,
value
):
self
.
bedtargettemps
.
pop
()
self
.
bedtargettemps
.
pop
()
self
.
bedtargettemps
.
append
(
value
)
self
.
bedtargettemps
.
append
(
value
)
if
self
.
window
:
self
.
window
.
graph
.
SetBedTargetTemperature
(
value
)
def
AddBedTargetTemperature
(
self
,
value
):
def
AddBedTargetTemperature
(
self
,
value
):
self
.
bedtargettemps
.
append
(
value
)
self
.
bedtargettemps
.
append
(
value
)
...
@@ -215,6 +240,7 @@ class Graph(BufferedCanvas):
...
@@ -215,6 +240,7 @@ class Graph(BufferedCanvas):
def
SetExtruder0Temperature
(
self
,
value
):
def
SetExtruder0Temperature
(
self
,
value
):
self
.
extruder0temps
.
pop
()
self
.
extruder0temps
.
pop
()
self
.
extruder0temps
.
append
(
value
)
self
.
extruder0temps
.
append
(
value
)
if
self
.
window
:
self
.
window
.
graph
.
SetExtruder0Temperature
(
value
)
def
AddExtruder0Temperature
(
self
,
value
):
def
AddExtruder0Temperature
(
self
,
value
):
self
.
extruder0temps
.
append
(
value
)
self
.
extruder0temps
.
append
(
value
)
...
@@ -224,6 +250,7 @@ class Graph(BufferedCanvas):
...
@@ -224,6 +250,7 @@ class Graph(BufferedCanvas):
def
SetExtruder0TargetTemperature
(
self
,
value
):
def
SetExtruder0TargetTemperature
(
self
,
value
):
self
.
extruder0targettemps
.
pop
()
self
.
extruder0targettemps
.
pop
()
self
.
extruder0targettemps
.
append
(
value
)
self
.
extruder0targettemps
.
append
(
value
)
if
self
.
window
:
self
.
window
.
graph
.
SetExtruder0TargetTemperature
(
value
)
def
AddExtruder0TargetTemperature
(
self
,
value
):
def
AddExtruder0TargetTemperature
(
self
,
value
):
self
.
extruder0targettemps
.
append
(
value
)
self
.
extruder0targettemps
.
append
(
value
)
...
@@ -233,6 +260,7 @@ class Graph(BufferedCanvas):
...
@@ -233,6 +260,7 @@ class Graph(BufferedCanvas):
def
SetExtruder1Temperature
(
self
,
value
):
def
SetExtruder1Temperature
(
self
,
value
):
self
.
extruder1temps
.
pop
()
self
.
extruder1temps
.
pop
()
self
.
extruder1temps
.
append
(
value
)
self
.
extruder1temps
.
append
(
value
)
if
self
.
window
:
self
.
window
.
graph
.
SetExtruder1Temperature
(
value
)
def
AddExtruder1Temperature
(
self
,
value
):
def
AddExtruder1Temperature
(
self
,
value
):
self
.
extruder1temps
.
append
(
value
)
self
.
extruder1temps
.
append
(
value
)
...
@@ -242,6 +270,7 @@ class Graph(BufferedCanvas):
...
@@ -242,6 +270,7 @@ class Graph(BufferedCanvas):
def
SetExtruder1TargetTemperature
(
self
,
value
):
def
SetExtruder1TargetTemperature
(
self
,
value
):
self
.
extruder1targettemps
.
pop
()
self
.
extruder1targettemps
.
pop
()
self
.
extruder1targettemps
.
append
(
value
)
self
.
extruder1targettemps
.
append
(
value
)
if
self
.
window
:
self
.
window
.
graph
.
SetExtruder1TargetTemperature
(
value
)
def
AddExtruder1TargetTemperature
(
self
,
value
):
def
AddExtruder1TargetTemperature
(
self
,
value
):
self
.
extruder1targettemps
.
append
(
value
)
self
.
extruder1targettemps
.
append
(
value
)
...
@@ -251,10 +280,12 @@ class Graph(BufferedCanvas):
...
@@ -251,10 +280,12 @@ class Graph(BufferedCanvas):
def
StartPlotting
(
self
,
time
):
def
StartPlotting
(
self
,
time
):
self
.
Refresh
()
self
.
Refresh
()
self
.
timer
.
Start
(
time
)
self
.
timer
.
Start
(
time
)
if
self
.
window
:
self
.
window
.
graph
.
StartPlotting
(
time
)
def
StopPlotting
(
self
):
def
StopPlotting
(
self
):
self
.
timer
.
Stop
()
self
.
timer
.
Stop
()
self
.
Refresh
()
self
.
Refresh
()
if
self
.
window
:
self
.
window
.
graph
.
StopPlotting
()
def
draw
(
self
,
dc
,
w
,
h
):
def
draw
(
self
,
dc
,
w
,
h
):
dc
.
SetBackground
(
wx
.
Brush
(
self
.
root
.
settings
.
bgcolor
))
dc
.
SetBackground
(
wx
.
Brush
(
self
.
root
.
settings
.
bgcolor
))
...
...
printrun/gui.py
View file @
0e4ada2e
...
@@ -171,6 +171,7 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None):
...
@@ -171,6 +171,7 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None):
self
.
Add
(
root
.
graph
,
pos
=
(
base_line
+
5
,
0
),
span
=
(
3
,
6
))
self
.
Add
(
root
.
graph
,
pos
=
(
base_line
+
5
,
0
),
span
=
(
3
,
6
))
else
:
else
:
self
.
Add
(
root
.
graph
,
pos
=
(
base_line
+
2
,
5
),
span
=
(
3
,
1
))
self
.
Add
(
root
.
graph
,
pos
=
(
base_line
+
2
,
5
),
span
=
(
3
,
1
))
root
.
graph
.
Bind
(
wx
.
EVT_LEFT_DOWN
,
root
.
graph
.
showwin
)
if
extra_buttons
:
if
extra_buttons
:
pos_mapping
=
{
pos_mapping
=
{
...
...
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