1
# -*- coding: utf-8 -*-
2
# thanks to Dave Arter <davea@sucs.org>
3
# Copyright (c) 2005 Dave Arter
9
from APTonCD.core.utils import get_icon
10
from APTonCD.core import utils
11
from APTonCD.widgets.progresswindow import ProgressDialog
12
from APTonCD.core.gui import processEvents
13
from APTonCD.core import constants
17
def __init__(self, Source = None, Destination = None):
19
self.destination = Destination
21
def set_source(self, filename): self.source = filename
22
def get_source(self): return self.source
23
Source = property(fget = get_source, fset = set_source)
25
def set_destination(self, filename): self.destination = filename
26
def get_destination(self): return self.destination
27
Destination = property(fget = get_destination, fset = set_destination)
32
def __init__(self,xid = None, script_location = None ):
35
self.window_by_id = gtk.gdk.window_foreign_new(int(xid))
36
self.script = script_location
38
self.progress = ProgressDialog(self.window_by_id)
39
self.progress.can_cancel_progress = False
40
self.progress.title = constants.MESSAGE_0073
41
self.progress.description = constants.MESSAGE_0074
42
self.progress.stop = len(self.files)
45
self.progress.destroy()
47
def process_files(self):
48
ifile = open(self.script,'r')
50
for n in ifile.readlines():
51
copy_list = n.split('|')
52
self.files.append(Files(copy_list[0],copy_list[1]))
54
def restore_files(self):
57
self.progress.update_progress(index + 1)
58
os.system('cp %s %s' % (n.Source, n.Destination))
62
if __name__ == '__main__':
64
restore = RestoreFiles(sys.argv[1], sys.argv[2])