1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2025-03-10 05:34:36 +00:00

Refactoring: de-notified problems_dialog. It simplifies things.

This commit is contained in:
Virgil Dupras 2012-03-13 11:58:07 -04:00
parent b4b9393e14
commit 878c744c21
4 changed files with 9 additions and 25 deletions

View File

@ -116,8 +116,7 @@ class DupeGuru(RegistrableApplication, Broadcaster):
self.problem_dialog = ProblemDialog(self) self.problem_dialog = ProblemDialog(self)
self.stats_label = StatsLabel(self) self.stats_label = StatsLabel(self)
self.result_table = self._create_result_table() self.result_table = self._create_result_table()
children = [self.result_table, self.directory_tree, self.problem_dialog, self.stats_label, children = [self.result_table, self.directory_tree, self.stats_label, self.details_panel]
self.details_panel]
for child in children: for child in children:
child.connect() child.connect()
# subclasses must create and connect self.result_table # subclasses must create and connect self.result_table
@ -195,7 +194,7 @@ class DupeGuru(RegistrableApplication, Broadcaster):
self.view.show_results_window() self.view.show_results_window()
if jobid in {JobType.Copy, JobType.Move, JobType.Delete}: if jobid in {JobType.Copy, JobType.Move, JobType.Delete}:
if self.results.problems: if self.results.problems:
self.notify('problems_changed') self.problem_dialog.refresh()
self.view.show_problem_dialog() self.view.show_problem_dialog()
else: else:
msg = { msg = {

View File

@ -24,9 +24,6 @@ class GUIObject(Listener):
def marking_changed(self): def marking_changed(self):
pass pass
def problems_changed(self):
pass
def results_changed(self): def results_changed(self):
pass pass

View File

@ -6,18 +6,17 @@
# which should be included with this package. The terms are also available at # which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/bsd_license # http://www.hardcoded.net/licenses/bsd_license
from hscommon.notify import Broadcaster
from .base import GUIObject
from .problem_table import ProblemTable from .problem_table import ProblemTable
class ProblemDialog(GUIObject, Broadcaster): class ProblemDialog:
def __init__(self, app): def __init__(self, app):
GUIObject.__init__(self, app) self.app = app
Broadcaster.__init__(self)
self._selected_dupe = None self._selected_dupe = None
self.problem_table = ProblemTable(self) self.problem_table = ProblemTable(self)
self.problem_table.connect()
def refresh(self):
self._selected_dupe = None
self.problem_table.refresh()
def reveal_selected_dupe(self): def reveal_selected_dupe(self):
if self._selected_dupe is not None: if self._selected_dupe is not None:
@ -26,8 +25,3 @@ class ProblemDialog(GUIObject, Broadcaster):
def select_dupe(self, dupe): def select_dupe(self, dupe):
self._selected_dupe = dupe self._selected_dupe = dupe
#--- Event Handlers
def problems_changed(self):
self._selected_dupe = None
self.notify('problems_changed')

View File

@ -6,14 +6,13 @@
# which should be included with this package. The terms are also available at # which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/bsd_license # http://www.hardcoded.net/licenses/bsd_license
from hscommon.notify import Listener
from hscommon.gui.table import GUITable, Row from hscommon.gui.table import GUITable, Row
from hscommon.gui.column import Column, Columns from hscommon.gui.column import Column, Columns
from hscommon.trans import trget from hscommon.trans import trget
coltr = trget('columns') coltr = trget('columns')
class ProblemTable(GUITable, Listener): class ProblemTable(GUITable):
COLUMNS = [ COLUMNS = [
Column('path', coltr("File Path")), Column('path', coltr("File Path")),
Column('msg', coltr("Error Message")), Column('msg', coltr("Error Message")),
@ -21,7 +20,6 @@ class ProblemTable(GUITable, Listener):
def __init__(self, problem_dialog): def __init__(self, problem_dialog):
GUITable.__init__(self) GUITable.__init__(self)
Listener.__init__(self, problem_dialog)
self.columns = Columns(self) self.columns = Columns(self)
self.view = None self.view = None
self.dialog = problem_dialog self.dialog = problem_dialog
@ -37,10 +35,6 @@ class ProblemTable(GUITable, Listener):
for dupe, msg in problems: for dupe, msg in problems:
self.append(ProblemRow(self, dupe, msg)) self.append(ProblemRow(self, dupe, msg))
#--- Event handlers
def problems_changed(self):
self.refresh()
class ProblemRow(Row): class ProblemRow(Row):
def __init__(self, table, dupe, msg): def __init__(self, table, dupe, msg):