示例#1
0
    def suggestDriver(self):
        config = self.iface.getConfig()
        dontAskAgainName = "Driver Suggestion"
        shouldBeShown, answer = kdeui.KMessageBox.shouldBeShownYesNo(
            dontAskAgainName)
        if not shouldBeShown or not config:
            return

        preferredDriver = config.preferredDriver(installed=False)
        if preferredDriver is None or preferredDriver == self.iface.getDriver(
        ):
            return

        isInstalled = preferredDriver == config.preferredDriver()

        if isInstalled:
            msg = kdecore.i18n(
                "<qt>To get better performance, you may want to "
                "use <b>%1</b> driver provided by hardware vendor. "
                "Do you want to use this driver?</p></qt>", preferredDriver)
            answer = kdeui.KMessageBox.questionYesNo(
                self, msg, QtCore.QString(), kdeui.KStandardGuiItem.yes(),
                kdeui.KStandardGuiItem.no(), dontAskAgainName)
            if answer == kdeui.KMessageBox.Yes:
                self.cardDialog.setDriver(preferredDriver)

        else:
            pm = str(kdecore.KStandardDirs.findExe("package-manager"))
            if not pm:
                return

            package = driverPackages.get(preferredDriver)
            if package is None:
                return
            msg = kdecore.i18n(
                "<qt>To get better performance, you may want to "
                "use <b>%1</b> driver provided by hardware vendor. "
                "To use it, you must install <b>%2</b> package and"
                " choose <b>%1</b> from video card options.</qt>",
                preferredDriver, package)
            startPMButton = kdeui.KGuiItem(
                kdecore.i18n("Start Package Manager"),
                kdeui.KIcon("package-manager"))
            answer = kdeui.KMessageBox.questionYesNo(
                self, msg, QtCore.QString(), startPMButton,
                kdeui.KStandardGuiItem.cont(), dontAskAgainName)
            if answer == kdeui.KMessageBox.Yes:
                run(pm, "--show-mainwindow")
示例#2
0
    def suggestDriver(self):
        config = self.iface.getConfig()
        dontAskAgainName = "Driver Suggestion"
        shouldBeShown, answer = kdeui.KMessageBox.shouldBeShownYesNo(dontAskAgainName)
        if not shouldBeShown or not config:
            return

        preferredDriver = config.preferredDriver(installed=False)
        if preferredDriver is None or preferredDriver == self.iface.getDriver():
            return

        isInstalled = preferredDriver == config.preferredDriver()

        if isInstalled:
            msg = kdecore.i18n("<qt>To get better performance, you may want to "
                            "use <b>%1</b> driver provided by hardware vendor. "
                            "Do you want to use this driver?</p></qt>",
                            preferredDriver)
            answer = kdeui.KMessageBox.questionYesNo(self, msg,
                        QtCore.QString(),
                        kdeui.KStandardGuiItem.yes(),
                        kdeui.KStandardGuiItem.no(),
                        dontAskAgainName)
            if answer == kdeui.KMessageBox.Yes:
                self.cardDialog.setDriver(preferredDriver)

        else:
            pm = str(kdecore.KStandardDirs.findExe("package-manager"))
            if not pm:
                return

            package = driverPackages.get(preferredDriver)
            if package is None:
                return
            msg = kdecore.i18n("<qt>To get better performance, you may want to "
                            "use <b>%1</b> driver provided by hardware vendor. "
                            "To use it, you must install <b>%2</b> package and"
                            " choose <b>%1</b> from video card options.</qt>",
                            preferredDriver, package)
            startPMButton = kdeui.KGuiItem(kdecore.i18n("Start Package Manager"),
                                            kdeui.KIcon("package-manager"))
            answer = kdeui.KMessageBox.questionYesNo(self, msg,
                        QtCore.QString(),
                        startPMButton,
                        kdeui.KStandardGuiItem.cont(),
                        dontAskAgainName)
            if answer == kdeui.KMessageBox.Yes:
                run(pm, "--show-mainwindow")