| 319 | CANCELLED = 3 |
| 320 | |
| 321 | class RemuxProgressDialog(ProgressDialog): |
| 322 | def __init__(self, parent, fromname, toname): |
| 323 | ProgressDialog.__init__(self, |
| 324 | "Writing to disk", |
| 325 | ('Writing the newly synchronized <b>%s</b> ' |
| 326 | 'to <b>%s</b>. This may take some time.' |
| 327 | % (fromname, toname)), |
| 328 | 'Starting media pipeline', |
| 329 | parent, |
| 330 | gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, |
| 331 | (gtk.STOCK_CANCEL, CANCELLED, |
| 332 | gtk.STOCK_CLOSE, SUCCESS)) |
| 333 | self.set_completed(False) |
| 334 | |
| 335 | def update_position(self, pos, dur): |
| 336 | remaining = dur - pos |
| 337 | minutes = remaining // (gst.SECOND * 60) |
| 338 | seconds = (remaining - minutes * gst.SECOND * 60) // gst.SECOND |
| 339 | self.progress.set_text('%d:%02d of video remaining' % (minutes, seconds)) |
| 340 | self.progress.set_fraction(1.0 - float(remaining) / dur) |
| 341 | |
| 342 | def set_completed(self, completed): |
| 343 | self.set_response_sensitive(CANCELLED, not completed) |
| 344 | self.set_response_sensitive(SUCCESS, completed) |
| 345 | |
| 346 | class Resynchronizer(gst.Pipeline): |
| 347 | |