nicer error handling
This commit is contained in:
parent
1c56e863a8
commit
b996fe1761
|
@ -658,8 +658,8 @@ class Manager:
|
||||||
size = deluge_core.get_torrent_state(unique_ID)["total_size"]
|
size = deluge_core.get_torrent_state(unique_ID)["total_size"]
|
||||||
avail = self.calc_free_space(torrent.save_dir)
|
avail = self.calc_free_space(torrent.save_dir)
|
||||||
print "Torrent Size", size
|
print "Torrent Size", size
|
||||||
print "Available Space", avail
|
# print "Available Space", avail
|
||||||
# size = avail + 1 #debug!
|
size = avail + 1 #debug!
|
||||||
if size > avail: # Not enough free space
|
if size > avail: # Not enough free space
|
||||||
torrent.user_paused = True
|
torrent.user_paused = True
|
||||||
no_space = True
|
no_space = True
|
||||||
|
|
|
@ -774,7 +774,6 @@ class DelugeGTK:
|
||||||
path = dialogs.show_directory_chooser_dialog(self.window)
|
path = dialogs.show_directory_chooser_dialog(self.window)
|
||||||
if path is None:
|
if path is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
unique_id = self.manager.add_torrent(torrent, path, self.config.get('use_compact_storage', bool, default=False))
|
unique_id = self.manager.add_torrent(torrent, path, self.config.get('use_compact_storage', bool, default=False))
|
||||||
|
|
||||||
|
@ -783,9 +782,14 @@ class DelugeGTK:
|
||||||
except core.InvalidEncodingError, e:
|
except core.InvalidEncodingError, e:
|
||||||
print "InvalidEncodingError", e
|
print "InvalidEncodingError", e
|
||||||
dialogs.show_popup_warning(self.window, _("An error occured while trying to add the torrent. It's possible your .torrent file is corrupted."))
|
dialogs.show_popup_warning(self.window, _("An error occured while trying to add the torrent. It's possible your .torrent file is corrupted."))
|
||||||
except core.InsufficientFreeSpaceError, e:
|
except core.DuplicateTorrentError, e:
|
||||||
|
dialogs.show_popup_warning(self.window, _("The torrent you've added seems to already be in Deluge."))
|
||||||
|
except core.InsufficientFreeSpaceError, e:
|
||||||
nice_need = common.fsize(e.needed_space)
|
nice_need = common.fsize(e.needed_space)
|
||||||
nice_free = common.fsize(e.free_space)
|
nice_free = common.fsize(e.free_space)
|
||||||
|
dialogs.show_popup_warning(self.window, _("There is not enough free disk space to complete your download.") + "\n" + \
|
||||||
|
_("Space Needed:") + " " + nice_need + "\n" + \
|
||||||
|
_("Available Space:") + " " + nice_free)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue