gget r41 - in trunk: data gget
- From: johans svn gnome org
- To: svn-commits-list gnome org
- Subject: gget r41 - in trunk: data gget
- Date: Wed, 30 Jul 2008 15:07:44 +0000 (UTC)
Author: johans
Date: Wed Jul 30 15:07:44 2008
New Revision: 41
URL: http://svn.gnome.org/viewvc/gget?rev=41&view=rev
Log:
Extended the DBus interface with alot of methods. Should contain pretty much everything needed now.
Modified:
trunk/data/gget.glade
trunk/gget/AddDownloadDialog.py
trunk/gget/DBusService.py
trunk/gget/Download.py
trunk/gget/DownloadList.py
trunk/gget/DownloadManager.py
trunk/gget/Main.py
trunk/gget/MainWindow.py
Modified: trunk/data/gget.glade
==============================================================================
--- trunk/data/gget.glade (original)
+++ trunk/data/gget.glade Wed Jul 30 15:07:44 2008
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.5 on Mon Jul 28 10:43:15 2008 -->
+<!--Generated with glade3 3.4.5 on Tue Jul 29 17:08:08 2008 -->
<glade-interface>
<widget class="GtkWindow" id="main_window">
<property name="width_request">800</property>
@@ -382,25 +382,16 @@
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<child>
- <widget class="GtkLabel" id="label3">
- <property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">_URI:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">uri_entry</property>
- </widget>
- <packing>
- <property name="x_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <widget class="GtkEntry" id="uri_entry">
+ <widget class="GtkFileChooserButton" id="download_filechooserbutton">
<property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
+ <property name="title" translatable="yes">Select download folder</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
</packing>
</child>
<child>
@@ -418,16 +409,25 @@
</packing>
</child>
<child>
- <widget class="GtkFileChooserButton" id="download_filechooserbutton">
+ <widget class="GtkEntry" id="uri_entry">
<property name="visible">True</property>
- <property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
- <property name="title" translatable="yes">Select download folder</property>
+ <property name="can_focus">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">_URI:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">uri_entry</property>
+ </widget>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
</packing>
</child>
</widget>
@@ -469,7 +469,7 @@
<property name="receives_default">True</property>
<property name="label" translatable="yes">gtk-add</property>
<property name="use_stock">True</property>
- <property name="response_id">0</property>
+ <property name="response_id">1</property>
</widget>
<packing>
<property name="position">1</property>
@@ -1188,89 +1188,83 @@
<property name="column_spacing">6</property>
<property name="row_spacing">6</property>
<child>
- <widget class="GtkAlignment" id="alignment4">
+ <widget class="GtkLabel" id="label8">
<property name="visible">True</property>
- <property name="bottom_padding">18</property>
- <child>
- <widget class="GtkLabel" id="uri_label">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- </widget>
- </child>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes"><b>Name:</b></property>
+ <property name="use_markup">True</property>
</widget>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="GtkAlignment" id="alignment3">
+ <widget class="GtkLabel" id="label9">
<property name="visible">True</property>
- <property name="top_padding">18</property>
- <child>
- <widget class="GtkLabel" id="date_started_label">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- </widget>
- </child>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes"><b>Folder:</b></property>
+ <property name="use_markup">True</property>
</widget>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">6</property>
- <property name="bottom_attach">7</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="GtkAlignment" id="alignment2">
+ <widget class="GtkLabel" id="label10">
<property name="visible">True</property>
- <property name="top_padding">18</property>
- <child>
- <widget class="GtkLabel" id="label13">
- <property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes"><b>Date started:</b></property>
- <property name="use_markup">True</property>
- </widget>
- </child>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes"><b>Current size:</b></property>
+ <property name="use_markup">True</property>
</widget>
<packing>
- <property name="top_attach">6</property>
- <property name="bottom_attach">7</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="GtkAlignment" id="alignment1">
+ <widget class="GtkLabel" id="label11">
<property name="visible">True</property>
- <property name="bottom_padding">18</property>
- <child>
- <widget class="GtkLabel" id="label7">
- <property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes"><b>URI:</b></property>
- <property name="use_markup">True</property>
- </widget>
- </child>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes"><b>Total size:</b></property>
+ <property name="use_markup">True</property>
</widget>
<packing>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="date_completed_label">
+ <widget class="GtkLabel" id="label12">
<property name="visible">True</property>
- <property name="xalign">0</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes"><b>MIME-type:</b></property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label14">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes"><b>Date completed:</b></property>
+ <property name="use_markup">True</property>
</widget>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="x_options">GTK_FILL</property>
@@ -1278,29 +1272,29 @@
</packing>
</child>
<child>
- <widget class="GtkLabel" id="mime_type_label">
+ <widget class="GtkLabel" id="name_label">
<property name="visible">True</property>
<property name="xalign">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="total_size_label">
+ <widget class="GtkLabel" id="folder_label">
<property name="visible">True</property>
<property name="xalign">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
@@ -1320,41 +1314,41 @@
</packing>
</child>
<child>
- <widget class="GtkLabel" id="folder_label">
+ <widget class="GtkLabel" id="total_size_label">
<property name="visible">True</property>
<property name="xalign">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="name_label">
+ <widget class="GtkLabel" id="mime_type_label">
<property name="visible">True</property>
<property name="xalign">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label14">
+ <widget class="GtkLabel" id="date_completed_label">
<property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes"><b>Date completed:</b></property>
- <property name="use_markup">True</property>
+ <property name="xalign">0</property>
</widget>
<packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="x_options">GTK_FILL</property>
@@ -1362,71 +1356,77 @@
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label12">
- <property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes"><b>MIME-type:</b></property>
- <property name="use_markup">True</property>
- </widget>
- <packing>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="label11">
+ <widget class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes"><b>Total size:</b></property>
- <property name="use_markup">True</property>
+ <property name="bottom_padding">18</property>
+ <child>
+ <widget class="GtkLabel" id="label7">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes"><b>URI:</b></property>
+ <property name="use_markup">True</property>
+ </widget>
+ </child>
</widget>
<packing>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label10">
+ <widget class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes"><b>Current size:</b></property>
- <property name="use_markup">True</property>
+ <property name="top_padding">18</property>
+ <child>
+ <widget class="GtkLabel" id="label13">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes"><b>Date started:</b></property>
+ <property name="use_markup">True</property>
+ </widget>
+ </child>
</widget>
<packing>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label9">
+ <widget class="GtkAlignment" id="alignment3">
<property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes"><b>Folder:</b></property>
- <property name="use_markup">True</property>
+ <property name="top_padding">18</property>
+ <child>
+ <widget class="GtkLabel" id="date_started_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ </widget>
+ </child>
</widget>
<packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label8">
+ <widget class="GtkAlignment" id="alignment4">
<property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes"><b>Name:</b></property>
- <property name="use_markup">True</property>
+ <property name="bottom_padding">18</property>
+ <child>
+ <widget class="GtkLabel" id="uri_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ </widget>
+ </child>
</widget>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
Modified: trunk/gget/AddDownloadDialog.py
==============================================================================
--- trunk/gget/AddDownloadDialog.py (original)
+++ trunk/gget/AddDownloadDialog.py Wed Jul 30 15:07:44 2008
@@ -52,6 +52,8 @@
folder = self.config.default_folder
self.download_filechooserbutton.set_current_folder(folder)
+ self.download = None
+
def __get_widgets(self):
xml = gtk.glade.XML(GUI.glade_file, domain=NAME.lower())
@@ -89,7 +91,7 @@
def __add_button_clicked(self, button):
download_list = DownloadList()
- download_list.add_download(self.uri_entry.get_text(),
+ self.download = download_list.add_download(self.uri_entry.get_text(),
self.download_filechooserbutton.get_current_folder())
self.clipboard.disconnect(self.owner_change_id)
Modified: trunk/gget/DBusService.py
==============================================================================
--- trunk/gget/DBusService.py (original)
+++ trunk/gget/DBusService.py Wed Jul 30 15:07:44 2008
@@ -18,11 +18,12 @@
# along with gget; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-import os
+import gtk.gdk
+import AddDownloadDialog
+import Download
import GUI
import Utils
-import AddDownloadDialog
from Configuration import Configuration
from gget import NAME
@@ -89,33 +90,116 @@
self.download_list.connect("download-removed", self.__download_removed)
def __download_added(self, download_list, download):
- self.DownloadAdded(download.uri, download.path)
+ self.DownloadAdded(download.id)
def __download_removed(self, download_list, download):
- self.DownloadRemoved(download.uri)
+ self.DownloadRemoved(download.id)
- @dbus.service.signal(INTERFACE, signature='ss')
- def DownloadAdded(self, uri, path):
+ # Signals
+
+ @dbus.service.signal(INTERFACE, signature='s')
+ def DownloadAdded(self, id):
Utils.debug_print("Emitted DBus DownloadAdded signal.")
- pass
@dbus.service.signal(INTERFACE, signature='s')
- def DownloadRemoved(self, uri):
+ def DownloadRemoved(self, id):
Utils.debug_print("Emitted DBus DownloadRemoved signal.")
- pass
- @dbus.service.signal(INTERFACE, signature='s')
- def DownloadStatusChanged(self, status):
+ @dbus.service.signal(INTERFACE, signature='ss')
+ def DownloadStatusChanged(self, id, status):
Utils.debug_print("Emitted DBus DownloadStatusChanged signal.")
- pass
- @dbus.service.method(INTERFACE, in_signature='ss', out_signature='')
- def AddDownload(self, uri, path=os.getcwd()):
+ # Methods
+
+ @dbus.service.method(INTERFACE, in_signature='', out_signature='')
+ def Quit(self):
+ Utils.debug_print("DBus Quit method was invoked.")
+ self.main_window.quit()
+
+ @dbus.service.method(INTERFACE, in_signature='', out_signature='')
+ def Present(self):
+ Utils.debug_print("DBus Present method was invoked.")
+ self.main_window.window.present()
+
+ @dbus.service.method(INTERFACE, in_signature='', out_signature='')
+ def Hide(self):
+ Utils.debug_print("DBus Hide method was invoked.")
+ self.main_window.window.hide()
+
+ @dbus.service.method(INTERFACE, in_signature='ss', out_signature='s')
+ def AddDownload(self, uri, path):
Utils.debug_print("DBus AddDownload method was invoked.")
+ r = ""
if self.config.ask_for_location:
+ gtk.gdk.threads_enter()
add = AddDownloadDialog.AddDownloadDialog(uri)
- add.dialog.show()
+ if add.dialog.run() == 1:
+ download = add.download
+ if download:
+ r = download.id
+ gtk.gdk.threads_leave()
else:
- self.download_list.add_download(uri, path)
+ download = self.download_list.add_download(uri, path)
+ r = download.id
+ return r
+
+ @dbus.service.method(INTERFACE, in_signature='s', out_signature='b')
+ def RemoveDownload(self, id):
+ Utils.debug_print("DBus RemoveDownload method was invoked.")
+ download = self.download_list.get_download(id)
+ if download:
+ self.download_list.remove_download(download)
+ return True
+ return False
+
+ @dbus.service.method(INTERFACE, in_signature='', out_signature='')
+ def RemoveCompletedDownloads(self):
+ Utils.debug_print("DBus RemoveCompletedDownloads method was invoked.")
+ self.download_list.remove_completed_downloads()
+
+ @dbus.service.method(INTERFACE, in_signature='', out_signature='as')
+ def ListDownloads(self):
+ Utils.debug_print("DBus RemoveDownload method was invoked.")
+ r = []
+ for download in self.download_list.downloads:
+ r.append(download.id)
+ return r
+
+ @dbus.service.method(INTERFACE, in_signature='s', out_signature='b')
+ def PauseDownload(self, id):
+ Utils.debug_print("DBus PauseDownload method was invoked.")
+ download = self.download_list.get_download(id)
+ if download:
+ return download.pause()
+
+ @dbus.service.method(INTERFACE, in_signature='s', out_signature='b')
+ def ResumeDownload(self, id):
+ Utils.debug_print("DBus ResumeDownload method was invoked.")
+ download = self.download_list.get_download(id)
+ if download:
+ return download.resume()
+
+ @dbus.service.method(INTERFACE, in_signature='s', out_signature='b')
+ def CancelDownload(self, id):
+ Utils.debug_print("DBus CancelDownload method was invoked.")
+ download = self.download_list.get_download(id)
+ if download:
+ return download.cancel()
+
+ @dbus.service.method(INTERFACE, in_signature='s', out_signature='a{ss}')
+ def GetDownloadInformation(self, id):
+ Utils.debug_print("DBus GetDownloadInformation method was invoked.")
+ r = {}
+ download = self.download_list.get_download(id)
+ if download:
+ r["uri"] = download.uri
+ r["path"] = download.path
+ r["file"] = download.file_name
+ r["status"] = Download.STATUS_STRINGS[download.status]
+ r["mime-type"] = download.mime_type
+ r["total size"] = str(download.total_size)
+ r["date started"] = download.get_date_str("started")
+ r["date completed"] = download.get_date_str("completed")
+ return r
# vim: set sw=4 et sts=4 tw=79 fo+=l:
Modified: trunk/gget/Download.py
==============================================================================
--- trunk/gget/Download.py (original)
+++ trunk/gget/Download.py Wed Jul 30 15:07:44 2008
@@ -42,6 +42,8 @@
COMPLETED = 4
ERROR = 5
+# Need this to be able to get an untranslated status message. Would be nice if
+# get_status_string could be used, but doesn't seem like gettext can do that.
STATUS_STRINGS = {CONNECTING: "Connecting",
DOWNLOADING: "Downloading",
CANCELED: "Canceled",
@@ -108,11 +110,18 @@
self.date_completed = datetime.datetime.strptime(date_completed,
"%Y-%m-%d %H:%M:%S")
+ self.id = self.date_started.strftime("%Y%m%d%H%M%S")
+
self.connect("status-changed", self.__status_changed)
def __str__(self):
return self.uri
+ def __cmp__(self, other):
+ if self.id == other.id:
+ return 0
+ return -1
+
def __get_current_size(self):
try:
file_info = gnomevfs.get_file_info(self.file)
@@ -129,12 +138,12 @@
else:
return ""
- def cancel(self):
+ def is_canceled(self):
"""Callback which returns True to cancel the download, False
otherwise."""
return self.canceled
- def pause(self):
+ def is_paused(self):
"""Callback which returns True to pause the download and False to
continue/resume."""
return self.paused
@@ -177,34 +186,52 @@
self.bit_rate = bit_rate
self.emit("bitrate", bit_rate)
- def set_canceled(self, canceled):
+ def cancel(self):
+ """Tries to cancel this download. Returns True if sucessful, else
+ False."""
+ return self.__set_canceled(True)
+
+ def __set_canceled(self, canceled):
if canceled:
if not (self.status != CONNECTING or self.status != DOWNLOADING or \
self.status != ERROR):
- return
+ return False
self.canceled = canceled
if canceled:
self.set_status(CANCELED)
else:
self.set_status(DOWNLOADING)
+ return True
+
+ def pause(self):
+ """Tries to pause this download. Returns True if sucessful, else
+ False."""
+ return self.__set_paused(True)
+
+ def resume(self):
+ """Tries to resume this download. Returns True if sucessful, else
+ False."""
+ return self.__set_paused(False)
- def set_paused(self, paused):
+ def __set_paused(self, paused):
if paused:
if not (self.status != CONNECTING or self.status != DOWNLOADING):
- return
+ return False
self.paused = paused
if paused:
self.set_status(PAUSED)
else:
self.set_status(DOWNLOADING)
+ return True
def set_status(self, status):
self.status = status
Utils.debug_print("Download status for %s changed to: %s (%s)" % (self,
self.get_status_string(), status))
- self.dbus_service.gget_object.DownloadStatusChanged(STATUS_STRINGS[status])
+ self.dbus_service.gget_object.DownloadStatusChanged(self.id,
+ STATUS_STRINGS[status])
self.emit("status-changed", status)
def get_status_string(self):
Modified: trunk/gget/DownloadList.py
==============================================================================
--- trunk/gget/DownloadList.py (original)
+++ trunk/gget/DownloadList.py Wed Jul 30 15:07:44 2008
@@ -95,6 +95,7 @@
download = Download.Download(uri, path)
self.__append_download(download)
self.__add_download_to_xml(download)
+ return download
def __append_download(self, download):
"""Connects to the download signals we are interested in before adding
@@ -162,6 +163,13 @@
return download_element
return None
+ def get_download(self, id):
+ """Returns the download object in the list with the given id."""
+ for download in self.downloads:
+ if id == download.id:
+ return download
+ return None
+
def remove_download(self, download):
"""Removes a download object from the list and xml tree."""
self.downloads.remove(download)
Modified: trunk/gget/DownloadManager.py
==============================================================================
--- trunk/gget/DownloadManager.py (original)
+++ trunk/gget/DownloadManager.py Wed Jul 30 15:07:44 2008
@@ -123,8 +123,8 @@
result = metalink.get(download.uri, download.path,
handlers={"status": download.update,
"bitrate": download.bitrate,
- "cancel": download.cancel,
- "pause": download.pause})
+ "cancel": download.is_canceled,
+ "pause": download.is_paused})
if not result:
download.set_status(Download.ERROR)
Modified: trunk/gget/Main.py
==============================================================================
--- trunk/gget/Main.py (original)
+++ trunk/gget/Main.py Wed Jul 30 15:07:44 2008
@@ -75,6 +75,7 @@
return 0
main_window = MainWindow(config, download_list)
+ dbus_service.gget_object.main_window = main_window
if config.show_main_window:
main_window.window.show()
Modified: trunk/gget/MainWindow.py
==============================================================================
--- trunk/gget/MainWindow.py (original)
+++ trunk/gget/MainWindow.py Wed Jul 30 15:07:44 2008
@@ -601,13 +601,16 @@
downloads = GUI.get_selected_values(self.downloads_treeview)
if downloads:
for download in downloads:
- download.set_paused(pause)
+ if pause:
+ download.pause()
+ else:
+ download.resume()
def __cancel_selected_downloads(self, widget):
"""Cancels the selected download in DownloadList."""
downloads = GUI.get_selected_values(self.downloads_treeview)
for download in downloads:
- download.set_canceled(True)
+ download.cancel()
def __remove_selected_downloads(self, widget):
"""Removes the selected download from DownloadList."""
@@ -636,7 +639,7 @@
if downloads:
DetailsDialog(downloads[0])
- def quit(self, widget):
+ def quit(self, widget=None):
"""Quits the application. Called from various places."""
# TODO: Shutdown gracefully
gtk.main_quit()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]