Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mesonium
gajim
Commits
c14cc32b
Commit
c14cc32b
authored
3 years ago
by
Daniel Brötzmann
Browse files
Options
Downloads
Patches
Plain Diff
ResourceSelector: Typing
parent
79b6cb15
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gajim/gtk/resource_selector.py
+8
-8
8 additions, 8 deletions
gajim/gtk/resource_selector.py
with
8 additions
and
8 deletions
gajim/gtk/resource_selector.py
+
8
−
8
View file @
c14cc32b
...
...
@@ -14,7 +14,7 @@
from
__future__
import
annotations
from
typing
import
Optional
from
typing
import
Tuple
from
typing
import
cast
import
locale
import
logging
...
...
@@ -23,7 +23,6 @@
from
gi.repository
import
Gtk
from
nbxmpp
import
JID
from
nbxmpp.namespaces
import
_Namespaces
from
nbxmpp.structs
import
DiscoInfo
from
gajim.common
import
app
...
...
@@ -46,7 +45,7 @@ class ResourceSelector(Gtk.ScrolledWindow):
def
__init__
(
self
,
contact
:
BareContact
,
constraints
:
Optional
[
list
[
_Namespaces
]]
=
None
)
->
None
:
constraints
:
Optional
[
list
[
str
]]
=
None
)
->
None
:
Gtk
.
ScrolledWindow
.
__init__
(
self
)
self
.
set_shadow_type
(
Gtk
.
ShadowType
.
IN
)
self
.
set_size_request
(
-
1
,
200
)
...
...
@@ -61,7 +60,7 @@ def __init__(self,
self
.
_contact
.
connect
(
'
presence-update
'
,
self
.
_on_update
)
self
.
_contact
.
connect
(
'
caps-update
'
,
self
.
_on_update
)
# Constraints include Namespaces a resource has to support
# Constraints include
nbxmpp
Namespaces a resource has to support
self
.
_constraints
=
constraints
or
[]
self
.
_set_placeholder
()
...
...
@@ -106,13 +105,14 @@ def _on_update(self,
self
.
_add_entries
()
def
get_jid
(
self
)
->
JID
:
return
self
.
_listbox
.
get_selected_row
().
jid
resource_row
=
cast
(
ResourceRow
,
self
.
_listbox
.
get_selected_row
())
return
resource_row
.
jid
class
ResourceRow
(
Gtk
.
ListBoxRow
):
def
__init__
(
self
,
resource_contact
:
ResourceContact
,
constraints
:
list
[
_Namespaces
]
constraints
:
list
[
str
]
)
->
None
:
Gtk
.
ListBoxRow
.
__init__
(
self
)
...
...
@@ -145,7 +145,7 @@ def __init__(self,
box
.
add
(
name_label
)
for
constraint
in
constraints
:
if
not
resource_contact
.
supports
(
str
(
constraint
)
)
:
if
not
resource_contact
.
supports
(
constraint
):
self
.
set_sensitive
(
False
)
self
.
set_tooltip_text
(
_
(
'
This devices is not compatible.
'
))
...
...
@@ -154,7 +154,7 @@ def __init__(self,
@staticmethod
def
_get_client_identity
(
disco_info
:
DiscoInfo
)
->
T
uple
[
Optional
[
str
],
Optional
[
str
]]:
)
->
t
uple
[
Optional
[
str
],
Optional
[
str
]]:
for
identity
in
disco_info
.
identities
:
if
identity
.
category
==
'
client
'
:
return
identity
.
name
,
identity
.
type
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment