コード例 #1
0
ファイル: UI.py プロジェクト: zcarwile/conda_build_demo
 def setValue(self, value):
     self.value = self.unidad(value)
     if self.magnitud:
         self.entrada.setText(
             representacion(self.value.config(self.UIconfig), self.decimales, self.tolerancia) + self.suffix
         )
     elif self.unidad == float:
         self.entrada.setText(representacion(self.value, self.decimales, self.tolerancia) + self.suffix)
     else:
         self.entrada.setText(str(self.value) + self.suffix)
     self.setToolTip()
コード例 #2
0
ファイル: UI.py プロジェクト: zcarwile/conda_build_demo
 def setToolTip(self):
     try:
         lista = eval(Config.get("Tooltip", self.magnitud))
     except:
         lista = []
     if len(lista) > 0:
         valores = []
         for i in lista:
             valores.append(
                 representacion(self.value.list[i], self.decimales, self.tolerancia) + " " + texto[self.magnitud][i]
             )
         self.entrada.setToolTip(linesep.join(valores))
コード例 #3
0
ファイル: UI.py プロジェクト: zcarwile/conda_build_demo
 def entrada_editingFinished(self):
     if not self.readOnly:
         if self.unidad <> int:
             self.entrada.setText(
                 representacion(float(self.entrada.text().replace(",", ".")), self.decimales, self.tolerancia)
             )
         if self.magnitud:
             self.value = self.unidad(float(self.entrada.text())).unit(
                 Configuracion(self.magnitud, self.UIconfig).func()
             )
         else:
             self.value = self.unidad(self.entrada.text())
         self.valueChanged.emit(self.value)
         self.setToolTip()
コード例 #4
0
ファイル: UI.py プロジェクト: zcarwile/conda_build_demo
 def aceptar(self, Config):
     if not Config.has_section(self.ConfSection):
         Config.add_section(self.ConfSection)
     Config.set(self.ConfSection, "Start", self.inicio.value)
     Config.set(self.ConfSection, "End", self.fin.value)
     Config.set(self.ConfSection, "Step", self.intervalo.value)
     Config.set(self.ConfSection, "Custom", self.Personalizar.isChecked())
     T = []
     if not self.Lista.text().isEmpty():
         T1 = self.Lista.text().split(",")
         for i in T1:
             if self.magnitud == None:
                 T.append(representacion(float(i)))
             else:
                 T.append(representacion(self.unidad(float(i)).unit(Configuracion(self.magnitud).func())))
     Config.set(self.ConfSection, "List", ",".join(T))
     if self.magnitud:
         Config.set(self.ConfSection, "Critic", self.Critica.isChecked())
     Config.set(self.ConfSection, "Color", self.Color.name())
     Config.set(self.ConfSection, "lineWidth", self.Grosor.value())
     Config.set(self.ConfSection, "lineStyle", self.Linea.currentIndex())
     Config.set(self.ConfSection, "Label", self.Label.isChecked())
     Config.set(self.ConfSection, "Units", self.unit.isChecked())
     Config.set(self.ConfSection, "Position", self.Posicion.value())
コード例 #5
0
ファイル: UI.py プロジェクト: zcarwile/conda_build_demo
    def __init__(self, UI, unidad, magnitud, ConfSection, parent=None):
        """UI: dialogo de conversión de unidades
        unidad: la clase unidad que define la magnitud de las variables
        magnitud: texto con la magnitud a usar"""
        super(Isolinea, self).__init__(parent)
        self.ConfSection = ConfSection
        self.magnitud = magnitud
        self.unidad = unidad
        self.Layout = QtGui.QGridLayout(self)
        self.Layout.addItem(QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed), 0, 1, 1, 4)
        self.label1 = QtGui.QLabel(
            QtGui.QApplication.translate("SteamTables", "Inicio", None, QtGui.QApplication.UnicodeUTF8)
        )
        self.label1.setAlignment(QtCore.Qt.AlignCenter | QtCore.Qt.AlignBottom)
        self.Layout.addWidget(self.label1, 1, 1, 1, 1)
        self.inicio = Entrada_con_unidades(UI, unidad, magnitud, boton=False, texto=False)
        self.Layout.addWidget(self.inicio, 2, 1, 1, 1)
        self.label2 = QtGui.QLabel(
            QtGui.QApplication.translate("SteamTables", "Fin", None, QtGui.QApplication.UnicodeUTF8)
        )
        self.label2.setAlignment(QtCore.Qt.AlignCenter | QtCore.Qt.AlignBottom)
        self.Layout.addWidget(self.label2, 1, 2, 1, 1)
        self.fin = Entrada_con_unidades(UI, unidad, magnitud, boton=False, texto=False)
        self.Layout.addWidget(self.fin, 2, 2, 1, 1)
        self.label3 = QtGui.QLabel(
            QtGui.QApplication.translate("SteamTables", "Intervalo", None, QtGui.QApplication.UnicodeUTF8)
        )
        self.label3.setAlignment(QtCore.Qt.AlignCenter | QtCore.Qt.AlignBottom)
        self.Layout.addWidget(self.label3, 1, 3, 1, 1)
        if magnitud == "Temperature":
            self.intervalo = Entrada_con_unidades(UI, DeltaT, magnitud, boton=False)
        else:
            self.intervalo = Entrada_con_unidades(UI, unidad, magnitud, boton=False)
        self.Layout.addWidget(self.intervalo, 2, 3, 1, 2)
        self.Layout.addItem(QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed), 3, 1, 1, 4)
        self.Personalizar = QtGui.QCheckBox(
            QtGui.QApplication.translate("SteamTables", "Personalizar", None, QtGui.QApplication.UnicodeUTF8)
        )
        self.Layout.addWidget(self.Personalizar, 4, 1, 1, 4)
        self.Lista = QtGui.QLineEdit()
        self.Layout.addWidget(self.Lista, 5, 1, 1, 4)
        self.Personalizar.toggled.connect(self.inicio.setDisabled)
        self.Personalizar.toggled.connect(self.fin.setDisabled)
        self.Personalizar.toggled.connect(self.intervalo.setDisabled)
        self.Personalizar.toggled.connect(self.Lista.setEnabled)
        self.Layout.addItem(QtGui.QSpacerItem(10, 10, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed), 6, 1, 1, 4)
        if magnitud:
            self.Critica = QtGui.QCheckBox(
                QtGui.QApplication.translate(
                    "SteamTables", "Incluir linea del punto crítico", None, QtGui.QApplication.UnicodeUTF8
                )
            )
            self.Layout.addWidget(self.Critica, 7, 1, 1, 4)
        self.Layout.addItem(QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed), 8, 1, 1, 4)
        self.groupbox = QtGui.QGroupBox(
            QtGui.QApplication.translate("SteamTables", "Estilo de línea", None, QtGui.QApplication.UnicodeUTF8)
        )
        self.Layout.addWidget(self.groupbox, 9, 1, 1, 4)
        self.horizontalLayout = QtGui.QHBoxLayout(self.groupbox)
        self.Grosor = QtGui.QDoubleSpinBox()
        self.Grosor.setFixedWidth(60)
        self.Grosor.setAlignment(QtCore.Qt.AlignRight)
        self.Grosor.setRange(0.1, 5)
        self.Grosor.setDecimals(1)
        self.Grosor.setSingleStep(0.1)
        self.horizontalLayout.addWidget(self.Grosor)
        self.Linea = QtGui.QComboBox()
        self.Linea.setFixedWidth(80)
        self.Linea.setIconSize(QtCore.QSize(35, 18))
        lineas = [":/button/line.png", ":/button/dash.png", ":/button/line-dot.png", ":/button/dot.png"]
        for i in lineas:
            self.Linea.addItem(QtGui.QIcon(QtGui.QPixmap(i)), "")
        self.horizontalLayout.addWidget(self.Linea)
        self.ColorButton = QtGui.QToolButton()
        self.ColorButton.clicked.connect(self.ColorButtonClicked)
        self.horizontalLayout.addWidget(self.ColorButton)
        self.horizontalLayout.addItem(QtGui.QSpacerItem(10, 10, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed))
        self.Layout.addItem(QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed), 10, 1, 1, 1)

        self.Label = QtGui.QCheckBox(
            QtGui.QApplication.translate("SteamTables", "Etiqueta", None, QtGui.QApplication.UnicodeUTF8)
        )
        self.Layout.addWidget(self.Label, 11, 1, 1, 1)
        self.unit = QtGui.QCheckBox(
            QtGui.QApplication.translate(
                "SteamTables", "Unidades en las etiquetas", None, QtGui.QApplication.UnicodeUTF8
            )
        )
        self.Layout.addWidget(self.unit, 12, 1, 1, 3)
        self.Layout.addWidget(
            QtGui.QLabel(QtGui.QApplication.translate("SteamTables", "Posición", None, QtGui.QApplication.UnicodeUTF8)),
            13,
            1,
            1,
            1,
        )
        self.Posicion = QtGui.QSlider(QtCore.Qt.Horizontal)
        self.Posicion.valueChanged.connect(self.PosicionChanged)
        self.Layout.addWidget(self.Posicion, 13, 2, 1, 1)
        self.label5 = QtGui.QLabel(str(self.Posicion.value()))
        self.label5.setAlignment(QtCore.Qt.AlignRight)
        self.Layout.addWidget(self.label5, 13, 1, 1, 1)
        self.Layout.addItem(
            QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding), 14, 1, 1, 1
        )

        if Config.has_section(ConfSection):
            self.inicio.setValue(Config.getfloat(ConfSection, "Start"))
            self.fin.setValue(Config.getfloat(ConfSection, "End"))
            self.intervalo.setValue(Config.getfloat(ConfSection, "Step"))
            self.Personalizar.setChecked(Config.getboolean(ConfSection, "Custom"))

            if Config.get(ConfSection, "List") <> "":
                T = []
                for i in Config.get(ConfSection, "List").split(","):
                    if magnitud == None:
                        T.append(representacion(float(i)))
                    else:
                        T.append(representacion(unidad(float(i)).config()))
                self.Lista.setText(",".join(T))
            if magnitud:
                self.Critica.setChecked(Config.getboolean(ConfSection, "Critic"))
            self.Color = QtGui.QColor(Config.get(ConfSection, "Color"))
            self.ColorButton.setPalette(QtGui.QPalette(self.Color))
            self.inicio.setDisabled(self.Personalizar.isChecked())
            self.fin.setDisabled(self.Personalizar.isChecked())
            self.intervalo.setDisabled(self.Personalizar.isChecked())
            self.Lista.setEnabled(self.Personalizar.isChecked())
            self.Grosor.setValue(Config.getfloat(ConfSection, "lineWidth"))
            self.Linea.setCurrentIndex(Config.getint(ConfSection, "lineStyle"))
            self.Label.setChecked(Config.getboolean(ConfSection, "Label"))
            self.unit.setChecked(Config.getboolean(ConfSection, "Units"))
            self.Posicion.setValue(Config.getint(ConfSection, "Position"))
コード例 #6
0
ファイル: UI.py プロジェクト: zcarwile/conda_build_demo
 def rellenarTabla(self, valor):
     for i in range(len(valor.list)):
         self.tabla.item(i, 0).setText(representacion(valor.list[i]))
コード例 #7
0
ファイル: UI.py プロジェクト: zcarwile/conda_build_demo
 def actualizar(self):
     if self.value:
         self.value = self.unidad(self.value)
         self.entrada.setText(representacion(self.value.config(), self.decimales, self.tolerancia) + self.suffix)
     if self.magnitud and self.texto:
         self.texto.setText(Configuracion(self.magnitud).text())