[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: CVS update: gui.py



  User: pcjc2   
  Date: 06/10/04 19:59:16

  Modified:    .        gui.py
  Log:
  Applied patch by Peter Brett allowing multiple selections in the 
  
  schematic list
  
  
  
  
  Revision  Changes    Path
  1.2       +32 -23    eda/geda/xgsch2pcb/lib/xgsch2pcb/gui.py
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: gui.py
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/xgsch2pcb/lib/xgsch2pcb/gui.py,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- gui.py	19 Sep 2006 09:42:42 -0000	1.1
  +++ gui.py	4 Oct 2006 23:59:16 -0000	1.2
  @@ -88,7 +88,7 @@
           column = gtk.TreeViewColumn(None, gtk.CellRendererText(), text=0)
           self.pagelist.append_column(column)
           selection = self.pagelist.get_selection()
  -        selection.set_mode(gtk.SELECTION_SINGLE)
  +        selection.set_mode(gtk.SELECTION_MULTIPLE)
           selection.connect('changed',
                             self.event_pagelist_selection_changed)
           self.pagelist.set_headers_visible(False)
  @@ -267,8 +267,7 @@
           self.set_pcbsensitivities()
   
       def event_pagelist_selection_changed(self, selection):
  -        (model, iter) = selection.get_selected()
  -        page_selected = (iter != None)
  +        page_selected = selection.count_selected_rows()
           self.removepagebutton.set_sensitive(page_selected)
           self.editpagebutton.set_sensitive(page_selected)
           self.attribpagebutton.set_sensitive(page_selected)
  @@ -343,14 +342,20 @@
   
   
       def event_removepage_button_clicked(self, button):
  -        (model, iter) = self.pagelist.get_selection().get_selected()
  -        if iter == None:
  -            return
  -        page = model.get_value(iter, 0)
  +        # Because we're modifying the treeview at the same time as
  +        # reading from it, we need to make a list of
  +        # gtk.TreeRowReferences (which are persistent over
  +        # modification of a treemodel) and then iterate over that.
  +        (model, paths) = self.pagelist.get_selection().get_selected_rows()
  +        refs = map(gtk.TreeRowReference, [model]*len(paths), paths)
  +        for ref in refs:
  +            page = model.get_value(model.get_iter(ref.get_path()), 0)
           self.project.remove_page(page)
   
  +
       def event_schematic_button_clicked(self, button, tool):
  -        (model, iter) = self.pagelist.get_selection().get_selected()
  +        
  +        def runtool_func(model, path, iter):
           page = model.get_value(iter, 0)
   
           toolpath = find_tool_path(tool)
  @@ -368,6 +373,10 @@
   
           Popen([toolpath, page])
   
  +        # Call the private helper function defined above for each
  +        # selected schematic page.
  +        self.pagelist.get_selection().selected_foreach(runtool_func)
  +
       def event_editpcb_button_clicked(self, button):
           
           # Check if the layout might need updating
  
  
  


_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs