def __init__(self, parent): [ self.__selectedFileId, self.__imageWidthId, self.__imageHeightId, self.__horizontalGapId, self.__verticalGapId, self.__fileSelectBtn, self.__imageFormatChoiceId ] = PyutUtils.assignID(7) super().__init__(parent, theTitle='Native Image Generation Options') self.logger: Logger = getLogger(__name__) self._outputFileName: str = PyutPreferences().wxImageFileName self._imageFormat: WxImageFormat = WxImageFormat.PNG fs: StaticBoxSizer = self.__layoutFileSelection() imgF: StaticBoxSizer = self.__layoutImageFormatChoice() hs: Sizer = self._createDialogButtonsContainer(buttons=OK | CANCEL) mainSizer: BoxSizer = BoxSizer(orient=VERTICAL) mainSizer.Add(fs, 0, ALL | EXPAND, 5) mainSizer.Add(imgF, 0, ALL, 5) mainSizer.Add(hs, 0, ALIGN_RIGHT) self.SetSizerAndFit(mainSizer) self._bindEventHandlers() self.Bind(EVT_BUTTON, self._OnCmdOk, id=ID_OK) self.Bind(EVT_CLOSE, self._OnClose, id=ID_CANCEL)
def __init__(self, theParent): [self.__layoutWidthID, self.__layoutHeightID] = PyutUtils.assignID(2) super().__init__(theParent, theTitle='Layout Size') self.logger: Logger = getLogger(__name__) self._layoutWidth: int = DlgLayoutSize.DEFAULT_LAYOUT_WIDTH self._layoutHeight: int = DlgLayoutSize.DEFAULT_LAYOUT_HEIGHT hs: Sizer = self._createDialogButtonsContainer(buttons=OK | CANCEL) layoutControls: StaticBoxSizer = self.__createLayoutSizeControls() mainSizer: BoxSizer = BoxSizer(orient=VERTICAL) mainSizer.Add(layoutControls, 0, CENTER) mainSizer.Add(hs, 0, CENTER) self.SetSizer(mainSizer) mainSizer.Fit(self) self.Bind(EVT_SPINCTRL, self.__OnSizeChange, id=self.__layoutWidthID) self.Bind(EVT_SPINCTRL, self.__OnSizeChange, id=self.__layoutHeightID) self.Bind(EVT_BUTTON, self._OnCmdOk, id=ID_OK) self.Bind(EVT_CLOSE, self._OnClose)
def __init__(self, theParent): [self.__layoutWidthID, self.__layoutHeightID] = PyutUtils.assignID(2) super().__init__(theParent, theTitle='Layout Size') self.logger: Logger = getLogger(__name__) self._preferences: PyutPreferences = PyutPreferences() self._layoutWidth: int = self._preferences.orthogonalLayoutSize.width self._layoutHeight: int = self._preferences.orthogonalLayoutSize.height hs: Sizer = self._createDialogButtonsContainer(buttons=OK | CANCEL) layoutControls: DimensionsContainer = self.__createLayoutSizeControls() mainSizer: BoxSizer = BoxSizer(orient=VERTICAL) mainSizer.Add(layoutControls, 0, CENTER) mainSizer.Add(hs, 0, CENTER) self.SetSizer(mainSizer) mainSizer.Fit(self) self.Bind(EVT_BUTTON, self._OnCmdOk, id=ID_OK) self.Bind(EVT_CLOSE, self._OnClose)
def __init__(self, theParent, imageOptions: ImageOptions = ImageOptions()): [ self.__selectedFileId, self.__imageWidthId, self.__imageHeightId, self.__horizontalGapId, self.__verticalGapId, self.__fileSelectBtn, self.__imageFormatChoiceId ] = PyutUtils.assignID(7) super().__init__(theParent, theTitle='UML Image Generation Options') self.logger: Logger = getLogger(__name__) self._imageOptions: ImageOptions = imageOptions fs: StaticBoxSizer = self.__layoutFileSelection() imgS: StaticBoxSizer = self.__layoutImageSizeControls() imgF: StaticBoxSizer = self.__layoutImageFormatChoice() imgP: StaticBoxSizer = self.__layoutImagePadding() hs: Sizer = self._createDialogButtonsContainer(buttons=OK | CANCEL) mainSizer: BoxSizer = BoxSizer(orient=VERTICAL) mainSizer.Add(fs, 0, ALL | EXPAND, 5) mainSizer.Add(imgS, 0, ALL, 5) mainSizer.Add(imgF, 0, ALL, 5) mainSizer.Add(imgP, 0, ALL, 5) mainSizer.Add(hs, 0, ALIGN_RIGHT) self.SetSizer(mainSizer) mainSizer.Fit(self) self._bindEventHandlers() self.Bind(EVT_BUTTON, self._OnCmdOk, id=ID_OK) self.Bind(EVT_CLOSE, self._OnClose, id=ID_CANCEL)
def __popupProjectDocumentMenu(self): if self.__documentPopupMenu is None: self.logger.info(f'Create the document popup menu') [editDocumentNameMenuID, removeDocumentMenuID] = PyutUtils.assignID(2) popupMenu: Menu = Menu('Actions') popupMenu.AppendSeparator() popupMenu.Append(editDocumentNameMenuID, 'Edit Document Name', 'Change document name', ITEM_NORMAL) popupMenu.Append(removeDocumentMenuID, 'Remove Document', 'Delete it', ITEM_NORMAL) popupMenu.Bind(EVT_MENU, self.__onEditDocumentName, id=editDocumentNameMenuID) popupMenu.Bind(EVT_MENU, self.__onRemoveDocument, id=removeDocumentMenuID) self.__documentPopupMenu = popupMenu self.logger.info(f'Current Document: `{self.getCurrentDocument()}`') self.__parent.PopupMenu(self.__documentPopupMenu)
def __initCtrl(self): """ Initialize the controls. """ # IDs [self.__editorID] = PyutUtils.assignID(1) sizer = BoxSizer(VERTICAL) self.__lblEditor = StaticText(self, -1, _("Editor")) self.__txtEditor = TextCtrl(self, -1, size=(100, 20)) sizer.Add(self.__lblEditor, 0, ALL, DlgFastEditOptions.GAP) sizer.Add(self.__txtEditor, 0, ALL, DlgFastEditOptions.GAP) hs = BoxSizer(HORIZONTAL) btnOk = Button(self, ID_OK, _("&OK")) hs.Add(btnOk, 0, ALL, DlgFastEditOptions.GAP) sizer.Add(hs, 0, CENTER) self.SetAutoLayout(True) self.SetSizer(sizer) sizer.Fit(self) sizer.SetSizeHints(self) btnOk.SetDefault() self.Bind(EVT_TEXT, self.__OnText, id=self.__editorID) self.__setValues() self.Center() self.__changed: bool = False
def __init__(self, parent: Window): super().__init__(parent=parent) [ self.enableBackgroundGridID, self.snapToGridID, self.scGridIntervalID, self.colorID ] = PyutUtils.assignID(4) self._createControls() self._setControlValues()
def __init__(self, parent: Window): super().__init__(parent=parent) [ self.__autoResizeID, self.__showParamsID, self.__maximizeID, self.__showTipsID, self.__resetTipsID, self.__centerDiagramID, self.__toolBarIconSizeID ] = PyutUtils.assignID(7) self._createControls() self._setControlValues()
def __initializeTheControls(self) -> DebugListControl: """ Initialize the controls. """ [self.__tId] = PyutUtils.assignID(1) dbgListCtrl: DebugListControl = DebugListControl(self, self.__tId, style=BORDER_SUNKEN) dbgListCtrl.populateList() return dbgListCtrl
def __initializeTheControls(self, mainSizer: StaticBoxSizer): """ Initialize the controls. """ # IDs [self.__xId, self.__yId] = PyutUtils.assignID(2) xBox, self.__x = self.__createPositionContainer( 'Frame X Position: ', self.__xId) yBox, self.__y = self.__createPositionContainer( 'Frame Y Position: ', self.__yId) mainSizer.Add(xBox, 0, ALL, DlgDebugDiagramFrame.VERTICAL_GAP) mainSizer.Add(yBox, 0, ALL, DlgDebugDiagramFrame.VERTICAL_GAP)
def __popupProjectMenu(self): self._mediator.resetStatusText() if self.__projectPopupMenu is None: self.logger.info(f'Create the project popup menu') [closeProjectMenuID] = PyutUtils.assignID(1) popupMenu: Menu = Menu('Actions') popupMenu.AppendSeparator() popupMenu.Append(closeProjectMenuID, 'Close Project', 'Remove project from tree', ITEM_NORMAL) popupMenu.Bind(EVT_MENU, self.__onCloseProject, id=closeProjectMenuID) self.__projectPopupMenu = popupMenu self.logger.info(f'currentProject: `{self._currentProject}`') self.__parent.PopupMenu(self.__projectPopupMenu)
def __init__(self, parent): super().__init__(parent=parent) [self.__languageID, self.__pdfFilenameID, self.__wxImageFileNameID] = PyutUtils.assignID(3) self._pdfFileNameContainer: TextContainer = cast(TextContainer, None) self._wxImageFileNameContainer: TextContainer = cast( TextContainer, None) self._fastEditEditorNameContainer: TextContainer = cast( TextContainer, None) self._createControls() self._setControlValues()
class SharedIdentifiers: [ ID_MNUFILENEWPROJECT, ID_MNU_FILE_OPEN, ID_MNU_FILE_SAVE, ID_MNUFILESAVEAS, ID_MNU_FILE_EXIT, ID_MNU_EDIT_CUT, ID_MNU_EDIT_COPY, ID_MNU_EDIT_PASTE, ID_MNU_HELP_ABOUT, ID_MNU_FILE_IMPORT, ID_MNU_FILE, ID_MNU_FILE_DIAGRAM_PROPERTIES, ID_MNU_FILE_PRINT_SETUP, ID_MNU_FILE_PRINT_PREVIEW, ID_MNU_FILE_PRINT, ID_MNU_ADD_PYUT_HIERARCHY, ID_MNU_ADD_OGL_HIERARCHY, ID_MENU_GRAPHIC_ERROR_VIEW, ID_MENU_TEXT_ERROR_VIEW, ID_MENU_RAISE_ERROR_VIEW, ID_MNU_HELP_INDEX, ID_MNU_HELP_WEB, ID_MNU_FILE_EXPORT, ID_MNU_EDIT_SHOW_TOOLBAR, ID_ARROW, ID_CLASS, ID_REL_INHERITANCE, ID_REL_REALISATION, ID_REL_COMPOSITION, ID_REL_AGGREGATION, ID_REL_ASSOCIATION, ID_MNU_PROJECT_CLOSE, ID_NOTE, ID_ACTOR, ID_USECASE, ID_REL_NOTE, ID_MNU_HELP_VERSION, ID_MENU_FILE_PYUT_PREFERENCES, ID_MNU_FILE_NEW_CLASS_DIAGRAM, ID_MNU_FILE_NEW_SEQUENCE_DIAGRAM, ID_MNU_FILE_NEW_USECASE_DIAGRAM, ID_SD_INSTANCE, ID_MNU_FILE_INSERT_PROJECT, ID_SD_MESSAGE, ID_MNU_EDIT_SELECT_ALL, ID_MNU_FILE_REMOVE_DOCUMENT, ID_DEBUG, ID_ZOOM_IN, ID_ZOOM_OUT, ID_ZOOM_VALUE, ID_MNU_REDO, ID_MNU_UNDO ] = PyutUtils.assignID(52) ACTIONS = { ID_ARROW: ACTION_SELECTOR, ID_CLASS: ACTION_NEW_CLASS, ID_NOTE: ACTION_NEW_NOTE, ID_REL_INHERITANCE: ACTION_NEW_INHERIT_LINK, ID_REL_REALISATION: ACTION_NEW_IMPLEMENT_LINK, ID_REL_COMPOSITION: ACTION_NEW_COMPOSITION_LINK, ID_REL_AGGREGATION: ACTION_NEW_AGGREGATION_LINK, ID_REL_ASSOCIATION: ACTION_NEW_ASSOCIATION_LINK, ID_REL_NOTE: ACTION_NEW_NOTE_LINK, ID_ACTOR: ACTION_NEW_ACTOR, ID_USECASE: ACTION_NEW_USECASE, ID_SD_INSTANCE: ACTION_NEW_SD_INSTANCE, ID_SD_MESSAGE: ACTION_NEW_SD_MESSAGE, ID_ZOOM_IN: ACTION_ZOOM_IN, ID_ZOOM_OUT: ACTION_ZOOM_OUT, }
def __init__(self, parent: Window): super().__init__(parent, ID_ANY) [ self._cbBoldTextId, self._cbItalicizeTextId, self._cbxFontSelectorId, self._cbxFontSizeSelectorId ] = PyutUtils.assignID(4) self.logger: Logger = getLogger(__name__) self._preferences: PyutPreferences = PyutPreferences() # # Controls we are going to create # self._cbBoldText: CheckBox = cast(CheckBox, None) self._cbItalicizeText: CheckBox = cast(CheckBox, None) self._cbxFontSelector: ComboBox = cast(ComboBox, None) self._cbxFontSizeSelector: ComboBox = cast(ComboBox, None) szrText: BoxSizer = BoxSizer(VERTICAL) self._textDimensions: DimensionsContainer = DimensionsContainer( parent=self, displayText=_('Text Width/Height'), valueChangedCallback=self._onTextDimensionsChanged) szrText.Add(self._textDimensions, 0, ALL, TextAttributesContainer.HORIZONTAL_GAP) szrText.Add(self.__createTextStyleContainer(parent=self), 0, ALL, TextAttributesContainer.HORIZONTAL_GAP) szrText.Add(self.__createFontAttributeContainer(parent=self), 0, ALL, TextAttributesContainer.HORIZONTAL_GAP) self.SetSizer(szrText) self.Fit() self._bindControls() self._setControlValues()
def __init__(self, parent: Window, wxID: int, title: str): """ Args: parent: parent window wxID: wx ID of this frame title: Title to display """ self._prefs: PyutPreferences = PyutPreferences() appSize: Size = Size(self._prefs.startupWidth, self._prefs.startupHeight) super().__init__(parent=parent, id=wxID, title=title, size=appSize, style=DEFAULT_FRAME_STYLE | FRAME_EX_METAL) self.logger: Logger = getLogger(__name__) # Create the application's icon if sysPlatform != PyutConstants.THE_GREAT_MAC_PLATFORM: fileName: str = PyutUtils.getResourcePath( packageName=IMAGE_RESOURCES_PACKAGE, fileName='pyut.ico') icon: Icon = Icon(fileName, BITMAP_TYPE_ICO) self.SetIcon(icon) self.SetThemeEnabled(True) if self._prefs.centerAppOnStartUp is True: self.Center(BOTH) # Center on the screen else: appPosition: Tuple[int, int] = self._prefs.appStartupPosition self.SetPosition(pt=appPosition) self.CreateStatusBar() # Properties from org.pyut.plugins.PluginManager import PluginManager # Plugin Manager should not be in plugins directory self.plugMgr: PluginManager = PluginManager() self.plugins: SharedTypes.PluginMap = cast(SharedTypes.PluginMap, {}) # To store the plugins self._toolboxIds: SharedTypes.ToolboxIdMap = cast( SharedTypes.ToolboxIdMap, {}) # Association toolbox id -> category self.mnuFile: Menu = cast(Menu, None) self._clipboard = [] self._currentDirectory = getcwd() self._lastDir = self._prefs["LastDirectory"] if self._lastDir is None: # Assert that the path is present self._lastDir = getcwd() self._ctrl = getMediator() self._ctrl.registerStatusBar(self.GetStatusBar()) self._ctrl.resetStatusText() self._ctrl.registerAppFrame(self) # Last opened Files IDs self.lastOpenedFilesID = [] for index in range(self._prefs.getNbLOF()): self.lastOpenedFilesID.append(PyutUtils.assignID(1)[0]) self._mainFileHandlingUI: MainUI = MainUI(self, self._ctrl) self._ctrl.registerFileHandling(self._mainFileHandlingUI) # Initialization self._initPyutTools() # Toolboxes, toolbar self._initMenu() # Menu self._initPrinting() # Printing data # Accelerators init. (=Keyboards shortcuts) acc = self._createAcceleratorTable() accel_table = AcceleratorTable(acc) self.SetAcceleratorTable(accel_table) self._ctrl.registerAppPath(self._currentDirectory) # set application title self._mainFileHandlingUI.newProject() self._ctrl.updateTitle() # Init tips frame self._alreadyDisplayedTipsFrame = False self.Bind(EVT_ACTIVATE, self._onActivate)
from org.pyut.model.PyutField import PyutField from org.pyut.PyutUtils import PyutUtils from org.pyut.dialogs.BaseDlgEdit import BaseDlgEdit from org.pyut.model.PyutVisibilityEnum import PyutVisibilityEnum # noinspection PyProtectedMember from org.pyut.general.Globals import _ [ ID_TXT_FIELD_NAME, ID_BTN_FIELD_OK, ID_BTN_FIELD_CANCEL ] = PyutUtils.assignID(3) class DlgEditField(BaseDlgEdit): def __init__(self, theParent, theWindowId, fieldToEdit: PyutField, theMediator=None): super().__init__(theParent, theWindowId, _("Field Edit"), theStyle=RESIZE_BORDER | CAPTION | STAY_ON_TOP, theMediator=theMediator) self._fieldToEdit: PyutField = fieldToEdit # ---------------- # Design of dialog # ---------------- self.SetAutoLayout(True) # RadioBox Visibility
from wx import Timer from wx import TimerEvent from wx import Yield as wxYield from org.pyut.PyutConstants import PyutConstants from org.pyut.PyutUtils import PyutUtils from org.pyut.enums.ResourceTextType import ResourceTextType from org.pyut.general.Globals import IMAGE_RESOURCES_PACKAGE # Constants from org.pyut.resources.img import ImgPyut [ID_OK] = PyutUtils.assignID(1) FrameWidth = 400 # Canvas width FrameHeight = 300 # and height x0 = 20 # Initial x y0 = 20 # Initial y dy = 20 # Y increment class DlgAbout(Dialog): TIMER_UPDATE_MSECS: int = 20 """ DlgAbout : About box for Pyut. Use it like a normal dialog box
from wx import RESIZE_BORDER from wx import VERTICAL from wx import ID_ANY from wx import ID_OK from wx import ListBox from wx import StaticText from wx import BoxSizer from wx import Dialog from wx import Button from org.pyut.PyutUtils import PyutUtils from org.pyut.general.Globals import _ [ID_BTN_TO_THE_RIGHT, ID_BTN_TO_THE_LEFT] = PyutUtils.assignID(2) class DlgAskWhichClassesToReverse(Dialog): def __init__(self, lstClasses): super().__init__(None, ID_ANY, "Classes choice", style=CAPTION | RESIZE_BORDER, size=(400, 500)) # Create not chosen classes listBox self._listBox1 = ListBox(self, ID_ANY, style=LB_EXTENDED | LB_ALWAYS_SB | LB_SORT, size=(320, 400)) for klass in lstClasses: self._listBox1.Append(klass.__name__, klass) # Create chosen classes listBox self._listBox2 = ListBox(self, ID_ANY, style=LB_EXTENDED | LB_ALWAYS_SB | LB_SORT, size=(320, 400))
from org.pyut.dialogs.tips.TipHandler import TipHandler from org.pyut.preferences.PyutPreferences import PyutPreferences from org.pyut.resources.img.ImgTipsFrameTipsLogo import embeddedImage as TipsLogo from org.pyut.general.Globals import _ # DEFAULT SIZE DEFAULT_WIDTH = 600 DEFAULT_HEIGHT = 100 # Constants [ID_OK, ID_SET_NEXT_TIP, ID_SET_PREVIOUS_TIP, ID_CHK_SHOW_TIPS] = PyutUtils.assignID(4) class DlgTips(Dialog): TIPS_FILENAME: str = 'tips.txt' """ Represents a tips dialog for displaying Pyut features. """ def __init__(self, parent): """ """ dialogStyle: int = RESIZE_BORDER | SYSTEM_MENU | CAPTION | FRAME_FLOAT_ON_PARENT | STAY_ON_TOP dialogSize: Size = Size(DEFAULT_WIDTH, DEFAULT_HEIGHT) super().__init__(parent, ID_ANY, _("Tips"), DefaultPosition, dialogSize, dialogStyle)
from wx import RESIZE_BORDER from wx import RIGHT from wx import TE_MULTILINE from wx import VERTICAL from wx import BoxSizer from wx import Button from wx import TextCtrl from wx import Dialog from wx import StaticText from org.pyut.PyutUtils import PyutUtils from org.pyut.general.Globals import _ [TXT_USECASE] = PyutUtils.assignID(1) class DlgEditUseCase(Dialog): """ Defines a multiline text control dialog for use case editing. This dialog is used to ask the user to enter the text that will be displayed into an UML Use case. Sample of use:: dlg = DlgEditUseCase(self._uml, -1, pyutUseCase) dlg.Destroy() :version: $Revision: 1.5 $ :author: Philippe Waelti :contact: [email protected]
from wx import StaticText from wx import TextCtrl from wx import VERTICAL from org.pyut.model import PyutField from org.pyut.PyutUtils import PyutUtils from org.pyut.dialogs.BaseDlgEdit import BaseDlgEdit from org.pyut.model.PyutVisibilityEnum import PyutVisibilityEnum from org.pyut.general.Globals import _ [ID_TXT_FIELD_NAME, ID_BTN_FIELD_OK, ID_BTN_FIELD_CANCEL] = PyutUtils.assignID(3) class DlgEditField(BaseDlgEdit): def __init__(self, theParent, theWindowId=ID_ANY, fieldToEdit: PyutField = None, theMediator=None): super().__init__(theParent, theWindowId, _("Field Edit"), theStyle=RESIZE_BORDER | CAPTION | STAY_ON_TOP, theMediator=theMediator)
from wx import Size from wx import BoxSizer from wx import Button from wx import DefaultPosition from wx.html import HtmlWindow from wx.html import HtmlEasyPrinting from wx.lib.dialogs import ScrolledMessageDialog from org.pyut.PyutUtils import PyutUtils from org.pyut.general.Globals import _ [ID_LOAD_FILE, ID_BACK, ID_FORWARD, ID_PRINT, ID_VIEW_SOURCE] = PyutUtils.assignID(5) class DlgHelp(Dialog): HELP_PKG_NAME: str = 'help' """ Pyut help dialog frame. Used to show help and navigate through it. To use it from a wxFrame : dlg = DlgHelp(self, -1, "Pyut Help") dlg.Show() dlg.destroy() :version: $Revision: 1.7 $ :author: C.Dutoit
def __initializeTheControls(self): """ Initialize the controls. """ # IDs [ self.__autoResizeID, self.__showParamsID, self.__languageID, self.__maximizeID, self.__fontSizeID, self.__showTipsID, self.__centerDiagramID, self.__resetTipsID, self.__scAppWidthID, self.__scAppHeightID, self.__scAppPosXID, self.__scAppPosYID ] = PyutUtils.assignID(12) self.__createBooleanControls() self.__createFontSizeControl() self.__cmbLanguage: ComboBox = cast(ComboBox, None) szrLanguage: BoxSizer = self.__createLanguageControlContainer() hs: BoxSizer = self.__createDialogButtonsContainer() box: StaticBox = StaticBox(self, ID_ANY, "") mainSizer: StaticBoxSizer = StaticBoxSizer(box, VERTICAL) # mainSizer.Add(window=self.__cbAutoResize, proportion=0, flag=ALL, border=DlgPyutPreferences.VERTICAL_GAP) mainSizer.Add(self.__cbAutoResize, 0, ALL, DlgPyutPreferences.VERTICAL_GAP) mainSizer.Add(self.__cbShowParams, 0, ALL, DlgPyutPreferences.VERTICAL_GAP) mainSizer.Add(self.__cbMaximize, 0, ALL, DlgPyutPreferences.VERTICAL_GAP) mainSizer.Add(self.__cbShowTips, 0, ALL, DlgPyutPreferences.VERTICAL_GAP) mainSizer.Add(self.__cbCenterDiagram, 0, ALL, DlgPyutPreferences.VERTICAL_GAP) mainSizer.Add(self.__createAppPositionControls(), 0, ALL, DlgPyutPreferences.VERTICAL_GAP) mainSizer.Add(self.__createAppSizeControls(), 0, ALL, DlgPyutPreferences.VERTICAL_GAP) mainSizer.Add(self.__btnResetTips, 0, ALL, DlgPyutPreferences.VERTICAL_GAP) mainSizer.Add(szrLanguage, 0, ALL, DlgPyutPreferences.VERTICAL_GAP) mainSizer.Add(hs, 0, CENTER) border: BoxSizer = BoxSizer() border.Add(mainSizer, 1, EXPAND | ALL, 3) self.SetAutoLayout(True) self.SetSizer(border) border.Fit(self) border.SetSizeHints(self) self.Bind(EVT_CHECKBOX, self.__OnCheckBox, id=self.__autoResizeID) self.Bind(EVT_CHECKBOX, self.__OnCheckBox, id=self.__showParamsID) self.Bind(EVT_CHECKBOX, self.__OnCheckBox, id=self.__maximizeID) self.Bind(EVT_CHECKBOX, self.__OnCheckBox, id=self.__showTipsID) self.Bind(EVT_CHECKBOX, self.__OnCheckBox, id=self.__centerDiagramID) self.Bind(EVT_SPINCTRL, self.__OnSizeChange, id=self.__scAppWidthID) self.Bind(EVT_SPINCTRL, self.__OnSizeChange, id=self.__scAppHeightID) self.Bind(EVT_BUTTON, self.__OnBtnResetTips, id=self.__resetTipsID) self.Bind(EVT_COMBOBOX, self.__OnLanguageChange, id=self.__languageID) self.Bind(EVT_BUTTON, self.__OnCmdOk, id=ID_OK) self.__changed: bool = False self.__setValues()
# noinspection PyProtectedMember from org.pyut.general.Globals import _ [ ID_TXT_METHOD_NAME, ID_LST_PARAM_LIST, ID_BTN_PARAM_ADD, ID_BTN_PARAM_EDIT, ID_BTN_PARAM_REMOVE, ID_BTN_PARAM_UP, ID_BTN_PARAM_DOWN, ID_BTN_METHOD_CODE, ID_BTN_METHOD_OK, ID_BTN_METHOD_CANCEL, ] = PyutUtils.assignID(10) class DlgEditMethod(BaseDlgEdit): def __init__(self, parent, windowId, pyutMethod: PyutMethod, mediator=None, editInterface: bool = False): super().__init__(parent, windowId, _("Method Edit"), theStyle=RESIZE_BORDER | CAPTION | STAY_ON_TOP, theMediator=mediator)
from wx import EVT_TEXT from wx import ID_ANY from wx import StaticText from wx import TextCtrl from wx import Window from org.pyut.PyutUtils import PyutUtils from org.pyut.dialogs.textdialogs.BaseDlgEditText import BaseDlgEditText from org.pyut.ui.PyutDocument import PyutDocument from org.pyut.general.Globals import _ [TXT_DOCUMENT_NAME] = PyutUtils.assignID(1) class DlgEditDocument(BaseDlgEditText): def __init__(self, parent: Window, dialogIdentifier, document: PyutDocument): """ Args: parent: The parent window dialogIdentifier An identifier for the dialog document: The UML document we want to edit """ super().__init__(parent, dialogIdentifier, _("Document Edit")) self.logger: Logger = getLogger(__name__)
from logging import Logger from logging import getLogger from org.pyut.PyutUtils import PyutUtils from org.pyut.model.PyutObject import * [INSTANCE_TYPE_ACTOR, INSTANCE_TYPE_CLASS] = PyutUtils.assignID(2) # List of possible instance type INSTANCE_TYPES = [INSTANCE_TYPE_ACTOR, INSTANCE_TYPE_CLASS] class PyutSDInstance(PyutObject): """ Data layer representation of a UML Collaboration instance (C.Diagram). :version: $Revision: 1.10 $ :author: C.Dutoit :contact: [email protected] """ def __init__(self): """ Constructor. @author C.Dutoit """ super().__init__() self.logger: Logger = getLogger(__name__) self._instanceName: str = "Unnamed instance" self._instanceGraphicalType: int = INSTANCE_TYPE_CLASS self._lifeLineLength: int = 200
def __init__(self, parent: Window, wxID: int, title: str): """ Args: parent: parent window wxID: wx ID of this frame title: Title to display """ self._prefs: PyutPreferences = PyutPreferences() appSize: Size = Size(self._prefs.startupSize.width, self._prefs.startupSize.height) super().__init__(parent=parent, id=wxID, title=title, size=appSize, style=DEFAULT_FRAME_STYLE | FRAME_EX_METAL) self.logger: Logger = getLogger(__name__) self._createApplicationIcon() self._plugMgr: PluginManager = PluginManager() self.CreateStatusBar() self._treeNotebookHandler: TreeNotebookHandler = TreeNotebookHandler( self) self._mediator: Mediator = Mediator() self._mediator.registerStatusBar(self.GetStatusBar()) self._mediator.resetStatusText() self._mediator.registerAppFrame(self) self._mediator.registerFileHandling(self._treeNotebookHandler) self._mediator.registerAppPath(getcwd()) # Last opened Files IDs self.lastOpenedFilesID = [] for index in range(self._prefs.getNbLOF()): self.lastOpenedFilesID.append(PyutUtils.assignID(1)[0]) self._toolPlugins: PluginMap = self._plugMgr.mapWxIdsToToolPlugins() self._importPlugins: PluginMap = self._plugMgr.mapWxIdsToImportPlugins( ) self._exportPlugins: PluginMap = self._plugMgr.mapWxIdsToExportPlugins( ) # Initialization fileMenu: Menu = Menu() editMenu: Menu = Menu() toolsMenu: Menu = Menu() helpMenu: Menu = Menu() self._fileMenuHandler: FileMenuHandler = FileMenuHandler( fileMenu=fileMenu, lastOpenFilesIDs=self.lastOpenedFilesID) self._editMenuHandler: EditMenuHandler = EditMenuHandler( editMenu=editMenu) self._initializePyutTools() self._toolboxIds: ToolboxIdMap = self._createToolboxIdMap() self._toolsMenuHandler: ToolsMenuHandler = ToolsMenuHandler( toolsMenu=toolsMenu, toolPluginsMap=self._toolPlugins, toolboxIds=self._toolboxIds) self._helpMenuHandler: HelpMenuHandler = HelpMenuHandler( helpMenu=helpMenu) self._menuCreator: MenuCreator = MenuCreator( frame=self, lastOpenFilesID=self.lastOpenedFilesID) self._menuCreator.fileMenu = fileMenu self._menuCreator.editMenu = editMenu self._menuCreator.toolsMenu = toolsMenu self._menuCreator.helpMenu = helpMenu self._menuCreator.fileMenuHandler = self._fileMenuHandler self._menuCreator.editMenuHandler = self._editMenuHandler self._menuCreator.toolsMenuHandler = self._toolsMenuHandler self._menuCreator.helpMenuHandler = self._helpMenuHandler self._menuCreator.toolPlugins = self._toolPlugins self._menuCreator.exportPlugins = self._exportPlugins self._menuCreator.importPlugins = self._importPlugins self._menuCreator.toolboxIds = self._toolboxIds self._menuCreator.initializeMenus() self.__setupKeyboardShortcuts() # set application title self._treeNotebookHandler.newProject() self._mediator.updateTitle() if self._prefs.centerAppOnStartUp is True: self.Center(BOTH) # Center on the screen else: appPosition: Position = self._prefs.startupPosition self.SetPosition(pt=Point(x=appPosition.x, y=appPosition.y)) # Initialize the tips frame self._alreadyDisplayedTipsFrame = False self.SetDropTarget( PyutFileDropTarget(treeNotebookHandler=self._treeNotebookHandler)) if self.GetThemeEnabled() is True: self.SetThemeEnabled(True) self.Bind(EVT_ACTIVATE, self._onActivate) self.Bind(EVT_CLOSE, self.Close)
from wx import EVT_TEXT from wx import TE_MULTILINE from wx import CommandEvent from wx import TextCtrl from wx import Window from org.pyut.dialogs.textdialogs.BaseDlgEditText import BaseDlgEditText from org.pyut.model.PyutText import PyutText from org.pyut.PyutUtils import PyutUtils from org.pyut.general.Globals import _ [ID_TEXT_LINE] = PyutUtils.assignID(1) class DlgEditText(BaseDlgEditText): """ Defines a multi-line text control dialog for placing an editing text on the UML Diagram Sample use: dlg = DlgEditText(self._uml, ID_ANY, pyutText) dlg.ShowModal() dlg.Destroy() """ def __init__(self, parent: Window, dialogIdentifier, pyutText: PyutText): """
from wx import ID_ANY from wx import TE_MULTILINE from wx import CommandEvent from wx import TextCtrl from wx import StaticText from wx import Window from org.pyut.dialogs.textdialogs.BaseDlgEditText import BaseDlgEditText from org.pyut.model.PyutNote import PyutNote from org.pyut.PyutUtils import PyutUtils from org.pyut.general.Globals import _ [TXT_NOTE] = PyutUtils.assignID(1) class DlgEditNote(BaseDlgEditText): """ Defines a multi-line text control dialog for note editing. This dialog is used to ask the user to enter the text that will be displayed in a UML note. Sample use: dlg = DlgEditNote(self._uml, ID_ANY, pyutNote) dlg.Destroy() """ def __init__(self, parent: Window, dialogIdentifier, pyutNote: PyutNote): """
def testAssignId(self): testIds = [Test_Id1, Test_Id2, Test_Id3] = PyutUtils.assignID(3) self.logger.info(f'test Ids: {testIds}') self.assertIsNotNone(Test_Id1, 'Test_Id1 - Should not be None') self.assertIsNotNone(Test_Id2, 'Test_Id2 - Should not be None') self.assertIsNotNone(Test_Id3, 'Test_Id3 - Should not be None')