[alacarte] alacarte: Simplify the runner script



commit fde7f5852ef85328880e676367ef0a684a33954e
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Jan 11 13:02:28 2013 -0500

    alacarte: Simplify the runner script
    
    Make it simply call out to a main function in another module and
    not much else.

 Alacarte/MainWindow.py |   17 +++++++++++++----
 alacarte.in            |   21 +--------------------
 2 files changed, 14 insertions(+), 24 deletions(-)
---
diff --git a/Alacarte/MainWindow.py b/Alacarte/MainWindow.py
index e4418f0..a15f65a 100644
--- a/Alacarte/MainWindow.py
+++ b/Alacarte/MainWindow.py
@@ -18,6 +18,7 @@
 #   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 from gi.repository import Gtk, GObject, Gio, GdkPixbuf, Gdk, GMenu, GLib
+import sys
 import cgi
 import os
 import gettext
@@ -34,13 +35,11 @@ from Alacarte.ItemEditor import LauncherEditor, DirectoryEditor
 from Alacarte import util
 
 class MainWindow(object):
-    def __init__(self, datadir, version):
-        self.file_path = datadir
-        self.version = version
+    def __init__(self):
         Gtk.Window.set_default_icon_name('alacarte')
         self.tree = Gtk.Builder()
         self.tree.set_translation_domain(config.GETTEXT_PACKAGE)
-        self.tree.add_from_file(os.path.join(self.file_path, 'alacarte.ui'))
+        self.tree.add_from_file(os.path.join(config.pkgdatadir, 'alacarte.ui'))
         self.tree.connect_signals(self)
         self.setupMenuTree()
         self.setupItemTree()
@@ -437,3 +436,13 @@ class MainWindow(object):
 
     def quit(self):
         Gtk.main_quit()
+
+def main():
+    if len(sys.argv) > 1:
+        basename = sys.argv[1]
+    else:
+        basename = None
+
+    app = MainWindow()
+    app.setMenuBasename(basename)
+    app.run()
diff --git a/alacarte.in b/alacarte.in
index a00469a..06eba6b 100644
--- a/alacarte.in
+++ b/alacarte.in
@@ -18,26 +18,7 @@
 #   License along with this library; if not, write to the Free Software
 #   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-import sys
-from Alacarte.MainWindow import MainWindow
-
-def get_menu_basename():
-    if len(sys.argv) > 1:
-        return sys.argv[1]
-    else:
-        return None
-
-def main():
-    try:
-        from Alacarte import config
-        datadir = config.pkgdatadir
-        version = config.VERSION
-    except ImportError:
-        datadir = '.'
-        version = '0.9'
-    app = MainWindow(datadir, version)
-    app.setMenuBasename(get_menu_basename())
-    app.run()
+from Alacarte.MainWindow import main
 
 if __name__ == '__main__':
     main()



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