diff --git a/.hgignore b/.hgignore index eb8a8e99..d1fc0c0d 100644 --- a/.hgignore +++ b/.hgignore @@ -13,8 +13,6 @@ cocoa/*/Info.plist cocoa/*/build cocoa/*/dg_cocoa.plugin qt/base/*_rc.py -qt/base/*_ui.py -qt/*/*_ui.py qt/*/build qt/*/dist qt/*/install diff --git a/build.py b/build.py index c0a05f33..20eaeb4c 100644 --- a/build.py +++ b/build.py @@ -67,9 +67,6 @@ def build_cocoa(edition, dev, help_destpath): def build_qt(edition, dev): print("Building Qt stuff") - build_all_qt_ui(op.join('qtlib', 'ui')) - build_all_qt_ui(op.join('qt', 'base')) - build_all_qt_ui(op.join('qt', edition)) print_and_do("pyrcc4 -py3 {0} > {1}".format(op.join('qt', 'base', 'dg.qrc'), op.join('qt', 'base', 'dg_rc.py'))) def build_pe_modules(ui): diff --git a/qt/__init__.py b/qt/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/qt/base/directories_dialog.py b/qt/base/directories_dialog.py index 2d155476..5a7b2cec 100644 --- a/qt/base/directories_dialog.py +++ b/qt/base/directories_dialog.py @@ -6,19 +6,21 @@ # which should be included with this package. The terms are also available at # http://www.hardcoded.net/licenses/bsd_license -from PyQt4.QtCore import SIGNAL, Qt -from PyQt4.QtGui import QDialog, QFileDialog, QHeaderView +from PyQt4.QtCore import SIGNAL, Qt, QSize +from PyQt4.QtGui import (QDialog, QFileDialog, QHeaderView, QVBoxLayout, QHBoxLayout, QTreeView, + QAbstractItemView, QSpacerItem, QSizePolicy, QPushButton, QApplication) from . import platform -from .directories_dialog_ui import Ui_DirectoriesDialog from .directories_model import DirectoriesModel, DirectoriesDelegate -class DirectoriesDialog(QDialog, Ui_DirectoriesDialog): +class DirectoriesDialog(QDialog): def __init__(self, parent, app): flags = Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint QDialog.__init__(self, parent, flags) self.app = app self.lastAddedFolder = platform.INITIAL_FOLDER_IN_DIALOGS + self.directoriesModel = DirectoriesModel(self.app) + self.directoriesDelegate = DirectoriesDelegate() self._setupUi() self._updateRemoveButton() @@ -29,19 +31,52 @@ class DirectoriesDialog(QDialog, Ui_DirectoriesDialog): self.app.willSavePrefs.connect(self.appWillSavePrefs) def _setupUi(self): - self.setupUi(self) - # Stuff that can't be done in the Designer - self.directoriesModel = DirectoriesModel(self.app) - self.directoriesDelegate = DirectoriesDelegate() + self.setWindowTitle("Directories") + self.resize(420, 338) + self.verticalLayout = QVBoxLayout(self) + self.treeView = QTreeView(self) self.treeView.setItemDelegate(self.directoriesDelegate) self.treeView.setModel(self.directoriesModel) - + self.treeView.setAcceptDrops(True) + self.treeView.setEditTriggers(QAbstractItemView.DoubleClicked|QAbstractItemView.EditKeyPressed|QAbstractItemView.SelectedClicked) + self.treeView.setDragDropOverwriteMode(True) + self.treeView.setDragDropMode(QAbstractItemView.DropOnly) + self.treeView.setUniformRowHeights(True) header = self.treeView.header() header.setStretchLastSection(False) header.setResizeMode(0, QHeaderView.Stretch) header.setResizeMode(1, QHeaderView.Fixed) header.resizeSection(1, 100) - + self.verticalLayout.addWidget(self.treeView) + self.horizontalLayout = QHBoxLayout() + spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + self.horizontalLayout.addItem(spacerItem) + self.removeButton = QPushButton(self) + self.removeButton.setText("Remove") + self.removeButton.setShortcut("Del") + self.removeButton.setMinimumSize(QSize(91, 0)) + self.removeButton.setMaximumSize(QSize(16777215, 32)) + self.horizontalLayout.addWidget(self.removeButton) + self.addButton = QPushButton(self) + self.addButton.setText("Add") + self.addButton.setMinimumSize(QSize(91, 0)) + self.addButton.setMaximumSize(QSize(16777215, 32)) + self.horizontalLayout.addWidget(self.addButton) + spacerItem1 = QSpacerItem(40, 20, QSizePolicy.Fixed, QSizePolicy.Minimum) + self.horizontalLayout.addItem(spacerItem1) + self.doneButton = QPushButton(self) + self.doneButton.setText("Done") + sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.doneButton.sizePolicy().hasHeightForWidth()) + self.doneButton.setSizePolicy(sizePolicy) + self.doneButton.setMinimumSize(QSize(91, 0)) + self.doneButton.setMaximumSize(QSize(16777215, 32)) + self.doneButton.setDefault(True) + self.horizontalLayout.addWidget(self.doneButton) + self.verticalLayout.addLayout(self.horizontalLayout) + if self.app.prefs.directoriesWindowRect is not None: self.setGeometry(self.app.prefs.directoriesWindowRect) @@ -84,3 +119,12 @@ class DirectoriesDialog(QDialog, Ui_DirectoriesDialog): def selectionChanged(self, selected, deselected): self._updateRemoveButton() + +if __name__ == '__main__': + import sys + from ..testapp import TestApp + app = QApplication([]) + dgapp = TestApp() + dialog = DirectoriesDialog(None, dgapp) + dialog.show() + sys.exit(app.exec_()) \ No newline at end of file diff --git a/qt/base/directories_dialog.ui b/qt/base/directories_dialog.ui deleted file mode 100644 index be44694d..00000000 --- a/qt/base/directories_dialog.ui +++ /dev/null @@ -1,145 +0,0 @@ - - - DirectoriesDialog - - - - 0 - 0 - 420 - 338 - - - - Directories - - - - - - true - - - QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked - - - true - - - QAbstractItemView::DropOnly - - - true - - - false - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 91 - 0 - - - - - 16777215 - 32 - - - - Remove - - - Del - - - - - - - - 91 - 0 - - - - - 16777215 - 32 - - - - Add - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 91 - 0 - - - - - 16777215 - 32 - - - - Done - - - true - - - - - - - - - - diff --git a/qt/base/main_window.py b/qt/base/main_window.py index 69a13491..400ea0a2 100644 --- a/qt/base/main_window.py +++ b/qt/base/main_window.py @@ -8,20 +8,20 @@ import sys -from PyQt4.QtCore import Qt, QCoreApplication, QProcess, SIGNAL, QUrl +from PyQt4.QtCore import Qt, QCoreApplication, QProcess, SIGNAL, QUrl, QRect from PyQt4.QtGui import (QMainWindow, QMenu, QPixmap, QIcon, QToolButton, QLabel, QHeaderView, - QMessageBox, QInputDialog, QLineEdit, QDesktopServices, QFileDialog) + QMessageBox, QInputDialog, QLineEdit, QDesktopServices, QFileDialog, QAction, QMenuBar, + QToolBar, QWidget, QVBoxLayout, QAbstractItemView, QStatusBar) from hsutil.misc import nonone from core.app import NoScannableFileError from . import dg_rc -from .main_window_ui import Ui_MainWindow -from .results_model import ResultsModel +from .results_model import ResultsModel, ResultsView from .stats_label import StatsLabel -class MainWindow(QMainWindow, Ui_MainWindow): +class MainWindow(QMainWindow): def __init__(self, app): QMainWindow.__init__(self, None) self.app = app @@ -32,31 +32,128 @@ class MainWindow(QMainWindow, Ui_MainWindow): self._load_columns() self._update_column_actions_status() - self.connect(self.actionQuit, SIGNAL('triggered()'), QCoreApplication.instance().quit) self.connect(self.menuColumns, SIGNAL('triggered(QAction*)'), self.columnToggled) self.connect(self.resultsView, SIGNAL('doubleClicked()'), self.resultsDoubleClicked) self.connect(self.resultsView, SIGNAL('spacePressed()'), self.resultsSpacePressed) self.app.willSavePrefs.connect(self.appWillSavePrefs) - - # 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) - self.actionHardlinkMarked.triggered.connect(self.hardlinkTriggered) - def _setupUi(self): - self.setupUi(self) - # Stuff that can't be setup in the Designer - h = self.resultsView.horizontalHeader() - h.setHighlightSections(False) - h.setMovable(True) - h.setStretchLastSection(False) - h.setDefaultAlignment(Qt.AlignLeft) + def _setupActions(self): + # (name, shortcut, icon, desc, func) + ACTIONS = [ + ('actionScan', 'Ctrl+T', self.app.LOGO_NAME, "Start Scan", self.scanTriggered), + ('actionDirectories', 'Ctrl+4', 'folder', "Directories", self.directoriesTriggered), + ('actionDetails', 'Ctrl+3', 'details', "Details", self.detailsTriggered), + ('actionActions', '', 'actions', "Actions", self.actionsTriggered), + ('actionPreferences', 'Ctrl+5', 'preferences', "Preferences", self.preferencesTriggered), + ('actionDelta', 'Ctrl+2', 'delta', "Delta Values", self.deltaTriggered), + ('actionPowerMarker', 'Ctrl+1', 'power_marker', "Power Marker", self.powerMarkerTriggered), + ('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), + ('actionQuit', 'Ctrl+Q', '', "Quit", QCoreApplication.instance().quit), + ('actionApplyFilter', 'Ctrl+F', '', "Apply Filter", self.applyFilterTriggered), + ('actionCancelFilter', 'Ctrl+Shift+F', '', "Cancel Filter", self.cancelFilterTriggered), + ('actionShowHelp', 'F1', '', "dupeGuru Help", self.showHelpTriggered), + ('actionAbout', '', '', "About dupeGuru", self.aboutTriggered), + ('actionRegister', '', '', "Register dupeGuru", self.registerTrigerred), + ('actionCheckForUpdate', '', '', "Check for Update", self.checkForUpdateTriggered), + ('actionExport', '', '', "Export To HTML", self.exportTriggered), + ('actionLoadResults', 'Ctrl+L', '', "Load Results...", self.loadResultsTriggered), + ('actionSaveResults', 'Ctrl+S', '', "Save Results...", self.saveResultsTriggered), + ('actionOpenDebugLog', '', '', "Open Debug Log", self.openDebugLogTriggered), + ('actionInvokeCustomCommand', 'Ctrl+I', '', "Invoke Custom Command", self.app.invokeCustomCommand), + ] + for name, shortcut, icon, desc, func in ACTIONS: + action = QAction(self) + if icon: + action.setIcon(QIcon(QPixmap(':/' + icon))) + if shortcut: + action.setShortcut(shortcut) + action.setText(desc) + action.triggered.connect(func) + setattr(self, name, action) + 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") + self.menuModes = QMenu(self.menubar) + self.menuModes.setTitle("Modes") + self.menuWindow = QMenu(self.menubar) + self.menuWindow.setTitle("Windows") + self.menuHelp = QMenu(self.menubar) + self.menuHelp.setTitle("Help") + self.setMenuBar(self.menubar) - self.setWindowTitle(QCoreApplication.instance().applicationName()) - self.actionScan.setIcon(QIcon(QPixmap(':/%s' % self.app.LOGO_NAME))) + 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) + self.menuModes.addAction(self.actionPowerMarker) + self.menuModes.addAction(self.actionDelta) + self.menuWindow.addAction(self.actionDetails) + self.menuWindow.addAction(self.actionDirectories) + self.menuWindow.addAction(self.actionPreferences) + self.menuHelp.addAction(self.actionShowHelp) + self.menuHelp.addAction(self.actionRegister) + self.menuHelp.addAction(self.actionCheckForUpdate) + self.menuHelp.addAction(self.actionOpenDebugLog) + self.menuHelp.addAction(self.actionAbout) + self.menuFile.addAction(self.actionScan) + self.menuFile.addSeparator() + self.menuFile.addAction(self.actionLoadResults) + self.menuFile.addAction(self.actionSaveResults) + self.menuFile.addAction(self.actionExport) + self.menuFile.addAction(self.actionClearIgnoreList) + self.menuFile.addSeparator() + self.menuFile.addAction(self.actionQuit) + + self.menubar.addAction(self.menuFile.menuAction()) + self.menubar.addAction(self.menuMark.menuAction()) + self.menubar.addAction(self.menuActions.menuAction()) + self.menubar.addAction(self.menuColumns.menuAction()) + self.menubar.addAction(self.menuModes.menuAction()) + self.menubar.addAction(self.menuWindow.menuAction()) + self.menubar.addAction(self.menuHelp.menuAction()) # Columns menu menu = self.menuColumns @@ -71,7 +168,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): action.column_index = -1 # Action menu - actionMenu = QMenu('Actions', self.toolBar) + actionMenu = QMenu('Actions', self.menubar) actionMenu.setIcon(QIcon(QPixmap(":/actions"))) actionMenu.addAction(self.actionDeleteMarked) actionMenu.addAction(self.actionHardlinkMarked) @@ -88,13 +185,51 @@ class MainWindow(QMainWindow, Ui_MainWindow): actionMenu.addAction(self.actionInvokeCustomCommand) actionMenu.addAction(self.actionRenameSelected) self.actionActions.setMenu(actionMenu) + + def _setupToolbar(self): + self.toolBar = QToolBar(self) + self.toolBar.setMovable(False) + self.toolBar.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) + self.toolBar.setFloatable(False) + self.addToolBar(Qt.ToolBarArea(Qt.TopToolBarArea), self.toolBar) + + self.toolBar.addAction(self.actionScan) button = QToolButton(self.toolBar) - button.setDefaultAction(actionMenu.menuAction()) + button.setDefaultAction(self.actionActions.menu().menuAction()) button.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) self.actionsButton = button - self.toolBar.insertWidget(self.actionActions, button) # the action is a placeholder - self.toolBar.removeAction(self.actionActions) - + self.toolBar.addWidget(button) + self.toolBar.addAction(self.actionDirectories) + self.toolBar.addAction(self.actionDetails) + self.toolBar.addAction(self.actionPreferences) + self.toolBar.addAction(self.actionDelta) + self.toolBar.addAction(self.actionPowerMarker) + + def _setupUi(self): + self.setWindowTitle(QCoreApplication.instance().applicationName()) + 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._setupToolbar() + self.statusbar = QStatusBar(self) + self.statusbar.setSizeGripEnabled(True) + self.setStatusBar(self.statusbar) self.statusLabel = QLabel(self) self.statusbar.addPermanentWidget(self.statusLabel, 1) diff --git a/qt/base/main_window.ui b/qt/base/main_window.ui deleted file mode 100644 index 299c7193..00000000 --- a/qt/base/main_window.ui +++ /dev/null @@ -1,990 +0,0 @@ - - - MainWindow - - - - 0 - 0 - 630 - 514 - - - - dupeGuru - - - - - 0 - - - - - QAbstractItemView::ExtendedSelection - - - QAbstractItemView::SelectRows - - - true - - - false - - - 18 - - - false - - - 18 - - - - - - - - - 0 - 0 - 630 - 22 - - - - - Columns - - - - - Actions - - - - - - - - - - - - - - - - - - - - - - Mark - - - - - - - - - Modes - - - - - - - Windows - - - - - - - - Help - - - - - - - - - - File - - - - - - - - - - - - - - - - - - - - - toolBar - - - false - - - Qt::ToolButtonTextUnderIcon - - - false - - - TopToolBarArea - - - false - - - - - - - - - - - - true - - - - - - :/logo_pe:/logo_pe - - - Start Scan - - - Start scanning for duplicates - - - Ctrl+T - - - - - - :/folder:/folder - - - Directories - - - Ctrl+4 - - - - - - :/details:/details - - - Details - - - Ctrl+3 - - - - - - :/actions:/actions - - - Actions - - - - - - :/preferences:/preferences - - - Preferences - - - Ctrl+5 - - - - - true - - - - :/delta:/delta - - - Delta Values - - - Ctrl+2 - - - - - true - - - - :/power_marker:/power_marker - - - Power Marker - - - Ctrl+1 - - - - - Send Marked to Recycle Bin - - - Ctrl+D - - - - - Delete Marked and Replace with Hardlinks - - - Ctrl+Shift+D - - - - - Move Marked to... - - - Ctrl+M - - - - - Copy Marked to... - - - Ctrl+Shift+M - - - - - Remove Marked from Results - - - Ctrl+R - - - - - Remove Selected from Results - - - Ctrl+Del - - - - - Add Selected to Ignore List - - - Ctrl+Shift+Del - - - - - Make Selected Reference - - - Ctrl+Space - - - - - Open Selected with Default Application - - - Ctrl+O - - - - - Open Containing Folder of Selected - - - Ctrl+Shift+O - - - - - Rename Selected - - - F2 - - - - - Mark All - - - Ctrl+A - - - - - Mark None - - - Ctrl+Shift+A - - - - - Invert Marking - - - Ctrl+Alt+A - - - - - Mark Selected - - - - - Clear Ignore List - - - - - Quit - - - Ctrl+Q - - - - - Apply Filter - - - Ctrl+F - - - - - Cancel Filter - - - Ctrl+Shift+F - - - - - dupeGuru Help - - - F1 - - - - - About dupeGuru - - - - - Register dupeGuru - - - - - Check for Update - - - - - Export To XHTML - - - - - Load Results... - - - Ctrl+L - - - - - Save Results... - - - Ctrl+S - - - - - Open Debug Log - - - - - Invoke Custom Command - - - Ctrl+I - - - - - - ResultsView - QTableView -
.results_model
-
-
- - - - - - actionDirectories - triggered() - MainWindow - directoriesTriggered() - - - -1 - -1 - - - 314 - 256 - - - - - actionActions - triggered() - MainWindow - actionsTriggered() - - - -1 - -1 - - - 314 - 256 - - - - - actionCopyMarked - triggered() - MainWindow - copyTriggered() - - - -1 - -1 - - - 314 - 256 - - - - - actionDeleteMarked - triggered() - MainWindow - deleteTriggered() - - - -1 - -1 - - - 314 - 256 - - - - - actionDelta - triggered() - MainWindow - deltaTriggered() - - - -1 - -1 - - - 314 - 256 - - - - - actionDetails - triggered() - MainWindow - detailsTriggered() - - - -1 - -1 - - - 314 - 256 - - - - - actionIgnoreSelected - triggered() - MainWindow - addToIgnoreListTriggered() - - - -1 - -1 - - - 314 - 256 - - - - - actionMakeSelectedReference - triggered() - MainWindow - makeReferenceTriggered() - - - -1 - -1 - - - 314 - 256 - - - - - actionMoveMarked - triggered() - MainWindow - moveTriggered() - - - -1 - -1 - - - 314 - 256 - - - - - actionOpenSelected - triggered() - MainWindow - openTriggered() - - - -1 - -1 - - - 314 - 256 - - - - - actionPowerMarker - triggered() - MainWindow - powerMarkerTriggered() - - - -1 - -1 - - - 314 - 256 - - - - - actionPreferences - triggered() - MainWindow - preferencesTriggered() - - - -1 - -1 - - - 314 - 256 - - - - - actionRemoveMarked - triggered() - MainWindow - removeMarkedTriggered() - - - -1 - -1 - - - 314 - 256 - - - - - actionRemoveSelected - triggered() - MainWindow - removeSelectedTriggered() - - - -1 - -1 - - - 314 - 256 - - - - - actionRevealSelected - triggered() - MainWindow - revealTriggered() - - - -1 - -1 - - - 314 - 256 - - - - - actionRenameSelected - triggered() - MainWindow - renameTriggered() - - - -1 - -1 - - - 314 - 256 - - - - - actionScan - triggered() - MainWindow - scanTriggered() - - - -1 - -1 - - - 314 - 256 - - - - - actionClearIgnoreList - triggered() - MainWindow - clearIgnoreListTriggered() - - - -1 - -1 - - - 314 - 256 - - - - - actionMarkAll - triggered() - MainWindow - markAllTriggered() - - - -1 - -1 - - - 314 - 256 - - - - - actionMarkNone - triggered() - MainWindow - markNoneTriggered() - - - -1 - -1 - - - 314 - 256 - - - - - actionMarkSelected - triggered() - MainWindow - markSelectedTriggered() - - - -1 - -1 - - - 314 - 256 - - - - - actionInvertMarking - triggered() - MainWindow - markInvertTriggered() - - - -1 - -1 - - - 314 - 256 - - - - - actionApplyFilter - triggered() - MainWindow - applyFilterTriggered() - - - -1 - -1 - - - 314 - 256 - - - - - actionCancelFilter - triggered() - MainWindow - cancelFilterTriggered() - - - -1 - -1 - - - 314 - 256 - - - - - actionShowHelp - triggered() - MainWindow - showHelpTriggered() - - - -1 - -1 - - - 314 - 256 - - - - - actionAbout - triggered() - MainWindow - aboutTriggered() - - - -1 - -1 - - - 314 - 256 - - - - - actionRegister - triggered() - MainWindow - registerTrigerred() - - - -1 - -1 - - - 314 - 256 - - - - - actionCheckForUpdate - triggered() - MainWindow - checkForUpdateTriggered() - - - -1 - -1 - - - 314 - 256 - - - - - actionExport - triggered() - MainWindow - exportTriggered() - - - -1 - -1 - - - 314 - 256 - - - - - actionOpenDebugLog - triggered() - MainWindow - openDebugLogTriggered() - - - -1 - -1 - - - 314 - 256 - - - - - - directoriesTriggered() - scanTriggered() - actionsTriggered() - detailsTriggered() - preferencesTriggered() - deltaTriggered() - powerMarkerTriggered() - deleteTriggered() - moveTriggered() - copyTriggered() - removeMarkedTriggered() - removeSelectedTriggered() - addToIgnoreListTriggered() - makeReferenceTriggered() - openTriggered() - revealTriggered() - renameTriggered() - clearIgnoreListTriggered() - clearPictureCacheTriggered() - markAllTriggered() - markNoneTriggered() - markInvertTriggered() - markSelectedTriggered() - applyFilterTriggered() - cancelFilterTriggered() - showHelpTriggered() - aboutTriggered() - registerTrigerred() - checkForUpdateTriggered() - exportTriggered() - openDebugLogTriggered() - -
diff --git a/qt/base/problem_dialog.py b/qt/base/problem_dialog.py index 41e1d456..68507f08 100644 --- a/qt/base/problem_dialog.py +++ b/qt/base/problem_dialog.py @@ -8,13 +8,13 @@ # http://www.hardcoded.net/licenses/bsd_license from PyQt4.QtCore import Qt -from PyQt4.QtGui import QDialog +from PyQt4.QtGui import (QDialog, QVBoxLayout, QHBoxLayout, QPushButton, QSpacerItem, QSizePolicy, + QLabel, QTableView, QAbstractItemView, QApplication) from core.gui.problem_dialog import ProblemDialog as ProblemDialogModel from .problem_table import ProblemTable -from .problem_dialog_ui import Ui_ProblemDialog -class ProblemDialog(QDialog, Ui_ProblemDialog): +class ProblemDialog(QDialog): def __init__(self, parent, app): flags = Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint QDialog.__init__(self, parent, flags) @@ -26,7 +26,43 @@ class ProblemDialog(QDialog, Ui_ProblemDialog): self.table.model.connect() self.revealButton.clicked.connect(self.model.reveal_selected_dupe) + self.closeButton.clicked.connect(self.accept) def _setupUi(self): - self.setupUi(self) + self.setWindowTitle("Problems!") + self.resize(413, 323) + self.verticalLayout = QVBoxLayout(self) + self.label = QLabel(self) + self.label.setText("There were problems processing some (or all) of the files. The cause of these problems are described in the table below. Those files were not removed from your results.") + self.label.setWordWrap(True) + self.verticalLayout.addWidget(self.label) + self.tableView = QTableView(self) + self.tableView.setEditTriggers(QAbstractItemView.NoEditTriggers) + self.tableView.setSelectionMode(QAbstractItemView.SingleSelection) + self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows) + self.tableView.setShowGrid(False) + self.tableView.horizontalHeader().setStretchLastSection(True) + self.tableView.verticalHeader().setDefaultSectionSize(18) + self.tableView.verticalHeader().setHighlightSections(False) + self.verticalLayout.addWidget(self.tableView) + self.horizontalLayout = QHBoxLayout() + self.revealButton = QPushButton(self) + self.revealButton.setText("Reveal Selected") + self.horizontalLayout.addWidget(self.revealButton) + spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + self.horizontalLayout.addItem(spacerItem) + self.closeButton = QPushButton(self) + self.closeButton.setText("Close") + self.closeButton.setDefault(True) + self.horizontalLayout.addWidget(self.closeButton) + self.verticalLayout.addLayout(self.horizontalLayout) + +if __name__ == '__main__': + import sys + from ..testapp import TestApp + app = QApplication([]) + dgapp = TestApp() + dialog = ProblemDialog(None, dgapp) + dialog.show() + sys.exit(app.exec_()) \ No newline at end of file diff --git a/qt/base/problem_dialog.ui b/qt/base/problem_dialog.ui deleted file mode 100644 index 65cc24bf..00000000 --- a/qt/base/problem_dialog.ui +++ /dev/null @@ -1,116 +0,0 @@ - - - ProblemDialog - - - - 0 - 0 - 413 - 323 - - - - Problems! - - - - - - There were problems processing some (or all) of the files. The cause of these problems are described in the table below. Those files were not removed from your results. - - - true - - - - - - - QAbstractItemView::NoEditTriggers - - - QAbstractItemView::SingleSelection - - - QAbstractItemView::SelectRows - - - false - - - true - - - 18 - - - false - - - 18 - - - true - - - false - - - - - - - - - Reveal Selected - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Close - - - true - - - - - - - - - - - closeButton - clicked() - ProblemDialog - accept() - - - 367 - 301 - - - 272 - 299 - - - - - diff --git a/qt/me/__init__.py b/qt/me/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/qt/me/app.py b/qt/me/app.py index f0e07ced..7a8992ad 100644 --- a/qt/me/app.py +++ b/qt/me/app.py @@ -8,10 +8,10 @@ from core_me import data, scanner, fs -from base.app import DupeGuru as DupeGuruBase -from details_dialog import DetailsDialog -from preferences import Preferences -from preferences_dialog import PreferencesDialog +from ..base.app import DupeGuru as DupeGuruBase +from .details_dialog import DetailsDialog +from .preferences import Preferences +from .preferences_dialog import PreferencesDialog class DupeGuru(DupeGuruBase): EDITION = 'me' diff --git a/qt/me/details_dialog.py b/qt/me/details_dialog.py index b5fc03b7..3a33cd2f 100644 --- a/qt/me/details_dialog.py +++ b/qt/me/details_dialog.py @@ -6,10 +6,23 @@ # which should be included with this package. The terms are also available at # http://www.hardcoded.net/licenses/bsd_license -from base.details_dialog import DetailsDialog as DetailsDialogBase -from details_dialog_ui import Ui_DetailsDialog +from PyQt4.QtCore import QSize +from PyQt4.QtGui import QVBoxLayout, QAbstractItemView -class DetailsDialog(DetailsDialogBase, Ui_DetailsDialog): +from ..base.details_dialog import DetailsDialog as DetailsDialogBase +from ..base.details_table import DetailsTable + +class DetailsDialog(DetailsDialogBase): def _setupUi(self): - self.setupUi(self) + self.setWindowTitle("Details") + self.resize(502, 295) + self.setMinimumSize(QSize(250, 250)) + self.verticalLayout = QVBoxLayout(self) + self.verticalLayout.setSpacing(0) + self.verticalLayout.setMargin(0) + self.tableView = DetailsTable(self) + self.tableView.setAlternatingRowColors(True) + self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows) + self.tableView.setShowGrid(False) + self.verticalLayout.addWidget(self.tableView) diff --git a/qt/me/details_dialog.ui b/qt/me/details_dialog.ui deleted file mode 100644 index c0557003..00000000 --- a/qt/me/details_dialog.ui +++ /dev/null @@ -1,53 +0,0 @@ - - - DetailsDialog - - - - 0 - 0 - 502 - 295 - - - - - 250 - 250 - - - - Details - - - - 0 - - - 0 - - - - - true - - - QAbstractItemView::SelectRows - - - false - - - - - - - - DetailsTable - QTableView -
base.details_table
-
-
- - -
diff --git a/qt/me/preferences.py b/qt/me/preferences.py index 9eac0f75..a1c64149 100644 --- a/qt/me/preferences.py +++ b/qt/me/preferences.py @@ -8,7 +8,7 @@ from core.scanner import ScanType -from base.preferences import Preferences as PreferencesBase +from ..base.preferences import Preferences as PreferencesBase class Preferences(PreferencesBase): # (width, is_visible) diff --git a/qt/me/preferences_dialog.py b/qt/me/preferences_dialog.py index 57bdd5cd..f80e6a8f 100644 --- a/qt/me/preferences_dialog.py +++ b/qt/me/preferences_dialog.py @@ -7,13 +7,13 @@ # http://www.hardcoded.net/licenses/bsd_license import sys -from PyQt4.QtCore import SIGNAL, Qt -from PyQt4.QtGui import QDialog, QDialogButtonBox +from PyQt4.QtCore import SIGNAL, Qt, QSize +from PyQt4.QtGui import (QDialog, QDialogButtonBox, QVBoxLayout, QHBoxLayout, QLabel, QComboBox, + QSlider, QSizePolicy, QSpacerItem, QWidget, QCheckBox, QLineEdit, QDialogButtonBox, QApplication) from core.scanner import ScanType -from preferences_dialog_ui import Ui_PreferencesDialog -import preferences +from . import preferences SCAN_TYPE_ORDER = [ ScanType.Filename, @@ -24,7 +24,7 @@ SCAN_TYPE_ORDER = [ ScanType.ContentsAudio, ] -class PreferencesDialog(QDialog, Ui_PreferencesDialog): +class PreferencesDialog(QDialog): def __init__(self, parent, app): flags = Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint QDialog.__init__(self, parent, flags) @@ -33,9 +33,148 @@ class PreferencesDialog(QDialog, Ui_PreferencesDialog): self.connect(self.buttonBox, SIGNAL('clicked(QAbstractButton*)'), self.buttonClicked) self.connect(self.scanTypeComboBox, SIGNAL('currentIndexChanged(int)'), self.scanTypeChanged) + self.connect(self.filterHardnessSlider, SIGNAL("valueChanged(int)"), self.filterHardnessLabel.setNum) + self.buttonBox.accepted.connect(self.accept) + self.buttonBox.rejected.connect(self.reject) def _setupUi(self): - self.setupUi(self) + self.setWindowTitle("Preferences") + self.resize(325, 360) + self.setSizeGripEnabled(False) + self.setModal(True) + self.verticalLayout_2 = QVBoxLayout(self) + self.verticalLayout = QVBoxLayout() + self.horizontalLayout = QHBoxLayout() + self.label_2 = QLabel(self) + self.label_2.setText("Scan Type:") + self.label_2.setMinimumSize(QSize(100, 0)) + self.label_2.setMaximumSize(QSize(100, 16777215)) + self.horizontalLayout.addWidget(self.label_2) + self.scanTypeComboBox = QComboBox(self) + self.scanTypeComboBox.addItem("Filename") + self.scanTypeComboBox.addItem("Filename - Fields") + self.scanTypeComboBox.addItem("Filename - Fields (No Order)") + self.scanTypeComboBox.addItem("Tags") + self.scanTypeComboBox.addItem("Contents") + self.scanTypeComboBox.addItem("Audio Contents") + self.horizontalLayout.addWidget(self.scanTypeComboBox) + self.verticalLayout.addLayout(self.horizontalLayout) + self.horizontalLayout_3 = QHBoxLayout() + self.label = QLabel(self) + self.label.setText("Filter Hardness:") + self.label.setMinimumSize(QSize(100, 0)) + self.label.setMaximumSize(QSize(100, 16777215)) + self.horizontalLayout_3.addWidget(self.label) + self.verticalLayout_3 = QVBoxLayout() + self.verticalLayout_3.setSpacing(0) + self.horizontalLayout_6 = QHBoxLayout() + self.horizontalLayout_6.setSpacing(12) + self.filterHardnessSlider = QSlider(self) + sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.filterHardnessSlider.sizePolicy().hasHeightForWidth()) + self.filterHardnessSlider.setSizePolicy(sizePolicy) + self.filterHardnessSlider.setMinimum(1) + self.filterHardnessSlider.setMaximum(100) + self.filterHardnessSlider.setTracking(True) + self.filterHardnessSlider.setOrientation(Qt.Horizontal) + self.horizontalLayout_6.addWidget(self.filterHardnessSlider) + self.filterHardnessLabel = QLabel(self) + self.filterHardnessLabel.setText("100") + self.filterHardnessLabel.setMinimumSize(QSize(21, 0)) + self.horizontalLayout_6.addWidget(self.filterHardnessLabel) + self.verticalLayout_3.addLayout(self.horizontalLayout_6) + self.horizontalLayout_5 = QHBoxLayout() + self.horizontalLayout_5.setContentsMargins(-1, 0, -1, -1) + self.label_4 = QLabel(self) + self.label_4.setText("More Results") + self.horizontalLayout_5.addWidget(self.label_4) + spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + self.horizontalLayout_5.addItem(spacerItem) + self.label_3 = QLabel(self) + self.label_3.setText("Fewer Results") + self.horizontalLayout_5.addWidget(self.label_3) + self.verticalLayout_3.addLayout(self.horizontalLayout_5) + self.horizontalLayout_3.addLayout(self.verticalLayout_3) + self.verticalLayout.addLayout(self.horizontalLayout_3) + self.widget = QWidget(self) + self.widget.setMinimumSize(QSize(0, 40)) + self.verticalLayout_4 = QVBoxLayout(self.widget) + self.verticalLayout_4.setSpacing(0) + self.verticalLayout_4.setMargin(0) + self.label_6 = QLabel(self.widget) + self.label_6.setText("Tags to scan:") + self.verticalLayout_4.addWidget(self.label_6) + self.horizontalLayout_2 = QHBoxLayout() + self.horizontalLayout_2.setSpacing(0) + spacerItem1 = QSpacerItem(15, 20, QSizePolicy.Fixed, QSizePolicy.Minimum) + self.horizontalLayout_2.addItem(spacerItem1) + self.tagTrackBox = QCheckBox(self.widget) + self.tagTrackBox.setText("Track") + self.horizontalLayout_2.addWidget(self.tagTrackBox) + self.tagArtistBox = QCheckBox(self.widget) + self.tagArtistBox.setText("Artist") + self.horizontalLayout_2.addWidget(self.tagArtistBox) + self.tagAlbumBox = QCheckBox(self.widget) + self.tagAlbumBox.setText("Album") + self.horizontalLayout_2.addWidget(self.tagAlbumBox) + self.tagTitleBox = QCheckBox(self.widget) + self.tagTitleBox.setText("Title") + self.horizontalLayout_2.addWidget(self.tagTitleBox) + self.tagGenreBox = QCheckBox(self.widget) + self.tagGenreBox.setText("Genre") + self.horizontalLayout_2.addWidget(self.tagGenreBox) + self.tagYearBox = QCheckBox(self.widget) + self.tagYearBox.setText("Year") + self.horizontalLayout_2.addWidget(self.tagYearBox) + self.verticalLayout_4.addLayout(self.horizontalLayout_2) + self.verticalLayout.addWidget(self.widget) + self.wordWeightingBox = QCheckBox(self) + self.wordWeightingBox.setText("Word weighting") + self.verticalLayout.addWidget(self.wordWeightingBox) + self.matchSimilarBox = QCheckBox(self) + self.matchSimilarBox.setText("Match similar words") + self.verticalLayout.addWidget(self.matchSimilarBox) + self.mixFileKindBox = QCheckBox(self) + self.mixFileKindBox.setText("Can mix file kind") + self.verticalLayout.addWidget(self.mixFileKindBox) + self.useRegexpBox = QCheckBox(self) + self.useRegexpBox.setText("Use regular expressions when filtering") + self.verticalLayout.addWidget(self.useRegexpBox) + self.removeEmptyFoldersBox = QCheckBox(self) + self.removeEmptyFoldersBox.setText("Remove empty folders on delete or move") + self.verticalLayout.addWidget(self.removeEmptyFoldersBox) + self.ignoreHardlinkMatches = QCheckBox(self) + self.ignoreHardlinkMatches.setText("Ignore duplicates hardlinking to the same file") + self.verticalLayout.addWidget(self.ignoreHardlinkMatches) + self.horizontalLayout_4 = QHBoxLayout() + self.label_5 = QLabel(self) + self.label_5.setText("Copy and Move:") + self.label_5.setMinimumSize(QSize(100, 0)) + self.label_5.setMaximumSize(QSize(100, 16777215)) + self.horizontalLayout_4.addWidget(self.label_5) + self.copyMoveDestinationComboBox = QComboBox(self) + sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.copyMoveDestinationComboBox.sizePolicy().hasHeightForWidth()) + self.copyMoveDestinationComboBox.setSizePolicy(sizePolicy) + self.copyMoveDestinationComboBox.addItem("Right in destination") + self.copyMoveDestinationComboBox.addItem("Recreate relative path") + self.copyMoveDestinationComboBox.addItem("Recreate absolute path") + self.horizontalLayout_4.addWidget(self.copyMoveDestinationComboBox) + self.verticalLayout.addLayout(self.horizontalLayout_4) + self.label_7 = QLabel(self) + self.label_7.setText("Custom Command (arguments: %d for dupe, %r for ref):") + self.verticalLayout.addWidget(self.label_7) + self.customCommandEdit = QLineEdit(self) + self.verticalLayout.addWidget(self.customCommandEdit) + self.verticalLayout_2.addLayout(self.verticalLayout) + self.buttonBox = QDialogButtonBox(self) + self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Ok|QDialogButtonBox.RestoreDefaults) + self.verticalLayout_2.addWidget(self.buttonBox) + if sys.platform not in {'darwin', 'linux2'}: self.verticalLayout.removeWidget(self.ignoreHardlinkMatches) self.ignoreHardlinkMatches.setHidden(True) @@ -107,3 +246,12 @@ class PreferencesDialog(QDialog, Ui_PreferencesDialog): self.tagGenreBox.setEnabled(tag_based) self.tagYearBox.setEnabled(tag_based) + +if __name__ == '__main__': + import sys + from ..testapp import TestApp + app = QApplication([]) + dgapp = TestApp() + dialog = PreferencesDialog(None, dgapp) + dialog.show() + sys.exit(app.exec_()) \ No newline at end of file diff --git a/qt/me/preferences_dialog.ui b/qt/me/preferences_dialog.ui deleted file mode 100644 index 1e00a211..00000000 --- a/qt/me/preferences_dialog.ui +++ /dev/null @@ -1,440 +0,0 @@ - - - PreferencesDialog - - - - 0 - 0 - 325 - 360 - - - - Preferences - - - false - - - true - - - - - - - - - - - 100 - 0 - - - - - 100 - 16777215 - - - - Scan Type: - - - - - - - - Filename - - - - - Filename - Fields - - - - - Filename - Fields (No Order) - - - - - Tags - - - - - Contents - - - - - Audio Contents - - - - - - - - - - - - - 100 - 0 - - - - - 100 - 16777215 - - - - Filter Hardness: - - - - - - - 0 - - - - - 12 - - - - - - 0 - 0 - - - - 1 - - - 100 - - - true - - - Qt::Horizontal - - - - - - - - 21 - 0 - - - - 100 - - - - - - - - - 0 - - - - - More Results - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Fewer Results - - - - - - - - - - - - - - 0 - 40 - - - - - 0 - - - 0 - - - - - Tags to scan: - - - - - - - 0 - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 15 - 20 - - - - - - - - Track - - - - - - - Artist - - - - - - - Album - - - - - - - Title - - - - - - - Genre - - - - - - - Year - - - - - - - - - - - - Word weighting - - - - - - - Match similar words - - - - - - - Can mix file kind - - - - - - - Use regular expressions when filtering - - - - - - - Remove empty folders on delete or move - - - - - - - Ignore duplicates hardlinking to the same file - - - - - - - - - - 100 - 0 - - - - - 100 - 16777215 - - - - Copy and Move: - - - - - - - - 0 - 0 - - - - - Right in destination - - - - - Recreate relative path - - - - - Recreate absolute path - - - - - - - - - - Custom Command (arguments: %d for dupe, %r for ref): - - - - - - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::RestoreDefaults - - - - - - - - - filterHardnessSlider - valueChanged(int) - filterHardnessLabel - setNum(int) - - - 182 - 26 - - - 271 - 26 - - - - - buttonBox - accepted() - PreferencesDialog - accept() - - - 182 - 228 - - - 182 - 124 - - - - - buttonBox - rejected() - PreferencesDialog - reject() - - - 182 - 228 - - - 182 - 124 - - - - - diff --git a/qt/me/start.py b/qt/me/start.py index 7ae84e16..acec0245 100644 --- a/qt/me/start.py +++ b/qt/me/start.py @@ -12,9 +12,8 @@ sip.setapi('QVariant', 1) from PyQt4.QtCore import QCoreApplication from PyQt4.QtGui import QApplication, QIcon, QPixmap -import base.dg_rc - -from app import DupeGuru +from ..base import dg_rc +from .app import DupeGuru if sys.platform == 'win32': import base.cxfreeze_fix diff --git a/qt/pe/__init__.py b/qt/pe/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/qt/pe/app.py b/qt/pe/app.py index 4708806f..3b1b0893 100644 --- a/qt/pe/app.py +++ b/qt/pe/app.py @@ -18,12 +18,12 @@ from core_pe import data as data_pe from core_pe.cache import Cache from core_pe.scanner import ScannerPE -from block import getblocks -from base.app import DupeGuru as DupeGuruBase -from details_dialog import DetailsDialog -from main_window import MainWindow -from preferences import Preferences -from preferences_dialog import PreferencesDialog +from ..base.app import DupeGuru as DupeGuruBase +from .block import getblocks +from .details_dialog import DetailsDialog +from .main_window import MainWindow +from .preferences import Preferences +from .preferences_dialog import PreferencesDialog class File(fs.File): INITIAL_INFO = fs.File.INITIAL_INFO.copy() diff --git a/qt/pe/block.py b/qt/pe/block.py index f6e43393..005af299 100644 --- a/qt/pe/block.py +++ b/qt/pe/block.py @@ -6,7 +6,7 @@ # which should be included with this package. The terms are also available at # http://www.hardcoded.net/licenses/bsd_license -from _block_qt import getblocks +from ._block_qt import getblocks # Converted to C # def getblock(image): diff --git a/qt/pe/details_dialog.py b/qt/pe/details_dialog.py index d32fd0e9..cefa19e4 100644 --- a/qt/pe/details_dialog.py +++ b/qt/pe/details_dialog.py @@ -6,20 +6,57 @@ # which should be included with this package. The terms are also available at # http://www.hardcoded.net/licenses/bsd_license -from PyQt4.QtCore import Qt -from PyQt4.QtGui import QPixmap +from PyQt4.QtCore import Qt, QSize +from PyQt4.QtGui import QVBoxLayout, QAbstractItemView, QHBoxLayout, QLabel, QSizePolicy, QPixmap -from base.details_dialog import DetailsDialog as DetailsDialogBase -from details_dialog_ui import Ui_DetailsDialog +from ..base.details_dialog import DetailsDialog as DetailsDialogBase +from ..base.details_table import DetailsTable -class DetailsDialog(DetailsDialogBase, Ui_DetailsDialog): +class DetailsDialog(DetailsDialogBase): def __init__(self, parent, app): DetailsDialogBase.__init__(self, parent, app) self.selectedPixmap = None self.referencePixmap = None def _setupUi(self): - self.setupUi(self) + self.setWindowTitle("Details") + self.resize(502, 295) + self.setMinimumSize(QSize(250, 250)) + self.verticalLayout = QVBoxLayout(self) + self.verticalLayout.setSpacing(0) + self.verticalLayout.setMargin(0) + self.horizontalLayout = QHBoxLayout() + self.horizontalLayout.setSpacing(4) + self.selectedImage = QLabel(self) + sizePolicy = QSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.selectedImage.sizePolicy().hasHeightForWidth()) + self.selectedImage.setSizePolicy(sizePolicy) + self.selectedImage.setScaledContents(False) + self.selectedImage.setAlignment(Qt.AlignCenter) + self.horizontalLayout.addWidget(self.selectedImage) + self.referenceImage = QLabel(self) + sizePolicy = QSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.referenceImage.sizePolicy().hasHeightForWidth()) + self.referenceImage.setSizePolicy(sizePolicy) + self.referenceImage.setAlignment(Qt.AlignCenter) + self.horizontalLayout.addWidget(self.referenceImage) + self.verticalLayout.addLayout(self.horizontalLayout) + self.tableView = DetailsTable(self) + sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.tableView.sizePolicy().hasHeightForWidth()) + self.tableView.setSizePolicy(sizePolicy) + self.tableView.setMinimumSize(QSize(0, 188)) + self.tableView.setMaximumSize(QSize(16777215, 190)) + self.tableView.setAlternatingRowColors(True) + self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows) + self.tableView.setShowGrid(False) + self.verticalLayout.addWidget(self.tableView) def _update(self): if not self.app.selected_dupes: diff --git a/qt/pe/details_dialog.ui b/qt/pe/details_dialog.ui deleted file mode 100644 index c4498068..00000000 --- a/qt/pe/details_dialog.ui +++ /dev/null @@ -1,113 +0,0 @@ - - - DetailsDialog - - - - 0 - 0 - 502 - 295 - - - - - 250 - 250 - - - - Details - - - - 0 - - - 0 - - - - - 4 - - - - - - 0 - 0 - - - - - - - false - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - - - Qt::AlignCenter - - - - - - - - - - 0 - 0 - - - - - 0 - 188 - - - - - 16777215 - 190 - - - - true - - - QAbstractItemView::SelectRows - - - false - - - - - - - - DetailsTable - QTableView -
base.details_table
-
-
- - -
diff --git a/qt/pe/main_window.py b/qt/pe/main_window.py index a86adf8d..a06483d1 100644 --- a/qt/pe/main_window.py +++ b/qt/pe/main_window.py @@ -9,7 +9,7 @@ from PyQt4.QtCore import SIGNAL from PyQt4.QtGui import QMessageBox, QAction -from base.main_window import MainWindow as MainWindowBase +from ..base.main_window import MainWindow as MainWindowBase class MainWindow(MainWindowBase): def _setupUi(self): diff --git a/qt/pe/preferences.py b/qt/pe/preferences.py index 7ce2f77c..65363b71 100644 --- a/qt/pe/preferences.py +++ b/qt/pe/preferences.py @@ -8,7 +8,7 @@ from PyQt4.QtCore import QSettings, QVariant -from base.preferences import Preferences as PreferencesBase +from ..base.preferences import Preferences as PreferencesBase class Preferences(PreferencesBase): # (width, is_visible) diff --git a/qt/pe/preferences_dialog.py b/qt/pe/preferences_dialog.py index 360f2a34..149cb0f2 100644 --- a/qt/pe/preferences_dialog.py +++ b/qt/pe/preferences_dialog.py @@ -7,13 +7,13 @@ # http://www.hardcoded.net/licenses/bsd_license import sys -from PyQt4.QtCore import SIGNAL, Qt -from PyQt4.QtGui import QDialog, QDialogButtonBox +from PyQt4.QtCore import SIGNAL, Qt, QSize +from PyQt4.QtGui import (QDialog, QDialogButtonBox, QVBoxLayout, QHBoxLayout, QLabel, QComboBox, + QSlider, QSizePolicy, QSpacerItem, QWidget, QCheckBox, QLineEdit, QDialogButtonBox, QApplication) -from preferences_dialog_ui import Ui_PreferencesDialog -import preferences +from . import preferences -class PreferencesDialog(QDialog, Ui_PreferencesDialog): +class PreferencesDialog(QDialog): def __init__(self, parent, app): flags = Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint QDialog.__init__(self, parent, flags) @@ -21,9 +21,94 @@ class PreferencesDialog(QDialog, Ui_PreferencesDialog): self._setupUi() self.connect(self.buttonBox, SIGNAL('clicked(QAbstractButton*)'), self.buttonClicked) + self.connect(self.filterHardnessSlider, SIGNAL("valueChanged(int)"), self.filterHardnessLabel.setNum) + self.buttonBox.accepted.connect(self.accept) + self.buttonBox.rejected.connect(self.reject) def _setupUi(self): - self.setupUi(self) + self.setWindowTitle("Preferences") + self.resize(304, 263) + self.setSizeGripEnabled(False) + self.setModal(True) + self.verticalLayout_2 = QVBoxLayout(self) + self.verticalLayout = QVBoxLayout() + self.horizontalLayout_3 = QHBoxLayout() + self.label = QLabel(self) + self.label.setText("Filter Hardness:") + self.label.setMinimumSize(QSize(0, 0)) + self.horizontalLayout_3.addWidget(self.label) + self.verticalLayout_3 = QVBoxLayout() + self.verticalLayout_3.setSpacing(0) + self.horizontalLayout_6 = QHBoxLayout() + self.horizontalLayout_6.setSpacing(12) + self.filterHardnessSlider = QSlider(self) + sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.filterHardnessSlider.sizePolicy().hasHeightForWidth()) + self.filterHardnessSlider.setSizePolicy(sizePolicy) + self.filterHardnessSlider.setMinimum(1) + self.filterHardnessSlider.setMaximum(100) + self.filterHardnessSlider.setTracking(True) + self.filterHardnessSlider.setOrientation(Qt.Horizontal) + self.horizontalLayout_6.addWidget(self.filterHardnessSlider) + self.filterHardnessLabel = QLabel(self) + self.filterHardnessLabel.setText("100") + self.filterHardnessLabel.setMinimumSize(QSize(21, 0)) + self.horizontalLayout_6.addWidget(self.filterHardnessLabel) + self.verticalLayout_3.addLayout(self.horizontalLayout_6) + self.horizontalLayout_5 = QHBoxLayout() + self.horizontalLayout_5.setContentsMargins(-1, 0, -1, -1) + self.label_4 = QLabel(self) + self.label_4.setText("More Results") + self.horizontalLayout_5.addWidget(self.label_4) + spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + self.horizontalLayout_5.addItem(spacerItem) + self.label_3 = QLabel(self) + self.label_3.setText("Fewer Results") + self.horizontalLayout_5.addWidget(self.label_3) + self.verticalLayout_3.addLayout(self.horizontalLayout_5) + self.horizontalLayout_3.addLayout(self.verticalLayout_3) + self.verticalLayout.addLayout(self.horizontalLayout_3) + self.matchScaledBox = QCheckBox(self) + self.matchScaledBox.setText("Match scaled pictures together") + self.verticalLayout.addWidget(self.matchScaledBox) + self.mixFileKindBox = QCheckBox(self) + self.mixFileKindBox.setText("Can mix file kind") + self.verticalLayout.addWidget(self.mixFileKindBox) + self.useRegexpBox = QCheckBox(self) + self.useRegexpBox.setText("Use regular expressions when filtering") + self.verticalLayout.addWidget(self.useRegexpBox) + self.removeEmptyFoldersBox = QCheckBox(self) + self.removeEmptyFoldersBox.setText("Remove empty folders on delete or move") + self.verticalLayout.addWidget(self.removeEmptyFoldersBox) + self.ignoreHardlinkMatches = QCheckBox(self) + self.ignoreHardlinkMatches.setText("Ignore duplicates hardlinking to the same file") + self.verticalLayout.addWidget(self.ignoreHardlinkMatches) + self.horizontalLayout_4 = QHBoxLayout() + self.label_5 = QLabel(self) + self.label_5.setText("Copy and Move:") + self.label_5.setMinimumSize(QSize(0, 0)) + self.horizontalLayout_4.addWidget(self.label_5) + self.copyMoveDestinationComboBox = QComboBox(self) + sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.copyMoveDestinationComboBox.sizePolicy().hasHeightForWidth()) + self.copyMoveDestinationComboBox.addItem("Right in destination") + self.copyMoveDestinationComboBox.addItem("Recreate relative path") + self.copyMoveDestinationComboBox.addItem("Recreate absolute path") + self.horizontalLayout_4.addWidget(self.copyMoveDestinationComboBox) + self.verticalLayout.addLayout(self.horizontalLayout_4) + self.label_2 = QLabel(self) + self.label_2.setText("Custom Command (arguments: %d for dupe %r for ref):") + self.verticalLayout.addWidget(self.label_2) + self.customCommandEdit = QLineEdit(self) + self.verticalLayout.addWidget(self.customCommandEdit) + self.verticalLayout_2.addLayout(self.verticalLayout) + self.buttonBox = QDialogButtonBox(self) + self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Ok|QDialogButtonBox.RestoreDefaults) + self.verticalLayout_2.addWidget(self.buttonBox) if sys.platform not in {'darwin', 'linux2'}: self.verticalLayout.removeWidget(self.ignoreHardlinkMatches) self.ignoreHardlinkMatches.setHidden(True) @@ -61,3 +146,12 @@ class PreferencesDialog(QDialog, Ui_PreferencesDialog): if role == QDialogButtonBox.ResetRole: self.resetToDefaults() + +if __name__ == '__main__': + import sys + from ..testapp import TestApp + app = QApplication([]) + dgapp = TestApp() + dialog = PreferencesDialog(None, dgapp) + dialog.show() + sys.exit(app.exec_()) \ No newline at end of file diff --git a/qt/pe/preferences_dialog.ui b/qt/pe/preferences_dialog.ui deleted file mode 100644 index c0aa0b8b..00000000 --- a/qt/pe/preferences_dialog.ui +++ /dev/null @@ -1,274 +0,0 @@ - - - PreferencesDialog - - - - 0 - 0 - 304 - 263 - - - - Preferences - - - false - - - true - - - - - - - - - - - 0 - 0 - - - - Filter Hardness: - - - - - - - 0 - - - - - 12 - - - - - - 0 - 0 - - - - 1 - - - 100 - - - true - - - Qt::Horizontal - - - - - - - - 21 - 0 - - - - 100 - - - - - - - - - 0 - - - - - More Results - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Fewer Results - - - - - - - - - - - - - Match scaled pictures together - - - - - - - Can mix file kind - - - - - - - Use regular expressions when filtering - - - - - - - Remove empty folders on delete or move - - - - - - - Ignore duplicates hardlinking to the same file - - - - - - - - - - 0 - 0 - - - - Copy and Move: - - - - - - - - 0 - 0 - - - - - Right in destination - - - - - Recreate relative path - - - - - Recreate absolute path - - - - - - - - - - Custom Command (arguments: %d for dupe %r for ref): - - - - - - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::RestoreDefaults - - - - - - - - - filterHardnessSlider - valueChanged(int) - filterHardnessLabel - setNum(int) - - - 182 - 26 - - - 271 - 26 - - - - - buttonBox - accepted() - PreferencesDialog - accept() - - - 182 - 228 - - - 182 - 124 - - - - - buttonBox - rejected() - PreferencesDialog - reject() - - - 182 - 228 - - - 182 - 124 - - - - - diff --git a/qt/pe/start.py b/qt/pe/start.py index 3d7420d1..ee48d19c 100644 --- a/qt/pe/start.py +++ b/qt/pe/start.py @@ -12,9 +12,8 @@ sip.setapi('QVariant', 1) from PyQt4.QtCore import QCoreApplication from PyQt4.QtGui import QApplication, QIcon, QPixmap -import base.dg_rc - -from app import DupeGuru +from ..base import dg_rc +from .app import DupeGuru if sys.platform == 'win32': import base.cxfreeze_fix diff --git a/qt/se/__init__.py b/qt/se/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/qt/se/app.py b/qt/se/app.py index ac8b9f61..63e3efbf 100644 --- a/qt/se/app.py +++ b/qt/se/app.py @@ -9,10 +9,10 @@ from core_se import data from core.directories import Directories as DirectoriesBase, STATE_EXCLUDED -from base.app import DupeGuru as DupeGuruBase -from details_dialog import DetailsDialog -from preferences import Preferences -from preferences_dialog import PreferencesDialog +from ..base.app import DupeGuru as DupeGuruBase +from .details_dialog import DetailsDialog +from .preferences import Preferences +from .preferences_dialog import PreferencesDialog class Directories(DirectoriesBase): ROOT_PATH_TO_EXCLUDE = frozenset(['windows', 'program files']) diff --git a/qt/se/details_dialog.py b/qt/se/details_dialog.py index 27d0dbf6..dfe7c366 100644 --- a/qt/se/details_dialog.py +++ b/qt/se/details_dialog.py @@ -6,10 +6,23 @@ # which should be included with this package. The terms are also available at # http://www.hardcoded.net/licenses/bsd_license -from base.details_dialog import DetailsDialog as DetailsDialogBase -from details_dialog_ui import Ui_DetailsDialog +from PyQt4.QtCore import QSize +from PyQt4.QtGui import QVBoxLayout, QAbstractItemView -class DetailsDialog(DetailsDialogBase, Ui_DetailsDialog): +from ..base.details_dialog import DetailsDialog as DetailsDialogBase +from ..base.details_table import DetailsTable + +class DetailsDialog(DetailsDialogBase): def _setupUi(self): - self.setupUi(self) + self.setWindowTitle("Details") + self.resize(502, 186) + self.setMinimumSize(QSize(200, 0)) + self.verticalLayout = QVBoxLayout(self) + self.verticalLayout.setSpacing(0) + self.verticalLayout.setMargin(0) + self.tableView = DetailsTable(self) + self.tableView.setAlternatingRowColors(True) + self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows) + self.tableView.setShowGrid(False) + self.verticalLayout.addWidget(self.tableView) diff --git a/qt/se/details_dialog.ui b/qt/se/details_dialog.ui deleted file mode 100644 index 1dc063d0..00000000 --- a/qt/se/details_dialog.ui +++ /dev/null @@ -1,53 +0,0 @@ - - - DetailsDialog - - - - 0 - 0 - 502 - 186 - - - - - 200 - 0 - - - - Details - - - - 0 - - - 0 - - - - - true - - - QAbstractItemView::SelectRows - - - false - - - - - - - - DetailsTable - QTableView -
base.details_table
-
-
- - -
diff --git a/qt/se/preferences.py b/qt/se/preferences.py index ced2537f..f9592836 100644 --- a/qt/se/preferences.py +++ b/qt/se/preferences.py @@ -8,7 +8,7 @@ from core.scanner import ScanType -from base.preferences import Preferences as PreferencesBase +from ..base.preferences import Preferences as PreferencesBase class Preferences(PreferencesBase): # (width, is_visible) diff --git a/qt/se/preferences_dialog.py b/qt/se/preferences_dialog.py index ca85c3ac..b3cbd6b8 100644 --- a/qt/se/preferences_dialog.py +++ b/qt/se/preferences_dialog.py @@ -7,22 +7,22 @@ # http://www.hardcoded.net/licenses/bsd_license import platform -from PyQt4.QtCore import SIGNAL, Qt -from PyQt4.QtGui import QDialog, QDialogButtonBox +from PyQt4.QtCore import SIGNAL, Qt, QSize +from PyQt4.QtGui import (QDialog, QDialogButtonBox, QVBoxLayout, QHBoxLayout, QLabel, QComboBox, + QSlider, QSizePolicy, QSpacerItem, QWidget, QCheckBox, QLineEdit, QDialogButtonBox, QApplication) from hsutil.misc import tryint from core.scanner import ScanType -from preferences_dialog_ui import Ui_PreferencesDialog -import preferences +from . import preferences SCAN_TYPE_ORDER = [ ScanType.Filename, ScanType.Contents, ] -class PreferencesDialog(QDialog, Ui_PreferencesDialog): +class PreferencesDialog(QDialog): def __init__(self, parent, app): flags = Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint QDialog.__init__(self, parent, flags) @@ -31,9 +31,134 @@ class PreferencesDialog(QDialog, Ui_PreferencesDialog): self.connect(self.buttonBox, SIGNAL('clicked(QAbstractButton*)'), self.buttonClicked) self.connect(self.scanTypeComboBox, SIGNAL('currentIndexChanged(int)'), self.scanTypeChanged) + self.connect(self.filterHardnessSlider, SIGNAL("valueChanged(int)"), self.filterHardnessLabel.setNum) + self.buttonBox.accepted.connect(self.accept) + self.buttonBox.rejected.connect(self.reject) def _setupUi(self): - self.setupUi(self) + self.setWindowTitle("Preferences") + self.resize(308, 361) + self.setSizeGripEnabled(False) + self.setModal(True) + self.verticalLayout_2 = QVBoxLayout(self) + self.verticalLayout = QVBoxLayout() + self.horizontalLayout = QHBoxLayout() + self.label_2 = QLabel(self) + self.label_2.setText("Scan Type:") + self.label_2.setMinimumSize(QSize(100, 0)) + self.label_2.setMaximumSize(QSize(100, 16777215)) + self.horizontalLayout.addWidget(self.label_2) + self.scanTypeComboBox = QComboBox(self) + self.scanTypeComboBox.addItem("Filename") + self.scanTypeComboBox.addItem("Contents") + self.horizontalLayout.addWidget(self.scanTypeComboBox) + self.verticalLayout.addLayout(self.horizontalLayout) + self.horizontalLayout_3 = QHBoxLayout() + self.label = QLabel(self) + self.label.setText("Filter Hardness:") + self.label.setMinimumSize(QSize(100, 0)) + self.label.setMaximumSize(QSize(100, 16777215)) + self.horizontalLayout_3.addWidget(self.label) + self.verticalLayout_3 = QVBoxLayout() + self.verticalLayout_3.setSpacing(0) + self.horizontalLayout_6 = QHBoxLayout() + self.horizontalLayout_6.setSpacing(12) + self.filterHardnessSlider = QSlider(self) + sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.filterHardnessSlider.sizePolicy().hasHeightForWidth()) + self.filterHardnessSlider.setSizePolicy(sizePolicy) + self.filterHardnessSlider.setMinimum(1) + self.filterHardnessSlider.setMaximum(100) + self.filterHardnessSlider.setTracking(True) + self.filterHardnessSlider.setOrientation(Qt.Horizontal) + self.horizontalLayout_6.addWidget(self.filterHardnessSlider) + self.filterHardnessLabel = QLabel(self) + self.filterHardnessLabel.setText("100") + self.filterHardnessLabel.setMinimumSize(QSize(21, 0)) + self.horizontalLayout_6.addWidget(self.filterHardnessLabel) + self.verticalLayout_3.addLayout(self.horizontalLayout_6) + self.horizontalLayout_5 = QHBoxLayout() + self.horizontalLayout_5.setContentsMargins(-1, 0, -1, -1) + self.label_4 = QLabel(self) + self.label_4.setText("More Results") + self.horizontalLayout_5.addWidget(self.label_4) + spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + self.horizontalLayout_5.addItem(spacerItem) + self.label_3 = QLabel(self) + self.label_3.setText("Fewer Results") + self.horizontalLayout_5.addWidget(self.label_3) + self.verticalLayout_3.addLayout(self.horizontalLayout_5) + self.horizontalLayout_3.addLayout(self.verticalLayout_3) + self.verticalLayout.addLayout(self.horizontalLayout_3) + self.widget = QWidget(self) + self.widget.setMinimumSize(QSize(0, 136)) + self.verticalLayout_4 = QVBoxLayout(self.widget) + self.wordWeightingBox = QCheckBox(self.widget) + self.wordWeightingBox.setText("Word weighting") + self.verticalLayout_4.addWidget(self.wordWeightingBox) + self.matchSimilarBox = QCheckBox(self.widget) + self.matchSimilarBox.setText("Match similar words") + self.verticalLayout_4.addWidget(self.matchSimilarBox) + self.mixFileKindBox = QCheckBox(self.widget) + self.mixFileKindBox.setText("Can mix file kind") + self.verticalLayout_4.addWidget(self.mixFileKindBox) + self.useRegexpBox = QCheckBox(self.widget) + self.useRegexpBox.setText("Use regular expressions when filtering") + self.verticalLayout_4.addWidget(self.useRegexpBox) + self.removeEmptyFoldersBox = QCheckBox(self.widget) + self.removeEmptyFoldersBox.setText("Remove empty folders on delete or move") + self.verticalLayout_4.addWidget(self.removeEmptyFoldersBox) + self.horizontalLayout_2 = QHBoxLayout() + self.ignoreSmallFilesBox = QCheckBox(self.widget) + self.ignoreSmallFilesBox.setText("Ignore files smaller than") + self.horizontalLayout_2.addWidget(self.ignoreSmallFilesBox) + self.sizeThresholdEdit = QLineEdit(self.widget) + sizePolicy = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.sizeThresholdEdit.sizePolicy().hasHeightForWidth()) + self.sizeThresholdEdit.setSizePolicy(sizePolicy) + self.sizeThresholdEdit.setMaximumSize(QSize(50, 16777215)) + self.horizontalLayout_2.addWidget(self.sizeThresholdEdit) + self.label_6 = QLabel(self.widget) + self.label_6.setText("KB") + self.horizontalLayout_2.addWidget(self.label_6) + spacerItem1 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + self.horizontalLayout_2.addItem(spacerItem1) + self.verticalLayout_4.addLayout(self.horizontalLayout_2) + self.ignoreHardlinkMatches = QCheckBox(self.widget) + self.ignoreHardlinkMatches.setText("Ignore duplicates hardlinking to the same file") + self.verticalLayout_4.addWidget(self.ignoreHardlinkMatches) + self.verticalLayout.addWidget(self.widget) + self.horizontalLayout_4 = QHBoxLayout() + self.label_5 = QLabel(self) + self.label_5.setText("Copy and Move:") + self.label_5.setMinimumSize(QSize(100, 0)) + self.label_5.setMaximumSize(QSize(100, 16777215)) + self.horizontalLayout_4.addWidget(self.label_5) + self.copyMoveDestinationComboBox = QComboBox(self) + sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.copyMoveDestinationComboBox.sizePolicy().hasHeightForWidth()) + self.copyMoveDestinationComboBox.setSizePolicy(sizePolicy) + self.copyMoveDestinationComboBox.addItem("Right in destination") + self.copyMoveDestinationComboBox.addItem("Recreate relative path") + self.copyMoveDestinationComboBox.addItem("Recreate absolute path") + self.horizontalLayout_4.addWidget(self.copyMoveDestinationComboBox) + self.verticalLayout.addLayout(self.horizontalLayout_4) + self.label_7 = QLabel(self) + self.label_7.setText("Custom Command (arguments: %d for dupe, %r for ref):") + self.verticalLayout.addWidget(self.label_7) + self.customCommandEdit = QLineEdit(self) + self.verticalLayout.addWidget(self.customCommandEdit) + self.verticalLayout_2.addLayout(self.verticalLayout) + self.buttonBox = QDialogButtonBox(self) + self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Ok|QDialogButtonBox.RestoreDefaults) + self.verticalLayout_2.addWidget(self.buttonBox) + if platform.system() not in {'Darwin', 'Linux'}: self.verticalLayout_4.removeWidget(self.ignoreHardlinkMatches) self.ignoreHardlinkMatches.setHidden(True) @@ -93,3 +218,12 @@ class PreferencesDialog(QDialog, Ui_PreferencesDialog): self.matchSimilarBox.setEnabled(word_based) self.wordWeightingBox.setEnabled(word_based) + +if __name__ == '__main__': + import sys + from ..testapp import TestApp + app = QApplication([]) + dgapp = TestApp() + dialog = PreferencesDialog(None, dgapp) + dialog.show() + sys.exit(app.exec_()) \ No newline at end of file diff --git a/qt/se/preferences_dialog.ui b/qt/se/preferences_dialog.ui deleted file mode 100644 index 217a5cc9..00000000 --- a/qt/se/preferences_dialog.ui +++ /dev/null @@ -1,389 +0,0 @@ - - - PreferencesDialog - - - - 0 - 0 - 308 - 361 - - - - Preferences - - - false - - - true - - - - - - - - - - - 100 - 0 - - - - - 100 - 16777215 - - - - Scan Type: - - - - - - - - Filename - - - - - Contents - - - - - - - - - - - - - 100 - 0 - - - - - 100 - 16777215 - - - - Filter Hardness: - - - - - - - 0 - - - - - 12 - - - - - - 0 - 0 - - - - 1 - - - 100 - - - true - - - Qt::Horizontal - - - - - - - - 21 - 0 - - - - 100 - - - - - - - - - 0 - - - - - More Results - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Fewer Results - - - - - - - - - - - - - - 0 - 136 - - - - - - - Word weighting - - - - - - - Match similar words - - - - - - - Can mix file kind - - - - - - - Use regular expressions when filtering - - - - - - - Remove empty folders on delete or move - - - - - - - - - Ignore files smaller than - - - - - - - - 0 - 0 - - - - - 50 - 16777215 - - - - - - - - KB - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Ignore duplicates hardlinking to the same file - - - - - - - - - - - - - 100 - 0 - - - - - 100 - 16777215 - - - - Copy and Move: - - - - - - - - 0 - 0 - - - - - Right in destination - - - - - Recreate relative path - - - - - Recreate absolute path - - - - - - - - - - Custom Command (arguments: %d for dupe, %r for ref): - - - - - - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::RestoreDefaults - - - - - - - - - filterHardnessSlider - valueChanged(int) - filterHardnessLabel - setNum(int) - - - 182 - 26 - - - 271 - 26 - - - - - buttonBox - accepted() - PreferencesDialog - accept() - - - 182 - 228 - - - 182 - 124 - - - - - buttonBox - rejected() - PreferencesDialog - reject() - - - 182 - 228 - - - 182 - 124 - - - - - diff --git a/qt/se/start.py b/qt/se/start.py index f98e371f..d5420b53 100644 --- a/qt/se/start.py +++ b/qt/se/start.py @@ -13,9 +13,8 @@ sip.setapi('QVariant', 1) from PyQt4.QtCore import QCoreApplication from PyQt4.QtGui import QApplication, QIcon, QPixmap -import base.dg_rc - -from app import DupeGuru +from ..base import dg_rc +from .app import DupeGuru if sys.platform == 'win32': import base.cxfreeze_fix diff --git a/qt/testapp.py b/qt/testapp.py new file mode 100644 index 00000000..722beb06 --- /dev/null +++ b/qt/testapp.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Created By: Virgil Dupras +# Created On: 2010-10-04 +# Copyright 2010 Hardcoded Software (http://www.hardcoded.net) +# +# This software is licensed under the "HS" 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/hs_license + +from .se.app import DupeGuru + +class TestApp(DupeGuru): + # Use this for as a mock for UI testing. + def mustShowNag(self): + pass + + def _setup(self): + self.prefs = self._create_preferences() + self.prefs.load() + diff --git a/run.py b/run.py index a6f688cc..d9a116f9 100644 --- a/run.py +++ b/run.py @@ -10,6 +10,7 @@ import sys import os import os.path as op +import runpy import yaml @@ -31,10 +32,7 @@ def main(): os.system('open {0}'.format(app_path)) elif ui == 'qt': add_to_pythonpath('.') - add_to_pythonpath('qt') - os.chdir(op.join('qt', edition)) - os.system('{0} start.py'.format(sys.executable)) - os.chdir('..') + runpy.run_module('qt.{0}.start'.format(edition), run_name='__main__') if __name__ == '__main__': main() \ No newline at end of file