-
Notifications
You must be signed in to change notification settings - Fork 68
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
Proof of concept for a minimal PyQt5 UI #460
base: main
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #460 +/- ##
==========================================
+ Coverage 63.11% 64.69% +1.57%
==========================================
Files 33 31 -2
Lines 4574 4002 -572
==========================================
- Hits 2887 2589 -298
+ Misses 1687 1413 -274
Continue to review full report at Codecov.
|
pelita/libpelita.py
Outdated
@@ -399,7 +399,9 @@ def channel_setup(publish_to=None, reply_to=None): | |||
yield { "publisher": publisher, "controller": controller } | |||
|
|||
|
|||
def run_external_viewer(subscribe_sock, controller, geometry, delay): | |||
def run_external_viewer(subscribe_sock, controller, geometry, delay, viewer=None, export=None): | |||
if viewer == None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if viewer is None
is the Pythonic way. ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I usually write is None
but patching this method was such a bad hack already that I mentally blacked out that thing I guess. :)
So cool! The pink food is a critical feature. =D I'm impressed with the brevity of the code. I think if you can paint a proper maze (this could be done by painting a brick pattern, or just making black squares of enough size), it's worth merging. |
Yeah, painting the maze properly is not much of a issue but I will have to look into implementing some caching for that. Currently it does a live redraw which will probably be slower if we have some connected walls (simple bricks don’t look good – there must be some common outline). Qt comes with built-in scaling and transformations so we don’t have to write it. Apart from that it is not too different from the Tk version actually. Just more minimal. :) |
if export: | ||
png_export_path = Path(export) | ||
if not png_export_path.is_dir(): | ||
raise RuntimeError("Not a directory: {png_export_path}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this get formatted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s a commit named ‘WIP’. This will be rebased eventually. Sorry for the noise. ;)
75f1438
to
7baa6b0
Compare
Features:
--export
cmd arg)It’s just a proof of concept and I don’t expect this to be merged or be used as the standard client. Tk is more on the batteries-included side of things and probably more tested. Also, the license of PyQt5 is GPL so we might want to keep it separate. However, we might use it as a base for exporting pngs in a proper and convenient way.