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
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
Michel Le Bihan
gajim
Commits
5bab2f22
Commit
5bab2f22
authored
1 year ago
by
Daniel Brötzmann
Browse files
Options
Downloads
Patches
Plain Diff
refactor: XMLConsole: Make attributes private
parent
e7aa6d3a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gajim/gtk/xml_console.py
+64
-43
64 additions, 43 deletions
gajim/gtk/xml_console.py
with
64 additions
and
43 deletions
gajim/gtk/xml_console.py
+
64
−
43
View file @
5bab2f22
...
...
@@ -58,15 +58,16 @@ class XMLConsoleWindow(Gtk.ApplicationWindow, EventHelper):
self
.
_selected_account
=
'
AllAccounts
'
self
.
_selected_send_account
:
Optional
[
str
]
=
None
self
.
presence
=
True
self
.
message
=
True
self
.
iq
=
True
self
.
stream
=
True
self
.
incoming
=
True
self
.
outgoing
=
True
self
.
filter_dialog
=
None
self
.
last_stanza
=
None
self
.
last_search
=
''
self
.
_filter_dialog
:
Optional
[
SettingsDialog
]
=
None
self
.
_last_stanza
:
Optional
[
str
]
=
None
self
.
_last_search
:
str
=
''
self
.
_presence
=
True
self
.
_message
=
True
self
.
_iq
=
True
self
.
_stream
=
True
self
.
_incoming
=
True
self
.
_outgoing
=
True
self
.
_ui
=
get_builder
(
'
xml_console.ui
'
)
self
.
set_titlebar
(
self
.
_ui
.
headerbar
)
...
...
@@ -190,7 +191,6 @@ class XMLConsoleWindow(Gtk.ApplicationWindow, EventHelper):
assert
isinstance
(
child
,
Gtk
.
Label
)
text
=
child
.
get_text
()
# pylint: disable=line-too-long
input_text
=
None
if
text
==
'
Presence
'
:
input_text
=
(
...
...
@@ -214,7 +214,6 @@ class XMLConsoleWindow(Gtk.ApplicationWindow, EventHelper):
'
<iq to=
""
type=
"
get
"
xmlns=
"
jabber:client
"
>
\n
'
'
<query xmlns=
"
http://jabber.org/protocol/disco#info
"
>
'
'
</query>
\n
</iq>
'
)
# pylint: enable=line-too-long
if
input_text
is
not
None
:
buffer_
=
self
.
_ui
.
input_entry
.
get_buffer
()
...
...
@@ -251,13 +250,13 @@ class XMLConsoleWindow(Gtk.ApplicationWindow, EventHelper):
client
=
app
.
get_client
(
self
.
_selected_send_account
)
assert
isinstance
(
node
,
nbxmpp
.
Protocol
)
client
.
connection
.
send_stanza
(
node
)
self
.
last_stanza
=
stanza
self
.
_
last_stanza
=
stanza
buffer_
.
set_text
(
''
)
def
_on_paste_last
(
self
,
*
args
:
Any
)
->
None
:
buffer_
=
self
.
_ui
.
input_entry
.
get_buffer
()
if
self
.
last_stanza
is
not
None
:
buffer_
.
set_text
(
self
.
last_stanza
)
if
self
.
_
last_stanza
is
not
None
:
buffer_
.
set_text
(
self
.
_
last_stanza
)
self
.
_ui
.
input_entry
.
grab_focus
()
def
_on_input
(
self
,
button
:
Gtk
.
ToggleButton
)
->
None
:
...
...
@@ -306,7 +305,7 @@ class XMLConsoleWindow(Gtk.ApplicationWindow, EventHelper):
if
last_pos_mark
is
not
None
:
current_pos
=
textbuffer
.
get_iter_at_mark
(
last_pos_mark
)
if
search_str
!=
self
.
last_search
:
if
search_str
!=
self
.
_
last_search
:
current_pos
=
textbuffer
.
get_start_iter
()
if
direction
==
Direction
.
NEXT
:
...
...
@@ -328,7 +327,7 @@ class XMLConsoleWindow(Gtk.ApplicationWindow, EventHelper):
textbuffer
.
select_range
(
match_start
,
match_end
)
mark
=
textbuffer
.
create_mark
(
'
last_pos
'
,
match_end
,
True
)
self
.
_ui
.
sourceview
.
scroll_to_mark
(
mark
,
0
,
True
,
0.5
,
0.5
)
self
.
last_search
=
search_str
self
.
_
last_search
=
search_str
@staticmethod
def
_get_accounts
()
->
list
[
tuple
[
Optional
[
str
],
str
]]:
...
...
@@ -341,51 +340,73 @@ class XMLConsoleWindow(Gtk.ApplicationWindow, EventHelper):
return
combo_accounts
def
_on_filter_options
(
self
,
_button
:
Gtk
.
Button
)
->
None
:
if
self
.
filter_dialog
is
not
None
:
self
.
filter_dialog
.
present
()
if
self
.
_
filter_dialog
is
not
None
:
self
.
_
filter_dialog
.
present
()
return
combo_accounts
=
self
.
_get_accounts
()
combo_accounts
.
insert
(
0
,
(
'
AllAccounts
'
,
_
(
'
All Accounts
'
)))
settings
=
[
Setting
(
SettingKind
.
COMBO
,
_
(
'
Account
'
),
SettingType
.
VALUE
,
self
.
_selected_account
,
Setting
(
SettingKind
.
COMBO
,
_
(
'
Account
'
),
SettingType
.
VALUE
,
self
.
_selected_account
,
callback
=
self
.
_set_account
,
props
=
{
'
combo_items
'
:
combo_accounts
}),
Setting
(
SettingKind
.
SWITCH
,
'
Presence
'
,
SettingType
.
VALUE
,
self
.
presence
,
callback
=
self
.
_on_setting
,
data
=
'
presence
'
),
Setting
(
SettingKind
.
SWITCH
,
'
Message
'
,
SettingType
.
VALUE
,
self
.
message
,
callback
=
self
.
_on_setting
,
data
=
'
message
'
),
Setting
(
SettingKind
.
SWITCH
,
'
IQ
'
,
SettingType
.
VALUE
,
self
.
iq
,
callback
=
self
.
_on_setting
,
data
=
'
iq
'
),
Setting
(
SettingKind
.
SWITCH
,
'
Stream Management
'
,
SettingType
.
VALUE
,
self
.
stream
,
callback
=
self
.
_on_setting
,
data
=
'
stream
'
),
Setting
(
SettingKind
.
SWITCH
,
'
In
'
,
SettingType
.
VALUE
,
self
.
incoming
,
callback
=
self
.
_on_setting
,
data
=
'
incoming
'
),
Setting
(
SettingKind
.
SWITCH
,
'
Out
'
,
SettingType
.
VALUE
,
self
.
outgoing
,
callback
=
self
.
_on_setting
,
data
=
'
outgoing
'
),
Setting
(
SettingKind
.
SWITCH
,
'
Presence
'
,
SettingType
.
VALUE
,
self
.
_presence
,
callback
=
self
.
_on_setting
,
data
=
'
presence
'
),
Setting
(
SettingKind
.
SWITCH
,
'
Message
'
,
SettingType
.
VALUE
,
self
.
_message
,
callback
=
self
.
_on_setting
,
data
=
'
message
'
),
Setting
(
SettingKind
.
SWITCH
,
'
IQ
'
,
SettingType
.
VALUE
,
self
.
_iq
,
callback
=
self
.
_on_setting
,
data
=
'
iq
'
),
Setting
(
SettingKind
.
SWITCH
,
'
Stream Management
'
,
SettingType
.
VALUE
,
self
.
_stream
,
callback
=
self
.
_on_setting
,
data
=
'
stream
'
),
Setting
(
SettingKind
.
SWITCH
,
'
In
'
,
SettingType
.
VALUE
,
self
.
_incoming
,
callback
=
self
.
_on_setting
,
data
=
'
incoming
'
),
Setting
(
SettingKind
.
SWITCH
,
'
Out
'
,
SettingType
.
VALUE
,
self
.
_outgoing
,
callback
=
self
.
_on_setting
,
data
=
'
outgoing
'
),
]
self
.
filter_dialog
=
SettingsDialog
(
self
.
_
filter_dialog
=
SettingsDialog
(
self
,
_
(
'
Filter
'
),
Gtk
.
DialogFlags
.
DESTROY_WITH_PARENT
,
settings
,
self
.
_selected_account
or
'
AllAccounts
'
)
self
.
filter_dialog
.
connect
(
'
destroy
'
,
self
.
_on_filter_destroyed
)
self
.
_
filter_dialog
.
connect
(
'
destroy
'
,
self
.
_on_filter_destroyed
)
def
_on_filter_destroyed
(
self
,
_widget
:
Gtk
.
Widget
)
->
None
:
self
.
filter_dialog
=
None
self
.
_
filter_dialog
=
None
def
_on_clear
(
self
,
_button
:
Gtk
.
Button
)
->
None
:
self
.
_ui
.
sourceview
.
get_buffer
().
set_text
(
''
)
...
...
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