diff --git a/Cura/gui/preferencesDialog.py b/Cura/gui/preferencesDialog.py index 9280505bb..81734c28c 100644 --- a/Cura/gui/preferencesDialog.py +++ b/Cura/gui/preferencesDialog.py @@ -28,6 +28,10 @@ class preferencesDialog(configBase.configWindowBase): configBase.TitleRow(left, 'Filament settings') c = configBase.SettingRow(left, 'Filament density (kg/m3)', 'filament_density', '1300', 'Weight of the filament per m3. Around 1300 for PLA. And around 1040 for ABS. This value is used to estimate the weight if the filament used for the print.', type = 'preference') validators.validFloat(c, 500.0, 3000.0) + c = configBase.SettingRow(left, 'Filament cost (price/kg)', 'filament_cost_kg', '0', 'Cost of your filament per kg, to estimate the cost of the final print.', type = 'preference') + validators.validFloat(c, 0.0) + c = configBase.SettingRow(left, 'Filament cost (price/m)', 'filament_cost_meter', '0', 'Cost of your filament per meter, to estimate the cost of the final print.', type = 'preference') + validators.validFloat(c, 0.0) configBase.TitleRow(left, 'Communication settings') c = configBase.SettingRow(left, 'Serial port', 'serial_port', ['AUTO'] + machineCom.serialList(), 'Serial port to use for communication with the printer', type = 'preference') diff --git a/Cura/gui/printWindow.py b/Cura/gui/printWindow.py index fd9b0ef3a..a7f2770a9 100644 --- a/Cura/gui/printWindow.py +++ b/Cura/gui/printWindow.py @@ -5,6 +5,7 @@ import wx, threading, re from gui import machineCom from gui import icon +from util import profile from util import gcodeInterpreter printWindowHandle = None @@ -95,6 +96,14 @@ class printWindow(wx.Frame): status = "" if self.gcode != None: status += "Filament: %.2fm %.2fg\n" % (self.gcode.extrusionAmount / 1000, self.gcode.calculateWeight() * 1000) + cost_kg = float(profile.getPreference('filament_cost_kg')) + cost_meter = float(profile.getPreference('filament_cost_meter')) + if cost_kg > 0.0 and cost_meter > 0.0: + status += "Filament cost: %.2f / %.2f\n" % (self.gcode.calculateWeight() * cost_kg, self.gcode.extrusionAmount / 1000 * cost_meter) + elif cost_kg > 0.0: + status += "Filament cost: %.2f\n" % (self.gcode.calculateWeight() * cost_kg) + elif cost_meter > 0.0: + status += "Filament cost: %.2f\n" % (self.gcode.extrusionAmount / 1000 * cost_meter) status += "Print time: %02d:%02d\n" % (int(self.gcode.totalMoveTimeMinute / 60), int(self.gcode.totalMoveTimeMinute % 60)) if self.printIdx == None: self.progress.SetValue(0) diff --git a/Cura/util/profile.py b/Cura/util/profile.py index b1bbccf84..8735152db 100644 --- a/Cura/util/profile.py +++ b/Cura/util/profile.py @@ -80,6 +80,8 @@ preferencesDefaultSettings = { 'serial_baud': '250000', 'slicer': 'Cura (Skeinforge based)', 'save_profile': 'False', + 'filament_cost_kg': '0', + 'filament_cost_meter': '0', } def getDefaultProfilePath():