Add possibility to get windows by jid

This also makes it possible to get windows by an account/jid combination
This commit is contained in:
Philipp Hörist 2018-11-02 22:21:15 +01:00
parent 0662374c14
commit e615a8e2e3
1 changed files with 14 additions and 11 deletions

View File

@ -630,19 +630,22 @@ def prefers_app_menu():
return False
return app.prefers_app_menu()
def get_app_window(cls, account=None):
def get_app_window(cls, account=None, jid=None):
for win in app.get_windows():
if isinstance(cls, str):
if type(win).__name__ == cls:
if account is not None:
if account != win.account:
continue
return win
elif isinstance(win, cls):
if account is not None:
if account != win.account:
continue
return win
if type(win).__name__ != cls:
continue
elif not isinstance(win, cls):
continue
if account is not None:
if account != win.account:
continue
if jid is not None:
if jid != win.jid:
continue
return win
return None
def load_css_config():