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
d06bc65b
Commit
d06bc65b
authored
Jun 04, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add callbacks to update gviz params on the fly from options dialog
parent
5f00454c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
4 deletions
+37
-4
pronsole.py
pronsole.py
+3
-1
pronterface.py
pronterface.py
+34
-3
No files found.
pronsole.py
View file @
d06bc65b
...
...
@@ -279,8 +279,10 @@ class Settings(object):
return
object
.
__getattribute__
(
self
,
name
)
return
getattr
(
self
,
"_"
+
name
)
.
value
def
_add
(
self
,
setting
):
def
_add
(
self
,
setting
,
callback
=
None
):
setattr
(
self
,
setting
.
name
,
setting
)
if
callback
:
setattr
(
self
,
"_"
+
setting
.
name
+
"_cb"
,
callback
)
def
_set
(
self
,
key
,
value
):
try
:
...
...
pronterface.py
View file @
d06bc65b
...
...
@@ -191,9 +191,9 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self
.
settings
.
_add
(
HiddenSetting
(
"last_bed_temperature"
,
0.0
))
self
.
settings
.
_add
(
HiddenSetting
(
"last_file_path"
,
""
))
self
.
settings
.
_add
(
HiddenSetting
(
"last_temperature"
,
0.0
))
self
.
settings
.
_add
(
FloatSpinSetting
(
"preview_extrusion_width"
,
0.5
,
0
,
10
,
_
(
"Preview extrusion width"
),
_
(
"Width of Extrusion in Preview"
),
"UI"
))
self
.
settings
.
_add
(
SpinSetting
(
"preview_grid_step1"
,
10.
,
0
,
200
,
_
(
"Fine grid spacing"
),
_
(
"Fine Grid Spacing"
),
"UI"
))
self
.
settings
.
_add
(
SpinSetting
(
"preview_grid_step2"
,
50.
,
0
,
200
,
_
(
"Coarse grid spacing"
),
_
(
"Coarse Grid Spacing"
),
"UI"
))
self
.
settings
.
_add
(
FloatSpinSetting
(
"preview_extrusion_width"
,
0.5
,
0
,
10
,
_
(
"Preview extrusion width"
),
_
(
"Width of Extrusion in Preview"
),
"UI"
)
,
self
.
update_gviz_params
)
self
.
settings
.
_add
(
SpinSetting
(
"preview_grid_step1"
,
10.
,
0
,
200
,
_
(
"Fine grid spacing"
),
_
(
"Fine Grid Spacing"
),
"UI"
)
,
self
.
update_gviz_params
)
self
.
settings
.
_add
(
SpinSetting
(
"preview_grid_step2"
,
50.
,
0
,
200
,
_
(
"Coarse grid spacing"
),
_
(
"Coarse Grid Spacing"
),
"UI"
)
,
self
.
update_gviz_params
)
self
.
settings
.
_add
(
StaticTextSetting
(
"note1"
,
_
(
"Note:"
),
_
(
"Changing most settings here will require restart to get effect"
),
group
=
"UI"
))
self
.
pauseScript
=
"pause.gcode"
...
...
@@ -715,6 +715,37 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self
.
gwindow
.
SetToolTip
(
wx
.
ToolTip
(
"Mousewheel zooms the display
\n
Shift / Mousewheel scrolls layers"
))
self
.
gwindow
.
Raise
()
def
update_gviz_params
(
self
,
param
,
value
):
params_map
=
{
"preview_extrusion_width"
:
"extrusion_width"
,
"preview_grid_step1"
:
"grid"
,
"preview_grid_step2"
:
"grid"
,}
if
param
not
in
params_map
:
return
trueparam
=
params_map
[
param
]
if
hasattr
(
self
.
gviz
,
trueparam
):
gviz
=
self
.
gviz
elif
hasattr
(
self
.
gwindow
,
"p"
)
and
hasattr
(
self
.
gwindow
.
p
,
trueparam
):
gviz
=
self
.
gwindow
.
p
else
:
return
if
trueparam
==
"grid"
:
try
:
item
=
int
(
param
[
-
1
])
# extract list item position
grid
=
list
(
self
.
gviz
.
grid
)
grid
[
item
-
1
]
=
value
value
=
tuple
(
grid
)
except
:
traceback
.
print_exc
()
if
hasattr
(
self
.
gviz
,
trueparam
):
self
.
apply_gviz_params
(
self
.
gviz
,
trueparam
,
value
)
if
hasattr
(
self
.
gwindow
,
"p"
)
and
hasattr
(
self
.
gwindow
.
p
,
trueparam
):
self
.
apply_gviz_params
(
self
.
gwindow
.
p
,
trueparam
,
value
)
def
apply_gviz_params
(
self
,
widget
,
param
,
value
):
setattr
(
widget
,
param
,
value
)
widget
.
dirty
=
1
wx
.
CallAfter
(
widget
.
Refresh
)
def
setfeeds
(
self
,
e
):
self
.
feedrates_changed
=
True
try
:
...
...
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