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
364f5e13
Commit
364f5e13
authored
Jan 31, 2019
by
Philipp Hörist
Browse files
[image] Remove compatibility code
parent
60be4d4b
Changes
1
Hide whitespace changes
Inline
Side-by-side
image/image.py
View file @
364f5e13
...
...
@@ -8,20 +8,9 @@ from gi.repository import Gdk
from
gajim
import
chat_control
from
gajim.plugins
import
GajimPlugin
from
gajim.plugins.helpers
import
log_calls
from
gajim.dialogs
import
ErrorDialog
# Since Gajim 1.1.0 _() has to be imported
try
:
from
gajim.common.i18n
import
_
except
ImportError
:
pass
try
:
from
gajim.gtk.filechoosers
import
FileChooserDialog
NEW_FILECHOOSER
=
True
except
ImportError
:
from
gajim.dialogs
import
ImageChooserDialog
NEW_FILECHOOSER
=
False
from
gajim.plugins.plugins_i18n
import
_
from
gajim.gtk.dialogs
import
ErrorDialog
from
gajim.gtk.filechoosers
import
FileChooserDialog
NS_XHTML_IM
=
'http://jabber.org/protocol/xhtml-im'
...
...
@@ -110,13 +99,7 @@ class Base(object):
self
.
on_image_button_clicked
(
widget
)
return
True
def
on_image_button_clicked
(
self
,
widget
):
if
NEW_FILECHOOSER
:
self
.
_new_filechooser
()
else
:
self
.
_old_filechooser
(
widget
)
def
_new_filechooser
(
self
):
def
on_image_button_clicked
(
self
,
*
args
):
def
on_ok
(
filename
):
image
=
self
.
_check_file
(
filename
)
if
image
is
None
:
...
...
@@ -128,18 +111,6 @@ class Base(object):
select_multiple
=
False
,
transient_for
=
self
.
chat_control
.
parent_win
.
window
)
def
_old_filechooser
(
self
,
widget
):
def
on_ok
(
widget
,
path_to_file
):
image
=
self
.
_check_file
(
path_to_file
)
if
image
is
None
:
return
dlg
.
destroy
()
self
.
_send
(
image
,
path_to_file
)
dlg
=
ImageChooserDialog
(
on_response_ok
=
on_ok
,
on_response_cancel
=
None
)
def
_check_file
(
self
,
filename
):
filesize
=
os
.
path
.
getsize
(
filename
)
# in bytes
invalid_file
=
False
...
...
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