这是我的应用的代码
来自lib.HTMLWindow的导入HTMLWindow 来自gi.repository import Gtk
类MyWindow(HTMLWindow):
def __init__(self):
super(MyWindow, self).__init__(442, 442)
self.drag = True
self.connect('button-press-event', self.button_press)
def button_press(self, widget, event):
if event.button == 1 and self.drag:
print "button 1 pressed and self drag is true"
Gtk.Window.begin_move_drag(self, event.button, event.x_root, event.y_root, event.time)
def on_html_message(self, signal_name, data):
print "signal received from frontend: %(signal)s, with this data: %(data)s" % {'signal': signal_name, 'data': data}
if signal_name == 'frontend_loaded':
version = 'Unknown OS'
for line in open('/etc/lsb-release'):
if 'DISTRIB_DESCRIPTION' in line:
version = line.replace('DISTRIB_DESCRIPTION=', '')[1:-2]
self.send_html_message('version_provided', {"version": "%s %s" % (data, version)})
elif signal_name == 'quit':
self.destroy()
elif signal_name == 'minimize':
self.iconify()
elif signal_name == 'enable_drag':
self.drag = True
elif signal_name == 'disable_drag':
self.drag = False