Glade file erzeugt fehler Gtk-CRITICAL

Programmierung für GNOME und GTK+, GUI-Erstellung mit Glade.
Antworten
sedi
User
Beiträge: 101
Registriert: Sonntag 9. Dezember 2007, 19:22

Donnerstag 19. Mai 2016, 16:04

Hallo zusammen...

Beim Einlesen des Gladefiles kommt ständig dieser Fehler:
(gladewindow.py:14861): Gtk-CRITICAL **: gtk_menu_item_set_accel_path: assertion 'accel_path == NULL || (accel_path[0] == '<' && strchr (accel_path, '/'))' failed
Ohne jede Spur von Erfolg versuche ich bereits seit mehreren Stunden diesen Fehler zu beheben :cry:

Hier das Gladefile (erstellt mit Glade 3.18):

Code: Alles auswählen

<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
  <requires lib="gtk+" version="3.12"/>
  <object class="GtkWindow" id="window1">
    <property name="can_focus">False</property>
    <child>
      <object class="GtkBox" id="box1">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="orientation">vertical</property>
        <child>
          <object class="GtkMenuBar" id="menubar1">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <child>
              <object class="GtkMenuItem" id="System">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">S_ystem</property>
                <property name="use_underline">True</property>
                <child type="submenu">
                  <object class="GtkMenu" id="mnu_system">
                    <property name="visible">True</property>
                    <property name="can_focus">False</property>
                    <child>
                      <object class="GtkSeparatorMenuItem" id="separatormenuitem1">
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                      </object>
                    </child>
                    <child>
                      <object class="GtkImageMenuItem" id="mnuitem_i_close">
                        <property name="label">gtk-quit</property>
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <property name="accel_path">CTL+W</property>
                        <property name="use_underline">True</property>
                        <property name="use_stock">True</property>
                        <property name="always_show_image">True</property>
                      </object>
                    </child>
                  </object>
                </child>
              </object>
            </child>
            <child>
              <object class="GtkMenuItem" id="Teilnehmer">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">_Teilnehmer</property>
                <property name="use_underline">True</property>
                <child type="submenu">
                  <object class="GtkMenu" id="mnu_teilnehmer">
                    <property name="visible">True</property>
                    <property name="can_focus">False</property>
                    <child>
                      <object class="GtkMenuItem" id="menuitem1">
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <property name="tooltip_text" translatable="yes">Listet alle Kurse auf</property>
                        <property name="label" translatable="yes">Kurse</property>
                        <property name="use_underline">True</property>
                      </object>
                    </child>
                    <child>
                      <object class="GtkMenuItem" id="menuitem2">
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <property name="label" translatable="yes">Übersicht</property>
                        <property name="use_underline">True</property>
                      </object>
                    </child>
                  </object>
                </child>
              </object>
            </child>
            <child>
              <object class="GtkMenuItem" id="Hilfe">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">_Hilfe</property>
                <property name="use_underline">True</property>
                <child type="submenu">
                  <object class="GtkMenu" id="mnu_hilfe">
                    <property name="visible">True</property>
                    <property name="can_focus">False</property>
                    <child>
                      <object class="GtkImageMenuItem" id="imagemenuitem10">
                        <property name="label">gtk-about</property>
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <property name="use_underline">True</property>
                        <property name="use_stock">True</property>
                      </object>
                    </child>
                  </object>
                </child>
              </object>
            </child>
          </object>
          <packing>
            <property name="expand">False</property>
            <property name="fill">True</property>
            <property name="position">0</property>
          </packing>
        </child>
        <child>
          <placeholder/>
        </child>
        <child>
          <object class="GtkBox" id="statusbar">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <child>
              <object class="GtkStatusbar" id="statusbar1">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="margin_left">10</property>
                <property name="margin_right">10</property>
                <property name="margin_start">10</property>
                <property name="margin_end">10</property>
                <property name="margin_top">6</property>
                <property name="margin_bottom">6</property>
                <property name="orientation">vertical</property>
                <property name="spacing">2</property>
              </object>
              <packing>
                <property name="expand">False</property>
                <property name="fill">True</property>
                <property name="position">0</property>
              </packing>
            </child>
          </object>
          <packing>
            <property name="expand">False</property>
            <property name="fill">True</property>
            <property name="position">2</property>
          </packing>
        </child>
      </object>
    </child>
  </object>
</interface>
Und hier der Testcode:

Code: Alles auswählen

#!/usr/bin/env python3
# -*- coding: utf-8 -*-


import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gio, Gtk, Gdk


builder = Gtk.Builder()
builder.add_from_file("appview.glade")

window = builder.get_object("window1")
window.show_all()
Hoffe ihr habt einen guten Rat
CU sedi
----------------------------------------------------------
Python 3.4
openSUSE 13.2
BlackJack

Donnerstag 19. Mai 2016, 17:30

@sedi: Wenn ich mir die Bedingungen an `accel_path` in der Ausgabe anschaue, dann sind die mindestens von dem ersten Wert, den ich dafür in der XML gefunden habe, nicht erfüllt.
sedi
User
Beiträge: 101
Registriert: Sonntag 9. Dezember 2007, 19:22

Donnerstag 19. Mai 2016, 18:17

Äh sorry, das habe ich vergessen:
Alle Variationen rund um die Zeile
<property name="accel_path">CTL+W</property>
haben ebenfalls nicht funktioniert:
a) entferne ich die Zeile komplett, so geht das Fenster kurz auf und verschwindet dann wieder
b) Rahme ich
CTL+W
ein
<CTL+W>
dann tritt das gleiche wie in a) auf

Ausgangspunkt für mein kleines Vorhaben in PyGObject und Glade war übrigens http://python-gtk-3-tutorial.readthedoc ... ilder.html - falls das irgendwas bringt.
CU sedi
----------------------------------------------------------
Python 3.4
openSUSE 13.2
sedi
User
Beiträge: 101
Registriert: Sonntag 9. Dezember 2007, 19:22

Donnerstag 19. Mai 2016, 18:24

Hab meinen - dummen - Fehler selbst gefunden: Habe das

Code: Alles auswählen

Gtk.main()
vergessen - sh...... :oops:
CU sedi
----------------------------------------------------------
Python 3.4
openSUSE 13.2
aleb
User
Beiträge: 1
Registriert: Montag 6. Juni 2016, 12:50

Montag 6. Juni 2016, 12:57

http://lazka.github.io/pgi-docs/#Gtk-3. ... k.AccelMap
The accelerator path must consist of “<WINDOWTYPE>/Category1/Category2/.../Action”, where WINDOWTYPE should be a unique application-specific identifier that corresponds to the kind of window the accelerator is being used in, e.g. “Gimp-Image”, “Abiword-Document” or “Gnumeric-Settings”. The “Category1/.../Action” portion is most appropriately chosen by the action the accelerator triggers, i.e. for accelerators on menu items, choose the item’s menu path, e.g. “File/Save As”, “Image/View/Zoom” or “Edit/Select All”. So a full valid accelerator path may look like: “<Gimp-Toolbox>/File/Dialogs/Tool Options...”.
Antworten