Exemplo 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)
Exemplo 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)
Exemplo 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
Exemplo 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
Exemplo 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
Exemplo 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
Exemplo n.º 7
0
 def path(self, path):
     """
     Set the path of the File.
     :type path: str.
     """
     self._path = expandPath(path)
Exemplo n.º 8
0
 def path(self, path):
     """
     Set the path of the File.
     :type path: str.
     """
     self._path = expandPath(path)