Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gajim-plugins
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
56
Issues
56
List
Boards
Labels
Service Desk
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gajim
gajim-plugins
Commits
003f2103
Commit
003f2103
authored
Dec 09, 2018
by
Philipp Hörist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[preview] Make pillow a required dependency
Fixes #367
parent
f61f8d3d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
url_image_preview/url_image_preview.py
url_image_preview/url_image_preview.py
+9
-6
No files found.
url_image_preview/url_image_preview.py
View file @
003f2103
...
...
@@ -41,7 +41,6 @@ from gajim.plugins.plugins_i18n import _
from
url_image_preview.http_functions
import
get_http_head
,
get_http_file
from
url_image_preview.config_dialog
import
UrlImagePreviewConfigDialog
from
url_image_preview.resize_gif
import
resize_gif
from
gajim.gtk.filechoosers
import
FileSaveDialog
from
gajim.gtk.util
import
get_cursor
...
...
@@ -49,12 +48,13 @@ from gajim.gtk.util import get_cursor
log
=
logging
.
getLogger
(
'gajim.plugin_system.preview'
)
PILLOW_AVAILABLE
=
Tru
e
ERROR_MSG
=
Non
e
try
:
from
PIL
import
Image
from
url_image_preview.resize_gif
import
resize_gif
except
:
log
.
debug
(
'Pillow not available'
)
PILLOW_AVAILABLE
=
False
ERROR_MSG
=
'Please install python-pillow'
try
:
if
os
.
name
==
'nt'
:
...
...
@@ -79,6 +79,12 @@ ACCEPTED_MIME_TYPES = ('image/png', 'image/jpeg', 'image/gif', 'image/raw',
class
UrlImagePreviewPlugin
(
GajimPlugin
):
@
log_calls
(
'UrlImagePreviewPlugin'
)
def
init
(
self
):
if
ERROR_MSG
:
self
.
activatable
=
False
self
.
available_text
=
ERROR_MSG
self
.
config_dialog
=
None
return
if
not
decryption_available
:
self
.
available_text
=
DEP_MSG
self
.
config_dialog
=
partial
(
UrlImagePreviewConfigDialog
,
self
)
...
...
@@ -361,9 +367,6 @@ class Base(object):
log
.
info
(
'Failed to load image using Gdk.Pixbuf'
)
log
.
debug
(
error
)
if
not
PILLOW_AVAILABLE
:
log
.
info
(
'Pillow not available'
)
return
# Try Pillow
image
=
Image
.
open
(
BytesIO
(
mem
)).
convert
(
"RGBA"
)
array
=
GLib
.
Bytes
.
new
(
image
.
tobytes
())
...
...
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