[Pkg-privacy-commits] [mat] 35/68: Document and simplify a bit the nautilus extension code

Sascha Steinbiss sascha at steinbiss.name
Sun Jan 3 12:32:41 UTC 2016


This is an automated email from the git hooks/post-receive script.

sascha-guest pushed a commit to branch master
in repository mat.

commit f80612a4abbff2e179fc5006772cf2c3b924323d
Author: jvoisin <julien.voisin at dustri.org>
Date:   Wed Dec 2 18:51:13 2015 +0100

    Document and simplify a bit the nautilus extension code
    
    - Document some methods and the class
    - Simplify a condition
---
 nautilus/nautilus-mat.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/nautilus/nautilus-mat.py b/nautilus/nautilus-mat.py
index c1f25df..938e692 100644
--- a/nautilus/nautilus-mat.py
+++ b/nautilus/nautilus-mat.py
@@ -23,6 +23,7 @@ import libmat.strippers
 
 
 class MatExtension(GObject.GObject, Nautilus.MenuProvider):
+    """ A nautilus extension, acting as a frontend to MAT, to clean metadata."""
     def __init__(self):
         logging.debug("nautilus-mat: initialising")
 
@@ -57,6 +58,7 @@ class MatExtension(GObject.GObject, Nautilus.MenuProvider):
 
     @staticmethod
     def show_message(message, msg_type=Gtk.MessageType.INFO):
+        """ Helper function to show a message in a popup """
         dialog = Gtk.MessageDialog(parent=None,
                                    flags=Gtk.DialogFlags.MODAL,
                                    type=msg_type,
@@ -67,9 +69,11 @@ class MatExtension(GObject.GObject, Nautilus.MenuProvider):
         return ret
 
     def menu_activate_cb(self, menu, current_file):
+        """ Callback function, used to clean the file """
         if file.is_gone():
             return
 
+        # files url in nautilus are starting with 'file://', of length 7
         file_path = urllib.unquote(current_file.get_uri()[7:])
 
         class_file = libmat.mat.create_class_file(file_path,
@@ -78,8 +82,7 @@ class MatExtension(GObject.GObject, Nautilus.MenuProvider):
         if class_file:
             if class_file.is_clean():
                 self.show_message(_("%s is already clean") % file_path)
-            else:
-                if not class_file.remove_all():
-                    self.show_message(_("Unable to clean %s") % file_path, Gtk.MessageType.ERROR)
+            elif not class_file.remove_all():
+                self.show_message(_("Unable to clean %s") % file_path, Gtk.MessageType.ERROR)
         else:
             self.show_message(_("Unable to process %s") % file_path, Gtk.MessageType.ERROR)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/mat.git



More information about the Pkg-privacy-commits mailing list