本文整理汇总了Python中tools.Tools.release方法的典型用法代码示例。如果您正苦于以下问题:Python Tools.release方法的具体用法?Python Tools.release怎么用?Python Tools.release使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tools.Tools
的用法示例。
在下文中一共展示了Tools.release方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from tools import Tools [as 别名]
# 或者: from tools.Tools import release [as 别名]
class DrawingInterface:
"""
The GTK interface to the drawing.
This class creates a GTK window, adds a drawing area to it and handles
GTK's destroy and expose events in order to close the application and
re-draw the area using Cairo.
"""
def __init__(self, area):
self._load_shape_on_init = None #"shapefiles/lt/keliai.shp"
self._print_orientation = 1 # landscape
self._print_settings = gtk.PrintSettings()
try:
self._print_settings.load_file("printer.settings")
except:
pass
self.main_window = gtk.Window()
vbox = gtk.VBox(False, 0)
self.main_window.add(vbox)
self.main_window.set_size_request(area.width, area.height)
vbox.show()
self.main_window.connect("destroy", self.destroy_event)
self.draw_area = gtk.DrawingArea()
#self.draw_area.set_size_request(200, 200)
hbox = gtk.HBox(False, 1)
vbox.pack_start(hbox, True, True, 0)
hbox.pack_start(self.draw_area, True, True, 0)
hbox.show()
self.draw_area.show()
self.draw_area.connect("expose-event", self.expose_event)
self.draw_area.connect("configure_event", self.configure_event)
# Event signals
# http://www.pygtk.org/pygtk2tutorial/sec-EventHandling.html
self.draw_area.connect("motion_notify_event", self.motion_notify_event)
self.draw_area.connect("button_press_event", self.button_press_event)
self.draw_area.connect("button_release_event", self.button_release_event)
self.main_window.connect("key_press_event", self.key_press_event)
#self.main_window.connect("leave_notify_event", self.leave_notify_event)
#self.main_window.connect("enter_notify_event", self.leave_notify_event)
#self.main_window.set_events(gtk.gdk.LEAVE_NOTIFY_MASK)
self.draw_area.set_events(gtk.gdk.EXPOSURE_MASK
| gtk.gdk.BUTTON_PRESS_MASK
| gtk.gdk.BUTTON_RELEASE_MASK
| gtk.gdk.BUTTON3_MOTION_MASK
| gtk.gdk.POINTER_MOTION_MASK
| gtk.gdk.POINTER_MOTION_HINT_MASK
#| gtk.gdk.ENTER_NOTIFY_MASK
#| gtk.gdk.LEAVE_NOTIFY_MASK
#| gtk.gdk.KEY_PRESS_MASK
)
vbox_toolbar = gtk.VBox(False, 1)
vbox_toolbar.set_size_request(100, 0)
hbox.pack_start(vbox_toolbar, False, False, 0)
vbox_toolbar.show()
zoom_in_button = gtk.Button("ZoomIn")
vbox_toolbar.pack_start(zoom_in_button, False, False, 0)
zoom_in_button.connect_object("clicked", self.zoom, 1)
zoom_in_button.show()
zoom_out_button = gtk.Button("ZoomOut")
vbox_toolbar.pack_start(zoom_out_button, False, False, 0)
zoom_out_button.connect_object("clicked", self.zoom, -1)
zoom_out_button.show()
center_button = gtk.Button("Center")
vbox_toolbar.pack_start(center_button, False, False, 0)
center_button.connect_object("clicked", self.center, None)
center_button.show()
valign0 = gtk.Alignment(0, 1, 0, 0)
vbox_toolbar.pack_start(valign0)
valign0.show()
Invoker.set_button_event("enable", lambda button: button.set_sensitive(1))
Invoker.set_button_event("disable", lambda button: button.set_sensitive(0))
undo_button = gtk.Button("Undo")
Invoker.set_button("undo", undo_button, disable=True)
vbox_toolbar.pack_start(undo_button, False, False, 0)
undo_button.connect_object("clicked", self.undo, None)
undo_button.show()
redo_button = gtk.Button("Redo")
Invoker.set_button("redo", redo_button, disable=True)
vbox_toolbar.pack_start(redo_button, False, False, 0)
#.........这里部分代码省略.........