Skip to content
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

PICARD-558: Initial port to Py3 #664

Merged
merged 62 commits into from Apr 7, 2017
Merged
Changes from 1 commit
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
995ff42
Replace deprecated __builtin__
samj1912 Mar 25, 2017
9e0ee95
Change deprecated xrange to range
samj1912 Mar 30, 2017
236b1d1
Fix dictionary behaviour for py3
samj1912 Mar 30, 2017
e7b0752
Fix astrcmp for new Py3 C API
samj1912 Mar 31, 2017
8834ec3
Fix filter,map and reduce behaviour for py3
samj1912 Mar 31, 2017
96161c7
Fix old division
samj1912 Apr 4, 2017
69fc718
Replace deprecated basestring
samj1912 Apr 4, 2017
dc209a2
Replace deprecated __getslice__
samj1912 Apr 4, 2017
2cf3e04
Replace deprecated __nonzero__
samj1912 Apr 4, 2017
4be5ce8
Replace deprecated file method and rename formats.open to formats.open_
samj1912 Apr 4, 2017
56fa013
Refactor and replace cmp methods
samj1912 Apr 4, 2017
2166108
Replace StringIO with BytesIO
samj1912 Apr 4, 2017
dcd9638
Remove old web browser code
samj1912 Apr 4, 2017
0dc9caf
Fix PY3 unicode
samj1912 Apr 5, 2017
a1e130e
Fix urlparse move
samj1912 Apr 5, 2017
c04237c
Replace unggettext with ngettext
samj1912 Apr 5, 2017
fae429a
Fix py3 super calls
samj1912 Apr 5, 2017
b0fcc9e
Fix test_script
samj1912 Apr 5, 2017
3f9d870
Fix picard.format issues
samj1912 Apr 5, 2017
67f4d27
Fix byte issues
samj1912 Apr 5, 2017
8a6285e
Fix cover art test bytes issue
samj1912 Apr 5, 2017
0b7d7af
Fix bytes/string issue with unpack_image
samj1912 Apr 5, 2017
7a12dd1
Fix comment spacing
samj1912 Apr 5, 2017
a79fb2a
Fix vorbis tag images
samj1912 Apr 5, 2017
6e85e09
Fix apev2 tag images
samj1912 Apr 5, 2017
f5d908b
Fix freeform mp4 tags loading
samj1912 Apr 5, 2017
69251f2
Fix decode error
samj1912 Apr 5, 2017
4824b68
Fix vorbis tags
samj1912 Apr 5, 2017
51041be
Fix test bytes error
samj1912 Apr 5, 2017
c3918b5
Fix asf discnumber tag
samj1912 Apr 5, 2017
70ba56d
Fix text encoding issues
samj1912 Apr 5, 2017
0981ca1
Fix QNetwork response issues with json loads
samj1912 Apr 5, 2017
028369c
Add hashable QTreeWidgetItem
samj1912 Apr 5, 2017
3581372
Fix bytes/string issue
samj1912 Apr 5, 2017
1a06d0a
Update travis config to py3
samj1912 Apr 5, 2017
e4e1c38
Fix bytes issue in makeqrc
samj1912 Apr 5, 2017
1c74954
Update resources
samj1912 Apr 5, 2017
0bcfbe2
Remove useless import and refactor
samj1912 Apr 5, 2017
5ad260a
Remove extra LoC
samj1912 Apr 6, 2017
0a1ded3
Port util.filenaming to py3
samj1912 Apr 6, 2017
a3deb86
Fix bytes issue in sigal send
samj1912 Apr 6, 2017
0a03d3e
Replace ugettext with gettext
samj1912 Apr 6, 2017
460416b
Fix fpcalc output
samj1912 Apr 6, 2017
e5b12b1
Fix acoustid lookups
samj1912 Apr 6, 2017
cb9ea25
Fix imports
samj1912 Apr 6, 2017
2548897
Add a json_load util function for py3 compat issues
samj1912 Apr 6, 2017
b910d0c
Add support for hashable ListWidgetItem
samj1912 Apr 6, 2017
80ec542
Add sorting key for data
samj1912 Apr 6, 2017
93cd519
Fix bytes/string issue with URLs
samj1912 Apr 6, 2017
1d658bb
Add a builtin for handling string coversions
samj1912 Apr 6, 2017
b4d9a65
Add name to author credits
samj1912 Apr 6, 2017
73c1250
Fix bytes/str issue
samj1912 Apr 6, 2017
09b3981
Convert pattern to string
samj1912 Apr 6, 2017
d5ec9a9
Remove deprecated __unicode__
samj1912 Apr 6, 2017
94d13f1
Fix drag and drop for itemviews
samj1912 Apr 6, 2017
e4e62bf
Test against more python qt versions
samj1912 Apr 6, 2017
1e00999
Fix encoding issues in file paths
samj1912 Apr 7, 2017
d9a9c5b
Update flake8 config with new builtins
samj1912 Apr 7, 2017
51d19ce
Remove unnecessary module
samj1912 Apr 7, 2017
8ac37eb
Remove unnecessary imports
samj1912 Apr 7, 2017
9992ade
Fix py3 compatibility
samj1912 Apr 7, 2017
9a35ae7
Update install instructions
samj1912 Apr 7, 2017
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Add hashable QTreeWidgetItem

  • Loading branch information
samj1912 committed Apr 5, 2017
commit 028369ca048c1f59c084182a61f898e88e198419
@@ -18,6 +18,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.


import uuid
from PyQt5 import QtCore, QtWidgets


@@ -27,3 +28,19 @@ class PicardDialog(QtWidgets.QDialog):

def __init__(self, parent=None):
QtWidgets.QDialog.__init__(self, parent, self.flags)


# With py3, QObjects are no longer hashable unless they have
# an explicit __hash__ implemented.
# See: http://python.6.x6.nabble.com/QTreeWidgetItem-is-not-hashable-in-Py3-td5212216.html
class HashableTreeWidgetItem(QtWidgets.QTreeWidgetItem):

This comment has been minimized.

Copy link
@mineo

mineo Apr 6, 2017

Member

This commit and 9ffc73b are really in need of an explanation: neither the class documentation nor the commit message explain why this is necessary. I guess it's because of this?

This comment has been minimized.

Copy link
@zas

zas Apr 7, 2017

Collaborator

Yes, it is. And i agree it deserves a comment in the code.


def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.id = uuid.uuid4()

def __eq__(self, other):
return self.id == other.id

def __hash__(self):
return hash(str(self.id))
@@ -20,7 +20,7 @@
from PyQt5 import QtCore, QtWidgets
from picard import config
from picard.util import webbrowser2
from picard.ui import PicardDialog
from picard.ui import PicardDialog, HashableTreeWidgetItem
from picard.ui.util import StandardButton
from picard.ui.options import (
about,
@@ -57,7 +57,7 @@ def add_pages(self, parent, default_page, parent_item):
pages = [(p.SORT_ORDER, p.NAME, p) for p in self.pages if p.PARENT == parent]
items = []
for foo, bar, page in sorted(pages):
item = QtWidgets.QTreeWidgetItem(parent_item)
item = HashableTreeWidgetItem(parent_item)
item.setText(0, _(page.TITLE))
if page.ACTIVE:
self.item_to_page[item] = page
@@ -30,11 +30,12 @@
USER_PLUGIN_DIR,
PLUGINS_API,
)
from picard.ui import HashableTreeWidgetItem
from picard.ui.options import OptionsPage, register_options_page
from picard.ui.ui_options_plugins import Ui_PluginsOptionsPage


class PluginTreeWidgetItem(QtWidgets.QTreeWidgetItem):
class PluginTreeWidgetItem(HashableTreeWidgetItem):

def __lt__(self, other):
if (not isinstance(other, PluginTreeWidgetItem)):
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.