gget r59 - trunk/gget
- From: johans svn gnome org
- To: svn-commits-list gnome org
- Subject: gget r59 - trunk/gget
- Date: Sat, 9 Aug 2008 19:13:12 +0000 (UTC)
Author: johans
Date: Sat Aug 9 19:13:12 2008
New Revision: 59
URL: http://svn.gnome.org/viewvc/gget?rev=59&view=rev
Log:
Modified:
trunk/gget/AboutDialog.py
trunk/gget/AddDownloadDialog.py
trunk/gget/Configuration.py
trunk/gget/DBusService.py
trunk/gget/DetailsDialog.py
trunk/gget/Download.py
trunk/gget/DownloadList.py
trunk/gget/DownloadManager.py
trunk/gget/GUI.py
trunk/gget/Main.py
Modified: trunk/gget/AboutDialog.py
==============================================================================
--- trunk/gget/AboutDialog.py (original)
+++ trunk/gget/AboutDialog.py Sat Aug 9 19:13:12 2008
@@ -2,20 +2,20 @@
# Copyright (C) 2008 Johan Svedberg <johan svedberg com>
-# This file is part of gget.
+# This file is part of GGet.
-# gget is free software; you can redistribute it and/or modify
+# GGet 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.
-# gget is distributed in the hope that it will be useful,
+# GGet 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 gget; if not, write to the Free Software
+# along with GGet; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
from gettext import gettext as _
Modified: trunk/gget/AddDownloadDialog.py
==============================================================================
--- trunk/gget/AddDownloadDialog.py (original)
+++ trunk/gget/AddDownloadDialog.py Sat Aug 9 19:13:12 2008
@@ -2,20 +2,20 @@
# Copyright (C) 2008 Johan Svedberg <johan svedberg com>
-# This file is part of gget.
+# This file is part of GGet.
-# gget is free software; you can redistribute it and/or modify
+# GGet 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.
-# gget is distributed in the hope that it will be useful,
+# GGet 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 gget; if not, write to the Free Software
+# along with GGet; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
from gettext import gettext as _
Modified: trunk/gget/Configuration.py
==============================================================================
--- trunk/gget/Configuration.py (original)
+++ trunk/gget/Configuration.py Sat Aug 9 19:13:12 2008
@@ -2,20 +2,20 @@
# Copyright (C) 2008 Johan Svedberg <johan svedberg com>
-# This file is part of gget.
+# This file is part of GGet.
-# gget is free software; you can redistribute it and/or modify
+# GGet 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.
-# gget is distributed in the hope that it will be useful,
+# GGet 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 gget; if not, write to the Free Software
+# along with GGet; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
import os
Modified: trunk/gget/DBusService.py
==============================================================================
--- trunk/gget/DBusService.py (original)
+++ trunk/gget/DBusService.py Sat Aug 9 19:13:12 2008
@@ -2,20 +2,20 @@
# Copyright (C) 2008 Johan Svedberg <johan svedberg com>
-# This file is part of gget.
+# This file is part of GGet.
-# gget is free software; you can redistribute it and/or modify
+# GGet 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.
-# gget is distributed in the hope that it will be useful,
+# GGet 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 gget; if not, write to the Free Software
+# along with GGet; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
import os.path
Modified: trunk/gget/DetailsDialog.py
==============================================================================
--- trunk/gget/DetailsDialog.py (original)
+++ trunk/gget/DetailsDialog.py Sat Aug 9 19:13:12 2008
@@ -2,20 +2,20 @@
# Copyright (C) 2008 Johan Svedberg <johan svedberg com>
-# This file is part of gget.
+# This file is part of GGet.
-# gget is free software; you can redistribute it and/or modify
+# GGet 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.
-# gget is distributed in the hope that it will be useful,
+# GGet 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 gget; if not, write to the Free Software
+# along with GGet; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
from gettext import gettext as _
Modified: trunk/gget/Download.py
==============================================================================
--- trunk/gget/Download.py (original)
+++ trunk/gget/Download.py Sat Aug 9 19:13:12 2008
@@ -2,20 +2,20 @@
# Copyright (C) 2008 Johan Svedberg <johan svedberg com>
-# This file is part of gget.
+# This file is part of GGet.
-# gget is free software; you can redistribute it and/or modify
+# GGet 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.
-# gget is distributed in the hope that it will be useful,
+# GGet 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 gget; if not, write to the Free Software
+# along with GGet; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
import os.path
Modified: trunk/gget/DownloadList.py
==============================================================================
--- trunk/gget/DownloadList.py (original)
+++ trunk/gget/DownloadList.py Sat Aug 9 19:13:12 2008
@@ -2,20 +2,20 @@
# Copyright (C) 2008 Johan Svedberg <johan svedberg com>
-# This file is part of gget.
+# This file is part of GGet.
-# gget is free software; you can redistribute it and/or modify
+# GGet 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.
-# gget is distributed in the hope that it will be useful,
+# GGet 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 gget; if not, write to the Free Software
+# along with GGet; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
import os.path
Modified: trunk/gget/DownloadManager.py
==============================================================================
--- trunk/gget/DownloadManager.py (original)
+++ trunk/gget/DownloadManager.py Sat Aug 9 19:13:12 2008
@@ -2,20 +2,20 @@
# Copyright (C) 2008 Johan Svedberg <johan svedberg com>
-# This file is part of gget.
+# This file is part of GGet.
-# gget is free software; you can redistribute it and/or modify
+# GGet 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.
-# gget is distributed in the hope that it will be useful,
+# GGet 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 gget; if not, write to the Free Software
+# along with GGet; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
import os.path
Modified: trunk/gget/GUI.py
==============================================================================
--- trunk/gget/GUI.py (original)
+++ trunk/gget/GUI.py Sat Aug 9 19:13:12 2008
@@ -2,20 +2,20 @@
# Copyright (C) 2004-2007 Johan Svedberg <johan svedberg com>
-# This file is part of gget.
+# This file is part of GGet.
-# gget is free software; you can redistribute it and/or modify
+# GGet 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.
-# gget is distributed in the hope that it will be useful,
+# GGet 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 gget; if not, write to the Free Software
+# along with GGet; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
import os.path
Modified: trunk/gget/Main.py
==============================================================================
--- trunk/gget/Main.py (original)
+++ trunk/gget/Main.py Sat Aug 9 19:13:12 2008
@@ -2,20 +2,20 @@
# Copyright (C) 2008 Johan Svedberg <johan svedberg com>
-# This file is part of gget.
+# This file is part of GGet.
-# gget is free software; you can redistribute it and/or modify
+# GGet 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.
-# gget is distributed in the hope that it will be useful,
+# GGet 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 gget; if not, write to the Free Software
+# along with GGet; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
import getopt
@@ -40,72 +40,83 @@
from Configuration import Configuration
from gget import NAME, VERSION, LOCALE_DIR
-def main():
- gettext.bindtextdomain(NAME.lower(), LOCALE_DIR)
- gettext.textdomain(NAME.lower())
-
- locale.bindtextdomain(NAME.lower(), LOCALE_DIR)
- locale.textdomain(NAME.lower())
-
- try:
- opts, args = getopt.getopt(sys.argv[1:], "dh", ["debug", "help"])
- except getopt.GetoptError:
- opts = []
- args = sys.argv[1:]
-
- debug = False
- for o, a in opts:
- if o in ("-d", "--debug"):
- debug = True
- elif o in ("-h", "--help"):
- print_usage()
-
- gnome.init(NAME, VERSION)
- gtk.gdk.threads_init()
- gtk.window_set_default_icon_list(*GUI.get_icon_list([16, 22, 24, 32]))
-
- config = Configuration(debug)
- download_list = DownloadList()
- download_manager = DownloadManager()
+class Application:
+ def run(self):
+ self.__init_i18n()
+ args = self.__get_options()
+
+ gnome.init(NAME, VERSION)
+ gtk.gdk.threads_init()
+ gtk.window_set_default_icon_list(*GUI.get_icon_list([16, 22, 24, 32]))
+
+ self.download_list = DownloadList()
+ self.download_manager = DownloadManager()
+
+ self.dbus_service = DBusService.DBusService()
+ if not self.dbus_service.register():
+ for uri in args:
+ self.dbus_service.download_manager.AddDownload(uri, os.getcwd())
+ return 0
+
+ self.dbus_service.register_object(DBusService.DOWNLOAD_MGR_OBJ_PATH,
+ self.download_list)
+
+ self.main_window = MainWindow(self.config, self.download_list)
+ self.dbus_service.register_object(DBusService.MAIN_WINDOW_OBJ_PATH,
+ self.main_window)
+ if self.config.show_main_window:
+ self.main_window.window.show()
+
+ self.status_icon = TrayIcon(self.main_window)
+ if not self.config.show_status_icon:
+ status_icon.icon.set_visible(False)
- dbus_service = DBusService.DBusService()
- if not dbus_service.register():
- for uri in args:
- dbus_service.download_manager.AddDownload(uri, os.getcwd())
- return 0
+ sys.excepthook = self.main_window.on_unhandled_exception
- dbus_service.register_object(DBusService.DOWNLOAD_MGR_OBJ_PATH,
- download_list)
+ self.download_list.load_from_xml()
- main_window = MainWindow(config, download_list)
- dbus_service.register_object(DBusService.MAIN_WINDOW_OBJ_PATH, main_window)
- if config.show_main_window:
- main_window.window.show()
-
- status_icon = TrayIcon(main_window)
- if not config.show_status_icon:
- status_icon.icon.set_visible(False)
-
- # sys.excepthook = main_window.on_unhandled_exception
-
- download_list.load_from_xml()
-
- for uri in args:
- if config.ask_for_location:
- add = AddDownloadDialog(uri)
- add.dialog.run()
- else:
- download_list.add_download(uri, config.default_folder)
-
- gtk.main()
-
-def print_usage():
- print _("Usage: %s [OPTION]... [URI]...") % (sys.argv[0])
- print ""
- print _("OPTIONS:")
- print " -d, --debug %s" % (_("enable debug messages"))
- print " -h, --help %s" % (_("show this help message and exit"))
+ for uri in args:
+ if self.config.ask_for_location:
+ add = AddDownloadDialog(uri)
+ add.dialog.run()
+ else:
+ self.download_list.add_download(uri, self.config.default_folder)
+
+ gtk.main()
+
+ def __init_i18n(self):
+ gettext.bindtextdomain(NAME.lower(), LOCALE_DIR)
+ gettext.textdomain(NAME.lower())
+
+ locale.bindtextdomain(NAME.lower(), LOCALE_DIR)
+ locale.textdomain(NAME.lower())
+
+ def __get_options(self):
+ """Get command line options."""
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], "dh", ["debug", "help"])
+ except getopt.GetoptError:
+ opts = []
+ args = sys.argv[1:]
+
+ debug = False
+ for o, a in opts:
+ if o in ("-d", "--debug"):
+ debug = True
+ elif o in ("-h", "--help"):
+ self.__print_usage()
+
+ self.config = Configuration(debug)
+ return args
+
+ def __print_usage(self):
+ """Output usage information and exit."""
+ print _("Usage: %s [OPTION]... [URI]...") % (sys.argv[0])
+ print ""
+ print _("OPTIONS:")
+ print " -d, --debug %s" % (_("enable debug messages"))
+ print " -h, --help %s" % (_("show this help message and exit"))
- sys.exit()
+ sys.exit()
# vim: set sw=4 et sts=4 tw=79 fo+=l:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]