Skip to content

Commit

Permalink
add storage, changed layouting
Browse files Browse the repository at this point in the history
  • Loading branch information
raik199x committed Apr 13, 2024
1 parent c0e0df0 commit 4cb562e
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions gui/custom_widgets/add_storage_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,24 +123,26 @@ def confirmClicked(self) -> None:
self.return_storage_name = self.line_edit_storage_name.text()
self.close()

def addCredentialsInput(self, layout: QVBoxLayout) -> None:
email_input_layout = QFormLayout()
label_email_explanation = QLabel("Enter email")
email_input_layout.addRow(label_email_explanation, self.line_edit_email_input)
def getCredentialsInput(self) -> QHBoxLayout:
credentials_input = QHBoxLayout()

password_input_layout = QFormLayout()
label_password_explanation = QLabel("Enter password")
self.line_edit_password_input.setEchoMode(QLineEdit.Password)
password_input_layout.addRow(label_password_explanation, self.line_edit_password_input)
labels_layout = QVBoxLayout()
labels_layout.addWidget(QLabel("Enter email"))
labels_layout.addWidget(QLabel("Enter password"))
credentials_input.addLayout(labels_layout)

layout.addLayout(email_input_layout)
layout.addLayout(password_input_layout)
line_edits_layout = QVBoxLayout()
line_edits_layout.addWidget(self.line_edit_email_input)
line_edits_layout.addWidget(self.line_edit_password_input)
credentials_input.addLayout(line_edits_layout)

def addTokenInput(self, layout: QVBoxLayout) -> None:
return credentials_input

def getTokenInput(self) -> QFormLayout:
token_input_layout = QFormLayout()
label_token_explanation = QLabel("Enter token")
token_input_layout.addRow(label_token_explanation, self.line_edit_token_input)
layout.addLayout(token_input_layout)
return token_input_layout

def getCredentialsWidget(self, service_name: str) -> QWidget:
result_widget = QWidget()
Expand All @@ -158,9 +160,9 @@ def getCredentialsWidget(self, service_name: str) -> QWidget:
self.label_status.setStyleSheet("color: red;")
return result_widget
if cloud_storage.isAuthViaCredentials:
self.addCredentialsInput(widget_layout)
widget_layout.addLayout(self.getCredentialsInput())
if cloud_storage.isAuthViaToken:
self.addTokenInput(widget_layout)
widget_layout.addLayout(self.getTokenInput())

return result_widget

Expand Down

0 comments on commit 4cb562e

Please sign in to comment.