Changeset 20
- Timestamp:
- 07/07/06 23:02:21 (3 years ago)
- Files:
-
- 2 added
- 7 modified
-
bug.py (modified) (2 diffs)
-
bug_template.glade (modified) (6 diffs)
-
bug_template_self.glade (modified) (6 diffs)
-
bugglade_test.py (modified) (4 diffs)
-
comment.glade (added)
-
comment_self.glade (added)
-
conseil.py (modified) (3 diffs)
-
launchpad_test.py (modified) (3 diffs)
-
protocol_launchpadweb.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bug.py
r18 r20 54 54 return self.assignee 55 55 56 def setAllComments ( ) :57 print "hello"56 def setAllComments (self,array) : 57 self.comments = array 58 58 59 def getAllComments ( ) :60 print "hello"59 def getAllComments (self) : 60 return self.comments 61 61 62 def addComment () : 63 print "hello" 62 def addComment (self,to_add) : 63 self.comments.append(to_add) 64 65 def comNbr(self) : 66 return len(self.comments) 64 67 65 68 … … 73 76 self.package="" 74 77 self.assignee="" 78 self.comments=[] 75 79 76 80 class comment: 77 81 78 def __init__(self,n,c,a ):82 def __init__(self,n,c,a,t,d): 79 83 self.nbr=n 80 84 self.content=c 81 self.author=a 85 self.author=a 86 self.title=t 87 self.date=d 88 89 def getNumber(self): 90 return self.nbr 91 92 def getContent(self): 93 return self.content 94 95 def getAuthor(self): 96 return self.author 97 98 def getTitle(self): 99 return self.title 100 101 def getDate(self): 102 return self.date -
bug_template.glade
r18 r20 103 103 <property name="can_focus">True</property> 104 104 <property name="show_tabs">True</property> 105 <property name="show_border"> True</property>105 <property name="show_border">False</property> 106 106 <property name="tab_pos">GTK_POS_BOTTOM</property> 107 <property name="scrollable"> False</property>108 <property name="enable_popup"> False</property>107 <property name="scrollable">True</property> 108 <property name="enable_popup">True</property> 109 109 110 110 <child> … … 265 265 <property name="can_focus">True</property> 266 266 <property name="label" translatable="yes">label10</property> 267 <property name="use_underline"> False</property>268 <property name="use_markup"> False</property>267 <property name="use_underline">True</property> 268 <property name="use_markup">True</property> 269 269 <property name="justify">GTK_JUSTIFY_LEFT</property> 270 270 <property name="wrap">True</property> … … 347 347 </widget> 348 348 <packing> 349 <property name="padding"> 0</property>349 <property name="padding">5</property> 350 350 <property name="expand">True</property> 351 351 <property name="fill">True</property> … … 363 363 364 364 <child> 365 <widget class="GtkFrame" id=" frame2">365 <widget class="GtkFrame" id="com_frame"> 366 366 <property name="visible">True</property> 367 367 <property name="label_xalign">0</property> … … 370 370 371 371 <child> 372 <widget class="Gtk Alignment" id="alignment2">372 <widget class="GtkLabel" id="dummy_label"> 373 373 <property name="visible">True</property> 374 <property name="label" translatable="yes">label10</property> 375 <property name="use_underline">False</property> 376 <property name="use_markup">False</property> 377 <property name="justify">GTK_JUSTIFY_LEFT</property> 378 <property name="wrap">False</property> 379 <property name="selectable">False</property> 374 380 <property name="xalign">0.5</property> 375 381 <property name="yalign">0.5</property> 376 <property name="xscale">1</property> 377 <property name="yscale">1</property> 378 <property name="top_padding">0</property> 379 <property name="bottom_padding">0</property> 380 <property name="left_padding">12</property> 381 <property name="right_padding">0</property> 382 383 <child> 384 <widget class="GtkLabel" id="label4"> 385 <property name="visible">True</property> 386 <property name="label" translatable="yes">Comments not yet implemented</property> 387 <property name="use_underline">False</property> 388 <property name="use_markup">False</property> 389 <property name="justify">GTK_JUSTIFY_LEFT</property> 390 <property name="wrap">False</property> 391 <property name="selectable">False</property> 392 <property name="xalign">0.5</property> 393 <property name="yalign">0.5</property> 394 <property name="xpad">0</property> 395 <property name="ypad">0</property> 396 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> 397 <property name="width_chars">-1</property> 398 <property name="single_line_mode">False</property> 399 <property name="angle">0</property> 400 </widget> 401 </child> 382 <property name="xpad">0</property> 383 <property name="ypad">0</property> 384 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> 385 <property name="width_chars">-1</property> 386 <property name="single_line_mode">False</property> 387 <property name="angle">0</property> 402 388 </widget> 403 389 </child> 404 390 405 391 <child> 406 <widget class="GtkLabel" id=" label3">392 <widget class="GtkLabel" id="comments_nbr"> 407 393 <property name="visible">True</property> 408 394 <property name="label" translatable="yes"><b>Comments</b></property> … … 427 413 </widget> 428 414 <packing> 429 <property name="padding"> 0</property>415 <property name="padding">5</property> 430 416 <property name="expand">True</property> 431 417 <property name="fill">True</property> 418 </packing> 419 </child> 420 421 <child> 422 <widget class="GtkLabel" id="label9"> 423 <property name="visible">True</property> 424 <property name="label" translatable="yes">Adding a comment is not yet implemented</property> 425 <property name="use_underline">False</property> 426 <property name="use_markup">False</property> 427 <property name="justify">GTK_JUSTIFY_LEFT</property> 428 <property name="wrap">False</property> 429 <property name="selectable">False</property> 430 <property name="xalign">0.5</property> 431 <property name="yalign">0.5</property> 432 <property name="xpad">0</property> 433 <property name="ypad">0</property> 434 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> 435 <property name="width_chars">-1</property> 436 <property name="single_line_mode">False</property> 437 <property name="angle">0</property> 438 </widget> 439 <packing> 440 <property name="padding">10</property> 441 <property name="expand">False</property> 442 <property name="fill">False</property> 432 443 </packing> 433 444 </child> -
bug_template_self.glade
r18 r20 121 121 <property name="can_focus">True</property> 122 122 <property name="show_tabs">True</property> 123 <property name="show_border"> True</property>123 <property name="show_border">False</property> 124 124 <property name="tab_pos">GTK_POS_BOTTOM</property> 125 <property name="scrollable"> False</property>126 <property name="enable_popup"> False</property>125 <property name="scrollable">True</property> 126 <property name="enable_popup">True</property> 127 127 128 128 <child> … … 283 283 <property name="can_focus">True</property> 284 284 <property name="label" translatable="yes">label10</property> 285 <property name="use_underline"> False</property>286 <property name="use_markup"> False</property>285 <property name="use_underline">True</property> 286 <property name="use_markup">True</property> 287 287 <property name="justify">GTK_JUSTIFY_LEFT</property> 288 288 <property name="wrap">True</property> … … 365 365 </widget> 366 366 <packing> 367 <property name="padding"> 0</property>367 <property name="padding">5</property> 368 368 <property name="expand">True</property> 369 369 <property name="fill">True</property> … … 381 381 382 382 <child> 383 <widget class="GtkFrame" id=" frame2">383 <widget class="GtkFrame" id="com_frame"> 384 384 <property name="visible">True</property> 385 385 <property name="label_xalign">0</property> … … 388 388 389 389 <child> 390 <widget class="Gtk Alignment" id="alignment2">390 <widget class="GtkLabel" id="dummy_label"> 391 391 <property name="visible">True</property> 392 <property name="label" translatable="yes">label10</property> 393 <property name="use_underline">False</property> 394 <property name="use_markup">False</property> 395 <property name="justify">GTK_JUSTIFY_LEFT</property> 396 <property name="wrap">False</property> 397 <property name="selectable">False</property> 392 398 <property name="xalign">0.5</property> 393 399 <property name="yalign">0.5</property> 394 <property name="xscale">1</property> 395 <property name="yscale">1</property> 396 <property name="top_padding">0</property> 397 <property name="bottom_padding">0</property> 398 <property name="left_padding">12</property> 399 <property name="right_padding">0</property> 400 401 <child> 402 <widget class="GtkLabel" id="label4"> 403 <property name="visible">True</property> 404 <property name="label" translatable="yes">Comments not yet implemented</property> 405 <property name="use_underline">False</property> 406 <property name="use_markup">False</property> 407 <property name="justify">GTK_JUSTIFY_LEFT</property> 408 <property name="wrap">False</property> 409 <property name="selectable">False</property> 410 <property name="xalign">0.5</property> 411 <property name="yalign">0.5</property> 412 <property name="xpad">0</property> 413 <property name="ypad">0</property> 414 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> 415 <property name="width_chars">-1</property> 416 <property name="single_line_mode">False</property> 417 <property name="angle">0</property> 418 </widget> 419 </child> 400 <property name="xpad">0</property> 401 <property name="ypad">0</property> 402 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> 403 <property name="width_chars">-1</property> 404 <property name="single_line_mode">False</property> 405 <property name="angle">0</property> 420 406 </widget> 421 407 </child> 422 408 423 409 <child> 424 <widget class="GtkLabel" id=" label3">410 <widget class="GtkLabel" id="comments_nbr"> 425 411 <property name="visible">True</property> 426 412 <property name="label" translatable="yes"><b>Comments</b></property> … … 445 431 </widget> 446 432 <packing> 447 <property name="padding"> 0</property>433 <property name="padding">5</property> 448 434 <property name="expand">True</property> 449 435 <property name="fill">True</property> 436 </packing> 437 </child> 438 439 <child> 440 <widget class="GtkLabel" id="label9"> 441 <property name="visible">True</property> 442 <property name="label" translatable="yes">Adding a comment is not yet implemented</property> 443 <property name="use_underline">False</property> 444 <property name="use_markup">False</property> 445 <property name="justify">GTK_JUSTIFY_LEFT</property> 446 <property name="wrap">False</property> 447 <property name="selectable">False</property> 448 <property name="xalign">0.5</property> 449 <property name="yalign">0.5</property> 450 <property name="xpad">0</property> 451 <property name="ypad">0</property> 452 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> 453 <property name="width_chars">-1</property> 454 <property name="single_line_mode">False</property> 455 <property name="angle">0</property> 456 </widget> 457 <packing> 458 <property name="padding">10</property> 459 <property name="expand">False</property> 460 <property name="fill">False</property> 450 461 </packing> 451 462 </child> -
bugglade_test.py
r18 r20 5 5 import gtk.glade 6 6 import urllib 7 from bug import bug 7 from bug import * 8 from protocol_launchpadweb import protocol 8 9 from BeautifulSoup import BeautifulSoup 9 10 # You have to change this if you have another storage … … 11 12 12 13 13 bugnbr="42" 14 nbr=int(bugnbr) 15 16 zebug = bug(nbr) 17 18 zeurl="https://launchpad.net/products/malone/+bug/1" 19 f= urllib.urlopen(zeurl) 20 # ici on a le corps principal 21 # faudrait faire un extract pour soulager la mémoire 22 soup = BeautifulSoup(f).body.contents[5].div.div 23 title = soup.h1.contents[0] 24 tbody = soup.findAll('tbody')[0].findAll('td') 25 product = tbody[0].a.contents[0] 26 status = tbody[1].contents[0] 27 importance = tbody[2].contents[0] 28 assigned = tbody[3].a.contents[2] 29 zebug.setTitle(title) 30 zebug.setPackage(product) 31 zebug.setStatus(status) 32 zebug.setImportance(importance) 33 zebug.setAssignee(assigned) 34 #need to prettify assigned 35 content='' 36 p = soup.findAll('div', recursive=0)[1].div.findAll('p', recursive=0) 37 for i in p: 38 for j in i.contents: 39 content = "%s\n%s"%(content,j) 40 zebug.setDescription(content) 14 bts = protocol() 15 zebug = bts.retrieveBug(42) 16 bugnbr = str(zebug.getNbr()) 41 17 42 18 … … 46 22 bugwidget.signal_autoconnect(dic) 47 23 24 widget_comments_nbr = bugwidget.get_widget("comments_nbr") 25 com_text = "%d comment(s) : "%zebug.comNbr() 26 widget_comments_nbr.set_text(com_text) 27 widget_comments = bugwidget.get_widget("com_frame") 48 28 widget_nbr = bugwidget.get_widget("number") 49 29 widget_nbr.set_text(bugnbr) … … 61 41 widget_package.set_text(zebug.getPackage()) 62 42 43 #inserting comments 44 hbox = gtk.VBox(spacing=2) 45 hbox.show() 46 for i in zebug.getAllComments(): 47 comwidget = gtk.glade.XML("comment.glade") 48 comwidget.get_widget("poster").set_text(i.getAuthor()) 49 comwidget.get_widget("title").set_text(i.getTitle()) 50 comwidget.get_widget("date").set_text(i.getDate()) 51 comwidget.get_widget("comment_body").set_text(i.getContent()) 52 hbox.add(comwidget.get_widget("comment")) 53 54 55 to_remove = bugwidget.get_widget("dummy_label") 56 widget_comments.remove(to_remove) 57 widget_comments.add(hbox) 58 63 59 #We take the vbox to insert it 64 60 main_widget = bugwidget.get_widget("bug_main") -
conseil.py
r18 r20 89 89 listing.insert_before(None, ["Evo's bugs", 3, "evolution refresh folder"]) 90 90 listing.insert_before(None, ["Bug #42", 1, "42"]) 91 listing.insert_before(None, ["Content in +text mode", 1, "51835"]) 92 listing.insert_before(None, ["Search in bugs+text", 1, "51836"]) 91 93 renderer = gtk.CellRendererText() 92 94 column = gtk.TreeViewColumn("title", renderer, text=0) … … 209 211 bugtemplate = "bug_template.glade" 210 212 bugwidget = gtk.glade.XML(bugtemplate) 213 widget_comments_nbr = bugwidget.get_widget("comments_nbr") 214 # TODO : handle nicely plurals 215 com_text = "%d comment(s) : "%zebug.comNbr() 216 widget_comments_nbr.set_text(com_text) 217 widget_comments = bugwidget.get_widget("com_frame") 211 218 widget_nbr = bugwidget.get_widget("number") 212 219 title_bugnbr = "Bug #%s :" %bugnbr … … 226 233 widget_package.set_text(zebug.getPackage()) 227 234 235 #inserting comments 236 hbox = gtk.VBox(spacing=2) 237 hbox.show() 238 for i in zebug.getAllComments(): 239 comwidget = gtk.glade.XML("comment.glade") 240 comwidget.get_widget("poster").set_text(i.getAuthor()) 241 comwidget.get_widget("title").set_text(i.getTitle()) 242 comwidget.get_widget("date").set_text(i.getDate()) 243 comwidget.get_widget("comment_body").set_text(i.getContent()) 244 hbox.add(comwidget.get_widget("comment")) 245 246 to_remove = bugwidget.get_widget("dummy_label") 247 widget_comments.remove(to_remove) 248 widget_comments.add(hbox) 249 250 228 251 #We take the vbox to insert it 229 252 main_widget = bugwidget.get_widget("bug_main") -
launchpad_test.py
r18 r20 5 5 import gtk.glade 6 6 import urllib 7 from bug import bug7 from bug import * 8 8 from BeautifulSoup import BeautifulSoup 9 9 # You have to change this if you have another storage … … 11 11 12 12 13 zeurl="https://launchpad.net/ products/malone/+bug/1"13 zeurl="https://launchpad.net/bugs/51835" 14 14 f= urllib.urlopen(zeurl) 15 zebug = bug(42) 15 16 # ici on a le corps principal 16 17 # faudrait faire un extract pour soulager la mémoire … … 21 22 status = tbody[1].contents[0] 22 23 importance = tbody[2].contents[0] 23 assigned = tbody[3].a.contents[2]24 #print title25 #print product26 #print status27 #print importance24 #assigned = tbody[3].a.contents[2] 25 print title 26 print product 27 print status 28 print importance 28 29 #need to prettify assigned 29 30 #print assigned 30 content='' 31 p = soup.findAll('div', recursive=0)[1].div.findAll('p', recursive=0) 32 for i in p: 33 #print i.renderContents() 34 for j in i.contents: 35 jj = j.string 36 if jj != None and jj != "<br />" : 37 print "#############################" 38 newj = jj.strip().replace(" "," ") 39 print str(newj) 40 content = "%s\n%s"%(content,newj) 41 #print newj 42 #print j.renderContents() 43 #print "#####################" 44 content = "%s\n"%content 45 #print content 31 array_com = soup.findAll('div', recursive=0)[1].findAll('div','boardComment') 32 print array_com 33 j = 0 34 com_counter = 0 35 for i in array_com : 36 details = i.contents[1].findAll('a') 37 title = details[0].strong.contents[0] 38 poster = details[1].contents[0] 39 body = i.contents[3].findAll('p') 40 com_counter += 1 41 content="" 42 for z in body : 43 phrase = z.contents[0].string 44 new_phrase = phrase.strip().replace(" "," ") 45 content = "%s\n%s" %(content,new_phrase) 46 newcom = comment(com_counter,content,poster,title,"date not implemented") 47 zebug.addComment(newcom) 48 j += 1 49 print zebug.comNbr() 46 50 47 #p = soup.p48 #content = p.contents[0]49 #print p.name50 #p = p.next51 #print p52 #p = p.nextSibling.nextSibling53 #while p.name != 'form' :54 # print p.name55 # if p.name == 'p' :56 # content = content+'\n'+p.contents[0]57 # p = p.next58 #print content59 60 -
protocol_launchpadweb.py
r18 r20 4 4 import gobject 5 5 import urllib 6 from bug import bug6 from bug import * 7 7 from BeautifulSoup import BeautifulSoup 8 8 # You have to change this if you have another storage … … 75 75 zebug.setImportance(importance) 76 76 zebug.setDescription(content) 77 78 array_com = soup.findAll('div', recursive=0)[1].findAll('div','boardComment') 79 j = 0 80 com_counter = 0 81 for i in array_com : 82 details = i.contents[1].findAll('a') 83 title = details[0].strong.contents[0] 84 poster = details[1].contents[0] 85 body = i.contents[3].findAll('p') 86 com_counter += 1 87 content="" 88 for z in body : 89 phrase = z.contents[0].string 90 new_phrase = phrase.strip().replace(" "," ") 91 content = "%s\n%s" %(content,new_phrase) 92 newcom = comment(com_counter,content,poster,title,"00/00/00") 93 zebug.addComment(newcom) 94 77 95 #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 78 96 return zebug
