remove advanced progress bar

This commit is contained in:
Marcos Pinto 2007-11-13 20:30:55 +00:00
parent de2f265c2a
commit f7a1db3be7
4 changed files with 488 additions and 516 deletions

File diff suppressed because it is too large Load Diff

View File

@ -433,7 +433,9 @@ static PyObject *torrent_quit(PyObject *self, PyObject *args)
delete M_torrents; delete M_torrents;
printf("core: removing settings...\r\n"); printf("core: removing settings...\r\n");
delete M_settings; delete M_settings;
delete M_ses; session_proxy sp = M_ses->abort();
printf("core: shutting down session...\r\n");
delete M_ses; // 100% CPU...
Py_DECREF(M_constants); Py_DECREF(M_constants);
printf("core shut down.\r\n"); printf("core shut down.\r\n");
@ -927,33 +929,8 @@ static PyObject *torrent_get_torrent_state(PyObject *self, PyObject *args)
total_seeds = s.num_complete != -1? s.num_complete : connected_seeds; total_seeds = s.num_complete != -1? s.num_complete : connected_seeds;
total_peers = s.num_incomplete != -1? s.num_incomplete : connected_peers; total_peers = s.num_incomplete != -1? s.num_incomplete : connected_peers;
// The following section computes the ranges of pieces that have been downloaded
std::vector<int> downloaded_range;
bool range_opened=false;
for (unsigned int i=0; i<=s.pieces->size(); ++i) {
bool downloaded=(i<s.pieces->size() && s.pieces->at(i));
if (!range_opened) {
if (downloaded) {
range_opened=true;
downloaded_range.push_back(i);
}
} else {
if (!downloaded) {
range_opened=false;
downloaded_range.push_back(i-1);
}
}
}
PyObject *pieces_range = PyTuple_New(downloaded_range.size()/2);
for(unsigned long i=0; i<downloaded_range.size(); i+=2)
{
PyObject *rangepos;
rangepos = Py_BuildValue("[i,i]",downloaded_range[i],
downloaded_range[i+1]);
PyTuple_SetItem(pieces_range, i/2, rangepos);
}
return Py_BuildValue("{s:s,s:i,s:i,s:l,s:l,s:f,s:f,s:b,s:f,s:L,s:L,s:s,s:s,s:f,s:L,s:L,s:O,s:i,s:i,s:L,s:L,s:i,s:l,s:l,s:b,s:b,s:L,s:L,s:L}", return Py_BuildValue("{s:s,s:i,s:i,s:l,s:l,s:f,s:f,s:b,s:f,s:L,s:L,s:s,s:s,s:f,s:L,s:L,s:l,s:i,s:i,s:L,s:L,s:i,s:l,s:l,s:b,s:b,s:L,s:L,s:L}",
"name", t.handle.get_torrent_info().name().c_str(), "name", t.handle.get_torrent_info().name().c_str(),
"num_files", t.handle.get_torrent_info().num_files(), "num_files", t.handle.get_torrent_info().num_files(),
"state", s.state, "state", s.state,
@ -970,7 +947,7 @@ static PyObject *torrent_get_torrent_state(PyObject *self, PyObject *args)
"progress", s.progress, "progress", s.progress,
"total_payload_download", s.total_payload_download, "total_payload_download", s.total_payload_download,
"total_payload_upload", s.total_payload_upload, "total_payload_upload", s.total_payload_upload,
"pieces", pieces_range, "pieces", long(s.pieces), // this is really a std::vector<bool>*
"pieces_done", s.num_pieces, "pieces_done", s.num_pieces,
"block_size", s.block_size, "block_size", s.block_size,
"total_size", i.total_size(), "total_size", i.total_size(),

View File

@ -153,7 +153,6 @@ class PreferencesDlg:
self.glade.get_widget("ratio_spinner").set_value(self.preferences.get("auto_seed_ratio")) self.glade.get_widget("ratio_spinner").set_value(self.preferences.get("auto_seed_ratio"))
self.glade.get_widget("chk_dht").set_active(self.preferences.get("enable_dht")) self.glade.get_widget("chk_dht").set_active(self.preferences.get("enable_dht"))
self.glade.get_widget("spin_gui").set_value(self.preferences.get("gui_update_interval")) self.glade.get_widget("spin_gui").set_value(self.preferences.get("gui_update_interval"))
self.glade.get_widget("chk_use_advanced_bar").set_active(self.preferences.get("use_advanced_bar"))
#smart dialog set sensitivities #smart dialog set sensitivities
if(self.preferences.get("use_default_dir")): if(self.preferences.get("use_default_dir")):
@ -268,7 +267,6 @@ class PreferencesDlg:
self.preferences.set("queue_seeds_to_bottom", self.glade.get_widget("chk_seedbottom").get_active()) self.preferences.set("queue_seeds_to_bottom", self.glade.get_widget("chk_seedbottom").get_active())
self.preferences.set("enable_dht", self.glade.get_widget("chk_dht").get_active()) self.preferences.set("enable_dht", self.glade.get_widget("chk_dht").get_active())
self.preferences.set("gui_update_interval", self.glade.get_widget("spin_gui").get_value()) self.preferences.set("gui_update_interval", self.glade.get_widget("spin_gui").get_value())
self.preferences.set("use_advanced_bar", self.glade.get_widget("chk_use_advanced_bar").get_active())
self.preferences.set("clear_max_ratio_torrents", self.glade.get_widget("chk_clear_max_ratio_torrents").get_active()) self.preferences.set("clear_max_ratio_torrents", self.glade.get_widget("chk_clear_max_ratio_torrents").get_active())
self.preferences.set("queue_above_completed", self.glade.get_widget("chk_queue_above_completed").get_active()) self.preferences.set("queue_above_completed", self.glade.get_widget("chk_queue_above_completed").get_active())

View File

@ -146,8 +146,7 @@ if common.windows_check():
"status_width" : 150, "status_width" : 150,
"filename_f_width" : 220, "filename_f_width" : 220,
"size_f_width" : 90, "size_f_width" : 90,
"priority_f_width" : 140, "priority_f_width" : 140
"use_advanced_bar" : False
} }
else: else:
DEFAULT_PREFS = { DEFAULT_PREFS = {
@ -256,8 +255,7 @@ else:
"status_width" : 150, "status_width" : 150,
"filename_f_width" : 220, "filename_f_width" : 220,
"size_f_width" : 90, "size_f_width" : 90,
"priority_f_width" : 140, "priority_f_width" : 140
"use_advanced_bar" : False
} }
class Preferences: class Preferences: