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

Added an Ignore List dialog.

This commit is contained in:
Virgil Dupras
2012-03-14 12:47:21 -04:00
parent ae16845477
commit 3fc83d6245
57 changed files with 1738 additions and 752 deletions

View File

@@ -0,0 +1,39 @@
# Created On: 2012/03/13
# Copyright 2012 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/bsd_license
from hscommon.trans import tr
from .ignore_list_table import IgnoreListTable
class IgnoreListDialog:
#--- View interface
# show()
#
def __init__(self, app):
self.app = app
self.ignore_list = self.app.scanner.ignore_list
self.ignore_list_table = IgnoreListTable(self)
def clear(self):
if not self.ignore_list:
return
msg = tr("Do you really want to remove all %d items from the ignore list?") % len(self.ignore_list)
if self.app.view.ask_yes_no(msg):
self.ignore_list.Clear()
self.refresh()
def refresh(self):
self.ignore_list_table.refresh()
def remove_selected(self):
for row in self.ignore_list_table.selected_rows:
self.ignore_list.remove(row.path1_original, row.path2_original)
self.refresh()
def show(self):
self.view.show()

View File

@@ -0,0 +1,41 @@
# Created By: Virgil Dupras
# Created On: 2012-03-13
# Copyright 2012 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/bsd_license
from hscommon.gui.table import GUITable, Row
from hscommon.gui.column import Column, Columns
from hscommon.trans import trget
coltr = trget('columns')
class IgnoreListTable(GUITable):
COLUMNS = [
# the str concat below saves us needless localization.
Column('path1', coltr("File Path") + " 1"),
Column('path2', coltr("File Path") + " 2"),
]
def __init__(self, ignore_list_dialog):
GUITable.__init__(self)
self.columns = Columns(self)
self.view = None
self.dialog = ignore_list_dialog
#--- Override
def _fill(self):
for path1, path2 in self.dialog.ignore_list:
self.append(IgnoreListRow(self, path1, path2))
class IgnoreListRow(Row):
def __init__(self, table, path1, path2):
Row.__init__(self, table)
self.path1_original = path1
self.path2_original = path2
self.path1 = str(path1)
self.path2 = str(path2)