Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lolenc Compatible Iquip #312

Open
alexist2623 opened this issue Aug 24, 2024 · 2 comments
Open

Lolenc Compatible Iquip #312

alexist2623 opened this issue Aug 24, 2024 · 2 comments
Assignees
Labels
enhancement New feature or any improvements to codes

Comments

@alexist2623
Copy link
Member

Feature you want to implement

To control lolenc from iquip, functionality must be added to recognize and work with both C and C++ files.

How the feature is implemented

In explore.py, a code block was added to the _addFile method to recognize .cpp and .c files. The code ensures that these files are included in the list of files processed by the method, alongside .py files.

    @pyqtSlot(list, object)
    def _addFile(self, experimentList: List[str], widget: Union[QTreeWidget, QTreeWidgetItem]):
        """Adds the files into the children of the widget.

        A file or directory which starts with "_" will be ignored, e.g. __pycache__/.

        Args:
            experimentList: The list of files under the widget path.
            widget: See _FileFinderThread class.
        """
        for experimentFile in experimentList:
            if experimentFile.startswith("_"):
                continue
            if experimentFile.endswith("/"):
                experimentFileItem = QTreeWidgetItem(widget)
                experimentFileItem.setText(0, experimentFile[:-1])
                # Make an empty item for indicating that it is a directory.
                QTreeWidgetItem(experimentFileItem)
            elif (
                experimentFile.endswith(".cpp") or 
                experimentFile.endswith(".c") or 
                experimentFile.endswith(".py")
            ):
                experimentFileItem = QTreeWidgetItem(widget)
                experimentFileItem.setText(0, experimentFile)
@alexist2623 alexist2623 added the enhancement New feature or any improvements to codes label Aug 24, 2024
@kangz12345
Copy link
Member

You could use if experimentFile.endswith((".cpp", ".c", ".py")) instead.
See endswith().

@alexist2623
Copy link
Member Author

Oh it can be used with tuple! thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or any improvements to codes
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants