[meld] PEP8-ify meldapp



commit 7fe626b6f3bbb723910032397ab03e2332a458bf
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Jan 6 07:18:33 2013 +1000

    PEP8-ify meldapp

 meld/meldapp.py |   67 +++++++++++++++++++++++++++++++-----------------------
 1 files changed, 38 insertions(+), 29 deletions(-)
---
diff --git a/meld/meldapp.py b/meld/meldapp.py
index 8974d07..072b74d 100644
--- a/meld/meldapp.py
+++ b/meld/meldapp.py
@@ -1,20 +1,20 @@
-### Copyright (C) 2002-2006 Stephen Kennedy <stevek gnome org>
-### Copyright (C) 2010-2011 Kai Willadsen <kai willadsen gmail com>
+# Copyright (C) 2002-2006 Stephen Kennedy <stevek gnome org>
+# Copyright (C) 2010-2012 Kai Willadsen <kai willadsen gmail com>
 
-### This program is free software; you can redistribute it and/or modify
-### it under the terms of the GNU General Public License as published by
-### the Free Software Foundation; either version 2 of the License, or
-### (at your option) any later version.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
 
-### This program is distributed in the hope that it will be useful,
-### but WITHOUT ANY WARRANTY; without even the implied warranty of
-### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-### GNU General Public License for more details.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
 
-### You should have received a copy of the GNU General Public License
-### along with this program; if not, write to the Free Software
-### Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
-### USA.
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
 
 from __future__ import print_function
 
@@ -38,8 +38,10 @@ version = "1.7.0"
 class MeldApp(gobject.GObject):
 
     __gsignals__ = {
-        'file-filters-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()),
-        'text-filters-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()),
+        'file-filters-changed': (gobject.SIGNAL_RUN_FIRST,
+                                 gobject.TYPE_NONE, ()),
+        'text-filters-changed': (gobject.SIGNAL_RUN_FIRST,
+                                 gobject.TYPE_NONE, ()),
     }
 
     def __init__(self):
@@ -95,12 +97,17 @@ class MeldApp(gobject.GObject):
 
     def parse_args(self, rawargs):
         usages = [("", _("Start with an empty window")),
-                  ("<%s|%s>" % (_("file"), _("dir")), _("Start a version control comparison")),
-                  ("<%s> <%s> [<%s>]" % ((_("file"),) * 3), _("Start a 2- or 3-way file comparison")),
-                  ("<%s> <%s> [<%s>]" % ((_("dir"),) * 3), _("Start a 2- or 3-way directory comparison")),
-                  ("<%s> <%s>" % (_("file"), _("dir")), _("Start a comparison between file and dir/file"))]
+                  ("<%s|%s>" % (_("file"), _("dir")),
+                   _("Start a version control comparison")),
+                  ("<%s> <%s> [<%s>]" % ((_("file"),) * 3),
+                   _("Start a 2- or 3-way file comparison")),
+                  ("<%s> <%s> [<%s>]" % ((_("dir"),) * 3),
+                   _("Start a 2- or 3-way directory comparison")),
+                  ("<%s> <%s>" % (_("file"), _("dir")),
+                   _("Start a comparison between file and dir/file"))]
         pad_args_fmt = "%-" + str(max([len(s[0]) for s in usages])) + "s %s"
-        usage = "\n" + "\n".join(["  %prog " + pad_args_fmt % u for u in usages])
+        usage_lines = ["  %prog " + pad_args_fmt % u for u in usages]
+        usage = "\n" + "\n".join(usage_lines)
 
         parser = optparse.OptionParser(
             usage=usage,
@@ -110,24 +117,26 @@ class MeldApp(gobject.GObject):
             help=_("Set label to use instead of file name"))
         parser.add_option("-n", "--newtab", action="store_true", default=False,
             help=_("Open a new tab in an already running instance"))
-        parser.add_option("-a", "--auto-compare", action="store_true", default=False,
+        parser.add_option("-a", "--auto-compare", action="store_true",
+            default=False,
             help=_("Automatically compare all differing files on startup"))
         parser.add_option("-u", "--unified", action="store_true",
                           help=_("Ignored for compatibility"))
         parser.add_option("-o", "--output", action="store", type="string",
             dest="outfile", default=None,
             help=_("Set the target file for saving a merge result"))
-        parser.add_option("--auto-merge", None, action="store_true", default=False,
-            help=_("Automatically merge files"))
+        parser.add_option("--auto-merge", None, action="store_true",
+            default=False, help=_("Automatically merge files"))
         parser.add_option("", "--comparison-file", action="store",
             type="string", dest="comparison_file", default=None,
             help=_("Load a saved comparison from a Meld comparison file"))
-        parser.add_option("", "--diff", action="callback", callback=self.diff_files_callback,
-                          dest="diff", default=[],
-                          help=_("Creates a diff tab for up to 3 supplied files or directories."))
+        parser.add_option("", "--diff", action="callback",
+            callback=self.diff_files_callback, dest="diff", default=[],
+            help=_("Create a diff tab for the supplied files or folders"))
         options, args = parser.parse_args(rawargs)
         if len(args) > 3:
-            parser.error(_("too many arguments (wanted 0-3, got %d)") % len(args))
+            parser.error(_("too many arguments (wanted 0-3, got %d)") % \
+                         len(args))
         elif options.auto_merge and len(args) < 3:
             parser.error(_("can't auto-merge less than 3 files"))
         elif options.auto_merge and any([os.path.isdir(f) for f in args]):
@@ -185,7 +194,7 @@ handler.setFormatter(formatter)
 log.addHandler(handler)
 
 app = MeldApp()
+dbus_app = None
 
 from . import filediff
 from . import meldwindow
-



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]