linuxmint / cinnamon

A Linux desktop featuring a traditional layout, built from modern technology and introducing brand new innovative features.
GNU General Public License v2.0
4.53k stars 736 forks source link

cinnamon-settings themes crashes #9043

Closed Bednar87 closed 4 years ago

Bednar87 commented 4 years ago

Issue

cinnamon-settings themes crashes

Steps to reproduce launch cinnamon-settings themes

Expected behaviour

Other information

/usr/share/cinnamon/cinnamon-settings/bin/ChooserButtonWidgets.py:334: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if show_seconds is 'default':
/usr/share/cinnamon/cinnamon-settings/bin/ChooserButtonWidgets.py:338: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if show_seconds is 'true':
/usr/share/cinnamon/cinnamon-settings/bin/ChooserButtonWidgets.py:340: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif show_seconds is 'false':
True
/usr/share/cinnamon/cinnamon-settings/modules/cs_keyboard.py:422: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if category.int_name is not "custom":
/usr/share/cinnamon/cinnamon-settings/modules/cs_keyboard.py:431: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if category.int_name is "custom":
/usr/share/cinnamon/cinnamon-settings/modules/cs_keyboard.py:446: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if category.int_name is "custom":
/usr/share/cinnamon/cinnamon-settings/modules/cs_keyboard.py:456: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if entry is not "_invalid_":
/usr/share/cinnamon/cinnamon-settings/modules/cs_keyboard.py:539: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if cat[2].int_name is "custom":
/usr/share/cinnamon/cinnamon-settings/modules/cs_keyboard.py:577: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if cat[2].int_name is "custom":
/usr/share/cinnamon/cinnamon-settings/modules/cs_keyboard.py:603: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if cat[2].int_name is "custom":
/usr/share/cinnamon/cinnamon-settings/modules/cs_keyboard.py:694: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if entry is not "":
/usr/share/cinnamon/cinnamon-settings/modules/cs_keyboard.py:734: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if entry is not "":
/usr/share/cinnamon/cinnamon-settings/modules/cs_keyboard.py:780: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  ok_enabled = self.name_entry.get_text().strip() is not "" and self.command_entry.get_text().strip() is not ""
/usr/share/cinnamon/cinnamon-settings/modules/cs_keyboard.py:780: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  ok_enabled = self.name_entry.get_text().strip() is not "" and self.command_entry.get_text().strip() is not ""
Using pam module (python3-pampy)
/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py:426: DeprecationWarning: Gtk.Window.set_wmclass is deprecated
  self.window.set_wmclass(wm_class, wm_class)
Loading Themes module
Traceback (most recent call last):
  File "/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py", line 726, in <module>
    window = MainWindow()
  File "/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py", line 431, in __init__
    self.go_to_sidepage(cat, path, user_action=False)
  File "/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py", line 188, in go_to_sidepage
    sidePage.build()
  File "/usr/share/cinnamon/cinnamon-settings/bin/SettingsWidgets.py", line 213, in build
    self.module.on_module_selected()
  File "/usr/share/cinnamon/cinnamon-settings/modules/cs_themes.py", line 118, in on_module_selected
    widget.sync_initial_switch_state()
  File "/usr/share/cinnamon/cinnamon-settings/bin/CinnamonGtkSettings.py", line 194, in sync_initial_switch_state
    if editor.get_declaration(self.selector, decl_name):
  File "/usr/share/cinnamon/cinnamon-settings/bin/CinnamonGtkSettings.py", line 114, in get_declaration
    rs = self.get_ruleset(selector)
  File "/usr/share/cinnamon/cinnamon-settings/bin/CinnamonGtkSettings.py", line 105, in get_ruleset
    if rs.selector.as_css() == selector_css:
AttributeError: 'ImportRule' object has no attribute 'selector'
icarter09 commented 4 years ago

Mint 19.3 64bit Cinnamon 4.5.4

While I'm not running Arch, I'm not able to reproduce this issue on Mint. Running cinnamon-settings themes works correctly in both python 2.7 and python 3.6.

icarter09 commented 4 years ago

@eli-schwartz

chromer030 commented 4 years ago

Thanks to neko from Porteus Linux , this issue was fixed. The cause of this crash is that setting the path to variable theme_path was missing and added in line 239 of cs_theme.py

`$ cat -n FIXED/cs_themes.py

1 #!/usr/bin/python3 2 3 import os 4 5 from gi.repository.Gtk import SizeGroup, SizeGroupMode ... 238 239 theme_path="usr/share/themes" 240 if os.path.exists(theme_path): 241 chooser.add_picture(theme_path, callback, title=theme, id=theme) 242 GLib.timeout_add(5, self.increment_progress, (chooser, inc)) ...`

eli-schwartz commented 4 years ago

https://github.com/linuxmint/cinnamon/blob/bd2104e59dc2eb86b52ee9c6c14a7df847cd73fe/files/usr/share/cinnamon/cinnamon-settings/bin/CinnamonGtkSettings.py#L104-L106

I'm not sure how a tinycss stylesheet "rules" attribute element could exist, but not have a selector attribute. Maybe someone else has an idea?

Anyway, I cannot duplicate this on Arch.

@Bednar87 if you could upload your .config/gtk-3.0/gtk.css, it is possible we might be able to debug why this is happening.

eli-schwartz commented 4 years ago

Why is it an ImportRule instead of a RuleSet, though... maybe that's the problem!

eli-schwartz commented 4 years ago

Yes, if you add something like @import url("/usr/share/themes/Adwaita/gtk-3.0/gtk.css"); then it fails. This is a supported use case as per https://developer.gnome.org/gtk3/stable/chap-css-overview.html#id-1.5.2.3.6

Looks like tinycss needs to be taught to flatten this if the editor is meant to see how that works.

eli-schwartz commented 4 years ago

The proper solution is to port from tinycss to tincyss2 if possible, since tinycss2 has the serialize() function for writing back css rules and that supports tinycss2.ast.AtRule just fine.

mtwebster commented 4 years ago

There's a PR for porting to tinycss2, but it will be for 4.6.

https://github.com/linuxmint/cinnamon/pull/8794

eli-schwartz commented 4 years ago

Okay, neat. Looks like that would solve the problem, especially since it explicitly mentions at-rules.

So, cinnamon would like to properly support css stylesheets per the spec, but it's currently waiting on the availability of the needed dependency in Debian. I can live with that. ;) I would be happier if I could get new stuff immediately, but such is life.

boussou commented 4 years ago

I tried solution from @chromer030 it did not work for me.

I use cinnamon installed along with KDE Plasma on Arch, so I remembered there shall be some GTK misconfig from KDE. And I had a previous config on my profile coming from Antergos; with missing files in ~/.theme.

So I renamed

    /home/nadir/.config/gtk-2.0.old
    /home/nadir/.config/gtk-3.0.old

A also tried some gsettings commands, to reset the state. Then relogged in.

and it works: I can now see the theme config panel.

For the record, here are the gsettings commands issued, I can't tell if it helped (I think it is the rename):

gsettings set org.cinnamon.desktop.privacy remember-recent-files false
gsettings set org.cinnamon.theme name 'Numix-Frost'
gsettings set org.cinnamon.desktop.interface gtk-theme 'Numix-Frost-Light'
gsettings set org.cinnamon.desktop.wm.preferences theme 'Numix-Frost-Light'
gsettings set org.cinnamon.desktop.interface cursor-blink true

gsettings set org.gnome.desktop.interface icon-theme 'Numix-Square'
eli-schwartz commented 4 years ago

@boussou yeah, @chromer030's comment was both totally unrelated to this issue and incorrect for the issue it tried to solve.

@mtwebster's fix should work, though, so hopefully that gets tagged soon and I can roll it out to the archlinux repos.

eli-schwartz commented 4 years ago

@boussou @Bednar87 I've just uploaded the new tagged release. You can get the fixed version (which should support gtk CSS files with @import rules) with the following command within (depending on how fast your configured mirror syncs) the next couple of hours:

sudo pacman -Syu 'cinnamon>=4.4.6-1'
Bednar87 commented 4 years ago

thanks everyone! This is working just fine now in 4.4.6