本文整理汇总了Python中pgidocgen.repo.Repository.import_module方法的典型用法代码示例。如果您正苦于以下问题:Python Repository.import_module方法的具体用法?Python Repository.import_module怎么用?Python Repository.import_module使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pgidocgen.repo.Repository
的用法示例。
在下文中一共展示了Repository.import_module方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_gtk
# 需要导入模块: from pgidocgen.repo import Repository [as 别名]
# 或者: from pgidocgen.repo.Repository import import_module [as 别名]
def test_gtk(self):
repo = Repository("Gtk", "3.0")
Gtk = repo.import_module()
klass = Class.from_object(repo, Gtk.TreeModel)
vfunc = find(klass.vfuncs, "do_get_iter")
self.assertTrue(vfunc.info.desc)
Class.from_object(repo, Gtk.Button)
Class.from_object(repo, Gtk.Paned)
Class.from_object(repo, Gtk.ActionBar)
klass = Class.from_object(repo, Gtk.TextView)
self.assertTrue(klass.image_path)
klass = Class.from_object(repo, Gtk.Widget)
translate_coordinates = find(klass.methods, "translate_coordinates")
# make sure we replace src_widget with self
self.assertTrue("src_widget" not in translate_coordinates.info.desc)
mod = repo.parse()
find(mod.class_structures, "WidgetClass")
find(mod.structures, "TableChild")
self.assertRaises(
LookupError, find, mod.class_structures, "TableChild")
self.assertRaises(
LookupError, find, mod.structures, "WidgetClass")
示例2: test_atk
# 需要导入模块: from pgidocgen.repo import Repository [as 别名]
# 或者: from pgidocgen.repo.Repository import import_module [as 别名]
def test_atk(self):
repo = Repository("Atk", "1.0")
Atk = repo.import_module()
c = Constant.from_object(repo, "", "FOO", Atk.Document.__gtype__)
self.assertEqual(str(c.value), "<GType AtkDocument>")
klass = Class.from_object(repo, Atk.Document)
method = find(klass.methods, "get_attributes")
self.assertEqual(method.info.version_added, "1.12")
method = find(klass.methods, "get_attribute_value")
self.assertEqual(method.info.version_added, "1.12")
klass = Class.from_object(repo, Atk.Hyperlink)
method = find(klass.methods, "is_selected_link")
self.assertTrue(method.info.deprecated)
self.assertEqual(method.info.version_added, "1.4")
self.assertEqual(method.info.version_deprecated, "1.8")
self.assertTrue(method.info.deprecation_desc, "1.8")
klass = Flags.from_object(repo, Atk.Role)
info = find(klass.values, "APPLICATION").info
self.assertEqual(info.version_added, "1.1.4")
示例3: test_method_inheritance
# 需要导入模块: from pgidocgen.repo import Repository [as 别名]
# 或者: from pgidocgen.repo.Repository import import_module [as 别名]
def test_method_inheritance(self):
repo = Repository("Atk", "1.0")
Atk = repo.import_module()
klass = Class.from_object(repo, Atk.Plug)
self.assertEqual(
[x[0] for x in klass.methods_inherited],
['Atk.Object', 'GObject.Object', 'Atk.Component']
)
示例4: test_method_inheritance
# 需要导入模块: from pgidocgen.repo import Repository [as 别名]
# 或者: from pgidocgen.repo.Repository import import_module [as 别名]
def test_method_inheritance(self):
repo = Repository("Atk", "1.0")
Atk = repo.import_module()
klass = Class.from_object(repo, Atk.Plug)
self.assertEqual(
klass.methods_inherited,
[('Atk.Object', 23),
('GObject.Object', 33),
('Atk.Component', 13)])
示例5: test_hierarchy
# 需要导入模块: from pgidocgen.repo import Repository [as 别名]
# 或者: from pgidocgen.repo.Repository import import_module [as 别名]
def test_hierarchy(self):
from pgi.repository import GObject
repo = Repository("Atk", "1.0")
Atk = repo.import_module()
hier = get_hierarchy([Atk.NoOpObjectFactory])
self.assertEqual(hier.keys(), [GObject.Object])
self.assertEqual(hier[GObject.Object].keys(), [Atk.ObjectFactory])
self.assertEqual(hier[GObject.Object][Atk.ObjectFactory].keys(), [Atk.NoOpObjectFactory])
self.assertFalse(hier[GObject.Object][Atk.ObjectFactory][Atk.NoOpObjectFactory])
示例6: test_gtk_overrides
# 需要导入模块: from pgidocgen.repo import Repository [as 别名]
# 或者: from pgidocgen.repo.Repository import import_module [as 别名]
def test_gtk_overrides(self):
repo = Repository("Gtk", "3.0")
Gtk = repo.import_module()
PyClass.from_object(repo, Gtk.TreeModelRow)
PyClass.from_object(repo, Gtk.TreeModelRowIter)
func = Function.from_object("Gtk.Container", "child_get", Gtk.Container.child_get, repo, Gtk.Container)
self.assertEqual(func.info.desc, "Returns a list of child property values for the given names.")
self.assertEqual(func.signature, "(child, *prop_names)")
func = Function.from_object("Gtk", "stock_lookup", Gtk.stock_lookup, repo, Gtk)
self.assertEqual(func.signature, "(stock_id)")
示例7: test_gio
# 需要导入模块: from pgidocgen.repo import Repository [as 别名]
# 或者: from pgidocgen.repo.Repository import import_module [as 别名]
def test_gio(self):
repo = Repository("Gio", "2.0")
Gio = repo.import_module()
klass = Class.from_object(repo, Gio.Application)
method = find(klass.methods, "activate")
signal = find(klass.signals, "activate")
self.assertTrue(method.info.desc)
self.assertTrue(signal.info.desc)
self.assertNotEqual(method.info.desc, signal.info.desc)
signal = find(klass.signals, "command_line")
self.assertTrue(":param command_line:" in signal.signature_desc)
klass = Class.from_object(repo, Gio.File)
method = find(klass.methods, "load_contents_finish")
self.assertTrue(":returns:" in method.signature_desc)
示例8: test_atk
# 需要导入模块: from pgidocgen.repo import Repository [as 别名]
# 或者: from pgidocgen.repo.Repository import import_module [as 别名]
def test_atk(self):
repo = Repository("Atk", "1.0")
Atk = repo.import_module()
klass = Class.from_object(repo, Atk.Document)
method = find(klass.methods, "get_attributes")
self.assertEqual(method.info.version_added, "1.12")
method = find(klass.methods, "get_attribute_value")
self.assertEqual(method.info.version_added, "1.12")
klass = Class.from_object(repo, Atk.Hyperlink)
method = find(klass.methods, "is_selected_link")
self.assertTrue(method.info.deprecated)
self.assertEqual(method.info.version_added, "1.4")
self.assertEqual(method.info.version_deprecated, "1.8")
self.assertTrue(method.info.deprecation_desc, "1.8")
示例9: test_gtk
# 需要导入模块: from pgidocgen.repo import Repository [as 别名]
# 或者: from pgidocgen.repo.Repository import import_module [as 别名]
def test_gtk(self):
repo = Repository("Gtk", "3.0")
mod = repo.parse()
Gtk = repo.import_module()
klass = Class.from_object(repo, Gtk.TreeModel)
vfunc = find(klass.vfuncs, "do_get_iter")
self.assertTrue(vfunc.info.desc)
Class.from_object(repo, Gtk.Button)
Class.from_object(repo, Gtk.Paned)
Class.from_object(repo, Gtk.ActionBar)
klass = Class.from_object(repo, Gtk.TextView)
self.assertTrue(klass.image_path)
find(mod.class_structures, "WidgetClass")
find(mod.structures, "TableChild")
self.assertRaises(LookupError, find, mod.class_structures, "TableChild")
self.assertRaises(LookupError, find, mod.structures, "WidgetClass")
示例10: test_gobject
# 需要导入模块: from pgidocgen.repo import Repository [as 别名]
# 或者: from pgidocgen.repo.Repository import import_module [as 别名]
def test_gobject(self):
repo = Repository("GObject", "2.0")
GObject = repo.import_module()
mod = repo.parse()
self.assertEqual(
repo.lookup_py_id_for_type_struct("GObjectClass"),
"GObject.Object")
klass = Class.from_object(repo, GObject.Object)
method = find(klass.methods, "list_properties")
self.assertTrue(method.is_static)
self.assertEqual(method.fullname, "GObject.Object.list_properties")
klass = find(mod.enums, "GEnum")
self.assertEqual(klass.base, "GLib.Enum")
klass = find(mod.flags, "GFlags")
self.assertEqual(klass.base, "GLib.Flags")
klass = find(mod.flags, "ParamFlags")
self.assertEqual(klass.base, "GLib.Flags")
示例11: test_override_method
# 需要导入模块: from pgidocgen.repo import Repository [as 别名]
# 或者: from pgidocgen.repo.Repository import import_module [as 别名]
def test_override_method(self):
repo = Repository("Gtk", "3.0")
Gtk = repo.import_module()
func = Function.from_object(
"Gtk.Widget", "translate_coordinates", Gtk.Widget.translate_coordinates, repo, Gtk.Widget)
self.assertEqual(func.signature, "(dest_widget, src_x, src_y)")
示例12: test_gudev
# 需要导入模块: from pgidocgen.repo import Repository [as 别名]
# 或者: from pgidocgen.repo.Repository import import_module [as 别名]
def test_gudev(self):
repo = Repository("GUdev", "1.0")
GUdev = repo.import_module()
Class.from_object(repo, GUdev.Client)