def __init__(self, component = None): PyGUIBase.__init__(self, component) if component == None: self.component = GUI.Window('system/maps/col_white.bmp') self.component.colour = (128, 128, 128, 255) self.component.widthMode = 'CLIP' self.component.heightMode = 'CLIP' self.component.addChild(GUI.Text(''), 'text') self.component.text.horizontalAnchor = 'LEFT' self.component.text.horizontalPositionMode = 'CLIP' self.component.text.verticalAnchor = 'BOTTOM' self.component.text.verticalPositionMode = 'CLIP' self.component.text.position = (-1.0, -1.0, 0.5) self.component.text.multiline = True self.component.text.richFormatting = True self.component.text.colour = (255, 255, 255, 255) self.onBound() self.component.script = self self.maxLines = 255 self.wordWrap = True self.minVisibleLines = 4 self.autoSelectionFonts = ['default_medium.font'] self.idealCharactersPerLine = 80 self.lines = [] self.scrollIndex = 0 self._displayedLineCount = 0 registerDeviceListener(self) return
def onSave(self, dataSection): PyGUIBase.onSave(self, dataSection) dataSection.writeBool('isHorizontal', self.isHorizontal) dataSection.writeFloat('minValue', self.minValue) dataSection.writeFloat('maxValue', self.maxValue) dataSection.writeFloat('stepSize', self.stepSize) VisualStateComponent.onSave(self, dataSection)
def handleMouseEnterEvent(self, comp): PyGUIBase.handleMouseEnterEvent(self, comp) slider = self.component.parent.script slider.handleMouseEnterEvent(comp) slider.thumbPressed = slider.thumbPressed and BigWorld.isKeyDown(Keys.KEY_LEFTMOUSE) slider._updateVisualState(hover=True) return True
def __init__(self, component = None): PyGUIBase.__init__(self, component) self.component.script = self self.mozillaHandlesKeyboard = True self.prevCursorManagement = True self.focusObserver = None return
def __init__(self, component = None): PyGUIBase.__init__(self, component) self.cursorIndex = 0 self.scrollInPixels = 0 self.onEnter = None self.onEscape = None self.maxLength = 256 self.enabled = True self.enableIME = False self.focusViaMouse = True self.focusObserver = None self.shouldAdjustClipping = False self.__externalKeyEventHandler = None self.__allowAutoDefocus = True if self.component is None: self.component = GUI.Window('system/maps/col_white.bmp') self.component.colour = (0, 0, 0, 255) self.component.materialFX = 'BLEND' self.component.width = 0.75 self.component.height = 0.1 self.component.heightMode = 'CLIP' self.component.widthMode = 'CLIP' self.component.minScroll = (-100, -100) self.component.maxScroll = (+100, +100) self.component.script = self self.onBound() self.autoSelectionFonts = ['default_medium.font'] self.idealVisibleCharacters = 80 registerDeviceListener(self) return
def __init__(self, component = None): PyGUIBase.__init__(self, component) self.__history = [] self.__historyShown = -1 if component == None: self.component = GUI.Window('system/maps/col_white.bmp') self.component.colour = (0, 0, 0, 255) self.component.materialFX = 'SOLID' self.component.height = 0.75 self.component.width = 1.5 self.component.addChild(ScrollableText().component, 'buffer') self.component.buffer.colour = (0, 0, 0, 0) self.component.buffer.widthMode = 'CLIP' self.component.buffer.width = 2.0 self.component.buffer.height = 1.8 self.component.buffer.verticalAnchor = 'TOP' self.component.buffer.verticalPositionMode = 'CLIP' self.component.buffer.position.y = 1.0 self.component.addChild(EditField().component, 'editField') self.component.editField.colour = (64, 64, 64, 255) self.component.editField.verticalPositionMode = 'CLIP' self.component.editField.verticalAnchor = 'BOTTOM' self.component.editField.position.y = -1.0 self.component.editField.height = 0.2 self.component.editField.widthMode = 'CLIP' self.component.editField.width = 2.0 self.component.script = self self.onBound() registerDeviceListener(self) return
def onLoad(self, dataSection): PyGUIBase.onLoad(self, dataSection) self.isHorizontal = dataSection.readBool('isHorizontal', self.isHorizontal) self.minValue = dataSection.readFloat('minValue', self.minValue) self.maxValue = dataSection.readFloat('maxValue', self.maxValue) self.stepSize = dataSection.readFloat('stepSize', self.stepSize) VisualStateComponent.onLoad(self, dataSection)
def doLayout(self, parent): PyGUIBase.doLayout(self, parent) y = 1.0 totalHeight = 0 itemHeight = 0 screenWidth = BigWorld.screenWidth() for discard, i in self.component.items.children: i.position.y = y thisItemHeight = i.script.adjustFont(screenWidth) if itemHeight == 0 and thisItemHeight != 0: itemHeight = thisItemHeight y = y - itemHeight - ITEM_MARGIN totalHeight += itemHeight + ITEM_MARGIN self.component.items.height = totalHeight heightMode = self.component.items.heightMode self.component.items.heightMode = 'LEGACY' self.totalHeightScreenClip = float(self.component.items.height) self.component.items.heightMode = heightMode self.items.script.maxScroll[1] = max(0, self.totalHeightScreenClip - self.component.height) self.items.script.minScroll[1] = 0 if self.items.script.maxScroll[1] == 0.0: self.scrollUp.visible = 0 self.scrollDown.visible = 0 self.maxVisibleItems = int(2.0 / itemHeight) if itemHeight > 0 else 1
def onLoad(self, dataSection): PyGUIBase.onLoad(self, dataSection) self.buttonStyle = dataSection.readString('buttonStyle') self.buttonDisabled = dataSection.readBool('buttonDisabled', False) self.groupName = dataSection.readString('groupName') self.groupDepth = dataSection.readInt('groupDepth', 1) VisualStateComponent.onLoad(self, dataSection)
def __init__(self, component=None): PyGUIBase.__init__(self, component) self.lines = [] self.lines.append(GUI.Text("")) self.lines[0].horizontalAnchor = "LEFT" self.lines[0].verticalAnchor = "TOP" self.transcript = "" self.component.addChild(self.lines[0])
def onLoad(self, dataSection): PyGUIBase.onLoad(self, dataSection) self.maxLines = dataSection.readInt("maxLines", self.maxLines) self.wordWrap = dataSection.readBool("wordWrap", self.wordWrap) self.idealCharactersPerLine = dataSection.readInt("idealCharactersPerLine", self.idealCharactersPerLine) fonts = dataSection.readStrings("autoFont") if len(fonts) > 0: self.autoSelectionFonts = fonts
def onLoad(self, dataSection): PyGUIBase.onLoad(self, dataSection) self.maxLines = dataSection.readInt('maxLines', self.maxLines) self.wordWrap = dataSection.readBool('wordWrap', self.wordWrap) self.idealCharactersPerLine = dataSection.readInt('idealCharactersPerLine', self.idealCharactersPerLine) fonts = dataSection.readStrings('autoFont') if len(fonts) > 0: self.autoSelectionFonts = fonts
def __init__(self, component = None): PyGUIBase.__init__(self, component) self.lines = [] self.lines.append(GUI.Text('')) self.lines[0].horizontalAnchor = 'LEFT' self.lines[0].verticalAnchor = 'TOP' self.transcript = '' self.component.addChild(self.lines[0])
def onSave(self, dataSection): PyGUIBase.onSave(self, dataSection) dataSection.writeBool('buttonDisabled', self.buttonDisabled) dataSection.writeString('buttonStyle', self.buttonStyle) if self.groupName != '': dataSection.writeString('groupName', self.groupName) dataSection.writeInt('groupDepth', self.groupDepth) VisualStateComponent.onSave(self, dataSection)
def __init__(self, component, isHorizontal = True): PyGUIBase.__init__(self, component) DraggableComponent.__init__(self, isHorizontal, not isHorizontal, True) self.component.focus = True self.component.mouseButtonFocus = True self.component.moveFocus = True self.component.crossFocus = True self.onDragging = self._onDragging
def __init__(self, component): PyGUIBase.__init__(self, component) self.minScroll = [0, 0] self.maxScroll = [0, 0] self.scroll = [0, 0] self.scrollSpeed = 0.5 self.scrollTransform = Math.Matrix() self.scrollTransform.setIdentity()
def onSave(self, dataSection): PyGUIBase.onSave(self, dataSection) dataSection.writeInt('maxLength', self.maxLength) dataSection.writeBool('focusViaMouse', self.focusViaMouse) dataSection.writeBool('enableIME', self.enableIME) dataSection.writeBool('shouldAdjustClipping', self.shouldAdjustClipping) dataSection.writeVector4('activeColour', self.activeColour) dataSection.writeVector4('inactiveColour', self.inactiveColour) dataSection.writeBool('allowAutoDefocus', self.__allowAutoDefocus)
def __init__(self, component): PyGUIBase.__init__(self, component) component.script = self self.padding = 5 self.square = True self.autoSize = True _indicators.append(weakref.ref(self)) import bwobsolete_helpers.PyGUI as PyGUI PyGUI.registerInputLangChangeListener(self)
def onSave(self, dataSection): PyGUIBase.onSave(self, dataSection) dataSection.writeInt('maxLength', self.maxLength) dataSection.writeBool('focusViaMouse', self.focusViaMouse) dataSection.writeBool('enableIME', self.enableIME) dataSection.writeBool('shouldAdjustClipping', self.shouldAdjustClipping) dataSection.writeVector4('activeColour', self.activeColour) dataSection.writeVector4('inactiveColour', self.inactiveColour) dataSection.writeBool('allowAutoDefocus', self.__allowAutoDefocus)
def handleMouseButtonEvent(self, comp, event): PyGUIBase.handleMouseButtonEvent(self, comp, event) slider = self.component.parent.script if event.key == Keys.KEY_LEFTMOUSE: if event.isKeyDown() and not slider.thumbPressed: slider.thumbPressed = True elif not event.isKeyDown() and slider.thumbPressed: slider.thumbPressed = False slider._updateVisualState(hover=True) return DraggableComponent.handleMouseButtonEvent(self, comp, event)
def handleMouseButtonEvent(self, comp, event): PyGUIBase.handleMouseButtonEvent(self, comp, event) pos = self._getWebCoordinates(event.cursorPosition) if pos is None: return False else: if event.isKeyDown(): setFocusedComponent(self.component) self.webPage.handleMouseButtonEvent(pos, event.isKeyDown()) return True
def handleMouseButtonEvent(self, comp, event): PyGUIBase.handleMouseButtonEvent(self, comp, event) if event.key == Keys.KEY_LEFTMOUSE: if event.isKeyDown() and not self.buttonPressed: self.buttonPressed = True elif not event.isKeyDown() and self.buttonPressed: self.buttonPressed = False self._onClick() self._updateVisualState() return True
def handleMouseButtonEvent(self, comp, event): PyGUIBase.handleMouseButtonEvent(self, comp, event) pos = self._getWebCoordinates(event.cursorPosition) if pos is None: return False else: if event.isKeyDown(): setFocusedComponent(self.component) self.webPage.handleMouseButtonEvent(pos, event.isKeyDown()) return True
def handleMouseButtonEvent(self, comp, event): PyGUIBase.handleMouseButtonEvent(self, comp, event) slider = self.component.parent.script if event.key == Keys.KEY_LEFTMOUSE: if event.isKeyDown() and not slider.thumbPressed: slider.thumbPressed = True elif not event.isKeyDown() and slider.thumbPressed: slider.thumbPressed = False slider._updateVisualState(hover=True) return DraggableComponent.handleMouseButtonEvent(self, comp, event)
def handleMouseButtonEvent(self, comp, event): PyGUIBase.handleMouseButtonEvent(self, comp, event) if event.key == Keys.KEY_LEFTMOUSE: if event.isKeyDown() and not self.buttonPressed: self.buttonPressed = True elif not event.isKeyDown() and self.buttonPressed: self.buttonPressed = False self._onClick() self._updateVisualState() return True
def onBound(self): PyGUIBase.onBound(self) try: self.items = self.component.items except: print 'the scrolling list should have a items area!!!' if hasattr(self.component, 'scrollUp'): self.scrollUp = self.component.scrollUp if hasattr(self.component, 'scrollDown'): self.scrollDown = self.component.scrollDown
def onBound(self): PyGUIBase.onBound(self) try: self.items = self.component.items except: print 'the scrolling list should have a items area!!!' if hasattr(self.component, 'scrollUp'): self.scrollUp = self.component.scrollUp if hasattr(self.component, 'scrollDown'): self.scrollDown = self.component.scrollDown
def __init__(self, component): PyGUIBase.__init__(self, component) self.selection = 0 self.itemGuiName = '' self.backFn = None self.budget = Utils.Budget(self.createItem, self.deleteItem) self.selectItemCallback = lambda : None self.maxVisibleItems = 0 self.totalHeightScreenClip = 0.0 component.focus = True component.crossFocus = True return
def __init__(self, component): PyGUIBase.__init__(self, component) self.selection = 0 self.itemGuiName = '' self.backFn = None self.budget = Utils.Budget(self.createItem, self.deleteItem) self.selectItemCallback = lambda: None self.maxVisibleItems = 0 self.totalHeightScreenClip = 0.0 component.focus = True component.crossFocus = True return
def onLoad(self, dataSection): PyGUIBase.onLoad(self, dataSection) self.maxLength = dataSection.readInt('maxLength', self.maxLength) self.focusViaMouse = dataSection.readBool('focusViaMouse', True) self.enableIME = dataSection.readBool('enableIME', False) self.shouldAdjustClipping = dataSection.readBool('shouldAdjustClipping', False) self.activeColour = dataSection.readVector4('activeColour', DEFAULT_TEXT_COLOUR_ACTIVE) self.inactiveColour = dataSection.readVector4('inactiveColour', DEFAULT_TEXT_COLOUR_INACTIVE) self.__allowAutoDefocus = dataSection.readBool('allowAutoDefocus', True) self.idealVisibleCharacters = dataSection.readInt('idealVisibleCharacters', self.idealVisibleCharacters) fonts = dataSection.readStrings('autoFont') if len(fonts) > 0: self.autoSelectionFonts = fonts
def __init__(self, component): PyGUIBase.__init__(self, component) component.script = self self.component.focus = True self.component.moveFocus = True self.component.crossFocus = True self.horizontalFirst = True self.gridWidth = 1 self.gridHeight = 1 self.borderTop = 0 self.borderBottom = 0 self.borderLeft = 0 self.borderRight = 0 self.horizontalGap = 0 self.verticalGap = 0
def __init__(self, component): PyGUIBase.__init__(self, component) component.script = self self.component.focus = True self.component.moveFocus = True self.component.crossFocus = True self.horizontalFirst = True self.gridWidth = 1 self.gridHeight = 1 self.borderTop = 0 self.borderBottom = 0 self.borderLeft = 0 self.borderRight = 0 self.horizontalGap = 0 self.verticalGap = 0
def __init__(self, component): PyGUIBase.__init__(self, component) VisualStateComponent.__init__(self, component, Slider.visualStateString) component.script = self self.isHorizontal = True self.minValue = 0.0 self.maxValue = 1.0 self.stepSize = 0.1 self._value = 0.0 self.thumbPressed = False self.sliderDisabled = False self.component.focus = True self.component.mouseButtonFocus = True self.component.crossFocus = True self.component.moveFocus = True self.onValueChanged = lambda : None
def __init__(self, component): PyGUIBase.__init__(self, component) VisualStateComponent.__init__(self, component, Slider.visualStateString) component.script = self self.isHorizontal = True self.minValue = 0.0 self.maxValue = 1.0 self.stepSize = 0.1 self._value = 0.0 self.thumbPressed = False self.sliderDisabled = False self.component.focus = True self.component.mouseButtonFocus = True self.component.crossFocus = True self.component.moveFocus = True self.onValueChanged = lambda : None
def onBound(self): if hasattr(self.component, 'cursor'): self.component.delChild(self.component.cursor) self.activeColour = DEFAULT_TEXT_COLOUR_ACTIVE self.inactiveColour = DEFAULT_TEXT_COLOUR_INACTIVE text = self.component.text text.horizontalAnchor = 'LEFT' text.horizontalPositionMode = 'PIXEL' text.position.x = 0 text.colour = self.inactiveColour if len(self.autoSelectionFonts) == 0: self.autoSelectionFonts = [self.component.text.font] self.cursor = BlinkingCursor() self.component.addChild(self.cursor.comp, 'cursor') self._updateCursor() self.cursor.enable(False) PyGUIBase.onBound(self) self._selectFontBestMatch()
def __init__(self, component): PyGUIBase.__init__(self, component) VisualStateComponent.__init__(self, component, Button.visualStateString) component.script = self self.component.focus = True self.component.mouseButtonFocus = True self.component.moveFocus = True self.component.crossFocus = True self.buttonStyle = Button.PRESSBUTTON_STYLE self.buttonPressed = False self.buttonActive = False self.buttonDisabled = False self.groupName = '' self.groupDepth = 1 self.hovering = False self.onClick = lambda : None self.onActivate = lambda : None self.onDeactivate = lambda : None
def __init__(self, component): PyGUIBase.__init__(self, component) VisualStateComponent.__init__(self, component, Button.visualStateString) component.script = self self.component.focus = True self.component.mouseButtonFocus = True self.component.moveFocus = True self.component.crossFocus = True self.buttonStyle = Button.PRESSBUTTON_STYLE self.buttonPressed = False self.buttonActive = False self.buttonDisabled = False self.groupName = '' self.groupDepth = 1 self.hovering = False self.onClick = lambda : None self.onActivate = lambda : None self.onDeactivate = lambda : None
def onLoad(self, dataSection): PyGUIBase.onLoad(self, dataSection) self.maxLength = dataSection.readInt('maxLength', self.maxLength) self.focusViaMouse = dataSection.readBool('focusViaMouse', True) self.enableIME = dataSection.readBool('enableIME', False) self.shouldAdjustClipping = dataSection.readBool( 'shouldAdjustClipping', False) self.activeColour = dataSection.readVector4( 'activeColour', DEFAULT_TEXT_COLOUR_ACTIVE) self.inactiveColour = dataSection.readVector4( 'inactiveColour', DEFAULT_TEXT_COLOUR_INACTIVE) self.__allowAutoDefocus = dataSection.readBool('allowAutoDefocus', True) self.idealVisibleCharacters = dataSection.readInt( 'idealVisibleCharacters', self.idealVisibleCharacters) fonts = dataSection.readStrings('autoFont') if len(fonts) > 0: self.autoSelectionFonts = fonts
def onBound(self): if hasattr(self.component, 'cursor'): self.component.delChild(self.component.cursor) self.activeColour = DEFAULT_TEXT_COLOUR_ACTIVE self.inactiveColour = DEFAULT_TEXT_COLOUR_INACTIVE text = self.component.text text.horizontalAnchor = 'LEFT' text.horizontalPositionMode = 'PIXEL' text.position.x = 0 text.colour = self.inactiveColour if len(self.autoSelectionFonts) == 0: self.autoSelectionFonts = [self.component.text.font] self.cursor = BlinkingCursor() self.component.addChild(self.cursor.comp, 'cursor') self._updateCursor() self.cursor.enable(False) PyGUIBase.onBound(self) self._selectFontBestMatch()
def __init__(self, component): PyGUIBase.__init__(self, component)
def onSave(self, dataSection): PyGUIBase.onSave(self, dataSection) dataSection.writeInt('maxLines', self.maxLines) dataSection.writeBool('wordWrap', self.wordWrap)
def onBound(self): PyGUIBase.onBound(self) self.colour(self.lines[0].colour) self.font(self.lines[0].font)
def handleMouseEnterEvent(self, comp): PyGUIBase.handleMouseEnterEvent(self, comp) self.buttonPressed = self.buttonPressed and BigWorld.isKeyDown(Keys.KEY_LEFTMOUSE) self.hovering = True self._updateVisualState() return True
def __init__(self, component): PyGUIBase.__init__(self, component)
def onLoad(self, dataSection): PyGUIBase.onLoad(self, dataSection)
def onSave(self, dataSection): PyGUIBase.onSave(self, dataSection)
def onBound(self): PyGUIBase.onBound(self) self.handleInputLangChangeEvent()
def onSave(self, dataSection): PyGUIBase.onSave(self, dataSection) dataSection.writeBool('autoSize', self.autoSize) dataSection.writeInt('padding', self.padding) dataSection.writeBool('square', self.square)
def onBound(self): PyGUIBase.onBound(self) self.colour(self.lines[0].colour) self.font(self.lines[0].font)
def onLoad(self, dataSection): PyGUIBase.onLoad(self, dataSection) self.autoSize = dataSection.readBool('autoSize', True) self.padding = dataSection.readInt('padding', 5) self.square = dataSection.readBool('square', True)
def active(self, state): if state == self.isActive: return PyGUIBase.active(self, state) self.selectItem(self.selection)
def __init__(self, component): PyGUIBase.__init__(self, component) component.script = self