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
ad02e645
Commit
ad02e645
authored
Nov 06, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'cbuttonwinfix'
parents
9a311ff2
a9d0eca4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
18 deletions
+21
-18
gui.py
printrun/gui.py
+4
-1
pronterface.py
printrun/pronterface.py
+17
-17
No files found.
printrun/gui.py
View file @
ad02e645
...
@@ -497,6 +497,8 @@ class MainWindow(wx.Frame):
...
@@ -497,6 +497,8 @@ class MainWindow(wx.Frame):
self
.
Bind
(
wx
.
EVT_CLOSE
,
self
.
kill
)
self
.
Bind
(
wx
.
EVT_CLOSE
,
self
.
kill
)
# Custom buttons
# Custom buttons
if
wx
.
VERSION
>
(
2
,
9
):
self
.
centersizer
=
wx
.
WrapSizer
(
wx
.
HORIZONTAL
)
else
:
self
.
centersizer
=
wx
.
GridBagSizer
()
self
.
centersizer
=
wx
.
GridBagSizer
()
self
.
centersizer
=
wx
.
GridBagSizer
()
self
.
centerpanel
=
self
.
newPanel
(
page1panel2
)
self
.
centerpanel
=
self
.
newPanel
(
page1panel2
)
self
.
centerpanel
.
SetSizer
(
self
.
centersizer
)
self
.
centerpanel
.
SetSizer
(
self
.
centersizer
)
...
@@ -546,7 +548,8 @@ class MainWindow(wx.Frame):
...
@@ -546,7 +548,8 @@ class MainWindow(wx.Frame):
logpanel
=
self
.
newPanel
(
lowerpanel
)
logpanel
=
self
.
newPanel
(
lowerpanel
)
viz_pane
=
VizPane
(
self
,
vizpanel
)
viz_pane
=
VizPane
(
self
,
vizpanel
)
# Custom buttons
# Custom buttons
self
.
centersizer
=
wx
.
GridBagSizer
()
if
wx
.
VERSION
>
(
2
,
9
):
self
.
centersizer
=
wx
.
WrapSizer
(
wx
.
HORIZONTAL
)
else
:
self
.
centersizer
=
wx
.
GridBagSizer
()
self
.
centerpanel
=
self
.
newPanel
(
vizpanel
)
self
.
centerpanel
=
self
.
newPanel
(
vizpanel
)
self
.
centerpanel
.
SetSizer
(
self
.
centersizer
)
self
.
centerpanel
.
SetSizer
(
self
.
centersizer
)
viz_pane
.
Add
(
self
.
centerpanel
,
0
,
flag
=
wx
.
ALIGN_CENTER
)
viz_pane
.
Add
(
self
.
centerpanel
,
0
,
flag
=
wx
.
ALIGN_CENTER
)
...
...
printrun/pronterface.py
View file @
ad02e645
...
@@ -875,15 +875,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
...
@@ -875,15 +875,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
self
.
custombuttonbuttons
=
[]
self
.
custombuttonbuttons
=
[]
custombuttons
=
self
.
custombuttons
[:]
+
[
None
]
custombuttons
=
self
.
custombuttons
[:]
+
[
None
]
for
i
,
btndef
in
enumerate
(
custombuttons
):
for
i
,
btndef
in
enumerate
(
custombuttons
):
try
:
if
btndef
is
None
:
b
=
wx
.
Button
(
self
.
centerpanel
,
-
1
,
btndef
.
label
,
style
=
wx
.
BU_EXACTFIT
)
b
.
SetToolTip
(
wx
.
ToolTip
(
_
(
"Execute command: "
)
+
btndef
.
command
))
if
btndef
.
background
:
b
.
SetBackgroundColour
(
btndef
.
background
)
rr
,
gg
,
bb
=
b
.
GetBackgroundColour
()
.
Get
()
if
0.3
*
rr
+
0.59
*
gg
+
0.11
*
bb
<
60
:
b
.
SetForegroundColour
(
"#ffffff"
)
except
:
if
i
==
len
(
custombuttons
)
-
1
:
if
i
==
len
(
custombuttons
)
-
1
:
self
.
newbuttonbutton
=
b
=
wx
.
Button
(
self
.
centerpanel
,
-
1
,
"+"
,
size
=
(
19
,
18
),
style
=
wx
.
BU_EXACTFIT
)
self
.
newbuttonbutton
=
b
=
wx
.
Button
(
self
.
centerpanel
,
-
1
,
"+"
,
size
=
(
19
,
18
),
style
=
wx
.
BU_EXACTFIT
)
#b.SetFont(wx.Font(12, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD))
#b.SetFont(wx.Font(12, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD))
...
@@ -891,18 +883,26 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
...
@@ -891,18 +883,26 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
b
.
SetToolTip
(
wx
.
ToolTip
(
_
(
"click to add new custom button"
)))
b
.
SetToolTip
(
wx
.
ToolTip
(
_
(
"click to add new custom button"
)))
b
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
cbutton_edit
)
b
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
cbutton_edit
)
else
:
else
:
b
=
wx
.
Button
(
self
.
centerpanel
,
-
1
,
"."
,
size
=
(
1
,
1
))
b
=
wx
.
StaticText
(
self
.
panel
,
-
1
,
""
)
#b = wx.StaticText(self.panel,-1, "", size = (72, 22), style = wx.ALIGN_CENTRE+wx.ST_NO_AUTORESIZE) #+wx.SIMPLE_BORDER
else
:
b
.
Disable
()
b
=
wx
.
Button
(
self
.
centerpanel
,
-
1
,
btndef
.
label
,
style
=
wx
.
BU_EXACTFIT
)
#continue
b
.
SetToolTip
(
wx
.
ToolTip
(
_
(
"Execute command: "
)
+
btndef
.
command
))
b
.
custombutton
=
i
if
btndef
.
background
:
b
.
properties
=
btndef
b
.
SetBackgroundColour
(
btndef
.
background
)
rr
,
gg
,
bb
=
b
.
GetBackgroundColour
()
.
Get
()
if
0.3
*
rr
+
0.59
*
gg
+
0.11
*
bb
<
60
:
b
.
SetForegroundColour
(
"#ffffff"
)
b
.
custombutton
=
i
b
.
properties
=
btndef
if
btndef
is
not
None
:
if
btndef
is
not
None
:
b
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
procbutton
)
b
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
procbutton
)
b
.
Bind
(
wx
.
EVT_MOUSE_EVENTS
,
self
.
editbutton
)
b
.
Bind
(
wx
.
EVT_MOUSE_EVENTS
,
self
.
editbutton
)
self
.
custombuttonbuttons
.
append
(
b
)
self
.
custombuttonbuttons
.
append
(
b
)
self
.
centersizer
.
Add
(
b
,
pos
=
(
i
//
4
,
i
%
4
))
if
type
(
self
.
centersizer
)
==
wx
.
GridBagSizer
:
self
.
panel
.
GetSizer
()
.
Layout
()
self
.
centersizer
.
Add
(
b
,
pos
=
(
i
//
4
,
i
%
4
),
flag
=
wx
.
EXPAND
)
else
:
self
.
centersizer
.
Add
(
b
,
flag
=
wx
.
EXPAND
)
self
.
Fit
()
def
help_button
(
self
):
def
help_button
(
self
):
print
_
(
'Defines custom button. Usage: button <num> "title" [/c "colour"] command'
)
print
_
(
'Defines custom button. Usage: button <num> "title" [/c "colour"] command'
)
...
...
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