Пример #1
0
 def __init__(self, parent):
     Component.__init__(self, parent)
     TextBase.__init__(self)
     CheckBase.__init__(self)
     TipBase.__init__(self)
     self.command = ''
     self.changeEvent('checked', self.__onCheckChanged, postevent=False)
Пример #2
0
 def __init__(self, parent):
     Component.__init__(self, parent)
     TextBase.__init__(self)
     CheckBase.__init__(self)
     TipBase.__init__(self)
     self.command = ''
     self.changeEvent('checked', self.__onCheckChanged, postevent = False)
Пример #3
0
    def __init__(self, parent = None, longFormat = False):        
        Component.__init__(self, parent)
        TextBase.__init__(self)

        self.iPlatform = subsys.GetLatestInterface('IPlatform')
        self.date = 2007, 1, 1
        self.margin = (2, 2, 2, 2)
        self.longFormat = longFormat
        self.bind('Mouse Down', koan.action.PureAction(self.setFocus))

        self.__datePicker = koan.platform.CreateDatePicker(callback = self.callback, longFormat = self.longFormat)
        self.window._window.AttachChild2( self.__datePicker.GetHWND() )

        #self.__datePicker.Show( False )
        self.changeEvent('text', self.invoke, 'Value Change', self)
        self.changeEvent('date', self.__onDateChange)
        self.changeEvent('font', self.__onFontChanged, sync = False)
        self.changeEvent('fontSize', self.__onFontChanged, sync = False)
        #koan.anim.Execute(0.3, self.__datePicker.Show, True)
        
        # font
        self.bind('Visible Change', self.__onEditVisibleChange)        
        self.bind('Size Change', self.__updateEditWndPos)
        self.bind('Position Change', self.__updateEditWndPos)
        self.bind('Parent Position Change', self.__updateEditWndPos)
        self.bind('Focus Change', self.__onEditVisibleChange)
        
        child = self
        while parent != None:
            child.autoRemove(parent.bind('Parent Position Change', child.invoke, 'Parent Position Change', postevent = False))
            child = parent
            parent = child.parent
Пример #4
0
    def __init__(self, parent = None):        
        Component.__init__(self, parent)
        TextBase.__init__(self)
        self.vscroll = False
        self.hscroll = False
        self.maxlen = -1
        self.bgColor = color.white

        self.margin = (2, 2, 2, 2)
        self.bind('Mouse Down', koan.action.PureAction(self.setFocus))

        self.__edit = koan.platform.CreateEdit(callback = self.callback)
        self.changeEvent('text', self.__onTextChanged, sync = False)
        self.changeEvent('text', self.invoke, 'Value Change', self)
        self.changeEvent('align', self.__onEditStyleChange)
        self.changeEvent('vscroll', self.__onEditStyleChange)
        self.changeEvent('hscroll', self.__onEditStyleChange)
        self.changeEvent('maxlen', self.__onEditMaxlenChange, sync = False)
        
        # font
        self.changeEvent('font', self.__onFontChanged, sync = False)
        self.changeEvent('fontSize', self.__onFontChanged, sync = False)
        self.changeEvent('fontColor', self.__onFontColorChange, sync = False)
        self.changeEvent('bgColor', self.__onBgColorChange, sync = False)
        self.bind('Visible Change', self.__onEditVisibleChange)        
        self.bind('Size Change', self.__updateEditWndPos)
        self.bind('Position Change', self.__updateEditWndPos)
        self.bind('Parent Position Change', self.__updateEditWndPos)
        self.bind('Focus Change', self.__onEditVisibleChange)
        
        child = self
        while parent != None:
            child.autoRemove(parent.bind('Parent Position Change', child.invoke, 'Parent Position Change', postevent = False))
            child = parent
            parent = child.parent
Пример #5
0
 def onDraw(self, render):
     super(DatePicker, self).onDraw(render)
     if not self.focus:
         TextBase.onDraw(self,
                         render,
                         pos=(self.margin[0], self.margin[1],
                              self.width - self.margin[2],
                              self.height - self.margin[3]))
Пример #6
0
 def onDraw(self, render):
     # draw background
     super(Text, self).onDraw(render)
     
     # draw border
     if not self.background:
         self.drawBorder(render, 1, color.black)
     
     # draw text
     TextBase.onDraw(self, render)
Пример #7
0
    def onDraw(self, render):
        # draw background
        super(Text, self).onDraw(render)

        # draw border
        if not self.background:
            self.drawBorder(render, 1, color.black)

        # draw text
        TextBase.onDraw(self, render)
Пример #8
0
    def __init__(self, parent):
        Static.__init__(self, parent)
        TextBase.__init__(self)
        # data
        self.progress = 0.0  # 0.0 ~ 1.0

        # display
        self.margin = 0
        self.margin2 = 0
        self.progressImg = ""
        self.autoDirty(["progress", "progressImg"])
Пример #9
0
 def __init__(self, parent):
     Static.__init__(self, parent)
     TextBase.__init__(self)
     # data
     self.progress = 0.0     # 0.0 ~ 1.0
     
     # display
     self.margin = 0
     self.margin2 = 0
     self.progressImg = ''
     self.autoDirty(['progress', 'progressImg'])
Пример #10
0
 def __init__(self, parent=None):
     Button.__init__(self, parent)
     TextBase.__init__(self)
     ImageBase.__init__(self)
     self.imgSize = 16, 16
     self.textGap = 0
     self.margin = 5, 5, 5, 5
     self.altCmd = ''
     self.changeEvent('text', self.onResize)
     self.changeEvent('textGap', self.onResize)
     self.changeEvent('imgSize', self.onResize)
Пример #11
0
 def onDraw(self, render):
     super(Checkbox, self).onDraw(render)
     
     # draw check icon
     t = render.GetTexture(self.checkImg)
     render.SetTexture(t)
     render.DrawRect(*self.checkPos)
     
     # draw text
     pos = self.height, 0, self.width, self.height
     TextBase.onDraw(self, render)
Пример #12
0
 def __init__(self, parent = None):
     Button.__init__(self, parent)
     TextBase.__init__(self)
     ImageBase.__init__(self)
     self.imgSize = 16, 16
     self.textGap = 0
     self.margin = 5, 5, 5, 5
     self.altCmd = ''
     self.changeEvent('text', self.onResize)
     self.changeEvent('textGap', self.onResize)
     self.changeEvent('imgSize', self.onResize)
Пример #13
0
    def onDraw(self, render):
        super(Checkbox, self).onDraw(render)

        # draw check icon
        t = render.GetTexture(self.checkImg)
        render.SetTexture(t)
        render.DrawRect(*self.checkPos)

        # draw text
        pos = self.height, 0, self.width, self.height
        TextBase.onDraw(self, render)
Пример #14
0
    def __init__(self, parent = None):
        Component.__init__(self, parent)
        TextBase.__init__(self)

        # cursor
        self.cursorColor = color.black
        self.cursorWidth = 1
        self.cursorPos = 0
        self.cursorShow = self.focus
        self.cursorShowAlways = False
        self.changeEvent('cursorPos', self.Regular)        
        
        # blink effect for cursor
        self.cursorAlpha = koan.anim.AnimLinear(1.0, (0, 0.45, 0.55, 1), (1, 1, 0, 0), loop = True)
        #koan.anim.IntervalExecute(0.5, self.onCursorShowChange)
        
        self.password = ''
        self.changeEvent('text', self.__onCheckCursorPos, sync = False)
        self.changeEvent('text', self.invoke, 'Value Change', self)

        self.margin = (2, 2, 2, 2)
        self.editrect = (0, 0, 0, 0)
        self._grawBound = (0, 0, 0, 0)
        self.spaceWidth = 10
               
        self.unit = 1, 1
        self.maxlen = 255
        self.beginOffset = 0

        self.autoDirty(['text', 'cursorPos', 'beginOffset', 'cursorShow'])
        
        self.bind('Size Change', self.onSize)
        self.bind('Mouse Down', koan.action.PureAction(self.setFocus))
        self.bind('Focus Change', self.onCursorShowChange)

        # file name input
        self.legalFileNameOnly = False
        
        # number        
        self.numbersOnly = False     
        self.autoadddecimal = True
        import locale
        self.decimal = locale.localeconv()['decimal_point']
        
        # 10 key input
        self.EnableDigitLetter = koan.config.getBool('Misc', 'EnableDigitLetter', True)  
        self.RCExpireTime = 1.5
        self.RCKeyTimer = 0
        self.RCKeyValue = -1
        self.RCKeyIndex = 0        
Пример #15
0
 def onDraw(self, render):
     # draw background
     super(Progress, self).onDraw(render)
     
     # draw progress
     t = render.GetTexture(self.progressImg, gamma = self.gamma)
     render.SetTexture(t)
     margin = self.margin + self.margin2
     render.DrawRect(self.margin, self.margin,
          margin + self.margin2 + (self.width-(margin)*2) * self.progress,
          self.height-self.margin)
     
     # draw text
     #self.text = '%d%%' %int(self.progress * 100)
     TextBase.onDraw(self, render)
Пример #16
0
    def __init__(self, parent = None, **argd):
        Component.__init__(self, parent)
        TextBase.__init__(self)
        CheckBase.__init__(self, **argd)
        TipBase.__init__(self)
        
        # property
        self.checkImg = ''
        self.autosize = False
        self.margin = 5
        self.onAutoSize()     # self.checkPos

        self.changeEvent('text', self.onAutoSize)
        self.changeEvent('margin', self.onAutoSize)
        self.bind('Size Change', self.onAutoSize)
        self.autoDirty( ['checkImg', 'margin'] )     
Пример #17
0
    def __init__(self, parent=None, **argd):
        Component.__init__(self, parent)
        TextBase.__init__(self)
        CheckBase.__init__(self, **argd)
        TipBase.__init__(self)

        # property
        self.checkImg = ''
        self.autosize = False
        self.margin = 5
        self.onAutoSize()  # self.checkPos

        self.changeEvent('text', self.onAutoSize)
        self.changeEvent('margin', self.onAutoSize)
        self.bind('Size Change', self.onAutoSize)
        self.autoDirty(['checkImg', 'margin'])
Пример #18
0
    def onDraw(self, render):
        # draw background
        super(Progress, self).onDraw(render)

        # draw progress
        t = render.GetTexture(self.progressImg, gamma=self.gamma)
        render.SetTexture(t)
        margin = self.margin + self.margin2
        render.DrawRect(
            self.margin,
            self.margin,
            margin + self.margin2 + (self.width - (margin) * 2) * self.progress,
            self.height - self.margin,
        )

        # draw text
        # self.text = '%d%%' %int(self.progress * 100)
        TextBase.onDraw(self, render)
Пример #19
0
    def __init__(self, parent=None, header=''):
        Component.__init__(self, parent)
        TextBase.__init__(self)
        AutoLayout.__init__(self)

        # default value
        self.tabStop = False
        self.height = 20
        self.clip = False

        # menu item
        self.header = header
        self.margin = 5, 2, 5, 2
        self.command = ''

        # icon
        self.icon = ''
        self.iconMargin = 0, 3, 5, 3
        self.iconWidth = 28

        # sub menu
        self.subMenuSize = 10, 10
        self.subMenuPos = 0, 0
        self.sysMenuItem = False
        self.subMenuExpand = False
        self.subMenuOffset = 0
        self.highLit = 'Empty'

        self.changeEvent('header', self.onHeaderChange)
        self.changeEvent('font', self.onHeaderChange)
        self.changeEvent('fontSize', self.onHeaderChange)
        self.changeEvent('subMenuExpand',
                         self.onSubMenuExpandChange,
                         sync=False)
        self.bind('Click', self.onClick)
        self.bind('Mouse Enter', self.setFocus, postevent=False)
        self.bind('Mouse Wheel', self.scroll)
        self.bind('Focus Change', self.onFocusChange, postevent=False)
        self.bind('Mouse Enter', self.onMouseEnter, postevent=False)
        self.bind('Parent Change', self.onParentChange)
        self.onParentChange()

        self.autoDirty(['subMenuExpand', 'highLit', 'sightRect'])
Пример #20
0
    def onDraw(self, render):        
        iw, ih = self.imgSize
        margin = self.margin

        # draw hight light
        super(LabelButton, self).onDraw(render)

        # draw image
        t = render.GetTexture(self.image)
        render.SetTexture(t)        
        if self.imageColor != color.white:
            render.SetColor(*self.imageColor)        
        x = (self.width - iw)/2
        render.DrawRect(x, margin[1], x+iw, ih+margin[1])
        if self.imageColor != color.white:
            render.SetColor(*color.white)
        # draw text
        tw, th = self.textSize
        render.Translate(margin[0], min(margin[1] + ih + self.textGap, self.height - th - margin[3]))
        TextBase.onDraw(self, render, (0, 0, max(iw, tw), th))
Пример #21
0
    def __init__(self, parent=None, header=""):
        Component.__init__(self, parent)
        TextBase.__init__(self)
        AutoLayout.__init__(self)

        # default value
        self.tabStop = False
        self.height = 20
        self.clip = False

        # menu item
        self.header = header
        self.margin = 5, 2, 5, 2
        self.command = ""

        # icon
        self.icon = ""
        self.iconMargin = 0, 3, 5, 3
        self.iconWidth = 28

        # sub menu
        self.subMenuSize = 10, 10
        self.subMenuPos = 0, 0
        self.sysMenuItem = False
        self.subMenuExpand = False
        self.subMenuOffset = 0
        self.highLit = "Empty"

        self.changeEvent("header", self.onHeaderChange)
        self.changeEvent("font", self.onHeaderChange)
        self.changeEvent("fontSize", self.onHeaderChange)
        self.changeEvent("subMenuExpand", self.onSubMenuExpandChange, sync=False)
        self.bind("Click", self.onClick)
        self.bind("Mouse Enter", self.setFocus, postevent=False)
        self.bind("Mouse Wheel", self.scroll)
        self.bind("Focus Change", self.onFocusChange, postevent=False)
        self.bind("Mouse Enter", self.onMouseEnter, postevent=False)
        self.bind("Parent Change", self.onParentChange)
        self.onParentChange()

        self.autoDirty(["subMenuExpand", "highLit", "sightRect"])
Пример #22
0
    def onDraw(self, render):
        iw, ih = self.imgSize
        margin = self.margin

        # draw hight light
        super(LabelButton, self).onDraw(render)

        # draw image
        t = render.GetTexture(self.image)
        render.SetTexture(t)
        if self.imageColor != color.white:
            render.SetColor(*self.imageColor)
        x = (self.width - iw) / 2
        render.DrawRect(x, margin[1], x + iw, ih + margin[1])
        if self.imageColor != color.white:
            render.SetColor(*color.white)
        # draw text
        tw, th = self.textSize
        render.Translate(
            margin[0],
            min(margin[1] + ih + self.textGap, self.height - th - margin[3]))
        TextBase.onDraw(self, render, (0, 0, max(iw, tw), th))
Пример #23
0
    def __init__(self, parent = None):
        Component.__init__(self, parent)
        TextBase.__init__(self)
        # default value
        self.tabStop = False
        self.height = 20

        # menu item
        self.header = ''
        self.margin = 5, 2, 5, 2
        self.autosize = True
        self.toolbar = ''
        
        self.selected = False

        self.changeEvent('header', self.onHeaderChange)
        self.changeEvent('font', self.onHeaderChange)
        self.changeEvent('fontSize', self.onHeaderChange)
        self.bind('Click', self.setFocus)
        self.autoRemove( self.parent.bind('Focus Child Change', self.onSelectChange) )
        self.bind('Visible Change', self.onSelectChange)
        self.onSelectChange()
Пример #24
0
    def __init__(self, parent=None):
        Component.__init__(self, parent)
        TextBase.__init__(self)
        # default value
        self.tabStop = False
        self.height = 20

        # menu item
        self.header = ''
        self.margin = 5, 2, 5, 2
        self.autosize = True
        self.toolbar = ''

        self.selected = False

        self.changeEvent('header', self.onHeaderChange)
        self.changeEvent('font', self.onHeaderChange)
        self.changeEvent('fontSize', self.onHeaderChange)
        self.bind('Click', self.setFocus)
        self.autoRemove(
            self.parent.bind('Focus Child Change', self.onSelectChange))
        self.bind('Visible Change', self.onSelectChange)
        self.onSelectChange()
Пример #25
0
    def __init__(self, parent=None, longFormat=False):
        Component.__init__(self, parent)
        TextBase.__init__(self)

        self.iPlatform = subsys.GetLatestInterface('IPlatform')
        self.date = 2007, 1, 1
        self.margin = (2, 2, 2, 2)
        self.longFormat = longFormat
        self.bind('Mouse Down', koan.action.PureAction(self.setFocus))

        self.__datePicker = koan.platform.CreateDatePicker(
            callback=self.callback, longFormat=self.longFormat)
        self.window._window.AttachChild2(self.__datePicker.GetHWND())

        #self.__datePicker.Show( False )
        self.changeEvent('text', self.invoke, 'Value Change', self)
        self.changeEvent('date', self.__onDateChange)
        self.changeEvent('font', self.__onFontChanged, sync=False)
        self.changeEvent('fontSize', self.__onFontChanged, sync=False)
        #koan.anim.Execute(0.3, self.__datePicker.Show, True)

        # font
        self.bind('Visible Change', self.__onEditVisibleChange)
        self.bind('Size Change', self.__updateEditWndPos)
        self.bind('Position Change', self.__updateEditWndPos)
        self.bind('Parent Position Change', self.__updateEditWndPos)
        self.bind('Focus Change', self.__onEditVisibleChange)

        child = self
        while parent != None:
            child.autoRemove(
                parent.bind('Parent Position Change',
                            child.invoke,
                            'Parent Position Change',
                            postevent=False))
            child = parent
            parent = child.parent
Пример #26
0
 def onDraw(self, render):
     super(RichEdit, self).onDraw(render)
     if not self.focus:
         TextBase.onDraw(self, render, pos = (self.margin[0], self.margin[1], self.width - self.margin[2], self.height - self.margin[3]))
Пример #27
0
 def onDraw(self, render):
     super(Combobox, self).onDraw(render)
     TextBase.onDraw(self, render)
Пример #28
0
 def __init__(self, parent = None):
     Button.__init__(self, parent)
     TextBase.__init__(self)
Пример #29
0
 def onDraw(self, render):
     super(CheckTextButton, self).onDraw(render)
     TextBase.onDraw(self, render)
Пример #30
0
 def onDraw(self, render):
     super(Combobox, self).onDraw(render)
     TextBase.onDraw(self, render)
Пример #31
0
 def __init__(self, parent=None):
     Button.__init__(self, parent)
     TextBase.__init__(self)
Пример #32
0
 def onDraw(self, render):
     super(TextButton, self).onDraw(render)
     TextBase.onDraw(self, render)