diff options
| author | jvoisin | 2018-07-18 23:20:51 +0200 |
|---|---|---|
| committer | jvoisin | 2018-07-18 23:20:51 +0200 |
| commit | 2f670651cf9307a1d8ae7b4cb83a8f2d03ad0ef7 (patch) | |
| tree | e419999502ff2a7e53dda7469a86efd3059b081b | |
| parent | 0cd510938a867661e243a60e61f2aba7998b50d8 (diff) | |
Minor cleanup of the Nautilus extension's code
| -rw-r--r-- | nautilus/nautilus_mat2.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/nautilus/nautilus_mat2.py b/nautilus/nautilus_mat2.py index 9be9438..48f2261 100644 --- a/nautilus/nautilus_mat2.py +++ b/nautilus/nautilus_mat2.py | |||
| @@ -1,13 +1,13 @@ | |||
| 1 | #!/usr/bin/env python3 | 1 | #!/usr/bin/env python3 |
| 2 | 2 | ||
| 3 | import os | ||
| 4 | from urllib.parse import unquote | ||
| 5 | |||
| 3 | import gi | 6 | import gi |
| 4 | gi.require_version('Nautilus', '3.0') | 7 | gi.require_version('Nautilus', '3.0') |
| 5 | gi.require_version('Gtk', '3.0') | 8 | gi.require_version('Gtk', '3.0') |
| 6 | from gi.repository import Nautilus, GObject, Gtk, Gio | 9 | from gi.repository import Nautilus, GObject, Gtk, Gio |
| 7 | from urllib.parse import unquote | ||
| 8 | import mimetypes | ||
| 9 | 10 | ||
| 10 | import os | ||
| 11 | 11 | ||
| 12 | from libmat2 import parser_factory | 12 | from libmat2 import parser_factory |
| 13 | 13 | ||
| @@ -34,7 +34,7 @@ class StatusWindow(Gtk.Window): | |||
| 34 | hb.pack_start(cancel) | 34 | hb.pack_start(cancel) |
| 35 | 35 | ||
| 36 | self.remove = Gtk.Button("Remove") | 36 | self.remove = Gtk.Button("Remove") |
| 37 | self.remove.get_style_context().add_class(Gtk.STYLE_CLASS_SUGGESTED_ACTION); | 37 | self.remove.get_style_context().add_class(Gtk.STYLE_CLASS_SUGGESTED_ACTION) |
| 38 | self.remove.connect("clicked", self.remove_btn) | 38 | self.remove.connect("clicked", self.remove_btn) |
| 39 | hb.pack_end(self.remove) | 39 | hb.pack_end(self.remove) |
| 40 | 40 | ||
| @@ -52,7 +52,7 @@ class StatusWindow(Gtk.Window): | |||
| 52 | hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) | 52 | hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) |
| 53 | row.add(hbox) | 53 | row.add(hbox) |
| 54 | 54 | ||
| 55 | icon = Gio.content_type_get_icon ('text/plain' if not mtype else mtype) | 55 | icon = Gio.content_type_get_icon('text/plain' if not mtype else mtype) |
| 56 | select_image = Gtk.Image.new_from_gicon(icon, Gtk.IconSize.BUTTON) | 56 | select_image = Gtk.Image.new_from_gicon(icon, Gtk.IconSize.BUTTON) |
| 57 | hbox.pack_start(select_image, False, False, 0) | 57 | hbox.pack_start(select_image, False, False, 0) |
| 58 | 58 | ||
| @@ -106,7 +106,7 @@ class StatusWindow(Gtk.Window): | |||
| 106 | def remove_btn(self, button): | 106 | def remove_btn(self, button): |
| 107 | failed = [] | 107 | failed = [] |
| 108 | for i in self.items: | 108 | for i in self.items: |
| 109 | p, mtype = parser_factory.get_parser(i) | 109 | p, _ = parser_factory.get_parser(i) |
| 110 | if p is not None and p.remove_all(): | 110 | if p is not None and p.remove_all(): |
| 111 | continue | 111 | continue |
| 112 | failed.append(i) | 112 | failed.append(i) |
