Show a warning if computer is not connected to AC power.

master
Ilya Kulakov 2012-11-20 15:32:34 +07:00
parent 5d98793ade
commit 0d4d181a5b
4 changed files with 23 additions and 0 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "Cura/util/Power"]
path = Cura/util/Power
url = git://github.com/GreatFruitOmsk/Power.git

View File

@ -11,6 +11,7 @@ from gui import taskbar
from util import machineCom
from util import profile
from util import gcodeInterpreter
from util import power
printWindowMonitorHandle = None
@ -116,6 +117,17 @@ class printWindow(wx.Frame):
sb = wx.StaticBox(self.panel, label="Statistics")
boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL)
p = power.PowerManagement()
if p.get_providing_power_source_type() != power.POWER_TYPE_AC:
self.powerWarningText = wx.StaticText(parent=self.panel,
id=-1,
label="Connect your computer to AC power\nIf it shuts down during printing, the product will be lost.",
style=wx.ALIGN_CENTER)
self.powerWarningText.SetBackgroundColour('red')
self.powerWarningText.SetForegroundColour('white')
boxsizer.AddF(self.powerWarningText, flags=wx.SizerFlags().Expand().Border(wx.BOTTOM, 10))
self.statsText = wx.StaticText(self.panel, -1, "Filament: ####.##m #.##g\nEstimated print time: #####:##\nMachine state:\nDetecting baudrateXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
boxsizer.Add(self.statsText, flag=wx.LEFT, border=5)

1
Cura/util/Power Submodule

@ -0,0 +1 @@
Subproject commit 9630adf08ee2de90cb3a49af53d85693060ccbff

View File

@ -0,0 +1,7 @@
import sys
import os
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'Power'))
import power