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
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
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