mirror of
https://github.com/arsenetar/dupeguru.git
synced 2026-01-22 14:41:39 +00:00
Added Load/Save Results menu items, allowing to save results at arbitrary places.
This commit is contained in:
@@ -10,7 +10,7 @@ import sys
|
||||
|
||||
from PyQt4.QtCore import Qt, QCoreApplication, QProcess, SIGNAL, QUrl
|
||||
from PyQt4.QtGui import (QMainWindow, QMenu, QPixmap, QIcon, QToolButton, QLabel, QHeaderView,
|
||||
QMessageBox, QInputDialog, QLineEdit, QDesktopServices)
|
||||
QMessageBox, QInputDialog, QLineEdit, QDesktopServices, QFileDialog)
|
||||
|
||||
from hsutil.misc import nonone
|
||||
|
||||
@@ -37,7 +37,13 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
self.connect(QCoreApplication.instance(), SIGNAL('aboutToQuit()'), self.application_will_terminate)
|
||||
self.connect(self.resultsView, SIGNAL('doubleClicked()'), self.resultsDoubleClicked)
|
||||
self.connect(self.resultsView, SIGNAL('spacePressed()'), self.resultsSpacePressed)
|
||||
|
||||
# Actions (the vast majority of them are connected in the UI file, but I'm trying to
|
||||
# phase away from those, and these connections are harder to maintain than through simple
|
||||
# code
|
||||
self.actionInvokeCustomCommand.triggered.connect(self.app.invokeCustomCommand)
|
||||
self.actionLoadResults.triggered.connect(self.loadResultsTriggered)
|
||||
self.actionSaveResults.triggered.connect(self.saveResultsTriggered)
|
||||
|
||||
def _setupUi(self):
|
||||
self.setupUi(self)
|
||||
@@ -196,7 +202,14 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
exported_path = self.app.export_to_xhtml(column_ids)
|
||||
url = QUrl.fromLocalFile(exported_path)
|
||||
QDesktopServices.openUrl(url)
|
||||
|
||||
|
||||
def loadResultsTriggered(self):
|
||||
title = "Select a results file to load"
|
||||
files = "dupeGuru Results (*.dupeguru)"
|
||||
destination = QFileDialog.getOpenFileName(self, title, '', files)
|
||||
if destination:
|
||||
self.app.load_from(destination)
|
||||
|
||||
def makeReferenceTriggered(self):
|
||||
self.app.make_selected_reference()
|
||||
|
||||
@@ -248,6 +261,13 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
def revealTriggered(self):
|
||||
self.app.reveal_selected()
|
||||
|
||||
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)
|
||||
|
||||
def scanTriggered(self):
|
||||
title = "Start a new scan"
|
||||
if len(self.app.results.groups) > 0:
|
||||
|
||||
@@ -126,6 +126,8 @@
|
||||
</property>
|
||||
<addaction name="actionScan"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionLoadResults"/>
|
||||
<addaction name="actionSaveResults"/>
|
||||
<addaction name="actionExport"/>
|
||||
<addaction name="actionClearIgnoreList"/>
|
||||
<addaction name="separator"/>
|
||||
@@ -183,7 +185,7 @@
|
||||
<string>Start scanning for duplicates</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+S</string>
|
||||
<string>Ctrl+T</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDirectories">
|
||||
@@ -427,6 +429,22 @@
|
||||
<string>Export To XHTML</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLoadResults">
|
||||
<property name="text">
|
||||
<string>Load Results...</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+L</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSaveResults">
|
||||
<property name="text">
|
||||
<string>Save Results...</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+S</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpenDebugLog">
|
||||
<property name="text">
|
||||
<string>Open Debug Log</string>
|
||||
|
||||
Reference in New Issue
Block a user