Пример #1
0
    def _createActionPage(self, notebook):
        """Create notebook page for action settings"""
        panel = wx.Panel(parent=notebook, id=wx.ID_ANY)
        notebook.AddPage(page=panel, text=_("Command"))

        # colors
        border = wx.BoxSizer(wx.VERTICAL)
        box = StaticBox(parent=panel, id=wx.ID_ANY,
                        label=" %s " % _("Color"))
        sizer = wx.StaticBoxSizer(box, wx.VERTICAL)

        gridSizer = wx.GridBagSizer(hgap=3, vgap=3)

        row = 0
        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
                                 label=_("Valid:")),
                      flag=wx.ALIGN_LEFT |
                      wx.ALIGN_CENTER_VERTICAL,
                      pos=(row, 0))
        vColor = csel.ColourSelect(
            parent=panel, id=wx.ID_ANY, colour=self.settings.Get(
                group='modeler', key='action', subkey=(
                    'color', 'valid')), size=globalvar.DIALOG_COLOR_SIZE)
        vColor.SetName('GetColour')
        self.winId['modeler:action:color:valid'] = vColor.GetId()

        gridSizer.Add(vColor,
                      flag=wx.ALIGN_RIGHT |
                      wx.ALIGN_CENTER_VERTICAL,
                      pos=(row, 1))

        row += 1
        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
                                 label=_("Invalid:")),
                      flag=wx.ALIGN_LEFT |
                      wx.ALIGN_CENTER_VERTICAL,
                      pos=(row, 0))
        iColor = csel.ColourSelect(
            parent=panel, id=wx.ID_ANY, colour=self.settings.Get(
                group='modeler', key='action', subkey=(
                    'color', 'invalid')), size=globalvar.DIALOG_COLOR_SIZE)
        iColor.SetName('GetColour')
        self.winId['modeler:action:color:invalid'] = iColor.GetId()

        gridSizer.Add(iColor,
                      flag=wx.ALIGN_RIGHT |
                      wx.ALIGN_CENTER_VERTICAL,
                      pos=(row, 1))

        row += 1
        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
                                 label=_("Running:")),
                      flag=wx.ALIGN_LEFT |
                      wx.ALIGN_CENTER_VERTICAL,
                      pos=(row, 0))
        rColor = csel.ColourSelect(
            parent=panel, id=wx.ID_ANY, colour=self.settings.Get(
                group='modeler', key='action', subkey=(
                    'color', 'running')), size=globalvar.DIALOG_COLOR_SIZE)
        rColor.SetName('GetColour')
        self.winId['modeler:action:color:running'] = rColor.GetId()

        gridSizer.Add(rColor,
                      flag=wx.ALIGN_RIGHT |
                      wx.ALIGN_CENTER_VERTICAL,
                      pos=(row, 1))

        gridSizer.AddGrowableCol(0)
        sizer.Add(
            gridSizer,
            proportion=1,
            flag=wx.ALL | wx.EXPAND,
            border=5)
        border.Add(sizer, proportion=0, flag=wx.LEFT |
                   wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3)

        # size
        box = StaticBox(parent=panel, id=wx.ID_ANY,
                        label=" %s " % _("Shape size"))
        sizer = wx.StaticBoxSizer(box, wx.VERTICAL)

        gridSizer = wx.GridBagSizer(hgap=3, vgap=3)

        row = 0
        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
                                 label=_("Width:")),
                      flag=wx.ALIGN_LEFT |
                      wx.ALIGN_CENTER_VERTICAL,
                      pos=(row, 0))

        width = SpinCtrl(
            parent=panel,
            id=wx.ID_ANY,
            min=0,
            max=500,
            initial=self.settings.Get(
                group='modeler',
                key='action',
                subkey=(
                    'size',
                    'width')))
        width.SetName('GetValue')
        self.winId['modeler:action:size:width'] = width.GetId()

        gridSizer.Add(width,
                      flag=wx.ALIGN_RIGHT |
                      wx.ALIGN_CENTER_VERTICAL,
                      pos=(row, 1))

        row += 1
        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
                                 label=_("Height:")),
                      flag=wx.ALIGN_LEFT |
                      wx.ALIGN_CENTER_VERTICAL,
                      pos=(row, 0))

        height = SpinCtrl(
            parent=panel,
            id=wx.ID_ANY,
            min=0,
            max=500,
            initial=self.settings.Get(
                group='modeler',
                key='action',
                subkey=(
                    'size',
                    'height')))
        height.SetName('GetValue')
        self.winId['modeler:action:size:height'] = height.GetId()

        gridSizer.Add(height,
                      flag=wx.ALIGN_RIGHT |
                      wx.ALIGN_CENTER_VERTICAL,
                      pos=(row, 1))

        gridSizer.AddGrowableCol(0)
        sizer.Add(
            gridSizer,
            proportion=1,
            flag=wx.ALL | wx.EXPAND,
            border=5)
        border.Add(sizer, proportion=0, flag=wx.LEFT |
                   wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3)

        panel.SetSizer(border)

        return panel
Пример #2
0
    def _createCommentPage(self, notebook):
        """Create notebook page for comment settings"""
        panel = wx.Panel(parent=notebook, id=wx.ID_ANY)
        notebook.AddPage(page=panel, text=_("Comment"))

        # colors
        border = wx.BoxSizer(wx.VERTICAL)
        box = StaticBox(parent=panel, id=wx.ID_ANY, label=" %s " % _("Color"))
        sizer = wx.StaticBoxSizer(box, wx.VERTICAL)

        gridSizer = wx.GridBagSizer(hgap=3, vgap=3)

        row = 0
        gridSizer.Add(
            StaticText(parent=panel, id=wx.ID_ANY, label=_("Valid:")),
            flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL,
            pos=(row, 0),
        )
        vColor = csel.ColourSelect(
            parent=panel,
            id=wx.ID_ANY,
            colour=self.settings.Get(group="modeler",
                                     key="comment",
                                     subkey="color"),
            size=globalvar.DIALOG_COLOR_SIZE,
        )
        vColor.SetName("GetColour")
        self.winId["modeler:comment:color"] = vColor.GetId()

        gridSizer.Add(vColor,
                      flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL,
                      pos=(row, 1))

        gridSizer.AddGrowableCol(0)
        sizer.Add(gridSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=5)
        border.Add(
            sizer,
            proportion=0,
            flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND,
            border=3,
        )

        # size
        box = StaticBox(parent=panel,
                        id=wx.ID_ANY,
                        label=" %s " % _("Shape size"))
        sizer = wx.StaticBoxSizer(box, wx.VERTICAL)

        gridSizer = wx.GridBagSizer(hgap=3, vgap=3)

        row = 0
        gridSizer.Add(
            StaticText(parent=panel, id=wx.ID_ANY, label=_("Width:")),
            flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL,
            pos=(row, 0),
        )

        width = SpinCtrl(
            parent=panel,
            id=wx.ID_ANY,
            min=0,
            max=500,
            initial=self.settings.Get(group="modeler",
                                      key="comment",
                                      subkey=("size", "width")),
        )
        width.SetName("GetValue")
        self.winId["modeler:comment:size:width"] = width.GetId()

        gridSizer.Add(width,
                      flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL,
                      pos=(row, 1))

        row += 1
        gridSizer.Add(
            StaticText(parent=panel, id=wx.ID_ANY, label=_("Height:")),
            flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL,
            pos=(row, 0),
        )

        height = SpinCtrl(
            parent=panel,
            id=wx.ID_ANY,
            min=0,
            max=500,
            initial=self.settings.Get(group="modeler",
                                      key="comment",
                                      subkey=("size", "height")),
        )
        height.SetName("GetValue")
        self.winId["modeler:comment:size:height"] = height.GetId()

        gridSizer.Add(height,
                      flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL,
                      pos=(row, 1))

        gridSizer.AddGrowableCol(0)
        sizer.Add(gridSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=5)
        border.Add(
            sizer,
            proportion=0,
            flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND,
            border=3,
        )

        panel.SetSizer(border)

        return panel