Here's some code:
#-*-Coding:utf-8-*-
From Pyqt4.qtcore import pyqtsignature
From Pyqt4.qtgui import Qdialog
From PYQT4 import Qtcore,qtgui
From Ui_copyfile import Ui_copyfile
Import Shutil
Import OS
Class CopyFile (Qdialog, Ui_copyfile):
"""
Class documentation goes here.
"""
def __init__ (self, Parent=none):
"""
Constructor
@param parent reference to the parent widget (Qwidget)
"""
Qdialog.__init__ (self, parent)
Self.setupui (self)
@pyqtSignature ("")
def on_startbutton_clicked (self):
If not self.dstlineEdit.text () and not Self.srclineEdit.text ():
Self.textBrowser.append ("Input srcdir or Dstdir")
FileList = []
If not os.path.exists (Self.srclineEdit.text ()):
Self.textBrowser.append ("%s Directory not exits!" %str (Self.srclineEdit.text ()))
Raise Systemexit
For root,dirs,files in Os.walk (str (Self.srclineEdit.text ())):
For file in Files:
filename = Os.path.join (root,file)
Filelist.append (filename)
num = Int (len (filelist))
Self.progressBar.setMinimum (0)
Self.progressBar.setMaximum (num)
For I,filename in Enumerate (filelist):
Self.textBrowser.append ("Copy%s to%s"% (Filename,str (Self.dstlineEdit.text ())))
Self.progressBar.setValue (i+1)
Shutil.copy2 (Filename,str (Self.dstlineEdit.text ()))
if __name__ = = "__main__":
Import Sys
App = Qtgui.qapplication (SYS.ARGV)
UI = CopyFile ()
Ui.show ()
Sys.exit (App.exec_ ())
Made a copy of the file interface with Python qt4.