def add_new_file(self, node):
        """
        Adds a new file next to given Node associated path.

        :param node: Node.
        :type node: ProjectNode or DirectoryNode or FileNode
        :return: Method success.
        :rtype: bool
        """

        if self.__script_editor.model.is_authoring_node(node):
            return self.__script_editor.new_file()

        file, state = QInputDialog.getText(self, "Add File", "Enter your new file name:")
        if not state:
            return False

        if node.family in ("Project", "Directory"):
            directory = node.path
        elif node.family == "File":
            directory = os.path.dirname(node.path)

        # file = foundations.strings.to_string(file)
        if not file in os.listdir(directory):
            file = os.path.join(directory, file)
            LOGGER.info("{0} | Adding '{1}' file!".format(self.__class__.__name__, file))
            open(file, "w").close()
        else:
            self.__raise_file_system_exception(file, directory)
        return True
def add_new_file ( self , node ) : if self . __script_editor . model . is_authoring_node ( node ) : return self . __script_editor . new_file ( ) file , state = QInputDialog . getText ( self , "Add File" , "Enter your new file name:" ) if not state : return False if node . family in ( "Project" , "Directory" ) : directory = node . path elif node . family == "File" : directory = os . path . dirname ( node . path ) if not file in os . listdir ( directory ) : file = os . path . join ( directory , file ) LOGGER . info ( "{0} | Adding '{1}' file!" . format ( self . __class__ . __name__ , file ) ) open ( file , "w" ) . close ( ) else : self . __raise_file_system_exception ( file , directory ) return True
Adds a new file next to given Node associated path.

        :param node: Node.
        :type node: ProjectNode or DirectoryNode or FileNode
        :return: Method success.
        :rtype: bool