gobject

Initialize a GObject with parameters which are not GObject properties?

孤人 提交于 2020-01-13 13:11:30
问题 I have a GObject "A" which creates an instance of another GObject "B" in its constructor. The "B" object needs to be passed several construction-only properties. Now when creating an instance of object "A" I want to allow passing values for these properties through the constructor of object "A" on to the constructor of object "B". The only way I have found to do that was to create identical properties for object "A" and pass their values on to the constructor of "B". These properties would

unpacking GVariant in javascript

我怕爱的太早我们不能终老 提交于 2020-01-06 08:16:17
问题 I have an array stored as a GVariant of type a(ss) in GSettings, that I want to use in a Cinnamon Applet. I can retrieve the value successfully using the following code: let schema = schema_source.lookup(SCHEMA_NAME, false); let settings = new Gio.Settings({ settings_schema: schema }); let my_value = settings.get_value('myvalue'); but I can't unpack it. As far as I can see, I will probably need to unpack it using a GVariantIter structure, but the documentation is limited, and I can't find the

GObject.add_emission_hook usage

怎甘沉沦 提交于 2020-01-06 06:56:20
问题 I was kindly directed to use GObject's "add_emission_hook" following a recent question on SO but I can't seem to find a usage example. Does anyone have one to share, please? 回答1: After a discussion with helpful folks on IRC #pygtk, here is what I came up with: import gobject class Signals(gobject.GObject): __gsignals__ = { "lastfm_username_changed": (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (gobject.TYPE_STRING,)) #@UndefinedVariable } def __init__(self): gobject.GObject.__init__(self)

interfacing gobject with C++

僤鯓⒐⒋嵵緔 提交于 2019-12-31 06:58:47
问题 I’m trying to create a custom audio sink plugin for gstreamer using the Gst::AudioSink as a base class. For me this involves multiple learning curves as I’m new to gstreamer, gstreamermm and gobject. Also I have no background or real interest in gtkmm as I’m not working on GUI code at present. I am trying to create a class along the lines of: class MyAudioSink: public Gst::AudioSink { public: explicit MyAudioSink(KantarAudioSink *gobj); virtual ~MyAudioSink(); static void class_init(Gst:

GObject.idle_add(), thread.join() and my program hangs

余生长醉 提交于 2019-12-25 00:05:24
问题 I've a problem: my main thread should start and join a thread that has a to run about 10-15 seconds. So: my main thread starts a child thread , whom has to run about 10-15 seconds my main thread joins the child thread : the main thread needs the result of the child thread in the meanwhile the child thread runs, i've to update the GUI , it is just a progressbar (possibly every 0.2 second) updating the GUI: i'll use a recursive function the child thread finishes and the main thread gets the

GObject Introspection across multiple languages

痴心易碎 提交于 2019-12-24 16:27:09
问题 The Wiki page of the old PyGTK 2.8 binding states that an object properly written in Python should also be easily usable from C code, or even other language bindings. But PyGTK is outdated and should be replaced by PyGObject. Is it possible to mix and match languages with the newer introspection-based binding, too? For example, can I write a gobject class in Vala, extend it with Python and use the result in Java? 回答1: I've written a C based plugin library that does essentially this. It does

How to stop a dbus gobject loop

社会主义新天地 提交于 2019-12-23 19:38:07
问题 I try to stop a gobject.MainLoop() after a few seconds. I don't know if it's possible to set a timeout to this kind of loop, it would be perfect but I have not found that. So, I tried to workaround this with threading but unfortunately, the main loop block others threads. Here my code (I'm working with python 2.7): import MediaCenter_dbusConfig import dbus import gobject from dbus.mainloop.glib import DBusGMainLoop from time import sleep from threading import Thread mainloop=0 class Timeout

Using Cairo Regions in python with gi.repository

こ雲淡風輕ζ 提交于 2019-12-23 10:07:37
问题 I can't seem to get cairo regions working in within using the gintrospection. For example from gi.repository import cairo reg = cairo.Region() will give me Traceback (most recent call last): File "<stdin>", line 1, in <module> MemoryError and trying to get a region from Gdk.get_clip_region() will give me return info.invoke(*args) TypeError: Couldn't find conversion for foreign struct 'cairo.Region' What obvious thing am I missing? I can't find a way to iniatilize the library, and can't

Is there a good way to copy a Gtk widget?

只谈情不闲聊 提交于 2019-12-23 08:03:21
问题 Is there a way, using the Gtk library in C, to clone a Gtk button (for instance), and pack it somewhere else in the app. I know you can't pack the same widget twice. And that this code obviously wouldn't work, but shows what happens when I attempt a shallow copy of the button: GtkButton *a = g_object_new(GTK_TYPE_BUTTON, "label", "o_0", NULL); GtkButton *b = g_memdup(a, sizeof *a); gtk_box_pack_start_defaults(GTK_BOX(vbox), GTK_WIDGET(b)); There is surrounding code which creates a vbox and

GOBJECT : unresolved externals symbol ___chkstk_ms

隐身守侯 提交于 2019-12-13 09:14:00
问题 On compiling GOBJECT in Visual Studio, I came across below two errors: Error 5 error LNK1120: 1 unresolved externals C:\gtk_compilation\glib\glib-2.46.0\build\win32\vs12\Debug\Win32\bin\gobject-2-vs12.dll gobject Error 4 error LNK2019: unresolved external symbol ___chkstk_ms referenced in function _ffi_call C:\gtk_compilation\glib\glib-2.46.0\build\win32\vs12\libffi.lib(ffi.o) gobject I recompiled the libffi using the procedure described here but with extra flags given to ./configure like