mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-09 21:24:36 +00:00
Refactoring: de-notified problems_dialog. It simplifies things.
This commit is contained in:
parent
b4b9393e14
commit
878c744c21
@ -116,8 +116,7 @@ class DupeGuru(RegistrableApplication, Broadcaster):
|
||||
self.problem_dialog = ProblemDialog(self)
|
||||
self.stats_label = StatsLabel(self)
|
||||
self.result_table = self._create_result_table()
|
||||
children = [self.result_table, self.directory_tree, self.problem_dialog, self.stats_label,
|
||||
self.details_panel]
|
||||
children = [self.result_table, self.directory_tree, self.stats_label, self.details_panel]
|
||||
for child in children:
|
||||
child.connect()
|
||||
# subclasses must create and connect self.result_table
|
||||
@ -195,7 +194,7 @@ class DupeGuru(RegistrableApplication, Broadcaster):
|
||||
self.view.show_results_window()
|
||||
if jobid in {JobType.Copy, JobType.Move, JobType.Delete}:
|
||||
if self.results.problems:
|
||||
self.notify('problems_changed')
|
||||
self.problem_dialog.refresh()
|
||||
self.view.show_problem_dialog()
|
||||
else:
|
||||
msg = {
|
||||
|
@ -24,9 +24,6 @@ class GUIObject(Listener):
|
||||
def marking_changed(self):
|
||||
pass
|
||||
|
||||
def problems_changed(self):
|
||||
pass
|
||||
|
||||
def results_changed(self):
|
||||
pass
|
||||
|
||||
|
@ -6,18 +6,17 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.hardcoded.net/licenses/bsd_license
|
||||
|
||||
from hscommon.notify import Broadcaster
|
||||
|
||||
from .base import GUIObject
|
||||
from .problem_table import ProblemTable
|
||||
|
||||
class ProblemDialog(GUIObject, Broadcaster):
|
||||
class ProblemDialog:
|
||||
def __init__(self, app):
|
||||
GUIObject.__init__(self, app)
|
||||
Broadcaster.__init__(self)
|
||||
self.app = app
|
||||
self._selected_dupe = None
|
||||
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):
|
||||
if self._selected_dupe is not None:
|
||||
@ -26,8 +25,3 @@ class ProblemDialog(GUIObject, Broadcaster):
|
||||
def select_dupe(self, dupe):
|
||||
self._selected_dupe = dupe
|
||||
|
||||
#--- Event Handlers
|
||||
def problems_changed(self):
|
||||
self._selected_dupe = None
|
||||
self.notify('problems_changed')
|
||||
|
||||
|
@ -6,14 +6,13 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.hardcoded.net/licenses/bsd_license
|
||||
|
||||
from hscommon.notify import Listener
|
||||
from hscommon.gui.table import GUITable, Row
|
||||
from hscommon.gui.column import Column, Columns
|
||||
from hscommon.trans import trget
|
||||
|
||||
coltr = trget('columns')
|
||||
|
||||
class ProblemTable(GUITable, Listener):
|
||||
class ProblemTable(GUITable):
|
||||
COLUMNS = [
|
||||
Column('path', coltr("File Path")),
|
||||
Column('msg', coltr("Error Message")),
|
||||
@ -21,7 +20,6 @@ class ProblemTable(GUITable, Listener):
|
||||
|
||||
def __init__(self, problem_dialog):
|
||||
GUITable.__init__(self)
|
||||
Listener.__init__(self, problem_dialog)
|
||||
self.columns = Columns(self)
|
||||
self.view = None
|
||||
self.dialog = problem_dialog
|
||||
@ -37,10 +35,6 @@ class ProblemTable(GUITable, Listener):
|
||||
for dupe, msg in problems:
|
||||
self.append(ProblemRow(self, dupe, msg))
|
||||
|
||||
#--- Event handlers
|
||||
def problems_changed(self):
|
||||
self.refresh()
|
||||
|
||||
|
||||
class ProblemRow(Row):
|
||||
def __init__(self, table, dupe, msg):
|
||||
|
Loading…
x
Reference in New Issue
Block a user