Ejemplo n.º 1
0
 def load_pass_file(self, pass_file_object):
     """
     populates the window with pass_file data
     :param pass_file_object: a PassFile
     :return: None
     """
     self.clear()
     self.pass_file = pass_file_object
     password_field_label = QLabel('password')
     password_field = QLineEdit()
     password_field.setEchoMode(QLineEdit.EchoMode(2))
     password_field.setDisabled(True)
     copy_password_button = QPushButton('copy')
     copy_password_button.clicked.connect(self.copy_password)
     self.layout().addWidget(password_field_label, 0, 0)
     self.layout().addWidget(password_field, 0, 1)
     self.layout().addWidget(copy_password_button, 0, 2)
     password_field.setText(self.pass_file.password)
     for key, value in self.pass_file.attributes:
         current_grid_view_row = self.layout().rowCount()
         additional_field_label = QLabel(key)
         additional_field = QLineEdit()
         self.layout().addWidget(additional_field_label,
                                 current_grid_view_row + 1, 0)
         self.layout().addWidget(additional_field,
                                 current_grid_view_row + 1, 1)
         additional_field.setText(value)
     comment_browser_label = QLabel('comments')
     comment_browser = QTextBrowser()
     self.layout().addWidget(comment_browser_label,
                             self.layout().rowCount() + 1, 0)
     self.layout().addWidget(comment_browser, self.layout().rowCount(), 1)
     comment_browser.setPlainText(self.pass_file.comments)
Ejemplo n.º 2
0
 def __init__(self, optional_fields=[]):
     QDialog.__init__(self)
     self.setMinimumHeight(120)
     self.setMinimumWidth(380)
     self.setWindowTitle('Enter a Password')
     self.grid_layout = QGridLayout()
     self.setLayout(self.grid_layout)
     name_label = QLabel('Name:')
     pass_label = QLabel('Password:'******'Gen')
     generate_password_button.clicked.connect(self.generate_password)
     self.layout().addWidget(generate_password_button, 1, 2)
     self.grid_layout.addWidget(pass_label, 1, 0)
     self.grid_layout.addWidget(self.password_input, 1, 1)
     self.optional_fields = list()
     for field in optional_fields:
         self.__add_optional_field__(field)
     comment_label = QLabel('comments')
     self.comment_field = QTextEdit()
     self.layout().addWidget(comment_label, self.layout().rowCount() + 1, 0)
     self.layout().addWidget(self.comment_field,
                             self.layout().rowCount(), 1)
     self.confirm_button = QPushButton()
     self.confirm_button.setShortcut('Return')
     self.confirm_button.setText('OK')
     self.grid_layout.addWidget(self.confirm_button,
                                self.grid_layout.rowCount() + 1, 1)
     self.confirm_button.clicked.connect(self.confirm)