1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2026-01-22 14:41:39 +00:00

[#12] Added the Custom Command preference on the Qt side.

This commit is contained in:
Virgil Dupras
2010-04-13 09:02:09 +01:00
parent 5c80ac1c74
commit 7346b422d5
7 changed files with 54 additions and 19 deletions

View File

@@ -171,6 +171,14 @@ class DupeGuru(DupeGuruBase, QObject):
def askForRegCode(self):
self.reg.ask_for_code()
def invokeCustomCommand(self):
cmd = self.prefs.custom_command
if cmd:
self.invoke_command(cmd)
else:
msg = "You have no custom command set up. Please, set it up in your preferences."
QMessageBox.warning(self.main_window, 'Custom Command', msg)
def openDebugLog(self):
debugLogPath = op.join(self.appdata, 'debug.log')
self._open_path(debugLogPath)

View File

@@ -37,6 +37,7 @@ 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)
self.actionInvokeCustomCommand.triggered.connect(self.app.invokeCustomCommand)
def _setupUi(self):
self.setupUi(self)
@@ -76,6 +77,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
actionMenu.addSeparator()
actionMenu.addAction(self.actionOpenSelected)
actionMenu.addAction(self.actionRevealSelected)
actionMenu.addAction(self.actionInvokeCustomCommand)
actionMenu.addAction(self.actionRenameSelected)
self.actionActions.setMenu(actionMenu)
button = QToolButton(self.toolBar)
@@ -194,7 +196,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
exported_path = self.app.export_to_xhtml(column_ids)
url = QUrl.fromLocalFile(exported_path)
QDesktopServices.openUrl(url)
def makeReferenceTriggered(self):
self.app.make_selected_reference()

View File

@@ -44,6 +44,9 @@
<attribute name="headerStretchLastSection">
<bool>false</bool>
</attribute>
<attribute name="headerStretchLastSection">
<bool>false</bool>
</attribute>
</widget>
</item>
</layout>
@@ -54,7 +57,7 @@
<x>0</x>
<y>0</y>
<width>630</width>
<height>22</height>
<height>20</height>
</rect>
</property>
<widget class="QMenu" name="menuColumns">
@@ -77,6 +80,7 @@
<addaction name="separator"/>
<addaction name="actionOpenSelected"/>
<addaction name="actionRevealSelected"/>
<addaction name="actionInvokeCustomCommand"/>
<addaction name="actionRenameSelected"/>
<addaction name="separator"/>
<addaction name="actionApplyFilter"/>
@@ -428,6 +432,14 @@
<string>Open Debug Log</string>
</property>
</action>
<action name="actionInvokeCustomCommand">
<property name="text">
<string>Invoke Custom Command</string>
</property>
<property name="shortcut">
<string>Ctrl+I</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

View File

@@ -26,6 +26,7 @@ class Preferences(PreferencesBase):
self.use_regexp = get('UseRegexp', self.use_regexp)
self.remove_empty_folders = get('RemoveEmptyFolders', self.remove_empty_folders)
self.destination_type = get('DestinationType', self.destination_type)
self.custom_command = get('CustomCommand', self.custom_command)
widths = get('ColumnsWidth', self.columns_width)
# only set nonzero values
for index, width in enumerate(widths[:len(self.columns_width)]):
@@ -46,6 +47,7 @@ class Preferences(PreferencesBase):
self.use_regexp = False
self.remove_empty_folders = False
self.destination_type = 1
self.custom_command = ''
self.registration_code = ''
self.registration_email = ''
self._reset_specific()
@@ -64,6 +66,7 @@ class Preferences(PreferencesBase):
set_('UseRegexp', self.use_regexp)
set_('RemoveEmptyFolders', self.remove_empty_folders)
set_('DestinationType', self.destination_type)
set_('CustomCommand', self.custom_command)
set_('ColumnsWidth', self.columns_width)
set_('ColumnsVisible', self.columns_visible)
set_('RegistrationCode', self.registration_code)