Пример #1
0
    def __init__(self, config, parent=None):
        super(ConfTooltipEntity, self).__init__(parent)

        layout = QtWidgets.QVBoxLayout(self)
        self.eleccion = QtWidgets.QComboBox()
        layout.addWidget(self.eleccion)
        self.stacked = QtWidgets.QStackedWidget()
        self.eleccion.currentIndexChanged.connect(self.stacked.setCurrentIndex)
        layout.addWidget(self.stacked)

        self.tabla = [QtWidgets.QTableWidget()]
        self.tabla[0].setRowCount(len(corriente.Corriente.propertiesNames()))
        self.tabla[0].setColumnCount(1)
        self.tabla[0].setColumnWidth(0, 16)
        self.tabla[0].setItemDelegateForColumn(0, CheckEditor(self))
        self.tabla[0].horizontalHeader().setVisible(False)
        self.stacked.addWidget(self.tabla[0])
        self.eleccion.addItem(
            QtWidgets.QApplication.translate("pychemqt", "Stream"))

        for i, propiedad in enumerate(corriente.Corriente.propertiesNames()):
            item = QtWidgets.QTableWidgetItem(propiedad[0])
            self.tabla[0].setVerticalHeaderItem(i, item)
            self.tabla[0].setRowHeight(i, 24)
            self.tabla[0].setItem(i, 0, QtWidgets.QTableWidgetItem(""))
            self.tabla[0].item(i, 0).setTextAlignment(QtCore.Qt.AlignRight
                                                      | QtCore.Qt.AlignVCenter)
            self.tabla[0].openPersistentEditor(self.tabla[0].item(i, 0))

        if config.has_option("TooltipEntity", "Corriente"):
            lista = eval(config.get("TooltipEntity", "Corriente"))
            for i in lista:
                self.tabla[0].item(i, 0).setText("true")

        for i, equipo in enumerate(equipments):
            propiedades = [prop[0] for prop in equipo.propertiesNames()]
            self.tabla.append(QtWidgets.QTableWidget())
            self.stacked.addWidget(self.tabla[-1])
            self.tabla[-1].setRowCount(len(propiedades))
            self.tabla[-1].setColumnCount(1)
            self.tabla[-1].setColumnWidth(0, 16)
            self.tabla[-1].setItemDelegateForColumn(0, CheckEditor(self))
            self.tabla[-1].horizontalHeader().setVisible(False)
            for j, propiedad in enumerate(propiedades):
                item = QtWidgets.QTableWidgetItem(propiedad)
                self.tabla[-1].setVerticalHeaderItem(j, item)
                self.tabla[-1].setRowHeight(j, 24)
                self.tabla[-1].setItem(j, 0, QtWidgets.QTableWidgetItem(""))
                self.tabla[-1].item(
                    j, 0).setTextAlignment(QtCore.Qt.AlignRight
                                           | QtCore.Qt.AlignVCenter)
                self.tabla[-1].openPersistentEditor(self.tabla[-1].item(j, 0))
            self.rellenar(equipo.__name__, i + 1, config)
            self.eleccion.addItem(equipo.title)
Пример #2
0
    def __init__(self, config, parent=None):
        super(ConfTooltipUnit, self).__init__(parent)

        layout = QtWidgets.QVBoxLayout(self)
        self.checkShow = QtWidgets.QCheckBox(
            QtWidgets.QApplication.translate("pychemqt", "Show Tool Tips"))
        self.checkShow.toggled.connect(self.checkShow_Toggled)
        layout.addWidget(self.checkShow)

        self.groupsystems = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate(
                "pychemqt", "Systems of measurement"))
        layout.addWidget(self.groupsystems)
        lytSystems = QtWidgets.QHBoxLayout(self.groupsystems)
        self.SI = QtWidgets.QCheckBox(
            QtWidgets.QApplication.translate("pychemqt", "SI"))
        self.SI.toggled.connect(partial(self.systems, "si"))
        lytSystems.addWidget(self.SI)
        self.AltSI = QtWidgets.QCheckBox(
            QtWidgets.QApplication.translate("pychemqt", "Alt SI"))
        self.AltSI.toggled.connect(partial(self.systems, "altsi"))
        lytSystems.addWidget(self.AltSI)
        self.English = QtWidgets.QCheckBox(
            QtWidgets.QApplication.translate("pychemqt", "English"))
        self.English.toggled.connect(partial(self.systems, "english"))
        lytSystems.addWidget(self.English)
        self.Metric = QtWidgets.QCheckBox(
            QtWidgets.QApplication.translate("pychemqt", "Metric"))
        self.Metric.toggled.connect(partial(self.systems, "metric"))
        lytSystems.addWidget(self.Metric)
        self.CGS = QtWidgets.QCheckBox(
            QtWidgets.QApplication.translate("pychemqt", "CGS"))
        self.CGS.toggled.connect(partial(self.systems, "cgs"))
        lytSystems.addWidget(self.CGS)
        layout.addItem(QtWidgets.QSpacerItem(
            10, 10, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed))

        self.eleccion = QtWidgets.QComboBox()
        layout.addWidget(self.eleccion)
        self.stacked = QtWidgets.QStackedWidget()
        self.eleccion.currentIndexChanged.connect(self.stacked.setCurrentIndex)
        layout.addWidget(self.stacked)

        self.tabla = []
        for i, magnitud in enumerate(unidades._magnitudes[:-1]):
            textos = magnitud[2].__text__
            self.tabla.append(QtWidgets.QTableWidget())
            self.stacked.addWidget(self.tabla[i])

            self.tabla[i].setRowCount(len(textos))
            self.tabla[i].setColumnCount(1)
            self.tabla[i].setColumnWidth(0, 16)
            self.tabla[i].setItemDelegateForColumn(0, CheckEditor(self))
            self.tabla[i].horizontalHeader().setVisible(False)
            for j in range(len(textos)):
                item = QtWidgets.QTableWidgetItem(textos[j])
                self.tabla[i].setVerticalHeaderItem(j, item)
                self.tabla[i].setRowHeight(j, 24)
                self.tabla[i].setItem(j, 0, QtWidgets.QTableWidgetItem(""))
                self.tabla[i].item(j, 0).setTextAlignment(
                    QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
                self.tabla[i].openPersistentEditor(self.tabla[i].item(j, 0))
            self.rellenar(magnitud[0], i, config)
            self.eleccion.addItem(magnitud[1])

        if config.has_section("Tooltip"):
            self.checkShow.setChecked(config.getboolean("Tooltip", "Show"))
            self.SI.setChecked(config.getboolean("Tooltip", "SI"))
            self.AltSI.setChecked(config.getboolean("Tooltip", "AltSI"))
            self.English.setChecked(config.getboolean("Tooltip", "English"))
            self.Metric.setChecked(config.getboolean("Tooltip", "Metric"))
            self.CGS.setChecked(config.getboolean("Tooltip", "CGS"))
Пример #3
0
    def __init__(self, config=None, parent=None):
        super(Ui_Properties, self).__init__(parent)
        if config and config.has_option("MEoS", "properties"):
            values = config.get("MEoS", "properties")
            if isinstance(values, str):
                values = eval(values)
            fase = config.getboolean("MEoS", "phase")
            self.order = config.get("MEoS", "propertiesOrder")
            if isinstance(self.order, str):
                self.order = eval(self.order)
        else:
            values = self._default
            fase = False
            self.order = list(range(N_PROP))

        self.setWindowTitle(
            QtWidgets.QApplication.translate("pychemqt", "Select Properties"))
        layout = QtWidgets.QGridLayout(self)
        self.prop = QtWidgets.QTableWidget(len(ThermoAdvanced.properties()), 2)
        self.prop.verticalHeader().hide()
        self.prop.horizontalHeader().hide()
        self.prop.horizontalHeader().setStretchLastSection(True)
        self.prop.setGridStyle(QtCore.Qt.NoPen)
        self.prop.setColumnWidth(0, 18)
        self.prop.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
        self.prop.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
        self.prop.setItemDelegateForColumn(0, CheckEditor(self))
        for i, value in enumerate(values):
            if value == 1:
                val = "1"
            else:
                val = ""
            self.prop.setItem(i, 0, QtWidgets.QTableWidgetItem(val))
            name = ThermoAdvanced.propertiesName()[self.order[i]]
            self.prop.setItem(i, 1, QtWidgets.QTableWidgetItem(name))
            self.prop.setRowHeight(i, 20)
            self.prop.openPersistentEditor(self.prop.item(i, 0))
        self.prop.currentCellChanged.connect(self.comprobarBotones)
        self.prop.cellDoubleClicked.connect(self.toggleCheck)
        layout.addWidget(self.prop, 1, 1, 6, 1)

        self.ButtonArriba = QtWidgets.QToolButton()
        self.ButtonArriba.setIcon(QtGui.QIcon(QtGui.QPixmap(
            os.environ["pychemqt"] +
            os.path.join("images", "button", "arrow-up.png"))))
        self.ButtonArriba.clicked.connect(self.Up)
        layout.addWidget(self.ButtonArriba, 3, 2, 1, 1)
        self.ButtonAbajo = QtWidgets.QToolButton()
        self.ButtonAbajo.setIcon(QtGui.QIcon(QtGui.QPixmap(
            os.environ["pychemqt"] +
            os.path.join("images", "button", "arrow-down.png"))))
        self.ButtonAbajo.clicked.connect(self.Down)
        layout.addWidget(self.ButtonAbajo, 4, 2, 1, 1)

        self.checkFase = QtWidgets.QCheckBox(QtWidgets.QApplication.translate(
            "pychemqt", "Show bulk, liquid and vapor properties"))
        self.checkFase.setChecked(fase)
        layout.addWidget(self.checkFase, 7, 1, 1, 2)
        self.buttonBox = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Reset | QtWidgets.QDialogButtonBox.Ok |
            QtWidgets.QDialogButtonBox.Cancel)
        self.buttonBox.addButton(
            QtWidgets.QApplication.translate("pychemqt", "Mark all"),
            QtWidgets.QDialogButtonBox.ResetRole)
        self.buttonBox.addButton(
            QtWidgets.QApplication.translate("pychemqt", "No Mark"),
            QtWidgets.QDialogButtonBox.ResetRole)
        self.btYes = QtWidgets.QPushButton
        self.buttonBox.clicked.connect(self.buttonClicked)
        layout.addWidget(self.buttonBox, 8, 1, 1, 2)