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
bbcdf2f3
Commit
bbcdf2f3
authored
Sep 05, 2012
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup factorized button creation, start using it more
parent
8974ada1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
21 deletions
+16
-21
gui.py
printrun/gui.py
+16
-21
No files found.
printrun/gui.py
View file @
bbcdf2f3
...
@@ -27,6 +27,20 @@ from printrun.xybuttons import XYButtons
...
@@ -27,6 +27,20 @@ from printrun.xybuttons import XYButtons
from
printrun.zbuttons
import
ZButtons
from
printrun.zbuttons
import
ZButtons
from
printrun.graph
import
Graph
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
):
class
XYZControlsSizer
(
wx
.
GridBagSizer
):
def
__init__
(
self
,
root
):
def
__init__
(
self
,
root
):
...
@@ -47,13 +61,11 @@ class LeftPane(wx.GridBagSizer):
...
@@ -47,13 +61,11 @@ class LeftPane(wx.GridBagSizer):
self
.
Add
(
self
.
xyzsizer
,
pos
=
(
1
,
0
),
span
=
(
1
,
8
),
flag
=
wx
.
ALIGN_CENTER
)
self
.
Add
(
self
.
xyzsizer
,
pos
=
(
1
,
0
),
span
=
(
1
,
8
),
flag
=
wx
.
ALIGN_CENTER
)
for
i
in
root
.
cpbuttons
:
for
i
in
root
.
cpbuttons
:
btn
=
wx
.
Button
(
root
.
panel
,
-
1
,
i
[
0
],
style
=
wx
.
BU_EXACTFIT
)
btn
=
make_button
(
root
.
panel
,
i
[
0
],
root
.
procbutton
,
i
[
5
],
style
=
wx
.
BU_EXACTFIT
)
btn
.
SetToolTip
(
wx
.
ToolTip
(
i
[
5
]))
btn
.
SetBackgroundColour
(
i
[
3
])
btn
.
SetBackgroundColour
(
i
[
3
])
btn
.
SetForegroundColour
(
"black"
)
btn
.
SetForegroundColour
(
"black"
)
btn
.
properties
=
i
btn
.
properties
=
i
btn
.
Bind
(
wx
.
EVT_BUTTON
,
root
.
procbutton
)
root
.
btndict
[
i
[
1
]]
=
btn
root
.
btndict
[
i
[
1
]]
=
btn
root
.
printerControls
.
append
(
btn
)
root
.
printerControls
.
append
(
btn
)
if
i
[
2
]
==
None
:
if
i
[
2
]
==
None
:
if
i
[
4
]
==
0
:
if
i
[
4
]
==
0
:
...
@@ -227,23 +239,6 @@ class LogPane(wx.BoxSizer):
...
@@ -227,23 +239,6 @@ class LogPane(wx.BoxSizer):
lbrs
.
Add
(
root
.
sendbtn
)
lbrs
.
Add
(
root
.
sendbtn
)
self
.
Add
(
lbrs
,
0
,
wx
.
EXPAND
)
self
.
Add
(
lbrs
,
0
,
wx
.
EXPAND
)
def
make_button
(
parent
,
label
,
callback
,
tooltip
,
container
=
None
,
size
=
None
,
style
=
None
):
if
style
:
button
=
wx
.
Button
(
parent
,
-
1
,
label
,
style
=
style
,
size
=
size
)
else
:
button
=
wx
.
Button
(
parent
,
-
1
,
label
,
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
MainToolbar
(
wx
.
BoxSizer
):
class
MainToolbar
(
wx
.
BoxSizer
):
def
__init__
(
self
,
root
):
def
__init__
(
self
,
root
):
...
...
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