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
Show 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):
self
.
mainsizer_page1
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
page1panel1
=
self
.
newPanel
(
page1panel
)
page1panel2
=
self
.
newPanel
(
page1panel
)
self
.
uppe
rsizer
=
MainToolbar
(
self
,
page1panel1
,
use_wrapsizer
=
True
)
page1panel1
.
SetSizer
(
self
.
uppe
rsizer
)
self
.
toolba
rsizer
=
MainToolbar
(
self
,
page1panel1
,
use_wrapsizer
=
True
)
page1panel1
.
SetSizer
(
self
.
toolba
rsizer
)
self
.
mainsizer_page1
.
Add
(
page1panel1
,
0
,
wx
.
EXPAND
)
self
.
lowersizer
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
page1panel2
.
SetSizer
(
self
.
lowersizer
)
...
...
@@ -183,9 +183,9 @@ class MainWindow(wx.Frame):
self
.
mainsizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
self
.
lowersizer
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
upperpanel
=
self
.
newPanel
(
self
.
panel
,
False
)
self
.
uppe
rsizer
=
MainToolbar
(
self
,
upperpanel
)
self
.
toolba
rsizer
=
MainToolbar
(
self
,
upperpanel
)
lowerpanel
=
self
.
newPanel
(
self
.
panel
)
upperpanel
.
SetSizer
(
self
.
uppe
rsizer
)
upperpanel
.
SetSizer
(
self
.
toolba
rsizer
)
lowerpanel
.
SetSizer
(
self
.
lowersizer
)
leftpanel
=
self
.
newPanel
(
lowerpanel
)
left_pane
=
LeftPaneToggleable
(
self
,
leftpanel
,
self
.
lowersizer
)
...
...
@@ -243,7 +243,7 @@ class MainWindow(wx.Frame):
minsize
=
[
0
,
0
]
minsize
[
0
]
=
self
.
lowersizer
.
GetMinSize
()[
0
]
# lower pane
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
()
minsize
[
0
]
=
min
(
minsize
[
0
],
displaysize
[
0
])
minsize
[
1
]
=
min
(
minsize
[
1
],
displaysize
[
1
])
...
...
printrun/pronterface.py
View file @
daa62329
...
...
@@ -346,6 +346,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self
.
p
.
runSmallScript
(
self
.
endScript
)
wx
.
CallAfter
(
self
.
pausebtn
.
Disable
)
wx
.
CallAfter
(
self
.
printbtn
.
SetLabel
,
_
(
"Print"
))
wx
.
CallAfter
(
self
.
toolbarsizer
.
Layout
)
def
online
(
self
):
print
_
(
"Printer is now online."
)
...
...
@@ -364,6 +365,8 @@ class PronterWindow(MainWindow, pronsole.pronsole):
if
self
.
filename
:
self
.
printbtn
.
Enable
()
wx
.
CallAfter
(
self
.
toolbarsizer
.
Layout
)
def
sentcb
(
self
,
line
,
gline
):
if
not
gline
:
pass
...
...
@@ -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.SetForegroundColour("black")
#self.newbuttonbutton.SetSize(obj.GetSize())
#if self.
uppe
rsizer.GetItem(self.newbuttonbutton) is not None:
# self.
uppe
rsizer.SetItemMinSize(self.newbuttonbutton, obj.GetSize())
#if self.
toolba
rsizer.GetItem(self.newbuttonbutton) is not None:
# self.
toolba
rsizer.SetItemMinSize(self.newbuttonbutton, obj.GetSize())
# self.mainsizer.Layout()
for
b
in
self
.
custombuttons_widgets
:
#if b.IsFrozen(): b.Thaw()
...
...
@@ -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
.
SetForegroundColour
(
"black"
)
b
.
SetSize
(
obj
.
GetSize
())
if
self
.
uppe
rsizer
.
GetItem
(
b
)
is
not
None
:
self
.
uppe
rsizer
.
SetItemMinSize
(
b
,
obj
.
GetSize
())
if
self
.
toolba
rsizer
.
GetItem
(
b
)
is
not
None
:
self
.
toolba
rsizer
.
SetItemMinSize
(
b
,
obj
.
GetSize
())
self
.
mainsizer
.
Layout
()
# 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
)
...
...
@@ -1219,9 +1222,9 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
break
#if dst is None and self.panel.GetScreenRect().Contains(scrpos):
# # 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())
# 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()))
# lbrect = btns[-1].GetScreenRect()
# p = scrpos.Get()
...
...
@@ -1680,11 +1683,13 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
except
:
self
.
filename
=
fn
wx
.
CallAfter
(
self
.
loadbtn
.
SetLabel
,
_
(
"Load File"
))
wx
.
CallAfter
(
self
.
toolbarsizer
.
Layout
)
self
.
skeining
=
0
self
.
skeinp
=
None
def
skein
(
self
,
filename
):
wx
.
CallAfter
(
self
.
loadbtn
.
SetLabel
,
_
(
"Cancel"
))
wx
.
CallAfter
(
self
.
toolbarsizer
.
Layout
)
print
_
(
"Slicing "
)
+
filename
self
.
cout
=
StringIO
.
StringIO
()
self
.
filename
=
filename
...
...
@@ -1768,6 +1773,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
wx
.
CallAfter
(
self
.
recoverbtn
.
Disable
)
if
self
.
p
.
online
:
wx
.
CallAfter
(
self
.
printbtn
.
Enable
)
wx
.
CallAfter
(
self
.
toolbarsizer
.
Layout
)
self
.
post_gcode_load
()
else
:
dlg
.
Destroy
()
...
...
@@ -1818,6 +1824,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
wx
.
CallAfter
(
self
.
pausebtn
.
SetLabel
,
_
(
"Pause"
))
wx
.
CallAfter
(
self
.
pausebtn
.
Enable
)
wx
.
CallAfter
(
self
.
printbtn
.
SetLabel
,
_
(
"Restart"
))
wx
.
CallAfter
(
self
.
toolbarsizer
.
Layout
)
def
endupload
(
self
):
self
.
p
.
send_now
(
"M29 "
)
...
...
@@ -1862,6 +1869,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
#self.p.runSmallScript(self.pauseScript)
self
.
extra_print_time
+=
int
(
time
.
time
()
-
self
.
starttime
)
wx
.
CallAfter
(
self
.
pausebtn
.
SetLabel
,
_
(
"Resume"
))
wx
.
CallAfter
(
self
.
toolbarsizer
.
Layout
)
else
:
print
_
(
"Resuming."
)
self
.
paused
=
False
...
...
@@ -1870,6 +1878,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
else
:
self
.
p
.
resume
()
wx
.
CallAfter
(
self
.
pausebtn
.
SetLabel
,
_
(
"Pause"
))
wx
.
CallAfter
(
self
.
toolbarsizer
.
Layout
)
def
sdprintfile
(
self
,
event
):
self
.
on_startprint
()
...
...
@@ -1895,6 +1904,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
self
.
p
.
printing
=
0
wx
.
CallAfter
(
self
.
pausebtn
.
SetLabel
,
_
(
"Pause"
))
wx
.
CallAfter
(
self
.
printbtn
.
SetLabel
,
_
(
"Print"
))
wx
.
CallAfter
(
self
.
toolbarsizer
.
Layout
)
self
.
paused
=
0
if
self
.
sdprinting
:
self
.
p
.
send_now
(
"M26 S0"
)
...
...
@@ -1969,6 +1979,9 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
if
self
.
sdprinting
:
self
.
p
.
send_now
(
"M26 S0"
)
# Relayout the toolbar to handle new buttons size
wx
.
CallAfter
(
self
.
toolbarsizer
.
Layout
)
def
reset
(
self
,
event
):
print
_
(
"Reset."
)
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/>."""
self
.
p
.
paused
=
0
wx
.
CallAfter
(
self
.
pausebtn
.
SetLabel
,
_
(
"Pause"
))
self
.
paused
=
0
wx
.
CallAfter
(
self
.
toolbarsizer
.
Layout
)
dlg
.
Destroy
()
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