Exemplo n.º 1
0
 def refresh_device_list(self):
   treeview_backups_model = self.xml.get_widget('treeview_backups').get_model()
   treeview_backups_model.clear()
   known_backups = backup.get_known_backups()
   for t in known_backups:
     uuid = t['uuid']
     paths = backup.get_dev_paths_for_uuid(t['uuid'])
     drive_name = 'UUID: '+ t['uuid']
     for path in paths:
       if 'disk/by-id' in path:
         drive_name = path[path.index('disk/by-id')+11:]
     free_space = util.humanize_bytes(backup.get_free_space(t['uuid']))
     drive_name = backup.get_mount_point_for_uuid(t['uuid']) + ' (%s free)' % free_space
     s = "<b>Drive:</b> %s\n<b>Source:</b> <i>%s</i>:%s\n" % (util.pango_escape(drive_name), util.pango_escape(t['host']), util.pango_escape(t['path']), )
     if backup.is_dev_present(t['uuid']) and backup.get_hostname()==t['host']:
       s += "<b>Status:</b> Drive is ready for backups"
     else:
       if backup.is_dev_present(t['uuid']) and backup.get_hostname()!=t['host']:
         s += "<b>Status:</b> Backup available for export only (was created on another computer)"
       else:
         s += "<b>Status:</b> Drive is unavailable (please attach)"
     if backup.get_device_type(uuid)=='gvfs':
       icon = self.main_window.render_icon(gtk.STOCK_NETWORK, gtk.ICON_SIZE_DIALOG)
     elif backup.get_device_type(uuid)=='local':
       icon = self.main_window.render_icon(gtk.STOCK_HARDDISK, gtk.ICON_SIZE_DIALOG)
     else:
       icon = self.main_window.render_icon(gtk.STOCK_DIALOG_QUESTION, gtk.ICON_SIZE_DIALOG)
     treeview_backups_model.append( (icon, s, backup.is_dev_present(t['uuid']), t['uuid'], t['host'], t['path']) )
   if known_backups:
     treeview_backups_model.append( (self.main_window.render_icon(gtk.STOCK_ADD, gtk.ICON_SIZE_DIALOG), 'Double-click here to create a new backup...', True, None, None, None) )
   else:
     treeview_backups_model.append( (self.main_window.render_icon(gtk.STOCK_ADD, gtk.ICON_SIZE_DIALOG), 'No existing backups found.\nDouble-click here to create a new backup...', True, None, None, None) )
Exemplo n.º 2
0
def run_all_backups():
  for t in backup.get_known_backups():
    uuid = t['uuid']
    host = t['host']
    path = t['path']
    if backup.test_backup_assertions(uuid, host, path):
      print '---=== starting backup:', uuid, path, '===---'
      try: backup.backup(uuid, host, path)
      except: traceback.print_exc()
    else:
      print '---=== skipped backup:', uuid, path, '===---'
Exemplo n.º 3
0
 def refresh_device_list(self):
     treeview_backups_model = self.xml.get_widget("treeview_backups").get_model()
     treeview_backups_model.clear()
     known_backups = backup.get_known_backups()
     for t in known_backups:
         uuid = t["uuid"]
         paths = backup.get_dev_paths_for_uuid(t["uuid"])
         drive_name = "UUID: " + t["uuid"]
         for path in paths:
             if "disk/by-id" in path:
                 drive_name = path[path.index("disk/by-id") + 11 :]
         free_space = util.humanize_bytes(backup.get_free_space(t["uuid"]))
         drive_name = backup.get_mount_point_for_uuid(t["uuid"]) + " (%s free)" % free_space
         s = "<b>Drive:</b> %s\n<b>Source:</b> <i>%s</i>:%s\n" % (
             util.pango_escape(drive_name),
             util.pango_escape(t["host"]),
             util.pango_escape(t["path"]),
         )
         if backup.is_dev_present(t["uuid"]) and backup.get_hostname() == t["host"]:
             s += "<b>Status:</b> Drive is ready for backups"
         else:
             if backup.is_dev_present(t["uuid"]) and backup.get_hostname() != t["host"]:
                 s += "<b>Status:</b> Backup available for export only (was created on another computer)"
             else:
                 s += "<b>Status:</b> Drive is unavailable (please attach)"
         if backup.get_device_type(uuid) == "gvfs":
             icon = self.main_window.render_icon(gtk.STOCK_NETWORK, gtk.ICON_SIZE_DIALOG)
         elif backup.get_device_type(uuid) == "local":
             icon = self.main_window.render_icon(gtk.STOCK_HARDDISK, gtk.ICON_SIZE_DIALOG)
         else:
             icon = self.main_window.render_icon(gtk.STOCK_DIALOG_QUESTION, gtk.ICON_SIZE_DIALOG)
         treeview_backups_model.append((icon, s, backup.is_dev_present(t["uuid"]), t["uuid"], t["host"], t["path"]))
     if known_backups:
         treeview_backups_model.append(
             (
                 self.main_window.render_icon(gtk.STOCK_ADD, gtk.ICON_SIZE_DIALOG),
                 "Double-click here to create a new backup...",
                 True,
                 None,
                 None,
                 None,
             )
         )
     else:
         treeview_backups_model.append(
             (
                 self.main_window.render_icon(gtk.STOCK_ADD, gtk.ICON_SIZE_DIALOG),
                 "No existing backups found.\nDouble-click here to create a new backup...",
                 True,
                 None,
                 None,
                 None,
             )
         )
Exemplo n.º 4
0
def run_all_backups():
    for t in backup.get_known_backups():
        uuid = t['uuid']
        host = t['host']
        path = t['path']
        if backup.test_backup_assertions(uuid, host, path):
            print '---=== starting backup:', uuid, path, '===---'
            try:
                backup.backup(uuid, host, path)
            except:
                traceback.print_exc()
        else:
            print '---=== skipped backup:', uuid, path, '===---'