def showTempPasswordDialog(self): """ Sets overridePassword for a server. Using this one doesn't actually have to enter the password in the ServerDialog (and by extension save to disk). """ serverList = ServerList() # Create a stringlist to be used by the qinputdialog stringList = [] for server in serverList.getTable(): stringList.append(server.name) # Display list of servers (serverString, ok) = QInputDialog.getItem( self, QApplication.translate("MainWindow", "Select server"), QApplication.translate("MainWindow", "Server:"), stringList, editable=False) if ok: server = serverList.getServerObjectByName(serverString) if server != None: # Ask for password (value, ok) = QInputDialog.getText( self, QApplication.translate("MainWindow", "Temporary password"), QApplication.translate("MainWindow", "Enter password:"), QLineEdit.Password) if ok: # Use value as the overridePassword for the server. LumaConnection(server).overridePassword(value)
def __init__(self, parent=None): super(SearchPlugin, self).__init__(parent) self.setupUi(self) self.setObjectName('SearchPlugin') self.openTabs = {} self.completer = None self.currentServer = None #self.connection = None self.resultSetCount = 0 self.serverListObject = ServerList() self.serverList = self.serverListObject.getTable() self.searchForm = SearchForm(parent=self) self.filterBuilder = FilterBuilder(parent=self) # Icons searchIcon = iconFromTheme('edit-find', ':/icons/32/edit-find') filterIcon = iconFromTheme('edit-find-replace', ':/icons/32/edit-find-replace') secureIcon = iconFromTheme('object-locked', ':/icons/16/object-locked') errorIcon = pixmapFromTheme('dialog-error', ':/icons/48/dialog-error', 24, 24) undoIcon = iconFromTheme('edit-undo', ':/icons/32/edit-undo') redoIcon = iconFromTheme('edit-redo', ':/icons/32/edit-redo') addIcon = iconFromTheme('list-add', ':/icons/32/list-add') self.indexSF = self.left.addTab(self.searchForm, searchIcon, '') self.indexFB = self.left.addTab(self.filterBuilder, filterIcon, '') self.searchForm.filterBuilderToolButton.setIcon(filterIcon) self.searchForm.errorIcon.setPixmap(errorIcon) self.filterBuilder.undoButton.setIcon(undoIcon) self.filterBuilder.redoButton.setIcon(redoIcon) self.filterBuilder.addSpecialCharButton.setIcon(addIcon) # The search plugin event filter we # use for acting upon various events eventFilter = SearchPluginEventFilter(self) # Install the eventFilter on desired widgets self.installEventFilter(eventFilter) self.right.installEventFilter(eventFilter) self.right.setUsesScrollButtons(True) self.__loadSettings() self.__connectSlots() # Only add text to these class and its children at this time self.retranslate(all=False) # TODO: maybe we allways want to return a list from ServerList, # eliminating the 'NoneType is not iterable' exceptions. if not self.serverList is None: for server in self.serverList: # As documendted in the ServerObject class: # 0 = Unencrypted, 1 = TLS, 2 = SSL if server.encryptionMethod == 0: self.searchForm.serverBox.addItem(server.name) else: self.searchForm.serverBox.addItem(secureIcon, server.name)
def __init__(self): QWidget.__init__(self) self.setupUi(self) self.setObjectName('TemplatePlugin') self._serverList = ServerList() templateList = TemplateList() self._templateList = copy.deepcopy(templateList) self._templateListCopy = None self._returnList = None #ObjectclassAttributeInfo self.preloadedServerMeta = {} self.templateTM = TemplateTableModel(self._templateList, self) self.listViewTemplates.setModel(self.templateTM) self.objectclassTM = ObjectclassTableModel(self) self.listViewObjectclasses.setModel(self.objectclassTM) self.attributeTM = AttributeTableModel(self) self.tableViewAttributes.setModel(self.attributeTM) # Enable/disable editing depending on if we have a server to edit if self.templateTM.rowCount(QModelIndex()) > 0: self.setRightSideEnabled(True) else: self.setRightSideEnabled(False) # Select the first template in the model) index = self.templateTM.index(0, 0) # Select the template in the view self.listViewTemplates.selectionModel().select( index, QItemSelectionModel.ClearAndSelect) self.listViewTemplates.selectionModel().setCurrentIndex( index, QItemSelectionModel.ClearAndSelect) self.listViewTemplates.selectionModel().selectionChanged.connect( self.selectedTemplate) # Map columns of the model to fields in the gui self.mapper = QDataWidgetMapper() self.mapper.setModel(self.templateTM) self.mapper.addMapping(self.lineEditDescription, 2) # Set-up of the non-mapped information self.selectedTemplate()
def setUp(self): #print "setUp" self.sl = ServerList(tempfile.gettempdir(), "serverlisttest.xml")
def __init__(self, parent=None, configPrefix=None): """ :param configPrefix: defines the location of serverlist. :type configPrefix: string """ super(BrowserView, self).__init__(parent) self.__logger = logging.getLogger(__name__) self.setObjectName("PLUGIN_BROWSER") self.templateList = TemplateList() # The serverlist used self.serverList = ServerList(configPrefix) self.serversChangedMessage = QtGui.QErrorMessage() self.mainLayout = QtGui.QHBoxLayout(self) self.splitter = QtGui.QSplitter(self) # Create the model self.ldaptreemodel = LDAPTreeItemModel(self.serverList, self) self.ldaptreemodel.workingSignal.connect(self.setBusy) # Set up the entrylist (uses the model) self.__setupEntryList() # The editor for entries self.tabWidget = QtGui.QTabWidget(self) #self.tabWidget.setDocumentMode(True) self.tabWidget.setMovable(True) self.setMinimumWidth(200) self.tabWidget.setTabsClosable(True) self.tabWidget.tabCloseRequested.connect(self.tabCloseClicked) self.tabWidget.setUsesScrollButtons(True) sizePolicy = self.tabWidget.sizePolicy() sizePolicy.setHorizontalStretch(1) self.tabWidget.setSizePolicy(sizePolicy) # Remember and looks up open tabs self.openTabs = {} self.splitter.addWidget(self.entryList) self.splitter.addWidget(self.tabWidget) self.mainLayout.addWidget(self.splitter) # Used to signal the ldaptreemodel with a index # which needs processing (reloading, clearing) self.reloadSignal.connect(self.ldaptreemodel.reloadItem) self.clearSignal.connect(self.ldaptreemodel.clearItem) eventFilter = BrowserPluginEventFilter(self) self.installEventFilter(eventFilter) self.__createContextMenu() self.retranslateUi() self.progress = QMessageBox(1, self.str_PLEASE_WAIT, self.str_PLEASE_WAIT_MSG, QMessageBox.Ignore, parent=self)