Repository navigation
First try to adopt Python3 and PyQt5 - #47
Conversation
|
Hey Huluti, What would you say are the main benefits of switching to py3 and pyQt5? It's been a while since I worked on Trimage so would like to err on the side of "if it ain't broken..." |
|
(aside from the obvious: we'll want to upgrade eventually, and it cleans up a whole bunch of code, nice!) |
|
In my opinion, the best benefit is to ensure the existence of Trimage in the future when python 2 and qt 4 will be removed from the distribution directories. The work on the repo does not mean to release a new version, it can take some time before leaving an update to be sure of its quality. I am ready to help to make this possible. |
|
Did that convince you? |
|
yes, it's a good reason :) |
|
https://www.phoronix.com/scan.php?page=news_item&px=Ubuntu-Python-2-Demotion I think that my code is ready, could you find time to test it and merge it ? |
|
Will do! |
|
@Kilian any news? ;) |
|
I've been busy outside of OS, sorry! I'll get to this in the near future, thanks for the reminder. |
|
I tried to run it. After getting the pyqt5 bindings for python 3, I quickly ran into this issue: [kilian:...nal/trimage/python3/Trimage]$ python3 src/trimage/trimage.py
Traceback (most recent call last):
File "src/trimage/trimage.py", line 18, in <module>
from filesize import *
File "/home/kilian/workspace/personal/trimage/python3/Trimage/src/trimage/filesize/__init__.py", line 1, in <module>
from filesize import traditional, alternative, verbose, iec, si, size
ImportError: cannot import name 'traditional'
[kilian:...nal/trimage/python3/Trimage]$ Does that work for you? I have very little experience with python3 (and haven't touch python in general in many years) so I have no clue on why this works in py2 and not in py3 |
|
I'm looking at it and I can not get it to work anymore ... I look at what I can do;) |
|
Should be fixed ;) |
|
It starts, but there are three issues I see: 1 functionality is broken. We use generators and calling next changed, so this needs to be updated: -- a/src/trimage/trimage.py
+++ b/src/trimage/trimage.py
@@ -171,8 +171,8 @@ class StartQT5(QMainWindow):
delegatorlist = []
for fullpath in images:
try: # recompress images already in the list
- image = (i.image for i in self.imagelist
- if i.image.fullpath == fullpath).__next__()
+ image = next(i.image for i in self.imagelist
+ if i.image.fullpath == fullpath)
if image.compressed:
image.reset()
image.recompression = True2 some filenames seems to give errors: Traceback (most recent call last):
File "src/trimage/trimage.py", line 334, in data
data = self.imagelist[index.row()][index.column()]
File "src/trimage/trimage.py", line 389, in __getitem__
return self.d[key](self.image)
File "src/trimage/trimage.py", line 357, in <lambda>
'shortname': lambda i: self.statusStr() % i.shortname,
After this lands, the |
|
1 - So, what you've write is the correct solution that I have to add? 2 - What sort of filenames? Do you have examples? 3 - Strange because it seems that pyqt5 uses native dialogs by default... I'm not an expert in packaging for debian but I can get a look 😃 |
|
any updates? on debian they are planning to remove it because is not working anymore |
|
Just to let you know, trimage is listed on https://wiki.debian.org/Qt4Removal and we are killing Qt4-related applications one by one in Debian (as well as in Ubuntu). |
|
I'll try to work on the PR today. |
determinetype functions has some defaults
|
@Kilian for me all seems to work when launched with: It works for me with the setup.py too: |
|
@hosiet any thing to do to have Trimage 1.0.6 updated in Debian? |
|
First of all, Debian is now in deep freeze state preparing for the release of Debian 10; no new version could be uploaded at this moment. Secondly I'm not the maintainer of trimage in Debian; the maintainer is the team pkg-phototools-devel@lists.alioth.debian.org and Kilian Valkhof kilian@kilianvalkhof.com . I guess I'll contact them using email first. |
Here's my first bytes to adopt Python3 and PyQt5 in order to modernize this very useful application.
@Kilian Are you interested in this approach?
Here's the TODO that will be updated:
Find all possible regressions and missing changes.I've also move the TODO file to the root directory for more visibility (standard practice) and convert it and the README files in markdown.
It seems to works quite well. I let you test these changes and give me advices. If you want to commit directly in my fork to update this PR, don't hesitate ;).