class OpenKey(QtGui.QDialog): """Show a SSH key into a textLine dialog""" def __init__(self, text='', title='Key', parent=None): """Init method @param self A OpenKey instance @param text A string to show @param parent A parent QtGui.QWidget """ self.parent = parent self.text = text self.clipboard = QtGui.QApplication.clipboard() QtGui.QDialog.__init__(self) self.ui = Ui_OpenKey() self.ui.setupUi(self) self.ui.textEdit.setFontFamily('monospace') self.ui.textEdit.setText(text) self.setWindowTitle(title) def copy(self): """Copy current text do clipboard""" self.clipboard.setText(self.ui.textEdit.toPlainText()) self.ui.copyButton.setText(self.tr("Copied!"))
def __init__(self, text='', title='Key', parent=None): """Init method @param self A OpenKey instance @param text A string to show @param parent A parent QtGui.QWidget """ self.parent = parent self.text = text self.clipboard = QtGui.QApplication.clipboard() QtGui.QDialog.__init__(self) self.ui = Ui_OpenKey() self.ui.setupUi(self) self.ui.textEdit.setFontFamily('monospace') self.ui.textEdit.setText(text) self.setWindowTitle(title)