PERFORCE change 121134 for review
Andrew Turner
andrew at FreeBSD.org
Thu Jun 7 08:47:44 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=121134
Change 121134 by andrew at andrew_hermies on 2007/06/07 08:47:15
Create a facund Python package to contain front-end code that could be used by other front-ends
Move the network code to the facund.network package
Load the Glade file in and display it
Affected files ...
.. //depot/projects/soc2007/andrew-update/frontend/facund.py#2 edit
.. //depot/projects/soc2007/andrew-update/frontend/facund/__init__.py#1 add
.. //depot/projects/soc2007/andrew-update/frontend/facund/gui/__init__.py#1 add
.. //depot/projects/soc2007/andrew-update/frontend/facund/gui/computer_model.py#1 add
.. //depot/projects/soc2007/andrew-update/frontend/facund/gui/main_window.py#1 add
.. //depot/projects/soc2007/andrew-update/frontend/facund/network/__init__.py#1 add
Differences ...
==== //depot/projects/soc2007/andrew-update/frontend/facund.py#2 (text+ko) ====
@@ -1,42 +1,21 @@
#!/usr/local/bin/python
-import xml.sax.handler
import socket
+import facund.gui, facund.network
-class FacundConnection(xml.sax.handler.ContentHandler):
- """A class that works as a client with the Facund XML IPC"""
- def __init__(self, server):
- self.isReady = False
- self.bufSize = 1024
- self.socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
- self.socket.connect(server)
- self.socket.send("<facund-client version=\"0\"/>")
- self.parser = xml.sax.make_parser()
- self.parser.setContentHandler(self)
+#try:
+# fc = facund.network.Connection("/tmp/facund")
+#except socket.error:
+# print "Couldn't connect to the back-end"
+#while True:
+# fc.interact()
- # Mark the class as ready and able to hav __del__ called
- self.isReady = True
-
- def __del__(self):
- if self.isReady:
- self.parser.close()
- self.socket.send("</facund-client>")
-
- def interact(self):
- data = self.socket.recv(self.bufSize)
- self.parser.feed(data)
-
- def startElement(self, name, attributes):
- print "> " + name
-
if __name__ == "__main__":
- try:
- fc = FacundConnection("/tmp/facund")
+ model = facund.gui.ComputerTreeModel()
+ mainWindow = facund.gui.MainWindow('facund-fe.glade')
+ mainWindow.setComputerTreeModel(model)
- while True:
- fc.interact()
+ mainWindow.run()
- except socket.error:
- print "Couldn't connect to the back-end"
More information about the p4-projects
mailing list