-
Notifications
You must be signed in to change notification settings - Fork 3
Conversation
Configured VSCode and Markdownlint settings Added and configured the following linters as strict as I could: pylint, flake8, mypy, bandit, pyright Partially filled in some type stubs: cv2, imagehash, keyboard, pyautogui, pythonwin, win32helper [Breaking change] Using interpolation=cv2.INTER_NEAREST everywhere as it is the fastest interlpolation method Hide generated/compiled files SelectRegionWidget width and height as functions Added validate_images_before_parsing() to validate images both before maxFPS and starting autosplitter
First linting pass
Configured Building and linting workflow
Pylint + Flake8 linting
Merge dev to 2.0.0
Simplified and reduced image conversions Reduced duplicated code, especially in settings Build Artifact
…-Open'-immediatly Fix issues with update checker and global error catching
Naming convention
Split image as class
Added badges
Split screen_region in smaller functions WIP towards Toufool#94: No pop-up on loading settings with no capture window Don't stop/reset AutoSplit upon loosing capture window No pop-up on loosing capture window Don't allow selecting desktop.
Fixed regressions: Fix crash on clising window mid-run Forgot to migrate split_delay to image.delay Removed dead load_pyqt_settings code Fixed dummy groups Pause time from filename not set correctly Setting hotkeys on load
…ecover-from-closed-capture-window
…e-window Recover from closed capture window Fixes Toufool#94
Thanks for taking a look. After failing to press hotkeys to advance my splits on SM64 16 star last night, I'm more motivated than ever to get this working.
The first step is to get this working on Linux. If I was to set this up, I would likely use setuptools because that's what I'm familiar with. I've recently started work on a library called xcookie, which I'm building to help me template new Python projects or update existing ones to have a proper package structure. There' still a lot of me-specific hard coded stuff in there, but the idea of:
I have a lot of experience with Python package setup and management. I'm not opposed to using poetry (although I've never used it directly myself), but I'm also very willing to take on this task of restructuring this as a proper package. But I think getting the minimum viable product is the first step. WRT to pyenv: I have a bash script that helps me automate the setup of pyenv. Pyenv already does a good job itself, but this handles details like ensuring system packages are installed (assuming debian / ubuntu), configuring python optimizations, etc... the script itself is documented in a way that it gives examples of how to run it. It does depend on my bash utilities script, which has even better documentation. (I need to figure out a good way of distributing bash libraries).
I'm not even 100% sure that's the problem. But its worth looking into.
I'll check that out, if the authors don't want to maintain the updated version, we can always fork it to remove the dependency on a git repo. I have quite a bit of experience publishing pypi packages, so I could do that if it would help. I do think eventually moving to pynput, where the system is entirely permissionless might ultimately be the best longer term move, but I may be missing something that keyboard can do that pynput can't, and also the quicker fix sounds like the right scope for a "get Linux working PR".
I can likely fix it. I'm fairly familiar with opencv.
Will do, I'm bossofthegame#9288 on discord. Using github with async conversations would be best for now, but I'll check that if you want to ping me. |
For now I'll just add a warning with instructions if the user isn't in the What I most need help with atm is making sure Capture Devices work (since I can't make my c920 work through my VM). As well as supporting multi-monitor setups. We also need to figure out how to find the size of the shadow around windows (like Finder) so that I can properly offset the targeted region, like we already do like on Windows. If this isn't something PyWinCtl can help with, then adding the functionality to the library will be beneficial to reduce code complexity on our side. But we need to figure it out first. Feel free to fix the Align Region feature separately. It's very low on my priority list and it's probably just a format issue. |
It turns out that keyboard doesn't even let you install it if you don't have the right group permissions setup. It's kind of annoying. I think we don't need to check for that explicitly in this program given that they do it, and a bit of documentation will go a long way here. Ultimately, it would be best to replace keyboard anyway, so I don't think it's worth investing time there.
If you need help testing something I help with that if you give instructions. I have a native Linux setup. I can disable my second monitor if we need to verify something works with/without multi-monitor. I'd hope that it wouldn't be that big of an issue though.
Sounds like a computer vision problem. I'll give it a think.
For whatever reason, I can't seem to reproduce it. I did find out that PyWinCtl really doesn't like whatever window the Mario64 PC port uses to display itself though. I'm guessing it might be doing some low level thing to display itself, which could be causing issues. It does work normally for other windows. |
I've noticed. It runs dumpkeys during install, which really doesn't feel intended. It's been messing up the CI (GitHub actions) because I can't set the active user's groups and running pip as root breaks Pyright linting... I wouldn't mind moving away from keyboard. Even on Windows you may have noticed some very specific code to listen for numpads + PyAutoGui to send them. And it still sometimes break on non-english locales... Also Toufool#155
It's less computer vision and more just finding the right XWindow property and doing a simple substraction :P Alternatively I think it's possible with Xlib to obtain the render of the window itself. That may simplify a lot (and increase performance). For inspiration, they seem to do it. It may still render the border shadows though. Something I'll absolutely need help with, since I cannot get either my webcam nor OBS' virtual cam plugin working on linux (so I can't even test this): |
I've opened an issue on keyboard's side concerning dumpkeys on install: boppreh/keyboard#563 |
d2c72f2
to
ecde800
Compare
I followed instructions on setting up permissons:
I'm still getting: ERROR: Failed to read device '/dev/input/event11'. You must be in the 'input' group to access global events. Use 'sudo usermod -a -G input USERNAME' to add user to the required group.But it seems to run, so I'm ignoring it. Yes, AutoSplit does pick up my webcam: It seems to list them multiple times. I can't take a screenshot while interacting with the dropdown, but the items are:
For capture methods I have XDisplay and Video Capture Device listed. The entire program does seem very sluggish though. Other things I noticed:
Also getting this error when setting hotkeys:
closing and then redoing it seemed to be fine though. But if i reset focus it happens again. Also closing settings after this seems to prevent settings from reopening. But working through it I can get the hotkeys set. The Select Window seems to be working now when using M64Py emulator instead of the sm64-port binary. I got it to successfully recognize the start image, but unfortunately it seems m64py eats any hotkeys and nothing gets picked up by livesplit-one. :( But that's not an issue for this repo I don't think. |
I get the error message as well. But it seems we can safely ignore it (it's just printed to the console anyway, not actually raised) boppreh/keyboard#312 (comment)
The entire code about capturing AND comparing images still runs on the main thread. So the entire program starts running at the same framerate you can capture frames... (yeah not great ik) (Unless the capture method implements ThreadedCaptureMethod, but that's more of a quick fix) So that probably doesn't help. Doing an actual screencast and only extracting the required frames may also be more efficient than taking screenshots. Btw that's why I had to drop gnome-screenshot support. Since GNOME flashes the screen every, single, time. We'll HAVE to use screencasting for Wayland support. I also need to find a way to capture only the targeted window, rather than the entire desktop + cropping. It's one of the reasons BitBlt (as well as WGC) is so performant on Windows.
Maybe not in this PR, but that's something that will need to be supported. Recovering the window of a game after it was closed (either Save & Quit or it crashed) is an important feature that is currently supported on Windows. If I can replicate I'll create an issue so it's tracked. Do you know what you're doing exactly to get empty hotkeys? Either way I'll tackle it as part of this existing issue: Toufool#155
On Windows I'd say check if you're running the app "as admin" (because an app as admin won't let other apps listen to its keystrokes). I'd bet there's something similar on Linux where you can allow another app to listen. Unless m64py is suppressing the keys. |
b942cac
to
30bb7ba
Compare
8a32716
to
82a4c69
Compare
I'll close this PR as stale. But feel free to update it and re-open it. |
This is work on this branch that will hopefully help improve Linux support. I'm trying to get this to work on my system.
Eventually it would be nice to have proper python packaging, as right now it's just a set of scripts which is unwieldy. It should be entirely possible to set this up through pip and have it be pip installable. See my other projects for how I usually do this.