Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Malte L
gajim-plugins
Commits
f64e4e99
Commit
f64e4e99
authored
Jan 31, 2019
by
Philipp Hörist
Browse files
[triggers] Remove compatibility code
parent
459f0d27
Changes
1
Hide whitespace changes
Inline
Side-by-side
triggers/triggers.py
View file @
f64e4e99
...
...
@@ -31,27 +31,15 @@ from gajim.plugins import GajimPlugin
from
gajim.plugins.helpers
import
log_calls
from
gajim.plugins.helpers
import
get_builder
from
gajim.plugins.gui
import
GajimPluginConfigDialog
from
gajim.plugins.plugins_i18n
import
_
# Since Gajim 1.1.0 _() has to be imported
try
:
from
gajim.common.i18n
import
_
except
ImportError
:
pass
from
gajim.gtk.filechoosers
import
NativeFileChooserDialog
,
Filter
try
:
from
gajim.gtk.filechoosers
import
NativeFileChooserDialog
,
Filter
class
SoundChooserDialog
(
NativeFileChooserDialog
):
NEW_FILECHOOSER
=
True
class
SoundChooserDialog
(
NativeFileChooserDialog
):
_title
=
_
(
'Choose Sound'
)
_filters
=
[
Filter
(
_
(
'All files'
),
'*'
,
False
),
Filter
(
_
(
'WAV files'
),
'*.wav'
,
True
)]
except
ImportError
:
from
gajim.dialogs
import
SoundChooserDialog
NEW_FILECHOOSER
=
False
_title
=
_
(
'Choose Sound'
)
_filters
=
[
Filter
(
_
(
'All files'
),
'*'
,
False
),
Filter
(
_
(
'WAV files'
),
'*.wav'
,
True
)]
class
Triggers
(
GajimPlugin
):
...
...
@@ -717,10 +705,7 @@ class TriggersPluginConfigDialog(GajimPluginConfigDialog):
self
.
_ui
.
sound_file_box
.
set_sensitive
(
False
)
def
on_browse_for_sounds_button_clicked
(
self
,
widget
,
data
=
None
):
if
NEW_FILECHOOSER
:
self
.
_new_filechooser
()
else
:
self
.
_old_filechooser
(
widget
,
data
)
self
.
_new_filechooser
()
def
_new_filechooser
(
self
):
if
self
.
active_num
<
0
:
...
...
@@ -736,21 +721,6 @@ class TriggersPluginConfigDialog(GajimPluginConfigDialog):
path
=
path_to_snd_file
,
transient_for
=
self
)
def
_old_filechooser
(
self
,
widget
,
data
=
None
):
if
self
.
active_num
<
0
:
return
def
on_ok
(
widget
,
path_to_snd_file
):
dialog
.
destroy
()
if
not
path_to_snd_file
:
path_to_snd_file
=
''
self
.
config
[
self
.
active_num
][
'sound_file'
]
=
path_to_snd_file
self
.
_ui
.
sound_entry
.
set_text
(
path_to_snd_file
)
path_to_snd_file
=
self
.
_ui
.
sound_entry
.
get_text
()
path_to_snd_file
=
os
.
path
.
join
(
os
.
getcwd
(),
path_to_snd_file
)
dialog
=
SoundChooserDialog
(
path_to_snd_file
,
on_ok
)
def
on_play_button_clicked
(
self
,
widget
):
helpers
.
play_sound_file
(
self
.
_ui
.
sound_entry
.
get_text
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment