guake icon indicating copy to clipboard operation
guake copied to clipboard

Restore default settings

Open Bost opened this issue 3 years ago • 24 comments

Please add functionality to restore default settings. Or at least documentation how to do it. Thank you.

Bost avatar Aug 29 '21 11:08 Bost

In Guake, we use GNOME/GSettings to manage settings.

You can use gsettings to reset all settings by gsettings:

$ gsettings reset-recursively guake.general

There are several scheme used by Guake:

$ gsettings list-schemas | grep guake
guake.general
guake.style.font
guake.style
guake.keybindings
guake.style.background
guake.keybindings.global
guake
guake.keybindings.local
guake.hooks

Bost @.***> 於 2021年8月29日 週日 下午7:36寫道:

Please add functionality to restore default settings. Or at least documentation how to do it. Thank you.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

mlouielu avatar Aug 29 '21 13:08 mlouielu

Thanks.

Bost avatar Aug 29 '21 19:08 Bost

@Bost Would you like to help create a PR for this?

mlouielu avatar Aug 31 '21 08:08 mlouielu

i could help

Chicchi7393 avatar Oct 03 '21 15:10 Chicchi7393

I'll assign @Chicchi7393 since they're volunteering here.

Davidy22 avatar Oct 03 '21 17:10 Davidy22

@Davidy22 sorry, i tried to make the button, i think i succeded but i can't test because the settings aren't saving when closing (and it gives me two errors at startup (arch with gnome40) )

Chicchi7393 avatar Oct 03 '21 17:10 Chicchi7393

Are you making any calls to self.settings.general.set_boolean()? That'll probably help you change settings to their original value. I can't see your code, but I suspect you just have the button changing some states in the preferences ui right now.

Davidy22 avatar Oct 03 '21 17:10 Davidy22

i got the schemas from the config file (could be unpractical in the future, if you want i'll use os.system to reset every category of properties available) and on the click it will loop in the schemas to reset using the function self.settings.general.reset, i can't test because in my case it doesn't even save to the config but i can link the maybe-functioning fork

Chicchi7393 avatar Oct 03 '21 17:10 Chicchi7393

On quick inspection of the commit, that's a massive amount of changes to prefs.glade for one button being added. Skimming through, a hefty chunk of it seems to be a change in convention? Is the preferences window failing to pop up for you at all, because some side effect in this hefty change might be the cause of that. You can also run guake with guake --debug for more messages that can help you pinpoint the issue better.

Davidy22 avatar Oct 03 '21 17:10 Davidy22

On quick inspection of the commit, that's a massive amount of changes to prefs.glade for one button being added. Skimming through, a hefty chunk of it seems to be a change in convention? Is the preferences window failing to pop up for you at all, because some side effect in this hefty change might be the cause of that. You can also run guake with guake --debug for more messages that can help you pinpoint the issue better.

apparently only changing the version of glade changed this much, i'll try to revert and change only the needed

Chicchi7393 avatar Oct 03 '21 17:10 Chicchi7393

@Davidy22 there is no such thing as --debug, also committed on the fork using glade 3.22.2 but the handler is not called

Chicchi7393 avatar Oct 03 '21 18:10 Chicchi7393

Oh whoops misremembered, it's --verbose

Davidy22 avatar Oct 03 '21 18:10 Davidy22

Oh whoops misremembered, it's --verbose

still, if i do guake -p --verbose nothing gets logged, now it saves what i set but the reset button doesn't do anything (that should also restart the settings, but it doesn't do it, so i suppose the handler doesn't even get executed)

Chicchi7393 avatar Oct 03 '21 19:10 Chicchi7393

To get log output, close guake entirely and run guake --verbose from another terminal to start guake. Pulling your repo and running with --verbose, I get the following message at the moment that I click the reset button:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/guake/prefs.py", line 562, in resetAllSettings_clicked_cb
    self.prefDlg.resetAllSettings_clicked_cb(btn)
  File "/usr/local/lib/python3.8/dist-packages/guake/prefs.py", line 815, in resetAllSettings_clicked_cb
    list_schemas = os.system("gsettings list-schemas | grep guake").split("\n")
AttributeError: 'int' object has no attribute 'split'

For sections of code like the one throwing the error above where no functions from guake are actually being called, you can also write a quick proof of concept in a throwaway file and copy it into guake once you get it to work. Looks like this is just a typing error that could have been tested and fixed outside of guake

Davidy22 avatar Oct 04 '21 03:10 Davidy22

Fixed it I suppose, i can’t test run because I’m at school with my iPad but in around 1h and 50m I can test, hope everything works!

Chicchi7393 avatar Oct 04 '21 09:10 Chicchi7393

Alright, make a pull request once you get it tested and working and ready to submit so someone can take a closer look

Davidy22 avatar Oct 04 '21 10:10 Davidy22

Alright, make a pull request once you get it tested and working and ready to submit so someone can take a closer look

apparently the program hates me, i expect it to work but https://hastebin.com/lexalemeqa.py

Chicchi7393 avatar Oct 04 '21 11:10 Chicchi7393

Alright, make a pull request once you get it tested and working and ready to submit so someone can take a closer look

apparently the program hates me, i expect it to work but https://hastebin.com/lexalemeqa.py

What kinda code do you run?

You cannot use (and better not use, use subprocess) os.system() to pipe stuff, it return int because it failed, and return errno.

You should use subprocess to handle the pipe, and for better wrap for spawn new processes.

mlouielu avatar Oct 04 '21 11:10 mlouielu

Just inspecting the error a little bit, and I'm not in sure what context did you manage to get guake_version() to return None, but expected parameter type is string and there's probably a good sensical place for you to add a check somewhere to make that line work.

On a side note, are you installing from source with sudo make install or some other path? I notice the error path is slightly different from mine. Probably doesn't actually make a difference though

Davidy22 avatar Oct 04 '21 13:10 Davidy22

Alright, make a pull request once you get it tested and working and ready to submit so someone can take a closer look

apparently the program hates me, i expect it to work but https://hastebin.com/lexalemeqa.py

What kinda code do you run?

You cannot use (and better not use, use subprocess) os.system() to pipe stuff, it return int because it failed, and return errno.

You should use subprocess to handle the pipe, and for better wrap for spawn new processes.

i now use subprocess, that error happened after i switched back to subprocess

Chicchi7393 avatar Oct 04 '21 14:10 Chicchi7393

Just inspecting the error a little bit, and I'm not in sure what context did you manage to get guake_version() to return None, but expected parameter type is string and there's probably a good sensical place for you to add a check somewhere to make that line work.

On a side note, are you installing from source with sudo make install or some other path? I notice the error path is slightly different from mine. Probably doesn't actually make a difference though

i do make reinstall in between the changes

Chicchi7393 avatar Oct 04 '21 14:10 Chicchi7393

well whatever it is, do some logging to try to figure out why guake_version's giving a blank return and add an appropriate check

Davidy22 avatar Oct 04 '21 14:10 Davidy22

How's fixing the patch up progressing, @Chicchi7393?

Davidy22 avatar Oct 09 '21 03:10 Davidy22

Unassigning due to no response

Davidy22 avatar Oct 13 '21 13:10 Davidy22