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
22cb28dc
Commit
22cb28dc
authored
May 31, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize spacing in tabbed interface, improve behavior of non tabbed one
parent
38d63f7d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
80 additions
and
57 deletions
+80
-57
gui.py
printrun/gui.py
+80
-57
No files found.
printrun/gui.py
View file @
22cb28dc
...
@@ -55,10 +55,15 @@ class XYZControlsSizer(wx.GridBagSizer):
...
@@ -55,10 +55,15 @@ class XYZControlsSizer(wx.GridBagSizer):
self
.
Add
(
root
.
zb
,
pos
=
(
0
,
2
),
flag
=
wx
.
ALIGN_CENTER
)
self
.
Add
(
root
.
zb
,
pos
=
(
0
,
2
),
flag
=
wx
.
ALIGN_CENTER
)
wx
.
CallAfter
(
root
.
xyb
.
SetFocus
)
wx
.
CallAfter
(
root
.
xyb
.
SetFocus
)
def
add_extra_controls
(
self
,
root
,
parentpanel
,
base_line
):
def
add_extra_controls
(
self
,
root
,
parentpanel
,
extra_buttons
=
None
):
standalone_mode
=
extra_buttons
is
not
None
base_line
=
1
if
standalone_mode
else
2
root
.
monitorbox
=
wx
.
CheckBox
(
parentpanel
,
-
1
,
_
(
"Watch"
))
root
.
monitorbox
=
wx
.
CheckBox
(
parentpanel
,
-
1
,
_
(
"Watch"
))
root
.
monitorbox
.
SetValue
(
bool
(
root
.
settings
.
monitor
))
root
.
monitorbox
.
SetValue
(
bool
(
root
.
settings
.
monitor
))
root
.
monitorbox
.
SetToolTip
(
wx
.
ToolTip
(
"Monitor Temperatures in Graph"
))
root
.
monitorbox
.
SetToolTip
(
wx
.
ToolTip
(
"Monitor Temperatures in Graph"
))
if
standalone_mode
:
self
.
Add
(
root
.
monitorbox
,
pos
=
(
0
,
3
),
span
=
(
1
,
3
))
else
:
self
.
Add
(
root
.
monitorbox
,
pos
=
(
base_line
+
1
,
5
))
self
.
Add
(
root
.
monitorbox
,
pos
=
(
base_line
+
1
,
5
))
root
.
monitorbox
.
Bind
(
wx
.
EVT_CHECKBOX
,
root
.
setmonitor
)
root
.
monitorbox
.
Bind
(
wx
.
EVT_CHECKBOX
,
root
.
setmonitor
)
...
@@ -136,11 +141,12 @@ def add_extra_controls(self, root, parentpanel, base_line):
...
@@ -136,11 +141,12 @@ def add_extra_controls(self, root, parentpanel, base_line):
self
.
Add
(
root
.
efeedc
,
pos
=
(
base_line
+
3
,
2
),
span
=
(
1
,
2
),
flag
=
wx
.
EXPAND
|
wx
.
RIGHT
,
border
=
10
)
self
.
Add
(
root
.
efeedc
,
pos
=
(
base_line
+
3
,
2
),
span
=
(
1
,
2
),
flag
=
wx
.
EXPAND
|
wx
.
RIGHT
,
border
=
10
)
self
.
Add
(
wx
.
StaticText
(
parentpanel
,
-
1
,
_
(
"mm/
\n
min"
)),
pos
=
(
base_line
+
3
,
4
),
span
=
(
2
,
1
))
self
.
Add
(
wx
.
StaticText
(
parentpanel
,
-
1
,
_
(
"mm/
\n
min"
)),
pos
=
(
base_line
+
3
,
4
),
span
=
(
2
,
1
))
gauges_base_line
=
base_line
+
8
if
standalone_mode
else
base_line
+
5
if
root
.
display_gauges
:
if
root
.
display_gauges
:
root
.
hottgauge
=
TempGauge
(
parentpanel
,
size
=
(
-
1
,
24
),
title
=
_
(
"Heater:"
),
maxval
=
300
)
root
.
hottgauge
=
TempGauge
(
parentpanel
,
size
=
(
-
1
,
24
),
title
=
_
(
"Heater:"
),
maxval
=
300
)
self
.
Add
(
root
.
hottgauge
,
pos
=
(
base_line
+
5
,
0
),
span
=
(
1
,
6
),
flag
=
wx
.
EXPAND
)
self
.
Add
(
root
.
hottgauge
,
pos
=
(
gauges_base_line
+
0
,
0
),
span
=
(
1
,
6
),
flag
=
wx
.
EXPAND
)
root
.
bedtgauge
=
TempGauge
(
parentpanel
,
size
=
(
-
1
,
24
),
title
=
_
(
"Bed:"
),
maxval
=
150
)
root
.
bedtgauge
=
TempGauge
(
parentpanel
,
size
=
(
-
1
,
24
),
title
=
_
(
"Bed:"
),
maxval
=
150
)
self
.
Add
(
root
.
bedtgauge
,
pos
=
(
base_line
+
6
,
0
),
span
=
(
1
,
6
),
flag
=
wx
.
EXPAND
)
self
.
Add
(
root
.
bedtgauge
,
pos
=
(
gauges_base_line
+
1
,
0
),
span
=
(
1
,
6
),
flag
=
wx
.
EXPAND
)
def
hotendgauge_scroll_setpoint
(
e
):
def
hotendgauge_scroll_setpoint
(
e
):
rot
=
e
.
GetWheelRotation
()
rot
=
e
.
GetWheelRotation
()
if
rot
>
0
:
if
rot
>
0
:
...
@@ -155,18 +161,34 @@ def add_extra_controls(self, root, parentpanel, base_line):
...
@@ -155,18 +161,34 @@ def add_extra_controls(self, root, parentpanel, base_line):
root
.
do_settemp
(
str
(
max
(
0
,
root
.
bsetpoint
-
1
)))
root
.
do_settemp
(
str
(
max
(
0
,
root
.
bsetpoint
-
1
)))
root
.
hottgauge
.
Bind
(
wx
.
EVT_MOUSEWHEEL
,
hotendgauge_scroll_setpoint
)
root
.
hottgauge
.
Bind
(
wx
.
EVT_MOUSEWHEEL
,
hotendgauge_scroll_setpoint
)
root
.
bedtgauge
.
Bind
(
wx
.
EVT_MOUSEWHEEL
,
bedgauge_scroll_setpoint
)
root
.
bedtgauge
.
Bind
(
wx
.
EVT_MOUSEWHEEL
,
bedgauge_scroll_setpoint
)
self
.
Add
(
root
.
tempdisp
,
pos
=
(
base_line
+
7
,
0
),
span
=
(
1
,
6
))
self
.
Add
(
root
.
tempdisp
,
pos
=
(
gauges_base_line
+
2
,
0
),
span
=
(
1
,
6
))
else
:
else
:
self
.
Add
(
root
.
tempdisp
,
pos
=
(
base_line
+
5
,
0
),
span
=
(
1
,
6
))
self
.
Add
(
root
.
tempdisp
,
pos
=
(
gauges_base_line
+
0
,
0
),
span
=
(
1
,
6
))
root
.
graph
=
Graph
(
parentpanel
,
wx
.
ID_ANY
,
root
)
root
.
graph
=
Graph
(
parentpanel
,
wx
.
ID_ANY
,
root
)
if
standalone_mode
:
self
.
Add
(
root
.
graph
,
pos
=
(
base_line
+
5
,
0
),
span
=
(
3
,
6
))
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
))
class
LeftPane
(
wx
.
GridBagSizer
):
if
extra_buttons
:
pos_mapping
=
{
(
2
,
5
):(
0
,
0
),
(
4
,
0
):(
3
,
0
),
(
5
,
0
):(
4
,
0
),
}
span_mapping
=
{
(
2
,
5
):(
1
,
3
),
(
4
,
0
):(
1
,
2
),
(
5
,
0
):(
1
,
2
),
}
for
i
in
extra_buttons
:
btn
=
extra_buttons
[
i
]
self
.
Add
(
btn
,
pos
=
pos_mapping
[
i
.
pos
],
span
=
span_mapping
[
i
.
pos
],
flag
=
wx
.
EXPAND
)
extra_base_line
=
2
class
LeftPane
(
wx
.
GridBagSizer
):
def
__init__
(
self
,
root
,
parentpanel
=
None
,
extra_controls
=
Non
e
):
def
__init__
(
self
,
root
,
parentpanel
=
None
,
standalone_mode
=
Fals
e
):
super
(
LeftPane
,
self
)
.
__init__
()
super
(
LeftPane
,
self
)
.
__init__
()
if
not
parentpanel
:
parentpanel
=
root
.
panel
if
not
parentpanel
:
parentpanel
=
root
.
panel
llts
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
llts
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
...
@@ -174,6 +196,7 @@ class LeftPane(wx.GridBagSizer):
...
@@ -174,6 +196,7 @@ class LeftPane(wx.GridBagSizer):
self
.
xyzsizer
=
XYZControlsSizer
(
root
,
parentpanel
)
self
.
xyzsizer
=
XYZControlsSizer
(
root
,
parentpanel
)
self
.
Add
(
self
.
xyzsizer
,
pos
=
(
1
,
0
),
span
=
(
1
,
6
),
flag
=
wx
.
ALIGN_CENTER
)
self
.
Add
(
self
.
xyzsizer
,
pos
=
(
1
,
0
),
span
=
(
1
,
6
),
flag
=
wx
.
ALIGN_CENTER
)
self
.
extra_buttons
=
{}
for
i
in
root
.
cpbuttons
:
for
i
in
root
.
cpbuttons
:
btn
=
make_button
(
parentpanel
,
i
.
label
,
root
.
procbutton
,
i
.
tooltip
)
btn
=
make_button
(
parentpanel
,
i
.
label
,
root
.
procbutton
,
i
.
tooltip
)
btn
.
SetBackgroundColour
(
i
.
background
)
btn
.
SetBackgroundColour
(
i
.
background
)
...
@@ -184,10 +207,10 @@ class LeftPane(wx.GridBagSizer):
...
@@ -184,10 +207,10 @@ class LeftPane(wx.GridBagSizer):
if
i
.
pos
==
None
:
if
i
.
pos
==
None
:
if
i
.
span
==
0
:
if
i
.
span
==
0
:
llts
.
Add
(
btn
)
llts
.
Add
(
btn
)
elif
not
extra_controls
:
elif
not
standalone_mode
:
self
.
Add
(
btn
,
pos
=
i
.
pos
,
span
=
i
.
span
,
flag
=
wx
.
EXPAND
)
self
.
Add
(
btn
,
pos
=
i
.
pos
,
span
=
i
.
span
,
flag
=
wx
.
EXPAND
)
else
:
else
:
extra_controls
.
Add
(
btn
,
pos
=
(
i
.
pos
[
0
]
-
self
.
extra_base_line
,
i
.
pos
[
1
]),
span
=
i
.
span
,
flag
=
wx
.
EXPAND
)
self
.
extra_buttons
[
i
]
=
btn
root
.
xyfeedc
=
wx
.
SpinCtrl
(
parentpanel
,
-
1
,
str
(
root
.
settings
.
xy_feedrate
),
min
=
0
,
max
=
50000
,
size
=
(
70
,
-
1
))
root
.
xyfeedc
=
wx
.
SpinCtrl
(
parentpanel
,
-
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)"
))
root
.
xyfeedc
.
SetToolTip
(
wx
.
ToolTip
(
"Set Maximum Speed for X & Y axes (mm/min)"
))
...
@@ -205,8 +228,8 @@ class LeftPane(wx.GridBagSizer):
...
@@ -205,8 +228,8 @@ class LeftPane(wx.GridBagSizer):
root
.
zfeedc
.
SetBackgroundColour
((
180
,
255
,
180
))
root
.
zfeedc
.
SetBackgroundColour
((
180
,
255
,
180
))
root
.
zfeedc
.
SetForegroundColour
(
"black"
)
root
.
zfeedc
.
SetForegroundColour
(
"black"
)
if
not
extra_controls
:
if
not
standalone_mode
:
add_extra_controls
(
self
,
root
,
parentpanel
,
self
.
extra_base_li
ne
)
add_extra_controls
(
self
,
root
,
parentpanel
,
No
ne
)
class
NoViz
(
object
):
class
NoViz
(
object
):
...
@@ -295,12 +318,10 @@ class LogPane(wx.BoxSizer):
...
@@ -295,12 +318,10 @@ class LogPane(wx.BoxSizer):
#root.printerControls.append(root.sendbtn)
#root.printerControls.append(root.sendbtn)
self
.
Add
(
lbrs
,
0
,
wx
.
EXPAND
)
self
.
Add
(
lbrs
,
0
,
wx
.
EXPAND
)
ToolbarSizer
=
wx
.
WrapSizer
if
wx
.
VERSION
>
(
2
,
9
)
else
wx
.
BoxSizer
class
MainToolbar
(
ToolbarSizer
):
def
MainToolbar
(
root
,
parentpanel
=
None
,
use_wrapsizer
=
False
):
ToolbarSizer
=
wx
.
WrapSizer
if
use_wrapsizer
and
wx
.
VERSION
>
(
2
,
9
)
else
wx
.
BoxSizer
def
__init__
(
self
,
root
,
parentpanel
=
None
):
self
=
ToolbarSizer
(
wx
.
HORIZONTAL
)
super
(
MainToolbar
,
self
)
.
__init__
(
wx
.
HORIZONTAL
)
if
not
parentpanel
:
parentpanel
=
root
.
panel
if
not
parentpanel
:
parentpanel
=
root
.
panel
root
.
rescanbtn
=
make_sized_button
(
parentpanel
,
_
(
"Port"
),
root
.
rescanports
,
_
(
"Communication Settings
\n
Click to rescan ports"
))
root
.
rescanbtn
=
make_sized_button
(
parentpanel
,
_
(
"Port"
),
root
.
rescanports
,
_
(
"Communication Settings
\n
Click to rescan ports"
))
self
.
Add
(
root
.
rescanbtn
,
0
,
wx
.
TOP
|
wx
.
LEFT
,
0
)
self
.
Add
(
root
.
rescanbtn
,
0
,
wx
.
TOP
|
wx
.
LEFT
,
0
)
...
@@ -334,6 +355,7 @@ class MainToolbar(ToolbarSizer):
...
@@ -334,6 +355,7 @@ class MainToolbar(ToolbarSizer):
root
.
printbtn
.
Disable
()
root
.
printbtn
.
Disable
()
root
.
pausebtn
=
make_sized_button
(
parentpanel
,
_
(
"Pause"
),
root
.
pause
,
_
(
"Pause Current Print"
),
self
)
root
.
pausebtn
=
make_sized_button
(
parentpanel
,
_
(
"Pause"
),
root
.
pause
,
_
(
"Pause Current Print"
),
self
)
root
.
recoverbtn
=
make_sized_button
(
parentpanel
,
_
(
"Recover"
),
root
.
recover
,
_
(
"Recover previous Print"
),
self
)
root
.
recoverbtn
=
make_sized_button
(
parentpanel
,
_
(
"Recover"
),
root
.
recover
,
_
(
"Recover previous Print"
),
self
)
return
self
class
MainWindow
(
wx
.
Frame
):
class
MainWindow
(
wx
.
Frame
):
...
@@ -357,16 +379,17 @@ class MainWindow(wx.Frame):
...
@@ -357,16 +379,17 @@ class MainWindow(wx.Frame):
self
.
mainsizer_page1
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
self
.
mainsizer_page1
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
page1panel1
=
self
.
newPanel
(
page1panel
)
page1panel1
=
self
.
newPanel
(
page1panel
)
page1panel2
=
self
.
newPanel
(
page1panel
)
page1panel2
=
self
.
newPanel
(
page1panel
)
self
.
uppersizer
=
MainToolbar
(
self
,
page1panel1
)
self
.
uppersizer
=
MainToolbar
(
self
,
page1panel1
,
use_wrapsizer
=
True
)
page1panel1
.
SetSizer
(
self
.
uppersizer
)
page1panel1
.
SetSizer
(
self
.
uppersizer
)
self
.
mainsizer_page1
.
Add
(
page1panel1
,
0
,
wx
.
EXPAND
)
self
.
mainsizer_page1
.
Add
(
page1panel1
,
0
,
wx
.
EXPAND
)
self
.
lowersizer
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
self
.
lowersizer
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
page1panel2
.
SetSizer
(
self
.
lowersizer
)
page1panel2
.
SetSizer
(
self
.
lowersizer
)
extracontrols
=
wx
.
GridBagSizer
()
add_extra_controls
(
extracontrols
,
self
,
page1panel2
,
0
)
leftsizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
leftsizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
leftsizer
.
Add
(
LeftPane
(
self
,
page1panel2
,
extracontrols
),
1
,
wx
.
ALIGN_CENTER
)
left_pane
=
LeftPane
(
self
,
page1panel2
,
True
)
leftsizer
.
Add
(
left_pane
,
1
,
wx
.
ALIGN_CENTER
)
rightsizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
rightsizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
extracontrols
=
wx
.
GridBagSizer
()
add_extra_controls
(
extracontrols
,
self
,
page1panel2
,
left_pane
.
extra_buttons
)
rightsizer
.
Add
(
extracontrols
,
1
,
wx
.
ALIGN_CENTER
)
rightsizer
.
Add
(
extracontrols
,
1
,
wx
.
ALIGN_CENTER
)
self
.
lowersizer
.
Add
(
leftsizer
,
1
,
wx
.
ALIGN_CENTER
)
self
.
lowersizer
.
Add
(
leftsizer
,
1
,
wx
.
ALIGN_CENTER
)
self
.
lowersizer
.
Add
(
rightsizer
,
1
,
wx
.
ALIGN_CENTER
)
self
.
lowersizer
.
Add
(
rightsizer
,
1
,
wx
.
ALIGN_CENTER
)
...
...
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