Ejemplo n.º 1
0
    def __init__(self, parent, embed=False):
        QtGui.QWidget.__init__(self, parent)

        if embed:
            self.setupUi(parent)
        else:
            self.setupUi(self)

        self.configureCardButton.setIcon(kdeui.KIcon("configure"))

        # Backend
        self.iface = Interface()
        self.iface.listenSignals(self.signalHandler)

        # Disable module if no packages provide backend or
        # no valid configuration is found
        if not self.checkBackend():
            parent.setDisabled(True)

        self.cardDialog = VideoCardDialog(self, self.iface)
        self.configureCardButton.clicked.connect(self.cardDialog.show)

        self.outputDialogs = {}
        self.firstLoad = True

        self.configChanged.connect(self.slotConfigChanged)
Ejemplo n.º 2
0
    def __init__(self, parent, embed=False):
        QtGui.QWidget.__init__(self, parent)

        if embed:
            self.setupUi(parent)
        else:
            self.setupUi(self)

        self.scene = DisplayScene(self.graphicsView)
        self.scene.outputsChanged.connect(self.slotChangeDisplays)
        self.scene.outputSelected.connect(self.slotUpdateOutputProperties)

        # Backend
        self.iface = Interface()
        self.iface.listenSignals(self.signalHandler)

        # Disable module if no packages provide backend or
        # no valid configuration is found
        if not self.checkBackend():
            parent.setDisabled(True)

        self.extendDisplays.toggled.connect(self.emitConfigChanged)
        self.detectButton.clicked.connect(self.slotDetectClicked)
        self.modeList.currentIndexChanged.connect(self.slotModeSelected)
        self.rateList.currentIndexChanged[int].connect(self.slotRateSelected)
        self.rotationList.currentIndexChanged[int].connect(self.slotRotationSelected)
Ejemplo n.º 3
0
class MainWidget(QtGui.QWidget, Ui_screensWidget):

    configChanged = QtCore.pyqtSignal()

    def __init__(self, parent, embed=False):
        QtGui.QWidget.__init__(self, parent)

        if embed:
            self.setupUi(parent)
        else:
            self.setupUi(self)

        self.scene = DisplayScene(self.graphicsView)
        self.scene.outputsChanged.connect(self.slotChangeDisplays)
        self.scene.outputSelected.connect(self.slotUpdateOutputProperties)

        # Backend
        self.iface = Interface()
        self.iface.listenSignals(self.signalHandler)

        # Disable module if no packages provide backend or
        # no valid configuration is found
        if not self.checkBackend():
            parent.setDisabled(True)

        self.extendDisplays.toggled.connect(self.emitConfigChanged)
        self.detectButton.clicked.connect(self.slotDetectClicked)
        self.modeList.currentIndexChanged.connect(self.slotModeSelected)
        self.rateList.currentIndexChanged[int].connect(self.slotRateSelected)
        self.rotationList.currentIndexChanged[int].connect(self.slotRotationSelected)

    def checkBackend(self):
        """
            Check if there are packages that provide required backend.
        """
        if not len(self.iface.getPackages()):
            kdeui.KMessageBox.error(self, kdecore.i18n(
                "There are no packages that provide backend for this "
                "application.\nPlease be sure that packages are installed "
                "and configured correctly."))
            return False

        elif not self.iface.isReady():
            answer = kdeui.KMessageBox.questionYesNo(self, kdecore.i18n(
                "Cannot find a valid configuration. Display settings won't "
                "be enabled until you create a new configuration.\n"
                "Would you like to create a safe configuration now?"))
            if answer == kdeui.KMessageBox.Yes:
                try:
                    self.iface.safeConfig()
                    self.iface.readConfig()
                except dbus.DBusException, exception:
                    if "Comar.PolicyKit" in exception._dbus_error_name:
                        kdeui.KMessageBox.error(self, kdecore.i18n("Access denied."))
                    else:
                        kdeui.KMessageBox.error(self, str(exception))

            return self.iface.isReady()

        return True
Ejemplo n.º 4
0
class MainWidget(QtGui.QWidget, Ui_screensWidget):

    configChanged = QtCore.pyqtSignal()

    def __init__(self, parent, embed=False):
        QtGui.QWidget.__init__(self, parent)

        if embed:
            self.setupUi(parent)
        else:
            self.setupUi(self)

        self.scene = DisplayScene(self.graphicsView)
        self.scene.outputsChanged.connect(self.slotChangeDisplays)
        self.scene.outputSelected.connect(self.slotUpdateOutputProperties)

        # Backend
        self.iface = Interface()
        self.iface.listenSignals(self.signalHandler)

        # Disable module if no packages provide backend or
        # no valid configuration is found
        if not self.checkBackend():
            parent.setDisabled(True)

        self.extendDisplays.toggled.connect(self.emitConfigChanged)
        self.detectButton.clicked.connect(self.slotDetectClicked)
        self.modeList.currentIndexChanged.connect(self.slotModeSelected)
        self.rateList.currentIndexChanged[int].connect(self.slotRateSelected)
        self.rotationList.currentIndexChanged[int].connect(self.slotRotationSelected)

    def checkBackend(self):
        """
            Check if there are packages that provide required backend.
        """
        if not len(self.iface.getPackages()):
            kdeui.KMessageBox.error(self, kdecore.i18n(
                "There are no packages that provide backend for this "
                "application.\nPlease be sure that packages are installed "
                "and configured correctly."))
            return False

        elif not self.iface.isReady():
            answer = kdeui.KMessageBox.questionYesNo(self, kdecore.i18n(
                "Cannot find a valid configuration. Display settings won't "
                "be enabled until you create a new configuration.\n"
                "Would you like to create a safe configuration now?"))
            if answer == kdeui.KMessageBox.Yes:
                try:
                    self.iface.safeConfig()
                    self.iface.readConfig()
                except dbus.DBusException, exception:
                    if "Comar.PolicyKit" in exception._dbus_error_name:
                        kdeui.KMessageBox.error(self, kdecore.i18n("Access denied."))
                    else:
                        kdeui.KMessageBox.error(self, str(exception))

            return self.iface.isReady()

        return True
Ejemplo n.º 5
0
    def __init__(self, parent, embed=False):
        QtGui.QWidget.__init__(self, parent)

        if embed:
            self.setupUi(parent)
        else:
            self.setupUi(self)

        self.configureCardButton.setIcon(kdeui.KIcon("configure"))

        # Backend
        self.iface = Interface()
        self.iface.listenSignals(self.signalHandler)

        # Disable module if no packages provide backend or
        # no valid configuration is found
        if not self.checkBackend():
            parent.setDisabled(True)


        self.cardDialog = VideoCardDialog(self, self.iface)
        self.configureCardButton.clicked.connect(self.cardDialog.show)

        self.outputDialogs = {}

        self.configChanged.connect(self.slotConfigChanged)

        QtCore.QTimer.singleShot(0, self.suggestDriver)
Ejemplo n.º 6
0
    def __init__(self, parent, embed=False):
        QtGui.QWidget.__init__(self, parent)

        if embed:
            self.setupUi(parent)
        else:
            self.setupUi(self)

        self.scene = DisplayScene(self.graphicsView)
        self.scene.outputsChanged.connect(self.slotChangeDisplays)
        self.scene.outputSelected.connect(self.slotUpdateOutputProperties)

        # Backend
        self.iface = Interface()
        self.iface.listenSignals(self.signalHandler)

        # Disable module if no packages provide backend or
        # no valid configuration is found
        if not self.checkBackend():
            parent.setDisabled(True)

        self.extendDisplays.toggled.connect(self.emitConfigChanged)
        self.detectButton.clicked.connect(self.slotDetectClicked)
        self.modeList.currentIndexChanged.connect(self.slotModeSelected)
        self.rateList.currentIndexChanged[int].connect(self.slotRateSelected)
        self.rotationList.currentIndexChanged[int].connect(self.slotRotationSelected)
Ejemplo n.º 7
0
    def __init__(self, parent):
        Ui_MainWidget.__init__(self, parent)

        # hide for now
        self.buttonHelp.hide()

        # "Apply" button will be enabled when config changed
        self.buttonApply.setDisabled(True)

        # set button icons
        self.buttonCancel.setIconSet(getIconSet("cancel", KIcon.Small))
        self.buttonApply.setIconSet(getIconSet("ok", KIcon.Small))
        self.buttonHelp.setIconSet(getIconSet("help", KIcon.Small))
        # use reload icon for now. will be replaced with swap icon later.
        self.buttonSwap.setPixmap(getIcon("reload", KIcon.Toolbar))

        self.pixVideoCard.setPixmap(getIcon("video_card", KIcon.User))

        self.iconWide = getIconSet("monitor_wide", KIcon.User)
        self.iconNormal = getIconSet("monitor", KIcon.User)

        # output list
        self.outputList = EntryView(self.devicesPage)
        self.devicesPage.layout().addWidget(self.outputList)

        # Backend
        self.iface = Interface()

        # Disable module if no packages provide backend or
        # no valid configuration is found
        if self.checkBackend():
            self.textNotReady.hide()
        else:
            self.screenImage1.hide()
            self.screenImage2.hide()
            self.buttonSwap.hide()
            self.setDisabled(True)

        self.suggestDriver()

        self.cardDialog = VideoCardDialog(self, self.iface)
        self.outputDialogs = {}

        # set signals
        self.connect(self.screenImage1, SIGNAL("toggled(bool)"), self.slotOutputSelected)

        self.connect(self.buttonCancel, SIGNAL("clicked()"), qApp, SLOT("quit()"))
        self.connect(self.buttonApply, SIGNAL("clicked()"), self.save)
        self.connect(self.buttonHelp, SIGNAL("clicked()"), self.slotHelp)
        self.connect(self.buttonSwap, SIGNAL("clicked()"), self.slotSwap)

        self.connect(self.extendDisplays, SIGNAL("toggled(bool)"), self.emitConfigChanged)
        self.connect(self.detectButton, SIGNAL("clicked()"), self.slotDetectClicked)
        self.connect(self.modeList, SIGNAL("activated(int)"), self.slotModeSelected)
        self.connect(self.rateList, SIGNAL("activated(int)"), self.slotRateSelected)
        self.connect(self.rotationList, SIGNAL("activated(int)"), self.slotRotationSelected)

        self.connect(self.cardDialog, PYSIGNAL("configChanged"), self.emitConfigChanged)
        self.connect(self.configureCardButton, SIGNAL("clicked()"), self.cardDialog.show)
Ejemplo n.º 8
0
class MainWidget(Ui_MainWidget):
    def __init__(self, parent):
        Ui_MainWidget.__init__(self, parent)

        # "Apply" button will be enabled when config changed
        self.buttonApply.setDisabled(True)

        # set button icons
        self.buttonCancel.setIconSet(getIconSet("cancel", KIcon.Small))
        self.buttonApply.setIconSet(getIconSet("ok", KIcon.Small))
        # use reload icon for now. will be replaced with swap icon later.
        self.buttonSwap.setPixmap(getIcon("reload", KIcon.Toolbar))

        self.pixVideoCard.setPixmap(getIcon("video_card", KIcon.User))

        self.iconWide = getIconSet("monitor_wide", KIcon.User)
        self.iconNormal = getIconSet("monitor", KIcon.User)

        # output list
        self.outputList = EntryView(self.devicesPage)
        self.devicesPage.layout().addWidget(self.outputList)

        # Backend
        self.iface = Interface()

        # Disable module if no packages provide backend or
        # no valid configuration is found
        if self.checkBackend():
            self.textNotReady.hide()
        else:
            self.screenImage1.hide()
            self.screenImage2.hide()
            self.buttonSwap.hide()
            self.setDisabled(True)

        self.suggestDriver()

        self.cardDialog = VideoCardDialog(self, self.iface)
        self.outputDialogs = {}

        # set signals
        self.connect(self.screenImage1, SIGNAL("toggled(bool)"), self.slotOutputSelected)

        self.connect(self.buttonCancel, SIGNAL("clicked()"), qApp, SLOT("quit()"))
        self.connect(self.buttonApply, SIGNAL("clicked()"), self.save)
        self.connect(self.buttonSwap, SIGNAL("clicked()"), self.slotSwap)

        self.connect(self.extendDisplays, SIGNAL("toggled(bool)"), self.emitConfigChanged)
        self.connect(self.detectButton, SIGNAL("clicked()"), self.slotDetectClicked)
        self.connect(self.modeList, SIGNAL("activated(int)"), self.slotModeSelected)
        self.connect(self.rateList, SIGNAL("activated(int)"), self.slotRateSelected)
        self.connect(self.rotationList, SIGNAL("activated(int)"), self.slotRotationSelected)

        self.connect(self.cardDialog, PYSIGNAL("configChanged"), self.emitConfigChanged)
        self.connect(self.configureCardButton, SIGNAL("clicked()"), self.cardDialog.show)

    def checkBackend(self):
        """
            Check if there are packages that provide required backend.
        """
        if not len(self.iface.getPackages()):
            KMessageBox.error(self, i18n(
                "There are no packages that provide backend for this "
                "application.\nPlease be sure that packages are installed "
                "and configured correctly."))
            return False

        elif not self.iface.isReady():
            answer = KMessageBox.questionYesNo(self, i18n(
                "Cannot find a valid configuration. Display settings won't "
                "be enabled until you create a new configuration.\n"
                "Would you like to create a safe configuration now?"))
            if answer == KMessageBox.Yes:
                try:
                    self.iface.safeConfig()
                    self.iface.readConfig()
                except dbus.DBusException, exception:
                    if "Comar.PolicyKit" in exception._dbus_error_name:
                        KMessageBox.error(self, i18n("Access denied."))
                    else:
                        KMessageBox.error(self, str(exception))

            return self.iface.isReady()

        return True
Ejemplo n.º 9
0
class MainWidget(QtGui.QWidget, Ui_devicesWidget):

    configChanged = QtCore.pyqtSignal()

    def __init__(self, parent, embed=False):
        QtGui.QWidget.__init__(self, parent)

        if embed:
            self.setupUi(parent)
        else:
            self.setupUi(self)

        self.configureCardButton.setIcon(kdeui.KIcon("configure"))

        # Backend
        self.iface = Interface()
        self.iface.listenSignals(self.signalHandler)

        # Disable module if no packages provide backend or
        # no valid configuration is found
        if not self.checkBackend():
            parent.setDisabled(True)


        self.cardDialog = VideoCardDialog(self, self.iface)
        self.configureCardButton.clicked.connect(self.cardDialog.show)

        self.outputDialogs = {}

        self.configChanged.connect(self.slotConfigChanged)

        QtCore.QTimer.singleShot(0, self.suggestDriver)

    def checkBackend(self):
        """
            Check if there are packages that provide required backend.
        """
        if not len(self.iface.getPackages()):
            kdeui.KMessageBox.error(self, kdecore.i18n(
                "There are no packages that provide backend for this "
                "application.\nPlease be sure that packages are installed "
                "and configured correctly."))
            return False

        elif not self.iface.isReady():
            answer = kdeui.KMessageBox.questionYesNo(self, kdecore.i18n(
                "Cannot find a valid configuration. Display settings won't "
                "be enabled until you create a new configuration.\n"
                "Would you like to create a safe configuration now?"))
            if answer == kdeui.KMessageBox.Yes:
                try:
                    self.iface.safeConfig()
                    self.iface.readConfig()
                except dbus.DBusException, exception:
                    if "Comar.PolicyKit" in exception._dbus_error_name:
                        kdeui.KMessageBox.error(self, kdecore.i18n("Access denied."))
                    else:
                        kdeui.KMessageBox.error(self, str(exception))

            return self.iface.isReady()

        return True
Ejemplo n.º 10
0
class MainWidget(QtGui.QWidget, Ui_devicesWidget):

    configChanged = QtCore.pyqtSignal()

    def __init__(self, parent, embed=False):
        QtGui.QWidget.__init__(self, parent)

        if embed:
            self.setupUi(parent)
        else:
            self.setupUi(self)

        self.configureCardButton.setIcon(kdeui.KIcon("configure"))

        # Backend
        self.iface = Interface()
        self.iface.listenSignals(self.signalHandler)

        # Disable module if no packages provide backend or
        # no valid configuration is found
        if not self.checkBackend():
            parent.setDisabled(True)

        self.cardDialog = VideoCardDialog(self, self.iface)
        self.configureCardButton.clicked.connect(self.cardDialog.show)

        self.outputDialogs = {}
        self.firstLoad = True

        self.configChanged.connect(self.slotConfigChanged)

    def checkBackend(self):
        """
            Check if there are packages that provide required backend.
        """
        if not len(self.iface.getPackages()):
            kdeui.KMessageBox.error(
                self,
                kdecore.i18n(
                    "There are no packages that provide backend for this "
                    "application.\nPlease be sure that packages are installed "
                    "and configured correctly."))
            return False

        elif not self.iface.isReady():
            answer = kdeui.KMessageBox.questionYesNo(
                self,
                kdecore.i18n(
                    "Cannot find a valid configuration. Display settings won't "
                    "be enabled until you create a new configuration.\n"
                    "Would you like to create a safe configuration now?"))
            if answer == kdeui.KMessageBox.Yes:
                try:
                    self.iface.safeConfig()
                    self.iface.readConfig()
                except dbus.DBusException, exception:
                    if "Comar.PolicyKit" in exception._dbus_error_name:
                        kdeui.KMessageBox.error(self,
                                                kdecore.i18n("Access denied."))
                    else:
                        kdeui.KMessageBox.error(self, str(exception))

            return self.iface.isReady()

        return True