Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYouness Alaoui <kakaroto@kakaroto.homelinux.net>2015-11-26 23:05:14 +0300
committerYouness Alaoui <kakaroto@kakaroto.homelinux.net>2015-11-26 23:06:16 +0300
commit215b9e1eeaa37d52f71d86d8c5b02e2b88d90dc4 (patch)
tree51a22d11b7ba0549416fddb00ec14f18161104f9
parent4da1a99ec7b05ba589fa29a180c3eea489c0a32b (diff)
Make the power module an optional dependency
If power module is not loadable, then all it will affect is the warning label about the PC being on battery vs. AC power in the print window.
-rw-r--r--Cura/gui/printWindow.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/Cura/gui/printWindow.py b/Cura/gui/printWindow.py
index b6a7a4c498..70d5fc8d61 100644
--- a/Cura/gui/printWindow.py
+++ b/Cura/gui/printWindow.py
@@ -2,7 +2,10 @@ __copyright__ = "Copyright (C) 2013 David Braam - Released under terms of the AG
import wx
from wx.lib.intctrl import IntCtrl
-import power
+try:
+ import power
+except:
+ power = None
import time
import sys
import os
@@ -447,7 +450,10 @@ class printWindowBasic(wx.Frame):
style=wx.ALIGN_CENTER)
self.powerWarningText.SetBackgroundColour('red')
self.powerWarningText.SetForegroundColour('white')
- self.powerManagement = power.PowerManagement()
+ if power:
+ self.powerManagement = power.PowerManagement()
+ else:
+ self.powerManagement = None
self.powerWarningTimer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.OnPowerWarningChange, self.powerWarningTimer)
self.OnPowerWarningChange(None)
@@ -498,6 +504,8 @@ class printWindowBasic(wx.Frame):
self._printerConnection.openActiveConnection()
def OnPowerWarningChange(self, e):
+ if self.powerManagement is None:
+ return
type = self.powerManagement.get_providing_power_source_type()
if type == power.POWER_TYPE_AC and self.powerWarningText.IsShown():
self.powerWarningText.Hide()