[Buildbot-commits] buildbot/buildbot/clients debug.glade,NONE,1.1 debug.py,NONE,1.1

Brian Warner warner at users.sourceforge.net
Fri Apr 22 02:57:25 UTC 2005


Update of /cvsroot/buildbot/buildbot/buildbot/clients
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4617/buildbot/clients

Added Files:
	debug.glade debug.py 
Log Message:
Revision: arch at buildbot.sf.net--2004/buildbot--dev--0--patch-61
Creator:  Brian Warner <warner at monolith.lothar.com>

move debugclient and status client into 'buildbot' command

* buildbot/scripts/runner.py (Options.debugclient, Options.statusgui):
add sub-commands to launch the debug client (formerly in
contrib/debugclient.py) and the Gtk status application (currently broken)
* buildbot/clients/debug.py: move from contrib/debugclient.py
* buildbot/clients/debug.glade: same


--- NEW FILE: debug.glade ---
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">

<glade-interface>
<requires lib="gnome"/>

<widget class="GtkWindow" id="window1">
  <property name="visible">True</property>
  <property name="title" translatable="yes">Buildbot Debug Tool</property>
  <property name="type">GTK_WINDOW_TOPLEVEL</property>
  <property name="window_position">GTK_WIN_POS_NONE</property>
  <property name="modal">False</property>
  <property name="resizable">True</property>
  <property name="destroy_with_parent">False</property>
  <property name="decorated">True</property>
  <property name="skip_taskbar_hint">False</property>
  <property name="skip_pager_hint">False</property>
  <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>

  <child>
    <widget class="GtkVBox" id="vbox1">
      <property name="visible">True</property>
      <property name="homogeneous">False</property>
      <property name="spacing">0</property>

      <child>
	<widget class="GtkHBox" id="connection">
	  <property name="visible">True</property>
	  <property name="homogeneous">False</property>
	  <property name="spacing">0</property>

	  <child>
	    <widget class="GtkButton" id="connectbutton">
	      <property name="visible">True</property>
	      <property name="can_focus">True</property>
	      <property name="label" translatable="yes">Connect</property>
	      <property name="use_underline">True</property>
	      <property name="relief">GTK_RELIEF_NORMAL</property>
	      <property name="focus_on_click">True</property>
	      <signal name="clicked" handler="do_connect"/>
	    </widget>
	    <packing>
	      <property name="padding">0</property>
	      <property name="expand">False</property>
	      <property name="fill">False</property>
	    </packing>
	  </child>

	  <child>
	    <widget class="GtkLabel" id="connectlabel">
	      <property name="visible">True</property>
	      <property name="label" translatable="yes">Disconnected</property>
	      <property name="use_underline">False</property>
	      <property name="use_markup">False</property>
	      <property name="justify">GTK_JUSTIFY_CENTER</property>
	      <property name="wrap">False</property>
	      <property name="selectable">False</property>
	      <property name="xalign">0.5</property>
	      <property name="yalign">0.5</property>
	      <property name="xpad">0</property>
	      <property name="ypad">0</property>
	    </widget>
	    <packing>
	      <property name="padding">0</property>
	      <property name="expand">True</property>
	      <property name="fill">True</property>
	    </packing>
	  </child>
	</widget>
	<packing>
	  <property name="padding">0</property>
	  <property name="expand">False</property>
	  <property name="fill">False</property>
	</packing>
      </child>

      <child>
	<widget class="GtkHBox" id="commands">
	  <property name="visible">True</property>
	  <property name="homogeneous">False</property>
	  <property name="spacing">0</property>

	  <child>
	    <widget class="GtkButton" id="reload">
	      <property name="visible">True</property>
	      <property name="can_focus">True</property>
	      <property name="label" translatable="yes">Reload .cfg</property>
	      <property name="use_underline">True</property>
	      <property name="relief">GTK_RELIEF_NORMAL</property>
	      <property name="focus_on_click">True</property>
	      <signal name="clicked" handler="do_reload" last_modification_time="Wed, 24 Sep 2003 20:47:55 GMT"/>
	    </widget>
	    <packing>
	      <property name="padding">0</property>
	      <property name="expand">False</property>
	      <property name="fill">False</property>
	    </packing>
	  </child>

	  <child>
	    <widget class="GtkButton" id="rebuild">
	      <property name="visible">True</property>
	      <property name="sensitive">False</property>
	      <property name="can_focus">True</property>
	      <property name="label" translatable="yes">Rebuild .py</property>
	      <property name="use_underline">True</property>
	      <property name="relief">GTK_RELIEF_NORMAL</property>
	      <property name="focus_on_click">True</property>
	      <signal name="clicked" handler="do_rebuild" last_modification_time="Wed, 24 Sep 2003 20:49:18 GMT"/>
	    </widget>
	    <packing>
	      <property name="padding">0</property>
	      <property name="expand">False</property>
	      <property name="fill">False</property>
	    </packing>
	  </child>

	  <child>
	    <widget class="GtkButton" id="button7">
	      <property name="visible">True</property>
	      <property name="can_focus">True</property>
	      <property name="label" translatable="yes">poke IRC</property>
	      <property name="use_underline">True</property>
	      <property name="relief">GTK_RELIEF_NORMAL</property>
	      <property name="focus_on_click">True</property>
	      <signal name="clicked" handler="do_poke_irc" last_modification_time="Wed, 14 Jan 2004 22:23:59 GMT"/>
	    </widget>
	    <packing>
	      <property name="padding">0</property>
	      <property name="expand">False</property>
	      <property name="fill">False</property>
	    </packing>
	  </child>
	</widget>
	<packing>
	  <property name="padding">0</property>
	  <property name="expand">True</property>
	  <property name="fill">True</property>
	</packing>
      </child>

      <child>
	<widget class="GtkFrame" id="Commit">
	  <property name="border_width">4</property>
	  <property name="visible">True</property>
	  <property name="label_xalign">0</property>
	  <property name="label_yalign">0.5</property>
	  <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>

	  <child>
	    <widget class="GtkAlignment" id="alignment1">
	      <property name="visible">True</property>
	      <property name="xalign">0.5</property>
	      <property name="yalign">0.5</property>
	      <property name="xscale">1</property>
	      <property name="yscale">1</property>
	      <property name="top_padding">0</property>
	      <property name="bottom_padding">0</property>
	      <property name="left_padding">0</property>
	      <property name="right_padding">0</property>

	      <child>
		<widget class="GtkVBox" id="vbox3">
		  <property name="visible">True</property>
		  <property name="homogeneous">False</property>
		  <property name="spacing">0</property>

		  <child>
		    <widget class="GtkHBox" id="commit">
		      <property name="visible">True</property>
		      <property name="homogeneous">False</property>
		      <property name="spacing">0</property>

		      <child>
			<widget class="GtkButton" id="button2">
			  <property name="visible">True</property>
			  <property name="can_focus">True</property>
			  <property name="label" translatable="yes">commit</property>
			  <property name="use_underline">True</property>
			  <property name="relief">GTK_RELIEF_NORMAL</property>
			  <property name="focus_on_click">True</property>
			  <signal name="clicked" handler="do_commit"/>
			</widget>
			<packing>
			  <property name="padding">0</property>
			  <property name="expand">False</property>
			  <property name="fill">False</property>
			</packing>
		      </child>

		      <child>
			<widget class="GtkEntry" id="filename">
			  <property name="visible">True</property>
			  <property name="can_focus">True</property>
			  <property name="editable">True</property>
			  <property name="visibility">True</property>
			  <property name="max_length">0</property>
			  <property name="text" translatable="yes">twisted/internet/app.py</property>
			  <property name="has_frame">True</property>
			  <property name="invisible_char" translatable="yes">*</property>
			  <property name="activates_default">False</property>
			</widget>
			<packing>
			  <property name="padding">0</property>
			  <property name="expand">True</property>
			  <property name="fill">True</property>
			</packing>
		      </child>
		    </widget>
		    <packing>
		      <property name="padding">0</property>
		      <property name="expand">True</property>
		      <property name="fill">True</property>
		    </packing>
		  </child>

		  <child>
		    <widget class="GtkHBox" id="hbox2">
		      <property name="visible">True</property>
		      <property name="homogeneous">False</property>
		      <property name="spacing">0</property>

		      <child>
			<widget class="GtkLabel" id="label5">
			  <property name="visible">True</property>
			  <property name="label" translatable="yes">Who: </property>
			  <property name="use_underline">False</property>
			  <property name="use_markup">False</property>
			  <property name="justify">GTK_JUSTIFY_LEFT</property>
			  <property name="wrap">False</property>
			  <property name="selectable">False</property>
			  <property name="xalign">0.5</property>
			  <property name="yalign">0.5</property>
			  <property name="xpad">0</property>
			  <property name="ypad">0</property>
			</widget>
			<packing>
			  <property name="padding">0</property>
			  <property name="expand">False</property>
			  <property name="fill">False</property>
			</packing>
		      </child>

		      <child>
			<widget class="GtkEntry" id="who">
			  <property name="visible">True</property>
			  <property name="can_focus">True</property>
			  <property name="editable">True</property>
			  <property name="visibility">True</property>
			  <property name="max_length">0</property>
			  <property name="text" translatable="yes">bob</property>
			  <property name="has_frame">True</property>
			  <property name="invisible_char" translatable="yes">*</property>
			  <property name="activates_default">False</property>
			</widget>
			<packing>
			  <property name="padding">0</property>
			  <property name="expand">True</property>
			  <property name="fill">True</property>
			</packing>
		      </child>
		    </widget>
		    <packing>
		      <property name="padding">0</property>
		      <property name="expand">True</property>
		      <property name="fill">True</property>
		    </packing>
		  </child>

		  <child>
		    <widget class="GtkHBox" id="hbox1">
		      <property name="visible">True</property>
		      <property name="homogeneous">False</property>
		      <property name="spacing">0</property>

		      <child>
			<widget class="GtkCheckButton" id="userevision">
			  <property name="visible">True</property>
			  <property name="can_focus">True</property>
			  <property name="label" translatable="yes">Revision:</property>
			  <property name="use_underline">True</property>
			  <property name="relief">GTK_RELIEF_NORMAL</property>
			  <property name="focus_on_click">True</property>
			  <property name="active">False</property>
			  <property name="inconsistent">False</property>
			  <property name="draw_indicator">True</property>
			  <signal name="toggled" handler="on_userevision_toggled" last_modification_time="Wed, 08 Sep 2004 17:58:33 GMT"/>
			</widget>
			<packing>
			  <property name="padding">0</property>
			  <property name="expand">False</property>
			  <property name="fill">False</property>
			</packing>
		      </child>

		      <child>
			<widget class="GtkEntry" id="revision">
			  <property name="visible">True</property>
			  <property name="can_focus">True</property>
			  <property name="editable">True</property>
			  <property name="visibility">True</property>
			  <property name="max_length">0</property>
			  <property name="text" translatable="yes"></property>
			  <property name="has_frame">True</property>
			  <property name="invisible_char" translatable="yes">*</property>
			  <property name="activates_default">False</property>
			</widget>
			<packing>
			  <property name="padding">0</property>
			  <property name="expand">True</property>
			  <property name="fill">True</property>
			</packing>
		      </child>
		    </widget>
		    <packing>
		      <property name="padding">0</property>
		      <property name="expand">True</property>
		      <property name="fill">True</property>
		    </packing>
		  </child>
		</widget>
	      </child>
	    </widget>
	  </child>

	  <child>
	    <widget class="GtkLabel" id="label4">
	      <property name="visible">True</property>
	      <property name="label" translatable="yes">Commit</property>
	      <property name="use_underline">False</property>
	      <property name="use_markup">False</property>
	      <property name="justify">GTK_JUSTIFY_LEFT</property>
	      <property name="wrap">False</property>
	      <property name="selectable">False</property>
	      <property name="xalign">0.5</property>
	      <property name="yalign">0.5</property>
	      <property name="xpad">2</property>
	      <property name="ypad">0</property>
	    </widget>
	    <packing>
	      <property name="type">label_item</property>
	    </packing>
	  </child>
	</widget>
	<packing>
	  <property name="padding">0</property>
	  <property name="expand">True</property>
	  <property name="fill">True</property>
	</packing>
      </child>

      <child>
	<widget class="GtkFrame" id="builderframe">
	  <property name="border_width">4</property>
	  <property name="visible">True</property>
	  <property name="label_xalign">0</property>
	  <property name="label_yalign">0.5</property>
	  <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>

	  <child>
	    <widget class="GtkVBox" id="vbox2">
	      <property name="visible">True</property>
	      <property name="homogeneous">False</property>
	      <property name="spacing">0</property>

	      <child>
		<widget class="GtkHBox" id="builder">
		  <property name="visible">True</property>
		  <property name="homogeneous">False</property>
		  <property name="spacing">3</property>

		  <child>
		    <widget class="GtkLabel" id="label1">
		      <property name="visible">True</property>
		      <property name="label" translatable="yes">Builder:</property>
		      <property name="use_underline">False</property>
		      <property name="use_markup">False</property>
		      <property name="justify">GTK_JUSTIFY_CENTER</property>
		      <property name="wrap">False</property>
		      <property name="selectable">False</property>
		      <property name="xalign">0.5</property>
		      <property name="yalign">0.5</property>
		      <property name="xpad">0</property>
		      <property name="ypad">0</property>
		    </widget>
		    <packing>
		      <property name="padding">0</property>
		      <property name="expand">False</property>
		      <property name="fill">False</property>
		    </packing>
		  </child>

		  <child>
		    <widget class="GtkEntry" id="buildname">
		      <property name="visible">True</property>
		      <property name="can_focus">True</property>
		      <property name="editable">True</property>
		      <property name="visibility">True</property>
		      <property name="max_length">0</property>
		      <property name="text" translatable="yes">one</property>
		      <property name="has_frame">True</property>
		      <property name="invisible_char" translatable="yes">*</property>
		      <property name="activates_default">False</property>
		    </widget>
		    <packing>
		      <property name="padding">0</property>
		      <property name="expand">True</property>
		      <property name="fill">True</property>
		    </packing>
		  </child>
		</widget>
		<packing>
		  <property name="padding">0</property>
		  <property name="expand">True</property>
		  <property name="fill">True</property>
		</packing>
	      </child>

	      <child>
		<widget class="GtkHBox" id="buildercontrol">
		  <property name="visible">True</property>
		  <property name="homogeneous">False</property>
		  <property name="spacing">0</property>

		  <child>
		    <widget class="GtkButton" id="button1">
		      <property name="visible">True</property>
		      <property name="can_focus">True</property>
		      <property name="label" translatable="yes">Force
Build</property>
		      <property name="use_underline">True</property>
		      <property name="relief">GTK_RELIEF_NORMAL</property>
		      <property name="focus_on_click">True</property>
		      <signal name="clicked" handler="do_build"/>
		    </widget>
		    <packing>
		      <property name="padding">0</property>
		      <property name="expand">False</property>
		      <property name="fill">False</property>
		    </packing>
		  </child>

		  <child>
		    <placeholder/>
		  </child>

		  <child>
		    <placeholder/>
		  </child>
		</widget>
		<packing>
		  <property name="padding">0</property>
		  <property name="expand">True</property>
		  <property name="fill">True</property>
		</packing>
	      </child>

	      <child>
		<widget class="GtkHBox" id="status">
		  <property name="visible">True</property>
		  <property name="homogeneous">False</property>
		  <property name="spacing">0</property>

		  <child>
		    <widget class="GtkLabel" id="label2">
		      <property name="visible">True</property>
		      <property name="label" translatable="yes">Currently:</property>
		      <property name="use_underline">False</property>
		      <property name="use_markup">False</property>
		      <property name="justify">GTK_JUSTIFY_CENTER</property>
		      <property name="wrap">False</property>
		      <property name="selectable">False</property>
		      <property name="xalign">0.5</property>
		      <property name="yalign">0.5</property>
		      <property name="xpad">7</property>
		      <property name="ypad">0</property>
		    </widget>
		    <packing>
		      <property name="padding">0</property>
		      <property name="expand">False</property>
		      <property name="fill">False</property>
		    </packing>
		  </child>

		  <child>
		    <widget class="GtkButton" id="button3">
		      <property name="visible">True</property>
		      <property name="can_focus">True</property>
		      <property name="label" translatable="yes">offline</property>
		      <property name="use_underline">True</property>
		      <property name="relief">GTK_RELIEF_NORMAL</property>
		      <property name="focus_on_click">True</property>
		      <signal name="clicked" handler="do_current_offline"/>
		    </widget>
		    <packing>
		      <property name="padding">0</property>
		      <property name="expand">False</property>
		      <property name="fill">False</property>
		    </packing>
		  </child>

		  <child>
		    <widget class="GtkButton" id="button4">
		      <property name="visible">True</property>
		      <property name="can_focus">True</property>
		      <property name="label" translatable="yes">idle</property>
		      <property name="use_underline">True</property>
		      <property name="relief">GTK_RELIEF_NORMAL</property>
		      <property name="focus_on_click">True</property>
		      <signal name="clicked" handler="do_current_idle"/>
		    </widget>
		    <packing>
		      <property name="padding">0</property>
		      <property name="expand">False</property>
		      <property name="fill">False</property>
		    </packing>
		  </child>

		  <child>
		    <widget class="GtkButton" id="button5">
		      <property name="visible">True</property>
		      <property name="can_focus">True</property>
		      <property name="label" translatable="yes">waiting</property>
		      <property name="use_underline">True</property>
		      <property name="relief">GTK_RELIEF_NORMAL</property>
		      <property name="focus_on_click">True</property>
		      <signal name="clicked" handler="do_current_waiting"/>
		    </widget>
		    <packing>
		      <property name="padding">0</property>
		      <property name="expand">False</property>
		      <property name="fill">False</property>
		    </packing>
		  </child>

		  <child>
		    <widget class="GtkButton" id="button6">
		      <property name="visible">True</property>
		      <property name="can_focus">True</property>
		      <property name="label" translatable="yes">building</property>
		      <property name="use_underline">True</property>
		      <property name="relief">GTK_RELIEF_NORMAL</property>
		      <property name="focus_on_click">True</property>
		      <signal name="clicked" handler="do_current_building"/>
		    </widget>
		    <packing>
		      <property name="padding">0</property>
		      <property name="expand">False</property>
		      <property name="fill">False</property>
		    </packing>
		  </child>
		</widget>
		<packing>
		  <property name="padding">0</property>
		  <property name="expand">True</property>
		  <property name="fill">True</property>
		</packing>
	      </child>
	    </widget>
	  </child>

	  <child>
	    <widget class="GtkLabel" id="label3">
	      <property name="visible">True</property>
	      <property name="label" translatable="yes">Builder</property>
	      <property name="use_underline">False</property>
	      <property name="use_markup">False</property>
	      <property name="justify">GTK_JUSTIFY_LEFT</property>
	      <property name="wrap">False</property>
	      <property name="selectable">False</property>
	      <property name="xalign">0.5</property>
	      <property name="yalign">0.5</property>
	      <property name="xpad">2</property>
	      <property name="ypad">0</property>
	    </widget>
	    <packing>
	      <property name="type">label_item</property>
	    </packing>
	  </child>
	</widget>
	<packing>
	  <property name="padding">0</property>
	  <property name="expand">True</property>
	  <property name="fill">True</property>
	</packing>
      </child>
    </widget>
  </child>
</widget>

</glade-interface>

--- NEW FILE: debug.py ---
#! /usr/bin/python

from twisted.internet import gtk2reactor
gtk2reactor.install()
from twisted.internet import reactor
from twisted.python import util
from twisted.spread import pb
from twisted.cred import credentials
import gtk, gtk.glade, gnome.ui
import os, sys, re

class DebugWidget:
    def __init__(self, master="localhost:8007", passwd="debugpw"):
        self.connected = 0
        try:
            host, port = re.search(r'(.+):(\d+)', master).groups()
        except:
            print "unparseable master location '%s'" % master
            print " expecting something more like localhost:8007"
            raise
        self.host = host
        self.port = int(port)
        self.passwd = passwd
        self.remote = None
        xml = self.xml = gtk.glade.XML(util.sibpath(__file__, "debug.glade"))
        g = xml.get_widget
        self.buildname = g('buildname')
        self.filename = g('filename')
        self.connectbutton = g('connectbutton')
        self.connectlabel = g('connectlabel')
        g('window1').connect('destroy', lambda win: gtk.mainquit())
        c = xml.signal_connect
        c('do_connect', self.do_connect)
        c('do_reload', self.do_reload)
        c('do_rebuild', self.do_rebuild)
        c('do_poke_irc', self.do_poke_irc)
        c('do_build', self.do_build)
        c('do_commit', self.do_commit)
        c('on_userevision_toggled', self.userevision_toggled)
        self.userevision_toggled(g('userevision'))
        c('do_current_offline', self.do_current, "offline")
        c('do_current_idle', self.do_current, "idle")
        c('do_current_waiting', self.do_current, "waiting")
        c('do_current_building', self.do_current, "building")

    def do_connect(self, widget):
        if self.connected:
            self.connectlabel.set_text("Disconnecting...")
            if self.remote:
                self.remote.broker.transport.loseConnection()
        else:
            self.connectlabel.set_text("Connecting...")
            f = pb.PBClientFactory()
            creds = credentials.UsernamePassword("debug", self.passwd)
            d = f.login(creds)
            reactor.connectTCP(self.host, int(self.port), f)
            d.addCallbacks(self.connect_complete, self.connect_failed)
    def connect_complete(self, ref):
        self.connectbutton.set_label("Disconnect")
        self.connectlabel.set_text("Connected")
        self.connected = 1
        self.remote = ref
        self.remote.callRemote("print", "hello cleveland")
        self.remote.notifyOnDisconnect(self.disconnected)
    def connect_failed(self, why):
        self.connectlabel.set_text("Failed")
        print why
    def disconnected(self, ref):
        self.connectbutton.set_label("Connect")
        self.connectlabel.set_text("Disconnected")
        self.connected = 0
        self.remote = None

    def do_reload(self, widget):
        if not self.remote:
            return
        d = self.remote.callRemote("reload")
        d.addErrback(self.err)
    def do_rebuild(self, widget):
        print "Not yet implemented"
        return
    def do_poke_irc(self, widget):
        if not self.remote:
            return
        d = self.remote.callRemote("pokeIRC")
        d.addErrback(self.err)

    def do_build(self, widget):
        if not self.remote:
            return
        name = self.buildname.get_text()
        d = self.remote.callRemote("forceBuild", name)
        d.addErrback(self.err)

    def userevision_toggled(self, widget):
        rev = self.xml.get_widget('revision')
        if widget.get_active():
            rev.set_sensitive(True)
        else:
            rev.set_sensitive(False)

    def do_commit(self, widget):
        if not self.remote:
            return
        filename = self.filename.get_text()
        who = self.xml.get_widget("who").get_text()
        revision = None
        if self.xml.get_widget("userevision").get_active():
            revision = self.xml.get_widget('revision').get_text()
            try:
                revision = int(revision)
            except ValueError:
                pass
        d = self.remote.callRemote("fakeChange", filename,
                                   revision=revision, who=who)
        d.addErrback(self.err)

    def do_current(self, widget, state):
        if not self.remote:
            return
        name = self.buildname.get_text()
        d = self.remote.callRemote("setCurrentState", name, state)
        d.addErrback(self.err)
    def err(self, failure):
        print "received error"
        failure.printTraceback()
        

    def run(self):
        reactor.run()

if __name__ == '__main__':
    master = "localhost:8007"
    if len(sys.argv) > 1:
        master = sys.argv[1]
    passwd = "debugpw"
    if len(sys.argv) > 2:
        passwd = sys.argv[2]
    d = DebugWidget(master, passwd)
    d.run()





More information about the Commits mailing list