Skip to content

Commit

Permalink
[feature] Add GUI Toolkit Commands (backport #5260) (#5283)
Browse files Browse the repository at this point in the history
[feature] Add GUI Toolkit Commands (#5260)

* Markdown

* Delete

* Add AFXApp and AFXBoolKeyword

* Delete

* Update headings

* Create parse.py

* Update parse.py

* Unicode Spaces

* Update .pre-commit-config.yaml

* Update md types

* Update Kernel plug-in registration commands.md

* Generated python stubs

* Add class inheritance

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Revert "Update .pre-commit-config.yaml"

This reverts commit 9d3aef3.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix mypy errors

* Delete parse.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix return types and imports

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update AFXColumnItems.md

* Update abaqusGui.py

* Add class/global flags

* Delete flags.py

* Fix flags

* Fix

* Skip mypy

* Update abaqusGui.py

* Update constants.py

* Create kernelAccess.py

* Add plugin docs

* Revert changes by docformatter

* Delete markdown files

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
(cherry picked from commit a65ff5d)

Co-authored-by: Hailin Wang <[email protected]>
  • Loading branch information
mergify[bot] and haiiliin authored Oct 6, 2023
1 parent 711ee90 commit a30ab44
Show file tree
Hide file tree
Showing 153 changed files with 21,015 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/source/reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ mdb/index
odb
session/index
kernel/index
plugin
```
17 changes: 17 additions & 0 deletions docs/source/reference/plugin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Plug-in Registration

Plug-in commands register kernel and GUI plug-ins in either the Plug-ins menu or in a toolbox. Plug-in registration commands for accessing both kernel and GUI plug-ins are located in the Abaqus GUI Toolkit Reference Guide.

## Classes

### Other Classes

```{eval-rst}
.. toggle::
.. automembers:: abaqus.PlugInRegistration
:recursive:
.. placeholder for empty members
```
140 changes: 140 additions & 0 deletions src/abaqus/PlugInRegistration/AFXApp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
from __future__ import annotations

from .AFXMainWindow import AFXMainWindow
from .FXApp import FXApp


class AFXApp(FXApp):
"""This class is responsible for providing some high-level GUI control methods."""

#: Used to query whether the GUI is locked.
ID_QUERY_GUILOCK: int = hash("ID_QUERY_GUILOCK")

#: Used to change the cursor.
ID_SHOW_HOURGLASS: int = hash("ID_SHOW_HOURGLASS")

def __init__(
self,
appName: str = "Abaqus/CAE",
vendorName: str = "SIMULIA",
productName: str = "''",
majorNumber: int = -1,
minorNumber: int = -1,
updateNumber: int = -1,
prerelease: bool = False,
):
"""Constructor.
Parameters
----------
appName : str
Application registry key.
vendorName : str
Vendor registry key.
productName : str
Product name.
majorNumber : int
Version number.
minorNumber : int
Release number.
updateNumber : int
Update number.
prerelease : bool
Official/Prerelease flag.
"""

def create(self):
"""Creates windows for the application.
Reimplemented from FXApp.
"""

def getAFXMainWindow(self) -> AFXMainWindow: # type: ignore
"""Returns a pointer to the AFXMainWindow."""
...

def getBasePrerelease(self) -> bool: # type: ignore
"""Returns True if the base product is a prerelease."""
...

def getBaseProductName(self) -> str: # type: ignore
"""Returns the base product name."""
...

def getBaseVersionNumbers(self, majorNumber: int, minorNumber: int, updateNumber: int):
"""Returns the base product's major, minor, and update numbers.
Parameters
----------
majorNumber : int
Version number.
minorNumber : int
Release number.
updateNumber : int
Update number.
"""

def getKernelInitializationCommand(self) -> str: # type: ignore
"""Returns the command string that will be issued upon application startup."""
...

def getPrerelease(self) -> bool: # type: ignore
"""Returns True if this is a prerelease."""
...

def getProductName(self) -> str: # type: ignore
"""Returns the product name."""
...

def getVersionNumbers(self) -> tuple[int, int, int]: # type: ignore
"""Returns the major, minor, and update numbers."""
...

def init(self, argc: int, argv: str, *args, **kwargs):
"""Initializes the application and connects to the kernel.
Parameters
----------
argc : int
argv : str
"""

def isLocked(self) -> bool: # type: ignore
"""Returns True if the GUI is locked or False if otherwise.
Reimplemented from FXApp.
"""
...

def isProductCAE(self) -> bool: # type: ignore
"""Returns True if the base product is Abaqus/CAE."""
...

def isProductViewer(self) -> bool: # type: ignore
"""Returns True if the base product is Abaqus/Viewer."""
...

def isLearningEdition(self) -> bool: # type: ignore
"""Returns True if the base product is a learning edition."""
...

def lock(self):
"""Locks the GUI (normally used during command and mode processing)."""

def run(self):
"""Runs the main application event loop until stop() is called,.
Reimplemented from FXApp.
"""

def runUntil(self, condition: int):
"""Run an event loop till some flag becomes non-zero. Reimplemented from FXApp.
Parameters
----------
condition : int
"""

def unlock(self):
"""Unlocks the GUI."""
8 changes: 8 additions & 0 deletions src/abaqus/PlugInRegistration/AFXBaseTable.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from __future__ import annotations

from .AFXDataComponent import AFXDataComponent
from .FXScrollArea import FXScrollArea


class AFXBaseTable(FXScrollArea, AFXDataComponent):
...
116 changes: 116 additions & 0 deletions src/abaqus/PlugInRegistration/AFXBoolKeyword.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
from __future__ import annotations

from .AFXCommand import AFXCommand
from .AFXKeyword import AFXKeyword


class AFXBoolKeyword(AFXKeyword):
"""This class is designed for command keywords that have Boolean values."""

#: Keyword value will be ON or OFF.
ON_OFF: int = hash("ON_OFF")

#: Keyword value will be True or False.
TRUE_FALSE: int = hash("TRUE_FALSE")

def __init__(
self,
command: AFXCommand,
name: str,
booleanType=ON_OFF,
isRequired: bool = False,
defaultValue: bool = False,
):
"""Constructor.
Parameters
----------
command : AFXCommand
Host command.
name : str
Keyword name.
booleanType : Type
Type of boolean used in the command.
isRequired : bool
True if the keyword is a required argument of the command.
defaultValue : bool
Default value.
"""

def getTypeName(self):
"""Returns the name of the keyword type.
Implements AFXKeyword.
"""

def getValue(self):
"""Returns the keyword's current value."""

def getValueAsString(self):
"""Returns the text string that represents the keyword's current value.
Implements AFXKeyword.
"""

def isValueChanged(self):
"""Returns True if the keyword value differs from its previous value.
Implements AFXKeyword.
"""

def setDefaultValue(self, defaultValue: bool):
"""Sets the keyword's default value.
Parameters
----------
defaultValue : bool
Default value.
"""

def setDefaultValueByString(self, defaultValueString: str):
"""Sets the keyword's default value (returns True if the given text string is valid).
Parameters
----------
defaultValueString : str
Default value in text string form.
"""

def setValue(self, newValue: bool):
"""Sets the keyword's current value.
Parameters
----------
newValue : bool
New value.
"""

def setValueByString(self, newValueString: str):
"""Sets the keyword's current value (returns True if the given text string is valid).
Parameters
----------
newValueString : str
New value in text string form.
"""

def setValueToDefault(self, ignoreUnspecified: bool = False):
"""Sets the keyword value to its default.
Parameters
----------
ignoreUnspecified : bool
Not used.
"""

def setValueToPrevious(self):
"""Sets the keyword value to its previous value.
Implements AFXKeyword.
"""

def syncPreviousValue(self):
"""Sets the keyword's previous value to its current value.
Implements AFXKeyword.
"""
Loading

0 comments on commit a30ab44

Please sign in to comment.