1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2026-01-25 16:11:39 +00:00

Compare commits

...

6 Commits

10 changed files with 56 additions and 19 deletions

View File

@@ -45,3 +45,4 @@ ca93352ce35184853ad9fcb881935a43a8b1e249 me5.10.3
f1d40b556c01f32c58f9ef9f9acac5b78e01ba7a pe2.0.0 f1d40b556c01f32c58f9ef9f9acac5b78e01ba7a pe2.0.0
2fd901a516f8cb6b4438491f63f2ebfd52a57c13 me6.0.0 2fd901a516f8cb6b4438491f63f2ebfd52a57c13 me6.0.0
ff43c6d9feb388f103b7857eaa6f7809185f78ec before-pluginbuilder ff43c6d9feb388f103b7857eaa6f7809185f78ec before-pluginbuilder
d274bcb98f2d02b86470a04cd62e718eff33b74f pe2.1.0

View File

@@ -16,12 +16,12 @@ STATE_ORDER = [STATE_NORMAL, STATE_REFERENCE, STATE_EXCLUDED]
# Lazily loads children # Lazily loads children
class DirectoryNode(Node): class DirectoryNode(Node):
def __init__(self, app, path, name): def __init__(self, tree, path, name):
Node.__init__(self, name) Node.__init__(self, name)
self._app = app self._tree = tree
self._directory_path = path self._directory_path = path
self._loaded = False self._loaded = False
self._state = STATE_ORDER.index(self._app.directories.get_state(path)) self._state = STATE_ORDER.index(self._tree.app.directories.get_state(path))
def __len__(self): def __len__(self):
if not self._loaded: if not self._loaded:
@@ -30,9 +30,9 @@ class DirectoryNode(Node):
def _load(self): def _load(self):
self.clear() self.clear()
subpaths = self._app.directories.get_subfolders(self._directory_path) subpaths = self._tree.app.directories.get_subfolders(self._directory_path)
for path in subpaths: for path in subpaths:
self.append(DirectoryNode(self._app, path, path[-1])) self.append(DirectoryNode(self._tree, path, path[-1]))
self._loaded = True self._loaded = True
# The state propery is an index to the combobox # The state propery is an index to the combobox
@@ -46,7 +46,9 @@ class DirectoryNode(Node):
return return
self._state = value self._state = value
state = STATE_ORDER[value] state = STATE_ORDER[value]
self._app.directories.set_state(self._directory_path, state) self._tree.app.directories.set_state(self._directory_path, state)
self._tree._refresh()
self._tree.view.refresh()
class DirectoryTree(GUIObject, Tree): class DirectoryTree(GUIObject, Tree):
@@ -62,7 +64,7 @@ class DirectoryTree(GUIObject, Tree):
def _refresh(self): def _refresh(self):
self.clear() self.clear()
for path in self.app.directories: for path in self.app.directories:
self.append(DirectoryNode(self.app, path, str(path))) self.append(DirectoryNode(self, path, str(path)))
def add_directory(self, path): def add_directory(self, path):
self.app.add_directory(path) self.app.add_directory(path)

View File

@@ -462,3 +462,31 @@ class TestCaseDupeGuru_renameSelected:
assert 'foo bar 2' in names assert 'foo bar 2' in names
eq_(g.dupes[0].name, 'foo bar 2') eq_(g.dupes[0].name, 'foo bar 2')
class TestAppWithDirectoriesInTree:
def pytest_funcarg__do_setup(self, request):
tmpdir = request.getfuncargvalue('tmpdir')
p = Path(str(tmpdir))
io.mkdir(p + 'sub1')
io.mkdir(p + 'sub2')
io.mkdir(p + 'sub3')
self.app = DupeGuru()
self.dtree_gui = CallLogger()
self.dtree = DirectoryTree(self.dtree_gui, self.app)
self.dtree.connect()
self.dtree.add_directory(p)
self.dtree_gui.clear_calls()
def test_set_root_as_ref_makes_subfolders_ref_as_well(self, do_setup):
# Setting a node state to something also affect subnodes. These subnodes must be correctly
# refreshed.
node = self.dtree[0]
eq_(len(node), 3) # a len() call is required for subnodes to be loaded
subnode = node[0]
node.state = 1 # the state property is a state index
node = self.dtree[0]
eq_(len(node), 3)
subnode = node[0]
eq_(subnode.state, 1)
self.dtree_gui.check_gui_calls(['refresh'])

View File

@@ -1,2 +1,2 @@
__version__ = '3.0.1' __version__ = '3.0.2'
__appname__ = 'dupeGuru' __appname__ = 'dupeGuru'

View File

@@ -8,5 +8,5 @@ Homepage: http://www.hardcoded.net
Package: dupeguru-me Package: dupeguru-me
Architecture: any Architecture: any
Depends: python3 (>= 3.1) Depends: python3.1
Description: dupeGuru Music Edition Description: dupeGuru Music Edition

View File

@@ -8,5 +8,5 @@ Homepage: http://www.hardcoded.net
Package: dupeguru-pe Package: dupeguru-pe
Architecture: any Architecture: any
Depends: python3 (>= 3.1) Depends: python3.1
Description: dupeGuru Picture Edition Description: dupeGuru Picture Edition

View File

@@ -8,5 +8,5 @@ Homepage: http://www.hardcoded.net
Package: dupeguru-se Package: dupeguru-se
Architecture: any Architecture: any
Depends: python3 (>= 3.1) Depends: python3.1
Description: dupeGuru Description: dupeGuru

View File

@@ -1,3 +1,13 @@
=== 3.0.2 (2011-03-16)
* Fixed crash after removing marked dupes. (#140)
* Fixed crash on error handling. [Windows] (#144)
* Fixed crash on copy/move. [Windows] (#148)
* Fixed crash when launching dupeGuru from a very long folder name. [Mac OS X] (#119)
* Fixed a refresh bug in directory panel. (#153)
* Improved reliability of the "Send to Trash" operation. [Linux]
* Tweaked Fairware reminders.
=== 3.0.1 (2011-01-27) === 3.0.1 (2011-01-27)
* Restored the context menu which had been broken in 3.0.0. [Mac OS X] (#133) * Restored the context menu which had been broken in 3.0.0. [Mac OS X] (#133)

View File

@@ -8,8 +8,8 @@
import urllib.parse import urllib.parse
from PyQt4.QtCore import pyqtSignal, Qt, QRect, QEvent, QPoint, QUrl from PyQt4.QtCore import pyqtSignal, Qt, QRect, QUrl
from PyQt4.QtGui import (QComboBox, QStyledItemDelegate, QMouseEvent, QApplication, QBrush, QStyle, from PyQt4.QtGui import (QComboBox, QStyledItemDelegate, QApplication, QBrush, QStyle,
QStyleOptionComboBox, QStyleOptionViewItemV4) QStyleOptionComboBox, QStyleOptionViewItemV4)
from hscommon.trans import tr from hscommon.trans import tr
@@ -47,11 +47,7 @@ class DirectoriesDelegate(QStyledItemDelegate):
def setEditorData(self, editor, index): def setEditorData(self, editor, index):
value = index.model().data(index, Qt.EditRole) value = index.model().data(index, Qt.EditRole)
editor.setCurrentIndex(value); editor.setCurrentIndex(value);
press = QMouseEvent(QEvent.MouseButtonPress, QPoint(0, 0), Qt.LeftButton, Qt.LeftButton, Qt.NoModifier) editor.showPopup()
release = QMouseEvent(QEvent.MouseButtonRelease, QPoint(0, 0), Qt.LeftButton, Qt.LeftButton, Qt.NoModifier)
QApplication.sendEvent(editor, press)
QApplication.sendEvent(editor, release)
# editor.showPopup() # this causes a weird glitch. the ugly workaround is above.
def setModelData(self, editor, model, index): def setModelData(self, editor, model, index):
value = editor.currentIndex() value = editor.currentIndex()

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python3 #!/usr/bin/env python3.1
# Copyright 2010 Hardcoded Software (http://www.hardcoded.net) # Copyright 2010 Hardcoded Software (http://www.hardcoded.net)
# #
# This software is licensed under the "BSD" License as described in the "LICENSE" file, # This software is licensed under the "BSD" License as described in the "LICENSE" file,