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
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yuki
gajim-plugins
Commits
06363073
Commit
06363073
authored
Apr 25, 2019
by
Daniel Brötzmann
Committed by
Philipp Hörist
Apr 27, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[preview] Add Open Folder to context menu
parent
d9b146ee
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
5 deletions
+34
-5
url_image_preview/config_dialog.py
url_image_preview/config_dialog.py
+1
-0
url_image_preview/context_menu.ui
url_image_preview/context_menu.ui
+19
-2
url_image_preview/url_image_preview.py
url_image_preview/url_image_preview.py
+14
-3
No files found.
url_image_preview/config_dialog.py
View file @
06363073
...
...
@@ -42,6 +42,7 @@ class UrlImagePreviewConfigDialog(SettingsDialog):
actions
=
[
(
'open_menuitem'
,
_
(
'Open'
)),
(
'save_as_menuitem'
,
_
(
'Save as'
)),
(
'open_folder_menuitem'
,
_
(
'Open Folder'
)),
(
'copy_link_location_menuitem'
,
_
(
'Copy Link Location'
)),
(
'open_link_in_browser_menuitem'
,
_
(
'Open Link in Browser'
)),
(
'open_file_in_browser_menuitem'
,
_
(
'Open File in Browser'
))]
...
...
url_image_preview/context_menu.ui
View file @
06363073
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
<requires
lib=
"gtk+"
version=
"3.0"
/>
<object
class=
"GtkImage"
id=
"image1"
>
...
...
@@ -19,12 +20,17 @@
<object
class=
"GtkImage"
id=
"image4"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"
stock"
>
gtk-jump-to
</property>
<property
name=
"
icon_name"
>
emblem-symbolic-link
</property>
</object>
<object
class=
"GtkImage"
id=
"image5"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"stock"
>
gtk-jump-to
</property>
<property
name=
"icon_name"
>
emblem-symbolic-link
</property>
</object>
<object
class=
"GtkImage"
id=
"image6"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"icon_name"
>
folder-download
</property>
</object>
<object
class=
"GtkMenu"
id=
"context_menu"
>
<property
name=
"can_focus"
>
False
</property>
...
...
@@ -50,6 +56,17 @@
<property
name=
"always_show_image"
>
True
</property>
</object>
</child>
<child>
<object
class=
"GtkImageMenuItem"
id=
"open_folder_menuitem"
>
<property
name=
"label"
translatable=
"yes"
>
Open _Folder
</property>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"use_underline"
>
True
</property>
<property
name=
"image"
>
image6
</property>
<property
name=
"use_stock"
>
False
</property>
<property
name=
"always_show_image"
>
True
</property>
</object>
</child>
<child>
<object
class=
"GtkSeparatorMenuItem"
id=
"encryption_separator"
>
<property
name=
"visible"
>
True
</property>
...
...
url_image_preview/url_image_preview.py
View file @
06363073
...
...
@@ -26,7 +26,10 @@ from io import BytesIO
import
shutil
from
functools
import
partial
from
gi.repository
import
Gtk
,
Gdk
,
GLib
,
GdkPixbuf
from
gi.repository
import
Gtk
from
gi.repository
import
Gdk
from
gi.repository
import
GLib
from
gi.repository
import
GdkPixbuf
from
gajim.common
import
app
from
gajim.common
import
helpers
...
...
@@ -39,7 +42,8 @@ from gajim.plugins import GajimPlugin
from
gajim.plugins.helpers
import
log_calls
from
gajim.plugins.plugins_i18n
import
_
from
url_image_preview.http_functions
import
get_http_head
,
get_http_file
from
url_image_preview.http_functions
import
get_http_head
from
url_image_preview.http_functions
import
get_http_file
from
url_image_preview.config_dialog
import
UrlImagePreviewConfigDialog
from
gajim.gtk.filechoosers
import
FileSaveDialog
...
...
@@ -95,7 +99,7 @@ class UrlImagePreviewPlugin(GajimPlugin):
(
self
.
connect_with_history
,
self
.
disconnect_from_history
),
'print_real_text'
:
(
self
.
print_real_text
,
None
),
}
self
.
config_default_values
=
{
'PREVIEW_SIZE'
:
(
150
,
'Preview size
(10-512
)'
),
'PREVIEW_SIZE'
:
(
150
,
'Preview size
(100-1000
)'
),
'MAX_FILE_SIZE'
:
(
5242880
,
'Max file size for image preview'
),
'ALLOW_ALL_IMAGES'
:
(
False
,
''
),
'LEFTCLICK_ACTION'
:
(
'open_menuitem'
,
'Open'
),
...
...
@@ -599,6 +603,7 @@ class Base(object):
open_menuitem
=
xml
.
get_object
(
'open_menuitem'
)
save_as_menuitem
=
xml
.
get_object
(
'save_as_menuitem'
)
open_folder_menuitem
=
xml
.
get_object
(
'open_folder_menuitem'
)
copy_link_location_menuitem
=
\
xml
.
get_object
(
'copy_link_location_menuitem'
)
open_link_in_browser_menuitem
=
\
...
...
@@ -621,6 +626,9 @@ class Base(object):
id_
=
save_as_menuitem
.
connect
(
'activate'
,
self
.
on_save_as_menuitem_activate_new
,
data
)
self
.
handlers
[
id_
]
=
save_as_menuitem
id_
=
open_folder_menuitem
.
connect
(
'activate'
,
self
.
_on_open_folder_menuitem_activate
,
data
)
self
.
handlers
[
id_
]
=
save_as_menuitem
id_
=
copy_link_location_menuitem
.
connect
(
'activate'
,
self
.
on_copy_link_location_menuitem_activate
,
data
)
self
.
handlers
[
id_
]
=
copy_link_location_menuitem
...
...
@@ -661,6 +669,9 @@ class Base(object):
file_name
=
original_filename
,
transient_for
=
app
.
app
.
get_active_window
())
def
_on_open_folder_menuitem_activate
(
self
,
menu
,
data
):
helpers
.
launch_file_manager
(
self
.
directory
)
def
on_copy_link_location_menuitem_activate
(
self
,
menu
,
data
):
url
=
data
[
"url"
]
clipboard
=
Gtk
.
Clipboard
.
get
(
Gdk
.
SELECTION_CLIPBOARD
)
...
...
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