コード例 #1
0
    def __init__(self, aParent, aResource):
        ##textfield.TextField.__init__( self, aParent, aResource )

        self._border = aResource.border

        # previously _createDelegate would be called by Widget.__init__
        # so put wxTextCtrl.__init__ here
        if aResource.border == 'none':
            borderStyle = wx.NO_BORDER
        else:
            borderStyle = 0

        self._alignment = aResource.alignment

        wx.TextCtrl.__init__(
            self,
            aParent,
            widget.makeNewId(aResource.id),
            aResource.text,
            aResource.position,
            aResource.size,
            #style = wx.TE_PASSWORD | wx.TE_PROCESS_ENTER | borderStyle | wx.CLIP_SIBLINGS,
            style = wx.TE_PASSWORD | borderStyle | \
                textfield.getAlignment(aResource.alignment) | \
                wx.NO_FULL_REPAINT_ON_RESIZE | wx.CLIP_SIBLINGS,
            name = aResource.name
        )

        widget.Widget.__init__(self, aParent, aResource)

        if not aResource.editable:
            self.SetEditable(False)

        if aResource.border == 'none':
            self.SetBackgroundColour(self.GetParent().GetBackgroundColour())

        #adapter = textfield.TextFieldEventBinding(self)
        #adapter.bindEvents()


##        self._bindEvents(event.WIDGET_EVENTS + textfield.TextFieldEvents)
# KEA 2004-09-24
# changing to CallAfter to force the gainFocus
# event to occur after the initialize event
        wx.CallAfter(self._bindEvents,
                     event.WIDGET_EVENTS + textfield.TextFieldEvents)
コード例 #2
0
    def __init__(self, aParent, aResource):
        wx.CheckBox.__init__(self,
                             aParent,
                             widget.makeNewId(aResource.id),
                             aResource.label,
                             aResource.position,
                             aResource.size,
                             style=wx.CLIP_SIBLINGS
                             | wx.NO_FULL_REPAINT_ON_RESIZE,
                             name=aResource.name)

        widget.Widget.__init__(self, aParent, aResource)

        if aResource.checked:
            self.SetValue(True)

        self._bindEvents(event.WIDGET_EVENTS + CheckBoxEvents)
コード例 #3
0
    def __init__(self, aParent, aResource):
        self._horizontalScrollbar = aResource.horizontalScrollbar
        if aResource.horizontalScrollbar:
            hScroll = wx.HSCROLL
        else:
            hScroll = 0

        self._border = aResource.border
        if aResource.border == 'none':
            borderStyle = wx.NO_BORDER
        else:
            borderStyle = 0

        self._alignment = aResource.alignment

        wx.TextCtrl.__init__(
            self,
            aParent,
            widget.makeNewId(aResource.id),
            aResource.text,
            aResource.position,
            aResource.size,
            # KEA 2004-07-19
            # don't use wx.TE_PROCESS_TAB with 2.5.2 and later
            ##            style =  wx.TE_RICH2 | wx.TE_PROCESS_TAB | wx.TE_MULTILINE | borderStyle | \
            style =  wx.TE_RICH2 | wx.TE_MULTILINE | borderStyle | \
                textfield.getAlignment(aResource.alignment) | hScroll |\
                wx.NO_FULL_REPAINT_ON_RESIZE | wx.CLIP_SIBLINGS,
            name = aResource.name )

        widget.Widget.__init__(self, aParent, aResource)

        if not aResource.editable:
            self.SetEditable(False)

        if aResource.border == 'none':
            self.SetBackgroundColour(self.GetParent().GetBackgroundColour())


##        self._bindEvents(event.WIDGET_EVENTS + textfield.TextFieldEvents)
# KEA 2004-09-24
# changing to CallAfter to force the gainFocus
# event to occur after the initialize event
        wx.CallAfter(self._bindEvents,
                     event.WIDGET_EVENTS + textfield.TextFieldEvents)
コード例 #4
0
    def __init__(self, aParent, aResource):
        wx.StaticText.__init__(
            self,
            aParent,
            widget.makeNewId(aResource.id),
            aResource.text,
            aResource.position,
            aResource.size,
            style = self.__getAlignment(aResource.alignment) | \
                wx.NO_FULL_REPAINT_ON_RESIZE | wx.CLIP_SIBLINGS,
            name = aResource.name
        )

        widget.Widget.__init__(self, aParent, aResource)

        self._alignment = aResource.alignment

        self._bindEvents(event.WIDGET_EVENTS)
コード例 #5
0
        def __init__(self, aParent, aResource):

            FCanvas.FloatCanvas.__init__(
                self,
                aParent,
                widget.makeNewId(aResource.id),
                #wx.wxPoint(aResource.position[0], aResource.position[1]),
                size=aResource.size,
                #aResource.items,
                #style = wx.wxCLIP_SIBLINGS,
                #name = aResource.name,
                ProjectionFun=None,
                BackgroundColor="WHITE",
                Debug=False,
            )

            widget.Widget.__init__(self, aParent, aResource)
            widget.Widget._setPosition(self, aResource.position)
コード例 #6
0
    def __init__(self, aParent, aResource):
        wx.Gauge.__init__(self,
                          aParent,
                          widget.makeNewId(aResource.id),
                          aResource.max,
                          aResource.position,
                          aResource.size,
                          style=self.__getLayout(aResource.layout)
                          | wx.GA_SMOOTH | wx.NO_FULL_REPAINT_ON_RESIZE
                          | wx.CLIP_SIBLINGS,
                          name=aResource.name)

        widget.Widget.__init__(self, aParent, aResource)

        self.SetValue(aResource.value)
        self._layout = aResource.layout

        self._bindEvents(event.WIDGET_EVENTS)
コード例 #7
0
    def __init__(self, aParent, aResource):
        wx.SpinCtrl.__init__(
            self,
            aParent,
            widget.makeNewId(aResource.id),
            str(aResource.value),
            aResource.position,
            aResource.size,
            style = wx.SP_ARROW_KEYS | wx.SP_WRAP | \
                wx.NO_FULL_REPAINT_ON_RESIZE | wx.CLIP_SIBLINGS,
            min = aResource.min,
            max = aResource.max,
            initial = aResource.value,
            name = aResource.name
        )

        widget.Widget.__init__(self, aParent, aResource)

        self._bindEvents(event.WIDGET_EVENTS + SpinnerEvents)
コード例 #8
0
    def __init__(self, aParent, aResource):
        if aResource.rules:
            rules = wx.LC_HRULES | wx.LC_VRULES
        else:
            rules = 0

        self._rules = aResource.rules
        self._maxColumns = aResource.maxColumns
        self._autoresize = 1

        wx.ListCtrl.__init__(
            self,
            aParent,
            widget.makeNewId(aResource.id),
            aResource.position,
            aResource.size,
            #aResource.items,
            style = rules | wx.LC_REPORT | \
                wx.NO_FULL_REPAINT_ON_RESIZE | wx.CLIP_SIBLINGS,
            name = aResource.name
        )

        widget.Widget.__init__(self, aParent, aResource)

        self.itemDataMap = {}
        # Now that the list exists we can init the other base class,
        # see wxPython/lib/mixins/listctrl.py
        ColumnSorterMixin.__init__(self, self._maxColumns)

        # Perform init for AutoWidth (resizes the last column to take up
        # the remaining display width)
        ListCtrlAutoWidthMixin.__init__(self)

        #if aResource.selected != "" and aResource.selected :
        #    self._setSelection( aResource.selected )

        # After creation we can set the headings
        self._setColumnHeadings(aResource.columnHeadings)

        # And load the list
        self._setItems(aResource.items)

        self._bindEvents(event.WIDGET_EVENTS + MultiColumnListEvents)
コード例 #9
0
    def __init__(self, aParent, aResource):
        self._border = aResource.border

        if aResource.border == 'none':
            borderStyle = wx.NO_BORDER
        else:
            borderStyle = 0

        self._alignment = aResource.alignment

        wx.TextCtrl.__init__(
            self,
            aParent,
            widget.makeNewId(aResource.id),
            aResource.text,
            aResource.position,
            aResource.size,
            #style = wxTE_PROCESS_ENTER | borderStyle | wxCLIP_SIBLINGS,
            style = borderStyle | getAlignment(aResource.alignment) | \
                wx.CLIP_SIBLINGS | wx.NO_FULL_REPAINT_ON_RESIZE,
            name = aResource.name)

        widget.Widget.__init__(self, aParent, aResource)

        if not aResource.editable:
            self.SetEditable(False)

        if aResource.border == 'none':
            # the erase background event doesn't appear to make the control
            # transparent, so further investigation is required
            #EVT_ERASE_BACKGROUND(delegate, lambda evt: None)
            self.SetBackgroundColour(self.GetParent().GetBackgroundColour())

        #adapter = TextFieldEventBinding(self)
        #adapter.bindEvents()


##        self._bindEvents(event.WIDGET_EVENTS + TextFieldEvents)
# KEA 2004-09-24
# changing to CallAfter to force the gainFocus
# event to occur after the initialize event
        wx.CallAfter(self._bindEvents, event.WIDGET_EVENTS + TextFieldEvents)
コード例 #10
0
    def __init__(self, aParent, aResource):
        wx.ComboBox.__init__(self,
                             aParent,
                             widget.makeNewId(aResource.id),
                             '',
                             aResource.position,
                             aResource.size,
                             aResource.items,
                             style=wx.CB_DROPDOWN
                             | wx.NO_FULL_REPAINT_ON_RESIZE | wx.CLIP_SIBLINGS,
                             name=aResource.name)

        widget.Widget.__init__(self, aParent, aResource)

        # KEA 2001-08-12
        # need to fix this, these are supposed to be optional
        if aResource.stringSelection:
            self._setStringSelection(aResource.stringSelection)
        if aResource.text != '':
            self.SetValue(aResource.text)

        self._bindEvents(event.WIDGET_EVENTS + ComboBoxEvents)
コード例 #11
0
    def __init__(self, aParent, aResource):
        self._thickness = 1
        self.autoRefresh = True
        self._drawingInProgress = False
        self._bufImage = None

        wx.Window.__init__(self,
                           aParent,
                           widget.makeNewId(aResource.id),
                           aResource.position,
                           aResource.size,
                           style=wx.NO_FULL_REPAINT_ON_RESIZE
                           | wx.CLIP_SIBLINGS,
                           name=aResource.name)

        self._size = self.GetClientSize()

        # create offscreen buffer where drawing occurs
        bitmap = wx.EmptyBitmap(self._size[0], self._size[1])
        self._bufImage = wx.MemoryDC()
        self._bufImage.SelectObject(bitmap)
        del bitmap

        widget.Widget.__init__(self, aParent, aResource)

        wx.EVT_PAINT(self, self._onPaint)
        wx.EVT_SIZE(self, self._onSize)
        wx.EVT_WINDOW_DESTROY(self, self._onDestroy)

        self.backgroundColor = (255, 255, 255)  # 'white'
        self.clear()
        self._setForegroundColor((0, 0, 0))  # 'black'
        # these are the defaults for a new MemoryDC
        self._fillColor = 'WHITE'
        self._fillMode = 'SOLID'
        self._logicalCopyMode = 'COPY'

        self._bindEvents(event.WIDGET_EVENTS)
コード例 #12
0
    def __init__(self, aParent, aResource):
        wx.Slider.__init__(
            self,
            aParent,
            widget.makeNewId(aResource.id),
            aResource.value, aResource.min, aResource.max,
            aResource.position,
            aResource.size,
            style= self.__getLayout(aResource.layout) | \
                self.__getLabels(aResource.labels) | \
                self.__getTicks(aResource.ticks) | \
                wx.NO_FULL_REPAINT_ON_RESIZE | wx.CLIP_SIBLINGS,
            name = aResource.name
        )

        widget.Widget.__init__(self, aParent, aResource)

        self._layout = aResource.layout
        self._labels = aResource.labels
        self._ticks = aResource.ticks
        if aResource.ticks and aResource.tickFrequency:
            self._setTickFrequency(aResource.tickFrequency)

        self._bindEvents(event.WIDGET_EVENTS + SliderEvents)
コード例 #13
0
    def __init__(self, aParent, aResource):
        wx.RadioBox.__init__(
            self,
            aParent,
            widget.makeNewId(aResource.id),
            aResource.label,
            aResource.position,
            aResource.size,
            aResource.items,
            aResource.max,
            self.__getLayout(aResource.layout) | \
                wx.NO_FULL_REPAINT_ON_RESIZE | wx.CLIP_SIBLINGS,
            name=aResource.name
            )

        widget.Widget.__init__(self, aParent, aResource)

        self._labels = aResource.items
        self._layout = aResource.layout
        self._max = aResource.max
        if aResource.stringSelection:
            self._setStringSelection(aResource.stringSelection)

        self._bindEvents(event.WIDGET_EVENTS + RadioGroupEvents)
コード例 #14
0
    def __init__(self, aParent, aResource):
        stc.StyledTextCtrl.__init__(
            self,
            aParent,
            widget.makeNewId(aResource.id),
            #aResource.text,
            aResource.position,
            aResource.size,
            #style = wxTE_PROCESS_ENTER | borderStyle | wxCLIP_SIBLINGS,
            #style = borderStyle | wx.CLIP_SIBLINGS,
            style=wx.NO_FULL_REPAINT_ON_RESIZE | wx.CLIP_SIBLINGS,
            name=aResource.name)

        widget.Widget.__init__(self, aParent, aResource)

        # POB 2002-05-04
        # Borrowed stuff from PyCrust just to get this working.
        self.SetMarginType(LINE_NUMBER_MARGIN, stc.STC_MARGIN_NUMBER)
        self.SetMarginWidth(LINE_NUMBER_MARGIN, LINE_NUMBER_MARGIN_WIDTH)
        self.SetLexer(stc.STC_LEX_PYTHON)
        self.SetKeyWords(0, ' '.join(keyword.kwlist))
        self._setStyles(faces)
        self.SetViewWhiteSpace(0)
        self.SetTabWidth(4)
        self.SetUseTabs(0)
        self.CallTipSetBackground(wx.Colour(255, 255, 232))
        self.SetBackSpaceUnIndents(1)

        stc.EVT_STC_UPDATEUI(self, self.GetId(), self.OnUpdateUI)

        # KEA 2002-12-16
        # code folding code taken from
        # wxStyledTextCtrl_2.py
        self.SetProperty("fold", "1")
        # Setup a margin to hold fold markers
        self.SetFoldFlags(
            16
        )  ###  WHAT IS THIS VALUE?  WHAT ARE THE OTHER FLAGS?  DOES IT MATTER?
        self.SetMarginType(CODE_FOLDING_MARGIN, stc.STC_MARGIN_SYMBOL)
        self.SetMarginMask(CODE_FOLDING_MARGIN, stc.STC_MASK_FOLDERS)
        self.SetMarginSensitive(CODE_FOLDING_MARGIN, 1)
        self.SetMarginWidth(CODE_FOLDING_MARGIN, CODE_FOLDING_MARGIN_WIDTH)
        # initially code folding should be off
        self.SetMarginWidth(CODE_FOLDING_MARGIN, 0)

        self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND,
                          stc.STC_MARK_BOXPLUSCONNECTED, "white", "black")
        self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID,
                          stc.STC_MARK_BOXMINUSCONNECTED, "white", "black")
        self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_TCORNER,
                          "white", "black")
        self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL, stc.STC_MARK_LCORNER,
                          "white", "black")
        self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB, stc.STC_MARK_VLINE,
                          "white", "black")
        self.MarkerDefine(stc.STC_MARKNUM_FOLDER, stc.STC_MARK_BOXPLUS,
                          "white", "black")
        self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN, stc.STC_MARK_BOXMINUS,
                          "white", "black")

        # KEA 2004-05-20
        # get rid of the annoying text drag and drop
        #stc.EVT_STC_START_DRAG(self, self.GetId(), self.OnStartDrag)

        stc.EVT_STC_MARGINCLICK(self, self.GetId(), self.OnMarginClick)

        if not aResource.editable:
            self._setEditable(False)

        #adapter = CodeEditorEventBinding(self)
        #adapter.bindEvents()
        self._bindEvents(event.WIDGET_EVENTS +
                         (event.KeyPressEvent, event.KeyDownEvent,
                          event.KeyUpEvent))