本文整理汇总了Python中GLIUtility.list_mirrors方法的典型用法代码示例。如果您正苦于以下问题:Python GLIUtility.list_mirrors方法的具体用法?Python GLIUtility.list_mirrors怎么用?Python GLIUtility.list_mirrors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLIUtility
的用法示例。
在下文中一共展示了GLIUtility.list_mirrors方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: host_browse_clicked
# 需要导入模块: import GLIUtility [as 别名]
# 或者: from GLIUtility import list_mirrors [as 别名]
def host_browse_clicked(self, button):
hostdlg = gtk.Dialog("Browse mirror list", self, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, (gtk.STOCK_OK, gtk.RESPONSE_ACCEPT, gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT))
hbox = gtk.HBox(False)
hbox.set_border_width(10)
hbox.pack_start(gtk.Label("Mirror:"), expand=False, fill=False, padding=0)
host_combo = gtk.combo_box_new_text()
if self.uritypes[self.uritype.get_active()] == "http":
mirrors = GLIUtility.list_mirrors(http=True, ftp=False, rsync=False)
elif self.uritypes[self.uritype.get_active()] == "ftp":
mirrors = GLIUtility.list_mirrors(http=False, ftp=True, rsync=False)
else:
msgdlg = gtk.MessageDialog(parent=self, type=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK, message_format=_("There are no known mirrors for this URI type."))
msgdlg.run()
msgdlg.destroy()
return
for mirror in mirrors:
host_combo.append_text(mirror[1])
host_combo.set_active(0)
hbox.pack_start(host_combo, expand=False, fill=True, padding=15)
hbox.show_all()
hostdlg.vbox.pack_start(hbox)
resp = hostdlg.run()
if resp == gtk.RESPONSE_ACCEPT:
mirror = mirrors[host_combo.get_active()][0]
if not mirror.endswith("/"):
mirror += "/"
self.uri = mirror
self.update_from_uri()
hostdlg.destroy()