Пример #1
0
 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
Пример #2
0
 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
Пример #3
0
 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
Пример #4
0
 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
Пример #5
0
 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
Пример #6
0
 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
Пример #7
0
 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)
Пример #8
0
 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)
Пример #9
0
 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)
Пример #10
0
 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)
Пример #11
0
    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)
Пример #12
0
 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
Пример #13
0
    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)
Пример #14
0
    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)
Пример #15
0
 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