From: Michael U. <mic...@so...> - 2015-11-03 07:23:00
Attachments:
signature.asc
|
Good morning, I try to understand GObject-Introspection to manipulate Gnumeric. Apart from the method-listings and an almost empty ri-output, I find no document dealing the topic. A working Python equivalent, which by use of the gi module writes 'hello world' into a table cell is impossible to reproduce in Ruby as the available documentation does not correspond, trial and error lead nowhere. Please point me at a more comprehensive overview. I see GI::Loader, Gio2, GObjectIntrospection::Loader but cannot bring them together with Gnumeric. In Python, using gi, a namespace 'gnm' is imported. If you want to help me with a direct hint, instead, just tell me how this is done in Ruby. I am not against finding a way on my own, but currently, there is only big mist. Thank you. -- ATTN! New Key! GnuPG brainpoolP512r1/5C2A258D 2015-10-02 [expires: 2017-10-01] Michael Uplawski <mic...@up...> fingerprint: 2A44 09D4 54B4 EBD2 90DA 0B2D E8B8 0614 5C2A 258D sub brainpoolP512r1/53461AFA 2015-10-02 [expires: 2017-10-01] |
From: cedlemo <ce...@gm...> - 2015-11-03 09:04:40
|
Hi Michael, I am not really an advanced contributor but Kouhei Sutou (which is the maintainer of ruby-gnome2) is busy at the moment so I will try to give you some hints. There is not yet a good documentation. The best informations that you could find I think should be in the unit tests : https://github.com/ruby-gnome2/ruby-gnome2/blob/master/gobject-introspection/test/ Have a look at the vte3 module which is really simple and follow the most common way to use GObjectIntrospection. https://github.com/ruby-gnome2/ruby-gnome2/tree/master/vte3 and especially this file https://github.com/ruby-gnome2/ruby-gnome2/blob/master/vte3/lib/vte3.rb cedlemo https://github.com/cedlemo On 03/11/2015 07:46, Michael Uplawski wrote: > Good morning, > > I try to understand GObject-Introspection to manipulate Gnumeric. > Apart from the method-listings and an almost empty ri-output, I find no > document dealing the topic. > > A working Python equivalent, which by use of the gi module writes > 'hello world' into a table cell is impossible to reproduce in Ruby as > the available documentation does not correspond, trial and error lead > nowhere. > > Please point me at a more comprehensive overview. I see GI::Loader, > Gio2, GObjectIntrospection::Loader but cannot bring them together with > Gnumeric. In Python, using gi, a namespace 'gnm' is imported. If you > want to help me with a direct hint, instead, just tell me how this is > done in Ruby. I am not against finding a way on my own, but currently, > there is only big mist. > > Thank you. > > > > ------------------------------------------------------------------------------ > > > _______________________________________________ > ruby-gnome2-devel-en mailing list > rub...@li... > https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en > |
From: <jc...@gm...> - 2015-11-03 09:34:41
|
On 3 November 2015 at 09:04, cedlemo <ce...@gm...> wrote: > On 03/11/2015 07:46, Michael Uplawski wrote: >> I try to understand GObject-Introspection to manipulate Gnumeric. >> Apart from the method-listings and an almost empty ri-output, I find no >> document dealing the topic. >> >> A working Python equivalent, which by use of the gi module writes >> 'hello world' into a table cell is impossible to reproduce in Ruby as >> the available documentation does not correspond, trial and error lead >> nowhere. Hi, like cedlemo I'm not much of an expert, but I have made a binding for my own gobject-based library here: https://github.com/jcupitt/ruby-vips8 I used the binding for gst as a model, it's pretty simple to understand: https://github.com/ruby-gnome2/ruby-gnome2/blob/master/gstreamer/lib/gst.rb Just copy-paste that and change the names to refer to the gnumeric objects instead and it should work. The gst binding does some extra renaming and overriding to make the interface pleasant to use, you probably won't need that, at least to start with. John |
From: Michael U. <mic...@up...> - 2015-11-03 10:49:13
Attachments:
signature.asc
|
Howdy. I have been a bit worried to put my question on the list, but your responses keep me interested in GObject-Introspection. On Tue, Nov 03, 2015 at 09:33:54AM +0000, jc...@gm... wrote: > Hi, like cedlemo I'm not much of an expert, but I have made a binding > for my own gobject-based library here: > > https://github.com/jcupitt/ruby-vips8 > > I used the binding for gst as a model, it's pretty simple to understand: > > https://github.com/ruby-gnome2/ruby-gnome2/blob/master/gstreamer/lib/gst.rb You subclass a Loader and I have the immediate feeling, that this must be crucial for all that follows. I do not have to understand all the meta-programming which is anyway out of my reach to see clearer now. Thank you very much. Michael > > Just copy-paste that and change the names to refer to the gnumeric > objects instead and it should work. > > The gst binding does some extra renaming and overriding to make the > interface pleasant to use, you probably won't need that, at least to > start with. > > John > > ------------------------------------------------------------------------------ > _______________________________________________ > ruby-gnome2-devel-en mailing list > rub...@li... > https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en -- ATTN! New Key! GnuPG brainpoolP512r1/5C2A258D 2015-10-02 [expires: 2017-10-01] Michael Uplawski <mic...@up...> fingerprint: 2A44 09D4 54B4 EBD2 90DA 0B2D E8B8 0614 5C2A 258D sub brainpoolP512r1/53461AFA 2015-10-02 [expires: 2017-10-01] |
From: cedlemo <ce...@gm...> - 2015-11-03 11:05:53
|
I think that the example I gave you is more simple and better to start with: https://github.com/ruby-gnome2/ruby-gnome2/blob/master/vte3/lib/vte3.rb Just change the Vte name with Gnumeric: require "gobject-introspection" require "gtk3" base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path vendor_dir = base_dir + "vendor" + "local" vendor_bin_dir = vendor_dir + "bin" GLib.prepend_dll_path(vendor_bin_dir) vendor_girepository_dir = vendor_dir + "lib" + "girepository-1.0" GObjectIntrospection.prepend_typelib_path(vendor_girepository_dir) # You don't nedd this #require "vte3/loader" module Vte LOG_DOMAIN = "Vte" GLib::Log.set_log_domain(LOG_DOMAIN) class Error < StandardError end class << self def const_missing(name) init if const_defined?(name) const_get(name) else super end end def init class << self remove_method(:init) remove_method(:const_missing) end Gtk.init if Gtk.respond_to?(:init) loader = Loader.new(self) loader.load("Vte") end end end This is the most basic example. Regards. On 03/11/2015 11:10, Michael Uplawski wrote: > Howdy. > > I have been a bit worried to put my question on the list, but your > responses keep me interested in GObject-Introspection. > > On Tue, Nov 03, 2015 at 09:33:54AM +0000, jc...@gm... wrote: > >> Hi, like cedlemo I'm not much of an expert, but I have made a binding >> for my own gobject-based library here: >> >> https://github.com/jcupitt/ruby-vips8 >> >> I used the binding for gst as a model, it's pretty simple to understand: >> >> https://github.com/ruby-gnome2/ruby-gnome2/blob/master/gstreamer/lib/gst.rb > You subclass a Loader and I have the immediate feeling, that this must > be crucial for all that follows. I do not have to understand all the > meta-programming which is anyway out of my reach to see clearer now. > > Thank you very much. > > Michael > >> Just copy-paste that and change the names to refer to the gnumeric >> objects instead and it should work. >> >> The gst binding does some extra renaming and overriding to make the >> interface pleasant to use, you probably won't need that, at least to >> start with. >> >> John >> >> ------------------------------------------------------------------------------ >> _______________________________________________ >> ruby-gnome2-devel-en mailing list >> rub...@li... >> https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en > > > ------------------------------------------------------------------------------ > > > _______________________________________________ > ruby-gnome2-devel-en mailing list > rub...@li... > https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en |
From: Michael U. <mic...@up...> - 2015-11-03 14:39:04
Attachments:
signature.asc
|
Hi again, With the example below, I get a name error, having replaced Vte against Gnm or Gnumeric.: “in `init': uninitialized constant Module::Loader (NameError)” If I use GObjectIntrospection::Loader.new(self), the error reads. ----------------- /var/lib/gems/2.1.0/gems/gobject-introspection-3.0.7/lib/gobject-introspection/loader.rb:167:in `const_set': wrong constant name 3D_NAME (NameError) from /var/lib/gems/2.1.0/gems/gobject-introspection-3.0.7/lib/gobject-introspection/loader.rb:167:in `load_enum_value' (...) ---------------- On Tue, Nov 03, 2015 at 12:05:44PM +0100, cedlemo wrote: > I think that the example I gave you is more simple and better to start with: > > https://github.com/ruby-gnome2/ruby-gnome2/blob/master/vte3/lib/vte3.rb > > Just change the Vte name with Gnumeric: > > require "gobject-introspection" > require "gtk3" > > base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path > vendor_dir = base_dir + "vendor" + "local" > vendor_bin_dir = vendor_dir + "bin" > GLib.prepend_dll_path(vendor_bin_dir) > vendor_girepository_dir = vendor_dir + "lib" + "girepository-1.0" > GObjectIntrospection.prepend_typelib_path(vendor_girepository_dir) > > # You don't nedd this > #require "vte3/loader" > > module Vte > LOG_DOMAIN = "Vte" > GLib::Log.set_log_domain(LOG_DOMAIN) > > class Error < StandardError > end > > class << self > def const_missing(name) > init > if const_defined?(name) > const_get(name) > else > super > end > end > > def init > class << self > remove_method(:init) > remove_method(:const_missing) > end > Gtk.init if Gtk.respond_to?(:init) > loader = Loader.new(self) > loader.load("Vte") > end > end > end > > > This is the most basic example. > > Regards. > > On 03/11/2015 11:10, Michael Uplawski wrote: > > Howdy. > > > > I have been a bit worried to put my question on the list, but your > > responses keep me interested in GObject-Introspection. > > > > On Tue, Nov 03, 2015 at 09:33:54AM +0000, jc...@gm... wrote: > > > >> Hi, like cedlemo I'm not much of an expert, but I have made a binding > >> for my own gobject-based library here: > >> > >> https://github.com/jcupitt/ruby-vips8 > >> > >> I used the binding for gst as a model, it's pretty simple to understand: > >> > >> https://github.com/ruby-gnome2/ruby-gnome2/blob/master/gstreamer/lib/gst.rb > > You subclass a Loader and I have the immediate feeling, that this must > > be crucial for all that follows. I do not have to understand all the > > meta-programming which is anyway out of my reach to see clearer now. > > > > Thank you very much. > > > > Michael > > > >> Just copy-paste that and change the names to refer to the gnumeric > >> objects instead and it should work. > >> > >> The gst binding does some extra renaming and overriding to make the > >> interface pleasant to use, you probably won't need that, at least to > >> start with. > >> > >> John > >> > >> ------------------------------------------------------------------------------ > >> _______________________________________________ > >> ruby-gnome2-devel-en mailing list > >> rub...@li... > >> https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en > > > > > > ------------------------------------------------------------------------------ > > > > > > _______________________________________________ > > ruby-gnome2-devel-en mailing list > > rub...@li... > > https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en > > > ------------------------------------------------------------------------------ > _______________________________________________ > ruby-gnome2-devel-en mailing list > rub...@li... > https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en -- ATTN! New Key! GnuPG brainpoolP512r1/5C2A258D 2015-10-02 [expires: 2017-10-01] Michael Uplawski <mic...@up...> fingerprint: 2A44 09D4 54B4 EBD2 90DA 0B2D E8B8 0614 5C2A 258D sub brainpoolP512r1/53461AFA 2015-10-02 [expires: 2017-10-01] |
From: cedlemo <ce...@gm...> - 2015-11-03 15:38:55
|
I have looked at /usr/share/gir-1.0/Gnm-1.12.gir and it seems that there are some dependencies that are not already done: Goffice Gsf On 03/11/2015 14:19, Michael Uplawski wrote: > Hi again, > > With the example below, I get a name error, having replaced Vte against > Gnm or Gnumeric.: > “in `init': uninitialized constant Module::Loader (NameError)” > > If I use GObjectIntrospection::Loader.new(self), the error reads. > ----------------- > /var/lib/gems/2.1.0/gems/gobject-introspection-3.0.7/lib/gobject-introspection/loader.rb:167:in > `const_set': wrong constant name 3D_NAME (NameError) > from > /var/lib/gems/2.1.0/gems/gobject-introspection-3.0.7/lib/gobject-introspection/loader.rb:167:in > `load_enum_value' > (...) > ---------------- > > On Tue, Nov 03, 2015 at 12:05:44PM +0100, cedlemo wrote: >> I think that the example I gave you is more simple and better to start with: >> >> https://github.com/ruby-gnome2/ruby-gnome2/blob/master/vte3/lib/vte3.rb >> >> Just change the Vte name with Gnumeric: >> >> require "gobject-introspection" >> require "gtk3" >> >> base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path >> vendor_dir = base_dir + "vendor" + "local" >> vendor_bin_dir = vendor_dir + "bin" >> GLib.prepend_dll_path(vendor_bin_dir) >> vendor_girepository_dir = vendor_dir + "lib" + "girepository-1.0" >> GObjectIntrospection.prepend_typelib_path(vendor_girepository_dir) >> >> # You don't nedd this >> #require "vte3/loader" >> >> module Vte >> LOG_DOMAIN = "Vte" >> GLib::Log.set_log_domain(LOG_DOMAIN) >> >> class Error < StandardError >> end >> >> class << self >> def const_missing(name) >> init >> if const_defined?(name) >> const_get(name) >> else >> super >> end >> end >> >> def init >> class << self >> remove_method(:init) >> remove_method(:const_missing) >> end >> Gtk.init if Gtk.respond_to?(:init) >> loader = Loader.new(self) >> loader.load("Vte") >> end >> end >> end >> >> >> This is the most basic example. >> >> Regards. >> >> On 03/11/2015 11:10, Michael Uplawski wrote: >>> Howdy. >>> >>> I have been a bit worried to put my question on the list, but your >>> responses keep me interested in GObject-Introspection. >>> >>> On Tue, Nov 03, 2015 at 09:33:54AM +0000, jc...@gm... wrote: >>> >>>> Hi, like cedlemo I'm not much of an expert, but I have made a binding >>>> for my own gobject-based library here: >>>> >>>> https://github.com/jcupitt/ruby-vips8 >>>> >>>> I used the binding for gst as a model, it's pretty simple to understand: >>>> >>>> https://github.com/ruby-gnome2/ruby-gnome2/blob/master/gstreamer/lib/gst.rb >>> You subclass a Loader and I have the immediate feeling, that this must >>> be crucial for all that follows. I do not have to understand all the >>> meta-programming which is anyway out of my reach to see clearer now. >>> >>> Thank you very much. >>> >>> Michael >>> >>>> Just copy-paste that and change the names to refer to the gnumeric >>>> objects instead and it should work. >>>> >>>> The gst binding does some extra renaming and overriding to make the >>>> interface pleasant to use, you probably won't need that, at least to >>>> start with. >>>> >>>> John >>>> >>>> ------------------------------------------------------------------------------ >>>> _______________________________________________ >>>> ruby-gnome2-devel-en mailing list >>>> rub...@li... >>>> https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en >>> >>> ------------------------------------------------------------------------------ >>> >>> >>> _______________________________________________ >>> ruby-gnome2-devel-en mailing list >>> rub...@li... >>> https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en >> >> ------------------------------------------------------------------------------ >> _______________________________________________ >> ruby-gnome2-devel-en mailing list >> rub...@li... >> https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en > > > ------------------------------------------------------------------------------ > > > _______________________________________________ > ruby-gnome2-devel-en mailing list > rub...@li... > https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en |