コード例 #1
0
 def set_Value(self, valueFloat):
     if self.numberResolution != None:
         if valueFloat == None or valueFloat == "":
             rStr = String.Number2String(0, self.numberResolution)
             self.numberBox.setText(rStr)
             return
         try:
             test = float(valueFloat)
             rStr = String.Number2String(test, self.numberResolution)
             self.numberBox.setText(rStr)
         except:
             str0 = "You must put the float type in \"%s\"." % (
                 self.Caption)
             QMessageBox.warning(self, "Warning", str0)
             rStr = String.Number2String(0, self.numberResolution)
             self.numberBox.setText(rStr)
     else:
         try:
             test = int(valueFloat)
             self.numberBox.setValue(test)
         except:
             str0 = "You must put the float type in \"%s\"." % (
                 self.Caption)
             QMessageBox.warning(self, "Warning", str0)
             self.numberBox.setValue(0)
コード例 #2
0
 def method_11(self):
     clipboard = QApplication.clipboard()
     clipboard.clear()
     # if (self.childName == "QASnapshot"):
     #     clipboard.setImage(self.Image);
     #     return;
     # dataObject = DataObject();
     dataObject = ""
     stringBuilder = StringBuilder()
     stringBuilder.Append("Version:0.9\r\n")
     stringBuilder.Append("StartHTML:aaaaaaaaaa\r\n")
     stringBuilder.Append("EndHTML:bbbbbbbbbb\r\n")
     stringBuilder.Append("StartFragment:cccccccccc\r\n")
     stringBuilder.Append("EndFragment:dddddddddd\r\n")
     length = stringBuilder.Length
     num = stringBuilder.Length
     stringBuilder.Append("<!--StartFragment-->\r\n")
     stringBuilder.Append(self.method_5())
     stringBuilder.Append("<!--EndFragment-->\r\n")
     length1 = stringBuilder.Length
     num1 = stringBuilder.Length
     stringBuilder.Replace("aaaaaaaaaa",
                           String.Number2String(length, "0000000000"), 0,
                           length)
     stringBuilder.Replace("bbbbbbbbbb",
                           String.Number2String(num1, "0000000000"), 0,
                           length)
     stringBuilder.Replace("cccccccccc",
                           String.Number2String(num, "0000000000"), 0,
                           length)
     stringBuilder.Replace("dddddddddd",
                           String.Number2String(length1, "0000000000"), 0,
                           length)
     dataObject += stringBuilder.ToString() + "\n"
     dataObject += self.ToString() + "\n"
     # dataObject.SetData(DataFormats.Html, stringBuilder.ToString());
     # dataObject.SetData(DataFormats.UnicodeText, this.ToString());
     clipboard.setText(dataObject)
コード例 #3
0
    def set_Value(self, value):
        if isinstance(value, AngleGradientSlope):
            self.txtDegree.setText(str(round(value.Degrees, 4)))
            return
            # if self.captionUnits == AngleGradientSlopeUnits.Degrees:
            #     rStr = String.Number2String(value.Degrees, self.numberResolution)
            #     self.angleGradientBox.setText(rStr)
            # elif self.captionUnits == AngleGradientSlopeUnits.Percent:
            #     rStr = String.Number2String(value.Percent, self.numberResolution)
            #     self.angleGradientBox.setText(rStr)
            # elif self.captionUnits == AngleGradientSlopeUnits.Slope:
            #     rStr = String.Number2String(value.Slope, self.numberResolution)
            #     self.angleGradientBox.setText(rStr)
            # return

        try:
            test = float(value)
            rStr = String.Number2String(test, self.numberResolution)
            self.txtDegree.setText(rStr)
        except:
            str0 = "You must put the float type in \"%s\"." % (self.Caption)
            QMessageBox.warning(self, "Warning", str0)
            # rStr = String.Number2String(0, self.numberResolution)
            self.txtDegree.setText("0.0")
コード例 #4
0
    def __init__(self, parent, resoution=None):
        QWidget.__init__(self, parent)
        while not isinstance(parent, QDialog):
            parent = parent.parent()
        self.setObjectName(
            "AngleGradientBoxPanel" +
            str(len(parent.findChildren(AngleGradientBoxPanel))))
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth())
        self.setSizePolicy(sizePolicy)

        self.hLayoutBoxPanel = QHBoxLayout(self)
        self.hLayoutBoxPanel.setSpacing(0)
        self.hLayoutBoxPanel.setContentsMargins(0, 0, 0, 0)
        self.hLayoutBoxPanel.setObjectName(("hLayoutBoxPanel"))
        self.frameBoxPanel = QFrame(self)
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.frameBoxPanel.sizePolicy().hasHeightForWidth())
        self.frameBoxPanel.setSizePolicy(sizePolicy)
        self.frameBoxPanel.setFrameShape(QFrame.NoFrame)
        self.frameBoxPanel.setFrameShadow(QFrame.Raised)
        self.frameBoxPanel.setObjectName(("frameBoxPanel"))
        self.hLayoutframeBoxPanel = QHBoxLayout(self.frameBoxPanel)
        self.hLayoutframeBoxPanel.setSpacing(0)
        self.hLayoutframeBoxPanel.setMargin(0)
        self.hLayoutframeBoxPanel.setObjectName(("hLayoutframeBoxPanel"))
        self.captionLabel = QLabel(self.frameBoxPanel)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.captionLabel.sizePolicy().hasHeightForWidth())
        self.captionLabel.setSizePolicy(sizePolicy)
        self.captionLabel.setMinimumSize(QSize(200, 0))
        self.captionLabel.setMaximumSize(QSize(200, 16777215))
        font = QFont()
        font.setBold(False)
        font.setWeight(50)
        self.captionLabel.setFont(font)
        self.captionLabel.setObjectName(("captionLabel"))
        self.hLayoutframeBoxPanel.addWidget(self.captionLabel)

        self.frameBoxPanelIn = QFrame(self.frameBoxPanel)
        self.frameBoxPanelIn.setFrameShape(QFrame.StyledPanel)
        self.frameBoxPanelIn.setFrameShadow(QFrame.Raised)
        self.frameBoxPanelIn.setObjectName(("frameBoxPanelIn"))
        self.hLayoutframeBoxPanelIn = QHBoxLayout(self.frameBoxPanelIn)
        self.hLayoutframeBoxPanelIn.setSpacing(0)
        self.hLayoutframeBoxPanelIn.setMargin(0)
        self.hLayoutframeBoxPanelIn.setObjectName(("hLayoutframeBoxPanelIn"))

        self.txtDegree = QLineEdit(self.frameBoxPanelIn)
        self.txtDegree.setEnabled(True)
        font = QFont()
        font.setBold(False)
        font.setWeight(50)
        self.txtDegree.setFont(font)
        self.txtDegree.setObjectName(self.objectName() + "_txtDegree")
        self.txtDegree.setText("0.0")
        self.txtDegree.setMinimumWidth(70)
        self.txtDegree.setMaximumWidth(70)
        self.hLayoutframeBoxPanelIn.addWidget(self.txtDegree)

        self.labelDegree = QLabel(self.frameBoxPanelIn)
        self.labelDegree.setObjectName(("labelDegree"))
        self.labelDegree.setText(" " + define._degreeStr + " ")
        self.hLayoutframeBoxPanelIn.addWidget(self.labelDegree)

        self.txtPercent = QLineEdit(self.frameBoxPanelIn)
        self.txtPercent.setEnabled(True)
        font = QFont()
        font.setBold(False)
        font.setWeight(50)
        self.txtPercent.setFont(font)
        self.txtPercent.setObjectName(self.objectName() + "_txtPercent")
        self.txtPercent.setText("0.0")
        self.txtPercent.setMinimumWidth(70)
        self.txtPercent.setMaximumWidth(70)
        self.hLayoutframeBoxPanelIn.addWidget(self.txtPercent)

        self.labelPercent = QLabel(self.frameBoxPanelIn)
        self.labelPercent.setObjectName(("labelPercent"))
        self.labelPercent.setText(" %")
        self.hLayoutframeBoxPanelIn.addWidget(self.labelPercent)

        self.hLayoutframeBoxPanel.addWidget(self.frameBoxPanelIn)

        # self.angleGradientBox = QLineEdit(self.frameBoxPanel)
        # self.angleGradientBox.setEnabled(True)
        # font = QFont()
        # font.setBold(False)
        # font.setWeight(50)
        # self.angleGradientBox.setFont(font)
        # self.angleGradientBox.setObjectName(("angleGradientBox"))
        # self.angleGradientBox.setText("0.0")
        # self.angleGradientBox.setMinimumWidth(70)
        # self.angleGradientBox.setMaximumWidth(70)
        # self.hLayoutframeBoxPanel.addWidget(self.angleGradientBox)

        self.imageButton = QPushButton(self.frameBoxPanel)
        self.imageButton.setText((""))
        icon = QIcon()
        icon.addPixmap(QPixmap(("Resource/convex_hull.png")), QIcon.Normal,
                       QIcon.Off)
        self.imageButton.setIcon(icon)
        self.imageButton.setObjectName(("imageButton"))
        self.imageButton.setVisible(False)
        self.hLayoutframeBoxPanel.addWidget(self.imageButton)

        self.hLayoutBoxPanel.addWidget(self.frameBoxPanel)

        spacerItem = QSpacerItem(0, 0, QSizePolicy.Minimum,
                                 QSizePolicy.Minimum)
        self.hLayoutBoxPanel.addItem(spacerItem)

        self.txtDegree.textChanged.connect(self.txtDegreeChanged)
        self.txtPercent.textChanged.connect(self.txtPercentChanged)
        self.imageButton.clicked.connect(self.imageButtonClicked)

        self.numberResolution = resoution
        str0 = String.Number2String(6.6788, "0.00000")

        self.captionUnits = ""
        self.hidePercentBox()
        self.flag = 0
コード例 #5
0
    def ToString(self, formatStr=None):
        if formatStr == None:
            return self.ToString("G")
        num = 0.0
        num1 = 0.0
        num2 = 0.0
        if (self.IsNaN):
            return ""
        if (formatStr == None or formatStr == ""):
            formatStr = self.defaultformatStr
        # if (provider == null)
        # {
        #     provider = CultureInfo.CurrentCulture;
        # }
        # s = QString(45)
        # s.toUpper()

        if isinstance(formatStr, QString):
            formatStr = formatStr.toUpper()
        else:
            formatStr = formatStr.upper()
        if (formatStr == "G"):
            formatStr = self.defaultformatStr.upper()
        stringBuilder = StringBuilder()
        strS = None
        str1 = None
        str2 = None
        num3 = 0
        num4 = 0
        num5 = 0
        length = -1
        length1 = -1
        length2 = -1
        num6 = 0
        while (len(formatStr) > num6):
            chr = formatStr[num6]
            if (chr == 'D'):
                if (strS != None):
                    return None
                    # throw new ArgumentException("formatStr");
                strS = "0"
                num6 += 1
                flag = False
                while (len(formatStr) > num6):
                    if (formatStr[num6] != 'D'):
                        if (formatStr[num6] != '.'):
                            break
                        strS = String.Concat([strS, "."])
                        flag = True
                        num6 += 1
                    else:
                        strS = String.Concat([strS, "0"])
                        if (flag):
                            num3 += 1
                        num6 += 1
                length = stringBuilder.Length
            elif (chr == 'M'):
                if (strS == None):
                    return None
                    # throw new ArgumentException("formatStr");
                if (str1 != None):
                    return None
                    # throw new ArgumentException("formatStr");
                str1 = "0"
                num6 += 1
                flag1 = False
                while (len(formatStr) > num6):
                    if (formatStr[num6] != 'M'):
                        if (formatStr[num6] != '.'):
                            break
                        str1 = String.Concat([str1, "."])
                        flag1 = True
                        num6 += 1
                    else:
                        str1 = String.Concat([str1, "0"])
                        if (flag1):
                            num4 += 1
                        num6 += 1
                length1 = stringBuilder.Length
            elif (chr == 'S'):
                if (strS == None):
                    return None
                    # throw new ArgumentException("formatStr");
                if (str1 == None):
                    return None
                    # throw new ArgumentException("formatStr");
                if (str2 != None):
                    return None
                    # throw new ArgumentException("formatStr");
                str2 = "0"
                num6 += 1
                flag2 = False
                while (len(formatStr) > num6):
                    if (formatStr[num6] != 'S'):
                        if (formatStr[num6] != '.'):
                            break
                        str2 = String.Concat([str2, "."])
                        flag2 = True
                        num6 += 1
                    else:
                        str2 = String.Concat([str2, "0"])
                        if (flag2):
                            num5 += 1
                        num6 += 1
                length2 = stringBuilder.Length
            elif (chr == 'H'):
                if (self.type == DegreesType.Latitude):
                    if (self.value >= 0):
                        stringBuilder.Append("N")
                    else:
                        stringBuilder.Append("S")
                elif (self.type == DegreesType.Longitude
                      or self.type == DegreesType.Variation):
                    if (self.value >= 0):
                        stringBuilder.Append("E")
                    else:
                        stringBuilder.Append("W")
                num6 += 1
            elif (chr != '-'):
                stringBuilder.Append(chr)
                num6 += 1
            else:
                if (self.value < 0):
                    stringBuilder.Append("-")
                num6 += 1
        if (str2 != None):
            num = math.fabs(self.value) if (not math.isinf(self.value)) else 0
            num7 = math.trunc(num)
            num8 = (num - num7) * 60
            num9 = math.trunc(num8)
            num10 = round((num8 - num9) * 60, num5)
            if (num10 >= 60):
                num10 = num10 - 60
                num9 = num9 + 1
            if (num9 >= 60):
                num9 = num9 - 60
                num7 = num7 + 1

            stringBuilder.Insert(length2, String.Number2String(num10, str2))
            stringBuilder.Insert(length1, String.Number2String(num9, str1))
            stringBuilder.Insert(length, String.Number2String(num7, strS))
        elif (str1 == None):
            if (strS == None):
                return None
                # throw new ArgumentException("formatStr");
            num2 = math.fabs(self.value) if (not math.isinf(self.value)) else 0
            num11 = round(num2, num3)
            stringBuilder.Insert(length, String.Number2String(num11, strS))
        else:
            num1 = math.fabs(self.value) if (not math.isinf(self.value)) else 0
            num12 = math.trunc(num1)
            num13 = round((num1 - num12) * 60, num4)
            if (num13 >= 60):
                num13 = num13 - 60
                num12 = num12 + 1
            stringBuilder.Insert(length1, String.Number2String(num13, str1))
            stringBuilder.Insert(length, String.Number2String(num12, strS))

        return stringBuilder.ToString()
コード例 #6
0
    def __init__(self, parent, resoution = "0.0000"):
        QWidget.__init__(self, parent)
        while not isinstance(parent, QDialog):
            parent = parent.parent()
        self.setObjectName("NumberBoxPanel" + str(len(parent.findChildren(NumberBoxPanel))))


        self.hLayoutBoxPanel = QHBoxLayout(self)
        self.hLayoutBoxPanel.setSpacing(0)
        self.hLayoutBoxPanel.setContentsMargins(0,0,0,0)
        self.hLayoutBoxPanel.setObjectName(("hLayoutBoxPanel"))
        self.frameBoxPanel = QFrame(self)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.frameBoxPanel.sizePolicy().hasHeightForWidth())
        self.frameBoxPanel.setSizePolicy(sizePolicy)
        self.frameBoxPanel.setFrameShape(QFrame.NoFrame)
        self.frameBoxPanel.setFrameShadow(QFrame.Raised)
        self.frameBoxPanel.setObjectName(("frameBoxPanel"))
        self.hLayoutframeBoxPanel = QHBoxLayout(self.frameBoxPanel)
        self.hLayoutframeBoxPanel.setSpacing(0)
        self.hLayoutframeBoxPanel.setMargin(0)
        self.hLayoutframeBoxPanel.setObjectName(("hLayoutframeBoxPanel"))
        self.captionLabel = QLabel(self.frameBoxPanel)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.captionLabel.sizePolicy().hasHeightForWidth())
        self.captionLabel.setSizePolicy(sizePolicy)
        self.captionLabel.setMinimumSize(QSize(200, 0))
        self.captionLabel.setMaximumSize(QSize(200, 16777215))
        font = QFont()
        font.setBold(False)
        font.setWeight(50)
        self.captionLabel.setFont(font)
        self.captionLabel.setObjectName(("captionLabel"))
        self.hLayoutframeBoxPanel.addWidget(self.captionLabel)

        if resoution != None:
            self.numberBox = QLineEdit(self.frameBoxPanel)
            self.numberBox.setEnabled(True)
            font = QFont()
            font.setBold(False)
            font.setWeight(50)
            self.numberBox.setFont(font)
            self.numberBox.setObjectName(self.objectName() + "_numberBox")
            self.numberBox.setText("0.0")
            self.numberBox.setMinimumWidth(70)
            self.numberBox.setMaximumWidth(70)
            self.hLayoutframeBoxPanel.addWidget(self.numberBox)
            self.numberBox.textChanged.connect(self.numberBoxChanged)
            self.numberBox.editingFinished.connect(self.numberBoxEditingFinished)
        else:
            self.numberBox = QSpinBox(self.frameBoxPanel)
            self.numberBox.setObjectName(self.objectName() + "_numberBox")
            self.numberBox.setMinimumWidth(70)
            self.numberBox.setMaximumWidth(70)
            self.numberBox.setMinimum(-100000000)
            self.numberBox.setMaximum(100000000)
            self.numberBox.setValue(1)
            self.hLayoutframeBoxPanel.addWidget(self.numberBox)

        self.imageButton = QPushButton(self.frameBoxPanel)

        self.imageButton.setText((""))
        icon = QIcon()
        icon.addPixmap(QPixmap(("Resource/convex_hull.png")), QIcon.Normal, QIcon.Off)
        self.imageButton.setIcon(icon)
        self.imageButton.setObjectName(("imageButton"))
        self.imageButton.setVisible(False)
        self.hLayoutframeBoxPanel.addWidget(self.imageButton)

        self.hLayoutBoxPanel.addWidget(self.frameBoxPanel)

        spacerItem = QSpacerItem(10,10,QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.hLayoutBoxPanel.addItem(spacerItem)


        self.imageButton.clicked.connect(self.imageButtonClicked)

        self.numberResolution = resoution
        str0 = String.Number2String(6.6788, "0.0000")
        self.Value = 0
        self.captionUnits = ""