def move(self, new_path): """ Phisically move the file """ if self._exists(): signal_handler = SignalFlowControl() # SIGNALL: WILL MOVE TO, to warn folder to exist self.willMove.emit(signal_handler, self._file_path, new_path) if signal_handler.stopped(): return if os.path.exists(new_path): signal_handler = SignalFlowControl() self.willOverWrite.emit(signal_handler, self._file_path, new_path) if signal_handler.stopped(): return if self.__watcher is not None: self.__watcher.removePath(self._file_path) shutil.move(self._file_path, new_path) if self.__watcher: self.__watcher.addPath(new_path) self._file_path = new_path
def move(self, new_path): """ Phisically move the file """ if self._exists(): signal_handler = SignalFlowControl() #SIGNALL: WILL MOVE TO, to warn folder to exist self.emit(SIGNAL("willMove(Qt_PyQtObject, QString, QString)"), signal_handler, self._file_path, new_path) if signal_handler.stopped(): return if os.path.exists(new_path): signal_handler = SignalFlowControl() self.emit( SIGNAL("willOverWrite(PyQt_PyObject, QString, QString)"), signal_handler, self._file_path, new_path) if signal_handler.stopped(): return if self.__watcher: self.__watcher.removePath(self._file_path) shutil.move(self._file_path, new_path) if self.__watcher: self.__watcher.addPath(new_path) self._file_path = new_path return
def attach_to_path(self, new_path): if os.path.exists(new_path): signal_handler = SignalFlowControl() self.emit("willAttachToExistingFile(PyQT_PyObject, QString)", signal_handler, new_path) if signal_handler.stopped(): return self._file_path = new_path self.emit("gotAPath(PyQT_PyObject)", self) return self._file_path
def attach_to_path(self, new_path): if os.path.exists(new_path): signal_handler = SignalFlowControl() self.willAttachToExistingFile.emit(signal_handler, new_path) if signal_handler.stopped(): return self._file_path = new_path self.gotAPath.emit(self) return self._file_path
def attach_to_path(self, new_path): if os.path.exists(new_path): signal_handler = SignalFlowControl() self.emit( SIGNAL("willAttachToExistingFile(PyQt_PyObject, QString)"), signal_handler, new_path) if signal_handler.stopped(): return self._file_path = new_path self.emit(SIGNAL("gotAPath(PyQt_PyObject)"), self) return self._file_path
def delete(self, force=False): """ This deletes the object and closes the file. """ # if created but exists this file migth to someone else self.close() if ((not self._created) or force) and self._exists(): DEBUG("Deleting our own NFile %s" % self._file_path) signal_handler = SignalFlowControl() self.emit(SIGNAL("willDelete(PyQt_PyObject, PyQt_PyObject)"), signal_handler, self) if not signal_handler.stopped(): os.remove(self._file_path)
def delete(self, force=False): """ This deletes the object and closes the file. """ #if created but exists this file migth to someone else self.close() if ((not self.__created) or force) and self._exists(): DEBUG("Deleting our own NFile %s" % self._file_path) signal_handler = SignalFlowControl() self.emit(SIGNAL("willDelete(PyQt_PyObject, PyQt_PyObject)"), signal_handler, self) if not signal_handler.stopped(): os.remove(self._file_path)
def delete(self, force=False): """ This deletes the object and closes the file. """ # if created but exists this file migth to someone else self.close() if ((not self.__created) or force) and self._exists(): DEBUG("Deleting our own NFile %s" % self._file_path) signal_handler = SignalFlowControl() self.willDelete.emit(signal_handler, self) if not signal_handler.stopped(): if self.__watcher is not None: self.__watcher.removePath(self._file_path) os.remove(self._file_path)
def copy(self, new_path): """ Copy the file to a new path """ if self._exists(): signal_handler = SignalFlowControl() # SIGNALL: WILL COPY TO, to warn folder to exist self.emit(SIGNAL("willCopyTo(Qt_PyQtObject, QString, QString)"), signal_handler, self._file_path, new_path) if signal_handler.stopped(): return if os.path.exists(new_path): signal_handler = SignalFlowControl() self.emit( SIGNAL("willOverWrite(PyQt_PyObject, QString, QString)"), signal_handler, self._file_path, new_path ) if signal_handler.stopped(): return shutil.copy(self._file_path, new_path)
def copy(self, new_path): """ Copy the file to a new path """ if self._exists(): signal_handler = SignalFlowControl() #SIGNALL: WILL COPY TO, to warn folder to exist self.willCopyTo.emit(signal_handler, self._file_path, new_path) if signal_handler.stopped(): return if os.path.exists(new_path): signal_handler = SignalFlowControl() self.willOverWrite.emit(signal_handler, self._file_path, new_path) if signal_handler.stopped(): return shutil.copy(self._file_path, new_path)
def copy(self, new_path): """ Copy the file to a new path """ if self._exists(): signal_handler = SignalFlowControl() #SIGNALL: WILL COPY TO, to warn folder to exist self.emit(SIGNAL("willCopyTo(Qt_PyQtObject, QString, QString)"), signal_handler, self._file_path, new_path) if signal_handler.stopped(): return if os.path.exists(new_path): signal_handler = SignalFlowControl() self.emit( SIGNAL("willOverWrite(PyQt_PyObject, QString, QString)"), signal_handler, self._file_path, new_path) if signal_handler.stopped(): return shutil.copy(self._file_path, new_path)