mirror of
https://github.com/arsenetar/dupeguru.git
synced 2026-01-22 14:41:39 +00:00
Converted to py3k. There's probably some bugs still. So far, I managed to run dupeGuru SE under pyobjc and qt.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.hardcoded.net/licenses/hs_license
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import logging
|
||||
import os
|
||||
@@ -54,7 +54,7 @@ class DupeGuru(DupeGuruBase, QObject):
|
||||
DELTA_COLUMNS = frozenset()
|
||||
|
||||
def __init__(self, data_module, appid):
|
||||
appdata = unicode(QDesktopServices.storageLocation(QDesktopServices.DataLocation))
|
||||
appdata = str(QDesktopServices.storageLocation(QDesktopServices.DataLocation))
|
||||
if not op.exists(appdata):
|
||||
os.makedirs(appdata)
|
||||
# For basicConfig() to work, we have to be sure that no logging has taken place before this call.
|
||||
@@ -120,7 +120,7 @@ class DupeGuru(DupeGuruBase, QObject):
|
||||
#--- Override
|
||||
@staticmethod
|
||||
def _open_path(path):
|
||||
url = QUrl.fromLocalFile(unicode(path))
|
||||
url = QUrl.fromLocalFile(str(path))
|
||||
QDesktopServices.openUrl(url)
|
||||
|
||||
@staticmethod
|
||||
@@ -150,7 +150,7 @@ class DupeGuru(DupeGuruBase, QObject):
|
||||
opname = 'copy' if copy else 'move'
|
||||
title = "Select a directory to {0} marked files to".format(opname)
|
||||
flags = QFileDialog.ShowDirsOnly
|
||||
destination = unicode(QFileDialog.getExistingDirectory(self.main_window, title, '', flags))
|
||||
destination = str(QFileDialog.getExistingDirectory(self.main_window, title, '', flags))
|
||||
if not destination:
|
||||
return
|
||||
recreate_path = self.prefs.destination_type
|
||||
|
||||
@@ -52,9 +52,9 @@ class DirectoriesDialog(QDialog, Ui_DirectoriesDialog):
|
||||
# label = 'Remove' if node.parent is None else 'Exclude'
|
||||
|
||||
def addButtonClicked(self):
|
||||
title = u"Select a directory to add to the scanning list"
|
||||
title = "Select a directory to add to the scanning list"
|
||||
flags = QFileDialog.ShowDirsOnly
|
||||
dirpath = unicode(QFileDialog.getExistingDirectory(self, title, self.lastAddedFolder, flags))
|
||||
dirpath = str(QFileDialog.getExistingDirectory(self, title, self.lastAddedFolder, flags))
|
||||
if not dirpath:
|
||||
return
|
||||
self.lastAddedFolder = dirpath
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.hardcoded.net/licenses/hs_license
|
||||
|
||||
import urllib
|
||||
import urllib.parse
|
||||
|
||||
from PyQt4.QtCore import QModelIndex, Qt, QRect, QEvent, QPoint, QUrl
|
||||
from PyQt4.QtGui import (QComboBox, QStyledItemDelegate, QMouseEvent, QApplication, QBrush, QStyle,
|
||||
@@ -101,9 +101,9 @@ class DirectoriesModel(TreeModel):
|
||||
if not mimeData.hasFormat('text/uri-list'):
|
||||
return False
|
||||
data = str(mimeData.data('text/uri-list'))
|
||||
unquoted = urllib.unquote(data)
|
||||
urls = unicode(unquoted, 'utf-8').split('\r\n')
|
||||
paths = [unicode(QUrl(url).toLocalFile()) for url in urls if url]
|
||||
unquoted = urllib.parse.unquote(data)
|
||||
urls = str(unquoted, 'utf-8').split('\r\n')
|
||||
paths = [str(QUrl(url).toLocalFile()) for url in urls if url]
|
||||
for path in paths:
|
||||
self.model.add_directory(path)
|
||||
self.reset()
|
||||
|
||||
@@ -16,10 +16,10 @@ from hsutil.misc import nonone
|
||||
|
||||
from core.app import NoScannableFileError, AllFilesAreRefError
|
||||
|
||||
import dg_rc
|
||||
from main_window_ui import Ui_MainWindow
|
||||
from results_model import ResultsModel
|
||||
from stats_label import StatsLabel
|
||||
from . import dg_rc
|
||||
from .main_window_ui import Ui_MainWindow
|
||||
from .results_model import ResultsModel
|
||||
from .stats_label import StatsLabel
|
||||
|
||||
class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
def __init__(self, app):
|
||||
@@ -104,7 +104,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
h = self.resultsView.header()
|
||||
h.setResizeMode(QHeaderView.Interactive)
|
||||
prefs = self.app.prefs
|
||||
attrs = zip(prefs.columns_width, prefs.columns_visible)
|
||||
attrs = list(zip(prefs.columns_width, prefs.columns_visible))
|
||||
for index, (width, visible) in enumerate(attrs):
|
||||
h.resizeSection(index, width)
|
||||
h.setSectionHidden(index, not visible)
|
||||
@@ -145,7 +145,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
answer, ok = QInputDialog.getText(self, title, msg, QLineEdit.Normal, text)
|
||||
if not ok:
|
||||
return
|
||||
answer = unicode(answer)
|
||||
answer = str(answer)
|
||||
self.app.apply_filter(answer)
|
||||
self._last_filter = answer
|
||||
|
||||
|
||||
@@ -11,10 +11,10 @@ import logging
|
||||
import sys
|
||||
|
||||
if sys.platform == 'win32':
|
||||
from platform_win import *
|
||||
from .platform_win import *
|
||||
elif sys.platform == 'darwin':
|
||||
from platform_osx import *
|
||||
from .platform_osx import *
|
||||
elif sys.platform == 'linux2':
|
||||
from platform_lnx import *
|
||||
from .platform_lnx import *
|
||||
else:
|
||||
pass # unsupported platform
|
||||
|
||||
@@ -7,5 +7,5 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.hardcoded.net/licenses/hs_license
|
||||
|
||||
INITIAL_FOLDER_IN_DIALOGS = u'/'
|
||||
INITIAL_FOLDER_IN_DIALOGS = '/'
|
||||
HELP_PATH = '/usr/local/share/dupeguru_{0}/help'
|
||||
|
||||
@@ -9,5 +9,5 @@
|
||||
|
||||
# dummy unit to allow the app to run under OSX during development
|
||||
|
||||
INITIAL_FOLDER_IN_DIALOGS = u'/'
|
||||
INITIAL_FOLDER_IN_DIALOGS = '/'
|
||||
HELP_PATH = ''
|
||||
|
||||
@@ -7,5 +7,5 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.hardcoded.net/licenses/hs_license
|
||||
|
||||
INITIAL_FOLDER_IN_DIALOGS = u'C:\\'
|
||||
INITIAL_FOLDER_IN_DIALOGS = 'C:\\'
|
||||
HELP_PATH = 'help'
|
||||
|
||||
@@ -112,7 +112,7 @@ class ResultsModel(TreeModel):
|
||||
return True
|
||||
if role == Qt.EditRole:
|
||||
if index.column() == 0:
|
||||
value = unicode(value.toString())
|
||||
value = str(value.toString())
|
||||
return self.model.rename_selected(value)
|
||||
return False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user