Esempio n. 1
0
 def update_revisions(self):
   revisions = backup.get_revisions(self.uuid, self.host, self.path)
   treeview_revisions_widget = self.xml.get_widget('treeview_revisions')
   treeview_revisions_model = treeview_revisions_widget.get_model()
   treeview_revisions_model.clear()
   for rev in revisions:
     s = 'Captured on: %s\nBy: <i>%s</i>' % ( util.pango_escape(rev['date']), util.pango_escape(rev['author']) )
     if rev['verified']:
       s += '\nVerified on: %s' % util.pango_escape(rev['verified']) #.strftime('%')
     treeview_revisions_model.append((s,rev['commit']))
Esempio n. 2
0
 def update_revisions(self):
     revisions = backup.get_revisions(self.uuid, self.host, self.path)
     treeview_revisions_widget = self.xml.get_widget('treeview_revisions')
     treeview_revisions_model = treeview_revisions_widget.get_model()
     treeview_revisions_model.clear()
     for rev in revisions:
         s = 'Captured on: %s\nBy: <i>%s</i>' % (util.pango_escape(
             rev['date']), util.pango_escape(rev['author']))
         if rev['verified']:
             s += '\nVerified on: %s' % util.pango_escape(
                 rev['verified'])  #.strftime('%')
         treeview_revisions_model.append((s, rev['commit']))
Esempio n. 3
0
  def __init__(self, register_gui, unregister_gui, uuid, host, path):

    self.register_gui = register_gui
    self.unregister_gui = unregister_gui
    self.uuid = uuid
    self.host = host
    self.path = path
    
    self.rev_files_map = {}
  
    self.xml = gtk.glade.XML( os.path.join( util.RUN_FROM_DIR, 'glade', 'manage_backup.glade' ) )
    self.main_window = self.xml.get_widget('window')
    self.main_window.connect("delete-event", self.close )
    icon = self.main_window.render_icon(gtk.STOCK_HARDDISK, gtk.ICON_SIZE_BUTTON)
    self.main_window.set_icon(icon)
    self.xml.get_widget('entry_drive_name').set_text( backup.get_drive_name(self.uuid) )
    self.xml.get_widget('entry_path').set_text( self.host +':'+ self.path )
    self.main_window.set_title('%s v%s - Manage Backup' % (settings.PROGRAM_NAME, settings.PROGRAM_VERSION))
    
    # toolbar
    self.xml.get_widget('toolbutton_backup').set_sensitive( backup.test_backup_assertions(self.uuid, self.host, self.path) )
    self.xml.get_widget('toolbutton_backup').connect('clicked', lambda x: self.start_backup() )
    self.xml.get_widget('toolbutton_status').set_sensitive( backup.test_backup_assertions(self.uuid, self.host, self.path) )
    self.xml.get_widget('toolbutton_status').connect('clicked', lambda x: self.start_status() )
    self.xml.get_widget('toolbutton_export').connect('clicked', lambda x: self.start_export() )
    self.xml.get_widget('toolbutton_explore').connect('clicked', lambda x: self.start_explore() )
    self.xml.get_widget('toolbutton_verify').connect('clicked', lambda x: self.start_verify() )
    self.xml.get_widget('toolbutton_preferences').connect('clicked', lambda x: self.open_preferences() )
    
    # revision list
    treeview_revisions_model = gtk.ListStore( str, str )
    treeview_revisions_widget = self.xml.get_widget('treeview_revisions')
    renderer = gtk.CellRendererText()
    treeview_revisions_widget.append_column( gtk.TreeViewColumn('History', renderer, markup=0) )
    treeview_revisions_widget.set_model(treeview_revisions_model)
    treeview_revisions_widget.connect( 'cursor-changed', self.update_files )
    treeview_revisions_widget.set_property('rules-hint', True)
    self.update_revisions()
    
    # file list
    treeview_files_widget = self.xml.get_widget('treeview_files')
    treeview_files_model = gtk.ListStore( str )
    renderer = gtk.CellRendererText()
    renderer.set_property('font','monospace')
    treeview_files_widget.append_column( gtk.TreeViewColumn('Files', renderer, markup=0) )
    treeview_files_widget.set_model(treeview_files_model)
    treeview_files_widget.set_property('rules-hint', True)
    treeview_files_model.append( (util.pango_escape('please select a revision to view... (on the left)'),) )

    # task list
    running_tasks_widget = self.xml.get_widget('running_tasks')
    running_tasks_model = gtk.ListStore( gtk.gdk.Pixbuf, str, gobject.TYPE_PYOBJECT, str )
    renderer = gtk.CellRendererPixbuf()
    renderer.set_property('xpad', 4)
    renderer.set_property('ypad', 4)
    running_tasks_widget.append_column( gtk.TreeViewColumn('', renderer, pixbuf=0) )
    renderer = gtk.CellRendererText()
    running_tasks_widget.append_column( gtk.TreeViewColumn('', renderer, markup=1) )
    renderer = gtk.CellRendererText()
    running_tasks_widget.append_column( gtk.TreeViewColumn('', renderer, markup=3) )
    running_tasks_widget.set_model(running_tasks_model)
    running_tasks_widget.set_headers_visible(False)
    running_tasks_widget.set_property('rules-hint', True)
    class T(threading.Thread):
      def run(self):
        while True:
          tasks_running = False
          gtk.gdk.threads_enter()
          for x in running_tasks_model:
            x[3] = util.humanize_time( datetime.datetime.now() - x[2] )
          gtk.gdk.threads_leave()
          if tasks_running: time.sleep(1)
          else: time.sleep(10)
    running_tasks_thread = T()
    running_tasks_thread.daemon = True
    running_tasks_thread.start()

    self.main_window.show()
    
    # if no revisions exist, prompt user to run backup
    if not backup.get_revisions(self.uuid, self.host, self.path):
      s = 'Welcome to Flyback!'
      md = gtk.MessageDialog(None, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, gtk.BUTTONS_CLOSE, s)
      md.format_secondary_markup('This is a brand new (and currently empty) backup repository.  To fill it with data, please click the "backup" button in the upper-left corner.')
      md.run()
      md.destroy()
Esempio n. 4
0
    def __init__(self, register_gui, unregister_gui, uuid, host, path):

        self.register_gui = register_gui
        self.unregister_gui = unregister_gui
        self.uuid = uuid
        self.host = host
        self.path = path

        self.rev_files_map = {}

        self.xml = gtk.glade.XML(
            os.path.join(util.RUN_FROM_DIR, 'glade', 'manage_backup.glade'))
        self.main_window = self.xml.get_widget('window')
        self.main_window.connect("delete-event", self.close)
        icon = self.main_window.render_icon(gtk.STOCK_HARDDISK,
                                            gtk.ICON_SIZE_BUTTON)
        self.main_window.set_icon(icon)
        self.xml.get_widget('entry_drive_name').set_text(
            backup.get_drive_name(self.uuid))
        self.xml.get_widget('entry_path').set_text(self.host + ':' + self.path)
        self.main_window.set_title(
            '%s v%s - Manage Backup' %
            (settings.PROGRAM_NAME, settings.PROGRAM_VERSION))

        # toolbar
        self.xml.get_widget('toolbutton_backup').set_sensitive(
            backup.test_backup_assertions(self.uuid, self.host, self.path))
        self.xml.get_widget('toolbutton_backup').connect(
            'clicked', lambda x: self.start_backup())
        self.xml.get_widget('toolbutton_status').set_sensitive(
            backup.test_backup_assertions(self.uuid, self.host, self.path))
        self.xml.get_widget('toolbutton_status').connect(
            'clicked', lambda x: self.start_status())
        self.xml.get_widget('toolbutton_export').connect(
            'clicked', lambda x: self.start_export())
        self.xml.get_widget('toolbutton_explore').connect(
            'clicked', lambda x: self.start_explore())
        self.xml.get_widget('toolbutton_verify').connect(
            'clicked', lambda x: self.start_verify())
        self.xml.get_widget('toolbutton_preferences').connect(
            'clicked', lambda x: self.open_preferences())

        # revision list
        treeview_revisions_model = gtk.ListStore(str, str)
        treeview_revisions_widget = self.xml.get_widget('treeview_revisions')
        renderer = gtk.CellRendererText()
        treeview_revisions_widget.append_column(
            gtk.TreeViewColumn('History', renderer, markup=0))
        treeview_revisions_widget.set_model(treeview_revisions_model)
        treeview_revisions_widget.connect('cursor-changed', self.update_files)
        treeview_revisions_widget.set_property('rules-hint', True)
        self.update_revisions()

        # file list
        treeview_files_widget = self.xml.get_widget('treeview_files')
        treeview_files_model = gtk.ListStore(str)
        renderer = gtk.CellRendererText()
        renderer.set_property('font', 'monospace')
        treeview_files_widget.append_column(
            gtk.TreeViewColumn('Files', renderer, markup=0))
        treeview_files_widget.set_model(treeview_files_model)
        treeview_files_widget.set_property('rules-hint', True)
        treeview_files_model.append((util.pango_escape(
            'please select a revision to view... (on the left)'), ))

        # task list
        running_tasks_widget = self.xml.get_widget('running_tasks')
        running_tasks_model = gtk.ListStore(gtk.gdk.Pixbuf, str,
                                            gobject.TYPE_PYOBJECT, str)
        renderer = gtk.CellRendererPixbuf()
        renderer.set_property('xpad', 4)
        renderer.set_property('ypad', 4)
        running_tasks_widget.append_column(
            gtk.TreeViewColumn('', renderer, pixbuf=0))
        renderer = gtk.CellRendererText()
        running_tasks_widget.append_column(
            gtk.TreeViewColumn('', renderer, markup=1))
        renderer = gtk.CellRendererText()
        running_tasks_widget.append_column(
            gtk.TreeViewColumn('', renderer, markup=3))
        running_tasks_widget.set_model(running_tasks_model)
        running_tasks_widget.set_headers_visible(False)
        running_tasks_widget.set_property('rules-hint', True)

        class T(threading.Thread):
            def run(self):
                while True:
                    tasks_running = False
                    gtk.gdk.threads_enter()
                    for x in running_tasks_model:
                        x[3] = util.humanize_time(datetime.datetime.now() -
                                                  x[2])
                    gtk.gdk.threads_leave()
                    if tasks_running: time.sleep(1)
                    else: time.sleep(10)

        running_tasks_thread = T()
        running_tasks_thread.daemon = True
        running_tasks_thread.start()

        self.main_window.show()

        # if no revisions exist, prompt user to run backup
        if not backup.get_revisions(self.uuid, self.host, self.path):
            s = 'Welcome to Flyback!'
            md = gtk.MessageDialog(None, gtk.DIALOG_DESTROY_WITH_PARENT,
                                   gtk.MESSAGE_INFO, gtk.BUTTONS_CLOSE, s)
            md.format_secondary_markup(
                'This is a brand new (and currently empty) backup repository.  To fill it with data, please click the "backup" button in the upper-left corner.'
            )
            md.run()
            md.destroy()