Ejemplo n.º 1
0
 def minScaleWidthWithBounds(self, unitSet, unitPlant, softMin, softMax):
     result = 0
     i = 0
     numeralChars = 0
     letterChars = 0
     maxLengthSoftMin = 0
     maxLengthSoftMax = 0
     minValue = 0.0
     maxValue = 0.0
     
     # value number of chars (always use max) 
     #+ kMaxDisplayDigitsToRightOfDecimal + 1
     numeralChars = kMaxDisplayDigitsToLeftOfDecimal
     # unit string number of chars (get max for set) 
     letterChars = uunits.maxUnitStringLengthForSet(unitSet)
     # bounds number of chars (use actual bounds, but calculate max for set) 
     maxLengthSoftMin = 0
     maxLengthSoftMax = 0
     for i in range(1, uunits.GetLastUnitEnumInUnitSet(unitSet)):
         minValue = uunits.Convert(unitSet, unitPlant, i, softMin)
         maxValue = uunits.Convert(unitSet, unitPlant, i, softMax)
         maxLengthSoftMin = umath.intMax(maxLengthSoftMin, len(usupport.digitValueString(minValue)))
         maxLengthSoftMax = umath.intMax(maxLengthSoftMax, len(usupport.digitValueString(maxValue)))
     numeralChars = numeralChars + maxLengthSoftMin + maxLengthSoftMax
     # calc min scale width from number of chars 
     result = self.formTextWidth("i") * letterChars + self.formTextWidth("1") * numeralChars + kBetweenGap * 3 + kLeftRightGap * 2
     return result
Ejemplo n.º 2
0
def combineRects(rect1, rect2):
    result = TRect()
    result.Left = umath.intMin(rect1.Left, rect2.Left)
    result.Right = umath.intMax(rect1.Right, rect2.Right)
    result.Top = umath.intMin(rect1.Top, rect2.Top)
    result.Bottom = umath.intMax(rect1.Bottom, rect2.Bottom)
    return result
Ejemplo n.º 3
0
def darkerColorWithSubtraction(aColor, subtract):
    r = umath.intMax(0, GetRValue(aColor) - subtract)
    g = umath.intMax(0, GetGValue(aColor) - subtract)
    b = umath.intMax(0, GetBValue(aColor) - subtract)
    result = support_rgb(r, g, b)
    #result := support_rgb(GetRValue(aColor) div 2, GetGValue(aColor) div 2, GetBValue(aColor) div 2);
    return result
Ejemplo n.º 4
0
def darkerColor(aColor):
    r = umath.intMax(0, GetRValue(aColor) - 10)
    g = umath.intMax(0, GetGValue(aColor) - 10)
    b = umath.intMax(0, GetBValue(aColor) - 10)
    result = support_rgb(r, g, b)
    #result := support_rgb(GetRValue(aColor) div 2, GetGValue(aColor) div 2, GetBValue(aColor) div 2);
    return result
Ejemplo n.º 5
0
def combineRects(rect1, rect2):
    result = TRect()
    result.Left = umath.intMin(rect1.Left, rect2.Left)
    result.Right = umath.intMax(rect1.Right, rect2.Right)
    result.Top = umath.intMin(rect1.Top, rect2.Top)
    result.Bottom = umath.intMax(rect1.Bottom, rect2.Bottom)
    return result
Ejemplo n.º 6
0
def darkerColor(aColor):
    r = umath.intMax(0, GetRValue(aColor) - 10)
    g = umath.intMax(0, GetGValue(aColor) - 10)
    b = umath.intMax(0, GetBValue(aColor) - 10)
    result = support_rgb(r, g, b)
    #result := support_rgb(GetRValue(aColor) div 2, GetGValue(aColor) div 2, GetBValue(aColor) div 2); 
    return result
Ejemplo n.º 7
0
def darkerColorWithSubtraction(aColor, subtract):
    r = umath.intMax(0, GetRValue(aColor) - subtract)
    g = umath.intMax(0, GetGValue(aColor) - subtract)
    b = umath.intMax(0, GetBValue(aColor) - subtract)
    result = support_rgb(r, g, b)
    #result := support_rgb(GetRValue(aColor) div 2, GetGValue(aColor) div 2, GetBValue(aColor) div 2); 
    return result
Ejemplo n.º 8
0
 def maxWidth(self):
     result = 0
     i = 0
     maxWidth = 0
     
     result = 0
     for i in range(0, self.choiceStrings.Count):
         result = umath.intMax(maxWidth, umain.TMainForm(self.Owner).Canvas.TextWidth(self.choiceStrings.Strings[i]))
     result = umath.intMax(uppanel.kLeftRightGap * 2 + self.labelWidth, +uppanel.kRadioButtonLeftGap + uppanel.kRadioButtonWidth + uppanel.kRadioButtonBeforeTextGap + maxWidth + uppanel.kLeftRightGap)
     return result
Ejemplo n.º 9
0
def darkerColorWithSubtraction(aColor, subtract):
    result = TColorRef()
    r = 0
    g = 0
    b = 0

    r = umath.intMax(0, UNRESOLVED.GetRValue(aColor) - subtract)
    g = umath.intMax(0, UNRESOLVED.GetGValue(aColor) - subtract)
    b = umath.intMax(0, UNRESOLVED.GetBValue(aColor) - subtract)
    result = support_rgb(r, g, b)
    # result := support_rgb(GetRValue(aColor) div 2, GetGValue(aColor) div 2, GetBValue(aColor) div 2);
    return result
Ejemplo n.º 10
0
def darkerColor(aColor):
    result = TColorRef()
    r = 0
    g = 0
    b = 0

    r = umath.intMax(0, UNRESOLVED.GetRValue(aColor) - 10)
    g = umath.intMax(0, UNRESOLVED.GetGValue(aColor) - 10)
    b = umath.intMax(0, UNRESOLVED.GetBValue(aColor) - 10)
    result = support_rgb(r, g, b)
    # result := support_rgb(GetRValue(aColor) div 2, GetGValue(aColor) div 2, GetBValue(aColor) div 2);
    return result
Ejemplo n.º 11
0
 def minWidth(self, requestedWidth):
     result = 0
     i = 0
     longestWidth = 0
     minAllowed = 0
     
     longestWidth = 0
     for i in range(0, self.choiceStrings.Count):
         longestWidth = umath.intMax(longestWidth, umain.TMainForm(self.Owner).Canvas.TextWidth(self.choiceStrings.Strings[i]))
     minAllowed = umath.intMax(uppanel.kLeftRightGap * 2 + self.longestLabelWordWidth, +uppanel.kRadioButtonLeftGap + uppanel.kRadioButtonWidth + uppanel.kRadioButtonBeforeTextGap + longestWidth + uppanel.kLeftRightGap)
     if requestedWidth > minAllowed:
         result = -1
     else:
         result = minAllowed
     return result
Ejemplo n.º 12
0
 def FormResize(self, Sender):
     if delphi_compatability.Application.terminated:
         return
     if self.plants == None:
         return
     self.grid.SetBounds(0, 0, self.ClientWidth, umath.intMax(0, self.ClientHeight))
     self.emptyWarningPanel.SetBounds(self.ClientWidth / 2 - self.emptyWarningPanel.Width / 2, self.ClientHeight / 2 - self.emptyWarningPanel.Height / 2, self.emptyWarningPanel.Width, self.emptyWarningPanel.Height)
Ejemplo n.º 13
0
    def minWidth(self, requestedWidth):
        result = 0
        widthForLongestWord = 0
        widthWithBounds = 0
        widthWithoutBounds = 0

        # 1. test if width given is less than labelWidth.
        #       if not, move on
        #       if so, test if width given is less than width of longest full word in labelWidth.
        #         if not, move on
        #         if so, give back width of longest full word in labelWidth as minWidth.
        #    2. test if width given is less than minScaleWidthWithBounds.
        #       if not, move on (set flag to draw bounds)
        #       if so, test if width given is less than minScaleWidthWithoutBounds.
        #         if not, move on (set flag to not draw bounds)
        #         if so, give back minScaleWidthWithoutBounds as minWidth.
        #
        widthForLongestWord = uppanel.kLeftRightGap * 2 + self.longestLabelWordWidth
        widthWithBounds = self.minScaleWidthWithBounds(self.param.unitSet,
                                                       self.param.unitModel,
                                                       self.minValue,
                                                       self.maxValue)
        widthWithoutBounds = self.minScaleWidthWithoutBounds(
            self.param.unitSet, self.param.unitModel)
        result = -1
        if requestedWidth < widthForLongestWord:
            result = widthForLongestWord
        if requestedWidth < widthWithBounds:
            self.drawWithoutBounds = true
            if requestedWidth < widthWithoutBounds:
                result = umath.intMax(result, widthWithoutBounds)
        else:
            self.drawWithoutBounds = false
        return result
Ejemplo n.º 14
0
 def maxWidth(self):
     result = 0
     result = umath.intMax(
         uppanel.kLeftRightGap * 2 + self.labelWidth,
         uppanel.kLeftRightGap + self.formTextWidth("wwwwwwww.www") +
         uppanel.kLeftRightGap + kTdoSize + uppanel.kLeftRightGap)
     return result
Ejemplo n.º 15
0
 def minWidth(self, requestedWidth):
     result = 0
     widthForLongestWord = 0
     widthWithBounds = 0
     widthWithoutBounds = 0
     
     # 1. test if width given is less than labelWidth.
     #       if not, move on
     #       if so, test if width given is less than width of longest full word in labelWidth.
     #         if not, move on
     #         if so, give back width of longest full word in labelWidth as minWidth.
     #    2. test if width given is less than minScaleWidthWithBounds.
     #       if not, move on (set flag to draw bounds)
     #       if so, test if width given is less than minScaleWidthWithoutBounds.
     #         if not, move on (set flag to not draw bounds)
     #         if so, give back minScaleWidthWithoutBounds as minWidth.
     #  
     widthForLongestWord = uppanel.kLeftRightGap * 2 + self.longestLabelWordWidth
     widthWithBounds = self.minScaleWidthWithBounds(self.param.unitSet, self.param.unitModel, self.minValue, self.maxValue)
     widthWithoutBounds = self.minScaleWidthWithoutBounds(self.param.unitSet, self.param.unitModel)
     result = -1
     if requestedWidth < widthForLongestWord:
         result = widthForLongestWord
     if requestedWidth < widthWithBounds:
         self.drawWithoutBounds = true
         if requestedWidth < widthWithoutBounds:
             result = umath.intMax(result, widthWithoutBounds)
     else:
         self.drawWithoutBounds = false
     return result
Ejemplo n.º 16
0
    def maxWidth(self):
        result = 0
        i = 0
        maxWidth = 0

        result = 0
        for i in range(0, self.choiceStrings.Count):
            result = umath.intMax(
                maxWidth,
                umain.TMainForm(self.Owner).Canvas.TextWidth(
                    self.choiceStrings.Strings[i]))
        result = umath.intMax(
            uppanel.kLeftRightGap * 2 + self.labelWidth,
            +uppanel.kRadioButtonLeftGap + uppanel.kRadioButtonWidth +
            uppanel.kRadioButtonBeforeTextGap + maxWidth +
            uppanel.kLeftRightGap)
        return result
Ejemplo n.º 17
0
 def resizeElements(self):
     self.paint()
     self.slider.Left = self.minTextRect.Right + uppanel.kSliderSpaceGap
     self.slider.Top = self.collapsedHeight(
     ) + self.textHeight / 2 - self.slider.Height / 2
     self.slider.Width = umath.intMax(
         0, self.maxTextRect.Left - self.minTextRect.Right -
         uppanel.kSliderSpaceGap * 2)
Ejemplo n.º 18
0
 def resizeElements(self):
     fullRect = TRect()
     
     if self.textHeight == 0:
         self.calculateTextDimensions()
     if self.maxLabelWidth == 0:
         self.paint()
     fullRect = Rect(0, 0, kMinGraphWidth + self.maxLabelWidth + uppanel.kLeftRightGap * 2 + uppanel.kBetweenGap, (self.numNonZeroPlantParts() + 2) * self.textHeight + uppanel.kTopBottomGap * 2 + uppanel.kBetweenGap * 2)
     self.ClientHeight = umath.intMax(0, umath.intMax(usupport.rHeight(fullRect), self.Parent.ClientHeight))
     self.ClientWidth = umath.intMax(0, umath.intMax(usupport.rWidth(fullRect), self.Parent.ClientWidth))
     try:
         self.drawBitmap.Width = self.ClientWidth
         self.drawBitmap.Height = self.ClientHeight
     except:
         self.drawBitmap.Width = 1
         self.drawBitmap.Height = 1
     self.updateDisplay()
Ejemplo n.º 19
0
 def maxWidth(self):
     result = 0
     result = umath.intMax(
         uppanel.kLeftRightGap * 2 + self.labelWidth,
         self.minScaleWidthWithBounds(self.param.unitSet,
                                      self.param.unitModel, self.minValue,
                                      self.maxValue))
     return result
Ejemplo n.º 20
0
 def uncollapsedHeight(self):
     result = 0
     result = (
         self.collapsedHeight()
         + umath.intMax(self.redSlider.Height, self.textHeight) * 3
         + udebug.kBetweenGap * 2
         + uppanel.kTopBottomGap * 3
     )
     return result
Ejemplo n.º 21
0
 def FormResize(self, Sender):
     if delphi_compatability.Application.terminated:
         return
     self.Close.Left = self.ClientWidth - self.Close.Width - kBetweenGap
     self.saveListAs.Left = self.Close.Left
     self.clearList.Left = self.Close.Left
     self.helpButton.Left = self.Close.Left
     self.supportButton.Left = self.Close.Left
     self.DebugList.SetBounds(kBetweenGap, kBetweenGap, self.Close.Left - kBetweenGap * 2, umath.intMax(0, self.ClientHeight - self.optionsPanel.Height - kBetweenGap * 3))
     self.optionsPanel.SetBounds(kBetweenGap, umath.intMax(0, self.ClientHeight - self.optionsPanel.Height - kBetweenGap), self.Close.Left - kBetweenGap * 2, self.optionsPanel.Height)
Ejemplo n.º 22
0
 def minWidth(self, requestedWidth):
     result = 0
     minAllowed = 0
     
     minAllowed = uppanel.kLeftRightGap * 2 + umath.intMax(self.longestLabelWordWidth, self.formTextWidth("wwwwwwww.www") + utdoedit.kBetweenGap + kTdoSize)
     if requestedWidth > minAllowed:
         result = -1
     else:
         result = minAllowed
     return result
Ejemplo n.º 23
0
 def minWidth(self, requestedWidth):
     result = 0
     minAllowed = 0
     
     minAllowed = umath.intMax(uppanel.kLeftRightGap * 2 + self.longestLabelWordWidth, uppanel.kRadioButtonLeftGap + (self.yesRect.Right - self.yesRect.Left) + uppanel.kRadioButtonBetweenGap + (self.noRect.Right - self.noRect.Left) + uppanel.kLeftRightGap)
     if requestedWidth > minAllowed:
         result = -1
     else:
         result = minAllowed
     return result
Ejemplo n.º 24
0
    def minWidth(self, requestedWidth):
        result = 0
        minAllowed = 0

        minAllowed = uppanel.kLeftRightGap * 2 + umath.intMax(
            self.longestLabelWordWidth,
            kColorRectSize + kMinSliderLength + udebug.kBetweenGap)
        if requestedWidth > minAllowed:
            result = -1
        else:
            result = minAllowed
        return result
Ejemplo n.º 25
0
    def minWidth(self, requestedWidth):
        result = 0
        minAllowed = 0

        minAllowed = uppanel.kLeftRightGap * 2 + umath.intMax(
            self.longestLabelWordWidth, kColorRectSize + kMinSliderLength + udebug.kBetweenGap
        )
        if requestedWidth > minAllowed:
            result = -1
        else:
            result = minAllowed
        return result
Ejemplo n.º 26
0
    def minWidth(self, requestedWidth):
        result = 0
        minAllowed = 0

        minAllowed = uppanel.kLeftRightGap * 2 + umath.intMax(
            self.longestLabelWordWidth,
            self.formTextWidth("wwwwwwww.www") + utdoedit.kBetweenGap +
            kTdoSize)
        if requestedWidth > minAllowed:
            result = -1
        else:
            result = minAllowed
        return result
Ejemplo n.º 27
0
 def FormResize(self, Sender):
     listHeight = 0
     
     if delphi_compatability.Application.terminated:
         return
     self.OK.Left = self.ClientWidth - self.OK.Width - kBetweenGap
     self.cancel.Left = self.OK.Left
     self.helpButton.Left = self.OK.Left
     self.undoListLabel.SetBounds(kBetweenGap, kBetweenGap, self.undoListLabel.Width, self.undoListLabel.Height)
     listHeight = umath.intMax(0, (self.ClientHeight - self.undoListLabel.Height * 2 - kBetweenGap * 5) / 2)
     self.undoList.SetBounds(kBetweenGap, self.undoListLabel.Top + self.undoListLabel.Height + kBetweenGap, self.OK.Left - kBetweenGap * 2, listHeight)
     self.redoListLabel.SetBounds(kBetweenGap, self.undoList.Top + self.undoList.Height + kBetweenGap, self.redoListLabel.Width, self.redoListLabel.Height)
     self.redoList.SetBounds(kBetweenGap, self.redoListLabel.Top + self.redoListLabel.Height + kBetweenGap, self.OK.Left - kBetweenGap * 2, listHeight)
Ejemplo n.º 28
0
    def minWidth(self, requestedWidth):
        result = 0
        i = 0
        longestWidth = 0
        minAllowed = 0

        longestWidth = 0
        for i in range(0, self.choiceStrings.Count):
            longestWidth = umath.intMax(
                longestWidth,
                umain.TMainForm(self.Owner).Canvas.TextWidth(
                    self.choiceStrings.Strings[i]))
        minAllowed = umath.intMax(
            uppanel.kLeftRightGap * 2 + self.longestLabelWordWidth,
            +uppanel.kRadioButtonLeftGap + uppanel.kRadioButtonWidth +
            uppanel.kRadioButtonBeforeTextGap + longestWidth +
            uppanel.kLeftRightGap)
        if requestedWidth > minAllowed:
            result = -1
        else:
            result = minAllowed
        return result
Ejemplo n.º 29
0
    def minWidth(self, requestedWidth):
        result = 0
        minAllowed = 0

        # cfk note: commented out part of this because it is estimating too wide, don't know why
        # + kLeftRightGap * 3
        minAllowed = uppanel.kLeftRightGap * 2 + umath.intMax(
            self.longestLabelWordWidth,
            self.formTextWidth("0.0") + udebug.kBetweenGap + self.formTextWidth("x2 0.00") * 4 + uppanel.kLeftRightGap,
        )
        if requestedWidth > minAllowed:
            result = -1
        else:
            result = minAllowed
        return result
Ejemplo n.º 30
0
    def keepPointsFromCrossing(self, point0, point1, movingPoint):
        closestPoint = TPoint()
        proportion = 0.0
        minDifference = 0.0

        proportion = 0.01
        minDifference = (self.maxXValue - self.minXValue) * proportion
        closestPoint = self.pointFromXY(minDifference, 0)
        closestPoint.X = umath.intMax(1, closestPoint.X - self.graphRect.Left)
        if movingPoint == 0:
            if point0.X > point1.X - closestPoint.X:
                point0.X = point1.X - closestPoint.X
        else:
            if point1.X < point0.X + closestPoint.X:
                point1.X = point0.X + closestPoint.X
Ejemplo n.º 31
0
 def updateForChangeToDomainOptions(self):
     i = 0
     
     if udomain.domain.breedingAndTimeSeriesOptions.numTimeSeriesStages != self.numStages:
         self.numStages = udomain.domain.breedingAndTimeSeriesOptions.numTimeSeriesStages
         for i in range(0, self.numStages):
             self.percentsOfMaxAge[i] = umath.intMin(100, umath.intMax(0, (i + 1) * 100 / self.numStages))
         if self.grid.ColCount != self.numStages:
             self.grid.ColCount = self.numStages
         self.updateForNewNumberOfStages()
     if self.grid.DefaultColWidth != udomain.domain.breedingAndTimeSeriesOptions.thumbnailWidth:
         self.grid.DefaultColWidth = udomain.domain.breedingAndTimeSeriesOptions.thumbnailWidth
     if self.grid.DefaultRowHeight != udomain.domain.breedingAndTimeSeriesOptions.thumbnailHeight:
         self.grid.DefaultRowHeight = udomain.domain.breedingAndTimeSeriesOptions.thumbnailHeight
         self.grid.RowHeights[1] = kStageNumberTextHeight
     self.redrawPlants()
Ejemplo n.º 32
0
 def resizeElements(self):
     self.redSlider.Left = uppanel.kLeftRightGap + kColorRectSize + self.formTextWidth(
         "W") + uppanel.kLeftRightGap * 2
     self.redSlider.Width = umath.intMax(
         0, self.Width - self.redSlider.Left - uppanel.kLeftRightGap)
     self.redSlider.Top = self.collapsedHeight(
     ) + uppanel.kTopBottomGap + self.Canvas.TextHeight(
         "r") / 2 - self.redSlider.Height / 2
     self.greenSlider.Left = self.redSlider.Left
     self.greenSlider.Width = self.redSlider.Width
     self.greenSlider.Top = self.redSlider.Top + self.textHeight + self.Canvas.TextHeight(
         "r") / 2 - self.greenSlider.Height / 2
     self.blueSlider.Left = self.redSlider.Left
     self.blueSlider.Width = self.redSlider.Width
     self.blueSlider.Top = self.greenSlider.Top + self.textHeight + self.Canvas.TextHeight(
         "r") / 2 - self.blueSlider.Height / 2
Ejemplo n.º 33
0
def blendColors(firstColor, secondColor, aStrength):
    #blend first color with second color,
    #   weighting the second color by aStrength (0-1) and first color by (1 - aStrength).
    aStrength = umath.max(0.0, umath.min(1.0, aStrength))
    r1 = umath.intMax(0, umath.intMin(255, GetRValue(firstColor)))
    g1 = umath.intMax(0, umath.intMin(255, GetGValue(firstColor)))
    b1 = umath.intMax(0, umath.intMin(255, GetBValue(firstColor)))
    r2 = umath.intMax(0, umath.intMin(255, GetRValue(secondColor)))
    g2 = umath.intMax(0, umath.intMin(255, GetGValue(secondColor)))
    b2 = umath.intMax(0, umath.intMin(255, GetBValue(secondColor)))
    result = support_rgb(intround(r1 * (1.0 - aStrength) + r2 * aStrength), intround(g1 * (1.0 - aStrength) + g2 * aStrength), intround(b1 * (1.0 - aStrength) + b2 * aStrength))
    return result
Ejemplo n.º 34
0
 def resizeElements(self):
     self.redSlider.Left = (
         uppanel.kLeftRightGap + kColorRectSize + self.formTextWidth("W") + uppanel.kLeftRightGap * 2
     )
     self.redSlider.Width = umath.intMax(0, self.Width - self.redSlider.Left - uppanel.kLeftRightGap)
     self.redSlider.Top = (
         self.collapsedHeight() + uppanel.kTopBottomGap + self.Canvas.TextHeight("r") / 2 - self.redSlider.Height / 2
     )
     self.greenSlider.Left = self.redSlider.Left
     self.greenSlider.Width = self.redSlider.Width
     self.greenSlider.Top = (
         self.redSlider.Top + self.textHeight + self.Canvas.TextHeight("r") / 2 - self.greenSlider.Height / 2
     )
     self.blueSlider.Left = self.redSlider.Left
     self.blueSlider.Width = self.redSlider.Width
     self.blueSlider.Top = (
         self.greenSlider.Top + self.textHeight + self.Canvas.TextHeight("r") / 2 - self.blueSlider.Height / 2
     )
Ejemplo n.º 35
0
 def minWidth(self, requestedWidth):
     result = 0
     widthForLongestWord = 0
     widthWithBounds = 0
     widthWithoutBounds = 0
     
     widthForLongestWord = uppanel.kLeftRightGap * 2 + self.longestLabelWordWidth
     widthWithBounds = self.minScaleWidthWithBounds()
     widthWithoutBounds = self.minScaleWidthWithoutBounds()
     result = -1
     if requestedWidth < widthForLongestWord:
         result = widthForLongestWord
     if requestedWidth < widthWithBounds:
         self.drawWithoutBounds = true
         if requestedWidth < widthWithoutBounds:
             result = umath.intMax(result, widthWithoutBounds)
     else:
         self.drawWithoutBounds = false
     return result
Ejemplo n.º 36
0
    def minWidth(self, requestedWidth):
        result = 0
        widthForLongestWord = 0
        widthWithBounds = 0
        widthWithoutBounds = 0

        widthForLongestWord = uppanel.kLeftRightGap * 2 + self.longestLabelWordWidth
        widthWithBounds = self.minScaleWidthWithBounds()
        widthWithoutBounds = self.minScaleWidthWithoutBounds()
        result = -1
        if requestedWidth < widthForLongestWord:
            result = widthForLongestWord
        if requestedWidth < widthWithBounds:
            self.drawWithoutBounds = true
            if requestedWidth < widthWithoutBounds:
                result = umath.intMax(result, widthWithoutBounds)
        else:
            self.drawWithoutBounds = false
        return result
Ejemplo n.º 37
0
def blendColors(firstColor, secondColor, aStrength):
    #blend first color with second color,
    #   weighting the second color by aStrength (0-1) and first color by (1 - aStrength).
    aStrength = umath.max(0.0, umath.min(1.0, aStrength))
    r1 = umath.intMax(0, umath.intMin(255, GetRValue(firstColor)))
    g1 = umath.intMax(0, umath.intMin(255, GetGValue(firstColor)))
    b1 = umath.intMax(0, umath.intMin(255, GetBValue(firstColor)))
    r2 = umath.intMax(0, umath.intMin(255, GetRValue(secondColor)))
    g2 = umath.intMax(0, umath.intMin(255, GetGValue(secondColor)))
    b2 = umath.intMax(0, umath.intMin(255, GetBValue(secondColor)))
    result = support_rgb(intround(r1 * (1.0 - aStrength) + r2 * aStrength),
                         intround(g1 * (1.0 - aStrength) + g2 * aStrength),
                         intround(b1 * (1.0 - aStrength) + b2 * aStrength))
    return result
Ejemplo n.º 38
0
 def maxWidth(self):
     result = 0
     result = uppanel.kLeftRightGap * 2 + umath.intMax(self.labelWidth, uppanel.kEditMaxWidth)
     return result
Ejemplo n.º 39
0
 def uncollapsedHeight(self):
     result = 0
     result = self.collapsedHeight() + umath.intMax(
         self.redSlider.Height, self.textHeight
     ) * 3 + udebug.kBetweenGap * 2 + uppanel.kTopBottomGap * 3
     return result
Ejemplo n.º 40
0
 def maxWidth(self):
     result = 0
     result = umath.intMax(uppanel.kLeftRightGap * 2 + self.longestLabelWordWidth, uppanel.kRadioButtonLeftGap + (self.yesRect.Right - self.yesRect.Left) + uppanel.kRadioButtonBetweenGap + (self.noRect.Right - self.noRect.Left) + uppanel.kLeftRightGap)
     return result
Ejemplo n.º 41
0
 def FormResize(self, Sender):
     if delphi_compatability.Application.terminated:
         return
     self.Close.Left = self.ClientWidth - self.Close.Width - kBetweenGap
     self.saveListAs.Left = self.Close.Left
     self.copyToClipboard.Left = self.Close.Left
     self.helpButton.Left = self.Close.Left
     self.infoList.SetBounds(kBetweenGap, kBetweenGap, self.Close.Left - kBetweenGap * 2, umath.intMax(0, self.ClientHeight - kBetweenGap * 2))
Ejemplo n.º 42
0
 def collapsedHeight(self):
     result = 0
     result = self.wrappedLabelHeight + kTopBottomGap
     result = umath.intMax(result, kArrowPictureSize + 5)
     return result
Ejemplo n.º 43
0
 def maxWidth(self):
     result = 0
     result = umath.intMax(uppanel.kLeftRightGap * 2 + self.labelWidth, uppanel.kLeftRightGap + self.formTextWidth("wwwwwwww.www") + uppanel.kLeftRightGap + kTdoSize + uppanel.kLeftRightGap)
     return result
Ejemplo n.º 44
0
 def maxWidth(self):
     result = 0
     result = uppanel.kLeftRightGap * 2 + umath.intMax(
         self.labelWidth, uppanel.kEditMaxWidth)
     return result
Ejemplo n.º 45
0
 def maxWidth(self):
     result = 0
     result = uppanel.kLeftRightGap * 2 + umath.intMax(self.labelWidth, self.minScaleWidthWithBounds())
     return result
Ejemplo n.º 46
0
 def maxWidth(self):
     result = 0
     result = uppanel.kLeftRightGap * 2 + umath.intMax(
         self.labelWidth, self.minScaleWidthWithBounds())
     return result
Ejemplo n.º 47
0
 def resizeElements(self):
     self.paint()
     self.slider.Left = self.minTextRect.Right + uppanel.kSliderSpaceGap
     self.slider.Top = self.collapsedHeight() + self.textHeight / 2 - self.slider.Height / 2
     self.slider.Width = umath.intMax(0, self.maxTextRect.Left - self.minTextRect.Right - uppanel.kSliderSpaceGap * 2)
Ejemplo n.º 48
0
 def maxWidth(self):
     result = 0
     result = umath.intMax(uppanel.kLeftRightGap * 2 + self.labelWidth, self.minScaleWidthWithBounds(self.param.unitSet, self.param.unitModel, self.minValue, self.maxValue))
     return result