Exemple #1
0
    def show_term(self):
        term = self.config.get("Applications", 'Shell')

        args = [
            "-into", str(self.winId()),
            "-bg", self.config.get("Applications", "backgroundColor"),
            "-fg", self.config.get("Applications", "foregroundColor"),
            # blink cursor
            "-bc"]

        if self.config.getboolean("Applications", 'ipython') and \
                which("ipython"):
            args.append("ipython")
        else:
            args.append("python")

        self.process.start(term, args)
        if self.process.error() == QtCore.QProcess.FailedToStart:
            print "xterm not installed"
Exemple #2
0
    def show_term(self):
        term = self.config.get("Applications", 'Shell')

        args = [
            "-into",
            str(self.winId()),
            "-bg",
            self.config.get("Applications", "backgroundColor"),
            "-fg",
            self.config.get("Applications", "foregroundColor"),
            # blink cursor
            "-bc"
        ]

        if self.config.getboolean("Applications", 'ipython') and \
                which("ipython"):
            args.append("ipython")
        else:
            args.append("python")

        self.process.start(term, args)
        if self.process.error() == QtCore.QProcess.FailedToStart:
            print "xterm not installed"
Exemple #3
0
    def show_term(self):
        term = self.config.get("Applications", 'Shell')

        args = [
            "-bg", self.config.get("Applications", "backgroundColor"),
            "-fg", self.config.get("Applications", "foregroundColor"),
            # blink cursor
            "-bc",
            # title
            "-T", QtWidgets.QApplication.translate(
                "pychemqt", "pychemqt python console")]

        if self.config.getboolean("Applications", "maximized"):
            args.append("-maximized")

        if self.config.getboolean("Applications", 'ipython') and \
                which("ipython"):
            args.append("ipython3")
        else:
            args.append("python3")

        self.start(term, args)
        if self.error() == QtCore.QProcess.FailedToStart:
            print("xterm not installed")
Exemple #4
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)