pelita icon indicating copy to clipboard operation
pelita copied to clipboard

Proof of concept for a minimal PyQt5 UI

Open Debilski opened this issue 8 years ago • 4 comments

Features:

  • zmq polling in a separate thread (in the single-threaded Tk we have to query every few milliseconds whether new data has arrived)
  • proper anti-aliasing on Linux and macOS (not tested on Windows yet)
  • the possibility for a useful png export (currently behind the --export cmd arg)
  • cubic bezier curves for the ghosts
  • pink food
  • longer startup times
  • no buttons (I did not bother to create them until now and also Qt buttons are slightly in the uncanny valley on macOS)

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.

image

Debilski avatar Mar 06 '18 22:03 Debilski

Codecov Report

Merging #460 into master will increase coverage by 1.57%. The diff coverage is 7.5%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
pelita/scripts/pelita_qtviewer.py 0% <0%> (ø)
pelita/scripts/pelita_tkviewer.py 0% <0%> (ø) :arrow_up:
pelita/libpelita.py 57.67% <20%> (+4.41%) :arrow_up:
pelita/scripts/pelita_main.py 33.82% <33.33%> (+33.82%) :arrow_up:
pelita/utils/__init__.py 50% <0%> (-38.89%) :arrow_down:
pelita/scripts/pelita_player.py 82.45% <0%> (-5.57%) :arrow_down:
pelita/player/FoodEatingPlayer.py 81.81% <0%> (-4.55%) :arrow_down:
pelita/player/SmartEatingPlayer.py 84.61% <0%> (-3.85%) :arrow_down:
pelita/player/__init__.py 100% <0%> (ø) :arrow_up:
pelita/ui/tk_canvas.py 0% <0%> (ø) :arrow_up:
... and 16 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 2665f13...7baa6b0. Read the comment docs.

codecov-io avatar Mar 06 '18 22:03 codecov-io

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.

jni avatar Mar 07 '18 22:03 jni

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. :)

Debilski avatar Mar 07 '18 23:03 Debilski

Hmm, I think we should have some shading for the wall background (or more fluid lines). Otherwise it just looks too similar to the Berkeley one. image

image (http://ai.berkeley.edu/contest.html)

Debilski avatar Mar 11 '18 23:03 Debilski