diff options
author | Simon Edwards <s.edwards@ultimaker.com> | 2017-01-17 10:42:55 +0300 |
---|---|---|
committer | Simon Edwards <s.edwards@ultimaker.com> | 2017-01-17 10:42:55 +0300 |
commit | fb70eb6813de4b7632be0abe7b3d5da82d157a49 (patch) | |
tree | a4e56f4c3d2b0c6e9d84e23fd1769f13fb435135 /cura/PrintInformation.py | |
parent | 38a7ffa7da151501028350d94ab82c45d57112ae (diff) | |
parent | 32fd02bd57a9aa22999cb0c242c63c0f37809c48 (diff) |
Merge branch 'master' into python_type_hinting
Diffstat (limited to 'cura/PrintInformation.py')
-rw-r--r-- | cura/PrintInformation.py | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/cura/PrintInformation.py b/cura/PrintInformation.py index d0de997566..641ef54160 100644 --- a/cura/PrintInformation.py +++ b/cura/PrintInformation.py @@ -1,7 +1,8 @@ # Copyright (c) 2015 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. -from PyQt5.QtCore import QObject, pyqtSignal, pyqtProperty, pyqtSlot +from PyQt5.QtCore import QObject, pyqtSignal, pyqtProperty +from UM.FlameProfiler import pyqtSlot from UM.Application import Application from UM.Qt.Duration import Duration @@ -13,6 +14,9 @@ import math import os.path import unicodedata +from UM.i18n import i18nCatalog +catalog = i18nCatalog("cura") + ## A class for processing and calculating minimum, current and maximum print time as well as managing the job name # # This class contains all the logic relating to calculation and slicing for the @@ -49,6 +53,8 @@ class PrintInformation(QObject): self._material_lengths = [] self._material_weights = [] + self._pre_sliced = False + self._backend = Application.getInstance().getBackend() if self._backend: self._backend.printDurationMessage.connect(self._onPrintDurationMessage) @@ -61,6 +67,16 @@ class PrintInformation(QObject): currentPrintTimeChanged = pyqtSignal() + preSlicedChanged = pyqtSignal() + + @pyqtProperty(bool, notify=preSlicedChanged) + def preSliced(self): + return self._pre_sliced + + def setPreSliced(self, pre_sliced): + self._pre_sliced = pre_sliced + self.preSlicedChanged.emit() + @pyqtProperty(Duration, notify = currentPrintTimeChanged) def currentPrintTime(self): return self._current_print_time @@ -122,7 +138,9 @@ class PrintInformation(QObject): def createJobName(self, base_name): base_name = self._stripAccents(base_name) self._setAbbreviatedMachineName() - if Preferences.getInstance().getValue("cura/jobname_prefix"): + if self._pre_sliced: + return catalog.i18nc("@label", "Pre-sliced file {0}", base_name) + elif Preferences.getInstance().getValue("cura/jobname_prefix"): return self._abbr_machine + "_" + base_name else: return base_name @@ -150,4 +168,4 @@ class PrintInformation(QObject): ## Utility method that strips accents from characters (eg: รข -> a) def _stripAccents(self, str): - return ''.join(char for char in unicodedata.normalize('NFD', str) if unicodedata.category(char) != 'Mn')
\ No newline at end of file + return ''.join(char for char in unicodedata.normalize('NFD', str) if unicodedata.category(char) != 'Mn') |