1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
import sys
try:
import pygtk
pygtk.require("2.0")
import gtk
from BugsPane import BugsPane
from FindTeamDialog import FindTeamDialog
from AsynchTaskProgressBox import AsynchTaskProgressBox
import LaunchpadUtils
except Exception, inst:
print "some dependencies for BugsPane are not available"
raise inst
class TeamBugsPage(gtk.VBox):
"""TeamBugsPage: A widget derived from VBox for use as a tab in a tabbed UI.
Handles showing a dialog to allow the user to search launchpad for the name
of a team, retrieves and presents all bugs assigned to that team.
Finds bugs assigned to a team and to the team itself.
"""
def __init__(self,launchpad,tab_label, progress_area):
"""Create an TeamBugsPage
Keyword arguments:
launchpad -- an instantiated launchpad instance
table_label -- a widget with a 'set_text' function to display the team name
progress_area -- a widget for displaying the progress indicator
"""
gtk.VBox.__init__(self,5,5)
self.progress_area = progress_area
self.tab_label = tab_label
self.launchpad = launchpad
self.find_team_dialog = FindTeamDialog(launchpad)
self.find_team_dialog.connect("response", self.get_team_complete)
self.find_team_dialog.show()
def get_team_complete(self, widget, response):
self.find_team_dialog.hide()
if response == gtk.RESPONSE_OK:
params = {"lp":self.launchpad, "team":self.find_team_dialog.get_selected()}
self.get_bugs_progressbox = AsynchTaskProgressBox(LaunchpadUtils.get_team_list_store , params)
self.progress_area.pack_end(self.get_bugs_progressbox, False, False)
self.get_bugs_progressbox.connect("complete",self.get_bugs_complete)
self.get_bugs_progressbox.show()
self.get_bugs_progressbox.start("Retrieving bugs from Launchpad")
def get_bugs_complete(self, widget, data):
self.progress_area.remove(self.get_bugs_progressbox)
list_store = data[0]
team = data[1]
self.tab_label.set_text(team.name)
bp = BugsPane(list_store)
self.pack_start(bp)
bp.show()
self.show()
|