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

gEDA-cvs: CVS update: gui.py



  User: pcjc2   
  Date: 06/10/05 16:28:04

  Modified:    .        Tag: V1_X gui.py
  Log:
  Applied patch by Peter B to open multiple pages using the same copy of 
  
  gschem or gattrib. Branched V1_X to keep updates to the pre D-Bus 
  
  version.
  
  
  
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +24 -13    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.1.2.1
  diff -u -b -r1.1 -r1.1.2.1
  --- gui.py	19 Sep 2006 09:42:42 -0000	1.1
  +++ gui.py	5 Oct 2006 20:28:02 -0000	1.1.2.1
  @@ -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,16 +342,28 @@
   
   
       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()
  -        page = model.get_value(iter, 0)
   
  +        # Call a private helper function defined above for each
  +        # selected schematic page in order to build a list of pages.
  +        pages = []
  +        def buildpagelist_func(model, path, iter):
  +            pages.append(model.get_value(iter, 0))
  +        self.pagelist.get_selection().selected_foreach(buildpagelist_func)
  +
  +        # Launch the requested tool
  +        # FIXME does this work for gattrib?
           toolpath = find_tool_path(tool)
           if toolpath == None:
               md = gtk.MessageDialog(self,
  @@ -366,7 +377,7 @@
               md.hide_all()
               return
   
  -        Popen([toolpath, page])
  +        Popen([toolpath] + pages)
   
       def event_editpcb_button_clicked(self, button):
           
  
  
  


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