Example #1
0
    def _createIssueSelection(self) -> StaticBoxSizer:

        issueWxID: int = wxNewIdRef()

        self._issueList: ListBox = ListBox(self,
                                           issueWxID,
                                           style=LB_MULTIPLE | LB_OWNERDRAW)

        # noinspection PyUnresolvedReferences
        self._issueList.Enable(False)
        sz = StaticBoxSizer(VERTICAL, self, "Repository Issues")
        sz.Add(self._issueList, BasePanel.PROPORTION_CHANGEABLE, EXPAND)

        return sz
    def _createTodoTaskList(self) -> StaticBoxSizer:

        taskWxID: int = wxNewIdRef()

        self._taskList: ListBox = ListBox(self,
                                          taskWxID,
                                          style=LB_OWNERDRAW | LB_ALWAYS_SB)
        # noinspection PyUnresolvedReferences
        self._taskList.Enable(False)

        sz = StaticBoxSizer(VERTICAL, self, "Todoist Tasks")
        sz.Add(self._taskList, BasePanel.PROPORTION_CHANGEABLE, EXPAND)

        self._taskList.SetItems(['Empty'])
        return sz
Example #3
0
    def __createSimpleGridOptions(self) -> BoxSizer:

        szrSimple: BoxSizer = BoxSizer(VERTICAL)

        cbEnableBackgroundGrid: CheckBox = CheckBox(
            self, self.enableBackgroundGridID, _('Enable Background Grid'))
        cbSnapToGrid: CheckBox = CheckBox(self, self.snapToGridID,
                                          _('Snap to Grid'))

        box: StaticBox = StaticBox(self, ID_ANY, _("Grid Interval"))
        szrGridInterval: StaticBoxSizer = StaticBoxSizer(
            box, HORIZONTAL | ALIGN_LEFT)

        scGridInterval: SpinCtrl = SpinCtrl(self, self.scGridIntervalID, "")

        szrGridInterval.Add(scGridInterval, 0, LEFT | RIGHT,
                            BackgroundPreferences.HORIZONTAL_GAP)

        szrSimple.Add(cbEnableBackgroundGrid, 0, LEFT | RIGHT,
                      BackgroundPreferences.VERTICAL_GAP)
        szrSimple.Add(cbSnapToGrid, 0, LEFT | BOTTOM,
                      BackgroundPreferences.VERTICAL_GAP)

        szrSimple.AddSpacer(BackgroundPreferences.VERTICAL_GAP)
        szrSimple.Add(szrGridInterval, 0, LEFT | RIGHT | TOP,
                      BackgroundPreferences.VERTICAL_GAP)

        self._cbEnableBackgroundGrid: CheckBox = cbEnableBackgroundGrid
        self._cbSnapToGrid: CheckBox = cbSnapToGrid
        self._scGridInterval: SpinCtrl = scGridInterval

        return szrSimple
Example #4
0
    def __createLanguageControlContainer(self) -> StaticBoxSizer:
        """
        Creates the language control inside a container

        Returns:
            The sizer that contains the language selection control
        """
        self.clsLogger.info(f'We are running on: {platform}')

        choices = [el[0] for el in list(LANGUAGES.values())]

        if platform == PyutConstants.THE_GREAT_MAC_PLATFORM:
            self.__cmbLanguage = ComboBox(self,
                                          self.__languageID,
                                          choices=choices,
                                          style=CB_READONLY | CB_SORT)
        else:
            self.__cmbLanguage = ComboBox(self,
                                          self.__languageID,
                                          choices=choices,
                                          style=CB_READONLY | CB_SORT)
        box: StaticBox = StaticBox(self, ID_ANY, _("Language"))
        szrGridStyle: StaticBoxSizer = StaticBoxSizer(box, HORIZONTAL)

        szrGridStyle.Add(self.__cmbLanguage, WX_SIZER_CHANGEABLE, ALL,
                         MiscellaneousPreferences.HORIZONTAL_GAP)

        return szrGridStyle
Example #5
0
    def _createMilestoneSelection(self) -> StaticBoxSizer:

        milestoneSelectionWxId: int = wxNewIdRef()

        self._milestoneList: ListBox = ListBox(self,
                                               milestoneSelectionWxId,
                                               style=LB_SINGLE | LB_OWNERDRAW)

        # noinspection PyUnresolvedReferences
        self._milestoneList.Enable(False)
        sz = StaticBoxSizer(VERTICAL, self, "Repository Milestone Titles")
        sz.Add(self._milestoneList, BasePanel.PROPORTION_CHANGEABLE, EXPAND)

        self.Bind(EVT_LISTBOX, self._onMilestoneSelected,
                  milestoneSelectionWxId)

        return sz
Example #6
0
    def _createRepositorySelection(self) -> StaticBoxSizer:

        repoSelectionWxId: int = wxNewIdRef()

        self._repositorySelection: ComboBox = ComboBox(self,
                                                       repoSelectionWxId,
                                                       style=CB_DROPDOWN
                                                       | CB_READONLY)

        sz = StaticBoxSizer(VERTICAL, self, "Repository List")
        sz.Add(self._repositorySelection, BasePanel.PROPORTION_NOT_CHANGEABLE,
               EXPAND)

        self.__populateRepositories()

        self.Bind(EVT_COMBOBOX,
                  self._onRepositorySelected,
                  id=repoSelectionWxId)

        return sz
Example #7
0
    def __createGridStyleChoice(self) -> StaticBoxSizer:

        gridStyles = [s.value for s in PyutPenStyle]

        gridStyleChoice: Choice = Choice(self, ID_ANY, choices=gridStyles)

        box: StaticBox = StaticBox(self, ID_ANY, _("Grid Line Style"))
        szrGridStyle: StaticBoxSizer = StaticBoxSizer(box, HORIZONTAL)
        szrGridStyle.Add(gridStyleChoice, 1, ALL,
                         BackgroundPreferences.HORIZONTAL_GAP)

        self._gridStyleChoice: Choice = gridStyleChoice

        return szrGridStyle
    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)
Example #9
0
    def __layoutImageFormatChoice(self) -> StaticBoxSizer:

        imageChoices: List[str] = [
            ImageFormat.PNG.value, ImageFormat.JPG.value,
            ImageFormat.BMP.value, ImageFormat.GIF.value
        ]
        self._imageFormatChoice = Choice(self,
                                         self.__imageFormatChoiceId,
                                         choices=imageChoices)

        box: StaticBox = StaticBox(self, ID_ANY, "Image Format")
        szrImageFormat: StaticBoxSizer = StaticBoxSizer(box, HORIZONTAL)

        szrImageFormat.Add(self._imageFormatChoice, 0, ALL)

        return szrImageFormat
Example #10
0
    def __createAppSizeControls(self) -> StaticBoxSizer:

        scAppWidth = SpinCtrl(self, self.__scAppWidthID, "", (30, 50))
        scAppHeight = SpinCtrl(self, self.__scAppHeightID, "", (30, 50))

        scAppWidth.SetRange(960, 4096)
        scAppHeight.SetRange(480, 4096)

        box: StaticBox = StaticBox(self, ID_ANY, "Startup Width/Height")
        szrAppSize: StaticBoxSizer = StaticBoxSizer(box, HORIZONTAL)

        szrAppSize.Add(scAppWidth, 0, ALL, DlgPyutPreferences.HORIZONTAL_GAP)
        szrAppSize.Add(scAppHeight, 0, ALL, DlgPyutPreferences.HORIZONTAL_GAP)

        self.__scAppWidth = scAppWidth
        self.__scAppHeight = scAppHeight

        return szrAppSize
Example #11
0
    def __createTextSizeSelectorContainer(self,
                                          parent: Window) -> StaticBoxSizer:

        box: StaticBox = StaticBox(self, ID_ANY, _("Font Size"))
        szrFontSize: StaticBoxSizer = StaticBoxSizer(box, HORIZONTAL)

        fontSizes: List[str] = [
            '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18',
            '19', '20'
        ]
        self._cbxFontSizeSelector = ComboBox(parent,
                                             self._cbxFontSizeSelectorId,
                                             choices=fontSizes,
                                             style=CB_READONLY)

        szrFontSize.Add(self._cbxFontSizeSelector, 1, LEFT | RIGHT,
                        TextAttributesContainer.MINI_GAP)

        return szrFontSize
Example #12
0
    def __createTextFontSelectorContainer(self,
                                          parent: Window) -> StaticBoxSizer:

        fontChoices = []
        for fontName in TextFontEnum:
            fontChoices.append(fontName.value)

        box: StaticBox = StaticBox(self, ID_ANY, _("Text Font"))
        szrFont: StaticBoxSizer = StaticBoxSizer(box, HORIZONTAL)

        self._cbxFontSelector = ComboBox(parent,
                                         self._cbxFontSelectorId,
                                         choices=fontChoices,
                                         style=CB_READONLY)

        szrFont.Add(self._cbxFontSelector, 1, LEFT | RIGHT,
                    TextAttributesContainer.MINI_GAP)

        return szrFont
Example #13
0
    def __layoutImageSizeControls(self) -> StaticBoxSizer:

        imageWidth = SpinCtrl(self,
                              self.__imageWidthId,
                              value=str(self._imageOptions.imageWidth))
        imageHeight = SpinCtrl(self,
                               self.__imageHeightId,
                               value=str(self._imageOptions.imageHeight))

        imageWidth.SetRange(500, 3000)
        imageHeight.SetRange(500, 3000)

        box: StaticBox = StaticBox(self, ID_ANY, "Layout Width/Height")
        szrAppSize: StaticBoxSizer = StaticBoxSizer(box, HORIZONTAL)

        szrAppSize.Add(imageWidth, 0, ALL, DlgImageOptions.HORIZONTAL_GAP)
        szrAppSize.Add(imageHeight, 0, ALL, DlgImageOptions.HORIZONTAL_GAP)

        return szrAppSize
Example #14
0
    def __createLayoutSizeControls(self) -> StaticBoxSizer:

        layoutWidth = SpinCtrl(self, self.__layoutWidthID, "", (30, 50))
        layoutHeight = SpinCtrl(self, self.__layoutHeightID, "", (30, 50))

        layoutWidth.SetRange(500, 3000)
        layoutHeight.SetRange(500, 3000)

        box: StaticBox = StaticBox(self, ID_ANY, "Layout Width/Height")
        szrAppSize: StaticBoxSizer = StaticBoxSizer(box, HORIZONTAL)

        szrAppSize.Add(layoutWidth, 0, ALL, DlgLayoutSize.HORIZONTAL_GAP)
        szrAppSize.Add(layoutHeight, 0, ALL, DlgLayoutSize.HORIZONTAL_GAP)

        self.__layoutWidth = layoutWidth
        self.__layoutHeight = layoutHeight

        self.__layoutWidth.SetValue(self._layoutWidth)
        self.__layoutHeight.SetValue(self._layoutHeight)

        return szrAppSize
Example #15
0
    def __createGridLineColorContainer(self) -> StaticBoxSizer:
        """
        Creates the grid line selection control inside a container

        Returns:
            The sizer that contains the language selection control
        """
        colorChoices = []
        for cc in PyutColorEnum:
            colorChoices.append(cc.value)

        self._cmbGridLineColor: ComboBox = ComboBox(self,
                                                    self.colorID,
                                                    choices=colorChoices,
                                                    style=CB_READONLY)

        box: StaticBox = StaticBox(self, ID_ANY, _("Grid Line Color"))
        szrColor: StaticBoxSizer = StaticBoxSizer(box, HORIZONTAL)

        szrColor.Add(self._cmbGridLineColor, 1, LEFT | RIGHT,
                     BackgroundPreferences.MINI_GAP)

        return szrColor
Example #16
0
    def __createAppPositionControls(self) -> StaticBoxSizer:

        scAppPosX = SpinCtrl(self, self.__scAppPosXID, "", (30, 50))
        scAppPosY = SpinCtrl(self, self.__scAppPosYID, "", (30, 50))

        scAppPosX.SetRange(0, 4096)
        scAppPosY.SetRange(0, 4096)
        scAppPosX.SetValue(self.__prefs.appStartupPosition[0])
        scAppPosY.SetValue(self.__prefs.appStartupPosition[1])

        box: StaticBox = StaticBox(self, ID_ANY, "Startup Position")
        szrAppPosition: StaticBoxSizer = StaticBoxSizer(box, HORIZONTAL)

        szrAppPosition.Add(scAppPosX, 0, ALL,
                           DlgPyutPreferences.HORIZONTAL_GAP)
        szrAppPosition.Add(scAppPosY, 0, ALL,
                           DlgPyutPreferences.HORIZONTAL_GAP)

        self.__scAppPosX = scAppPosX
        self.__scAppPosY = scAppPosY

        self.__setPositionControls()
        return szrAppPosition
Example #17
0
    def __layoutImagePadding(self) -> StaticBoxSizer:

        box: StaticBox = StaticBox(self, ID_ANY, "Shape Padding")
        szrImagePaddingSizer: StaticBoxSizer = StaticBoxSizer(box, HORIZONTAL)

        hGap: int = self._imageOptions.horizontalGap
        vGap: int = self._imageOptions.verticalGap

        horizontalGap: SpinCtrl = SpinCtrl(
            self,
            id=self.__horizontalGapId,
            value=str(hGap),
            min=DlgImageOptions.MIN_UML_SHAPE_GAP,
            max=DlgImageOptions.MAX_UML_SHAPE_GAP)
        verticalGap: SpinCtrl = SpinCtrl(self,
                                         id=self.__verticalGapId,
                                         value=str(vGap),
                                         min=DlgImageOptions.MIN_UML_SHAPE_GAP,
                                         max=DlgImageOptions.MAX_UML_SHAPE_GAP)

        szrImagePaddingSizer.Add(horizontalGap, flag=ALL, border=5)
        szrImagePaddingSizer.Add(verticalGap, flag=ALL, border=5)

        return szrImagePaddingSizer
Example #18
0
    def __layoutFileSelection(self) -> StaticBoxSizer:

        box: StaticBox = StaticBox(self, ID_ANY, label="Output Filename")
        fileSelectionSizer: StaticBoxSizer = StaticBoxSizer(box, HORIZONTAL)

        currentFile: str = self._imageOptions.outputFileName

        fileSelectBtn: Button = Button(self,
                                       label=_("&Select"),
                                       id=self.__fileSelectBtn)
        self._selectedFile: TextCtrl = TextCtrl(self,
                                                value=currentFile,
                                                id=self.__selectedFileId,
                                                style=TE_READONLY)

        self._selectedFile.SetToolTip(currentFile)

        fileSelectionSizer.Add(fileSelectBtn, proportion=0, flag=ALL, border=5)
        fileSelectionSizer.Add(self._selectedFile,
                               proportion=1,
                               flag=ALL | EXPAND,
                               border=5)

        return fileSelectionSizer
    def __init__(self, frameToMonitor: Window, dialogIdentifier):
        """

        Args:
            frameToMonitor:     parent window to center on and the one to monitor
            dialogIdentifier:   An identifier for the dialog
        """
        super().__init__(frameToMonitor, dialogIdentifier, _("Debug Diagram"))

        from org.pyut.MiniOgl.DiagramFrame import DiagramFrame

        self.logger: Logger = getLogger(__name__)
        assert isinstance(frameToMonitor, DiagramFrame)
        self._diagramFrame: DiagramFrame = cast(DiagramFrame, frameToMonitor)

        hs: BoxSizer = self.__createDialogButtonsContainer()
        box: StaticBox = StaticBox(self, ID_ANY, "")

        mainSizer: StaticBoxSizer = StaticBoxSizer(box, VERTICAL)
        self.__initializeTheControls(mainSizer)
        mainSizer.Add(hs, 0, CENTER)

        border: BoxSizer = BoxSizer()
        border.Add(mainSizer,
                   DlgDebugDiagramFrame.PROPORTION_CHANGEABLE,
                   flag=EXPAND | ALL,
                   border=0)

        self.SetAutoLayout(True)
        self.SetSizer(border)

        border.Fit(self)
        border.SetSizeHints(self)

        self.Bind(EVT_BUTTON, self.__OnCmdOk, id=ID_OK)
        self.Bind(EVT_CLOSE, self.__OnClose)
Example #20
0
    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()
Example #21
0
 def build(self, parent):
     box = StaticBox(parent, -1, self.title)
     bsizer = StaticBoxSizer(box, VERTICAL)
     self.add_to_sizer(parent, bsizer)
     return bsizer