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
88a7b10c
Commit
88a7b10c
authored
Sep 04, 2011
by
Kliment Yanev
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:kliment/Printrun
parents
895a958e
6e0d5a70
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
52 deletions
+42
-52
.pronsolerc.example
.pronsolerc.example
+15
-0
gviz.py
gviz.py
+7
-29
pronterface.py
pronterface.py
+20
-23
No files found.
.pronsolerc.example
View file @
88a7b10c
# Sample .pronsolerc file - copy this into your home directory and rename it to .pronsolerc
!print "Loaded " + self.rc_filename
macro loud
!if self.p.loud:
!self.p.loud = 0
...
...
@@ -10,3 +11,17 @@ macro loud
!if hasattr(self,"cur_button") and self.cur_button is not None:
!self.onecmd('button %d "loud (on)" /c yellow loud' % self.cur_button)
button 0 "loud (off)" /c "green" loud
macro fan
!global _fan
!if '_fan' in globals() and _fan:
!_fan = 0
M107
!if hasattr(self,"cur_button") and self.cur_button is not None:
!self.onecmd('button %d "fan (off)" /c green fan' % self.cur_button)
!else:
!_fan = 1
M106
!if hasattr(self,"cur_button") and self.cur_button is not None:
!self.onecmd('button %d "fan (on)" /c yellow fan' % self.cur_button)
button 1 "fan (off)" /c "green" fan
gviz.py
View file @
88a7b10c
...
...
@@ -3,7 +3,7 @@ import wx,time
class
window
(
wx
.
Frame
):
def
__init__
(
self
,
f
,
size
=
(
600
,
600
),
bedsize
=
(
200
,
200
),
grid
=
(
10
,
50
),
extrusion_width
=
0.5
):
wx
.
Frame
.
__init__
(
self
,
None
,
title
=
"Layer view (Use shift+mousewheel to switch layers)"
,
size
=
(
size
[
0
],
size
[
1
]))
self
.
p
=
gviz
(
self
,
size
=
size
,
bedsize
=
bedsize
,
grid
=
grid
,
extrusion_width
=
extrusion_width
,
keepProportions
=
0
)
self
.
p
=
gviz
(
self
,
size
=
size
,
bedsize
=
bedsize
,
grid
=
grid
,
extrusion_width
=
extrusion_width
)
s
=
time
.
time
()
for
i
in
f
:
self
.
p
.
addgcode
(
i
)
...
...
@@ -15,7 +15,7 @@ class window(wx.Frame):
self
.
Bind
(
wx
.
EVT_MOUSEWHEEL
,
self
.
zoom
)
self
.
p
.
Bind
(
wx
.
EVT_MOUSE_EVENTS
,
self
.
mouse
)
self
.
Bind
(
wx
.
EVT_MOUSE_EVENTS
,
self
.
mouse
)
def
mouse
(
self
,
event
):
if
event
.
ButtonUp
(
wx
.
MOUSE_BTN_LEFT
):
if
(
self
.
initpos
is
not
None
):
...
...
@@ -53,12 +53,11 @@ class window(wx.Frame):
elif
z
<
0
:
self
.
p
.
zoom
(
event
.
GetX
(),
event
.
GetY
(),
1
/
1.2
)
class
gviz
(
wx
.
Panel
):
def
__init__
(
self
,
parent
,
size
=
(
200
,
200
),
bedsize
=
(
200
,
200
),
grid
=
(
10
,
50
),
extrusion_width
=
0.5
,
keepProportions
=
1
):
wx
.
Panel
.
__init__
(
self
,
parent
,
-
1
)
def
__init__
(
self
,
parent
,
size
=
(
200
,
200
),
bedsize
=
(
200
,
200
),
grid
=
(
10
,
50
),
extrusion_width
=
0.5
):
wx
.
Panel
.
__init__
(
self
,
parent
,
-
1
,
size
=
(
size
[
0
],
size
[
1
])
)
self
.
size
=
size
self
.
bedsize
=
bedsize
self
.
grid
=
grid
self
.
keepProportions
=
keepProportions
self
.
lastpos
=
[
0
,
0
,
0
,
0
,
0
]
self
.
hilightpos
=
self
.
lastpos
[:]
self
.
Bind
(
wx
.
EVT_PAINT
,
self
.
paint
)
...
...
@@ -68,7 +67,7 @@ class gviz(wx.Panel):
self
.
layers
=
[]
self
.
layerindex
=
0
self
.
filament_width
=
extrusion_width
# set it to 0 to disable scaling lines with zoom
self
.
calculatScale
()
self
.
scale
=
[
min
(
float
(
size
[
0
])
/
bedsize
[
0
],
float
(
size
[
1
])
/
bedsize
[
1
])]
*
2
penwidth
=
max
(
1.0
,
self
.
filament_width
*
((
self
.
scale
[
0
]
+
self
.
scale
[
1
])
/
2.0
))
self
.
translate
=
[
0.0
,
0.0
]
self
.
mainpen
=
wx
.
Pen
(
wx
.
Colour
(
0
,
0
,
0
),
penwidth
)
...
...
@@ -121,30 +120,9 @@ class gviz(wx.Panel):
#self.dirty=1
self
.
repaint
()
self
.
Refresh
()
def
calculatScale
(
self
):
self
.
scale
=
[
min
(
float
(
self
.
size
[
0
])
/
self
.
bedsize
[
0
],
float
(
self
.
size
[
1
])
/
self
.
bedsize
[
1
])]
*
2
def
setBedsize
(
self
,
width
,
height
):
self
.
bedsize
=
(
width
,
height
)
self
.
repaint
()
self
.
Refresh
()
def
adjustSize
(
self
):
width
=
self
.
size
[
0
]
height
=
self
.
size
[
1
]
wtoh
=
self
.
bedsize
[
1
]
/
self
.
bedsize
[
0
]
if
(
width
*
wtoh
>
height
):
self
.
size
[
0
]
=
height
/
wtoh
elif
(
height
/
wtoh
>
width
):
self
.
size
[
1
]
=
width
*
wtoh
def
repaint
(
self
):
self
.
size
=
self
.
GetSize
()
if
self
.
keepProportions
:
self
.
adjustSize
()
self
.
calculatScale
()
self
.
blitmap
=
wx
.
EmptyBitmap
(
self
.
size
[
0
],
self
.
size
[
1
],
-
1
)
self
.
blitmap
=
wx
.
EmptyBitmap
(
self
.
GetClientSize
()[
0
],
self
.
GetClientSize
()[
1
],
-
1
)
dc
=
wx
.
MemoryDC
()
dc
.
SelectObject
(
self
.
blitmap
)
dc
.
SetBackground
(
wx
.
Brush
((
250
,
250
,
200
)))
...
...
pronterface.py
View file @
88a7b10c
...
...
@@ -368,7 +368,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
#sizer layout: topsizer is a column sizer containing two sections
#upper section contains the mini view buttons
#lower section contains the rest of the window - manual controls, console, visualizations
#TOP
button
ROW:
#TOP ROW:
uts
=
self
.
uppertopsizer
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
uts
.
Add
(
wx
.
StaticText
(
self
.
panel
,
-
1
,
_
(
"Port:"
),
pos
=
(
0
,
5
)),
wx
.
TOP
|
wx
.
LEFT
,
5
)
scan
=
self
.
scanserial
()
...
...
@@ -415,8 +415,9 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
uts
.
Add
((
15
,
-
1
),
flag
=
wx
.
EXPAND
)
uts
.
Add
(
self
.
minibtn
)
#SECOND
button
ROW
#SECOND ROW
ubs
=
self
.
upperbottomsizer
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
self
.
loadbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Load file"
),
pos
=
(
0
,
40
))
self
.
loadbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
loadfile
)
ubs
.
Add
(
self
.
loadbtn
)
...
...
@@ -436,31 +437,30 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
pausebtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
pause
)
ubs
.
Add
(
self
.
pausebtn
)
ubs
.
Add
((
50
,
-
1
),
flag
=
wx
.
EXPAND
)
#Log panel full view
#Right full view
lrs
=
self
.
lowerrsizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
self
.
logbox
=
wx
.
TextCtrl
(
self
.
panel
,
style
=
wx
.
TE_MULTILINE
)
#,
size=(350,340),pos=(440,75),style = wx.TE_MULTILINE)
self
.
logbox
=
wx
.
TextCtrl
(
self
.
panel
,
size
=
(
350
,
340
),
pos
=
(
440
,
75
),
style
=
wx
.
TE_MULTILINE
)
self
.
logbox
.
SetEditable
(
0
)
lrs
.
Add
(
self
.
logbox
,
1
,
flag
=
wx
.
EXPAND
)
lrs
.
Add
(
self
.
logbox
)
lbrs
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
self
.
commandbox
=
wx
.
TextCtrl
(
self
.
panel
,
style
=
wx
.
TE_PROCESS_ENTER
)
#,
size=(250,30),pos=(440,420),style = wx.TE_PROCESS_ENTER)
self
.
commandbox
.
Bind
(
wx
.
EVT_TEXT_ENTER
,
self
.
sendline
)
self
.
commandbox
=
wx
.
TextCtrl
(
self
.
panel
,
size
=
(
250
,
30
),
pos
=
(
440
,
420
),
style
=
wx
.
TE_PROCESS_ENTER
)
self
.
commandbox
.
Bind
(
wx
.
EVT_TEXT_ENTER
,
self
.
sendline
)
#self.printerControls.append(self.commandbox)
lbrs
.
Add
(
self
.
commandbox
,
1
,
flag
=
wx
.
EXPAND
)
self
.
sendbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Send"
))
#
,pos=(700,420))
lbrs
.
Add
(
self
.
commandbox
)
self
.
sendbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Send"
)
,
pos
=
(
700
,
420
))
self
.
sendbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
sendline
)
#self.printerControls.append(self.sendbtn)
lbrs
.
Add
(
self
.
sendbtn
)
lrs
.
Add
(
lbrs
,
flag
=
wx
.
EXPAND
)
lrs
.
Add
(
lbrs
)
#left pane
lls
=
self
.
lowerlsizer
=
wx
.
GridBagSizer
()
lls
.
Add
(
wx
.
StaticText
(
self
.
panel
,
-
1
,
_
(
"mm/min"
)),
pos
=
(
0
,
4
),
span
=
(
1
,
4
))
lls
.
Add
(
wx
.
StaticText
(
self
.
panel
,
-
1
,
_
(
"mm/min"
)
,
pos
=
(
60
,
69
)
),
pos
=
(
0
,
4
),
span
=
(
1
,
4
))
self
.
xyfeedc
=
wx
.
SpinCtrl
(
self
.
panel
,
-
1
,
str
(
self
.
settings
.
xy_feedrate
),
min
=
0
,
max
=
50000
,
size
=
(
70
,
25
),
pos
=
(
25
,
83
))
lls
.
Add
(
wx
.
StaticText
(
self
.
panel
,
-
1
,
_
(
"XY:"
)),
pos
=
(
1
,
0
),
span
=
(
1
,
2
))
lls
.
Add
(
wx
.
StaticText
(
self
.
panel
,
-
1
,
_
(
"XY:"
)
,
pos
=
(
2
,
90
-
2
)
),
pos
=
(
1
,
0
),
span
=
(
1
,
2
))
lls
.
Add
(
self
.
xyfeedc
,
pos
=
(
1
,
2
),
span
=
(
1
,
4
))
lls
.
Add
(
wx
.
StaticText
(
self
.
panel
,
-
1
,
_
(
"Z:"
)),
pos
=
(
1
,
6
),
span
=
(
1
,
2
))
self
.
zfeedc
=
wx
.
SpinCtrl
(
self
.
panel
,
-
1
,
str
(
self
.
settings
.
z_feedrate
),
min
=
0
,
max
=
50000
,
pos
=
(
105
,
83
))
lls
.
Add
(
wx
.
StaticText
(
self
.
panel
,
-
1
,
_
(
"Z:"
)
,
pos
=
(
90
,
90
-
2
)
),
pos
=
(
1
,
6
),
span
=
(
1
,
2
))
self
.
zfeedc
=
wx
.
SpinCtrl
(
self
.
panel
,
-
1
,
str
(
self
.
settings
.
z_feedrate
),
min
=
0
,
max
=
50000
,
size
=
(
70
,
25
),
pos
=
(
105
,
83
))
lls
.
Add
(
self
.
zfeedc
,
pos
=
(
1
,
8
),
span
=
(
1
,
4
))
#lls.Add((200,375))
...
...
@@ -530,9 +530,9 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
extrusion_width
=
self
.
settings
.
preview_extrusion_width
)
self
.
gviz
.
Bind
(
wx
.
EVT_LEFT_DOWN
,
self
.
showwin
)
self
.
gwindow
.
Bind
(
wx
.
EVT_CLOSE
,
lambda
x
:
self
.
gwindow
.
Hide
())
cs
=
self
.
centersizer
=
wx
.
Box
Sizer
()
cs
.
Add
(
self
.
gviz
,
1
,
flag
=
wx
.
EXPAND
)
cs
.
Add
((
10
,
10
))
cs
=
self
.
centersizer
=
wx
.
GridBag
Sizer
()
cs
.
Add
(
self
.
gviz
,
pos
=
(
0
,
0
),
span
=
(
1
,
3
)
)
lls
.
Add
(
cs
,
pos
=
(
0
,
10
),
span
=
(
15
,
1
))
self
.
uppersizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
self
.
uppersizer
.
Add
(
self
.
uppertopsizer
)
...
...
@@ -540,11 +540,10 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
lowersizer
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
self
.
lowersizer
.
Add
(
lls
)
self
.
lowersizer
.
Add
(
cs
,
1
,
flag
=
wx
.
EXPAND
)
self
.
lowersizer
.
Add
(
lrs
,
1
,
flag
=
wx
.
EXPAND
)
self
.
lowersizer
.
Add
(
lrs
)
self
.
topsizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
self
.
topsizer
.
Add
(
self
.
uppersizer
)
self
.
topsizer
.
Add
(
self
.
lowersizer
,
1
,
flag
=
wx
.
EXPAND
)
self
.
topsizer
.
Add
(
self
.
lowersizer
)
self
.
panel
.
SetSizer
(
self
.
topsizer
)
self
.
status
=
self
.
CreateStatusBar
()
self
.
status
.
SetStatusText
(
_
(
"Not connected to printer."
))
...
...
@@ -1263,8 +1262,6 @@ class options(wx.Dialog):
for
k
,
v
in
pronterface
.
settings
.
_all_settings
()
.
items
():
if
ctrls
[
k
]
.
GetValue
()
!=
str
(
v
):
pronterface
.
set
(
k
,
str
(
ctrls
[
k
]
.
GetValue
()))
pronterface
.
gviz
.
setBedsize
(
pronterface
.
settings
.
bed_size_x
,
pronterface
.
settings
.
bed_size_y
)
self
.
Destroy
()
class
ButtonEdit
(
wx
.
Dialog
):
...
...
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