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
1c00fc25
Commit
1c00fc25
authored
Mar 25, 2014
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add speed control slider
parent
6340b9d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
1 deletion
+44
-1
gui.py
printrun/gui.py
+29
-1
pronterface.py
printrun/pronterface.py
+15
-0
No files found.
printrun/gui.py
View file @
1c00fc25
...
...
@@ -67,7 +67,7 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode
standalone_mode
=
extra_buttons
is
not
None
base_line
=
1
if
standalone_mode
else
2
gauges_base_line
=
base_line
+
9
if
standalone_mode
else
base_line
+
5
gauges_base_line
=
base_line
+
10
if
standalone_mode
else
base_line
+
6
tempdisp_line
=
gauges_base_line
+
(
2
if
root
.
display_gauges
else
0
)
e_base_line
=
base_line
+
3
if
mini_mode
else
base_line
+
2
...
...
@@ -82,6 +82,7 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode
"btemp_set"
:
(
base_line
+
1
,
4
),
"ebuttons"
:
(
e_base_line
+
0
,
0
),
"esettings"
:
(
e_base_line
+
1
,
0
),
"speedcontrol"
:
(
e_base_line
+
2
,
0
),
"htemp_gauge"
:
(
gauges_base_line
+
0
,
0
),
"btemp_gauge"
:
(
gauges_base_line
+
1
,
0
),
"tempdisp"
:
(
tempdisp_line
,
0
),
...
...
@@ -100,6 +101,7 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode
"btemp_set"
:
(
1
,
1
),
"ebuttons"
:
(
1
,
5
),
"esettings"
:
(
1
,
5
),
"speedcontrol"
:
(
1
,
5
),
"htemp_gauge"
:
(
1
,
5
if
mini_mode
else
6
),
"btemp_gauge"
:
(
1
,
5
if
mini_mode
else
6
),
"tempdisp"
:
(
1
,
5
if
mini_mode
else
6
),
...
...
@@ -203,6 +205,32 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode
if
'('
not
in
root
.
htemp
.
Value
:
root
.
htemp
.
SetValue
(
root
.
htemp
.
Value
+
' (user)'
)
## Speed control
speedpanel
=
root
.
newPanel
(
parentpanel
)
speedsizer
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
speedsizer
.
Add
(
wx
.
StaticText
(
speedpanel
,
-
1
,
_
(
"Print speed:"
)),
flag
=
wx
.
ALIGN_CENTER_VERTICAL
|
wx
.
ALIGN_RIGHT
)
root
.
speed_slider
=
wx
.
Slider
(
speedpanel
,
-
1
,
100
,
1
,
300
)
speedsizer
.
Add
(
root
.
speed_slider
,
1
,
flag
=
wx
.
EXPAND
)
root
.
speed_label
=
wx
.
StaticText
(
speedpanel
,
-
1
,
_
(
"
%
d
%%
"
)
%
100
)
speedsizer
.
Add
(
root
.
speed_label
,
flag
=
wx
.
ALIGN_CENTER_VERTICAL
|
wx
.
ALIGN_RIGHT
)
def
speedslider_set
(
event
):
root
.
do_setspeed
()
root
.
speed_setbtn
.
SetBackgroundColour
(
wx
.
NullColour
)
root
.
speed_setbtn
=
make_button
(
speedpanel
,
_
(
"Set"
),
speedslider_set
,
_
(
"Set print speed factor"
),
size
=
(
38
,
-
1
),
style
=
wx
.
BU_EXACTFIT
)
root
.
printerControls
.
append
(
root
.
speed_setbtn
)
speedsizer
.
Add
(
root
.
speed_setbtn
,
flag
=
wx
.
ALIGN_CENTER
)
speedpanel
.
SetSizer
(
speedsizer
)
add
(
"speedcontrol"
,
speedpanel
,
flag
=
wx
.
EXPAND
)
def
speedslider_scroll
(
event
):
value
=
root
.
speed_slider
.
GetValue
()
root
.
speed_setbtn
.
SetBackgroundColour
(
"red"
)
root
.
speed_label
.
SetLabel
(
_
(
"
%
d
%%
"
)
%
value
)
root
.
speed_slider
.
Bind
(
wx
.
EVT_SCROLL
,
speedslider_scroll
)
## Temperature gauges
if
root
.
display_gauges
:
...
...
printrun/pronterface.py
View file @
1c00fc25
...
...
@@ -493,6 +493,21 @@ class PronterWindow(MainWindow, pronsole.pronsole):
except
Exception
,
x
:
print
_
(
"You must enter a temperature. (
%
s)"
)
%
(
repr
(
x
),)
def
do_setspeed
(
self
,
l
=
""
):
try
:
if
not
l
.
__class__
in
(
str
,
unicode
)
or
not
len
(
l
):
l
=
str
(
self
.
speed_slider
.
GetValue
())
else
:
l
=
l
.
lower
()
.
replace
(
", "
,
"."
)
f
=
float
(
l
)
if
self
.
p
.
online
:
self
.
p
.
send_now
(
"M220 S"
+
l
)
print
_
(
"Setting print speed factor to
%.1
f
%%
."
)
%
f
else
:
print
_
(
"Printer is not online."
)
except
Exception
,
x
:
print
_
(
"You must enter a speed. (
%
s)"
)
%
(
repr
(
x
),)
def
end_macro
(
self
):
pronsole
.
pronsole
.
end_macro
(
self
)
self
.
update_macros_menu
()
...
...
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