Drop python2 support. #35

Merged
SlavekB merged 1 commits from feat/drop-python2 into master 1 year ago
SlavekB commented 1 year ago
Owner

Update for PyTQt.

Although my experience with Python is small, I hope that conversions using 2to3 and subsequent adjustments of the code are fine.

Update for PyTQt. Although my experience with Python is small, I hope that conversions using 2to3 and subsequent adjustments of the code are fine.
SlavekB added 1 commit 1 year ago
8e7e2f5893
Drop python2 support.
SlavekB added this to the R14.1.0 release milestone 1 year ago
SlavekB requested review from MicheleC 1 year ago
MicheleC requested changes 1 year ago
MicheleC left a comment
Owner

Some corrections required related to string.contains.

Some corrections required related to string.contains.
print("[Alarm Script] Received notification: " + str( string ))
if string.contains( "configure" ):
if "configure" in string:
Owner

This seems wrong. string is a TQString object, so the call to contains actually calls the TQString method with the same name through C++ extension. I don't think we should change this line.
It may also be a good idea to rename string to something else, since it could be confused with the string python2 object.

This seems wrong. `string` is a `TQString` object, so the call to `contains` actually calls the TQString method with the same name through C++ extension. I don't think we should change this line. It may also be a good idea to rename `string` to something else, since it could be confused with the `string` python2 object.
debug( "Received notification: " + str( string ) )
if string.contains( "configure" ):
if "configure" in string:
Owner

As before, this line shoud not be changed. Some for subsequent cotains calls in the following few lines.

As before, this line shoud not be changed. Some for subsequent `cotains` calls in the following few lines.
debug( "Received notification: " + str( string ) )
if string.contains( "configure" ):
if "configure" in string:
Owner

As per previous comments, replacing the calls to contains seems wrong.

As per previous comments, replacing the calls to `contains` seems wrong.
debug( "Received notification: " + str( string ) )
if string.contains( "configure" ):
if "configure" in string:
Owner

As before, replacing contains seems wrong.

As before, replacing `contains` seems wrong.
SlavekB reviewed 1 year ago
elif string.contains( "customMenuClicked" ):
elif "customMenuClicked" in string:
if "selected" in string:
SlavekB commented 1 year ago
Poster
Owner

Thank you for the comment on string that is TQstring object – I did not realize that in this case contains(...) is the call of the TQString object method and there is no need to change it.

However, you may notice that in the original code the same use of "something" in string has previously been in other places, such as this. It seems that both ways can work. Perhaps it would be good for the same way to be used in all cases.

Thank you for the comment on `string` that is `TQstring` object – I did not realize that in this case `contains(...)` is the call of the TQString object method and there is no need to change it. However, you may notice that in the original code the same use of `"something" in string` has previously been in other places, such as this. It seems that both ways can work. Perhaps it would be good for the same way to be used in all cases.
Owner

I did a test to see if things could work or not. It seems that both ways work fine.

# python
>>> from PyTQt.qt import *
>>> string = TQString("Hello world")
>>> string.contains("Hello")
1
>>> string.contains("Hello1")
0
>>> "Hello" in string
True
>>> "Hello1" in string
False
>>> quit()

So we could probably merge the PR as is now.

I did a test to see if things could work or not. It seems that both ways work fine. ``` # python >>> from PyTQt.qt import * >>> string = TQString("Hello world") >>> string.contains("Hello") 1 >>> string.contains("Hello1") 0 >>> "Hello" in string True >>> "Hello1" in string False >>> quit() ``` So we could probably merge the PR as is now.
SlavekB commented 1 year ago
Poster
Owner

PR is already updated to use eventStr.contains(...) in all cases 😉

PR is already updated to use `eventStr.contains(...)` in all cases 😉
Owner

Yes, I hadn't noticed the new commit before my previous comment, but just reviewed it now :-)

Yes, I hadn't noticed the new commit before my previous comment, but just reviewed it now :-)
MicheleC marked this conversation as resolved
SlavekB force-pushed feat/drop-python2 from 8e7e2f5893 to 9be5499101 1 year ago
MicheleC approved these changes 1 year ago
MicheleC left a comment
Owner

Looks good.

Looks good.
SlavekB merged commit 9be5499101 into master 1 year ago
SlavekB deleted branch feat/drop-python2 1 year ago

Reviewers

MicheleC approved these changes 1 year ago
The pull request has been merged as 9be5499101.
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: TDE/amarok#35
Loading…
There is no content yet.