Trees | Indices | Help |
|
---|
|
1 2 from twisted.internet import gtk2reactor 3 gtk2reactor.install() 4 from twisted.internet import reactor 5 from twisted.python import util 6 from twisted.spread import pb 7 from twisted.cred import credentials 8 import gtk.glade #@UnresolvedImport 9 import re 1017213 self.connected = 0 14 try: 15 host, port = re.search(r'(.+):(\d+)', master).groups() 16 except: 17 print "unparseable master location '%s'" % master 18 print " expecting something more like localhost:8007" 19 raise 20 self.host = host 21 self.port = int(port) 22 self.passwd = passwd 23 self.remote = None 24 xml = self.xml = gtk.glade.XML(util.sibpath(__file__, "debug.glade")) 25 g = xml.get_widget 26 self.buildname = g('buildname') 27 self.filename = g('filename') 28 self.connectbutton = g('connectbutton') 29 self.connectlabel = g('connectlabel') 30 g('window1').connect('destroy', lambda win: gtk.main_quit()) 31 # put the master info in the window's titlebar 32 g('window1').set_title("Buildbot Debug Tool: %s" % master) 33 c = xml.signal_connect 34 c('do_connect', self.do_connect) 35 c('do_reload', self.do_reload) 36 c('do_rebuild', self.do_rebuild) 37 c('do_poke_irc', self.do_poke_irc) 38 c('do_build', self.do_build) 39 c('do_ping', self.do_ping) 40 c('do_commit', self.do_commit) 41 c('on_usebranch_toggled', self.usebranch_toggled) 42 self.usebranch_toggled(g('usebranch')) 43 c('on_userevision_toggled', self.userevision_toggled) 44 self.userevision_toggled(g('userevision')) 45 c('do_current_offline', self.do_current, "offline") 46 c('do_current_idle', self.do_current, "idle") 47 c('do_current_waiting', self.do_current, "waiting") 48 c('do_current_building', self.do_current, "building")4951 if self.connected: 52 self.connectlabel.set_text("Disconnecting...") 53 if self.remote: 54 self.remote.broker.transport.loseConnection() 55 else: 56 self.connectlabel.set_text("Connecting...") 57 f = pb.PBClientFactory() 58 creds = credentials.UsernamePassword("debug", self.passwd) 59 d = f.login(creds) 60 reactor.connectTCP(self.host, int(self.port), f) 61 d.addCallbacks(self.connect_complete, self.connect_failed)63 self.connectbutton.set_label("Disconnect") 64 self.connectlabel.set_text("Connected") 65 self.connected = 1 66 self.remote = ref 67 self.remote.callRemote("print", "hello cleveland") 68 self.remote.notifyOnDisconnect(self.disconnected)73 self.connectbutton.set_label("Connect") 74 self.connectlabel.set_text("Disconnected") 75 self.connected = 0 76 self.remote = None77 9193 if not self.remote: 94 return 95 name = self.buildname.get_text() 96 branch = None 97 if self.xml.get_widget("usebranch").get_active(): 98 branch = self.xml.get_widget('branch').get_text() 99 if branch == '': 100 branch = None 101 revision = None 102 if self.xml.get_widget("userevision").get_active(): 103 revision = self.xml.get_widget('revision').get_text() 104 if revision == '': 105 revision = None 106 reason = "debugclient 'Request Build' button pushed" 107 properties = {} 108 d = self.remote.callRemote("requestBuild", 109 name, reason, branch, revision, properties) 110 d.addErrback(self.err)111113 if not self.remote: 114 return 115 name = self.buildname.get_text() 116 d = self.remote.callRemote("pingBuilder", name) 117 d.addErrback(self.err)118120 rev = self.xml.get_widget('branch') 121 if widget.get_active(): 122 rev.set_sensitive(True) 123 else: 124 rev.set_sensitive(False)125127 rev = self.xml.get_widget('revision') 128 if widget.get_active(): 129 rev.set_sensitive(True) 130 else: 131 rev.set_sensitive(False)132134 if not self.remote: 135 return 136 filename = self.filename.get_text() 137 who = self.xml.get_widget("who").get_text() 138 139 branch = None 140 if self.xml.get_widget("usebranch").get_active(): 141 branch = self.xml.get_widget('branch').get_text() 142 if branch == '': 143 branch = None 144 145 revision = None 146 if self.xml.get_widget("userevision").get_active(): 147 revision = self.xml.get_widget('revision').get_text() 148 try: 149 revision = int(revision) 150 except ValueError: 151 pass 152 if revision == '': 153 revision = None 154 155 kwargs = { 'revision': revision, 'who': who } 156 if branch: 157 kwargs['branch'] = branch 158 d = self.remote.callRemote("fakeChange", filename, **kwargs) 159 d.addErrback(self.err)160162 if not self.remote: 163 return 164 name = self.buildname.get_text() 165 d = self.remote.callRemote("setCurrentState", name, state) 166 d.addErrback(self.err)168 print "received error:", failure169
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Fri Oct 29 10:00:44 2010 | http://epydoc.sourceforge.net |