本文整理汇总了Python中gtk.Builder方法的典型用法代码示例。如果您正苦于以下问题:Python gtk.Builder方法的具体用法?Python gtk.Builder怎么用?Python gtk.Builder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gtk
的用法示例。
在下文中一共展示了gtk.Builder方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_btundockconsole_clicked
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Builder [as 别名]
def on_btundockconsole_clicked(self, widget, data=None):
"""
Function called when you press "undock"
"""
#create a new window and append the vnc
if self.selected_ref not in self.vnc_builders.keys():
self.noclosevnc = True
self.builder.get_object("console_area").remove(self.vnc[self.selected_ref])
glade_dir = os.path.join(utils.module_path(), 'ui')
self.vnc_builders[self.selected_ref] = gtk.Builder()
self.vnc_builders[self.selected_ref].add_from_file(os.path.join(glade_dir,"window_vnc.glade"))
self.vnc_builders[self.selected_ref].get_object("console_area3").add(self.vnc[self.selected_ref])
self.vnc_builders[self.selected_ref].get_object("btredockconsole").connect("clicked", self.on_btredockconsole_clicked,self.selected_ref)
self.vnc_builders[self.selected_ref].get_object("btredockconsole").connect("destroy", self.on_btredockconsole_clicked,self.selected_ref)
self.vnc_builders[self.selected_ref].get_object("btsendctrlaltdel1").connect("clicked", self.on_btsendctraltdel_clicked,self.selected_ref)
self.vnc_builders[self.selected_ref].get_object("windowvncundock").set_title(self.selected_name)
self.vnc_builders[self.selected_ref].get_object("windowvncundock").show_all()
else:
#If the vnc window already exists (partially covered or minimized), present it to the user.
self.vnc_builders[self.selected_ref].get_object("windowvncundock").present()
示例2: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Builder [as 别名]
def __init__ (self, term):
self.config = config.Config()
self.term = term
self.builder = gtk.Builder()
self.keybindings = Keybindings()
try:
# Figure out where our library is on-disk so we can open our
(head, _tail) = os.path.split(config.__file__)
librarypath = os.path.join(head, 'preferences.glade')
gladefile = open(librarypath, 'r')
gladedata = gladefile.read()
except Exception, ex:
print "Failed to find preferences.glade"
print ex
return
示例3: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Builder [as 别名]
def __init__(self, inifile, width, height):
gobject.GObject.__init__(self)
super(HazzyGremlin, self).__init__(inifile)
self.width = width
self.height = height
self.percent = 0
self.mouse_mode = None
self.zoom_in_pressed = False
self.zoom_out_pressed = False
self.set_display_units('in')
# Gremlin3D width = width - 40 to allow room for the controls
self.set_size_request(self.width - 40, self.height)
# Add gremlin back-plot
self.gremlin_view = gtk.HBox()
fixed = gtk.Fixed()
fixed.put(self, 0, 0)
self.gremlin_view.add(fixed)
self.connect('button_press_event', self.on_gremlin_clicked)
# Add touchscreen controls
gladefile = os.path.join(UIDIR, 'controls.glade')
self.builder = gtk.Builder()
self.builder.add_from_file(gladefile)
self.builder.connect_signals(self)
controls = self.builder.get_object('controls')
controls.set_size_request(40, self.height)
self.gremlin_view.add(controls)
# Add progress label
self.label = gtk.Label()
self.label.modify_font(pango.FontDescription('FreeSans 11'))
self.label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.Color('White'))
labelbox = gtk.EventBox()
labelbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color('Black'))
labelbox.set_size_request(-1, 20)
labelbox.add(self.label)
fixed.put(labelbox, 0 , self.height - 20)
# def fileloading(self, current_line):
# self.progressbar.show()
# percent = current_line * 100 / self.line_count
# if self.percent != percent:
# self.percent = percent
# msg = "Generating preview {}%".format(self.percent)
# self.progressbar.set_text(msg)
# self.progressbar.set_fraction(self.percent / 100)
# log.debug(msg)
# self.emit('loading_progress', percent)