Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scale pyrdp-player replays with window height #208

Merged
merged 20 commits into from
Apr 15, 2020
Merged

Conversation

Res260
Copy link
Collaborator

@Res260 Res260 commented Apr 9, 2020

image

image

Works ONLY on replays, not on the live player tab (because I was too scared to commit to testing the whole session takeover feature to be bug free).

Right now, I will keep it as a draft because it is the default option, but I want to have a checkbox where we can choose to scale or not.

EDIT: Checkbox has been implemented, images updated

Also maximizes pyrdp-player upon launch

Fixes #101

@Res260 Res260 marked this pull request as ready for review April 9, 2020 01:39
@Res260 Res260 requested review from alxbl and obilodeau April 9, 2020 01:39
Copy link
Collaborator

@alxbl alxbl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very cool PR. Thanks for taking the time to work on this!

My only critique is that you seem to be ignoring the concept of parent widgets in Qt. I have a feeling that if we are properly setting the widget chain (MainWindow -> ReplayWindow -> ReplayTab), then the onResize events from Qt would propagate throughout the widget tree and avoid all of the need for this observable code and manual event dispatching. I am not sure, but I know a lot of GUI frameworks work like that, so if you can test it, it would be nice and greatly simplify the code.

If having parent widgets introduces other bugs, I am willing to accept this implementation first and iron out the bugs/refactor to be more idiomatic Qt later down the road.

pyrdp/player/ReplayTab.py Outdated Show resolved Hide resolved
pyrdp/player/ReplayWindow.py Outdated Show resolved Hide resolved
@Res260
Copy link
Collaborator Author

Res260 commented Apr 9, 2020

This is a very cool PR. Thanks for taking the time to work on this!

My only critique is that you seem to be ignoring the concept of parent widgets in Qt. I have a feeling that if we are properly setting the widget chain (MainWindow -> ReplayWindow -> ReplayTab), then the onResize events from Qt would propagate throughout the widget tree and avoid all of the need for this observable code and manual event dispatching. I am not sure, but I know a lot of GUI frameworks work like that, so if you can test it, it would be nice and greatly simplify the code.

If having parent widgets introduces other bugs, I am willing to accept this implementation first and iron out the bugs/refactor to be more idiomatic Qt later down the road.

I'll try and test this today and report back. I didnt think the resize events would propagate, but havent tested

@Res260
Copy link
Collaborator Author

Res260 commented Apr 9, 2020

It should be a better implementation now. It doesnt use the parent concept, but it is way cleaner still.

pyrdp/player/ReplayThread.py Outdated Show resolved Hide resolved
pyrdp/player/ReplayWindow.py Outdated Show resolved Hide resolved
…aking another blank one.

This removes the need to seek upon changing the scale and greatly improves
rescaling performance.
pyrdp/player/MainWindow.py Outdated Show resolved Hide resolved
pyrdp/ui/qt.py Outdated Show resolved Hide resolved
pyrdp/ui/qt.py Outdated Show resolved Hide resolved
pyrdp/ui/qt.py Outdated Show resolved Hide resolved
pyrdp/ui/qt.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@alxbl alxbl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Good work :)

Copy link
Member

@obilodeau obilodeau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A very precise change that has an important user-visible impact. Good work!

You can ignore most of my comments, they are more meant as a "watch out for next time" rather than a "change this or I won't merge".

I'm going to merge this in the next few minutes.

Note that I can't apply to a diff section:

  • pyrdp/ui/qt.py has diverged from the rpdy days and should now carry both project's headers

Comment on lines -10 to 15
# installed properly. Do not re-order.
import asyncio # noqa
# installed properly. ***DO NOT RE-ORDER***.
import asyncio # noqa

from twisted.internet import asyncioreactor

asyncioreactor.install(asyncio.get_event_loop())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really?... 😒

pyrdp/player/MainWindow.py Outdated Show resolved Hide resolved
pyrdp/player/ReplayTab.py Outdated Show resolved Hide resolved
@@ -44,41 +44,41 @@ def __init__(self, replay: Replay):
self.lastSeekTime = 0
self.requestedSpeed = 1
self.replay = replay
self.timer = Timer()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were these changes really necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was in my previous implementation. I forgot to completely revert this change after I changed the implementation, so no they were not necessary.

Comment on lines +27 to -29
import rle
from io import BytesIO

import rle
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: rle is not an stdlib module. Your import organizer is broken and you shouldn't have made that change.

@@ -151,7 +163,6 @@ def runOnMainThread(self, target: callable):
@property
def screen(self):
return self._buffer

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what this is doing here given your taste to reindent and add new lines to things 😉

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PEP8 :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pep8-wat

No empty lines between a property and a method? This is PEP8?

Copy link
Collaborator Author

@Res260 Res260 Apr 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

~I missed this one :( ~

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm now ashamed of myself

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't be

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha it was mostly a joke

@obilodeau obilodeau merged commit 07dc800 into master Apr 15, 2020
@obilodeau obilodeau deleted the replay_scaling branch August 6, 2021 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Player should support window scaling
3 participants