Esempio n. 1
0
 def __init__(self, path, parent=None):
     """
     Initialize the save file dialog.
     :type path: str
     :type parent: QWidget
     """
     super().__init__(parent)
     self.setAcceptMode(QFileDialog.AcceptSave)
     self.setDirectory(expandPath('~') if not path else expandPath(path))
     self.setFileMode(QFileDialog.ExistingFile)
     self.setViewMode(QFileDialog.Detail)
Esempio n. 2
0
 def __init__(self, path, parent=None):
     """
     Initialize the save file dialog.
     :type path: str
     :type parent: QWidget
     """
     super().__init__(parent)
     self.setAcceptMode(QFileDialog.AcceptSave)
     self.setDirectory(expandPath('~') if not path else expandPath(path))
     self.setFileMode(QFileDialog.ExistingFile)
     self.setViewMode(QFileDialog.Detail)
Esempio n. 3
0
 def __init__(self, path=None, parent=None):
     """
     Initialize the File.
     :type path: str
     :type parent: QObject
     """
     super().__init__(parent)
     self._path = expandPath(path) if path else None
Esempio n. 4
0
 def __init__(self, path=None, parent=None):
     """
     Initialize the File.
     :type path: str
     :type parent: QObject
     """
     super().__init__(parent)
     self._path = expandPath(path) if path else None
Esempio n. 5
0
    def write(self, string, path=None):
        """
        Write the content of 'string' in 'path'.
        :type string: str
        :type path: str
        """
        path = path or self.path
        temp = expandPath('@home/.{}'.format(os.path.basename(os.path.normpath(path))))

        with open(temp, mode='wb') as file:
            file.write(string.encode(encoding='UTF-8'))

        if os.path.isfile(path):
            os.remove(path)
        os.rename(temp, path)
        self.path = path
Esempio n. 6
0
    def write(self, string, path=None):
        """
        Write the content of 'string' in 'path'.
        :type string: str
        :type path: str
        """
        path = path or self.path
        temp = expandPath('@home/.{}'.format(
            os.path.basename(os.path.normpath(path))))

        with open(temp, mode='wb') as file:
            file.write(string.encode(encoding='UTF-8'))

        if os.path.isfile(path):
            os.remove(path)
        os.rename(temp, path)
        self.path = path
Esempio n. 7
0
 def path(self, path):
     """
     Set the path of the File.
     :type path: str.
     """
     self._path = expandPath(path)
Esempio n. 8
0
 def path(self, path):
     """
     Set the path of the File.
     :type path: str.
     """
     self._path = expandPath(path)