def __init__(self, id, nick, filename, size, resumable): InlineDialog.__init__(self, buttons = (gtk.STOCK_OK, gtk.RESPONSE_OK, gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE), icon = gtk.STOCK_DIALOG_INFO) self.table = gtk.Table(rows = 3, columns = 2) self.transfer_id = id self.transfer_info = { "id": id, "nick": nick, "filename": filename, "size": size, "resumable": resumable, "original_directory": sushi.dcc_send_get(id, "directory")} self.label = gtk.Label(None) self._update_label() self.table.attach(self.label, 0, 2, 0, 2, xoptions = gtk.FILL) # Setup the destination chooser button self.destination_dialog = None self.destination_button = gtk.Button(_("Select destination")) self.destination_button.connect("clicked", self._destination_button_clicked_cb) self.table.attach(self.destination_button, 0, 1, 2, 3, xoptions = gtk.FILL) self.destination_button.set_property("border-width", 6) self.vbox.add(self.table)
def resumable_str(): if (self.transfer_info["resumable"] and sushi.dcc_send_get(self.transfer_id, "directory") \ == self.transfer_info["original_directory"]): return _("\n<b>Info:</b> If you don't choose another " "destination, this file will be resumed.") else: return ""
def _update_label(self): def resumable_str(): if (self.transfer_info["resumable"] and sushi.dcc_send_get(self.transfer_id, "directory") \ == self.transfer_info["original_directory"]): return _("\n<b>Info:</b> If you don't choose another " "destination, this file will be resumed.") else: return "" self.label.set_markup( "<b>"+_("Incoming file transfer")+"\n</b>"+ _( "Sender: ”%(nick)s”\n" "Filename: “%(filename)s“\n" "File size: %(bytes)d bytes\n" "Destination: %(destination)s" "%(resumable)s" % \ { "nick": self.transfer_info["nick"], "filename": self.transfer_info["filename"], "bytes": self.transfer_info["size"], "destination": sushi.dcc_send_get(self.transfer_id, "directory"), "resumable": resumable_str() }))