Date: Sat, 18 Aug 2007 03:52:35 GMT From: Andrew Turner <andrew@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 125286 for review Message-ID: <200708180352.l7I3qZ4a054542@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=125286 Change 125286 by andrew@andrew_hermies on 2007/08/18 03:52:19 Remove most of the menu as it was unused Add a dialog box to add new computers Add a menu item to remove computers from the gui Affected files ... .. //depot/projects/soc2007/andrew-update/frontend/facund-fe.glade#5 edit .. //depot/projects/soc2007/andrew-update/frontend/facund.py#10 edit .. //depot/projects/soc2007/andrew-update/frontend/facund/__init__.py#7 edit .. //depot/projects/soc2007/andrew-update/frontend/facund/computer.py#12 edit .. //depot/projects/soc2007/andrew-update/frontend/facund/gui/__init__.py#5 edit .. //depot/projects/soc2007/andrew-update/frontend/facund/gui/computer_model.py#7 edit .. //depot/projects/soc2007/andrew-update/frontend/facund/gui/main_window.py#11 edit .. //depot/projects/soc2007/andrew-update/frontend/facund/network/__init__.py#12 edit Differences ... ==== //depot/projects/soc2007/andrew-update/frontend/facund-fe.glade#5 (text+ko) ==== @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd"> -<!--Generated with glade3 3.2.2 on Sun Jul 22 15:49:07 2007 by andrew@hermies.int.fubar.geek.nz--> +<!--Generated with glade3 3.2.2 on Thu Aug 16 12:34:07 2007 by andrew@hermies.int.fubar.geek.nz--> <glade-interface> <widget class="GtkWindow" id="facundWindow"> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> @@ -23,7 +23,7 @@ <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <child> - <widget class="GtkImageMenuItem" id="imagemenuitem1"> + <widget class="GtkImageMenuItem" id="newConnection"> <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="label" translatable="yes">gtk-new</property> @@ -32,40 +32,22 @@ </widget> </child> <child> - <widget class="GtkImageMenuItem" id="imagemenuitem2"> + <widget class="GtkImageMenuItem" id="delConnection"> <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">gtk-open</property> - <property name="use_underline">True</property> - <property name="use_stock">True</property> - </widget> - </child> - <child> - <widget class="GtkImageMenuItem" id="imagemenuitem3"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">gtk-save</property> + <property name="label" translatable="yes">gtk-delete</property> <property name="use_underline">True</property> <property name="use_stock">True</property> </widget> </child> <child> - <widget class="GtkImageMenuItem" id="imagemenuitem4"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">gtk-save-as</property> - <property name="use_underline">True</property> - <property name="use_stock">True</property> - </widget> - </child> - <child> <widget class="GtkSeparatorMenuItem" id="separatormenuitem1"> <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> </widget> </child> <child> - <widget class="GtkImageMenuItem" id="imagemenuitem5"> + <widget class="GtkImageMenuItem" id="progQuit"> <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="label" translatable="yes">gtk-quit</property> @@ -77,87 +59,6 @@ </child> </widget> </child> - <child> - <widget class="GtkMenuItem" id="menuitem2"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">_Edit</property> - <property name="use_underline">True</property> - <child> - <widget class="GtkMenu" id="menu2"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <child> - <widget class="GtkImageMenuItem" id="imagemenuitem6"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">gtk-cut</property> - <property name="use_underline">True</property> - <property name="use_stock">True</property> - </widget> - </child> - <child> - <widget class="GtkImageMenuItem" id="imagemenuitem7"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">gtk-copy</property> - <property name="use_underline">True</property> - <property name="use_stock">True</property> - </widget> - </child> - <child> - <widget class="GtkImageMenuItem" id="imagemenuitem8"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">gtk-paste</property> - <property name="use_underline">True</property> - <property name="use_stock">True</property> - </widget> - </child> - <child> - <widget class="GtkImageMenuItem" id="imagemenuitem9"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">gtk-delete</property> - <property name="use_underline">True</property> - <property name="use_stock">True</property> - </widget> - </child> - </widget> - </child> - </widget> - </child> - <child> - <widget class="GtkMenuItem" id="menuitem3"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">_View</property> - <property name="use_underline">True</property> - </widget> - </child> - <child> - <widget class="GtkMenuItem" id="menuitem4"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">_Help</property> - <property name="use_underline">True</property> - <child> - <widget class="GtkMenu" id="menu3"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <child> - <widget class="GtkImageMenuItem" id="imagemenuitem10"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">gtk-about</property> - <property name="use_underline">True</property> - <property name="use_stock">True</property> - </widget> - </child> - </widget> - </child> - </widget> - </child> </widget> <packing> <property name="expand">False</property> @@ -209,19 +110,27 @@ <property name="column_spacing">5</property> <property name="row_spacing">5</property> <child> - <widget class="GtkButton" id="deinstallButton"> + <widget class="GtkButton" id="connectButton"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="label" translatable="yes">Connect</property> + <property name="response_id">0</property> + </widget> + </child> + <child> + <widget class="GtkButton" id="disconnectButton"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">Remove</property> + <property name="label" translatable="yes">Disconnect</property> <property name="response_id">0</property> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> </packing> </child> <child> @@ -239,29 +148,21 @@ </packing> </child> <child> - <widget class="GtkButton" id="disconnectButton"> + <widget class="GtkButton" id="deinstallButton"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">Disconnect</property> + <property name="label" translatable="yes">Remove</property> <property name="response_id">0</property> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> </packing> </child> - <child> - <widget class="GtkButton" id="connectButton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">Connect</property> - <property name="response_id">0</property> - </widget> - </child> </widget> <packing> <property name="expand">False</property> @@ -339,4 +240,140 @@ </widget> </child> </widget> + <widget class="GtkDialog" id="newConnectionDialog"> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="border_width">5</property> + <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property> + <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> + <property name="deletable">False</property> + <property name="has_separator">False</property> + <child internal-child="vbox"> + <widget class="GtkVBox" id="dialog-vbox1"> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="spacing">2</property> + <child> + <widget class="GtkTable" id="table2"> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="n_rows">3</property> + <property name="n_columns">2</property> + <property name="column_spacing">3</property> + <property name="row_spacing">10</property> + <child> + <widget class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="label" translatable="yes">Computer's description +This is a Human redable +name for the computer</property> + </widget> + </child> + <child> + <widget class="GtkEntry" id="computerNameEntry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + </packing> + </child> + <child> + <widget class="GtkEntry" id="computerEntry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + </packing> + </child> + <child> + <widget class="GtkEntry" id="socketEntry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="label" translatable="yes">Computer's name +leave blank for the +local computer</property> + </widget> + <packing> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="label" translatable="yes">Socket location +Leave blank for +the default socket</property> + </widget> + <packing> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + </packing> + </child> + </widget> + <packing> + <property name="position">1</property> + </packing> + </child> + <child internal-child="action_area"> + <widget class="GtkHButtonBox" id="dialog-action_area1"> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="layout_style">GTK_BUTTONBOX_END</property> + <child> + <widget class="GtkButton" id="newConnectionSave"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="label" translatable="yes">gtk-save</property> + <property name="use_stock">True</property> + <property name="response_id">0</property> + </widget> + </child> + <child> + <widget class="GtkButton" id="newConnectionCancel"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="label" translatable="yes">gtk-cancel</property> + <property name="use_stock">True</property> + <property name="response_id">0</property> + </widget> + <packing> + <property name="position">1</property> + </packing> + </child> + </widget> + <packing> + <property name="expand">False</property> + <property name="pack_type">GTK_PACK_END</property> + </packing> + </child> + </widget> + </child> + </widget> </glade-interface> ==== //depot/projects/soc2007/andrew-update/frontend/facund.py#10 (text+ko) ==== @@ -38,9 +38,18 @@ # fc.interact() if __name__ == "__main__": + computerList = facund.ComputerList() + computers = computerList.getComputerList() + computerModel = facund.gui.ComputerTreeModel() - localComputer = facund.Computer("Local computer", '/tmp/facund') - computerModel.addComputer(localComputer) + for i in range(len(computers)): + computer = facund.Computer(computers[i][0], computers[i][1], + computers[i][2]) + computerModel.addComputer(computer) + + # If we nee the computer list again we gan get it in the same way + del computers + del computerList updateModel = facund.gui.UpdateListModel() ==== //depot/projects/soc2007/andrew-update/frontend/facund/__init__.py#7 (text+ko) ==== @@ -26,6 +26,7 @@ from call import * from computer import * +from computer_list import * from controller import * from data import * ==== //depot/projects/soc2007/andrew-update/frontend/facund/computer.py#12 (text+ko) ==== @@ -45,17 +45,18 @@ class Computer(threading.Thread): '''A class to describe each computer able to be connected to''' - def __init__(self, name, host): + def __init__(self, name, host, socket): threading.Thread.__init__(self) self.__name = name self.__host = host + self.__socket = socket self.__dirs = [] self.__connected = False self.__connection = None self.__commands = ['Avaliable', 'Installed'] def __str__(self): - return self.__name + ": " + self.__host + return self.__name + ": " + (self.__host or self.__socket) def addDir(self, dir): '''Adds a directory to the avaliable directories to update''' @@ -77,6 +78,9 @@ '''Returns the hostname/ip of the computer''' return self.__host + def getSocket(self): + return self.__socket + def getCommands(self, dir): return self.__commands @@ -156,7 +160,7 @@ try: self.__connection = \ - facund.network.Connection(self.__host) + facund.network.Connection(self.__host, self.__socket) # Start the communication thread self.start() @@ -173,7 +177,7 @@ for dir in dirs: self.addDir(dir.getData()) except socket.error: - print "Couldn't connect to " + self.__host + print "Couldn't connect to %s " % (self.__host or self.__socket) del self.__connection self.__connection = None ==== //depot/projects/soc2007/andrew-update/frontend/facund/gui/__init__.py#5 (text+ko) ==== @@ -25,5 +25,6 @@ # from computer_model import ComputerTreeModel +from connection_dialog import ConnectionDialog from main_window import MainWindow from update_model import UpdateListModel ==== //depot/projects/soc2007/andrew-update/frontend/facund/gui/computer_model.py#7 (text+ko) ==== @@ -75,15 +75,11 @@ return self.__computers[name] def removeComputer(self, computer): - '''Removes a computer from the computer tree. TODO: Implement''' - iter = self.get_iter_from_string(computer) - print iter - - def addBaseDir(self, computer, dir): - '''Adds a base directory to manage to a computer. TODO: Implement''' - pass - - def removeBaseDir(self, computer, dir): - '''Removes a base directory from a computer. TODO: Implement''' - pass + '''Removes a computer from the computer tree''' + computer_name = computer.getName() + if self.__computers.has_key(computer_name) and \ + self.__iterators.has_key(computer): + del self.__computers[computer_name] + iter = self.__iterators[computer] + self.remove(iter) ==== //depot/projects/soc2007/andrew-update/frontend/facund/gui/main_window.py#11 (text+ko) ==== @@ -24,6 +24,7 @@ # SUCH DAMAGE. # +import facund import gtk import gtk.gdk import gtk.glade @@ -37,7 +38,79 @@ self.__xml = gtk.glade.XML(glade_file) self.__widget = self.__xml.get_widget('facundWindow') - self.__widget.connect('destroy', lambda *w: gtk.main_quit()) + self.__widget.connect('destroy', self.onQuit) + + # Open the new computer window on File > New + menuItem = self.__xml.get_widget('newConnection') + menuItem.connect('activate', self.newConnection) + + # Remove the selected computer on File > Delete + menuItem = self.__xml.get_widget('delConnection') + menuItem.connect('activate', self.delConnection) + + # Attach the quit signal to File > Quit + menuItem = self.__xml.get_widget('progQuit') + menuItem.connect('activate', self.onQuit) + + self.__newConnectionDialog = None + + # Connect the signals to the new connection dialog box + button = self.__xml.get_widget('newConnectionCancel') + button.connect('clicked', self.connectionCancel) + + button = self.__xml.get_widget('newConnectionSave') + button.connect('clicked', self.connectionSave) + + def onQuit(self, data): + gtk.main_quit() + + def newConnection(self, data): + widget = self.__xml.get_widget('newConnectionDialog') + self.__newConnectionDialog = widget + self.__newConnectionDialog.show() + + def delConnection(self, data): + # Make sure the we have disconnected + self.onDisconnectClick(data) + computer = self.__controller.getCurrentComputer() + computerList = facund.ComputerList() + computerList.delComputer(computer) + self.__computerTreeModel.removeComputer(computer) + del computerList + + def connectionCancel(self, data): + self.__newConnectionDialog.hide() + self.__newConnectionDialog = None + + self.__xml.get_widget('computerNameEntry').set_text('') + self.__xml.get_widget('computerEntry').set_text('') + self.__xml.get_widget('computerEntry').set_text('') + + def connectionSave(self, data): + item = self.__xml.get_widget('computerEntry') + server = item.get_text() + if server is '': + server = None + + item = self.__xml.get_widget('socketEntry') + socket = item.get_text() + if socket is '': + socket = '/tmp/facund' + + item = self.__xml.get_widget('computerNameEntry') + name = item.get_text() + if name is '': + name = server or 'Local Computer' + + computer = facund.Computer(name, server, socket) + computerList = facund.ComputerList() + computerList.addComputer(computer) + del computerList + self.__computerTreeModel.addComputer(computer) + + # Use the connectionCancel handler as it + # closes the dialog and cleans up the fields + self.connectionCancel(data) def setController(self, controller): self.__controller = controller ==== //depot/projects/soc2007/andrew-update/frontend/facund/network/__init__.py#12 (text+ko) ==== @@ -33,10 +33,10 @@ import xml.sax.handler class PipeComms: - def __init__(self, server): - self.popen = subprocess.Popen(["/usr/bin/ssh", server, "/usr/bin/nc -oU /tmp/facund"], stdin=subprocess.PIPE, stdout=subprocess.PIPE) - print self.popen.stdout + def __init__(self, server, socket): + self.popen = subprocess.Popen(["/usr/bin/ssh", server, "/usr/bin/nc -oU %s" % socket], stdin=subprocess.PIPE, stdout=subprocess.PIPE) self.stdout = self.popen.stdout.fileno() + print poll() def read(self, len): return os.read(self.stdout, len) @@ -57,7 +57,7 @@ class Connection(xml.sax.handler.ContentHandler): '''A class that works as a client with the Facund XML IPC''' - def __init__(self, server): + def __init__(self, server, socket): self.isReady = False self.connectionType = "unix" @@ -65,10 +65,10 @@ self.__calls = {} self.bufSize = 1024 - if self.connectionType == "unix": - self.__connection = SocketComms(server) - elif self.connectionType == "pipe": - self.__connection = PipeComms(server) + if server is None: + self.__connection = SocketComms(socket) + else: + self.__connection = PipeComms(server, socket) self.send("<facund-client version=\"0\">")
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200708180352.l7I3qZ4a054542>