bk1285 / rpi_wordclock

Software to create a Raspberry Pi based wordclock
GNU General Public License v3.0
214 stars 106 forks source link

Refactor/py3 #175

Closed plotaBot closed 3 years ago

plotaBot commented 3 years ago

Referring to #174 and opening this pull request for discussion Important:

Ierlandfan commented 3 years ago

The developer mode isn't working as it should. The error is

 File "/usr/lib/python3/dist-packages/gi/overrides/__init__.py", line 39, in __getattr__
    return getattr(self._introspection_module, name)
  File "/usr/lib/python3/dist-packages/gi/module.py", line 132, in __getattr__
    self.__name__, name))
AttributeError: 'gi.repository.Pango' object has no attribute 'attr_foreground_new

Browsing through the internet it gave me mixed reports about deprecated, broken and some old function Any ideas?

plotaBot commented 3 years ago

I have updated the description. Is it working now @Ierlandfan?

Ierlandfan commented 3 years ago

No, unfortunately the same error. (I am running Buster and tried Bullseye as well) But I found this repo:

https://gitlab.gnome.org/takluyver/pango-attr-cast

This is a tiny library to make it possible to cast Pango attributes to specific types through GObject introspection. This is not yet possible with Pango itself.

phenze commented 3 years ago

I have updated my fork to python3. Take a look here:

https://github.com/phenze/rpi_wordclock/tree/master-python3

In the readme there is a detailed description what has been changed during installation. Maybe @bk1285 can also have a look at it.

Important Notes:

bk1285 commented 3 years ago

Hi @plotaBot,

just some short feedback: I really appreciate your initiative to move to Py3, making the code base future proof. To keep overhead for testing and update of dependencies + docs as small as possible, I currently plan to merge esp. develop to master first. In a second step, I'll apply your changes to complete the migration.

Best, Bernd

ruedli commented 3 years ago

I am building another 3D printed clock and want to make development and new plugins available. As the installation with python2 looks quite cumbersome, the installation documentaiton is e.g not up-to-date (mentioning to install to latest raspbian image which is buster and not stretch), I am considering to install from scratch and migrate everything to python3. I potentially have 9 new plugins:

Also my stencils are of a different size: 11x12, and existing plugins have been updated to use the configured size (so all plugins now work over all sizes). Some of my stencils (I have 4 new ones) allow time displayed to the minute. One switches stencils (by servo) twice a day to have all hours available.

I am still on the android app (also updated, so it now works smoothly for switching between plugins everywhere.)

For the stencils, I use an easier "recipe" to implement new templates, customizing for different languages is a breeze there.

I am unsure which version to base my pull requests on.

My question is:

bk1285 commented 3 years ago

Hi @ruedli

that sound's very promising. I'm currently working on refactoring and updating the repo. Expect the migration to python3 to be done by end of may (including updated docs).

py3 is definitely the way to go, for keeping the clock future-proof ;)

Best, Bernd

ruedli commented 3 years ago

OK, I'll do a "quick" install of my current software for my new clock, but will wait merging my pull-request after your pi3 merge. I had to do some refactoring, because the stencil logic (which language - so which template to use for displaying) has to be known for displaying the correct time. The sunrise plugin e.g. displays in the language selected.

You might have seen it displayed here already: https://youtu.be/XTHH30S8Aao Since then a lot changed of course. I'll keep an eye on your merge ;-)

Op ma 3 mei 2021 om 17:18 schreef Bernd Krolla @.***>:

Hi @ruedli https://github.com/ruedli

that sound's very promising. I'm currently working on refactoring and updating the repo. Expect the migration to python3 to be done by end of may (including updated docs).

py3 is definitely the way to go, for keeping the clock future-proof ;)

Best, Bernd

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bk1285/rpi_wordclock/pull/175#issuecomment-831328925, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGGYOEIK7GM6MOE47EG2STTL25FLANCNFSM4UDXWDBA .

-- Ruud Rademaker prefered mail: @.***

bk1285 commented 3 years ago

Hi @plotaBot, how did you resolve the dependency from freetype, which seems not to be available for py3 via pip3?

Best, Bernd

ruedli commented 3 years ago

Hi Bernd,

I stayed on python2, until it was converted. However, when I check GitHub https://github.com/rougier/freetype-py, and look at the issues, it says that python2 support is dropped. See the conversation of

137.

So... I would expect it to work on python3 and not python2.

Hope this helps, I am struggling to get my 12x11 clock working, maybe hardware issues...

Cheers

Ruud

On Fri, 21 May 2021 at 00:01, Bernd Krolla @.***> wrote:

Hi @plotaBot https://github.com/plotaBot, how did you resolve the dependency from freetype, which seems not to be available for py3 via pip3?

Best, Bernd

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bk1285/rpi_wordclock/pull/175#issuecomment-845505853, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGGYOAYGXF2FWSC77PPYGDTOWBE5ANCNFSM4UDXWDBA .

-- Ruud Rademaker prefered mail: @.***

bk1285 commented 3 years ago

Review + updates of this is WIP. ... no way back to py2 ;)

ruedli commented 3 years ago

@bk1285 I would try this, but its release state and "what to access" is unclear. Is it available? Is it merged to stable / complete? Is there a lag? Are there new installation instructions? I don't mind not going back to py2, but is it working now on py3?

plotaBot commented 3 years ago

Hi @plotaBot, how did you resolve the dependency from freetype, which seems not to be available for py3 via pip3?

Best, Bernd

I am not quite sure right now. I have to check this on my other machine. One year is a long time to remember all these details of refactoring. But one thing I do remeber is that I mainly used the tool provided in the python docs which helped a lot transforming the code

bk1285 commented 3 years ago

Hey @plotaBot,

finally, I reviewed your PR and applied some patches from my side to comply with the changes, made meanwhile.

However I had to merge your commits into develop: Merging into master was not possible, since the docs are still quite experimental. I'll update them asap.

Merging into develop -- however -- unfortunately implies to close (instead of merge) your PR, even so your changes become part of master soon... Anyways: Thanks for contributing!

Regards, Bernd

ruedli commented 3 years ago

@bk1285 That is great news, I should try the devel branch. Did you label it? did you install all the latest packages compatible to python3? What is the list? Any exceptions / patches needed?

plotaBot commented 2 years ago

Hi @plotaBot, how did you resolve the dependency from freetype, which seems not to be available for py3 via pip3?

Best, Bernd

Sorry for the late reply on this issue. Because I had to search for the harddrive where all this work was on.... If it is still of interest: I had no problems installing freetype -py (attached screenshot shows current version and all the codes were happy with it). Were you able to resolve this in your installation? Screenshot from 2021-07-25 11-30-57 Screenshot from 2021-07-25 11-49-07