Git Product home page Git Product logo

xdg-prefs's Introduction

Remy Chaput

Hi, I'm Remy Chaput 👋

PhD in Artificial Intelligence 🤖

About me 👨‍💻

  • I am a 🔨 software engineer, 📝 computer science researcher and 📚 teacher from Lyon, France.
  • My favourite languages are Python3 and Java, although I use many languages.
  • I mainly create projects that I find useful, but I also code for fun.

Read more on 📃 rchaput.github.io

My stack 💻

Programming languages

Python
Java
Kotlin
Lua
Bash
Zsh
R
Prolog
JS
Vue.js
Vuetify
React

Tools 🔧

Git
IntelliJ IDEA
PyCharm
macOS
Arch Linux
Debian
Docker
PostgreSQL
MongoDB

GitHub stats 🔥

Account stats Top languages

Star History Chart

xdg-prefs's People

Contributors

akvadrako avatar nickgeek avatar rchaput avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

xdg-prefs's Issues

XP-007 Add docs

Documentation should be added in a docs/ folder at the root of the project. It should contain:

  • the code documentation (extracted from the Python docstrings)
  • a "user manual" on how to use the application
  • a "dev manual" on how to contribute, how to delve into the source code, what is the goal of each module,...

The documentation should be set up as Github Pages for easy access.

XP-008 Allow batch edition

It would be interesting to change the default program of multiples Media Types at the same time (for example, setting all 'image/...' to be opened by eog).
This should not be difficult not to implement, but requires a clean, intuitive UI.

Segfault on Python 3.12

Hi, I just attempted to install and run this with Python 3.12 on x86_64 Arch Linux. I get a segmentation fault when attempting to launch the program. I put the core dump in the debugger and it appears that there is a bad pointer deference in PyDict_GetItem within cpython. I think it's a case of bad FFI.

Specifically:

PyDict_GetItem:
	endbr64                         
	push   %rbp                     
	mov    %rsp,%rbp                
	push   %r15                     
	push   %r14                     
	push   %r13                     
	push   %r12                     
	push   %rbx                     
	sub    $0x18,%rsp               
	mov    %fs:0x28,%rax            
	mov    %rax,-0x38(%rbp)         
	mov    0x8(%rdi),%rax    ; %rdi is null, 0x8(0x0) is invalid memory

PackageNotFoundError: No package metadata was found for XDG-Prefs

Trying to run this on EndeavourOS Linux x86_64 (with openbox/lxqt) results in an error. I did compile it, but I never did a lot of python development so I'm a bit lost.

running ./compiled/bin/xdg-prefs gives me:

Traceback (most recent call last):                                                                                                              
  File "/home/jogai/Projects/xdg-prefs/./compiled/bin/xdg-prefs", line 33, in <module>
    sys.exit(load_entry_point('XDG-Prefs==0.1', 'gui_scripts', 'xdg-prefs')())
  File "/home/jogai/Projects/xdg-prefs/./compiled/bin/xdg-prefs", line 22, in importlib_load_entry_point
    for entry_point in distribution(dist_name).entry_points
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 957, in distribution
    return Distribution.from_name(distribution_name)
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 548, in from_name
    raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: No package metadata was found for XDG-Prefs

Build command:
python setup.py install --prefix compiled/

output of tree compiled/ -L 4:

tree compiled/ -L 4                                                                                          
compiled/                                                                                                                                       
|-- bin
|   |-- future-fstrings-show
|   |-- pyside2-designer
|   |-- pyside2-lupdate
|   |-- pyside2-rcc
|   |-- pyside2-uic
|   `-- xdg-prefs
`-- lib
    `-- python3.10
        `-- site-packages
            |-- PySide2-5.15.2.1-py3.10-linux-x86_64.egg
            |-- XDG_Prefs-0.1-py3.10.egg
            |-- future_fstrings-1.2.0-py3.10.egg
            `-- shiboken2-5.15.2.1-py3.10-linux-x86_64.egg

future-fstrings not found, even when installed

~/S/C/xdg-prefs master• [1] pip3 list
Package                Version
---------------------- ---------
...
future-fstrings        1.2.0
...
XDG-Prefs              0.1
~/S/C/xdg-prefs master• ❱ xdg-prefs
Traceback (most recent call last):
  File "/usr/bin/xdg-prefs", line 33, in <module>
    sys.exit(load_entry_point('XDG-Prefs==0.1', 'gui_scripts', 'xdg-prefs')())
  File "/usr/bin/xdg-prefs", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.9/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "/usr/lib/python3.9/site-packages/XDG_Prefs-0.1-py3.9.egg/xdgprefs/__init__.py", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "/usr/lib/python3.9/site-packages/XDG_Prefs-0.1-py3.9.egg/xdgprefs/core/__init__.py", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 982, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 925, in _find_spec
  File "<frozen importlib._bootstrap_external>", line 1414, in find_spec
  File "<frozen importlib._bootstrap_external>", line 1388, in _get_spec
  File "<frozen importlib._bootstrap_external>", line 1369, in _legacy_get_spec
  File "<frozen importlib._bootstrap>", line 423, in spec_from_loader
  File "<frozen importlib._bootstrap_external>", line 716, in spec_from_file_location
  File "<frozen zipimport>", line 191, in get_filename
  File "<frozen zipimport>", line 713, in _get_module_code
  File "<frozen zipimport>", line 647, in _compile_source
  File "/usr/lib/python3.9/site-packages/XDG_Prefs-0.1-py3.9.egg/xdgprefs/core/app_database.py", line 0
SyntaxError: unknown encoding: future_fstrings

Easier install process

I noticed the README recommends installing by downloading the wheel or cloning the repo.

Actually, you can install directly from the repo with pip install git+https://github.com/rchaput/xdg-prefs. That might be a more straightforward instruction.

That said, have you consider publishing to PyPi, so that it can become just pip install XDG-Prefs?

KeyError: None

Just installed from the whl file and this is what I get:

$ xdg-prefs

[lots of "overwriting" messages]
.
.
.
MimeType inode/socket already in the database, overwriting!
MimeType inode/fifo already in the database, overwriting!
MimeType inode/directory already in the database, overwriting!
MimeType inode/blockdevice already in the database, overwriting!
Traceback (most recent call last):
  File "/home/eater/.local/bin/xdg-prefs", line 8, in <module>
    sys.exit(main())
  File "/home/eater/.local/lib/python3.6/site-packages/xdgprefs/__main__.py", line 14, in main
    window = MainWindow()
  File "/home/eater/.local/lib/python3.6/site-packages/xdgprefs/gui/main_window.py", line 22, in __init__
    self.appdb = AppDatabase()
  File "/home/eater/.local/lib/python3.6/site-packages/xdgprefs/core/app_database.py", line 40, in __init__
    self._build_db()
  File "/home/eater/.local/lib/python3.6/site-packages/xdgprefs/core/app_database.py", line 53, in _build_db
    app = parser.parse(filepath, _id)
  File "/home/eater/.local/lib/python3.6/site-packages/xdgprefs/core/desktop_entry_parser.py", line 146, in parse
    entry_groups[current_group].add_entry(entry)
KeyError: None

option 'application/vnd.ms-word.document.macroenabled.12' in section 'MIME Cache' already exists

Hi there. Firstly, thanks a ton for this program! It's something I'd been looking for for years before I found it, and was even planning on writing my own. Thanks for saving me the trouble :)

This crash seems to occur on startup when there is a duplicate line in /usr/share/applications/mimeinfo.cache.
In my case, there were both of these lines:

application/vnd.ms-word.document.macroEnabled.12
application/vnd.ms-word.document.macroenabled.12

I don't know why this duplicate existed, but it seems that xdg-prefs didn't like it so it just crashed. After removing the duplicate, it works fine again.

Full stack trace, for info:

While reading from '/usr/share/applications/mimeinfo.cache' [line 60]: option 'application/vnd.ms-word.document.macroenabled.12' in section 'MIME Cache' already exists
Traceback (most recent call last):
  File "/home/haystack/.local/bin/xdg-prefs", line 8, in <module>
    sys.exit(main())
  File "/home/haystack/.local/lib/python3.8/site-packages/xdgprefs/__main__.py", line 14, in main
    window = MainWindow()
  File "/home/haystack/.local/lib/python3.8/site-packages/xdgprefs/gui/main_window.py", line 23, in __init__
    self.assocdb = AssociationsDatabase()
  File "/home/haystack/.local/lib/python3.8/site-packages/xdgprefs/core/associations_database.py", line 142, in __init__
    self._build_db()
  File "/home/haystack/.local/lib/python3.8/site-packages/xdgprefs/core/associations_database.py", line 150, in _build_db
    self._parse_cache_file(file)
  File "/home/haystack/.local/lib/python3.8/site-packages/xdgprefs/core/associations_database.py", line 169, in _parse_cache_file
    for mimetype, apps in config['MIME Cache'].items():
TypeError: 'NoneType' object is not subscriptable

XP-010 Add tests

Add testing cases (with a framework such as Unittest).
Such tests need to be reproducible on each computer (which is a bit complicated, considering that xdg-prefs changes the user's preferences)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.