当前位置: 首页>>代码示例>>Python>>正文


Python Line.horizontal方法代码示例

本文整理汇总了Python中gaphas.item.Line.horizontal方法的典型用法代码示例。如果您正苦于以下问题:Python Line.horizontal方法的具体用法?Python Line.horizontal怎么用?Python Line.horizontal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gaphas.item.Line的用法示例。


在下文中一共展示了Line.horizontal方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_orthogonal_horizontal_undo

# 需要导入模块: from gaphas.item import Line [as 别名]
# 或者: from gaphas.item.Line import horizontal [as 别名]
def test_orthogonal_horizontal_undo(revert_undo, undo_fixture):
    """Test orthogonal line constraints bug (#107).

    """
    canvas = Canvas()
    line = Line()
    canvas.add(line)
    assert not line.horizontal
    assert len(canvas.solver._constraints) == 0

    segment = Segment(line, None)
    segment.split_segment(0)

    line.orthogonal = True

    assert 2 == len(canvas.solver._constraints)

    del undo_fixture[2][:]  # Clear undo_list
    line.horizontal = True

    assert 2 == len(canvas.solver._constraints)

    undo_fixture[0]()  # Call undo

    assert not line.horizontal
    assert 2 == len(canvas.solver._constraints)

    line.horizontal = True

    assert line.horizontal
    assert 2 == len(canvas.solver._constraints)
开发者ID:amolenaar,项目名称:gaphas,代码行数:33,代码来源:test_line.py

示例2: test_orthogonal_horizontal_undo

# 需要导入模块: from gaphas.item import Line [as 别名]
# 或者: from gaphas.item.Line import horizontal [as 别名]
    def test_orthogonal_horizontal_undo(self):
        canvas = Canvas()
        line = Line()
        canvas.add(line)

        assert len(canvas.solver._constraints) == 0

        line.orthogonal = True

        assert len(canvas.solver._constraints) == 2
        after_ortho = set(canvas.solver._constraints)

        del undo_list[:]
        line.horizontal = True

        assert len(canvas.solver._constraints) == 2

        undo()

        assert not line.horizontal
        assert len(canvas.solver._constraints) == 2, canvas.solver._constraints

        line.horizontal = True

        assert line.horizontal
        assert len(canvas.solver._constraints) == 2, canvas.solver._constraints
开发者ID:hugoruscitti,项目名称:examplelab,代码行数:28,代码来源:test_line.py

示例3: test_line_guide_horizontal

# 需要导入模块: from gaphas.item import Line [as 别名]
# 或者: from gaphas.item.Line import horizontal [as 别名]
    def test_line_guide_horizontal(self):
        c = Canvas()
        l = Line()
        c.add(l)
        l.handles().append(l._create_handle((20, 20)))
        l.handles().append(l._create_handle((30, 30)))
        l.handles().append(l._create_handle((40, 40)))
        l.horizontal = True
        l.orthogonal = True
        c.update_now()

        guides = list(Guide(l).horizontal())
        self.assertEquals(2, len(guides))
        self.assertEquals(0.0, guides[0])
        self.assertEquals(20.0, guides[1])

        guides = list(Guide(l).horizontal())
        self.assertEquals(2, len(guides))
        self.assertEquals(0.0, guides[0])
        self.assertEquals(20.0, guides[1])
开发者ID:adrianboguszewski,项目名称:gaphas,代码行数:22,代码来源:test_guide.py


注:本文中的gaphas.item.Line.horizontal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。