def finished(self): if self.running_tasks: raise RuntimeError TaskQueue.finished(self) self.window.set_sensitive() self.window.conversion_ended() total_time = self.run_finish_time - self.run_start_time msg = _('Conversion done, in %s') % self.format_time(total_time) if self.error_count: msg += ', %d error(s)' % self.error_count self.window.set_status(msg) if not self.window.is_active(): notification(msg) # this must move self.reset_counters()
def finished(self): # This must be called with emit_async if self.running_tasks: raise RuntimeError TaskQueue.finished(self) self.window.set_sensitive() self.window.conversion_ended() total_time = self.run_finish_time - self.run_start_time msg = _("Conversion done in %s") % self.format_time(total_time) if self.error_count: msg += ", %d error(s)" % self.error_count self.window.set_status(msg) if not self.window.is_active(): notification(msg) # this must move self.reset_counters()
def finished(self): # This must be called with emit_async if self.running_tasks: raise RuntimeError TaskQueue.finished(self) self.window.set_sensitive() self.window.conversion_ended() total_time = self.run_finish_time - self.run_start_time msg = _('Conversion done in %s') % self.format_time(total_time) if self.error_count: msg += ', %d error(s)' % self.error_count self.window.set_status(msg) if not self.window.is_active(): notification(msg) # this must move self.reset_counters()
def cli_convert_main(input_files): loop = gobject.MainLoop() gobject.threads_init() context = loop.get_context() error.set_error_handler(error.ErrorPrinter()) output_type = settings['cli-output-type'] output_suffix = settings['cli-output-suffix'] generator = TargetNameGenerator() generator.suffix = output_suffix progress = CliProgress() queue = TaskQueue() for input_file in input_files: input_file = SoundFile(input_file) output_name = generator.get_target_name(input_file) c = Converter(input_file, output_name, output_type) c.init() c.start() while c.running: if c.get_duration(): percent = min(100, 100.0 * (c.get_position() / c.get_duration())) percent = '%.1f %%' % percent else: percent = '/-\|'[int(time.time()) % 4] progress.show( '%s: %s' % (unquote_filename(c.sound_file.filename[-65:]), percent)) time.sleep(0.01) context.iteration(True) print previous_filename = None ''' queue.start() #running, progress = queue.get_progress(perfile) while queue.running: t = None #queue.get_current_task() if t and not settings['quiet']: if previous_filename != t.sound_file.get_filename_for_display(): if previous_filename: print _('%s: OK') % previous_filename previous_filename = t.sound_file.get_filename_for_display() percent = 0 if t.get_duration(): percent = '%.1f %%' % ( 100.0* (t.get_position() / t.get_duration() )) else: percent = '/-\|' [int(time.time()) % 4] progress.show('%s: %s' % (t.sound_file.get_filename_for_display()[-65:], percent )) time.sleep(0.10) context.iteration(True) ''' if not settings['quiet']: progress.clear()
def abort(self): TaskQueue.abort(self) self.window.set_sensitive() self.reset_counters()
def __init__(self, window): TaskQueue.__init__(self) self.window = window self.overwrite_action = None self.reset_counters()
def __init__(self, window): TaskQueue.__init__(self) self.window = window self.reset_counters()