Make login button work for login page
This commit is contained in:
parent
c7dd602687
commit
dc2f779d4b
1
TODO.md
1
TODO.md
|
@ -1,6 +1,7 @@
|
|||
- Current focus
|
||||
- Merge login page
|
||||
- Just import nio?
|
||||
- TextInput.accepted() for SendBox
|
||||
|
||||
- Refactoring
|
||||
- Migrate more JS functions to their own files / Implement in Python instead
|
||||
|
|
|
@ -115,8 +115,7 @@ class Client(QObject):
|
|||
self.net_sync.http_disconnect()
|
||||
|
||||
|
||||
@pyqtSlot()
|
||||
@futurize()
|
||||
@futurize(pyqt=False)
|
||||
def startSyncing(self) -> None:
|
||||
while True:
|
||||
self._on_sync(self.net_sync.talk(
|
||||
|
|
|
@ -61,7 +61,7 @@ class ClientManager(QObject):
|
|||
|
||||
|
||||
@pyqtSlot(str, str, str)
|
||||
@pyqtSlot(str, str, str)
|
||||
@pyqtSlot(str, str, str, str)
|
||||
def new(self, hostname: str, username: str, password: str,
|
||||
device_id: str = "") -> None:
|
||||
|
||||
|
|
|
@ -67,7 +67,8 @@ class PyQtFuture(QObject):
|
|||
_RUNNING: List[Tuple[Executor, Callable, tuple, dict]] = []
|
||||
|
||||
|
||||
def futurize(max_instances: Optional[int] = None) -> Callable:
|
||||
def futurize(max_instances: Optional[int] = None, pyqt: bool = True
|
||||
) -> Callable:
|
||||
|
||||
def decorator(func: Callable) -> Callable:
|
||||
|
||||
|
@ -89,7 +90,8 @@ def futurize(max_instances: Optional[int] = None) -> Callable:
|
|||
return None
|
||||
|
||||
_RUNNING.append((self.pool, func, args, kws))
|
||||
return PyQtFuture(self.pool.submit(run_and_catch_errs), self)
|
||||
future = self.pool.submit(run_and_catch_errs)
|
||||
return PyQtFuture(future, self) if pyqt else future
|
||||
|
||||
return wrapper
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ class SignalManager(QObject):
|
|||
|
||||
|
||||
def onClientAdded(self, client: Client) -> None:
|
||||
print(client)
|
||||
self.connectClient(client)
|
||||
self.backend.models.accounts.append(User(
|
||||
userId = client.userId,
|
||||
|
|
|
@ -10,6 +10,12 @@ Image {
|
|||
cache: false
|
||||
source: "../../images/login_background.jpg"
|
||||
|
||||
function login() {
|
||||
Backend.clientManager.new(
|
||||
"matrix.org", identifierField.text, passwordField.text
|
||||
)
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
color: Qt.hsla(1, 1, 1, 0.3)
|
||||
|
||||
|
@ -80,11 +86,14 @@ Image {
|
|||
}
|
||||
|
||||
Base.HTextField {
|
||||
id: identifierField
|
||||
placeholderText: qsTr(
|
||||
loginWithEmailButton.checked ? "Email" :
|
||||
loginWithPhoneButton.checked ? "Phone" :
|
||||
"Username"
|
||||
)
|
||||
onAccepted: login()
|
||||
Component.onCompleted: forceActiveFocus()
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.margins: mainColumn.hMargin
|
||||
|
@ -93,7 +102,10 @@ Image {
|
|||
}
|
||||
|
||||
Base.HTextField {
|
||||
id: passwordField
|
||||
placeholderText: qsTr("Password")
|
||||
echoMode: TextField.Password
|
||||
onAccepted: login()
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.margins: mainColumn.hMargin
|
||||
|
@ -112,6 +124,10 @@ Image {
|
|||
text: qsTr("Login")
|
||||
Layout.fillWidth: true
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: login()
|
||||
}
|
||||
}
|
||||
Base.HButton {
|
||||
text: qsTr("Forgot?")
|
||||
|
|
Loading…
Reference in New Issue
Block a user