-
Notifications
You must be signed in to change notification settings - Fork 0
Room list in demo client #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Aksem
wants to merge
15
commits into
master
Choose a base branch
from
roomlist
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
6564720
Event, RoomEvent, StateBaseEvent bindings.
Aksem 89ea564
Fix server edit slot in login window.
Aksem c9adec6
Subclass quotient room(in tests and demo).
Aksem 02addf0
Room list dock widget.
Aksem 2485fe2
Account registry.
Aksem 6b7a46e
Add room list in demo.
Aksem 8e4bff9
Add bindigs for settings. Remove commented code in connection bindings.
Aksem 60debf6
Add new files in source list.
Aksem f3c0723
Merge branch 'master' of https://github.com/Aksem/PyQuotient into roo…
Aksem 63e5dd1
Apply suggestions from code review
Aksem f6e3179
Remove unused custom room class.
Aksem 402f9e8
Merge branch 'roomlist' of https://github.com/Aksem/PyQuotient into r…
Aksem 995c55f
Small refactor in demo/models/roomlistmodel.py
Aksem 1237c98
Update bindings for EventStatus.
Aksem 84cca61
Merge branch 'roomlist' of https://github.com/Aksem/PyQuotient into r…
Aksem File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from typing import List | ||
from PySide6 import QtCore | ||
from PyQuotient import Quotient | ||
from __feature__ import snake_case, true_property | ||
|
||
|
||
class Account(Quotient.Connection): | ||
... | ||
|
||
|
||
class AccountRegistry(QtCore.QObject): | ||
addedAccount = QtCore.Signal(Account) | ||
aboutToDropAccount = QtCore.Signal(Account) | ||
|
||
def __init__(self) -> None: | ||
super().__init__() | ||
self.accounts: List[Account] = [] | ||
|
||
def __len__(self): | ||
return len(self.accounts) | ||
|
||
def __getitem__(self, position): | ||
return self.accounts[position] | ||
|
||
def add(self, account: Account) -> None: | ||
if (account in self.accounts): | ||
return | ||
|
||
self.accounts.append(account) | ||
self.addedAccount.emit(account) | ||
|
||
def drop(self, account: Account) -> None: | ||
self.aboutToDropAccount.emit(account) | ||
self.accounts.remove(account) | ||
|
||
def is_logged_in(self, user_id: str) -> bool: | ||
return next((user for user in self.accounts if user.user_id == user_id), None) is not None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from __future__ import annotations | ||
from typing import List, Optional, TYPE_CHECKING | ||
|
||
|
||
from PySide6 import QtCore | ||
from PyQuotient import Quotient | ||
if TYPE_CHECKING: | ||
from demo.models.roomlistmodel import RoomListModel | ||
from __feature__ import snake_case, true_property | ||
|
||
|
||
class RoomGroup: | ||
SystemPrefix = "im.quotient." | ||
LegacyPrefix = "org.qmatrixclient." | ||
|
||
def __init__(self, key: str, rooms: Optional[List[Quotient.Room]] = None): | ||
self.key = key | ||
self.rooms: List[Quotient.Room] = [] | ||
if rooms is not None: | ||
self.rooms = rooms | ||
|
||
def __eq__(self, o: object) -> bool: | ||
if isinstance(o, RoomGroup): | ||
return self.key == o.key | ||
return self.key == o | ||
|
||
def __repr__(self) -> str: | ||
return f"RoomGroup(key='{self.key}', len(rooms)={len(self.rooms)})" | ||
|
||
|
||
RoomGroups = List[RoomGroup] | ||
|
||
|
||
class AbstractRoomOrdering(QtCore.QObject): | ||
def __init__(self, model: RoomListModel) -> None: | ||
super().__init__(model) | ||
self.model = model | ||
|
||
def room_groups(self, room: Quotient.Room) -> RoomGroups: | ||
return [] | ||
|
||
def update_groups(self, room: Quotient.Room) -> None: | ||
self.model.update_groups(room) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.