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


Python Canvas.set_viewport方法代码示例

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


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

示例1: NetEditor

# 需要导入模块: from canvas import Canvas [as 别名]
# 或者: from canvas.Canvas import set_viewport [as 别名]

#.........这里部分代码省略.........
        elif name == "transition":
            self.canvas.set_config(neteditcc.NewTransitionCanvasConfig(self))
        elif name == "place":
            self.canvas.set_config(neteditcc.NewPlaceCanvasConfig(self))
        elif name == "edge":
            self.canvas.set_config(neteditcc.NewEdgeCanvasConfig(self))
        elif name == "area":
            self.canvas.set_config(neteditcc.NewAreaCanvasConfig(self))
        else:
            raise Exception("Invalid tool")
        self.canvas.config.set_net(self.net, self.canvas.viewport)

    def add_undo_action(self, action):
        self.undo_manager.add_action(action)
        self.on_undomanager_changed()

    def on_undomanager_changed(self):
        if self.undo_manager is None:
            self.button_undo.set_sensitive(False)
            self.button_redo.set_sensitive(False)
        else:
            self.button_undo.set_sensitive(self.undo_manager.has_undo())
            self.button_redo.set_sensitive(self.undo_manager.has_redo())

    def save_as_svg(self, filename):
        self.canvas.save_as_svg(filename)

    def get_zoom(self):
        return self.canvas.get_zoom()

    def focus_edit_item(self, index=0):
        self.attribute_widgets[0].grab_focus()

    def set_viewport(self, viewport):
        self.canvas.set_viewport(viewport)

    def get_viewport(self):
        return self.canvas.get_viewport()

    def redraw(self):
        self.canvas.redraw()

    def undo(self):
        if self.undo_manager.has_undo():
            self.undo_manager.perform_undo()
            self.on_undomanager_changed()
            self.net.changed()

    def redo(self):
        if self.undo_manager.has_redo():
            self.undo_manager.perform_redo()
            self.on_undomanager_changed()
            self.net.changed()

    def _controls(self):
        def add_radio_shortcut(accel_group, widget, key, ctrl=False):
            mask = 0
            if ctrl:
                mask |= gtk.gdk.CONTROL_MASK
            accel_group.connect_group(gtk.gdk.keyval_from_name(key),
                                      mask, gtk.ACCEL_VISIBLE,
                                      lambda a, b, c, d: activate_radio(widget))
        def activate_radio(widget):
            widget.set_active(True)

        icon_arrow = gtk.image_new_from_file(
开发者ID:cie0037,项目名称:kaira,代码行数:70,代码来源:neteditor.py


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