Пример #1
0
 def finish(self, success, del_, time):
     Gtk = get_introspection_module('Gtk')
     Gtk.drag_finish(self, success, del_, time)
Пример #2
0
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
# USA

import signal
import warnings
import sys

from pgi.gerror import PGError as GError
from pgi.overrides import get_introspection_module, override, deprecated
from pgi.util import PyGIDeprecationWarning
from pgi import version_info

GLib = get_introspection_module('GLib')

__all__ = []

#~ from gi import _option as option
#~ option  # pyflakes
#~ __all__.append('option')
#~
#~
#~ # Types and functions still needed from static bindings
#~ from gi._gi import _glib
#~ from gi._error import GError
#~
#~ Error = GError
#~ OptionContext = _glib.OptionContext
#~ OptionGroup = _glib.OptionGroup
Пример #3
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
# USA

import sys
import warnings

from pgi.overrides import override, get_introspection_module, \
    strip_boolean_result
from pgi.util import PyGIDeprecationWarning

Gdk = get_introspection_module('Gdk')

__all__ = []


class Color(Gdk.Color):
    MAX_VALUE = 65535

    def __init__(self, red, green, blue):
        Gdk.Color.__init__(self)
        self.red = red
        self.green = green
        self.blue = blue

    def __eq__(self, other):
        return self.equal(other)
Пример #4
0
# USA

import sys
import warnings
from collections import namedtuple

import pgi
from pgi.overrides import get_introspection_module, override, deprecated_attr
from pgi.repository import GLib
from pgi import propertyhelper
from pgi import signalhelper
from pgi import static as _gobject
from pgi.util import PyGIDeprecationWarning


GObjectModule = get_introspection_module('GObject')
__all__ = []


_gobject.GObject = GObjectModule.Object
_gobject.TYPE_INVALID = GObjectModule.type_from_name('invalid')
Object = GObjectModule.Object


# API aliases for backwards compatibility
for name in ['markup_escape_text', 'get_application_name',
             'set_application_name', 'get_prgname', 'set_prgname',
             'main_depth', 'filename_display_basename',
             'filename_display_name', 'filename_from_utf8',
             'uri_list_extract_uris',
             'MainLoop', 'MainContext', 'main_context_default',
Пример #5
0
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
# USA

from pgi.overrides import override, get_introspection_module


Pango = get_introspection_module('Pango')

__all__ = []


class Context(Pango.Context):

    def get_metrics(self, desc, language=None):
        return super(Context, self).get_metrics(desc, language)

Context = override(Context)
__all__.append('Context')


class FontDescription(Pango.FontDescription):
Пример #6
0
Файл: Gio.py Проект: pwaller/pgi
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
# USA

import sys

from pgi.overrides import override, get_introspection_module
from pgi.repository import GLib


Gio = get_introspection_module('Gio')

__all__ = []


class FileEnumerator(Gio.FileEnumerator):
    def __iter__(self):
        return self

    def __next__(self):
        file_info = self.next_file(None)

        if file_info is not None:
            return file_info
        else:
            raise StopIteration
Пример #7
0
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
# USA

from pgi.overrides import override, get_introspection_module

Pango = get_introspection_module('Pango')

__all__ = []


class FontDescription(Pango.FontDescription):
    def __new__(cls, string=None):
        if string is not None:
            return Pango.font_description_from_string(string)
        else:
            return Pango.FontDescription.__new__(cls)

    def __init__(self, *args, **kwargs):
        return super(FontDescription, self).__init__()

Пример #8
0
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, see <http://www.gnu.org/licenses/>.

import sys
import warnings

from pgi.overrides import get_introspection_module


Gdk = get_introspection_module('Gdk')

warnings.warn('keysyms has been deprecated. Please use Gdk.KEY_<name> instead.',
              RuntimeWarning)

_modname = globals()['__name__']
_keysyms = sys.modules[_modname]

for name in dir(Gdk):
    if name.startswith('KEY_'):
        target = name[4:]
        if target[0] in '0123456789':
            target = '_' + target
        value = getattr(Gdk, name)
        setattr(_keysyms, target, value)
Пример #9
0
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
# USA

from pgi.overrides import override, get_introspection_module, deprecated_init
from pgi.repository import GLib

import sys

Gio = get_introspection_module('Gio')

__all__ = []


class FileEnumerator(Gio.FileEnumerator):
    def __iter__(self):
        return self

    def __next__(self):
        file_info = self.next_file(None)

        if file_info is not None:
            return file_info
        else:
            raise StopIteration
Пример #10
0
from ctypes import (
    Structure, POINTER,
    byref, c_bool, c_double, c_uint, c_void_p)

from pgi.codegen.ctypes_backend import CTypesBackend
from pgi.overrides import override, get_introspection_module

Poppler = get_introspection_module('Poppler')

backend = CTypesBackend()
lib = backend.get_library("Poppler")

g_free = lib.g_free

poppler_page_get_text_layout = lib.poppler_page_get_text_layout
poppler_page_get_text_layout.argtypes = [
    c_void_p, POINTER(c_void_p), POINTER(c_uint)]
poppler_page_get_text_layout.restype = c_bool

Rectangle = Poppler.Rectangle

__all__ = []

from pgi.finalizer import _BaseFinalizer


class _FreeFinalizer(_BaseFinalizer):
    def destructor(self, deadweakproxy, ptr):
        g_free(ptr)

Пример #11
0
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
# USA

import sys
import warnings
import ctypes

from pgi import PyGIDeprecationWarning
from pgi.overrides import get_introspection_module, override
from pgi.repository import GLib
from pgi.properties import list_properties


GObjectModule = get_introspection_module("GObject")
__all__ = []


G_MININT8 = GLib.MININT8
G_MAXINT8 = GLib.MAXINT8
G_MAXUINT8 = GLib.MAXUINT8
G_MININT16 = GLib.MININT16
G_MAXINT16 = GLib.MAXINT16
G_MAXUINT16 = GLib.MAXUINT16
G_MININT32 = GLib.MININT32
G_MAXINT32 = GLib.MAXINT32
G_MAXUINT32 = GLib.MAXUINT32
G_MININT64 = GLib.MININT64
G_MAXINT64 = GLib.MAXINT64
G_MAXUINT64 = GLib.MAXUINT64
Пример #12
0
 def finish(self, success, del_, time):
     Gtk = get_introspection_module('Gtk')
     Gtk.drag_finish(self, success, del_, time)
Пример #13
0
Файл: Gdk.py Проект: pwaller/pgi
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
# USA

from pgi.overrides import override, get_introspection_module

import sys

Gdk = get_introspection_module("Gdk")

__all__ = []


class Color(Gdk.Color):
    MAX_VALUE = 65535

    def __init__(self, red, green, blue):
        Gdk.Color.__init__(self)
        self.red = red
        self.green = green
        self.blue = blue

    def __new__(cls, *args, **kwargs):
        return Gdk.Color.__new__(cls)
Пример #14
0
from ctypes import (Structure, POINTER, byref, c_bool, c_double, c_uint,
                    c_void_p)

from pgi.codegen.ctypes_backend import CTypesBackend
from pgi.overrides import override, get_introspection_module

Poppler = get_introspection_module('Poppler')

backend = CTypesBackend()
lib = backend.get_library("Poppler")

g_free = lib.g_free

poppler_page_get_text_layout = lib.poppler_page_get_text_layout
poppler_page_get_text_layout.argtypes = [
    c_void_p, POINTER(c_void_p), POINTER(c_uint)
]
poppler_page_get_text_layout.restype = c_bool

Rectangle = Poppler.Rectangle

__all__ = []

from pgi.finalizer import _BaseFinalizer


class _FreeFinalizer(_BaseFinalizer):
    def destructor(self, deadweakproxy, ptr):
        g_free(ptr)