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
Package Registry
Model registry
Operate
Environments
Terraform modules
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
TSRh
gajim
Commits
8f645b86
Commit
8f645b86
authored
18 years ago
by
dkirov
Browse files
Options
Downloads
Patches
Plain Diff
msg should be string, not object instance
show error dialog if file_path is not a file or file_size is 0
parent
ca6668d8
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
src/vcard.py
+16
-2
16 additions, 2 deletions
src/vcard.py
with
16 additions
and
2 deletions
src/vcard.py
+
16
−
2
View file @
8f645b86
...
...
@@ -161,7 +161,16 @@ def on_set_avatar_button_clicked(self, widget):
f
=
None
def
on_ok
(
widget
,
path_to_file
):
filesize
=
os
.
path
.
getsize
(
path_to_file
)
# in bytes
if
filesize
>
16384
:
# 16 kb
#FIXME: use messages for invalid file for 0.11
invalid_file
=
False
msg
=
''
if
os
.
path
.
isfile
(
path_to_file
):
stat
=
os
.
stat
(
path_to_file
)
if
stat
[
6
]
==
0
:
invalid_file
=
True
else
:
invalid_file
=
True
if
not
invalid_file
and
filesize
>
16384
:
# 16 kb
try
:
pixbuf
=
gtk
.
gdk
.
pixbuf_new_from_file
(
path_to_file
)
# get the image at 'notification size'
...
...
@@ -169,9 +178,14 @@ def on_ok(widget, path_to_file):
scaled_pixbuf
=
gtkgui_helpers
.
get_scaled_pixbuf
(
pixbuf
,
'
notification
'
)
except
gobject
.
GError
,
msg
:
# unknown format
# msg should be string, not object instance
msg
=
str
(
msg
)
invalid_file
=
True
if
invalid_file
:
if
True
:
# keep identation
dialogs
.
ErrorDialog
(
_
(
'
Could not load image
'
),
msg
)
return
else
:
if
filesize
>
16384
:
if
scaled_pixbuf
:
path_to_file
=
os
.
path
.
join
(
gajim
.
TMP
,
'
avatar_scaled.png
'
)
...
...
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