1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2026-01-22 06:37:17 +00:00

Updated hscommon to its tip.

Because the latest changes in hscommon include the introduction of a base GUIObject which significantly changes view setting mechanisms, significant adjustments had to be made in dupeGuru.
This commit is contained in:
Virgil Dupras
2012-03-13 14:27:08 -04:00
parent 878c744c21
commit 49a7043b4d
11 changed files with 56 additions and 60 deletions

View File

@@ -9,10 +9,9 @@
from hscommon.notify import Listener
from hscommon.gui.base import NoopGUI
class GUIObject(Listener):
class DupeGuruGUIObject(Listener):
def __init__(self, app):
Listener.__init__(self, app)
self.view = NoopGUI()
self.app = app
def directories_changed(self):

View File

@@ -6,15 +6,16 @@
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/bsd_license
from .base import GUIObject
from hscommon.gui.base import GUIObject
from .base import DupeGuruGUIObject
class DetailsPanel(GUIObject):
class DetailsPanel(GUIObject, DupeGuruGUIObject):
def __init__(self, app):
GUIObject.__init__(self, app)
GUIObject.__init__(self)
DupeGuruGUIObject.__init__(self, app)
self._table = []
def connect(self):
GUIObject.connect(self)
def _view_updated(self):
self._refresh()
self.view.refresh()

View File

@@ -9,7 +9,7 @@
from hscommon.gui.tree import Tree, Node
from ..directories import DirectoryState
from .base import GUIObject
from .base import DupeGuruGUIObject
STATE_ORDER = [DirectoryState.Normal, DirectoryState.Reference, DirectoryState.Excluded]
@@ -54,17 +54,16 @@ class DirectoryNode(Node):
self._tree.update_all_states()
class DirectoryTree(GUIObject, Tree):
class DirectoryTree(Tree, DupeGuruGUIObject):
#--- model -> view calls:
# refresh()
# refresh_states() # when only states label need to be refreshed
#
def __init__(self, app):
GUIObject.__init__(self, app)
Tree.__init__(self)
DupeGuruGUIObject.__init__(self, app)
def connect(self):
GUIObject.connect(self)
def _view_updated(self):
self._refresh()
self.view.refresh()

View File

@@ -6,6 +6,7 @@
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/bsd_license
from hscommon.gui.base import GUIObject
from hscommon.gui.selectable_list import GUISelectableList
class CriterionCategoryList(GUISelectableList):
@@ -39,8 +40,9 @@ class PrioritizationList(GUISelectableList):
del prilist[i]
self._refresh_contents()
class PrioritizeDialog:
class PrioritizeDialog(GUIObject):
def __init__(self, app):
GUIObject.__init__(self)
self.app = app
self.categories = [cat(app.results) for cat in app._prioritization_categories()]
self.category_list = CriterionCategoryList(self)
@@ -48,6 +50,9 @@ class PrioritizeDialog:
self.criteria_list = GUISelectableList()
self.prioritizations = []
self.prioritization_list = PrioritizationList(self)
#--- Override
def _view_updated(self):
self.category_list.select(0)
#--- Private

View File

@@ -21,7 +21,6 @@ class ProblemTable(GUITable):
def __init__(self, problem_dialog):
GUITable.__init__(self)
self.columns = Columns(self)
self.view = None
self.dialog = problem_dialog
#--- Override

View File

@@ -11,7 +11,7 @@ from operator import attrgetter
from hscommon.gui.table import GUITable, Row
from hscommon.gui.column import Columns
from .base import GUIObject
from .base import DupeGuruGUIObject
class DupeRow(Row):
def __init__(self, table, group, dupe):
@@ -51,20 +51,18 @@ class DupeRow(Row):
self._app.mark_dupe(self._dupe, value)
class ResultTable(GUIObject, GUITable):
class ResultTable(GUITable, DupeGuruGUIObject):
def __init__(self, app):
GUIObject.__init__(self, app)
GUITable.__init__(self)
DupeGuruGUIObject.__init__(self, app)
self.columns = Columns(self, prefaccess=app, savename='ResultTable')
self._power_marker = False
self._delta_values = False
self._sort_descriptors = ('name', True)
#--- Override
def connect(self):
GUIObject.connect(self)
def _view_updated(self):
self._refresh_with_view()
self.columns.restore_columns()
def _restore_selection(self, previous_selection):
if self.app.selected_dupes:

View File

@@ -6,11 +6,10 @@
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/bsd_license
from .base import GUIObject
from .base import DupeGuruGUIObject
class StatsLabel(GUIObject):
def connect(self):
GUIObject.connect(self)
class StatsLabel(DupeGuruGUIObject):
def _view_updated(self):
self.view.refresh()
@property