本文整理汇总了Python中Pyblio.Autoload.available方法的典型用法代码示例。如果您正苦于以下问题:Python Autoload.available方法的具体用法?Python Autoload.available怎么用?Python Autoload.available使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pyblio.Autoload
的用法示例。
在下文中一共展示了Autoload.available方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Pyblio import Autoload [as 别名]
# 或者: from Pyblio.Autoload import available [as 别名]
def __init__ (self, parent = None, has_auto = True):
Utils.GladeWindow.__init__ (self, parent)
liststore = gtk.ListStore (gobject.TYPE_STRING)
menu = self._w_combobox
menu.set_model (liststore)
cell = gtk.CellRendererText()
menu.pack_start(cell, True)
menu.add_attribute(cell, 'text', 0)
liste = Autoload.available ('format')
liste.sort ()
self.formats = [ None ]
if has_auto:
iter = liststore.append ()
liststore.set (iter, 0, _(' - According to file suffix - '))
self.ftype = None
else:
self.ftype = liste [0]
for avail in liste:
iter = liststore.append ()
liststore.set (iter, 0, avail)
self.formats += liste
menu.set_active (0)
menu.connect ("changed", self.menu_select)
return
示例2: __init__
# 需要导入模块: from Pyblio import Autoload [as 别名]
# 或者: from Pyblio.Autoload import available [as 别名]
def __init__ (self, parent = None):
Utils.GladeWindow.__init__ (self, parent)
# Fill the output format drop-down menu
menu = gtk.Menu ()
self._w_menu.set_menu (menu)
outlist = Autoload.available ('output')
outlist.sort ()
for avail in outlist:
Utils.popup_add (menu, avail, self._menu_select, avail)
self._w_menu.set_history (0)
self.menu_item = outlist [0]
self._w_style_entry.set_default_path (FormatDialog.style)
self._w_style.set_text (FormatDialog.style)
if FormatDialog.output:
self._w_output_entry.set_default_path (FormatDialog.output)
self._w_output.set_text (FormatDialog.output)
self._w_format.show ()
return
示例3: __init__
# 需要导入模块: from Pyblio import Autoload [as 别名]
# 或者: from Pyblio.Autoload import available [as 别名]
def __init__ (self, parent=None):
Utils.Builder.__init__(self, parent)
cell = gtk.CellRendererText()
self._w_menu.pack_start (cell, True)
self._w_menu.add_attribute (cell, 'text', 0)
outlist = Autoload.available ('output')
outlist.sort ()
for avail in outlist:
self._w_menu.append_text(avail)
self._w_menu.set_active(0)
self.menu_item = outlist[0]
self._w_style.set_filename(FormatDialog.style)
if FormatDialog.output:
self._w_output.set_filename(FormatDialog.output)
self._w_format.show ()
示例4: simple_try
# 需要导入模块: from Pyblio import Autoload [as 别名]
# 或者: from Pyblio.Autoload import available [as 别名]
def simple_try (url, how):
# url is Fields.URL instance, only to be passed to opener
base = None
if how == None:
listedmethods = Autoload.available ("format")
for method in listedmethods:
opener = get_by_name (method, 'open')
if opener:
base = opener (url, 1)
if base is not None:
return base
return None
opener = get_by_name (how, 'open')
if opener:
base = opener (url, 0)
else:
raise Exceptions.FormatError (_(u"method “%s” provides no opener") % how)
return base
示例5: __init__
# 需要导入模块: from Pyblio import Autoload [as 别名]
# 或者: from Pyblio.Autoload import available [as 别名]
def __init__(self, title=_("File"),
modal=True, has_auto=True, is_save=False,
directory=None, show_type=True, parent=None):
gtk.FileChooserDialog.__init__(self, parent=parent)
accelerator = gtk.AccelGroup ()
self.add_accel_group (accelerator)
b = self.add_button (gtk.STOCK_OK, gtk.RESPONSE_OK)
b.add_accelerator ('clicked', accelerator, gtk.keysyms.Return, 0, 0)
b = self.add_button (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT)
b.add_accelerator ('clicked', accelerator, gtk.keysyms.Escape, 0, 0)
if is_save:
self.set_action(gtk.FILE_CHOOSER_ACTION_SAVE)
self.set_local_only (False)
self.set_title (title)
if directory:
self.set_current_folder (directory)
elif self.defaultdir:
self.set_current_folder (self.defaultdir)
self.ret = None
self.ftype = None
if show_type:
# type selector
hbox = gtk.HBox ()
hbox.set_spacing (5)
hbox.set_border_width (5)
hbox.pack_start (gtk.Label (_("Bibliography type:")),
expand = False, fill = False)
self.menu = gtk.combo_box_new_text ()
hbox.pack_start (self.menu)
self.set_extra_widget (hbox)
# menu content
liste = Autoload.available ('format')
liste.sort ()
self.formats = []
if has_auto:
self.menu.append_text (_(' — According to file suffix — '))
self.ftype = None
self.formats.append(None)
else:
self.ftype = liste [0]
for avail in liste:
self.menu.append_text (avail)
self.formats += liste
self.menu.set_active (0)
self.menu.connect ("changed", self.menu_select)
hbox.show_all ()
return
示例6: open
# 需要导入模块: from Pyblio import Autoload [as 别名]
# 或者: from Pyblio.Autoload import available [as 别名]
continue
if opt == '-F' or opt == '--footer':
footer = value
continue
if opt == '-o' or opt == '--output':
try:
outfile = open (value, 'w')
except IOError, err:
error (_("can't open `%s': %s") % (value, str (err).decode (charset)))
continue
if opt == '-l' or opt == '--list':
try:
list = Autoload.available (value)
except KeyError:
error (_("unknown list `%s'") % value)
if list:
print (_("pyblioformat: available values for `%s':") % value).encode (charset)
print " " + string.join (list, ", ")
sys.exit (0)
else:
warning (_("empty value list `%s'") % value)
sys.exit (0)
if opt == '-h' or opt == '--help':
usage ()
sys.exit (0)
continue
示例7: _get_keytypes
# 需要导入模块: from Pyblio import Autoload [as 别名]
# 或者: from Pyblio.Autoload import available [as 别名]
def _get_keytypes ():
return Autoload.available ('key')