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)
      model.set_value(myiter,0,type_image)
      model.set_value(myiter,1,file)
      model.set_value(myiter,2,pbar)
      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...

Thanks

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')
      view.set_model(self.list)
      columns = []
      columns.append(gtk.TreeViewColumn("File", gtk.CellRendererText(), text=0))
      columns.append(gtk.TreeViewColumn("Progress", gtk.CellRendererProgress(), value=1))
      for c in columns:
         c.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE)
         view.append_column(c)
     
      self.iter=None
    
   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 meeting, networking, learning, and sharing knowledge.