Ejemplo n.º 1
0
    def _createSampleSpoolModel(self):
        #DisplayName, Vendor, Material, Color[# code], Diameter [mm], Density [g/cm³], Temperature [°C], TotalWeight [g], UsedWeight [g], UsedLength [mm], FirstUse [dd.mm.yyyy hh:mm], LastUse [dd.mm.yyyy hh:mm], PurchasedFrom, PurchasedOn [dd.mm.yyyy hh:mm], Cost, CostUnit, Labels, NoteText

        s1 = SpoolModel()
        s1.displayName = "Number #1"
        s1.colorName = "raw-red"
        s1.color = "#FF0000"
        s1.vendor = "The Spool Company"
        s1.material = "PETG"
        s1.diameter = 1.75
        s1.diameterTolerance = 0.2
        s1.density = 1.27
        s1.flowRateCompensation = 110
        s1.temperature = 182
        s1.bedtemperature = 52
        s1.enclosureTemperature = 23
        s1.totalWeight = 1000.0
        s1.spoolWeight = 12.3
        s1.usedWeight = 123.4
        s1.totalLength = 1321
        s1.usedLength = 234
        s1.lastUse = datetime.datetime.now()

        s1.firstUse = datetime.datetime.strptime("2020-03-02 10:33",
                                                 '%Y-%m-%d %H:%M')
        s1.purchasedOn = datetime.datetime.strptime("2020-02-01", '%Y-%m-%d')
        s1.purchasedFrom = "Unknown Seller"
        s1.cost = "12.30"
        s1.costUnit = "€"
        s1.noteText = "Very cheap spool!"
        return s1
	def _createSpoolModelFromLegacy(self, allSpoolLegacyList):
		allSpoolModels = list()
		for spoolDict in allSpoolLegacyList:
			spoolModel = SpoolModel()

			spoolIdInt = spoolDict["id"]
			nameUnicode = spoolDict["name"]
			usedFloat = spoolDict["used"]
			weightFloat = spoolDict["weight"]
			tempOffsetInt = spoolDict["temp_offset"]
			costFloat = spoolDict["cost"]
			profileDict = spoolDict["profile"]
			profileIdInt = profileDict["id"]
			diameterFloat = profileDict["diameter"]
			materialUnicode = profileDict["material"]
			vendorUnicode = profileDict["vendor"]
			densityFloat = profileDict["density"]

			spoolModel.displayName = nameUnicode
			spoolModel.vendor = vendorUnicode

			spoolModel.material = materialUnicode
			spoolModel.density = densityFloat
			spoolModel.diameter = diameterFloat
			spoolModel.cost = costFloat
			spoolModel.costUnit = "ToDo"
			spoolModel.usedLength = usedFloat
			spoolModel.totalWeight = weightFloat

			allSpoolModels.append(spoolModel)

		return allSpoolModels
Ejemplo n.º 3
0
	def _createSpoolModelFromLegacy(self, allSpoolLegacyList):
		allSpoolModels = list()
		for spoolDict in allSpoolLegacyList:
			spoolModel = SpoolModel()

			spoolIdInt = spoolDict["id"]
			nameUnicode = spoolDict["name"]
			usedWeightFloat = spoolDict["used"]
			totalWeightFloat = spoolDict["weight"]
			tempOffsetInt = spoolDict["temp_offset"]
			costFloat = spoolDict["cost"]
			profileDict = spoolDict["profile"]
			profileIdInt = profileDict["id"]
			diameterFloat = profileDict["diameter"]
			materialUnicode = profileDict["material"]
			vendorUnicode = profileDict["vendor"]
			densityFloat = profileDict["density"]

			spoolModel.displayName = nameUnicode
			spoolModel.vendor = vendorUnicode

			spoolModel.material = materialUnicode
			spoolModel.density = densityFloat
			spoolModel.diameter = diameterFloat
			spoolModel.cost = costFloat
			spoolModel.costUnit = self._filamentManagerPluginImplementation._settings.get(["currencySymbol"])
			spoolModel.totalWeight = totalWeightFloat
			spoolModel.usedWeight = usedWeightFloat

			spoolModel.usedLength = self._calculateUsedLength(spoolModel.usedWeight, spoolModel.density, spoolModel.diameter)

			allSpoolModels.append(spoolModel)

		return allSpoolModels