def addWidgets(self): opener = QLabel(self) self.pixmap_open = QPixmap(asset('png', 'triangle-open.png')) self.pixmap_closed = QPixmap(asset('png', 'triangle-closed.png')) opener.setPixmap(self.pixmap_open) opener.resize(opener.pixmap().size()) self.opener = opener self.setIndent(opener.width() + 12) self.setMargin(2)
def __init__(self, parent=None): super(MenuButton, self).__init__(parent) self.setObjectName('menu') self.setIcon(QIcon(QPixmap(asset('png', 'bluepass-logo-48.png')))) self.setFocusPolicy(Qt.TabFocus) self.setFlat(True) self.buildMenu()
def __init__(self, *args, **kwargs): super(AddButton, self).__init__(*args, **kwargs) icon = QIcon(QPixmap(asset('png', 'add.png'))) self.setIcon(icon) self.clicked.connect(self.newPassword) self.setFlat(True) self.setFixedSize(30, 28) self.setFocusPolicy(Qt.TabFocus) self.setEnabled(False)
def _load_wordlist(self): """Load the Diceware wordlist.""" fin = open(util.asset('diceware', 'wordlist.asc')) wordlist = [] for line in fin: if line[:5].isdigit() and line[5:6] == '\t': key, value = line.split() wordlist.append(value) fin.close() self.wordlist = wordlist
def __init__(self, *args, **kwargs): super(SearchEditor, self).__init__(*args, **kwargs) self.setPlaceholderText('Enter a search term') icon = QLabel(self) pixmap = QPixmap(asset('png', 'search.png')) icon.setPixmap(pixmap) icon.resize(pixmap.size()) self.searchicn = icon self.clearbtn = ClearButton(self) self.setTextMargins(30, 0, 30, 0) self.setFocusPolicy(Qt.NoFocus) self.current_vault = None self.queries = {}
def __init__(self, args): super(Bluepass, self).__init__(args) self._config = None icon = QIcon(QPixmap(asset('png', 'bluepass-logo-144.png'))) self.setWindowIcon(icon)
def addWidgets(self): layout = QVBoxLayout() self.setLayout(layout) grid = QGridLayout() layout.addLayout(grid) grid.setColumnMinimumWidth(1, 20) grid.setColumnStretch(2, 100) grid.setRowStretch(6, 100) label = QLabel('Group', self) grid.addWidget(label, 0, 0) combobox = QComboBox(self) combobox.setEditable(True) combobox.setInsertPolicy(QComboBox.InsertAtTop) grid.addWidget(combobox, 0, 2) self.combobox = combobox self.fields['group'] = (combobox.currentText, None) label = QLabel('Name', self) grid.addWidget(label, 1, 0) nameedt = QLineEdit(self) nameedt.textChanged.connect(self.fieldUpdated) grid.addWidget(nameedt, 1, 2) self.nameedt = nameedt self.fields['name'] = (nameedt.text, nameedt.setText) label = QLabel('Username', self) grid.addWidget(label, 2, 0) editor = QLineEdit(self) grid.addWidget(editor, 2, 2) self.fields['username'] = (editor.text, editor.setText) label = QLabel('Password', self) grid.addWidget(label, 3, 0) passwdedt = QLineEdit(self) passwdedt.setEchoMode(QLineEdit.Password) passwdedt.textChanged.connect(self.fieldUpdated) grid.addWidget(passwdedt, 3, 2) self.fields['password'] = (passwdedt.text, passwdedt.setText) self.passwdedt = passwdedt config = RandomPasswordConfiguration() icon = QIcon(QPixmap(asset('png', 'eye.png'))) showbtn = QPushButton(icon, '', self) showbtn.setCheckable(True) showbtn.toggled.connect(self.setShowPassword) showbtn.setFixedHeight(passwdedt.sizeHint().height()) grid.addWidget(showbtn, 3, 3) self.showbtn = showbtn passwdbtn = GeneratePasswordButton('Generate', config, self) passwdbtn.setFixedWidth(passwdbtn.sizeHint().width()) grid.addWidget(passwdbtn, 3, 4) passwdbtn.passwordGenerated.connect(passwdedt.setText) label = QLabel('Website') grid.addWidget(label, 5, 0) editor = QLineEdit(self) grid.addWidget(editor, 5, 2, 1, 3) self.fields['url'] = (editor.text, editor.setText) label = QLabel('Comment') grid.addWidget(label, 6, 0) editor = QTextEdit(self) editor.setAcceptRichText(False) grid.addWidget(editor, 6, 2, 1, 3) self.fields['comment'] = (editor.toPlainText, editor.setPlainText) layout.addStretch(100) hbox = QHBoxLayout() layout.addLayout(hbox) cancelbtn = QPushButton('Cancel') cancelbtn.clicked.connect(self.hide) hbox.addWidget(cancelbtn) savebtn = QPushButton('Save') savebtn.setDefault(True) savebtn.setEnabled(False) savebtn.clicked.connect(self.savePassword) hbox.addWidget(savebtn) self.savebtn = savebtn hbox.addStretch(100)
def __init__(self, *args, **kwargs): super(ClearButton, self).__init__(*args, **kwargs) pixmap = QPixmap(asset('png', 'clear.png')) self.setPixmap(pixmap) self.resize(pixmap.size()) self.setCursor(Qt.ArrowCursor)