Beispiel #1
0
    def __init__(self, config=None, parent=None):
        super(ConfBabel, self).__init__(parent)

        layout = QtWidgets.QGridLayout(self)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Bond color:")), 1, 1)
        self.BondColor = ColorSelector()
        layout.addWidget(self.BondColor, 1, 2)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Foreground color:")), 2, 1)
        self.BackgroundColor = ColorSelector(isAlpha=True)
        layout.addWidget(self.BackgroundColor, 2, 2)
        self.checkColor = QtWidgets.QCheckBox(QtWidgets.QApplication.translate(
            "pychemqt", "Heteroatom in color"))
        layout.addWidget(self.checkColor, 3, 1, 1, 2)
        layout.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed),
            4, 1, 1, 2)

        group = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate("pychemqt", "Atom details"))
        layout.addWidget(group, 5, 1, 1, 2)
        lyt = QtWidgets.QVBoxLayout(group)
        self.radioAll = QtWidgets.QRadioButton(
            QtWidgets.QApplication.translate("pychemqt", "Show all atoms"))
        lyt.addWidget(self.radioAll)
        self.radioEnd = QtWidgets.QRadioButton(
            QtWidgets.QApplication.translate(
                "pychemqt", "Show only terminal atoms"))
        lyt.addWidget(self.radioEnd)
        self.radioNone = QtWidgets.QRadioButton(
            QtWidgets.QApplication.translate("pychemqt", "Do not show atoms"))
        lyt.addWidget(self.radioNone)
        layout.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed),
            6, 1, 1, 2)
        self.checkTighBond = QtWidgets.QCheckBox(
            QtWidgets.QApplication.translate("pychemqt", "Thicker bond lines"))
        layout.addWidget(self.checkTighBond, 7, 1, 1, 2)

        layout.addItem(QtWidgets.QSpacerItem(
            10, 0, QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Expanding), 14, 1, 1, 4)

        if config and config.has_section("Openbabel"):
            self.BondColor.setColor(config.get("Openbabel", 'BondColor'))
            alpha = config.getfloat("Openbabel", "BackColorAlpha")
            self.BackgroundColor.setColor(
                config.get("Openbabel", 'BackColor'), alpha)
            self.checkColor.setChecked(
                config.getboolean("Openbabel", 'AtomsColor'))
            self.radioAll.setChecked(
                config.getboolean("Openbabel", 'AtomsAll'))
            self.radioEnd.setChecked(
                config.getboolean("Openbabel", 'AtomsEnd'))
            self.radioNone.setChecked(
                config.getboolean("Openbabel", 'AtomsNone'))
            self.checkTighBond.setChecked(
                config.getboolean("Openbabel", 'TighBond'))
Beispiel #2
0
    def __init__(self, config=None, parent=None):
        super(ConfBabel, self).__init__(parent)

        layout = QtWidgets.QGridLayout(self)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Bond color:")), 1, 1)
        self.BondColor = ColorSelector()
        layout.addWidget(self.BondColor, 1, 2)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Foreground color:")), 2, 1)
        self.BackgroundColor = ColorSelector(isAlpha=True)
        layout.addWidget(self.BackgroundColor, 2, 2)
        self.checkColor = QtWidgets.QCheckBox(QtWidgets.QApplication.translate(
            "pychemqt", "Heteroatom in color"))
        layout.addWidget(self.checkColor, 3, 1, 1, 2)
        layout.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed),
            4, 1, 1, 2)

        group = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate("pychemqt", "Atom details"))
        layout.addWidget(group, 5, 1, 1, 2)
        lyt = QtWidgets.QVBoxLayout(group)
        self.radioAll = QtWidgets.QRadioButton(
            QtWidgets.QApplication.translate("pychemqt", "Show all atoms"))
        lyt.addWidget(self.radioAll)
        self.radioEnd = QtWidgets.QRadioButton(
            QtWidgets.QApplication.translate(
                "pychemqt", "Show only terminal atoms"))
        lyt.addWidget(self.radioEnd)
        self.radioNone = QtWidgets.QRadioButton(
            QtWidgets.QApplication.translate("pychemqt", "Do not show atoms"))
        lyt.addWidget(self.radioNone)
        layout.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed),
            6, 1, 1, 2)
        self.checkTighBond = QtWidgets.QCheckBox(
            QtWidgets.QApplication.translate("pychemqt", "Thicker bond lines"))
        layout.addWidget(self.checkTighBond, 7, 1, 1, 2)

        layout.addItem(QtWidgets.QSpacerItem(
            10, 0, QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Expanding), 14, 1, 1, 4)

        if config and config.has_section("Openbabel"):
            self.BondColor.setColor(config.get("Openbabel", 'BondColor'))
            alpha = config.getfloat("Openbabel", "BackColorAlpha")
            self.BackgroundColor.setColor(
                config.get("Openbabel", 'BackColor'), alpha)
            self.checkColor.setChecked(
                config.getboolean("Openbabel", 'AtomsColor'))
            self.radioAll.setChecked(
                config.getboolean("Openbabel", 'AtomsAll'))
            self.radioEnd.setChecked(
                config.getboolean("Openbabel", 'AtomsEnd'))
            self.radioNone.setChecked(
                config.getboolean("Openbabel", 'AtomsNone'))
            self.checkTighBond.setChecked(
                config.getboolean("Openbabel", 'TighBond'))
Beispiel #3
0
    def __init__(self, config=None, parent=None):
        super(Widget, self).__init__(parent)

        lyt = QtWidgets.QGridLayout(self)
        lyt.setContentsMargins(0, 0, 0, 0)
        scroll = QtWidgets.QScrollArea()
        scroll.setFrameStyle(QtWidgets.QFrame.NoFrame)
        lyt.addWidget(scroll)
        dlg = QtWidgets.QWidget()
        layout = QtWidgets.QGridLayout(dlg)

        layout.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Input color")), 1, 1)
        self.ColorButtonEntrada = ColorSelector()
        layout.addWidget(self.ColorButtonEntrada, 1, 2)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Output color:")), 2, 1)
        self.ColorButtonSalida = ColorSelector()
        layout.addWidget(self.ColorButtonSalida, 2, 2)

        group = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate("pychemqt", "Line format"))
        layout.addWidget(group, 3, 1, 1, 3)
        lyt = QtWidgets.QHBoxLayout(group)
        self.lineFormat = ConfLine()
        lyt.addWidget(self.lineFormat)

        group = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate("pychemqt", "PFD resolution"))
        layout.addWidget(group, 4, 1, 1, 3)
        lyt = QtWidgets.QHBoxLayout(group)
        self.resolution = UI_confResolution.UI_confResolution_widget(config)
        lyt.addWidget(self.resolution)

        layout.addItem(QtWidgets.QSpacerItem(
            10, 0, QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Expanding), 14, 1, 1, 4)
        scroll.setWidget(dlg)

        if config and config.has_section("PFD"):
            self.ColorButtonEntrada.setColor(
                config.get("PFD", 'Color_Entrada'))
            self.ColorButtonSalida.setColor(config.get("PFD", 'Color_Salida'))
            self.lineFormat.ColorButtonLine.setColor(
                config.get("PFD", 'Color_Stream'))
            self.lineFormat.groupJoint.button(
                (config.getint("PFD", 'Union')+2)*-1).setChecked(True)
            self.lineFormat.mitterLimit.setValue(
                config.getfloat("PFD", 'Miter_limit'))
            self.lineFormat.groupCap.button(
                (config.getint("PFD", 'Punta')+2)*-1).setChecked(True)
            self.lineFormat.guion.setCurrentIndex(
                config.getint("PFD", 'Guion'))
            self.lineFormat.dashOffset.setValue(
                config.getfloat("PFD", 'Dash_offset'))
            self.lineFormat.width.setValue(config.getfloat("PFD", 'Width'))
Beispiel #4
0
    def __init__(self, config=None, parent=None):
        super(ConfGeneral, self).__init__(parent)

        layout = QtWidgets.QGridLayout(self)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Highlight color:")), 1, 1)
        self.ColorButtonResaltado = ColorSelector()
        layout.addWidget(self.ColorButtonResaltado, 1, 2)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Readonly color:")), 2, 1)
        self.ColorButtonReadOnly = ColorSelector()
        layout.addWidget(self.ColorButtonReadOnly, 2, 2)
        layout.addItem(
            QtWidgets.QSpacerItem(10, 0, QtWidgets.QSizePolicy.Fixed,
                                  QtWidgets.QSizePolicy.Fixed), 3, 1)
        group = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate("pychemqt", "Recent Files"))
        layout.addWidget(group, 4, 1, 1, 4)
        lyt = QtWidgets.QHBoxLayout(group)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Number of recent files:")))
        self.recentFiles = QtWidgets.QSpinBox()
        self.recentFiles.setRange(1, 20)
        lyt.addWidget(self.recentFiles)
        lyt.addItem(
            QtWidgets.QSpacerItem(10, 0, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Fixed))
        self.loadLastProject = QtWidgets.QCheckBox(
            QtWidgets.QApplication.translate("pychemqt",
                                             "Load last session project"))
        layout.addWidget(self.loadLastProject, 5, 1)
        self.showTrayIcon = QtWidgets.QCheckBox(
            QtWidgets.QApplication.translate("pychemqt", "Show tray icon"))
        layout.addWidget(self.showTrayIcon, 6, 1)

        layout.addItem(
            QtWidgets.QSpacerItem(10, 0, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding), 14, 1, 1,
            4)

        if config and config.has_section("General"):
            self.ColorButtonResaltado.setColor(
                config.get("General", 'Color_Resaltado'))
            self.ColorButtonReadOnly.setColor(
                config.get("General", 'Color_ReadOnly'))
            self.recentFiles.setValue(config.getint("General", 'Recent_Files'))
            self.loadLastProject.setChecked(
                config.getboolean("General", 'Load_Last_Project'))
            self.showTrayIcon.setChecked(config.getboolean("General", 'Tray'))
Beispiel #5
0
    def __init__(self, config=None, parent=None):
        super(ConfGeneral, self).__init__(parent)

        layout = QtWidgets.QGridLayout(self)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Highlight color:")), 1, 1)
        self.ColorButtonResaltado = ColorSelector()
        layout.addWidget(self.ColorButtonResaltado, 1, 2)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Readonly color:")), 2, 1)
        self.ColorButtonReadOnly = ColorSelector()
        layout.addWidget(self.ColorButtonReadOnly, 2, 2)
        layout.addItem(QtWidgets.QSpacerItem(
            10, 0, QtWidgets.QSizePolicy.Fixed,
            QtWidgets.QSizePolicy.Fixed), 3, 1)
        group = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate("pychemqt", "Recent Files"))
        layout.addWidget(group, 4, 1, 1, 4)
        lyt = QtWidgets.QHBoxLayout(group)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Number of recent files:")))
        self.recentFiles = QtWidgets.QSpinBox()
        self.recentFiles.setRange(1, 20)
        lyt.addWidget(self.recentFiles)
        lyt.addItem(QtWidgets.QSpacerItem(
            10, 0, QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Fixed))
        self.loadLastProject = QtWidgets.QCheckBox(
            QtWidgets.QApplication.translate(
                "pychemqt", "Load last session project"))
        layout.addWidget(self.loadLastProject, 5, 1)
        self.showTrayIcon = QtWidgets.QCheckBox(
            QtWidgets.QApplication.translate("pychemqt", "Show tray icon"))
        layout.addWidget(self.showTrayIcon, 6, 1)

        layout.addItem(QtWidgets.QSpacerItem(
            10, 0, QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Expanding), 14, 1, 1, 4)

        if config and config.has_section("General"):
            self.ColorButtonResaltado.setColor(
                config.get("General", 'Color_Resaltado'))
            self.ColorButtonReadOnly.setColor(
                config.get("General", 'Color_ReadOnly'))
            self.recentFiles.setValue(config.getint("General", 'Recent_Files'))
            self.loadLastProject.setChecked(
                config.getboolean("General", 'Load_Last_Project'))
            self.showTrayIcon.setChecked(config.getboolean("General", 'Tray'))
Beispiel #6
0
    def __init__(self, config=None, parent=None):
        super(ConfApplications, self).__init__(parent)
        layout = QtWidgets.QGridLayout(self)
        l = QtWidgets.QApplication.translate("pychemqt", "External Calculator")
        msg = QtWidgets.QApplication.translate(
            "pychemqt", "Select External Calculator Application")
        self.calculadora = PathConfig(l + ":", msg=msg, patron="exe")
        layout.addWidget(self.calculadora, 1, 1)
        l = QtWidgets.QApplication.translate("pychemqt", "Text viewer")
        msg = QtWidgets.QApplication.translate(
            "pychemqt", "Select External Text Viewer Application")
        self.textViewer = PathConfig(l + ":", msg=msg, patron="exe")
        layout.addWidget(self.textViewer, 2, 1)

        terminal = QtWidgets.QGroupBox()
        layout.addWidget(terminal, 3, 1)
        layoutTerminal = QtWidgets.QGridLayout(terminal)
        msg = QtWidgets.QApplication.translate(
            "pychemqt", "Select External shell")
        self.terminal = PathConfig("", msg=msg, patron="exe")
        layoutTerminal.addWidget(self.terminal, 1, 1, 1, 3)
        layoutTerminal.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Foreground color:")),
            2, 1)
        self.ForegroundColor = ColorSelector()
        layoutTerminal.addWidget(self.ForegroundColor, 2, 2, 1, 2)
        layoutTerminal.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Background color:")),
            3, 1)
        self.BackgroundColor = ColorSelector()
        layoutTerminal.addWidget(self.BackgroundColor, 3, 2, 1, 2)
        self.ipython = QtWidgets.QCheckBox(QtWidgets.QApplication.translate(
            "pychemqt", "Use ipython if its available"))
        layoutTerminal.addWidget(self.ipython, 4, 1, 1, 3)
        self.maximized = QtWidgets.QCheckBox(
            QtWidgets.QApplication.translate("pychemqt", "Show maximized"))
        layoutTerminal.addWidget(self.maximized, 5, 1, 1, 3)
        layout.addItem(QtWidgets.QSpacerItem(
            10, 0, QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Expanding), 10, 1)

        terminalTitle = QtWidgets.QApplication.translate("pychemqt", "Shell")
        if sys.platform == "win32":
            terminal.setEnabled(False)
            terminalTitle += " (" + QtWidgets.QApplication.translate(
                "pychemqt", "Only Available on linux") + ")"
        terminal.setTitle(terminalTitle)

        if config.has_section("Applications"):
            self.calculadora.setText(config.get("Applications", 'Calculator'))
            self.textViewer.setText(config.get("Applications", 'TextViewer'))
            self.terminal.setText(config.get("Applications", 'Shell'))
            self.ipython.setChecked(
                config.getboolean("Applications", 'ipython'))
            self.maximized.setChecked(
                config.getboolean("Applications", 'maximized'))
            self.ForegroundColor.setColor(
                config.get("Applications", 'foregroundColor'))
            self.BackgroundColor.setColor(
                config.get("Applications", 'backgroundColor'))

        self.ipython.setEnabled(bool(which("ipython3")))

        # TODO: Habilitar cuando añada soporte para otras terminales
        self.terminal.setEnabled(False)
Beispiel #7
0
    def __init__(self, pen=None, parent=None):
        super(ConfLine, self).__init__(parent)
        lyt = QtWidgets.QVBoxLayout(self)

        lyt1 = QtWidgets.QHBoxLayout()
        lyt1.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Line")))
        self.ColorButtonLine = ColorSelector()
        self.ColorButtonLine.setToolTip(
            QtWidgets.QApplication.translate("pychemqt", "Default line color"))
        lyt1.addWidget(self.ColorButtonLine)
        self.width = Entrada_con_unidades(
            float, width=50, decimales=1, spinbox=True, step=0.1,
            textounidad="px")
        self.width.entrada.setToolTip(QtWidgets.QApplication.translate(
            "pychemqt", "Line Width"))
        lyt1.addWidget(self.width)
        lyt.addLayout(lyt1)

        lyt2 = QtWidgets.QHBoxLayout()
        lyt2.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Join")))
        self.mitterLimit = Entrada_con_unidades(
            float, width=50, decimales=1, spinbox=True, step=0.1)
        self.mitterLimit.entrada.setToolTip(QtWidgets.QApplication.translate(
            "pychemqt", "Mitter Limit"))
        lyt2.addWidget(self.mitterLimit)
        toolJoinMitter = QtWidgets.QToolButton()
        toolJoinMitter.setIcon(QtGui.QIcon(QtGui.QPixmap(
            os.environ["pychemqt"] +
            os.path.join("images", "button", "stroke-join-miter.png"))))
        toolJoinMitter.setIconSize(QtCore.QSize(24, 24))
        toolJoinMitter.setCheckable(True)
        toolJoinMitter.setToolTip(QtWidgets.QApplication.translate(
            "pychemqt",
            "Join mitter: The triangular notch between the two lines is not "
            "filled"))
        lyt2.addWidget(toolJoinMitter)
        toolJoinBevel = QtWidgets.QToolButton()
        toolJoinBevel.setIcon(QtGui.QIcon(QtGui.QPixmap(
            os.environ["pychemqt"] +
            os.path.join("images", "button", "stroke-join-bevel.png"))))
        toolJoinBevel.setIconSize(QtCore.QSize(24, 24))
        toolJoinBevel.setCheckable(True)
        toolJoinBevel.setToolTip(QtWidgets.QApplication.translate(
            "pychemqt",
            "Join bevel: The triangular notch between the two lines is "
            "filled"))
        lyt2.addWidget(toolJoinBevel)
        toolJoinRound = QtWidgets.QToolButton()
        toolJoinRound.setIcon(QtGui.QIcon(QtGui.QPixmap(
            os.environ["pychemqt"] +
            os.path.join("images", "button", "stroke-join-round.png"))))
        toolJoinRound.setIconSize(QtCore.QSize(24, 24))
        toolJoinRound.setCheckable(True)
        toolJoinRound.setToolTip(QtWidgets.QApplication.translate(
            "pychemqt",
            "Join round: A circular arc between the two lines is filled"))
        lyt2.addWidget(toolJoinRound)

        self.groupJoint = QtWidgets.QButtonGroup()
        self.groupJoint.addButton(toolJoinMitter)
        self.groupJoint.addButton(toolJoinBevel)
        self.groupJoint.addButton(toolJoinRound)
        self.groupJoint.buttonClicked["int"].connect(self.mitterlimitEnabled)
        lyt.addLayout(lyt2)

        lyt3 = QtWidgets.QHBoxLayout()
        lyt3.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Cap")))
        toolCapFlat = QtWidgets.QToolButton()
        toolCapFlat.setIcon(QtGui.QIcon(QtGui.QPixmap(
            os.environ["pychemqt"] +
            os.path.join("images", "button", "stroke-cap-butt.png"))))
        toolCapFlat.setIconSize(QtCore.QSize(24, 24))
        toolCapFlat.setCheckable(True)
        toolCapFlat.setToolTip(QtWidgets.QApplication.translate(
            "pychemqt",
            "Flat Cap: A square line end that does not cover the end point of "
            "the line"))
        lyt3.addWidget(toolCapFlat)
        toolCapRound = QtWidgets.QToolButton()
        toolCapRound.setIcon(QtGui.QIcon(QtGui.QPixmap(
            os.environ["pychemqt"] +
            os.path.join("images", "button", "stroke-cap-round.png"))))
        toolCapRound.setIconSize(QtCore.QSize(24, 24))
        toolCapRound.setCheckable(True)
        toolCapRound.setToolTip(QtWidgets.QApplication.translate(
            "pychemqt", "Round Cap: A rounded line end"))
        lyt3.addWidget(toolCapRound)
        toolCapSquare = QtWidgets.QToolButton()
        toolCapSquare.setIcon(QtGui.QIcon(QtGui.QPixmap(
            os.environ["pychemqt"] +
            os.path.join("images", "button", "stroke-cap-square.png"))))
        toolCapSquare.setIconSize(QtCore.QSize(24, 24))
        toolCapSquare.setCheckable(True)
        toolCapSquare.setToolTip(QtWidgets.QApplication.translate(
            "pychemqt",
            "Square Cap: A square line end that covers the end point and "
            "extends beyond it by half the line width"))
        lyt3.addWidget(toolCapSquare)

        self.groupCap = QtWidgets.QButtonGroup()
        self.groupCap.addButton(toolCapFlat)
        self.groupCap.addButton(toolCapRound)
        self.groupCap.addButton(toolCapSquare)
        lyt.addLayout(lyt3)

        lyt4 = QtWidgets.QHBoxLayout()
        lyt4.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Dash")))
        self.guion = PFDLineCombo()
        lyt4.addWidget(self.guion)
        self.dashOffset = Entrada_con_unidades(
            float, width=50, decimales=1, spinbox=True, step=0.1)
        self.dashOffset.entrada.setToolTip(QtWidgets.QApplication.translate(
            "pychemqt", "Dash offset"))
        lyt4.addWidget(self.dashOffset)
        lyt.addLayout(lyt4)
        lyt.addItem(QtWidgets.QSpacerItem(
            0, 0, QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Expanding))

        if pen:
            self.ColorButtonLine.setColor(pen.color().name())
            self.groupJoint.button((self.join.index(
                pen.joinStyle())+2)*-1).setChecked(True)
            self.mitterLimit.setValue(pen.miterLimit())
            self.groupCap.button((self.cap.index(
                pen.capStyle())+2)*-1).setChecked(True)
            self.guion.setCurrentIndex(self.line.index(pen.style()))
            self.dashOffset.setValue(pen.dashOffset())
            self.width.setValue(pen.widthF())
Beispiel #8
0
    def __init__(self, config=None, parent=None):
        super(Widget, self).__init__(parent)

        lyt = QtWidgets.QGridLayout(self)
        lyt.setContentsMargins(0, 0, 0, 0)
        scroll = QtWidgets.QScrollArea()
        scroll.setFrameStyle(QtWidgets.QFrame.NoFrame)
        lyt.addWidget(scroll)
        dlg = QtWidgets.QWidget()
        layout = QtWidgets.QGridLayout(dlg)

        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Input color")),
            1, 1)
        self.ColorButtonEntrada = ColorSelector()
        layout.addWidget(self.ColorButtonEntrada, 1, 2)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Output color:")),
            2, 1)
        self.ColorButtonSalida = ColorSelector()
        layout.addWidget(self.ColorButtonSalida, 2, 2)

        group = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate("pychemqt", "Line format"))
        layout.addWidget(group, 3, 1, 1, 3)
        lyt = QtWidgets.QHBoxLayout(group)
        self.lineFormat = ConfLine()
        lyt.addWidget(self.lineFormat)

        group = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate("pychemqt", "PFD resolution"))
        layout.addWidget(group, 4, 1, 1, 3)
        lyt = QtWidgets.QHBoxLayout(group)
        self.resolution = UI_confResolution.UI_confResolution_widget(config)
        lyt.addWidget(self.resolution)

        layout.addItem(
            QtWidgets.QSpacerItem(10, 0, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding), 14, 1, 1,
            4)
        scroll.setWidget(dlg)

        if config and config.has_section("PFD"):
            self.ColorButtonEntrada.setColor(config.get(
                "PFD", 'Color_Entrada'))
            self.ColorButtonSalida.setColor(config.get("PFD", 'Color_Salida'))
            self.lineFormat.ColorButtonLine.setColor(
                config.get("PFD", 'Color_Stream'))
            self.lineFormat.groupJoint.button(
                (config.getint("PFD", 'Union') + 2) * -1).setChecked(True)
            self.lineFormat.mitterLimit.setValue(
                config.getfloat("PFD", 'Miter_limit'))
            self.lineFormat.groupCap.button(
                (config.getint("PFD", 'Punta') + 2) * -1).setChecked(True)
            self.lineFormat.guion.setCurrentIndex(config.getint(
                "PFD", 'Guion'))
            self.lineFormat.dashOffset.setValue(
                config.getfloat("PFD", 'Dash_offset'))
            self.lineFormat.width.setValue(config.getfloat("PFD", 'Width'))
Beispiel #9
0
    def __init__(self, pen=None, parent=None):
        super(ConfLine, self).__init__(parent)
        lyt = QtWidgets.QVBoxLayout(self)

        lyt1 = QtWidgets.QHBoxLayout()
        lyt1.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Line")))
        self.ColorButtonLine = ColorSelector()
        self.ColorButtonLine.setToolTip(
            QtWidgets.QApplication.translate("pychemqt", "Default line color"))
        lyt1.addWidget(self.ColorButtonLine)
        self.width = Entrada_con_unidades(float,
                                          width=50,
                                          decimales=1,
                                          spinbox=True,
                                          step=0.1,
                                          textounidad="px")
        self.width.entrada.setToolTip(
            QtWidgets.QApplication.translate("pychemqt", "Line Width"))
        lyt1.addWidget(self.width)
        lyt.addLayout(lyt1)

        lyt2 = QtWidgets.QHBoxLayout()
        lyt2.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Join")))
        self.mitterLimit = Entrada_con_unidades(float,
                                                width=50,
                                                decimales=1,
                                                spinbox=True,
                                                step=0.1)
        self.mitterLimit.entrada.setToolTip(
            QtWidgets.QApplication.translate("pychemqt", "Mitter Limit"))
        lyt2.addWidget(self.mitterLimit)
        toolJoinMitter = QtWidgets.QToolButton()
        toolJoinMitter.setIcon(
            QtGui.QIcon(
                QtGui.QPixmap(os.environ["CheProcess"] + os.path.join(
                    "images", "button", "stroke-join-miter.png"))))
        toolJoinMitter.setIconSize(QtCore.QSize(24, 24))
        toolJoinMitter.setCheckable(True)
        toolJoinMitter.setToolTip(
            QtWidgets.QApplication.translate(
                "pychemqt",
                "Join mitter: The triangular notch between the two lines is not "
                "filled"))
        lyt2.addWidget(toolJoinMitter)
        toolJoinBevel = QtWidgets.QToolButton()
        toolJoinBevel.setIcon(
            QtGui.QIcon(
                QtGui.QPixmap(os.environ["CheProcess"] + os.path.join(
                    "images", "button", "stroke-join-bevel.png"))))
        toolJoinBevel.setIconSize(QtCore.QSize(24, 24))
        toolJoinBevel.setCheckable(True)
        toolJoinBevel.setToolTip(
            QtWidgets.QApplication.translate(
                "pychemqt",
                "Join bevel: The triangular notch between the two lines is "
                "filled"))
        lyt2.addWidget(toolJoinBevel)
        toolJoinRound = QtWidgets.QToolButton()
        toolJoinRound.setIcon(
            QtGui.QIcon(
                QtGui.QPixmap(os.environ["CheProcess"] + os.path.join(
                    "images", "button", "stroke-join-round.png"))))
        toolJoinRound.setIconSize(QtCore.QSize(24, 24))
        toolJoinRound.setCheckable(True)
        toolJoinRound.setToolTip(
            QtWidgets.QApplication.translate(
                "pychemqt",
                "Join round: A circular arc between the two lines is filled"))
        lyt2.addWidget(toolJoinRound)

        self.groupJoint = QtWidgets.QButtonGroup()
        self.groupJoint.addButton(toolJoinMitter)
        self.groupJoint.addButton(toolJoinBevel)
        self.groupJoint.addButton(toolJoinRound)
        self.groupJoint.buttonClicked["int"].connect(self.mitterlimitEnabled)
        lyt.addLayout(lyt2)

        lyt3 = QtWidgets.QHBoxLayout()
        lyt3.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Cap")))
        toolCapFlat = QtWidgets.QToolButton()
        toolCapFlat.setIcon(
            QtGui.QIcon(
                QtGui.QPixmap(
                    os.environ["CheProcess"] +
                    os.path.join("images", "button", "stroke-cap-butt.png"))))
        toolCapFlat.setIconSize(QtCore.QSize(24, 24))
        toolCapFlat.setCheckable(True)
        toolCapFlat.setToolTip(
            QtWidgets.QApplication.translate(
                "pychemqt",
                "Flat Cap: A square line end that does not cover the end point of "
                "the line"))
        lyt3.addWidget(toolCapFlat)
        toolCapRound = QtWidgets.QToolButton()
        toolCapRound.setIcon(
            QtGui.QIcon(
                QtGui.QPixmap(
                    os.environ["CheProcess"] +
                    os.path.join("images", "button", "stroke-cap-round.png"))))
        toolCapRound.setIconSize(QtCore.QSize(24, 24))
        toolCapRound.setCheckable(True)
        toolCapRound.setToolTip(
            QtWidgets.QApplication.translate("pychemqt",
                                             "Round Cap: A rounded line end"))
        lyt3.addWidget(toolCapRound)
        toolCapSquare = QtWidgets.QToolButton()
        toolCapSquare.setIcon(
            QtGui.QIcon(
                QtGui.QPixmap(os.environ["CheProcess"] + os.path.join(
                    "images", "button", "stroke-cap-square.png"))))
        toolCapSquare.setIconSize(QtCore.QSize(24, 24))
        toolCapSquare.setCheckable(True)
        toolCapSquare.setToolTip(
            QtWidgets.QApplication.translate(
                "pychemqt",
                "Square Cap: A square line end that covers the end point and "
                "extends beyond it by half the line width"))
        lyt3.addWidget(toolCapSquare)

        self.groupCap = QtWidgets.QButtonGroup()
        self.groupCap.addButton(toolCapFlat)
        self.groupCap.addButton(toolCapRound)
        self.groupCap.addButton(toolCapSquare)
        lyt.addLayout(lyt3)

        lyt4 = QtWidgets.QHBoxLayout()
        lyt4.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Dash")))
        self.guion = PFDLineCombo()
        lyt4.addWidget(self.guion)
        self.dashOffset = Entrada_con_unidades(float,
                                               width=50,
                                               decimales=1,
                                               spinbox=True,
                                               step=0.1)
        self.dashOffset.entrada.setToolTip(
            QtWidgets.QApplication.translate("pychemqt", "Dash offset"))
        lyt4.addWidget(self.dashOffset)
        lyt.addLayout(lyt4)
        lyt.addItem(
            QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding))

        if pen:
            self.ColorButtonLine.setColor(pen.color().name())
            self.groupJoint.button(
                (self.join.index(pen.joinStyle()) + 2) * -1).setChecked(True)
            self.mitterLimit.setValue(pen.miterLimit())
            self.groupCap.button(
                (self.cap.index(pen.capStyle()) + 2) * -1).setChecked(True)
            self.guion.setCurrentIndex(self.line.index(pen.style()))
            self.dashOffset.setValue(pen.dashOffset())
            self.width.setValue(pen.widthF())