예제 #1
0
 def refresh_device_list(self):
     treeview_backups_model = self.xml.get_widget(
         'treeview_backups').get_model()
     treeview_backups_model.clear()
     writable_devices = backup.get_writable_devices()
     for uuid in writable_devices:
         path = backup.get_mount_point_for_uuid(uuid)
         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)
         free_space = util.humanize_bytes(backup.get_free_space(uuid))
         s = "<b>Drive:</b> %s\n<b>Mount Point:</b> %s\n<b>Free Space:</b> %s" % (
             util.pango_escape(uuid), util.pango_escape(path),
             util.pango_escape(free_space))
         treeview_backups_model.append(
             (icon, s, backup.is_dev_present(uuid), uuid))
     if not writable_devices:
         icon = self.main_window.render_icon(gtk.STOCK_INFO,
                                             gtk.ICON_SIZE_DIALOG)
         s = 'In order to create a backup, Flyback needs a hard drive\nother than the one your computer boots from.\n(preferably external and removable)  Please plug one\ninto a free USB or eSATA port...'
         treeview_backups_model.append((icon, s, False, None))
         self.xml.get_widget('button_new').set_sensitive(False)
     else:
         self.xml.get_widget('button_new').set_sensitive(True)
예제 #2
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) )
예제 #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,
             )
         )
예제 #4
0
 def refresh_device_list(self):
   treeview_backups_model = self.xml.get_widget('treeview_backups').get_model()
   treeview_backups_model.clear()
   writable_devices = backup.get_writable_devices()
   for uuid in writable_devices:
     path = backup.get_mount_point_for_uuid(uuid)
     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)
     free_space = util.humanize_bytes(backup.get_free_space(uuid))
     s = "<b>Drive:</b> %s\n<b>Mount Point:</b> %s\n<b>Free Space:</b> %s" % (util.pango_escape(uuid), util.pango_escape(path), util.pango_escape(free_space))
     treeview_backups_model.append( (icon, s, backup.is_dev_present(uuid), uuid) )
   if not writable_devices:
     icon = self.main_window.render_icon(gtk.STOCK_INFO, gtk.ICON_SIZE_DIALOG)
     s = 'In order to create a backup, Flyback needs a hard drive\nother than the one your computer boots from.\n(preferably external and removable)  Please plug one\ninto a free USB or eSATA port...'
     treeview_backups_model.append( (icon, s, False, None) )
     self.xml.get_widget('button_new').set_sensitive(False)
   else:
     self.xml.get_widget('button_new').set_sensitive(True)