本文整理汇总了Python中volumina.layerstack.LayerStackModel.selectedRow方法的典型用法代码示例。如果您正苦于以下问题:Python LayerStackModel.selectedRow方法的具体用法?Python LayerStackModel.selectedRow怎么用?Python LayerStackModel.selectedRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类volumina.layerstack.LayerStackModel
的用法示例。
在下文中一共展示了LayerStackModel.selectedRow方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testMovingLayers
# 需要导入模块: from volumina.layerstack import LayerStackModel [as 别名]
# 或者: from volumina.layerstack.LayerStackModel import selectedRow [as 别名]
def testMovingLayers( self ):
lsm = LayerStackModel()
lsm.append(self.l1)
lsm.append(self.l2)
lsm.append(self.l3)
lsm.selectRow(1)
self.assertEqual(len(lsm),3)
self.assertEqual(lsm[0].name, self.l3.name )
self.assertEqual(lsm[1].name, self.l2.name )
self.assertEqual(lsm[2].name, self.l1.name )
self.assertEqual(lsm.selectedRow(), 1)
lsm.moveSelectedDown()
self.assertEqual(lsm.selectedRow(), 2)
self.assertEqual(len(lsm),3)
self.assertEqual(lsm[0].name, self.l3.name )
self.assertEqual(lsm[1].name, self.l1.name )
self.assertEqual(lsm[2].name, self.l2.name )
lsm.selectRow(1)
lsm.moveSelectedUp()
self.assertEqual(lsm.selectedRow(), 0)
self.assertEqual(len(lsm),3)
self.assertEqual(lsm[0].name, self.l1.name )
self.assertEqual(lsm[1].name, self.l3.name )
self.assertEqual(lsm[2].name, self.l2.name )
# moving topmost layer up => nothing should happen
lsm.selectRow(0)
self.assertEqual(lsm.selectedRow(), 0)
self.assertEqual(lsm[0].name, self.l1.name )
self.assertEqual(lsm[1].name, self.l3.name )
self.assertEqual(lsm[2].name, self.l2.name )
lsm.moveSelectedUp()
self.assertEqual(lsm.selectedRow(), 0)
self.assertEqual(lsm[0].name, self.l1.name )
self.assertEqual(lsm[1].name, self.l3.name )
self.assertEqual(lsm[2].name, self.l2.name )
# moving bottommost layer down => nothing should happen
lsm.selectRow(2)
self.assertEqual(lsm.selectedRow(), 2)
self.assertEqual(lsm[0].name, self.l1.name )
self.assertEqual(lsm[1].name, self.l3.name )
self.assertEqual(lsm[2].name, self.l2.name )
lsm.moveSelectedDown()
self.assertEqual(lsm.selectedRow(), 2)
self.assertEqual(lsm[0].name, self.l1.name )
self.assertEqual(lsm[1].name, self.l3.name )
self.assertEqual(lsm[2].name, self.l2.name )