Skip to content

Commit

Permalink
[bugfix] Fix AFXMainWindow methods return types (#5286)
Browse files Browse the repository at this point in the history
* [bugfix] Fix AFXMainWindow return types

* Remove toolboxName argument for registerGuiMenuButton
  • Loading branch information
haiiliin committed Oct 7, 2023
1 parent d4f5bfa commit 51df0fc
Show file tree
Hide file tree
Showing 6 changed files with 230 additions and 224 deletions.
11 changes: 0 additions & 11 deletions src/abaqus/PlugInRegistration/AFXApp.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,12 @@ def create(self):

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.
Expand All @@ -76,19 +73,15 @@ def getBaseVersionNumbers(self, majorNumber: int, minorNumber: int, updateNumber

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.
Expand All @@ -105,19 +98,15 @@ def isLocked(self) -> bool: # type: ignore
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)."""
Expand Down
37 changes: 22 additions & 15 deletions src/abaqus/PlugInRegistration/AFXMainWindow.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
from __future__ import annotations

from .AFXGuiObjectManager import AFXGuiObjectManager
from .AFXMenuPane import AFXMenuPane
from .AFXMenuTitle import AFXMenuTitle
from .AFXTarget import AFXTarget
from .AFXToolsetGui import AFXToolsetGui
from .constants import DECOR_ALL
from .FXApp import FXApp
from .FXIcon import FXIcon
from .FXMainWindow import FXMainWindow
from .FXMenubar import FXMenubar
from .FXSelector import FXSelector
from .FXTabItem import FXTabItem
from .PluginToolset import PluginToolset


class AFXMainWindow(FXMainWindow):
Expand Down Expand Up @@ -108,22 +115,22 @@ def create(self):
def getContextBar(self):
"""Returns a pointer to the context bar container."""

def getCurrentTreeTab(self):
def getCurrentTreeTab(self) -> FXTabItem: # type: ignore
"""Returns the current tab item."""

def getDefaultHeight(self):
def getDefaultHeight(self) -> int: # type: ignore
"""Returns the default main window height.
Reimplemented from FXTopWindow.
"""

def getDefaultWidth(self):
def getDefaultWidth(self) -> int: # type: ignore
"""Returns the default main window width.
Reimplemented from FXTopWindow.
"""

def getDisplayedNameAtIndex(self, index: int):
def getDisplayedNameAtIndex(self, index: int) -> str: # type: ignore
"""Returns the displayed name at the given position in the list.
Parameters
Expand All @@ -132,16 +139,16 @@ def getDisplayedNameAtIndex(self, index: int):
Position in the module list.
"""

def getDrawingAreaHeight(self):
def getDrawingAreaHeight(self) -> int: # type: ignore
"""Returns the height of the drawing area in pixels."""

def getDrawingAreaWidth(self):
def getDrawingAreaWidth(self) -> int: # type: ignore
"""Returns the width of the drawing area in pixels."""

def getHelpToolset(self):
"""Returns a pointer to the help toolset."""

def getMenubar(self):
def getMenubar(self) -> FXMenubar: # type: ignore
"""Returns a pointer to the menubar."""

def getModule(self, name: str):
Expand All @@ -153,7 +160,7 @@ def getModule(self, name: str):
A String that specifies the module to get.
"""

def getModuleName(self, displayedName: str):
def getModuleName(self, displayedName: str) -> str: # type: ignore
"""Returns the module name for the given displayed name.
Parameters
Expand All @@ -162,13 +169,13 @@ def getModuleName(self, displayedName: str):
Displayed module name (English).
"""

def getNumModules(self):
def getNumModules(self) -> int: # type: ignore
"""Returns the number of modules."""

def getPluginToolset(self):
def getPluginToolset(self) -> PluginToolset: # type: ignore
"""Returns the Plugin toolset."""

def getSelectorFromFunction(self, function: str):
def getSelectorFromFunction(self, function: str) -> FXSelector: # type: ignore
"""Returns the selector of the given shortcut function. Throws exception if not found.
Parameters
Expand All @@ -177,7 +184,7 @@ def getSelectorFromFunction(self, function: str):
A String specifying the function as shown in the Customize dialog box.
"""

def getTargetFromFunction(self, function: str):
def getTargetFromFunction(self, function: str) -> AFXTarget: # type: ignore
"""Returns the target of the given shortcut function. Throws exception if not found.
Parameters
Expand All @@ -189,10 +196,10 @@ def getTargetFromFunction(self, function: str):
def getToolbox(self):
"""Returns a pointer to the module toolbox container."""

def getToolMenuPane(self):
def getToolMenuPane(self) -> AFXMenuPane: # type: ignore
"""Returns a pointer to the tools menu pane."""

def getToolMenuTitle(self):
def getToolMenuTitle(self) -> AFXMenuTitle: # type: ignore
"""Returns a pointer to the Tools menu title."""

def getToolset(self, name: str):
Expand All @@ -208,7 +215,7 @@ def getToolsetKernelInitializationCommands(self):
"""Returns the command string that should initialize the toolsets in the kernel that are corresponding
to the toolsets registered with the main window."""

def getWorkDirectory(self):
def getWorkDirectory(self) -> str: # type: ignore
"""Returns the current working directory."""

def hideCli(self):
Expand Down

0 comments on commit 51df0fc

Please sign in to comment.