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
gajim
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
209
Issues
209
List
Boards
Labels
Service Desk
Milestones
Merge Requests
21
Merge Requests
21
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
Commits
45a200f7
Commit
45a200f7
authored
Sep 04, 2019
by
Philipp Hörist
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove menu for saving avatar to harddisk
All avatars are available under ~/.cache/gajim/avatars
parent
9f59eb54
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
3 additions
and
151 deletions
+3
-151
gajim/chat_control.py
gajim/chat_control.py
+0
-23
gajim/data/gui/profile_window.ui
gajim/data/gui/profile_window.ui
+2
-2
gajim/data/gui/vcard_information_window.ui
gajim/data/gui/vcard_information_window.ui
+0
-1
gajim/data/gui/zeroconf_information_window.ui
gajim/data/gui/zeroconf_information_window.ui
+0
-1
gajim/gtk/filechoosers.py
gajim/gtk/filechoosers.py
+0
-6
gajim/gtk/profile.py
gajim/gtk/profile.py
+1
-16
gajim/gtkgui_helpers.py
gajim/gtkgui_helpers.py
+0
-65
gajim/gui_menu_builder.py
gajim/gui_menu_builder.py
+0
-12
gajim/vcard.py
gajim/vcard.py
+0
-25
No files found.
gajim/chat_control.py
View file @
45a200f7
...
...
@@ -142,13 +142,6 @@ def __init__(self, parent_win, contact, acct, session, resource=None):
self
.
show_avatar
()
# Hook up signals
widget
=
self
.
xml
.
get_object
(
'avatar_eventbox'
)
widget
.
set_property
(
'height-request'
,
AvatarSize
.
CHAT
)
id_
=
widget
.
connect
(
'button-press-event'
,
self
.
on_avatar_eventbox_button_press_event
)
self
.
handlers
[
id_
]
=
widget
widget
=
self
.
xml
.
get_object
(
'location_eventbox'
)
id_
=
widget
.
connect
(
'button-release-event'
,
self
.
on_location_eventbox_button_release_event
)
...
...
@@ -639,22 +632,6 @@ def on_sound_hscale_value_changed(self, widget, value):
# Save volume to config
app
.
config
.
set
(
'audio_output_volume'
,
value
)
def
on_avatar_eventbox_button_press_event
(
self
,
widget
,
event
):
"""
If right-clicked, show popup
"""
if
event
.
button
==
3
:
# right click
if
self
.
TYPE_ID
==
message_control
.
TYPE_CHAT
:
sha
=
app
.
contacts
.
get_avatar_sha
(
self
.
account
,
self
.
contact
.
jid
)
name
=
self
.
contact
.
get_shown_name
()
else
:
sha
=
self
.
gc_contact
.
avatar_sha
name
=
self
.
gc_contact
.
get_shown_name
()
if
sha
is
not
None
:
gui_menu_builder
.
show_save_as_menu
(
sha
,
name
)
return
True
def
on_location_eventbox_button_release_event
(
self
,
widget
,
event
):
if
'geoloc'
in
self
.
contact
.
pep
:
location
=
self
.
contact
.
pep
[
'geoloc'
].
data
...
...
gajim/data/gui/profile_window.ui
View file @
45a200f7
...
...
@@ -43,7 +43,7 @@
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"receives_default"
>
False
</property>
<signal
name=
"
button-press-event"
handler=
"on_PHOTO_button_press_event
"
swapped=
"no"
/>
<signal
name=
"
clicked"
handler=
"_on_set_avatar_clicked
"
swapped=
"no"
/>
<child>
<object
class=
"GtkOverlay"
>
<property
name=
"visible"
>
True
</property>
...
...
@@ -108,7 +108,7 @@
<property
name=
"halign"
>
start
</property>
<property
name=
"valign"
>
start
</property>
<property
name=
"use_underline"
>
True
</property>
<signal
name=
"
button-press-event"
handler=
"on_PHOTO_button_press_event
"
swapped=
"no"
/>
<signal
name=
"
clicked"
handler=
"_on_set_avatar_clicked
"
swapped=
"no"
/>
<child>
<object
class=
"GtkBox"
>
<property
name=
"visible"
>
True
</property>
...
...
gajim/data/gui/vcard_information_window.ui
View file @
45a200f7
...
...
@@ -364,7 +364,6 @@
<property
name=
"can_focus"
>
False
</property>
<property
name=
"halign"
>
start
</property>
<property
name=
"visible_window"
>
False
</property>
<signal
name=
"button-press-event"
handler=
"on_PHOTO_eventbox_button_press_event"
swapped=
"no"
/>
<child>
<object
class=
"GtkImage"
id=
"PHOTO_image"
>
<property
name=
"can_focus"
>
False
</property>
...
...
gajim/data/gui/zeroconf_information_window.ui
View file @
45a200f7
...
...
@@ -179,7 +179,6 @@
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"visible_window"
>
False
</property>
<signal
name=
"button-press-event"
handler=
"on_PHOTO_eventbox_button_press_event"
swapped=
"no"
/>
<child>
<object
class=
"GtkImage"
id=
"PHOTO_image"
>
<property
name=
"visible"
>
True
</property>
...
...
gajim/gtk/filechoosers.py
View file @
45a200f7
...
...
@@ -144,12 +144,6 @@ class FileSaveDialog(NativeFileChooserDialog):
_action
=
Gtk
.
FileChooserAction
.
SAVE
class
AvatarSaveDialog
(
FileSaveDialog
):
if
sys
.
platform
==
'win32'
:
_filters
=
[
Filter
(
_
(
'Images'
),
'*.png;*.jpg;*.jpeg;*.svg'
,
True
)]
class
NativeFileOpenDialog
(
BaseFileOpenDialog
,
NativeFileChooserDialog
):
pass
...
...
gajim/gtk/profile.py
View file @
45a200f7
...
...
@@ -32,7 +32,6 @@
from
gajim.common.helpers
import
event_filter
from
gajim
import
gtkgui_helpers
from
gajim.gui_menu_builder
import
show_save_as_menu
from
gajim.gtk.dialogs
import
ErrorDialog
from
gajim.gtk.dialogs
import
InformationDialog
...
...
@@ -127,7 +126,7 @@ def _clear_photo(self, widget):
self
.
avatar_sha
=
None
self
.
avatar_mime_type
=
None
def
on_set_avatar_button_clicked
(
self
,
widget
):
def
_on_set_avatar_clicked
(
self
,
_button
):
def
on_ok
(
path_to_file
):
data
,
sha
=
app
.
interface
.
avatar_storage
.
prepare_for_publish
(
path_to_file
)
...
...
@@ -153,20 +152,6 @@ def on_ok(path_to_file):
AvatarChooserDialog
(
on_ok
,
transient_for
=
self
)
def
on_PHOTO_button_press_event
(
self
,
widget
,
event
):
"""
If right-clicked, show popup
"""
if
event
.
button
==
3
:
# right click
nick
=
app
.
config
.
get_per
(
'accounts'
,
self
.
account
,
'name'
)
if
self
.
avatar_sha
is
None
:
return
show_save_as_menu
(
self
.
avatar_sha
,
nick
)
elif
event
.
button
==
1
:
# left click
self
.
on_set_avatar_button_clicked
(
widget
)
def
on_BDAY_entry_focus_out_event
(
self
,
widget
,
event
):
txt
=
widget
.
get_text
()
if
not
txt
:
...
...
gajim/gtkgui_helpers.py
View file @
45a200f7
...
...
@@ -39,7 +39,6 @@
except
Exception
:
pass
from
gajim.common.i18n
import
_
from
gajim.common
import
app
HAS_PYWIN32
=
True
...
...
@@ -148,70 +147,6 @@ def scale_pixbuf_from_data(data, size):
return
scale_pixbuf
(
pixbuf
,
size
)
def
on_avatar_save_as_menuitem_activate
(
widget
,
avatar
,
default_name
=
''
):
from
gajim.gtk.dialogs
import
DialogButton
from
gajim.gtk.dialogs
import
ErrorDialog
from
gajim.gtk.dialogs
import
NewConfirmationDialog
from
gajim.gtk.filechoosers
import
AvatarSaveDialog
def
_on_save_avatar
(
file_path
):
if
os
.
path
.
exists
(
file_path
):
# Check if we have write permissions
if
not
os
.
access
(
file_path
,
os
.
W_OK
):
file_name
=
os
.
path
.
basename
(
file_path
)
ErrorDialog
(
_
(
'Cannot overwrite existing file
\'
%s
\'
'
%
file_name
),
_
(
'A file with this name already exists and you do '
'not have permission to overwrite it.'
))
return
app
.
config
.
set
(
'last_save_dir'
,
os
.
path
.
dirname
(
file_path
))
if
isinstance
(
avatar
,
str
):
# We got a SHA
pixbuf
=
app
.
interface
.
avatar_storage
.
pixbuf_from_filename
(
avatar
)
else
:
# We got a pixbuf
pixbuf
=
avatar
extension
=
os
.
path
.
splitext
(
file_path
)[
1
]
if
not
extension
:
# Silently save as Jpeg image
image_format
=
'png'
file_path
+=
'.png'
else
:
image_format
=
extension
[
1
:]
# remove leading dot
# Save image
try
:
pixbuf
.
savev
(
file_path
,
image_format
,
[],
[])
except
Exception
as
error
:
log
.
error
(
'Error saving avatar: %s'
,
error
)
if
os
.
path
.
exists
(
file_path
):
os
.
remove
(
file_path
)
new_file_path
=
'.'
.
join
(
file_path
.
split
(
'.'
)[:
-
1
])
+
'.png'
def
_on_ok
(
file_path
,
pixbuf
):
pixbuf
.
savev
(
file_path
,
'png'
,
[],
[])
NewConfirmationDialog
(
_
(
'Error While Saving'
),
_
(
'Extension not supported'
),
_
(
'Image cannot be saved in %(type)s format.
\n
'
'Save as %(new_filename)s?'
)
%
{
'type'
:
image_format
,
'new_filename'
:
new_file_path
},
[
DialogButton
.
make
(
'Cancel'
),
DialogButton
.
make
(
'OK'
,
text
=
_
(
'_Save'
),
callback
=
_on_ok
,
args
=
[
new_file_path
,
pixbuf
])]).
show
()
AvatarSaveDialog
(
_on_save_avatar
,
path
=
app
.
config
.
get
(
'last_save_dir'
),
file_name
=
'%s.png'
%
default_name
,
transient_for
=
app
.
app
.
get_active_window
())
def
create_combobox
(
value_list
,
selected_value
=
None
):
"""
Value_list is [(label1, value1)]
...
...
gajim/gui_menu_builder.py
View file @
45a200f7
...
...
@@ -509,18 +509,6 @@ def get_transport_menu(contact, account):
return
menu
def
show_save_as_menu
(
sha
,
name
):
menu
=
Gtk
.
Menu
()
menuitem
=
Gtk
.
MenuItem
.
new_with_mnemonic
(
_
(
'Save _As'
))
menuitem
.
connect
(
'activate'
,
gtkgui_helpers
.
on_avatar_save_as_menuitem_activate
,
sha
,
name
)
menu
.
append
(
menuitem
)
menu
.
connect
(
'selection-done'
,
lambda
w
:
w
.
destroy
())
menu
.
show_all
()
menu
.
popup_at_pointer
()
def
get_singlechat_menu
(
control_id
,
account
,
jid
):
singlechat_menu
=
[
(
_
(
'Send File…'
),
[
...
...
gajim/vcard.py
View file @
45a200f7
...
...
@@ -37,7 +37,6 @@
from
nbxmpp.protocol
import
JID
from
gajim
import
gtkgui_helpers
from
gajim.gui_menu_builder
import
show_save_as_menu
from
gajim.common
import
helpers
from
gajim.common
import
app
from
gajim.common
import
ged
...
...
@@ -158,22 +157,6 @@ def on_vcard_information_window_key_press_event(self, widget, event):
def
on_information_notebook_switch_page
(
self
,
widget
,
page
,
page_num
):
GLib
.
idle_add
(
self
.
xml
.
get_object
(
'close_button'
).
grab_focus
)
def
on_PHOTO_eventbox_button_press_event
(
self
,
widget
,
event
):
"""
If right-clicked, show popup
"""
if
event
.
button
==
3
:
# right click
if
self
.
gc_contact
:
sha
=
self
.
gc_contact
.
avatar_sha
name
=
self
.
gc_contact
.
get_shown_name
()
else
:
sha
=
app
.
contacts
.
get_avatar_sha
(
self
.
account
,
self
.
contact
.
jid
)
name
=
self
.
contact
.
get_shown_name
()
if
sha
is
None
:
sha
=
self
.
avatar
show_save_as_menu
(
sha
,
name
)
def
set_value
(
self
,
entry_name
,
value
):
try
:
widget
=
self
.
xml
.
get_object
(
entry_name
)
...
...
@@ -499,14 +482,6 @@ def on_zeroconf_information_window_key_press_event(self, widget, event):
if
event
.
keyval
==
Gdk
.
KEY_Escape
:
self
.
window
.
destroy
()
def
on_PHOTO_eventbox_button_press_event
(
self
,
widget
,
event
):
"""
If right-clicked, show popup
"""
if
event
.
button
==
3
:
# right click
show_save_as_menu
(
self
.
contact
.
avatar_sha
,
self
.
contact
.
get_shown_name
())
def
set_value
(
self
,
entry_name
,
value
):
try
:
if
value
and
entry_name
==
'URL_label'
:
...
...
Daniel Brötzmann
@wurstsalat
mentioned in issue
#9741 (closed)
·
Sep 06, 2019
mentioned in issue
#9741 (closed)
mentioned in issue #9741
Toggle commit list
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