2009-06-01 09:55:11 +00:00
|
|
|
# Created By: Virgil Dupras
|
|
|
|
# Created On: 2009-04-25
|
2010-01-01 20:11:34 +00:00
|
|
|
# Copyright 2010 Hardcoded Software (http://www.hardcoded.net)
|
2009-08-05 08:59:46 +00:00
|
|
|
#
|
2010-09-30 10:17:41 +00:00
|
|
|
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
|
2009-08-05 08:59:46 +00:00
|
|
|
# which should be included with this package. The terms are also available at
|
2010-09-30 10:17:41 +00:00
|
|
|
# http://www.hardcoded.net/licenses/bsd_license
|
2009-06-01 09:55:11 +00:00
|
|
|
|
2010-04-07 16:04:58 +00:00
|
|
|
import sys
|
|
|
|
|
2011-01-15 15:29:35 +00:00
|
|
|
from PyQt4.QtCore import Qt, SIGNAL, QUrl, QRect
|
|
|
|
from PyQt4.QtGui import (QMainWindow, QMenu, QPixmap, QIcon, QLabel, QHeaderView, QMessageBox,
|
|
|
|
QInputDialog, QLineEdit, QDesktopServices, QFileDialog, QMenuBar, QWidget, QVBoxLayout,
|
|
|
|
QAbstractItemView, QStatusBar)
|
2009-06-01 09:55:11 +00:00
|
|
|
|
2011-01-11 12:36:05 +00:00
|
|
|
from hscommon.util import nonone
|
2009-06-01 09:55:11 +00:00
|
|
|
|
2010-10-04 13:29:00 +00:00
|
|
|
from .results_model import ResultsModel, ResultsView
|
2010-08-11 14:39:06 +00:00
|
|
|
from .stats_label import StatsLabel
|
2011-01-15 15:29:35 +00:00
|
|
|
from .util import createActions
|
2009-06-01 09:55:11 +00:00
|
|
|
|
2011-01-15 15:29:35 +00:00
|
|
|
class ResultWindow(QMainWindow):
|
2009-06-01 09:55:11 +00:00
|
|
|
def __init__(self, app):
|
|
|
|
QMainWindow.__init__(self, None)
|
|
|
|
self.app = app
|
|
|
|
self._last_filter = None
|
|
|
|
self._setupUi()
|
2010-02-12 14:39:29 +00:00
|
|
|
self.resultsModel = ResultsModel(self.app, self.resultsView)
|
|
|
|
self.stats = StatsLabel(app, self.statusLabel)
|
2009-06-01 09:55:11 +00:00
|
|
|
self._load_columns()
|
|
|
|
self._update_column_actions_status()
|
|
|
|
|
|
|
|
self.connect(self.menuColumns, SIGNAL('triggered(QAction*)'), self.columnToggled)
|
2009-06-19 11:14:27 +00:00
|
|
|
self.connect(self.resultsView, SIGNAL('doubleClicked()'), self.resultsDoubleClicked)
|
2010-02-12 14:39:29 +00:00
|
|
|
self.connect(self.resultsView, SIGNAL('spacePressed()'), self.resultsSpacePressed)
|
2010-08-15 10:27:15 +00:00
|
|
|
self.app.willSavePrefs.connect(self.appWillSavePrefs)
|
2009-06-01 09:55:11 +00:00
|
|
|
|
2010-10-04 13:29:00 +00:00
|
|
|
def _setupActions(self):
|
|
|
|
# (name, shortcut, icon, desc, func)
|
|
|
|
ACTIONS = [
|
2011-01-17 16:15:16 +00:00
|
|
|
('actionDetails', 'Ctrl+I', '', "Details", self.detailsTriggered),
|
|
|
|
('actionActions', '', '', "Actions", self.actionsTriggered),
|
2011-01-18 09:45:40 +00:00
|
|
|
('actionPowerMarker', 'Ctrl+1', '', "Show Dupes Only", self.powerMarkerTriggered),
|
|
|
|
('actionDelta', 'Ctrl+2', '', "Show Delta Values", self.deltaTriggered),
|
2010-10-04 13:29:00 +00:00
|
|
|
('actionDeleteMarked', 'Ctrl+D', '', "Send Marked to Recycle Bin", self.deleteTriggered),
|
|
|
|
('actionHardlinkMarked', 'Ctrl+Shift+D', '', "Delete Marked and Replace with Hardlinks", self.hardlinkTriggered),
|
|
|
|
('actionMoveMarked', 'Ctrl+M', '', "Move Marked to...", self.moveTriggered),
|
|
|
|
('actionCopyMarked', 'Ctrl+Shift+M', '', "Copy Marked to...", self.copyTriggered),
|
|
|
|
('actionRemoveMarked', 'Ctrl+R', '', "Remove Marked from Results", self.removeMarkedTriggered),
|
|
|
|
('actionRemoveSelected', 'Ctrl+Del', '', "Remove Selected from Results", self.removeSelectedTriggered),
|
|
|
|
('actionIgnoreSelected', 'Ctrl+Shift+Del', '', "Add Selected to Ignore List", self.addToIgnoreListTriggered),
|
|
|
|
('actionMakeSelectedReference', 'Ctrl+Space', '', "Make Selected Reference", self.makeReferenceTriggered),
|
|
|
|
('actionOpenSelected', 'Ctrl+O', '', "Open Selected with Default Application", self.openTriggered),
|
|
|
|
('actionRevealSelected', 'Ctrl+Shift+O', '', "Open Containing Folder of Selected", self.revealTriggered),
|
|
|
|
('actionRenameSelected', 'F2', '', "Rename Selected", self.renameTriggered),
|
|
|
|
('actionMarkAll', 'Ctrl+A', '', "Mark All", self.markAllTriggered),
|
|
|
|
('actionMarkNone', 'Ctrl+Shift+A', '', "Mark None", self.markNoneTriggered),
|
|
|
|
('actionInvertMarking', 'Ctrl+Alt+A', '', "Invert Marking", self.markInvertTriggered),
|
|
|
|
('actionMarkSelected', '', '', "Mark Selected", self.markSelectedTriggered),
|
|
|
|
('actionClearIgnoreList', '', '', "Clear Ignore List", self.clearIgnoreListTriggered),
|
|
|
|
('actionApplyFilter', 'Ctrl+F', '', "Apply Filter", self.applyFilterTriggered),
|
|
|
|
('actionCancelFilter', 'Ctrl+Shift+F', '', "Cancel Filter", self.cancelFilterTriggered),
|
|
|
|
('actionExport', '', '', "Export To HTML", self.exportTriggered),
|
|
|
|
('actionSaveResults', 'Ctrl+S', '', "Save Results...", self.saveResultsTriggered),
|
2011-01-17 16:15:16 +00:00
|
|
|
('actionInvokeCustomCommand', 'Ctrl+Alt+I', '', "Invoke Custom Command", self.app.invokeCustomCommand),
|
2010-10-04 13:29:00 +00:00
|
|
|
]
|
2011-01-15 15:29:35 +00:00
|
|
|
createActions(ACTIONS, self)
|
2010-10-04 13:29:00 +00:00
|
|
|
self.actionDelta.setCheckable(True)
|
|
|
|
self.actionPowerMarker.setCheckable(True)
|
|
|
|
|
|
|
|
def _setupMenu(self):
|
|
|
|
self.menubar = QMenuBar(self)
|
|
|
|
self.menubar.setGeometry(QRect(0, 0, 630, 22))
|
|
|
|
self.menuFile = QMenu(self.menubar)
|
|
|
|
self.menuFile.setTitle("File")
|
|
|
|
self.menuMark = QMenu(self.menubar)
|
|
|
|
self.menuMark.setTitle("Mark")
|
|
|
|
self.menuActions = QMenu(self.menubar)
|
|
|
|
self.menuActions.setTitle("Actions")
|
|
|
|
self.menuColumns = QMenu(self.menubar)
|
|
|
|
self.menuColumns.setTitle("Columns")
|
2011-01-15 15:29:35 +00:00
|
|
|
self.menuView = QMenu(self.menubar)
|
|
|
|
self.menuView.setTitle("View")
|
2010-10-04 13:29:00 +00:00
|
|
|
self.menuHelp = QMenu(self.menubar)
|
|
|
|
self.menuHelp.setTitle("Help")
|
|
|
|
self.setMenuBar(self.menubar)
|
2009-06-01 09:55:11 +00:00
|
|
|
|
2010-10-04 13:29:00 +00:00
|
|
|
self.menuActions.addAction(self.actionDeleteMarked)
|
|
|
|
self.menuActions.addAction(self.actionHardlinkMarked)
|
|
|
|
self.menuActions.addAction(self.actionMoveMarked)
|
|
|
|
self.menuActions.addAction(self.actionCopyMarked)
|
|
|
|
self.menuActions.addAction(self.actionRemoveMarked)
|
|
|
|
self.menuActions.addSeparator()
|
|
|
|
self.menuActions.addAction(self.actionRemoveSelected)
|
|
|
|
self.menuActions.addAction(self.actionIgnoreSelected)
|
|
|
|
self.menuActions.addAction(self.actionMakeSelectedReference)
|
|
|
|
self.menuActions.addSeparator()
|
|
|
|
self.menuActions.addAction(self.actionOpenSelected)
|
|
|
|
self.menuActions.addAction(self.actionRevealSelected)
|
|
|
|
self.menuActions.addAction(self.actionInvokeCustomCommand)
|
|
|
|
self.menuActions.addAction(self.actionRenameSelected)
|
|
|
|
self.menuActions.addSeparator()
|
|
|
|
self.menuActions.addAction(self.actionApplyFilter)
|
|
|
|
self.menuActions.addAction(self.actionCancelFilter)
|
|
|
|
self.menuMark.addAction(self.actionMarkAll)
|
|
|
|
self.menuMark.addAction(self.actionMarkNone)
|
|
|
|
self.menuMark.addAction(self.actionInvertMarking)
|
|
|
|
self.menuMark.addAction(self.actionMarkSelected)
|
2011-01-15 15:29:35 +00:00
|
|
|
self.menuView.addAction(self.actionPowerMarker)
|
|
|
|
self.menuView.addAction(self.actionDelta)
|
|
|
|
self.menuView.addSeparator()
|
|
|
|
self.menuView.addAction(self.actionDetails)
|
|
|
|
self.menuView.addAction(self.app.actionPreferences)
|
|
|
|
self.menuHelp.addAction(self.app.actionShowHelp)
|
|
|
|
self.menuHelp.addAction(self.app.actionRegister)
|
|
|
|
self.menuHelp.addAction(self.app.actionCheckForUpdate)
|
|
|
|
self.menuHelp.addAction(self.app.actionOpenDebugLog)
|
|
|
|
self.menuHelp.addAction(self.app.actionAbout)
|
2010-10-04 13:29:00 +00:00
|
|
|
self.menuFile.addAction(self.actionSaveResults)
|
|
|
|
self.menuFile.addAction(self.actionExport)
|
|
|
|
self.menuFile.addAction(self.actionClearIgnoreList)
|
|
|
|
self.menuFile.addSeparator()
|
2011-01-15 15:29:35 +00:00
|
|
|
self.menuFile.addAction(self.app.actionQuit)
|
2010-10-04 13:29:00 +00:00
|
|
|
|
|
|
|
self.menubar.addAction(self.menuFile.menuAction())
|
|
|
|
self.menubar.addAction(self.menuMark.menuAction())
|
|
|
|
self.menubar.addAction(self.menuActions.menuAction())
|
|
|
|
self.menubar.addAction(self.menuColumns.menuAction())
|
2011-01-15 15:29:35 +00:00
|
|
|
self.menubar.addAction(self.menuView.menuAction())
|
2010-10-04 13:29:00 +00:00
|
|
|
self.menubar.addAction(self.menuHelp.menuAction())
|
2009-06-01 09:55:11 +00:00
|
|
|
|
|
|
|
# Columns menu
|
|
|
|
menu = self.menuColumns
|
|
|
|
self._column_actions = []
|
|
|
|
for index, column in enumerate(self.app.data.COLUMNS):
|
|
|
|
action = menu.addAction(column['display'])
|
|
|
|
action.setCheckable(True)
|
|
|
|
action.column_index = index
|
|
|
|
self._column_actions.append(action)
|
|
|
|
menu.addSeparator()
|
|
|
|
action = menu.addAction("Reset to Defaults")
|
|
|
|
action.column_index = -1
|
|
|
|
|
|
|
|
# Action menu
|
2010-10-04 13:29:00 +00:00
|
|
|
actionMenu = QMenu('Actions', self.menubar)
|
2009-06-01 09:55:11 +00:00
|
|
|
actionMenu.addAction(self.actionDeleteMarked)
|
2010-09-25 13:37:18 +00:00
|
|
|
actionMenu.addAction(self.actionHardlinkMarked)
|
2009-06-01 09:55:11 +00:00
|
|
|
actionMenu.addAction(self.actionMoveMarked)
|
|
|
|
actionMenu.addAction(self.actionCopyMarked)
|
|
|
|
actionMenu.addAction(self.actionRemoveMarked)
|
|
|
|
actionMenu.addSeparator()
|
|
|
|
actionMenu.addAction(self.actionRemoveSelected)
|
|
|
|
actionMenu.addAction(self.actionIgnoreSelected)
|
|
|
|
actionMenu.addAction(self.actionMakeSelectedReference)
|
|
|
|
actionMenu.addSeparator()
|
|
|
|
actionMenu.addAction(self.actionOpenSelected)
|
|
|
|
actionMenu.addAction(self.actionRevealSelected)
|
2010-04-13 08:02:09 +00:00
|
|
|
actionMenu.addAction(self.actionInvokeCustomCommand)
|
2009-06-01 09:55:11 +00:00
|
|
|
actionMenu.addAction(self.actionRenameSelected)
|
|
|
|
self.actionActions.setMenu(actionMenu)
|
2010-10-04 13:29:00 +00:00
|
|
|
|
|
|
|
def _setupUi(self):
|
2011-01-15 15:29:35 +00:00
|
|
|
self.setWindowTitle("dupeGuru Results")
|
2010-10-04 13:29:00 +00:00
|
|
|
self.resize(630, 514)
|
|
|
|
self.centralwidget = QWidget(self)
|
|
|
|
self.verticalLayout_2 = QVBoxLayout(self.centralwidget)
|
|
|
|
self.verticalLayout_2.setMargin(0)
|
|
|
|
self.resultsView = ResultsView(self.centralwidget)
|
|
|
|
self.resultsView.setSelectionMode(QAbstractItemView.ExtendedSelection)
|
|
|
|
self.resultsView.setSelectionBehavior(QAbstractItemView.SelectRows)
|
|
|
|
self.resultsView.setSortingEnabled(True)
|
|
|
|
self.resultsView.verticalHeader().setVisible(False)
|
|
|
|
self.resultsView.verticalHeader().setDefaultSectionSize(18)
|
|
|
|
h = self.resultsView.horizontalHeader()
|
|
|
|
h.setHighlightSections(False)
|
|
|
|
h.setMovable(True)
|
|
|
|
h.setStretchLastSection(False)
|
|
|
|
h.setDefaultAlignment(Qt.AlignLeft)
|
|
|
|
self.verticalLayout_2.addWidget(self.resultsView)
|
|
|
|
self.setCentralWidget(self.centralwidget)
|
|
|
|
self._setupActions()
|
|
|
|
self._setupMenu()
|
|
|
|
self.statusbar = QStatusBar(self)
|
|
|
|
self.statusbar.setSizeGripEnabled(True)
|
|
|
|
self.setStatusBar(self.statusbar)
|
2009-06-01 09:55:11 +00:00
|
|
|
self.statusLabel = QLabel(self)
|
|
|
|
self.statusbar.addPermanentWidget(self.statusLabel, 1)
|
2010-04-07 16:04:58 +00:00
|
|
|
|
2011-01-15 15:29:35 +00:00
|
|
|
if self.app.prefs.resultWindowIsMaximized:
|
|
|
|
self.setWindowState(self.windowState() | Qt.WindowMaximized)
|
|
|
|
if self.app.prefs.resultWindowRect is not None and not self.app.prefs.resultWindowIsMaximized:
|
|
|
|
self.setGeometry(self.app.prefs.resultWindowRect)
|
2010-08-15 10:27:15 +00:00
|
|
|
|
2010-09-25 13:37:18 +00:00
|
|
|
# Platform-specific setup
|
2010-04-07 16:04:58 +00:00
|
|
|
if sys.platform == 'linux2':
|
|
|
|
self.actionCheckForUpdate.setVisible(False) # This only works on Windows
|
2010-09-25 13:37:18 +00:00
|
|
|
if sys.platform not in {'darwin', 'linux2'}:
|
|
|
|
self.actionHardlinkMarked.setVisible(False)
|
2009-06-01 09:55:11 +00:00
|
|
|
|
|
|
|
#--- Private
|
|
|
|
def _load_columns(self):
|
2010-09-24 13:48:59 +00:00
|
|
|
h = self.resultsView.horizontalHeader()
|
2009-06-01 09:55:11 +00:00
|
|
|
h.setResizeMode(QHeaderView.Interactive)
|
|
|
|
prefs = self.app.prefs
|
2010-08-11 14:39:06 +00:00
|
|
|
attrs = list(zip(prefs.columns_width, prefs.columns_visible))
|
2009-06-01 09:55:11 +00:00
|
|
|
for index, (width, visible) in enumerate(attrs):
|
|
|
|
h.resizeSection(index, width)
|
|
|
|
h.setSectionHidden(index, not visible)
|
|
|
|
h.setResizeMode(0, QHeaderView.Stretch)
|
|
|
|
|
|
|
|
def _update_column_actions_status(self):
|
2010-09-24 13:48:59 +00:00
|
|
|
h = self.resultsView.horizontalHeader()
|
2009-06-01 09:55:11 +00:00
|
|
|
for action in self._column_actions:
|
|
|
|
colid = action.column_index
|
|
|
|
action.setChecked(not h.isSectionHidden(colid))
|
|
|
|
|
|
|
|
#--- Actions
|
|
|
|
def actionsTriggered(self):
|
|
|
|
self.actionsButton.showMenu()
|
|
|
|
|
|
|
|
def addToIgnoreListTriggered(self):
|
2010-02-06 11:12:20 +00:00
|
|
|
self.app.add_selected_to_ignore_list()
|
2009-06-01 09:55:11 +00:00
|
|
|
|
|
|
|
def applyFilterTriggered(self):
|
|
|
|
title = "Apply Filter"
|
|
|
|
msg = "Type the filter you want to apply on your results. See help for details."
|
|
|
|
text = nonone(self._last_filter, '[*]')
|
|
|
|
answer, ok = QInputDialog.getText(self, title, msg, QLineEdit.Normal, text)
|
|
|
|
if not ok:
|
|
|
|
return
|
2010-08-11 14:39:06 +00:00
|
|
|
answer = str(answer)
|
2009-06-07 07:14:47 +00:00
|
|
|
self.app.apply_filter(answer)
|
2009-06-01 09:55:11 +00:00
|
|
|
self._last_filter = answer
|
|
|
|
|
|
|
|
def cancelFilterTriggered(self):
|
2009-06-07 07:14:47 +00:00
|
|
|
self.app.apply_filter('')
|
2009-06-01 09:55:11 +00:00
|
|
|
|
|
|
|
def clearIgnoreListTriggered(self):
|
|
|
|
title = "Clear Ignore List"
|
|
|
|
count = len(self.app.scanner.ignore_list)
|
|
|
|
if not count:
|
|
|
|
QMessageBox.information(self, title, "Nothing to clear.")
|
|
|
|
return
|
|
|
|
msg = "Do you really want to remove all {0} items from the ignore list?".format(count)
|
2011-01-15 15:29:35 +00:00
|
|
|
if self.app.confirm(title, msg, QMessageBox.No):
|
2009-06-01 09:55:11 +00:00
|
|
|
self.app.scanner.ignore_list.Clear()
|
|
|
|
QMessageBox.information(self, title, "Ignore list cleared.")
|
|
|
|
|
|
|
|
def copyTriggered(self):
|
|
|
|
self.app.copy_or_move_marked(True)
|
|
|
|
|
|
|
|
def deleteTriggered(self):
|
|
|
|
count = self.app.results.mark_count
|
|
|
|
if not count:
|
|
|
|
return
|
|
|
|
title = "Delete duplicates"
|
|
|
|
msg = "You are about to send {0} files to the recycle bin. Continue?".format(count)
|
2011-01-15 15:29:35 +00:00
|
|
|
if self.app.confirm(title, msg):
|
2009-06-01 09:55:11 +00:00
|
|
|
self.app.delete_marked()
|
|
|
|
|
|
|
|
def deltaTriggered(self):
|
2010-02-12 14:39:29 +00:00
|
|
|
self.resultsModel.delta_values = self.actionDelta.isChecked()
|
2009-06-01 09:55:11 +00:00
|
|
|
|
|
|
|
def detailsTriggered(self):
|
|
|
|
self.app.show_details()
|
|
|
|
|
2009-09-01 16:40:29 +00:00
|
|
|
def exportTriggered(self):
|
2010-09-24 13:48:59 +00:00
|
|
|
h = self.resultsView.horizontalHeader()
|
2009-09-01 16:40:29 +00:00
|
|
|
column_ids = []
|
|
|
|
for i in range(len(self.app.data.COLUMNS)):
|
|
|
|
if not h.isSectionHidden(i):
|
|
|
|
column_ids.append(str(i))
|
|
|
|
exported_path = self.app.export_to_xhtml(column_ids)
|
|
|
|
url = QUrl.fromLocalFile(exported_path)
|
|
|
|
QDesktopServices.openUrl(url)
|
2010-08-13 11:06:18 +00:00
|
|
|
|
2010-09-25 13:37:18 +00:00
|
|
|
def hardlinkTriggered(self):
|
|
|
|
count = self.app.results.mark_count
|
|
|
|
if not count:
|
|
|
|
return
|
|
|
|
title = "Delete and hardlink duplicates"
|
|
|
|
msg = "You are about to send {0} files to the trash and hardlink them afterwards. Continue?".format(count)
|
2011-01-15 15:29:35 +00:00
|
|
|
if self.app.confirm(title, msg):
|
2010-09-25 13:37:18 +00:00
|
|
|
self.app.delete_marked(replace_with_hardlinks=True)
|
|
|
|
|
2009-06-01 09:55:11 +00:00
|
|
|
def makeReferenceTriggered(self):
|
2010-02-06 11:27:11 +00:00
|
|
|
self.app.make_selected_reference()
|
2009-06-01 09:55:11 +00:00
|
|
|
|
|
|
|
def markAllTriggered(self):
|
|
|
|
self.app.mark_all()
|
|
|
|
|
|
|
|
def markInvertTriggered(self):
|
|
|
|
self.app.mark_invert()
|
|
|
|
|
|
|
|
def markNoneTriggered(self):
|
|
|
|
self.app.mark_none()
|
|
|
|
|
|
|
|
def markSelectedTriggered(self):
|
2010-02-12 14:39:29 +00:00
|
|
|
self.app.toggle_selected_mark_state()
|
2009-06-01 09:55:11 +00:00
|
|
|
|
|
|
|
def moveTriggered(self):
|
|
|
|
self.app.copy_or_move_marked(False)
|
|
|
|
|
|
|
|
def openTriggered(self):
|
|
|
|
self.app.open_selected()
|
|
|
|
|
|
|
|
def powerMarkerTriggered(self):
|
|
|
|
self.resultsModel.power_marker = self.actionPowerMarker.isChecked()
|
|
|
|
|
|
|
|
def preferencesTriggered(self):
|
|
|
|
self.app.show_preferences()
|
|
|
|
|
|
|
|
def removeMarkedTriggered(self):
|
|
|
|
count = self.app.results.mark_count
|
|
|
|
if not count:
|
|
|
|
return
|
|
|
|
title = "Remove duplicates"
|
|
|
|
msg = "You are about to remove {0} files from results. Continue?".format(count)
|
2011-01-15 15:29:35 +00:00
|
|
|
if self.app.confirm(title, msg):
|
2010-02-12 14:39:29 +00:00
|
|
|
self.app.remove_marked()
|
2009-06-01 09:55:11 +00:00
|
|
|
|
|
|
|
def removeSelectedTriggered(self):
|
2010-02-06 11:44:21 +00:00
|
|
|
self.app.remove_selected()
|
2009-06-01 09:55:11 +00:00
|
|
|
|
|
|
|
def renameTriggered(self):
|
|
|
|
self.resultsView.edit(self.resultsView.selectionModel().currentIndex())
|
|
|
|
|
|
|
|
def revealTriggered(self):
|
|
|
|
self.app.reveal_selected()
|
|
|
|
|
2010-08-13 11:06:18 +00:00
|
|
|
def saveResultsTriggered(self):
|
|
|
|
title = "Select a file to save your results to"
|
|
|
|
files = "dupeGuru Results (*.dupeguru)"
|
|
|
|
destination = QFileDialog.getSaveFileName(self, title, '', files)
|
|
|
|
if destination:
|
|
|
|
self.app.save_as(destination)
|
2011-01-15 15:29:35 +00:00
|
|
|
self.app.recentResults.insertItem(destination)
|
2009-06-01 09:55:11 +00:00
|
|
|
|
|
|
|
#--- Events
|
2010-08-15 10:27:15 +00:00
|
|
|
def appWillSavePrefs(self):
|
|
|
|
prefs = self.app.prefs
|
2010-09-24 13:48:59 +00:00
|
|
|
h = self.resultsView.horizontalHeader()
|
2010-08-15 10:27:15 +00:00
|
|
|
widths = []
|
|
|
|
visible = []
|
|
|
|
for i in range(len(self.app.data.COLUMNS)):
|
|
|
|
widths.append(h.sectionSize(i))
|
|
|
|
visible.append(not h.isSectionHidden(i))
|
|
|
|
prefs.columns_width = widths
|
|
|
|
prefs.columns_visible = visible
|
2011-01-15 15:29:35 +00:00
|
|
|
prefs.resultWindowIsMaximized = self.isMaximized()
|
|
|
|
prefs.resultWindowRect = self.geometry()
|
2009-06-01 09:55:11 +00:00
|
|
|
|
|
|
|
def columnToggled(self, action):
|
|
|
|
colid = action.column_index
|
|
|
|
if colid == -1:
|
|
|
|
self.app.prefs.reset_columns()
|
|
|
|
self._load_columns()
|
|
|
|
else:
|
2010-09-24 13:48:59 +00:00
|
|
|
h = self.resultsView.horizontalHeader()
|
2009-06-01 09:55:11 +00:00
|
|
|
h.setSectionHidden(colid, not h.isSectionHidden(colid))
|
|
|
|
self._update_column_actions_status()
|
|
|
|
|
2009-06-19 11:32:58 +00:00
|
|
|
def contextMenuEvent(self, event):
|
|
|
|
self.actionActions.menu().exec_(event.globalPos())
|
|
|
|
|
2009-06-19 11:14:27 +00:00
|
|
|
def resultsDoubleClicked(self):
|
|
|
|
self.app.open_selected()
|
|
|
|
|
2010-02-12 14:39:29 +00:00
|
|
|
def resultsSpacePressed(self):
|
|
|
|
self.app.toggle_selected_mark_state()
|
2009-06-01 09:55:11 +00:00
|
|
|
|