コード例 #1
0
ファイル: filechooser.py プロジェクト: MichaelSanchez1196/jes
    def approveSelection(self):
        if self._validator is not None:
            chosenFile = self.selectedFile
            chosenPath = chosenFile.path
            validatedPath = self._validator(chosenPath)
            if validatedPath is None or validatedPath is False:
                return
            elif validatedPath is True:
                pass
            elif validatedPath != chosenPath:
                self.selectedFile = File(validatedPath)

        JFileChooser.approveSelection(self)
コード例 #2
0
ファイル: filechooser.py プロジェクト: JoeLeclercq/jesWork
    def approveSelection(self):
        if self._validator is not None:
            chosenFile = self.selectedFile
            chosenPath = chosenFile.path
            validatedPath = self._validator(chosenPath)
            if validatedPath is None or validatedPath is False:
                return
            elif validatedPath is True:
                pass
            elif validatedPath != chosenPath:
                self.selectedFile = File(validatedPath)

        JFileChooser.approveSelection(self)
コード例 #3
0
    def approveSelection(self):
        filePath = self.getSelectedFile().getPath()
        fileName = String(self.getSelectedFile().getName())

        if fileName.matches('[_a-zA-Z0-9()~#.]+'):
            if os.path.exists(filePath):
                message = 'File "' + str(fileName) + ' exists. Overwrite?'
                result = JOptionPane.showConfirmDialog(self, message,
                                                       'Confirm Overwrite',
                                                       JOptionPane.YES_NO_OPTION)
                if result == JOptionPane.YES_OPTION:
                    JFileChooser.approveSelection(self)
            else:
                JFileChooser.approveSelection(self)
        else:
            message = 'The file name contains illegal characters. Please rename.'
            JOptionPane.showMessageDialog(self, message, 'Error', JOptionPane.ERROR_MESSAGE)
コード例 #4
0
    def approveSelection(self):
        filePath = self.getSelectedFile().getPath()
        fileName = String(self.getSelectedFile().getName())

        if fileName.matches('[_a-zA-Z0-9()~#.]+'):
            if os.path.exists(filePath):
                message = 'File "' + str(fileName) + ' exists. Overwrite?'
                result = JOptionPane.showConfirmDialog(
                    self, message, 'Confirm Overwrite',
                    JOptionPane.YES_NO_OPTION)
                if result == JOptionPane.YES_OPTION:
                    JFileChooser.approveSelection(self)
            else:
                JFileChooser.approveSelection(self)
        else:
            message = 'The file name contains illegal characters. Please rename.'
            JOptionPane.showMessageDialog(self, message, 'Error',
                                          JOptionPane.ERROR_MESSAGE)