Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
gajim-plugins
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
Evert Mouw
gajim-plugins
Commits
eeeb9e46
Commit
eeeb9e46
authored
7 years ago
by
vflyson
Browse files
Options
Downloads
Patches
Plain Diff
[regex_filter] Improve the rule swap mechanism
parent
00b40e62
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
regex_filter/regex_filter.py
+14
-5
14 additions, 5 deletions
regex_filter/regex_filter.py
regex_filter/ui.py
+4
-5
4 additions, 5 deletions
regex_filter/ui.py
with
18 additions
and
10 deletions
regex_filter/regex_filter.py
+
14
−
5
View file @
eeeb9e46
...
...
@@ -88,11 +88,20 @@ class RegexFilterPlugin(GajimPlugin):
return
False
@log_calls
(
'
RegexFilterPlugin
'
)
def
swap_rules
(
self
,
oldNum
,
newNum
):
if
newNum
>=
0
and
newNum
<
len
(
self
.
get_rules
().
items
()):
temp
=
self
.
config
[
str
(
newNum
)]
self
.
config
[
str
(
newNum
)]
=
self
.
config
[
str
(
oldNum
)]
self
.
config
[
str
(
oldNum
)]
=
temp
def
swap_rules
(
self
,
old_num
,
down
):
new_num
=
old_num
rules_num
=
self
.
rules
.
keys
()
rules_num
.
sort
()
if
down
:
rules_num
=
reversed
(
rules_num
)
for
num
in
rules_num
:
if
num
==
old_num
:
break
new_num
=
num
if
new_num
!=
old_num
:
temp
=
self
.
config
[
str
(
new_num
)]
self
.
config
[
str
(
new_num
)]
=
self
.
config
[
str
(
old_num
)]
self
.
config
[
str
(
old_num
)]
=
temp
self
.
create_rules
()
return
True
return
False
...
...
This diff is collapsed.
Click to expand it.
regex_filter/ui.py
+
4
−
5
View file @
eeeb9e46
...
...
@@ -115,14 +115,13 @@ class RegexFilterPluginConfigDialog(GajimPluginConfigDialog):
for
rule
in
rules
:
it
=
model
.
get_iter
(
rule
)
ruleNum
=
model
.
get
(
it
,
0
)
self
.
plugin
.
swap_rules
(
"
%d
"
%
ruleNum
,
int
(
"
%d
"
%
ruleNum
)
-
1
)
ruleNum
,
_
=
model
.
get
(
it
,
0
,
1
)
self
.
plugin
.
swap_rules
(
ruleNum
,
False
)
def
move_down_button_clicked_cb
(
self
,
button
,
*
args
):
model
,
rules
=
self
.
rules_view
.
get_selection
().
get_selected_rows
()
for
rule
in
rules
:
it
=
model
.
get_iter
(
rule
)
ruleNum
=
model
.
get
(
it
,
0
)
self
.
plugin
.
swap_rules
(
"
%d
"
%
ruleNum
,
int
(
"
%d
"
%
ruleNum
)
+
1
)
ruleNum
,
_
=
model
.
get
(
it
,
0
,
1
)
self
.
plugin
.
swap_rules
(
ruleNum
,
True
)
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