Can't edit menu or item properties in Alacarte

After the GNOME 3.8 update, Alacarte wasn’t launching so I downloaded the rpm package for Alacarte 3.7.90 from the Factory repo. This version seems to fix the previous issue, however, I can’t edit menus or items. Pressing on the “properties” button doesn’t do anything. Here’s the terminal output:

(alacarte:9406): Gtk-CRITICAL **: gtk_accel_label_set_accel_closure: assertion `gtk_accel_group_from_accel_closure (accel_closure) != NULL' failed

(alacarte:9406): Gtk-CRITICAL **: gtk_accel_label_set_accel_closure: assertion `gtk_accel_group_from_accel_closure (accel_closure) != NULL' failed
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/Alacarte/MainWindow.py", line 363, in on_item_tree_row_activated
    self.on_edit_properties_activate(None)
  File "/usr/lib/python2.7/site-packages/Alacarte/MainWindow.py", line 307, in on_edit_properties_activate
    editor = Editor(self.main_window, file_path)
AttributeError: 'MainWindow' object has no attribute 'main_window'
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/Alacarte/MainWindow.py", line 429, in on_properties_button_clicked
    self.on_edit_properties_activate(None)
  File "/usr/lib/python2.7/site-packages/Alacarte/MainWindow.py", line 307, in on_edit_properties_activate
    editor = Editor(self.main_window, file_path)
AttributeError: 'MainWindow' object has no attribute 'main_window'


On Wed 17 Apr 2013 09:56:03 PM CDT, Vagrant232 wrote:

After the GNOME 3.8 update, Alacarte wasn’t launching so I downloaded
the rpm package for Alacarte 3.7.90 from the Factory repo. This version
seems to fix the previous issue, however, I can’t edit menus or items.
Pressing on the “properties” button doesn’t do anything. Here’s the
terminal output:

Hi
Re-install the original version and then look at this thread;
http://forums.opensuse.org/showthread.php?t=485933

Then be patient and wait for the update from the G:S:3.8 repository,
the fixed one is just waiting to be published. If it’s still having an
issue, then report back :wink:


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 12.3 (x86_64) Kernel 3.7.10-1.1-desktop
up 0:14, 3 users, load average: 0.13, 0.22, 0.14
CPU Intel® i5 CPU M520@2.40GHz | GPU Intel® Ironlake Mobile

Thanks you Malcolm! You saved my virtual life once again!

Same problem here. Cannot add items or view properties on Main Menu (Alacarte) on Gnome 3.8 Stable. Any ideas?

Running openSUSE 12.3 64 bit with the Gnome 3.8 stable repo.

Hi
Did you update the util.py as per the link in my post #2? Seems it’s still an issue in the update is not there…

Hi there. I did check your post and util.py, but my file says -

KEY_FILE_FLAGS = GLib.KeyFileFlags.KEEP_COMMENTS | GLib.KeyFileFlags.KEEP_TRANSLATIONS 

on line 28. Just above it on line 25 there’s something similar to what you say -

from gi.repository import Gtk, GdkPixbuf, GMenu, GLib

but it’s not really the same thing I think. Should I still make the changes? Many thanks. :slight_smile:

On Sat 08 Jun 2013 03:46:03 PM CDT, Kinzie wrote:

malcolmlewis;2563530 Wrote:
> Hi
> Did you update the util.py as per the link in my post #2? Seems it’s
> still an issue in the update is not there…

Hi there. I did check your post and util.py, but my file says -

Code:

KEY_FILE_FLAGS = GLib.KeyFileFlags.KEEP_COMMENTS |
GLib.KeyFileFlags.KEEP_TRANSLATIONS --------------------

on line 28. Just above it on line 25 there’s something similar to what
you say -

Code:

from gi.repository import Gtk, GdkPixbuf, GMenu, GLib

but it’s not really the same thing I think. Should I still make the
changes? Many thanks. :slight_smile:

Hi
Just below that;


# XXX: look into pygobject error marshalling
from gi.repository.GLib import GError


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 12.3 (x86_64) Kernel 3.7.10-1.11-desktop
up 23:30, 3 users, load average: 0.05, 0.04, 0.05
CPU AMD Athlon™ II P360@2.30GHz | GPU Mobility Radeon HD 4200

Hi. Thanks for your patience. I’ve added your amendment, but Alacarte still won’t let me edit menus or view properties etc. The file now looks like this:

# -*- coding: utf-8 -*-
#   Alacarte Menu Editor - Simple fd.o Compliant Menu Editor
#   Copyright (C) 2006  Travis Watkins
#
#   This library is free software; you can redistribute it and/or
#   modify it under the terms of the GNU Library General Public
#   License as published by the Free Software Foundation; either
#   version 2 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
#   Library General Public License for more details.
#
#   You should have received a copy of the GNU Library General Public
#   License along with this library; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA


import os
import xml.dom.minidom
from collections import Sequence


import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GdkPixbuf, GMenu, GLib
# XXX: look into pygobject error marshalling
from gi.repository.GLib import GError


DESKTOP_GROUP = GLib.KEY_FILE_DESKTOP_GROUP
KEY_FILE_FLAGS = GLib.KeyFileFlags.KEEP_COMMENTS | GLib.KeyFileFlags.KEEP_TRANSLATIONS


def fillKeyFile(keyfile, items):
    for key, item in items.iteritems():
        if item is None:
            continue


        if isinstance(item, bool):
            keyfile.set_boolean(DESKTOP_GROUP, key, item)
        elif isinstance(item, basestring):
            keyfile.set_string(DESKTOP_GROUP, key, item)
        elif isinstance(item, Sequence):
            keyfile.set_string_list(DESKTOP_GROUP, key, item)


def getUniqueFileId(name, extension):
    append = 0
    while 1:
        if append == 0:
            filename = name + extension
        else:
            filename = name + '-' + str(append) + extension
        if extension == '.desktop':
            path = getUserItemPath()
            if not os.path.isfile(os.path.join(path, filename)) and not getItemPath(filename):
                break
        elif extension == '.directory':
            path = getUserDirectoryPath()
            if not os.path.isfile(os.path.join(path, filename)) and not getDirectoryPath(filename):
                break
        append += 1
    return filename


def getUniqueRedoFile(filepath):
    append = 0
    while 1:
        new_filepath = filepath + '.redo-' + str(append)
        if not os.path.isfile(new_filepath):
            break
        else:
            append += 1
    return new_filepath


def getUniqueUndoFile(filepath):
    filename, extension = os.path.split(filepath)[1].rsplit('.', 1)
    append = 0
    while 1:
        if extension == 'desktop':
            path = getUserItemPath()
        elif extension == 'directory':
            path = getUserDirectoryPath()
        elif extension == 'menu':
            path = getUserMenuPath()
        new_filepath = os.path.join(path, filename + '.' + extension + '.undo-' + str(append))
        if not os.path.isfile(new_filepath):
            break
        else:
            append += 1
    return new_filepath


def getItemPath(file_id):
    for path in GLib.get_system_data_dirs():
        file_path = os.path.join(path, 'applications', file_id)
        if os.path.isfile(file_path):
            return file_path
    return None


def getUserItemPath():
    item_dir = os.path.join(GLib.get_user_data_dir(), 'applications')
    if not os.path.isdir(item_dir):
        os.makedirs(item_dir)
    return item_dir


def getDirectoryPath(file_id):
    for path in GLib.get_system_data_dirs():
        file_path = os.path.join(path, 'desktop-directories', file_id)
        if os.path.isfile(file_path):
            return file_path
    return None


def getUserDirectoryPath():
    menu_dir = os.path.join(GLib.get_user_data_dir(), 'desktop-directories')
    if not os.path.isdir(menu_dir):
        os.makedirs(menu_dir)
    return menu_dir


def getUserMenuPath():
    menu_dir = os.path.join(GLib.get_user_config_dir(), 'menus')
    if not os.path.isdir(menu_dir):
        os.makedirs(menu_dir)
    return menu_dir


def getSystemMenuPath(file_id):
    for path in GLib.get_system_config_dirs():
        file_path = os.path.join(path, 'menus', file_id)
        if os.path.isfile(file_path):
            return file_path
    return None


def getUserMenuXml(tree):
    system_file = getSystemMenuPath(os.path.basename(tree.get_canonical_menu_path()))
    name = tree.get_root_directory().get_menu_id()
    menu_xml = "<!DOCTYPE Menu PUBLIC '-//freedesktop//DTD Menu 1.0//EN' 'http://standards.freedesktop.org/menu-spec/menu-1.0.dtd'>
"
    menu_xml += "<Menu>
  <Name>" + name + "</Name>
  "
    menu_xml += "<MergeFile type=\"parent\">" + system_file +    "</MergeFile>
</Menu>
"
    return menu_xml


def getIcon(item):
    pixbuf = None
    if item is None:
        return None


    if isinstance(item, GMenu.TreeDirectory):
        gicon = item.get_icon()
    elif isinstance(item, GMenu.TreeEntry):
        app_info = item.get_app_info()
        gicon = app_info.get_icon()
    else:
        return None


    if gicon is None:
        return None


    icon_theme = Gtk.IconTheme.get_default()
    info = icon_theme.lookup_by_gicon(gicon, 24, 0)
    if info is None:
        return None
    try:
        pixbuf = info.load_icon()
    except GLib.GError:
        return None
    if pixbuf is None:
        return None
    if pixbuf.get_width() != 24 or pixbuf.get_height() != 24:
        pixbuf = pixbuf.scale_simple(24, 24, GdkPixbuf.InterpType.HYPER)
    return pixbuf


def removeWhitespaceNodes(node):
    remove_list = ]
    for child in node.childNodes:
        if child.nodeType == xml.dom.minidom.Node.TEXT_NODE:
            child.data = child.data.strip()
            if not child.data.strip():
                remove_list.append(child)
        elif child.hasChildNodes():
            removeWhitespaceNodes(child)
    for node in remove_list:
        node.parentNode.removeChild(node)

Is this correct? Thanks again.

On Sat 08 Jun 2013 04:26:02 PM CDT, Kinzie wrote:

malcolmlewis;2563537 Wrote:
> Hi
> Just below that;
> >
Code:

> >
> # XXX: look into pygobject error marshalling
> from gi.repository.GLib import GError
>

> >
>
>

Hi. Thanks for your patience. I’ve added your amendment, but Alacarte
still won’t let me edit menus or view properties etc. The file now looks
like this:

Hi
Hmmm, working fine here. So if you create a test user and login as the
test user, does alacarte work?

If you start alacarte from a terminal, is there additional output?

If none of the above work, can you force the re-install of alacarte and
edit the utils.py again;


zypper in -f alacarte


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 12.3 (x86_64) Kernel 3.7.10-1.11-desktop
up 1 day 0:24, 3 users, load average: 0.23, 0.15, 0.09
CPU AMD Athlon™ II P360@2.30GHz | GPU Mobility Radeon HD 4200

OK, I created a test user, but the result was the same. No changes could be made using Alacarte. From a terminal I tried first to view properties on an entry, and then to create a new entry. The output is below -

Kinzie@linux-xxxx:~> alacarte


(alacarte:6856): Gtk-CRITICAL **: gtk_accel_label_set_accel_closure: assertion `gtk_accel_group_from_accel_closure (accel_closure) != NULL' failed


(alacarte:6856): Gtk-CRITICAL **: gtk_accel_label_set_accel_closure: assertion `gtk_accel_group_from_accel_closure (accel_closure) != NULL' failed
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/Alacarte/MainWindow.py", line 429, in on_properties_button_clicked
    self.on_edit_properties_activate(None)
  File "/usr/lib/python2.7/site-packages/Alacarte/MainWindow.py", line 307, in on_edit_properties_activate
    editor = Editor(self.main_window, file_path)
AttributeError: 'MainWindow' object has no attribute 'main_window'
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/Alacarte/MainWindow.py", line 258, in on_new_item_button_clicked
    editor = LauncherEditor(self.main_window, file_path)
AttributeError: 'MainWindow' object has no attribute 'main_window'

I’ll re-install if you still feel it’s worthwhile. Many thanks for your continued patience.

On Sat 08 Jun 2013 06:46:01 PM CDT, Kinzie wrote:

malcolmlewis;2563545 Wrote:
> Hi
> Hmmm, working fine here. So if you create a test user and login as the
> test user, does alacarte work?
>
> If you start alacarte from a terminal, is there additional output?
>
> If none of the above work, can you force the re-install of alacarte
> and edit the utils.py again;
> >
Code:

> >
> zypper in -f alacarte
>

> >
>
> –
> Cheers Malcolm °¿° (Linux Counter #276890)
> openSUSE 12.3 (x86_64) Kernel 3.7.10-1.11-desktop
> up 1 day 0:24, 3 users, load average: 0.23, 0.15, 0.09
> CPU AMD Athlon™ II P360@2.30GHz | GPU Mobility Radeon HD 4200

OK, I created a test user, but the result was the same. No changes
could be made using Alacarte. From a terminal I tried first to view
properties on an entry, and then to create a new entry. The output is
below -

Code:

Kinzie@linux-xxxx:~> alacarte

(alacarte:6856): Gtk-CRITICAL **: gtk_accel_label_set_accel_closure:
assertion gtk_accel_group_from_accel_closure (accel_closure) != NULL' failed (alacarte:6856): Gtk-CRITICAL **: gtk_accel_label_set_accel_closure: assertion gtk_accel_group_from_accel_closure (accel_closure) != NULL’
failed Traceback (most recent call last): File
“/usr/lib/python2.7/site-packages/Alacarte/MainWindow.py”, line 429, in
on_properties_button_clicked self.on_edit_properties_activate(None)
File “/usr/lib/python2.7/site-packages/Alacarte/MainWindow.py”, line
307, in on_edit_properties_activate editor = Editor(self.main_window,
file_path) AttributeError: ‘MainWindow’ object has no attribute
‘main_window’ Traceback (most recent call last): File
“/usr/lib/python2.7/site-packages/Alacarte/MainWindow.py”, line 258, in
on_new_item_button_clicked editor = LauncherEditor(self.main_window,
file_path) AttributeError: ‘MainWindow’ object has no attribute
‘main_window’ --------------------

I’ll re-install if you still feel it’s worthwhile. Many thanks for your
continued patience.

Hi
Yes, reinstall alarcarte, edit and try again.


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 12.3 (x86_64) Kernel 3.7.10-1.11-desktop
up 1 day 4:21, 3 users, load average: 0.20, 0.29, 0.20
CPU AMD Athlon™ II P360@2.30GHz | GPU Mobility Radeon HD 4200

Hullo again. :slight_smile: I reinstalled Alacarte this morning and re-edited the utils.py file, but still to no avail. :frowning:

Wonder what’s happening? I did note that in the Gnome Stable repo, Alacarte is version 3.7.9, rather than 3.8.x. Could this be the problem?

On 06/09/2013 12:16 PM, Kinzie wrote:
> 3.7.9, rather than 3.8.x. Could this be the problem?

sure, backlevel to test…


dd

Hi. Not sure what you mean by “backlevel”, but I guess I’ll just wait until this application gets upgraded in the Gnome:Stable repo.

Thanks all.

On Sun 09 Jun 2013 10:16:02 AM CDT, Kinzie wrote:

Hullo again. :slight_smile: I reinstalled Alacarte this morning and re-edited the
utils.py file, but still to no avail. :frowning:

Wonder what’s happening? I did note that in the Gnome Stable repo,
Alacarte is version 3.7.9, rather than 3.8.x. Could this be the problem?

Hi
Mine is from the oss repo;


Repository: openSUSE-12.3-Oss
Name: alacarte
Version: 3.6.1-3.1.2


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 12.3 (x86_64) Kernel 3.7.10-1.11-desktop
up 1 day 21:03, 3 users, load average: 0.07, 0.11, 0.13
CPU AMD Athlon™ II P360@2.30GHz | GPU Mobility Radeon HD 4200

Ah! Well that version doesn’t seem to be available to me in YasT. If I select repositories, and browse the openSUSE-12.3-Oss repo, the version available is the same as the Gnome:Stable one.

No matter. I can wait until a newer, fixed version of the program is available. :slight_smile: Thanks all.

Hi
In YaST check the versions tab?
SUSE Paste

Well that’s embarrassing. I’ve been using openSUSE for ages and never thought to check that drop down box! Thanks for that.

I’ve installed the older version and applied the fix. It works now, but I do hope Gnome fix this for future releases. :slight_smile:

Thanks for your help. :slight_smile:

On 06/09/2013 02:56 PM, Kinzie wrote:
> Not sure what you mean by “backlevel”

move back (down) to the previous level (version)…

hmmm, maybe it should be presented as “back level”

if you install a new version and it does not work, then a back level
is often the quickest fix


dd

We probably shouldn’t be installing alacarte by default… it clearly does not support GNOME anymore. (alacarte was picked up by MATE last year so it’s not really being tested with GNOME anymore; GNOME half-dropped it in the transition to 3.0 and other distros stopped installing it, but the module just sort of stuck around.)

I hope GNOME comes up with an alternative (and I’ve heard it already has one but I’m not sure that’s true).