0

i've been trying to run a software where i've built the UI by Glade. Glade then transform the UI in an XML file, and then in Python i just load that file.

But i've a problem with (maybe) deprecated properties of gtk objects. This is what the interpreter says:

 Unknown property: GtkScrolledWindow.min-content-width
  self.__builder.add_from_file('UI2.glade')
/home/jimmy/Documenti/linguaggi_dinamici/progetto/collega_GUI.py:37: GtkWarning: Unknown property: GtkScrolledWindow.min-content-height
  self.__builder.add_from_file('UI2.glade')
/home/jimmy/Documenti/linguaggi_dinamici/progetto/collega_GUI.py:37: GtkWarning: Unknown property: GtkBox.margin-left
  self.__builder.add_from_file('UI2.glade')
/home/jimmy/Documenti/linguaggi_dinamici/progetto/collega_GUI.py:37: GtkWarning: Unknown property: GtkBox.margin-right
  self.__builder.add_from_file('UI2.glade')
/home/jimmy/Documenti/linguaggi_dinamici/progetto/collega_GUI.py:37: GtkWarning: Unknown property: GtkBox.margin-bottom
  self.__builder.add_from_file('UI2.glade')

(main.py:4490): GLib-GObject-ERROR **: cannot create instance of abstract (non-instantiatable) type 'GtkBox'
Trace/breakpoint trap (core dumped)

I could try to remove GtkBox.margin-left-right-bottom, but i need the property GtkScrolledWindow.min-content-height.

The strange thing is that GtkScrolledWindow.min-content-width has been working corretcly, because i can't see any WARNING about that.

EDIT :: informations about Gtk and Glade versions currently running

Glade: 3.14.2

collega_GUI.py

try:  
    import pygtk  
    pygtk.require("2.0")  
except:  
    pass  

try:  
    import gtk  
    import gtk.glade  
except:  
    print("GTK Not Availible")
    sys.exit(1)

I ran this command to retrieve the version of gtk:

dpkg -l libgtk[0-9]* | grep ^i

and i got

2.24.20-1ubuntu1
Community
  • 1
  • 1
FrancescoN
  • 2,146
  • 12
  • 34
  • 45
  • Are you using the latest version of glade? It looks like you are using a newer version of Gtk then what glade is generating the UI file for. – smani Feb 07 '14 at 11:46
  • When you create a ui file within glade, you are usually asked which version to target. Make sure you select 2.24.x (or close) and not 3.x or 1.x. – drahnr Feb 07 '14 at 12:27
  • I can't do it.. i can only save it as "libglade" file, "glade" file, or "GtkBuilder" file. But nothing happens, it doesn't work – FrancescoN Feb 07 '14 at 12:47
  • You select the target version in File->Properties. – smani Feb 07 '14 at 12:56
  • I can just run a button that search for deprecated components and widgets in the current file, and imagine.. it's all fine (f***k this shit) – FrancescoN Feb 07 '14 at 12:59
  • 1
    It is valid for the version of Gtk that glade is generating the ui for, it is just that you aren't using that version in the project which uses the ui. – smani Feb 07 '14 at 13:02
  • Anyway i can't set by myself the version of Gtk to use.. would i reinstall another version of Glade compatible with Gtk2.0? Glade 2.x.x? – FrancescoN Feb 07 '14 at 15:18

1 Answers1

0

The glade-3.8.x series is the last version supporting Gtk+2. glade > 3.8.x targets Gtk+3. Ubuntu provides the glade-gtk2 package which packages the 3.8.x version, whereas the glade package packages the latest, Gtk+3 only version.

So if you are targeting Gtk+2, you need to install glade-gtk2 and use that version of glade.

Note: similarly on Fedora, the glade package ships the Gtk+3 version, whereas the glade3 (not really an optimal name) ships the Gtk+2 version.

smani
  • 1,953
  • 17
  • 13
  • Ok good.. i've installed it, and now it crashes every time i'm going to load the file edited with the previous Glade (3.x.x). Endless torment. In a few minutes i'll try to search for a workaround, any tip is welcome. Thanks – FrancescoN Feb 07 '14 at 15:25
  • If you run glade from the terminal, you might see it the output it prints to the terminal what is causing it to crash. You could then open the glade file with a text editor and remove the offending elements/properties. The problem is most likely that the new glade wrote elements/properties to the file which glade 3.8.x cannot read, causing it to crash because of poor error handling. – smani Feb 07 '14 at 15:32
  • If i got something from the terminal.. but it just create a core dump (and i can't find it with **ls -a**) – FrancescoN Feb 07 '14 at 15:45
  • If you actually want to debug the crash, just run it through `gdb`. – smani Feb 07 '14 at 15:49
  • As i thought, i simply get a segmentation fault.. maybe instead of debugging a software (i tried to find exceptions.. but i think it will be hard to catch something helpful from this shit) i'll try to to do other loadings or something else – FrancescoN Feb 07 '14 at 16:04
  • Well the point of running it in a debugger is that when in crashes you can write `backtrace` and you know where it actually crashed. – smani Feb 07 '14 at 16:10
  • Ok, [look at this](http://pastebin.com/raw.php?i=zzWY9HJ1): i've been thinking to edit the file via editor, because they're all XML file; i would only cut off Gtk3 code – FrancescoN Feb 07 '14 at 16:19
  • Concerning the backtrace: install the `glade-gtk2-dbg` package and after that rerun in gdb and regenerate the backtrace to get a meaningful output. However, this is kind of OT here and we shouldn't be abusing the comments section for it. – smani Feb 07 '14 at 16:24
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/47037/discussion-between-jimmy5nomana-and-smani) – FrancescoN Feb 07 '14 at 16:44