本文整理汇总了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(