def on_cancel(self): id_item_list = [] # stop all downloads from this host for id_item, download_item in api.get_active_downloads().iteritems(): if download_item.host == self.host and not download_item.start_time: api.stop_download(id_item) for id_item, download_item in api.get_queue_downloads().iteritems(): if download_item.host == self.host: api.stop_download(id_item) id_item_list.append(id_item) # change queue icon to stopped for id_item in id_item_list: row = self.parent.downloads.rows_buffer[id_item] row[1] = self.parent.downloads.icons_dict[cons.STATUS_STOPPED] self.reject()
def on_stop_download(self): rows = self.downloads.get_selected_rows() if rows: for row in rows: items = self.downloads.items id_item = items[row][0] stopped = api.stop_download(id_item) if stopped: if items[row][1] == self.downloads.icons_dict[cons.STATUS_QUEUE]: items[row][1] = self.downloads.icons_dict[cons.STATUS_STOPPED] self.stop[BTN].setEnabled(False) self.start[BTN].setEnabled(True)
def on_stop_download(self): rows = self.downloads.get_selected_rows() if rows: for row in rows: items = self.downloads.items id_item = items[row][0] stopped = api.stop_download(id_item) #return true or false if stopped: if items[row][1] == self.downloads.icons_dict[cons.STATUS_QUEUE]: items[row][1] = self.downloads.icons_dict[cons.STATUS_STOPPED] self.stop[BTN].setEnabled(False) #deshabilitar el boton de stop ya que acaban de detener la descarga. self.start[BTN].setEnabled(True)
def on_stop_download(self): rows = self.downloads.get_selected_rows() if rows: for row in rows: items = self.downloads.items id_item = items[row][0] stopped = api.stop_download(id_item) if stopped: if items[row][1] == self.downloads.icons_dict[ cons.STATUS_QUEUE]: items[row][1] = self.downloads.icons_dict[ cons.STATUS_STOPPED] self.stop[BTN].setEnabled(False) self.start[BTN].setEnabled(True)
def stop_download(self, widget): """ TODO: Desactivar boton stop cuando finaliza la descarga seleccionada. *arreglo temporal Solucion: pasarle el boton de stop a List, y desactivarlo desde get_status, si th.finished == True. TODO: Stop y start deberian ser metodos de list_gui """ model, rows = self.downloads_list_gui.treeView.get_selection().get_selected_rows() #atributo treeView de la clase List if rows: for row in rows: id_item = model[row][0] stopped = api.stop_download(id_item) #return true or false if stopped: if model[row][1] == self.downloads_list_gui.icons_dict[cons.STATUS_QUEUE]: model[row][1] = self.downloads_list_gui.icons_dict[cons.STATUS_STOPPED] self.stop.set_sensitive(False) #deshabilitar el boton de stop ya que acaban de detener la descarga. self.start.set_sensitive(True)
def on_stop_download(self): rows = self.downloads.get_selected_rows() if rows: for row in rows: items = self.downloads.items id_item = items[row][0] stopped = api.stop_download(id_item) #return true or false if stopped: if items[row][1] == self.downloads.icons_dict[ cons.STATUS_QUEUE]: items[row][1] = self.downloads.icons_dict[ cons.STATUS_STOPPED] self.stop[BTN].setEnabled( False ) #deshabilitar el boton de stop ya que acaban de detener la descarga. self.start[BTN].setEnabled(True)