本文整理汇总了Python中direct.gui.DirectGui.DirectScrolledList.component方法的典型用法代码示例。如果您正苦于以下问题:Python DirectScrolledList.component方法的具体用法?Python DirectScrolledList.component怎么用?Python DirectScrolledList.component使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类direct.gui.DirectGui.DirectScrolledList
的用法示例。
在下文中一共展示了DirectScrolledList.component方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CalendarGuiDay
# 需要导入模块: from direct.gui.DirectGui import DirectScrolledList [as 别名]
# 或者: from direct.gui.DirectGui.DirectScrolledList import component [as 别名]
class CalendarGuiDay(DirectFrame):
notify = directNotify.newCategory('CalendarGuiDay')
ScrollListTextSize = 0.03
def __init__(self, parent, myDate, startDate, dayClickCallback = None, onlyFutureDaysClickable = False):
self.origParent = parent
self.startDate = startDate
self.myDate = myDate
self.dayClickCallback = dayClickCallback
self.onlyFutureDaysClickable = onlyFutureDaysClickable
DirectFrame.__init__(self, parent=parent)
self.timedEvents = []
self.partiesInvitedToToday = []
self.hostedPartiesToday = []
self.yearlyHolidaysToday = []
self.showMarkers = base.config.GetBool('show-calendar-markers', 0)
self.filter = ToontownGlobals.CalendarFilterShowAll
self.load()
self.createGuiObjects()
self.update()
def createDummyLocators(self):
self.dayButtonLocator = self.attachNewNode('dayButtonLocator')
self.dayButtonLocator.setX(0.1)
self.dayButtonLocator.setZ(-0.05)
self.numberLocator = self.attachNewNode('numberLocator')
self.numberLocator.setX(0.09)
self.scrollLocator = self.attachNewNode('scrollLocator')
self.selectedLocator = self.attachNewNode('selectedLocator')
self.selectedLocator.setX(0.11)
self.selectedLocator.setZ(-0.06)
def load(self):
dayAsset = loader.loadModel('phase_4/models/parties/tt_m_gui_sbk_calendar_box')
dayAsset.reparentTo(self)
self.dayButtonLocator = self.find('**/loc_origin')
self.numberLocator = self.find('**/loc_number')
self.scrollLocator = self.find('**/loc_topLeftList')
self.selectedLocator = self.find('**/loc_origin')
self.todayBox = self.find('**/boxToday')
self.todayBox.hide()
self.selectedFrame = self.find('**/boxHover')
self.selectedFrame.hide()
self.defaultBox = self.find('**/boxBlank')
self.scrollBottomRightLocator = self.find('**/loc_bottomRightList')
self.scrollDownLocator = self.find('**/loc_scrollDown')
self.attachMarker(self.scrollDownLocator)
self.scrollUpLocator = self.find('**/loc_scrollUp')
self.attachMarker(self.scrollUpLocator)
def attachMarker(self, parent, scale = 0.005, color = (1, 0, 0)):
if self.showMarkers:
marker = loader.loadModel('phase_3/models/misc/sphere')
marker.reparentTo(parent)
marker.setScale(scale)
marker.setColor(*color)
def createGuiObjects(self):
self.dayButton = DirectButton(parent=self.dayButtonLocator, image=self.selectedFrame, relief=None, command=self.__clickedOnDay, pressEffect=1, rolloverSound=None, clickSound=None)
self.numberWidget = DirectLabel(parent=self.numberLocator, relief=None, text=str(self.myDate.day), text_scale=0.04, text_align=TextNode.ACenter, text_font=ToontownGlobals.getInterfaceFont(), text_fg=Vec4(110 / 255.0, 126 / 255.0, 255 / 255.0, 1))
self.attachMarker(self.numberLocator)
self.listXorigin = 0
self.listFrameSizeX = self.scrollBottomRightLocator.getX() - self.scrollLocator.getX()
self.scrollHeight = self.scrollLocator.getZ() - self.scrollBottomRightLocator.getZ()
self.listZorigin = self.scrollBottomRightLocator.getZ()
self.listFrameSizeZ = self.scrollLocator.getZ() - self.scrollBottomRightLocator.getZ()
self.arrowButtonXScale = 1
self.arrowButtonZScale = 1
self.itemFrameXorigin = 0
self.itemFrameZorigin = 0
self.buttonXstart = self.itemFrameXorigin + 0.21
self.gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui')
buttonOffSet = -0.01
incButtonPos = (0.0, 0, 0)
decButtonPos = (0.0, 0, 0)
itemFrameMinZ = self.listZorigin
itemFrameMaxZ = self.listZorigin + self.listFrameSizeZ
arrowUp = self.find('**/downScroll_up')
arrowDown = self.find('**/downScroll_down')
arrowHover = self.find('**/downScroll_hover')
self.scrollList = DirectScrolledList(parent=self.scrollLocator, relief=None, pos=(0, 0, 0), incButton_image=(arrowUp,
arrowDown,
arrowHover,
arrowUp), incButton_relief=None, incButton_scale=(self.arrowButtonXScale, 1, self.arrowButtonZScale), incButton_pos=incButtonPos, incButton_image3_color=(1, 1, 1, 0.2), decButton_image=(arrowUp,
arrowDown,
arrowHover,
arrowUp), decButton_relief=None, decButton_scale=(self.arrowButtonXScale, 1, -self.arrowButtonZScale), decButton_pos=decButtonPos, decButton_image3_color=(1, 1, 1, 0.2), itemFrame_pos=(self.itemFrameXorigin, 0, -0.03), numItemsVisible=4, incButtonCallback=self.scrollButtonPressed, decButtonCallback=self.scrollButtonPressed)
itemFrameParent = self.scrollList.itemFrame.getParent()
self.scrollList.incButton.reparentTo(self.scrollDownLocator)
self.scrollList.decButton.reparentTo(self.scrollUpLocator)
arrowUp.removeNode()
arrowDown.removeNode()
arrowHover.removeNode()
clipper = PlaneNode('clipper')
clipper.setPlane(Plane((-1, 0, 0), (0.23, 0, 0)))
clipNP = self.scrollList.component('itemFrame').attachNewNode(clipper)
self.scrollList.component('itemFrame').setClipPlane(clipNP)
return
def scrollButtonPressed(self):
#.........这里部分代码省略.........
示例2: CalendarGuiDay
# 需要导入模块: from direct.gui.DirectGui import DirectScrolledList [as 别名]
# 或者: from direct.gui.DirectGui.DirectScrolledList import component [as 别名]
class CalendarGuiDay(DirectFrame):
notify = directNotify.newCategory('CalendarGuiDay')
ScrollListTextSize = 0.03
def __init__(self, parent, myDate, startDate, dayClickCallback = None, onlyFutureDaysClickable = False):
self.origParent = parent
self.startDate = startDate
self.myDate = myDate
self.dayClickCallback = dayClickCallback
self.onlyFutureDaysClickable = onlyFutureDaysClickable
DirectFrame.__init__(self, parent=parent)
self.timedEvents = []
self.partiesInvitedToToday = []
self.hostedPartiesToday = []
self.yearlyHolidaysToday = []
self.showMarkers = base.config.GetBool('show-calendar-markers', 0)
self.filter = ToontownGlobals.CalendarFilterShowAll
self.load()
self.createGuiObjects()
self.update()
def createDummyLocators(self):
self.dayButtonLocator = self.attachNewNode('dayButtonLocator')
self.dayButtonLocator.setX(0.1)
self.dayButtonLocator.setZ(-0.05)
self.numberLocator = self.attachNewNode('numberLocator')
self.numberLocator.setX(0.09)
self.scrollLocator = self.attachNewNode('scrollLocator')
self.selectedLocator = self.attachNewNode('selectedLocator')
self.selectedLocator.setX(0.11)
self.selectedLocator.setZ(-0.06)
def load(self):
dayAsset = loader.loadModel('phase_4/models/parties/tt_m_gui_sbk_calendar_box')
dayAsset.reparentTo(self)
self.dayButtonLocator = self.find('**/loc_origin')
self.numberLocator = self.find('**/loc_number')
self.scrollLocator = self.find('**/loc_topLeftList')
self.selectedLocator = self.find('**/loc_origin')
self.todayBox = self.find('**/boxToday')
self.todayBox.hide()
self.selectedFrame = self.find('**/boxHover')
self.selectedFrame.hide()
self.defaultBox = self.find('**/boxBlank')
self.scrollBottomRightLocator = self.find('**/loc_bottomRightList')
self.scrollDownLocator = self.find('**/loc_scrollDown')
self.attachMarker(self.scrollDownLocator)
self.scrollUpLocator = self.find('**/loc_scrollUp')
self.attachMarker(self.scrollUpLocator)
def attachMarker(self, parent, scale = 0.005, color = (1, 0, 0)):
if self.showMarkers:
marker = loader.loadModel('phase_3/models/misc/sphere')
marker.reparentTo(parent)
marker.setScale(scale)
marker.setColor(*color)
def createGuiObjects(self):
self.dayButton = DirectButton(parent=self.dayButtonLocator, image=self.selectedFrame, relief=None, command=self.__clickedOnDay, pressEffect=1, rolloverSound=None, clickSound=None)
self.numberWidget = DirectLabel(parent=self.numberLocator, relief=None, text=str(self.myDate.day), text_scale=0.04, text_align=TextNode.ACenter, text_font=ToontownGlobals.getInterfaceFont(), text_fg=Vec4(110 / 255.0, 126 / 255.0, 255 / 255.0, 1))
self.attachMarker(self.numberLocator)
self.listXorigin = 0
self.listFrameSizeX = self.scrollBottomRightLocator.getX() - self.scrollLocator.getX()
self.scrollHeight = self.scrollLocator.getZ() - self.scrollBottomRightLocator.getZ()
self.listZorigin = self.scrollBottomRightLocator.getZ()
self.listFrameSizeZ = self.scrollLocator.getZ() - self.scrollBottomRightLocator.getZ()
self.arrowButtonXScale = 1
self.arrowButtonZScale = 1
self.itemFrameXorigin = 0
self.itemFrameZorigin = 0
self.buttonXstart = self.itemFrameXorigin + 0.21
self.gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui')
buttonOffSet = -0.01
incButtonPos = (0.0, 0, 0)
decButtonPos = (0.0, 0, 0)
itemFrameMinZ = self.listZorigin
itemFrameMaxZ = self.listZorigin + self.listFrameSizeZ
arrowUp = self.find('**/downScroll_up')
arrowDown = self.find('**/downScroll_down')
arrowHover = self.find('**/downScroll_hover')
self.scrollList = DirectScrolledList(parent=self.scrollLocator, relief=None, pos=(0, 0, 0), incButton_image=(arrowUp,
arrowDown,
arrowHover,
arrowUp), incButton_relief=None, incButton_scale=(self.arrowButtonXScale, 1, self.arrowButtonZScale), incButton_pos=incButtonPos, incButton_image3_color=Vec4(1, 1, 1, 0.2), decButton_image=(arrowUp,
arrowDown,
arrowHover,
arrowUp), decButton_relief=None, decButton_scale=(self.arrowButtonXScale, 1, -self.arrowButtonZScale), decButton_pos=decButtonPos, decButton_image3_color=Vec4(1, 1, 1, 0.2), itemFrame_pos=(self.itemFrameXorigin, 0, -0.03), numItemsVisible=4, incButtonCallback=self.scrollButtonPressed, decButtonCallback=self.scrollButtonPressed)
itemFrameParent = self.scrollList.itemFrame.getParent()
self.scrollList.incButton.reparentTo(self.scrollDownLocator)
self.scrollList.decButton.reparentTo(self.scrollUpLocator)
arrowUp.removeNode()
arrowDown.removeNode()
arrowHover.removeNode()
clipper = PlaneNode('clipper')
clipper.setPlane(Plane(Vec3(-1, 0, 0), Point3(0.23, 0, 0)))
clipNP = self.scrollList.component('itemFrame').attachNewNode(clipper)
self.scrollList.component('itemFrame').setClipPlane(clipNP)
return
def scrollButtonPressed(self):
#.........这里部分代码省略.........
示例3: CalendarGuiDay
# 需要导入模块: from direct.gui.DirectGui import DirectScrolledList [as 别名]
# 或者: from direct.gui.DirectGui.DirectScrolledList import component [as 别名]
class CalendarGuiDay(DirectFrame):
notify = directNotify.newCategory('CalendarGuiDay')
ScrollListTextSize = 0.03
LargeTextSize = 0.0232
def __init__(self, parent, myDate, startDate, dayClickCallback = None, onlyFutureDaysClickable = False):
self.origParent = parent
self.startDate = startDate
self.myDate = myDate
self.dayClickCallback = dayClickCallback
self.onlyFutureDaysClickable = onlyFutureDaysClickable
DirectFrame.__init__(self, parent=parent)
self.timedEvents = []
self.partiesInvitedToToday = []
self.hostedPartiesToday = []
self.yearlyHolidaysToday = []
self.showMarkers = config.GetBool('show-calendar-markers', 0)
self.filter = ToontownGlobals.CalendarFilterShowAll
self.load()
self.createGuiObjects()
self.update()
def createDummyLocators(self):
self.dayButtonLocator = self.attachNewNode('dayButtonLocator')
self.dayButtonLocator.setX(0.1)
self.dayButtonLocator.setZ(-0.05)
self.numberLocator = self.attachNewNode('numberLocator')
self.numberLocator.setX(0.09)
self.scrollLocator = self.attachNewNode('scrollLocator')
self.selectedLocator = self.attachNewNode('selectedLocator')
self.selectedLocator.setX(0.11)
self.selectedLocator.setZ(-0.06)
def load(self):
dayAsset = loader.loadModel('phase_4/models/parties/tt_m_gui_sbk_calendar_box')
dayAsset.reparentTo(self)
self.dayButtonLocator = self.find('**/loc_origin')
self.numberLocator = self.find('**/loc_number')
self.scrollLocator = self.find('**/loc_topLeftList')
self.selectedLocator = self.find('**/loc_origin')
self.todayBox = self.find('**/boxToday')
self.todayBox.hide()
self.selectedFrame = self.find('**/boxHover')
self.selectedFrame.hide()
self.defaultBox = self.find('**/boxBlank')
self.scrollBottomRightLocator = self.find('**/loc_bottomRightList')
self.scrollDownLocator = self.find('**/loc_scrollDown')
self.attachMarker(self.scrollDownLocator)
self.scrollUpLocator = self.find('**/loc_scrollUp')
self.attachMarker(self.scrollUpLocator)
def attachMarker(self, parent, scale = 0.005, color = (1, 0, 0)):
if self.showMarkers:
marker = loader.loadModel('phase_3/models/misc/sphere')
marker.reparentTo(parent)
marker.setScale(scale)
marker.setColor(*color)
def createGuiObjects(self):
self.dayButton = DirectButton(parent=self.dayButtonLocator, image=self.selectedFrame, relief=None, command=self.__clickedOnDay, pressEffect=1, rolloverSound=None, clickSound=None)
self.numberWidget = DirectLabel(parent=self.numberLocator, relief=None, text=str(self.myDate.day), text_scale=0.04, text_align=TextNode.ACenter, text_font=ToontownGlobals.getInterfaceFont(), text_fg=Vec4(110 / 255.0, 126 / 255.0, 255 / 255.0, 1))
self.attachMarker(self.numberLocator)
self.listXorigin = 0
self.listFrameSizeX = self.scrollBottomRightLocator.getX() - self.scrollLocator.getX()
self.scrollHeight = self.scrollLocator.getZ() - self.scrollBottomRightLocator.getZ()
self.listZorigin = self.scrollBottomRightLocator.getZ()
self.listFrameSizeZ = self.scrollLocator.getZ() - self.scrollBottomRightLocator.getZ()
self.arrowButtonXScale = 1
self.arrowButtonZScale = 1
self.itemFrameXorigin = 0
self.itemFrameZorigin = 0
self.buttonXstart = self.itemFrameXorigin + 0.21
self.gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui')
buttonOffSet = -0.01
incButtonPos = (0.0, 0, 0)
decButtonPos = (0.0, 0, 0)
itemFrameMinZ = self.listZorigin
itemFrameMaxZ = self.listZorigin + self.listFrameSizeZ
arrowUp = self.find('**/downScroll_up')
arrowDown = self.find('**/downScroll_down')
arrowHover = self.find('**/downScroll_hover')
self.scrollList = DirectScrolledList(parent=self.scrollLocator, relief=None, pos=(0, 0, 0), incButton_image=(arrowUp,
arrowDown,
arrowHover,
arrowUp), incButton_relief=None, incButton_scale=(self.arrowButtonXScale, 1, self.arrowButtonZScale), incButton_pos=incButtonPos, incButton_image3_color=Vec4(1, 1, 1, 0.2), decButton_image=(arrowUp,
arrowDown,
arrowHover,
arrowUp), decButton_relief=None, decButton_scale=(self.arrowButtonXScale, 1, -self.arrowButtonZScale), decButton_pos=decButtonPos, decButton_image3_color=Vec4(1, 1, 1, 0.2), itemFrame_pos=(self.itemFrameXorigin, 0, -0.03), numItemsVisible=4, incButtonCallback=self.scrollButtonPressed, decButtonCallback=self.scrollButtonPressed)
itemFrameParent = self.scrollList.itemFrame.getParent()
self.scrollList.incButton.reparentTo(self.scrollDownLocator)
self.scrollList.decButton.reparentTo(self.scrollUpLocator)
arrowUp.removeNode()
arrowDown.removeNode()
arrowHover.removeNode()
clipper = PlaneNode('clipper')
clipper.setPlane(Plane(Vec3(-1, 0, 0), Point3(0.23, 0, 0)))
clipNP = self.scrollList.component('itemFrame').attachNewNode(clipper)
self.scrollList.component('itemFrame').setClipPlane(clipNP)
#.........这里部分代码省略.........