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
daa62329
Commit
daa62329
authored
Mar 28, 2014
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename uppersizer to toolbarsizer and relayout it when changing buttons
parent
f80bc8c4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
11 deletions
+25
-11
__init__.py
printrun/gui/__init__.py
+5
-5
pronterface.py
printrun/pronterface.py
+20
-6
No files found.
printrun/gui/__init__.py
View file @
daa62329
...
@@ -122,8 +122,8 @@ class MainWindow(wx.Frame):
...
@@ -122,8 +122,8 @@ 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
.
uppe
rsizer
=
MainToolbar
(
self
,
page1panel1
,
use_wrapsizer
=
True
)
self
.
toolba
rsizer
=
MainToolbar
(
self
,
page1panel1
,
use_wrapsizer
=
True
)
page1panel1
.
SetSizer
(
self
.
uppe
rsizer
)
page1panel1
.
SetSizer
(
self
.
toolba
rsizer
)
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
)
...
@@ -183,9 +183,9 @@ class MainWindow(wx.Frame):
...
@@ -183,9 +183,9 @@ class MainWindow(wx.Frame):
self
.
mainsizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
self
.
mainsizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
self
.
lowersizer
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
self
.
lowersizer
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
upperpanel
=
self
.
newPanel
(
self
.
panel
,
False
)
upperpanel
=
self
.
newPanel
(
self
.
panel
,
False
)
self
.
uppe
rsizer
=
MainToolbar
(
self
,
upperpanel
)
self
.
toolba
rsizer
=
MainToolbar
(
self
,
upperpanel
)
lowerpanel
=
self
.
newPanel
(
self
.
panel
)
lowerpanel
=
self
.
newPanel
(
self
.
panel
)
upperpanel
.
SetSizer
(
self
.
uppe
rsizer
)
upperpanel
.
SetSizer
(
self
.
toolba
rsizer
)
lowerpanel
.
SetSizer
(
self
.
lowersizer
)
lowerpanel
.
SetSizer
(
self
.
lowersizer
)
leftpanel
=
self
.
newPanel
(
lowerpanel
)
leftpanel
=
self
.
newPanel
(
lowerpanel
)
left_pane
=
LeftPaneToggleable
(
self
,
leftpanel
,
self
.
lowersizer
)
left_pane
=
LeftPaneToggleable
(
self
,
leftpanel
,
self
.
lowersizer
)
...
@@ -243,7 +243,7 @@ class MainWindow(wx.Frame):
...
@@ -243,7 +243,7 @@ class MainWindow(wx.Frame):
minsize
=
[
0
,
0
]
minsize
=
[
0
,
0
]
minsize
[
0
]
=
self
.
lowersizer
.
GetMinSize
()[
0
]
# lower pane
minsize
[
0
]
=
self
.
lowersizer
.
GetMinSize
()[
0
]
# lower pane
minsize
[
1
]
=
max
(
viz_pane
.
GetMinSize
()[
1
],
controls_sizer
.
GetMinSize
()[
1
])
minsize
[
1
]
=
max
(
viz_pane
.
GetMinSize
()[
1
],
controls_sizer
.
GetMinSize
()[
1
])
minsize
[
1
]
+=
self
.
uppe
rsizer
.
GetMinSize
()[
1
]
# toolbar height
minsize
[
1
]
+=
self
.
toolba
rsizer
.
GetMinSize
()[
1
]
# toolbar height
displaysize
=
wx
.
DisplaySize
()
displaysize
=
wx
.
DisplaySize
()
minsize
[
0
]
=
min
(
minsize
[
0
],
displaysize
[
0
])
minsize
[
0
]
=
min
(
minsize
[
0
],
displaysize
[
0
])
minsize
[
1
]
=
min
(
minsize
[
1
],
displaysize
[
1
])
minsize
[
1
]
=
min
(
minsize
[
1
],
displaysize
[
1
])
...
...
printrun/pronterface.py
View file @
daa62329
...
@@ -346,6 +346,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
...
@@ -346,6 +346,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self
.
p
.
runSmallScript
(
self
.
endScript
)
self
.
p
.
runSmallScript
(
self
.
endScript
)
wx
.
CallAfter
(
self
.
pausebtn
.
Disable
)
wx
.
CallAfter
(
self
.
pausebtn
.
Disable
)
wx
.
CallAfter
(
self
.
printbtn
.
SetLabel
,
_
(
"Print"
))
wx
.
CallAfter
(
self
.
printbtn
.
SetLabel
,
_
(
"Print"
))
wx
.
CallAfter
(
self
.
toolbarsizer
.
Layout
)
def
online
(
self
):
def
online
(
self
):
print
_
(
"Printer is now online."
)
print
_
(
"Printer is now online."
)
...
@@ -364,6 +365,8 @@ class PronterWindow(MainWindow, pronsole.pronsole):
...
@@ -364,6 +365,8 @@ class PronterWindow(MainWindow, pronsole.pronsole):
if
self
.
filename
:
if
self
.
filename
:
self
.
printbtn
.
Enable
()
self
.
printbtn
.
Enable
()
wx
.
CallAfter
(
self
.
toolbarsizer
.
Layout
)
def
sentcb
(
self
,
line
,
gline
):
def
sentcb
(
self
,
line
,
gline
):
if
not
gline
:
if
not
gline
:
pass
pass
...
@@ -1180,8 +1183,8 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
...
@@ -1180,8 +1183,8 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
#self.newbuttonbutton.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
#self.newbuttonbutton.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
#self.newbuttonbutton.SetForegroundColour("black")
#self.newbuttonbutton.SetForegroundColour("black")
#self.newbuttonbutton.SetSize(obj.GetSize())
#self.newbuttonbutton.SetSize(obj.GetSize())
#if self.
uppe
rsizer.GetItem(self.newbuttonbutton) is not None:
#if self.
toolba
rsizer.GetItem(self.newbuttonbutton) is not None:
# self.
uppe
rsizer.SetItemMinSize(self.newbuttonbutton, obj.GetSize())
# self.
toolba
rsizer.SetItemMinSize(self.newbuttonbutton, obj.GetSize())
# self.mainsizer.Layout()
# self.mainsizer.Layout()
for
b
in
self
.
custombuttons_widgets
:
for
b
in
self
.
custombuttons_widgets
:
#if b.IsFrozen(): b.Thaw()
#if b.IsFrozen(): b.Thaw()
...
@@ -1191,8 +1194,8 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
...
@@ -1191,8 +1194,8 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
b
.
SetFont
(
wx
.
Font
(
10
,
wx
.
FONTFAMILY_DEFAULT
,
wx
.
FONTSTYLE_NORMAL
,
wx
.
FONTWEIGHT_NORMAL
))
b
.
SetFont
(
wx
.
Font
(
10
,
wx
.
FONTFAMILY_DEFAULT
,
wx
.
FONTSTYLE_NORMAL
,
wx
.
FONTWEIGHT_NORMAL
))
b
.
SetForegroundColour
(
"black"
)
b
.
SetForegroundColour
(
"black"
)
b
.
SetSize
(
obj
.
GetSize
())
b
.
SetSize
(
obj
.
GetSize
())
if
self
.
uppe
rsizer
.
GetItem
(
b
)
is
not
None
:
if
self
.
toolba
rsizer
.
GetItem
(
b
)
is
not
None
:
self
.
uppe
rsizer
.
SetItemMinSize
(
b
,
obj
.
GetSize
())
self
.
toolba
rsizer
.
SetItemMinSize
(
b
,
obj
.
GetSize
())
self
.
mainsizer
.
Layout
()
self
.
mainsizer
.
Layout
()
# b.SetStyle(wx.ALIGN_CENTRE+wx.ST_NO_AUTORESIZE+wx.SIMPLE_BORDER)
# b.SetStyle(wx.ALIGN_CENTRE+wx.ST_NO_AUTORESIZE+wx.SIMPLE_BORDER)
self
.
dragging
=
wx
.
Button
(
self
.
panel
,
-
1
,
obj
.
GetLabel
(),
style
=
wx
.
BU_EXACTFIT
)
self
.
dragging
=
wx
.
Button
(
self
.
panel
,
-
1
,
obj
.
GetLabel
(),
style
=
wx
.
BU_EXACTFIT
)
...
@@ -1219,9 +1222,9 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
...
@@ -1219,9 +1222,9 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
break
break
#if dst is None and self.panel.GetScreenRect().Contains(scrpos):
#if dst is None and self.panel.GetScreenRect().Contains(scrpos):
# # try to check if it is after buttons at the end
# # try to check if it is after buttons at the end
# tspos = self.panel.ClientToScreen(self.
uppe
rsizer.GetPosition())
# tspos = self.panel.ClientToScreen(self.
toolba
rsizer.GetPosition())
# bspos = self.panel.ClientToScreen(self.centersizer.GetPosition())
# bspos = self.panel.ClientToScreen(self.centersizer.GetPosition())
# tsrect = wx.Rect(*(tspos.Get()+self.
uppe
rsizer.GetSize().Get()))
# tsrect = wx.Rect(*(tspos.Get()+self.
toolba
rsizer.GetSize().Get()))
# bsrect = wx.Rect(*(bspos.Get()+self.centersizer.GetSize().Get()))
# bsrect = wx.Rect(*(bspos.Get()+self.centersizer.GetSize().Get()))
# lbrect = btns[-1].GetScreenRect()
# lbrect = btns[-1].GetScreenRect()
# p = scrpos.Get()
# p = scrpos.Get()
...
@@ -1680,11 +1683,13 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
...
@@ -1680,11 +1683,13 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
except
:
except
:
self
.
filename
=
fn
self
.
filename
=
fn
wx
.
CallAfter
(
self
.
loadbtn
.
SetLabel
,
_
(
"Load File"
))
wx
.
CallAfter
(
self
.
loadbtn
.
SetLabel
,
_
(
"Load File"
))
wx
.
CallAfter
(
self
.
toolbarsizer
.
Layout
)
self
.
skeining
=
0
self
.
skeining
=
0
self
.
skeinp
=
None
self
.
skeinp
=
None
def
skein
(
self
,
filename
):
def
skein
(
self
,
filename
):
wx
.
CallAfter
(
self
.
loadbtn
.
SetLabel
,
_
(
"Cancel"
))
wx
.
CallAfter
(
self
.
loadbtn
.
SetLabel
,
_
(
"Cancel"
))
wx
.
CallAfter
(
self
.
toolbarsizer
.
Layout
)
print
_
(
"Slicing "
)
+
filename
print
_
(
"Slicing "
)
+
filename
self
.
cout
=
StringIO
.
StringIO
()
self
.
cout
=
StringIO
.
StringIO
()
self
.
filename
=
filename
self
.
filename
=
filename
...
@@ -1768,6 +1773,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
...
@@ -1768,6 +1773,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
wx
.
CallAfter
(
self
.
recoverbtn
.
Disable
)
wx
.
CallAfter
(
self
.
recoverbtn
.
Disable
)
if
self
.
p
.
online
:
if
self
.
p
.
online
:
wx
.
CallAfter
(
self
.
printbtn
.
Enable
)
wx
.
CallAfter
(
self
.
printbtn
.
Enable
)
wx
.
CallAfter
(
self
.
toolbarsizer
.
Layout
)
self
.
post_gcode_load
()
self
.
post_gcode_load
()
else
:
else
:
dlg
.
Destroy
()
dlg
.
Destroy
()
...
@@ -1818,6 +1824,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
...
@@ -1818,6 +1824,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
wx
.
CallAfter
(
self
.
pausebtn
.
SetLabel
,
_
(
"Pause"
))
wx
.
CallAfter
(
self
.
pausebtn
.
SetLabel
,
_
(
"Pause"
))
wx
.
CallAfter
(
self
.
pausebtn
.
Enable
)
wx
.
CallAfter
(
self
.
pausebtn
.
Enable
)
wx
.
CallAfter
(
self
.
printbtn
.
SetLabel
,
_
(
"Restart"
))
wx
.
CallAfter
(
self
.
printbtn
.
SetLabel
,
_
(
"Restart"
))
wx
.
CallAfter
(
self
.
toolbarsizer
.
Layout
)
def
endupload
(
self
):
def
endupload
(
self
):
self
.
p
.
send_now
(
"M29 "
)
self
.
p
.
send_now
(
"M29 "
)
...
@@ -1862,6 +1869,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
...
@@ -1862,6 +1869,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
#self.p.runSmallScript(self.pauseScript)
#self.p.runSmallScript(self.pauseScript)
self
.
extra_print_time
+=
int
(
time
.
time
()
-
self
.
starttime
)
self
.
extra_print_time
+=
int
(
time
.
time
()
-
self
.
starttime
)
wx
.
CallAfter
(
self
.
pausebtn
.
SetLabel
,
_
(
"Resume"
))
wx
.
CallAfter
(
self
.
pausebtn
.
SetLabel
,
_
(
"Resume"
))
wx
.
CallAfter
(
self
.
toolbarsizer
.
Layout
)
else
:
else
:
print
_
(
"Resuming."
)
print
_
(
"Resuming."
)
self
.
paused
=
False
self
.
paused
=
False
...
@@ -1870,6 +1878,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
...
@@ -1870,6 +1878,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
else
:
else
:
self
.
p
.
resume
()
self
.
p
.
resume
()
wx
.
CallAfter
(
self
.
pausebtn
.
SetLabel
,
_
(
"Pause"
))
wx
.
CallAfter
(
self
.
pausebtn
.
SetLabel
,
_
(
"Pause"
))
wx
.
CallAfter
(
self
.
toolbarsizer
.
Layout
)
def
sdprintfile
(
self
,
event
):
def
sdprintfile
(
self
,
event
):
self
.
on_startprint
()
self
.
on_startprint
()
...
@@ -1895,6 +1904,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
...
@@ -1895,6 +1904,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
self
.
p
.
printing
=
0
self
.
p
.
printing
=
0
wx
.
CallAfter
(
self
.
pausebtn
.
SetLabel
,
_
(
"Pause"
))
wx
.
CallAfter
(
self
.
pausebtn
.
SetLabel
,
_
(
"Pause"
))
wx
.
CallAfter
(
self
.
printbtn
.
SetLabel
,
_
(
"Print"
))
wx
.
CallAfter
(
self
.
printbtn
.
SetLabel
,
_
(
"Print"
))
wx
.
CallAfter
(
self
.
toolbarsizer
.
Layout
)
self
.
paused
=
0
self
.
paused
=
0
if
self
.
sdprinting
:
if
self
.
sdprinting
:
self
.
p
.
send_now
(
"M26 S0"
)
self
.
p
.
send_now
(
"M26 S0"
)
...
@@ -1969,6 +1979,9 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
...
@@ -1969,6 +1979,9 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
if
self
.
sdprinting
:
if
self
.
sdprinting
:
self
.
p
.
send_now
(
"M26 S0"
)
self
.
p
.
send_now
(
"M26 S0"
)
# Relayout the toolbar to handle new buttons size
wx
.
CallAfter
(
self
.
toolbarsizer
.
Layout
)
def
reset
(
self
,
event
):
def
reset
(
self
,
event
):
print
_
(
"Reset."
)
print
_
(
"Reset."
)
dlg
=
wx
.
MessageDialog
(
self
,
_
(
"Are you sure you want to reset the printer?"
),
_
(
"Reset?"
),
wx
.
YES
|
wx
.
NO
)
dlg
=
wx
.
MessageDialog
(
self
,
_
(
"Are you sure you want to reset the printer?"
),
_
(
"Reset?"
),
wx
.
YES
|
wx
.
NO
)
...
@@ -1982,6 +1995,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
...
@@ -1982,6 +1995,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
self
.
p
.
paused
=
0
self
.
p
.
paused
=
0
wx
.
CallAfter
(
self
.
pausebtn
.
SetLabel
,
_
(
"Pause"
))
wx
.
CallAfter
(
self
.
pausebtn
.
SetLabel
,
_
(
"Pause"
))
self
.
paused
=
0
self
.
paused
=
0
wx
.
CallAfter
(
self
.
toolbarsizer
.
Layout
)
dlg
.
Destroy
()
dlg
.
Destroy
()
def
lock
(
self
,
event
=
None
,
force
=
None
):
def
lock
(
self
,
event
=
None
,
force
=
None
):
...
...
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