Python gi.require_version() Examples

The following are 50 code examples for showing how to use gi.require_version(). They are extracted from open source Python projects. You can vote up the examples you like or vote down the exmaples you don't like. You can also save this page to your account.

Example 1
Project: mac-package-build   Author: persepolisdm   File: gi.py    (license) View Source Project 7 votes vote down vote up
def get_gi_libdir(module, version):
    statement = """
        import gi
        gi.require_version("GIRepository", "2.0")
        from gi.repository import GIRepository
        repo = GIRepository.Repository.get_default()
        module, version = (%r, %r)
        repo.require(module, version,
                     GIRepository.RepositoryLoadFlags.IREPOSITORY_LOAD_FLAG_LAZY)
        print(repo.get_shared_library(module))
    """
    statement %= (module, version)
    libs = exec_statement(statement).split(',')
    for lib in libs:
        path = findSystemLibrary(lib.strip())
        return os.path.normpath(os.path.dirname(path))

    raise ValueError("Could not find libdir for %s-%s" % (module, version)) 
Example 2
Project: sc-controller   Author: kozec   File: gesture_display.py    (license) View Source Project 6 votes vote down vote up
def main():
	import gi
	gi.require_version('Gtk', '3.0')
	gi.require_version('Rsvg', '2.0')
	gi.require_version('GdkX11', '3.0')
	
	from scc.tools import init_logging
	from scc.paths import get_share_path
	init_logging()
	
	gd = GestureDisplay()
	if not gd.parse_argumets(sys.argv):
		sys.exit(1)
	gd.run()
	if gd.get_exit_code() == 0:
		print gd.get_gesture()
	else:
		sys.exit(gd.get_exit_code()) 
Example 3
Project: sc-controller   Author: kozec   File: test_setup.py    (license) View Source Project 6 votes vote down vote up
def test_packages(self):
		"""
		Tests if every known Action is documentated in docs/actions.md
		"""
		try:
			import gi
			gi.require_version('Gtk', '3.0') 
			gi.require_version('GdkX11', '3.0') 
			gi.require_version('Rsvg', '2.0') 
		except ImportError:
			pass
		
		from setup import packages
		for importer, modname, ispkg in pkgutil.walk_packages(path=scc.__path__, prefix="scc.", onerror=lambda x: None):
			if ispkg:
				assert modname in packages, "Package '%s' is not being installed by setup.py" % (modname,) 
Example 4
Project: scarlett_os   Author: bossjones   File: gi.py    (license) View Source Project 6 votes vote down vote up
def _gst_available():
    """Determine whether Gstreamer and the Python GObject bindings are
    installed.
    """
    try:
        import gi
    except ImportError:
        return False

    try:
        gi.require_version('Gst', '1.0')
    except (ValueError, AttributeError):
        return False

    try:
        from gi.repository import Gst  # noqa
    except ImportError:
        return False

    return True 
Example 5
Project: gprime   Author: GenealogyCollective   File: constfunc.py    (license) View Source Project 6 votes vote down vote up
def is_quartz():
    """
    Tests to see if Python is currently running with gtk and
    windowing system is Mac OS-X's "quartz".
    """
    if mac():
        try:
            import gi
            gi.require_version('Gtk', '3.0')
            gi.require_version('Gdk', '3.0')
            from gi.repository import Gtk
            from gi.repository import Gdk
        except ImportError:
            return False
        return Gdk.Display.get_default().__class__.__name__.endswith("QuartzDisplay")
    return False 
Example 6
Project: driveboardapp   Author: nortd   File: gi.py    (license) View Source Project 6 votes vote down vote up
def get_gi_libdir(module, version):
    statement = """
        import gi
        gi.require_version("GIRepository", "2.0")
        from gi.repository import GIRepository
        repo = GIRepository.Repository.get_default()
        module, version = (%r, %r)
        repo.require(module, version,
                     GIRepository.RepositoryLoadFlags.IREPOSITORY_LOAD_FLAG_LAZY)
        print(repo.get_shared_library(module))
    """
    statement %= (module, version)
    libs = exec_statement(statement).split(',')
    for lib in libs:
        path = findSystemLibrary(lib.strip())
        return os.path.normpath(os.path.dirname(path))

    raise ValueError("Could not find libdir for %s-%s" % (module, version)) 
Example 7
Project: SlackBuilds   Author: montagdude   File: setupext.py    (license) View Source Project 6 votes vote down vote up
def backend_gtk3agg_internal_check(x):
    try:
        import gi
    except ImportError:
        return (False, "Requires pygobject to be installed.")

    try:
        gi.require_version("Gtk", "3.0")
    except ValueError:
        return (False, "Requires gtk3 development files to be installed.")
    except AttributeError:
        return (False, "pygobject version too old.")

    try:
        from gi.repository import Gtk, Gdk, GObject
    except (ImportError, RuntimeError):
        return (False, "Requires pygobject to be installed.")

    return (True, "version %s.%s.%s" % (
        Gtk.get_major_version(),
        Gtk.get_micro_version(),
        Gtk.get_minor_version())) 
Example 8
Project: cavalcade   Author: worron   File: run.py    (license) View Source Project 6 votes vote down vote up
def import_optional():
	"""Safe module import"""
	success = AttributeDict()
	try:
		gi.require_version('Gst', '1.0')
		from gi.repository import Gst  # noqa: F401
		success.gstreamer = True
	except Exception:
		success.gstreamer = False
		logger.warning("Fail to import Gstreamer module")

	try:
		from PIL import Image  # noqa: F401
		success.pillow = True
	except Exception:
		success.pillow = False
		logger.warning("Fail to import Pillow module")

	return success 
Example 9
Project: keepass-menu   Author: frostidaho   File: xquery.py    (license) View Source Project 6 votes vote down vote up
def monitor_geometry():
    "Return the current monitor geometry"
    import gi
    gi.require_version('Gdk', '3.0')
    from gi.repository import Gdk
    from collections import namedtuple
    MonitorGeometry = namedtuple(
        'MonitorGeometry',
        ['left', 'right', 'top', 'bottom', 'width', 'height'],
    )

    display = Gdk.Display.get_default()
    screen = display.get_default_screen()
    window = screen.get_active_window()
    monitor = screen.get_monitor_at_window(window)

    g = screen.get_monitor_geometry(monitor)
    right = g.x + g.width
    bottom = g.y + g.height
    return MonitorGeometry(g.x, right, g.y, bottom, g.width, g.height) 
Example 10
Project: sc-controller   Author: kozec   File: scripts.py    (license) View Source Project 5 votes vote down vote up
def import_osd():
	import gi
	gi.require_version('Gtk', '3.0')
	gi.require_version('Rsvg', '2.0')
	gi.require_version('GdkX11', '3.0') 
Example 11
Project: sc-controller   Author: kozec   File: scripts.py    (license) View Source Project 5 votes vote down vote up
def cmd_dependency_check(argv0, argv):
	""" Checks if all required libraries are installed on this system """
	try:
		import gi
		gi.require_version('Gtk', '3.0') 
		gi.require_version('GdkX11', '3.0') 
		gi.require_version('Rsvg', '2.0') 
	except ValueError, e1:
		print >>sys.stderr, e1
		if "Rsvg" in str(e1):
			print >>sys.stderr, "Please, install 'gir1.2-rsvg-2.0' package to use this application"
		else:
			print >>sys.stderr, "Please, install 'PyGObject' package to use this application"
	except ImportError, e2:
		print e2
		return 1
	try:
		import evdev
	except Exception, e:
		print >>sys.stderr, e
		print >>sys.stderr, "Please, install python-evdev package to enable non-steam controller support"
	try:
		import scc.lib.xwrappers as X
		X.Atom
	except Exception, e:
		print >>sys.stderr, e
		print >>sys.stderr, "Failed to load X11 helpers, please, check your X installation"
		return 1
	return 0 
Example 12
Project: gprime   Author: GenealogyCollective   File: constfunc.py    (license) View Source Project 5 votes vote down vote up
def has_display():
    """
    Tests to see if Python is currently running with gtk
    """
    # FIXME: currently, Gtk.init_check() requires all strings
    # in argv, and we might have unicode.
    temp, sys.argv = sys.argv, sys.argv[:1]
    try:
        import gi
        gi.require_version('Gtk', '3.0')
        gi.require_version('Gdk', '3.0')
        from gi.repository import Gtk
        from gi.repository import Gdk
    except ImportError:
        return False

    try:
        test = Gtk.init_check(temp) and \
            Gdk.Display.get_default()
        sys.argv = temp
        return bool(test)
    except:
        sys.argv = temp
        return False

# A couple of places add menu accelerators using <alt>, which doesn't
# work with Gtk-quartz. <Meta> is the usually correct replacement, but
# in one case the key is a number, and <meta>number is used by Spaces
# (a mac feature), so we'll use control instead. 
Example 13
Project: rpi-backlight   Author: linusg   File: rpi_backlight.py    (license) View Source Project 5 votes vote down vote up
def gui():
    """Start the graphical user interface."""
    try:
        import gi
        gi.require_version("Gtk", "3.0")
        from gi.repository import Gtk
    except ImportError:
        print("Sorry, this needs pygobject to be installed!")
        sys.exit()

    win = Gtk.Window(title="Set display brightness")

    ad1 = Gtk.Adjustment(value=get_actual_brightness(), lower=11, upper=255)
    scale = Gtk.Scale(orientation=Gtk.Orientation.HORIZONTAL, adjustment=ad1)

    def on_scale_changed(s, _):
        value = int(s.get_value())
        set_brightness(value)

    scale.connect("button-release-event", on_scale_changed)
    scale.connect("key_release_event", on_scale_changed)
    scale.connect("scroll-event", on_scale_changed)
    scale.set_size_request(350, 50)

    # Main Container
    main_container = Gtk.Fixed()
    main_container.put(scale, 10, 10)

    # Main Window
    win.connect("delete-event", Gtk.main_quit)
    win.connect("destroy", Gtk.main_quit)
    win.add(main_container)
    win.resize(400, 50)
    win.set_position(Gtk.WindowPosition.CENTER)

    win.show_all()
    Gtk.main() 
Example 14
Project: driveboardapp   Author: nortd   File: test_gi.py    (license) View Source Project 5 votes vote down vote up
def test_gi_gst_binding(pyi_builder):
    pyi_builder.test_source('''
        import gi
        gi.require_version('Gst', '1.0')
        from gi.repository import Gst
        Gst.init(None)
        print(Gst)
    ''')


## For PyGObject >= 2.0

# Names of all "gi.repository" packages provided by PyGObject >= 2.0 to be
# tested below, typically corresponding to those packages hooked by PyInstaller. 
Example 15
Project: driveboardapp   Author: nortd   File: test_gi.py    (license) View Source Project 5 votes vote down vote up
def test_gi2_repository(pyi_builder, repository_name):
    '''
    Test the importability of the `gi.repository` subpackage with the passed
    name installed with PyGObject >= 2.0 (e.g., `GLib`, corresponding to the
    `gi.repository.GLib` subpackage).
    '''

    # Test the importability of this subpackage.
    pyi_builder.test_source('''
        import gi
        gi.require_version('{repository_name}', '2.0')
        from gi.repository import {repository_name}
        print({repository_name})
        '''.format(repository_name=repository_name)) 
Example 16
Project: driveboardapp   Author: nortd   File: gi.py    (license) View Source Project 5 votes vote down vote up
def get_glib_system_data_dirs():
    statement = """
        import gi
        gi.require_version('GLib', '2.0')
        from gi.repository import GLib
        print(GLib.get_system_data_dirs())
    """
    data_dirs = eval_statement(statement)
    if not data_dirs:
        logger.error("gi repository 'GIRepository 2.0' not found. "
                     "Please make sure libgirepository-gir2.0 resp. "
                     "lib64girepository-gir2.0 is installed.")
        # :todo: should we raise a SystemError here?
    return data_dirs 
Example 17
Project: MokaPlayer   Author: vedard   File: linux.py    (license) View Source Project 5 votes vote down vote up
def __init__(self, player):
        self.player = player
        self.logger = logging.getLogger('KeyboardClient')

        try:
            import gi
            gi.require_version('Keybinder', '3.0')
            from gi.repository import Keybinder
            Keybinder.init()
            Keybinder.bind('XF86AudioPlay', self._on_XF86AudioPlay)
            Keybinder.bind('XF86AudioNext', self._on_XF86AudioNext)
            Keybinder.bind('XF86AudioPrev', self._on_XF86AudioPrev)
        except ValueError:
            self.logger.warning('Keybinder is needed on Linux for MediaKey binding') 
Example 18
Project: SlackBuilds   Author: montagdude   File: setupext.py    (license) View Source Project 5 votes vote down vote up
def backend_gtk3cairo_internal_check(x):
    try:
        import cairocffi
    except ImportError:
        try:
            import cairo
        except ImportError:
            return (False, "Requires cairocffi or pycairo to be installed.")

    try:
        import gi
    except ImportError:
        return (False, "Requires pygobject to be installed.")

    try:
        gi.require_version("Gtk", "3.0")
    except ValueError:
        return (False, "Requires gtk3 development files to be installed.")
    except AttributeError:
        return (False, "pygobject version too old.")

    try:
        from gi.repository import Gtk, Gdk, GObject
    except (RuntimeError, ImportError):
        return (False, "Requires pygobject to be installed.")

    return (True, "version %s.%s.%s" % (
        Gtk.get_major_version(),
        Gtk.get_micro_version(),
        Gtk.get_minor_version())) 
Example 19
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n 
Example 20
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n 
Example 21
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n 
Example 22
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n 
Example 23
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n 
Example 24
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n 
Example 25
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n 
Example 26
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n 
Example 27
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n 
Example 28
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n 
Example 29
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n 
Example 30
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n 
Example 31
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n 
Example 32
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n 
Example 33
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n 
Example 34
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n 
Example 35
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n 
Example 36
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n 
Example 37
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n 
Example 38
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n 
Example 39
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n 
Example 40
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n 
Example 41
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n 
Example 42
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n 
Example 43
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n 
Example 44
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n 
Example 45
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n 
Example 46
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n 
Example 47
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n 
Example 48
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n 
Example 49
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n 
Example 50
Project: network   Author: linux-system-roles   File: network_connections.py    (license) View Source Project 5 votes vote down vote up
def NM(cls):
        n = getattr(cls, '_NM', None)
        if n is None:
            import gi
            gi.require_version('NM', '1.0')
            from gi.repository import NM, GLib, Gio, GObject
            cls._NM = NM
            cls._GLib = GLib
            cls._Gio = Gio
            cls._GObject = GObject
            n = NM
            import uuid
            cls._uuid = uuid
        return n