~and471/leonov/andrew-leonov

« back to all changes in this revision

Viewing changes to leonov/gtk/buginfowidgetbranches.py

  • Committer: Stephan Hermann
  • Date: 2008-07-09 17:02:50 UTC
  • mfrom: (121.1.2 leonov)
  • Revision ID: sh@sourcecode.de-20080709170250-33i7r55eg0bgv17n
local merge with lp:leonov/leonov-gtk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#####################################################
 
2
# leonov - The Launchpad Desktop Client
 
3
# Copyright (C) 2008 Siegfried-A. Gevatter
 
4
#
 
5
# This program is free software; you can redistribute it and/or modify
 
6
# it under the terms of the GNU General Public License as published by
 
7
# the Free Software Foundation; either version 2 of the License, or
 
8
# (at your option) any later version.
 
9
#
 
10
# This program is distributed in the hope that it will be useful,
 
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
# GNU General Public License for more details.
 
14
#
 
15
# You should have received a copy of the GNU General Public License along
 
16
# with this program; if not, write to the Free Software Foundation, Inc.,
 
17
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
18
#####################################################
 
19
 
 
20
import gtk
 
21
 
 
22
from leonov.gtk.objects.treeview import SimplifiedTreeView
 
23
 
 
24
class BugInfoWidgetBranches(gtk.ScrolledWindow):
 
25
    
 
26
    def __init__(self):
 
27
        gtk.ScrolledWindow.__init__(self)
 
28
        
 
29
        self._branches = []
 
30
        
 
31
        self.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
 
32
        self._model = gtk.ListStore(str, str)
 
33
        treeview = SimplifiedTreeView(self._model)
 
34
        treeview.add_columns('Branch', 'Status')
 
35
        treeview.show()
 
36
        self.add_with_viewport(treeview)
 
37
    
 
38
    def showBug(self, bug = None):
 
39
        self._model.clear()
 
40
        self._bug = bug
 
41
        if not bug:
 
42
            return
 
43
        for branch in bug.branches:
 
44
            self._model.append([branch.title, branch.status])
 
45
            self._branches.append(branch.url)