File indexing completed on 2024-05-12 05:01:45

0001 """ Add Account """
0002 from PySide2 import QtWidgets, QtGui
0003 from PySide2.QtWidgets import QDialog, QDialogButtonBox, QFormLayout, QVBoxLayout, QLineEdit
0004 from accountinfo import AccountInfo
0005 import pyruqolacore
0006 
0007 class AddAccountDialog(QDialog):
0008     def __init__(self):
0009         super().__init__()
0010         self.setWindowTitle(self.tr("Add Account"))
0011         self.initializeWidget()
0012 
0013     def initializeWidget(self):
0014         mainLayout = QVBoxLayout(self)
0015         self.formLayout = QFormLayout()
0016         self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
0017 
0018         # Account Name
0019         self.accountName = QLineEdit();
0020         self.formLayout.addRow(self.tr("Account Name:"), self.accountName);
0021 
0022         #Server Url
0023         self.serverUrl = QLineEdit();
0024         self.formLayout.addRow(self.tr("Server Url:"), self.serverUrl);
0025 
0026         #Server Url
0027         self.userName = QLineEdit();
0028         self.formLayout.addRow(self.tr("User Name:"), self.userName);
0029 
0030         mainLayout.addLayout(self.formLayout)
0031         mainLayout.addWidget(self.buttonBox)
0032         self.buttonBox.accepted.connect(self.accept)
0033         self.buttonBox.rejected.connect(self.reject)
0034 
0035     # Return account info.
0036     def accountInfo(self)->AccountInfo:
0037         info = AccountInfo()
0038         info.accountName = self.accountName.text()
0039         info.userName = self.userName.text()
0040         info.serverUrl = self.serverUrl.text()
0041         return info
0042