Hi, i am making downloader, and I want to use diferent progressbar for every link (like ff downloader)...

I made treemodel

treemodel = gtk.TreeStore(gtk.gdk.Pixbuf, str, gtk.ProgressBar)

and i put in components with this

def insert_row(self, model, parent, type_image, file, pbar):      
      myiter = model.insert_before(parent,None)
      return myiter

my only problem is how to control progressbars, eg. download has been started for link no.5 and bar no.5 needs to change...


solved, model must be <str> <float>, but float needs to be rendered as gtk.cellRenderProgress()... here is code

def setup_list(self):
      self.list = gtk.ListStore(str, float)
      view = self.wTree.get_widget('treeview1')
      columns = []
      columns.append(gtk.TreeViewColumn("File", gtk.CellRendererText(), text=0))
      columns.append(gtk.TreeViewColumn("Progress", gtk.CellRendererProgress(), value=1))
      for c in columns:
   def change_pbar_and_text(self, widget): 
      if self.iter == None:
         self.iter = self.list.get_iter_first()
      elif self.list.iter_next(self.iter)!=None:
         self.iter = self.list.iter_next(self.iter)
      self.list.set_value(self.iter, 0, "Uspeh!!! :)")
      self.list.set_value(self.iter, 1, 100.0)
   def insert_row(self, model, parent):
      iter = model.append()
      model.set_value(iter, 0, "") 
      model.set_value(iter, 1, 0)  
      return iter
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.