[meld] Move main method into starter script
- From: Kai Willadsen <kaiw src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [meld] Move main method into starter script
- Date: Sat, 10 Oct 2009 22:04:43 +0000 (UTC)
commit c46c962264e579f632727166bb447a14f6b1a5bd
Author: Kai Willadsen <kai willadsen gmail com>
Date: Thu Jul 9 10:35:50 2009 +1000
Move main method into starter script
bin/meld | 25 +++++++++++++++++++------
meld/meldapp.py | 21 ---------------------
2 files changed, 19 insertions(+), 27 deletions(-)
---
diff --git a/bin/meld b/bin/meld
index 98c868c..17ff6e9 100755
--- a/bin/meld
+++ b/bin/meld
@@ -19,6 +19,17 @@
import os
import sys
+# Disable buffering of stdout
+class Unbuffered(object):
+ def __init__(self, file):
+ self.file = file
+ def write(self, arg):
+ self.file.write(arg)
+ self.file.flush()
+ def __getattr__(self, attr):
+ return getattr(self.file, attr)
+sys.stdout = Unbuffered(sys.stdout)
+
# Use pychecker if requested
if "--pychecker" in sys.argv:
sys.argv.remove("--pychecker")
@@ -97,14 +108,16 @@ except ImportError, e:
gtk.glade.bindtextdomain("meld", meld.paths.locale_dir())
gtk.glade.textdomain("meld")
+gtk.icon_theme_get_default().append_search_path(meld.paths.icon_dir())
-#
-# main
-#
-import meld.meldapp
+def main():
+ import meld.meldapp
+ app = meld.meldapp.MeldApp()
+ app.parse_args(sys.argv[1:])
+ gtk.main()
if profiling:
import profile
- profile.run("meld.meldapp.main()")
+ profile.run("main()")
else:
- meld.meldapp.main()
+ main()
diff --git a/meld/meldapp.py b/meld/meldapp.py
index 5babcb3..35b23f2 100644
--- a/meld/meldapp.py
+++ b/meld/meldapp.py
@@ -899,24 +899,3 @@ class MeldApp(gnomeglade.Component):
tab = self.append_diff(paths, auto_compare)
return tab
-
-################################################################################
-#
-# Main
-#
-################################################################################
-def main():
- class Unbuffered(object):
- def __init__(self, file):
- self.file = file
- def write(self, arg):
- self.file.write(arg)
- self.file.flush()
- def __getattr__(self, attr):
- return getattr(self.file, attr)
- sys.stdout = Unbuffered(sys.stdout)
-
- gtk.icon_theme_get_default().append_search_path(paths.icon_dir())
- app = MeldApp()
- app.parse_args(sys.argv[1:])
- gtk.main()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]