def updateCellSizeAndCountForSelection(self): excludeInvisiblePlants = false excludeNonSelectedPlants = false cellRect = TRect() scaleMultiplier = 0.0 fileSize = 0L excludeInvisiblePlants = not self.useAllPlants.Checked excludeNonSelectedPlants = self.useSelectedPlants.Checked cellRect = udomain.domain.plantManager.largestPlantBoundsRect( umain.MainForm.selectedPlants, excludeInvisiblePlants, excludeNonSelectedPlants) scaleMultiplier = umath.safedivExcept( 1.0 * self.options.resolution_pixelsPerInch, 1.0 * delphi_compatability.Screen.PixelsPerInch, 1.0) self.options.cellSize = Point( intround(usupport.rWidth(cellRect) * scaleMultiplier), intround(usupport.rHeight(cellRect) * scaleMultiplier)) if self.useAllPlants.Checked: self.options.cellCount = udomain.domain.plantManager.plants.Count elif self.useVisiblePlants.Checked: self.options.cellCount = udomain.domain.plantManager.visiblePlantCount( ) elif self.useSelectedPlants.Checked: self.options.cellCount = umain.MainForm.selectedPlants.Count self.cellSizeLabel.Caption = "Nozzle/tube cell width: " + IntToStr( self.options.cellSize.X) + " height: " + IntToStr( self.options.cellSize.Y) self.cellCountLabel.Caption = "Number of items: " + IntToStr( self.options.cellCount) fileSize = intround( self.options.cellCount * self.options.cellSize.X * self.options.cellSize.Y * usupport.bitsPerPixelForColorType(self.options.colorType) / 8.0) + FIX_sizeof(delphi_compatability.TBitmapInfo) if fileSize < 1024: self.fileSizeLabel.Caption = "Estimated file size: " + IntToStr( fileSize) + " bytes" elif fileSize < 1024 * 1024: self.fileSizeLabel.Caption = "Estimated file size: " + IntToStr( fileSize / 1024) + " KB" else: self.fileSizeLabel.Caption = "Estimated file size: " + FloatToStrF( fileSize / (1024 * 1024), UNRESOLVED.ffFixed, 7, 1) + " MB" if fileSize >= 10.0 * 1024 * 1024: self.fileSizeLabel.Font.Style = [ UNRESOLVED.fsBold, ] else: self.fileSizeLabel.Font.Style = []
def calculateNumberOfFrames(self): scaleMultiplier = 0.0 if self.options.animateBy == udomain.kAnimateByAge: self.plantMaxAgeLabel.Caption = "Maximum age = " + IntToStr( self.plant.pGeneral.ageAtMaturity) self.plantMaxAgeLabel.Visible = true self.options.frameCount = self.plant.pGeneral.ageAtMaturity / self.options.ageIncrement + 1 elif self.options.animateBy == udomain.kAnimateByXRotation: self.plantMaxAgeLabel.Visible = false self.options.frameCount = 360 / abs( self.options.xRotationIncrement) self.fileNumberLabel.Caption = "Number of files: " + IntToStr( self.options.frameCount) scaleMultiplier = umath.safedivExcept( 1.0 * self.options.resolution_pixelsPerInch, 1.0 * delphi_compatability.Screen.PixelsPerInch, 1.0) self.options.scaledSize = Point( intround( usupport.rWidth(self.plant.boundsRect_pixels()) * scaleMultiplier), intround( usupport.rHeight(self.plant.boundsRect_pixels()) * scaleMultiplier)) self.animationSizeLabel.Caption = "Animation size: " + IntToStr( self.options.scaledSize.X) + " x " + IntToStr( self.options.scaledSize.Y) self.options.fileSize = intround( self.options.frameCount * self.options.scaledSize.X * self.options.scaledSize.Y * usupport.bitsPerPixelForColorType(self.options.colorType) / 8.0) + FIX_sizeof(delphi_compatability.TBitmapInfo) if self.options.fileSize < 1024: self.fileSizeLabel.Caption = "Estimated total size: " + IntToStr( self.options.fileSize) + " bytes" elif self.options.fileSize < 1024 * 1024: self.fileSizeLabel.Caption = "Estimated total size: " + IntToStr( self.options.fileSize / 1024) + " KB" else: self.fileSizeLabel.Caption = "Estimated total size: " + FloatToStrF( self.options.fileSize / (1024 * 1024), UNRESOLVED.ffFixed, 7, 1) + " MB" if self.options.fileSize >= 10.0 * 1024 * 1024: self.fileSizeLabel.Font.Style = [ UNRESOLVED.fsBold, ] else: self.fileSizeLabel.Font.Style = []
def updateCellSizeAndCountForSelection(self): excludeInvisiblePlants = false excludeNonSelectedPlants = false cellRect = TRect() scaleMultiplier = 0.0 fileSize = 0L excludeInvisiblePlants = not self.useAllPlants.Checked excludeNonSelectedPlants = self.useSelectedPlants.Checked cellRect = udomain.domain.plantManager.largestPlantBoundsRect(umain.MainForm.selectedPlants, excludeInvisiblePlants, excludeNonSelectedPlants) scaleMultiplier = umath.safedivExcept(1.0 * self.options.resolution_pixelsPerInch, 1.0 * delphi_compatability.Screen.PixelsPerInch, 1.0) self.options.cellSize = Point(intround(usupport.rWidth(cellRect) * scaleMultiplier), intround(usupport.rHeight(cellRect) * scaleMultiplier)) if self.useAllPlants.Checked: self.options.cellCount = udomain.domain.plantManager.plants.Count elif self.useVisiblePlants.Checked: self.options.cellCount = udomain.domain.plantManager.visiblePlantCount() elif self.useSelectedPlants.Checked: self.options.cellCount = umain.MainForm.selectedPlants.Count self.cellSizeLabel.Caption = "Nozzle/tube cell width: " + IntToStr(self.options.cellSize.X) + " height: " + IntToStr(self.options.cellSize.Y) self.cellCountLabel.Caption = "Number of items: " + IntToStr(self.options.cellCount) fileSize = intround(self.options.cellCount * self.options.cellSize.X * self.options.cellSize.Y * usupport.bitsPerPixelForColorType(self.options.colorType) / 8.0) + FIX_sizeof(delphi_compatability.TBitmapInfo) if fileSize < 1024: self.fileSizeLabel.Caption = "Estimated file size: " + IntToStr(fileSize) + " bytes" elif fileSize < 1024 * 1024: self.fileSizeLabel.Caption = "Estimated file size: " + IntToStr(fileSize / 1024) + " KB" else: self.fileSizeLabel.Caption = "Estimated file size: " + FloatToStrF(fileSize / (1024 * 1024), UNRESOLVED.ffFixed, 7, 1) + " MB" if fileSize >= 10.0 * 1024 * 1024: self.fileSizeLabel.Font.Style = [UNRESOLVED.fsBold, ] else: self.fileSizeLabel.Font.Style = []
def calculateNumberOfFrames(self): scaleMultiplier = 0.0 if self.options.animateBy == udomain.kAnimateByAge: self.plantMaxAgeLabel.Caption = "Maximum age = " + IntToStr(self.plant.pGeneral.ageAtMaturity) self.plantMaxAgeLabel.Visible = true self.options.frameCount = self.plant.pGeneral.ageAtMaturity / self.options.ageIncrement + 1 elif self.options.animateBy == udomain.kAnimateByXRotation: self.plantMaxAgeLabel.Visible = false self.options.frameCount = 360 / abs(self.options.xRotationIncrement) self.fileNumberLabel.Caption = "Number of files: " + IntToStr(self.options.frameCount) scaleMultiplier = umath.safedivExcept(1.0 * self.options.resolution_pixelsPerInch, 1.0 * delphi_compatability.Screen.PixelsPerInch, 1.0) self.options.scaledSize = Point(intround(usupport.rWidth(self.plant.boundsRect_pixels()) * scaleMultiplier), intround(usupport.rHeight(self.plant.boundsRect_pixels()) * scaleMultiplier)) self.animationSizeLabel.Caption = "Animation size: " + IntToStr(self.options.scaledSize.X) + " x " + IntToStr(self.options.scaledSize.Y) self.options.fileSize = intround(self.options.frameCount * self.options.scaledSize.X * self.options.scaledSize.Y * usupport.bitsPerPixelForColorType(self.options.colorType) / 8.0) + FIX_sizeof(delphi_compatability.TBitmapInfo) if self.options.fileSize < 1024: self.fileSizeLabel.Caption = "Estimated total size: " + IntToStr(self.options.fileSize) + " bytes" elif self.options.fileSize < 1024 * 1024: self.fileSizeLabel.Caption = "Estimated total size: " + IntToStr(self.options.fileSize / 1024) + " KB" else: self.fileSizeLabel.Caption = "Estimated total size: " + FloatToStrF(self.options.fileSize / (1024 * 1024), UNRESOLVED.ffFixed, 7, 1) + " MB" if self.options.fileSize >= 10.0 * 1024 * 1024: self.fileSizeLabel.Font.Style = [UNRESOLVED.fsBold, ] else: self.fileSizeLabel.Font.Style = []