Skip to content

Commit

Permalink
Buffer Bar
Browse files Browse the repository at this point in the history
  • Loading branch information
HomineLudens committed May 24, 2016
1 parent afbb302 commit e6abfd2
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions bCNC.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,11 @@ def __init__(self, master, **kw):
self.statusx = Label(frame, foreground="DarkRed", relief=SUNKEN, anchor=W, width=10)
self.statusx.pack(side=RIGHT)

# Buffer gauge
self.bufferGauge = tkExtra.Gauge(frame, height=20, width=20, relief=SUNKEN)
self.bufferGauge.pack(side=RIGHT, expand=NO)
tkExtra.Balloon.set(self.bufferGauge,_("Controller buffer fill"))
# Buffer bar
self.bufferbar = tkExtra.ProgressBar(frame, height=20, width=40, relief=SUNKEN)
self.bufferbar.pack(side=RIGHT, expand=NO)
self.bufferbar.setLimits(0, 100)
tkExtra.Balloon.set(self.bufferbar,_("Controller buffer fill"))

# --- Left side ---
frame = Frame(self.paned)
Expand Down Expand Up @@ -427,7 +428,7 @@ def setStatus(self, msg, force_update=False):
self.statusbar.configText(text=msg, fill="DarkBlue")
if force_update:
self.statusbar.update_idletasks()
self.bufferGauge.update_idletasks()
self.bufferbar.update_idletasks()

#-----------------------------------------------------------------------
# Set a status message from an event
Expand Down Expand Up @@ -2006,7 +2007,9 @@ def runEnded(self):
self.statusbar.clear()
self.statusbar.config(background="LightGray")
self.setStatus(_("Run ended"))
self.bufferGauge.setFill(0)
self.bufferbar.clear()
self.bufferbar.config(background="LightGray")
self.bufferbar.setText("")

#-----------------------------------------------------------------------
# Send enabled gcode file to the CNC machine
Expand Down Expand Up @@ -2087,6 +2090,10 @@ def run(self, lines=None):
self.statusbar.configText(fill="White")
self.statusbar.config(background="DarkGray")

self.bufferbar.configText(fill="White")
self.bufferbar.config(background="DarkGray")
self.bufferbar.setText("")

#-----------------------------------------------------------------------
# Start the web pendant
#-----------------------------------------------------------------------
Expand Down Expand Up @@ -2207,7 +2214,9 @@ def _monitorSerial(self):
self.statusbar.setProgress(self._runLines-self.queue.qsize(),
self._gcount)
CNC.vars["msg"] = self.statusbar.msg
self.bufferGauge.setFill(Sender.getBufferFill(self))
self.bufferbar.setProgress(Sender.getBufferFill(self))
self.bufferbar.setText("%i%%"%Sender.getBufferFill(self))

if self._selectI>=0 and self._paths:
while self._selectI <= self._gcount and self._selectI<len(self._paths):
if self._paths[self._selectI]:
Expand Down

0 comments on commit e6abfd2

Please sign in to comment.