Example #1
0
 def run_delayed_op(self, operation, option_id):
     """Run one delayed operation"""
     self.ui.update_progress_bar(0.0)
     if 'free_disk_space' == option_id:
         # TRANSLATORS: 'free' means 'unallocated'
         msg = _("Please wait.  Wiping free disk space.")
     elif 'memory' == option_id:
         msg = _("Please wait.  Cleaning %s.") % _("Memory")
     else:
         raise RuntimeError("Unexpected option_id in delayed ops")
     self.ui.update_progress_bar(msg)
     for cmd in backends[operation].get_commands(option_id):
         for ret in self.execute(cmd, '%s.%s' % (operation, option_id)):
             if isinstance(ret, tuple):
                 # Display progress (for free disk space)
                 # 진행 상황을 표시(사용 가능한 디스크 공간)
                 phase = ret[
                     0]  # 1=wipe free disk space, 2=wipe inodes, 3=clean up inodes files
                 percent_done = ret[1]
                 eta_seconds = ret[2]
                 self.ui.update_progress_bar(percent_done)
                 if phase == 2:
                     msg = _('Please wait. Wiping file system metadata.')
                 elif phase == 3:
                     msg = _(
                         'Please wait. Cleaning up after wiping file system metadata.'
                     )
                 if isinstance(eta_seconds, int):
                     eta_mins = math.ceil(eta_seconds / 60)
                     msg2 = ungettext("About %d minute remaining.",
                                      "About %d minutes remaining.", eta_mins) \
                         % eta_mins
                     self.ui.update_progress_bar(msg + ' ' + msg2)
                 else:
                     self.ui.update_progress_bar(msg)
             if True == ret or isinstance(ret, tuple):
                 # Return control to PyGTK idle loop to keep
                 # it responding and allow the user to abort.
                 # PyGTK 유휴 루프에 컨트롤을 되돌려 보관
                 # 응답하고 사용자가 중단하도록 한다
                 yield True
Example #2
0
 def run_delayed_op(self, operation, option_id):
     """Run one delayed operation"""
     self.ui.update_progress_bar(0.0)
     if 'free_disk_space' == option_id:
         # TRANSLATORS: 'free' means 'unallocated'
         msg = _("Please wait.  Wiping free disk space.")
         self.ui.append_text(
             _('Wiping free disk space erases remnants of files that were deleted without shredding. It does not free up space.'
               ))
     elif 'memory' == option_id:
         msg = _("Please wait.  Cleaning %s.") % _("Memory")
     else:
         raise RuntimeError("Unexpected option_id in delayed ops")
     self.ui.update_progress_bar(msg)
     for cmd in backends[operation].get_commands(option_id):
         for ret in self.execute(cmd, '%s.%s' % (operation, option_id)):
             if isinstance(ret, tuple):
                 # Display progress (for free disk space)
                 phase = ret[0]
                 # A while ago there were other phase numbers. Currently it's just 1
                 if phase != 1:
                     raise RuntimeError(
                         'While wiping free space, unexpected phase %d' %
                         phase)
                 percent_done = ret[1]
                 eta_seconds = ret[2]
                 self.ui.update_progress_bar(percent_done)
                 if isinstance(eta_seconds, int):
                     eta_mins = math.ceil(eta_seconds / 60)
                     msg2 = ungettext("About %d minute remaining.",
                                      "About %d minutes remaining.", eta_mins) \
                         % eta_mins
                     self.ui.update_progress_bar(msg + ' ' + msg2)
                 else:
                     self.ui.update_progress_bar(msg)
             if self.is_aborted:
                 break
             if True == ret or isinstance(ret, tuple):
                 # Return control to PyGTK idle loop to keep
                 # it responding and allow the user to abort.
                 yield True
Example #3
0
 def run_delayed_op(self, operation, option_id):
     """Run one delayed operation"""
     self.ui.update_progress_bar(0.0)
     if 'free_disk_space' == option_id:
         # TRANSLATORS: 'free' means 'unallocated'
         msg = _("Please wait.  Wiping free disk space.")
     elif 'memory' == option_id:
         msg = _("Please wait.  Cleaning %s.") % _("Memory")
     else:
         raise RuntimeError("Unexpected option_id in delayed ops")
     self.ui.update_progress_bar(msg)
     for cmd in backends[operation].get_commands(option_id):
         old_phase = None
         for ret in self.execute(cmd):
             if isinstance(ret, tuple):
                 # Display progress (for free disk space)
                 phase = ret[
                     0]  # 1=wipe free disk space, 2=wipe inodes, 3=clean up inodes files
                 percent_done = ret[1]
                 eta_seconds = ret[2]
                 self.ui.update_progress_bar(percent_done)
                 if phase == 2:
                     msg = _('Please wait. Wiping file system metadata.')
                 elif phase == 3:
                     msg = _(
                         'Please wait. Cleaning up after wiping file system metadata.')
                 if isinstance(eta_seconds, int):
                     eta_mins = math.ceil(eta_seconds / 60)
                     msg2 = ungettext("About %d minute remaining.",
                                      "About %d minutes remaining.", eta_mins) \
                         % eta_mins
                     self.ui.update_progress_bar(msg + ' ' + msg2)
                 else:
                     self.ui.update_progress_bar(msg)
             if True == ret or isinstance(ret, tuple):
                 # Return control to PyGTK idle loop to keep
                 # it responding and allow the user to abort.
                 yield True