amezin / amdgpu-pptable

A Python library that maps amdgpu powerplay tables to ctypes structs. Qt GUI moved to its own repo: https://github.com/amezin/amdgpu-pptable-editor-qt
MIT License
27 stars 3 forks source link

Text based alternative to GUI (TUI) #7

Closed rdugan closed 4 years ago

rdugan commented 4 years ago

Love the idea of this app, but I run all my rigs headless, and can't use the GUI as a result. So I wrote a curses based TUI (using a modded npyscreen library) as an alternative. This is purely an add-on to your code, w/ the exception of a couple changes to setup.py, including renaming your entry point for the gui (amdgpu-pptable-gui) to allow for a similarly named amdgpu-pptable-tui.

I haven't included any in-app help yet (e.g. for keybindings), but a few major ones if you're interested in testing are:

'SPC': expand/collapse section toggle
']/+': expand section (multiple keypresses expands subsections
'[/-': collapse section (multiple keypresses collapses parent sections
'}': expand all
'{': collapse all
'l': search values (expanded sections only)
'n': next search match
'p': previous search match
'RET/e': edit value

There's also a menu accessible via Ctrl-X (indicated on the bottom left) for file controls.

I'm sure there are still bugs to be found - the underlying ncurses lib (npyscreen) is pretty old and crusty. But it had a decent start on the tree functionality, and gets the job done for now.

amezin commented 4 years ago

Actually, I think it's the right time to split the core library and GUI app to different setuptools packages (so gui app will have Qt as a dependency, and the library won't), and maybe even different repositories. This way you'll be able to write whatever frontend you want, without pulling Qt into your app.

Hopefully I'll be able to find time to do it this week.

Or maybe you could help me with this task?

rdugan commented 4 years ago

That's kinda what I did w/ that latest change - just adding HEADLESS=1 before the pip3 install command (or separately as a more permanent env var) leaves out both the qt requirement as well as the gui entry point (though the gui code is still installed.). I could go further w/ a library only option...

Are you thinking that's not enough?

Btw, it also appears my inclusion of a github hosted npyscreen repo doesn't work properly when installing this package via git+https (setup looks at some package index instead.) If this is cloned locally, then installed via pip install . however, it works just fine... Any ideas?

amezin commented 4 years ago

just adding HEADLESS=1 before the pip3 install command (or separately as a more permanent env var)

Honestly I haven't looked at the code yet. I thought you were using 'extras_require' (extras also can be applied to entry points, but won't prevent entry points from being installed). Env variable is a hack that I don't like. And even if you're getting rid of the entry point, the code that uses Qt will still be installed (true for extras_require too).

I think the cleanest approach is to have separate setuptools packages for the library, qt gui editor, and your terminal ui.

I'm currently deciding whether I should create a dedicated repository for the qt app (and completely remove its code from this repo) or keep two packages in the same repo. Creating the dedicated repo seems to be a cleaner/more straightforward solution.

Btw, it also appears my inclusion of a github hosted npyscreen repo doesn't work properly when installing this package via git+https (setup looks at some package index instead.) If this is cloned locally, then installed via pip install . however, it works just fine... Any ideas?

Many things are broken in pip/setuptools. Only installation from pypi is usually reliable.

amezin commented 4 years ago

I've removed all Qt GUI code from this repo. GUI editor is now in https://github.com/amezin/amdgpu-pptable-editor-qt

Also I've published the library on pypi: https://pypi.org/project/amdgpu-pptable/ so you won't have to deal with git+https links

rdugan commented 4 years ago

Thanks for the tip and separating the library... was the better solution. Cheers!