def _printConflictDetails(self, entry1, entry2, nameSource1, nameSource2): """ Supporting function to show differences for two contact entries Prints a table with all attributes being different in the two sources for comparing two contact entries. """ diffList = pisi.determineConflictDetails(entry1, entry2) print "\n " + "=" * 25 + " DETAILS " + "=" * 25 print "* %s, %s" %(entry1.attributes['lastname'],entry1.attributes['firstname']) print self._strFixedLen('Attribute', 15) + " | " + self._strFixedLen(nameSource1, 20) + " | " + self._strFixedLen(nameSource2, 20) print "-" * 60 for key in diffList.keys(): print self._strFixedLen(key, 15) + " | " + self._strFixedLen(self._getDetailValue(entry1.attributes, key), 20) + " | " + self._strFixedLen(self._getDetailValue(entry2.attributes, key), 20) print "-" * 60
def __init__(self, parent, entry1, entry2, nameSource1, nameSource2): """ Constructor - all components are assembled in here """ gtk.Dialog.__init__(self, "Details for conflict", parent, gtk.DIALOG_MODAL , ("Close",gtk.RESPONSE_OK)) self.set_size_request(600, 300) box = gtk.VBox(False, 5) l = gtk.Label("Details for <%s, %s>" %(entry1.attributes['lastname'],entry1.attributes['firstname'])) l.show() box.pack_start(l, False, False, 0) separator = gtk.HSeparator() box.pack_start(separator, False, True, 5) separator.show() diffList = pisi.determineConflictDetails(entry1, entry2) # boxH = gtk.HBox(False, 20) scrolled_window = gtk.ScrolledWindow() scrolled_window.set_border_width(10) scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_ALWAYS) box.pack_start(scrolled_window, True, True, 0) scrolled_window.show() table = gtk.Table(3, len(diffList.keys())+1, True) table.set_row_spacings(10) table.set_col_spacings(10) l = gtk.Label('Attribute') l.set_pattern('_' * len('Attribute')) l.set_use_underline(True) l.show() table.attach(l, 0, 1, 0, 1) l = gtk.Label(nameSource1) l.set_pattern('_' * len(nameSource1)) l.set_use_underline(True) l.show() table.attach(l, 1, 2, 0, 1) l = gtk.Label(nameSource2) l.set_pattern('_' * len(nameSource2)) l.set_use_underline(True) l.show() table.attach(l, 2, 3, 0, 1) y = 1 for key in diffList.keys(): l = gtk.Label(key) l.show() table.attach(l, 0, 1, y, y+1) l = gtk.Label(self._getDetailValue(entry1.attributes, key)) l.show() table.attach(l, 1, 2, y, y+1) l = gtk.Label(self._getDetailValue(entry2.attributes, key)) l.show() table.attach(l, 2, 3, y, y+1) y+=1 table.show() scrolled_window.add_with_viewport(table) # boxH.pack_start(table, False, True, 20) # boxH.show() # box.pack_start(boxH, False, True, 5) box.show() self.vbox.pack_start(box, True, True, 0)