mirror of
				https://github.com/arsenetar/dupeguru.git
				synced 2025-09-11 17:58:17 +00:00 
			
		
		
		
	[#102 state:fixed] Remember the size/position of all window between launches.
This commit is contained in:
		
							parent
							
								
									58da335b17
								
							
						
					
					
						commit
						4c273a7910
					
				@ -284,6 +284,7 @@
 | 
			
		||||
				<string key="NSScreenRect">{{0, 0}, {1024, 746}}</string>
 | 
			
		||||
				<string key="NSMinSize">{451, 162}</string>
 | 
			
		||||
				<string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
 | 
			
		||||
				<string key="NSFrameAutosaveName">DetailsPanel</string>
 | 
			
		||||
			</object>
 | 
			
		||||
		</object>
 | 
			
		||||
		<object class="IBObjectContainer" key="IBDocument.Objects">
 | 
			
		||||
 | 
			
		||||
@ -2,13 +2,13 @@
 | 
			
		||||
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
 | 
			
		||||
	<data>
 | 
			
		||||
		<int key="IBDocument.SystemTarget">1050</int>
 | 
			
		||||
		<string key="IBDocument.SystemVersion">10C540</string>
 | 
			
		||||
		<string key="IBDocument.InterfaceBuilderVersion">740</string>
 | 
			
		||||
		<string key="IBDocument.AppKitVersion">1038.25</string>
 | 
			
		||||
		<string key="IBDocument.HIToolboxVersion">458.00</string>
 | 
			
		||||
		<string key="IBDocument.SystemVersion">10F569</string>
 | 
			
		||||
		<string key="IBDocument.InterfaceBuilderVersion">788</string>
 | 
			
		||||
		<string key="IBDocument.AppKitVersion">1038.29</string>
 | 
			
		||||
		<string key="IBDocument.HIToolboxVersion">461.00</string>
 | 
			
		||||
		<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
 | 
			
		||||
			<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
 | 
			
		||||
			<string key="NS.object.0">740</string>
 | 
			
		||||
			<string key="NS.object.0">788</string>
 | 
			
		||||
		</object>
 | 
			
		||||
		<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
 | 
			
		||||
			<bool key="EncodedWithXMLCoder">YES</bool>
 | 
			
		||||
@ -428,6 +428,7 @@
 | 
			
		||||
				<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
 | 
			
		||||
				<string key="NSMinSize">{369, 291}</string>
 | 
			
		||||
				<string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
 | 
			
		||||
				<string key="NSFrameAutosaveName">DirectoryPanel</string>
 | 
			
		||||
			</object>
 | 
			
		||||
		</object>
 | 
			
		||||
		<object class="IBObjectContainer" key="IBDocument.Objects">
 | 
			
		||||
@ -869,6 +870,35 @@
 | 
			
		||||
							<string>id</string>
 | 
			
		||||
						</object>
 | 
			
		||||
					</object>
 | 
			
		||||
					<object class="NSMutableDictionary" key="actionInfosByName">
 | 
			
		||||
						<bool key="EncodedWithXMLCoder">YES</bool>
 | 
			
		||||
						<object class="NSArray" key="dict.sortedKeys">
 | 
			
		||||
							<bool key="EncodedWithXMLCoder">YES</bool>
 | 
			
		||||
							<string>askForDirectory:</string>
 | 
			
		||||
							<string>popupAddDirectoryMenu:</string>
 | 
			
		||||
							<string>removeSelectedDirectory:</string>
 | 
			
		||||
							<string>toggleVisible:</string>
 | 
			
		||||
						</object>
 | 
			
		||||
						<object class="NSMutableArray" key="dict.values">
 | 
			
		||||
							<bool key="EncodedWithXMLCoder">YES</bool>
 | 
			
		||||
							<object class="IBActionInfo">
 | 
			
		||||
								<string key="name">askForDirectory:</string>
 | 
			
		||||
								<string key="candidateClassName">id</string>
 | 
			
		||||
							</object>
 | 
			
		||||
							<object class="IBActionInfo">
 | 
			
		||||
								<string key="name">popupAddDirectoryMenu:</string>
 | 
			
		||||
								<string key="candidateClassName">id</string>
 | 
			
		||||
							</object>
 | 
			
		||||
							<object class="IBActionInfo">
 | 
			
		||||
								<string key="name">removeSelectedDirectory:</string>
 | 
			
		||||
								<string key="candidateClassName">id</string>
 | 
			
		||||
							</object>
 | 
			
		||||
							<object class="IBActionInfo">
 | 
			
		||||
								<string key="name">toggleVisible:</string>
 | 
			
		||||
								<string key="candidateClassName">id</string>
 | 
			
		||||
							</object>
 | 
			
		||||
						</object>
 | 
			
		||||
					</object>
 | 
			
		||||
					<object class="NSMutableDictionary" key="outlets">
 | 
			
		||||
						<bool key="EncodedWithXMLCoder">YES</bool>
 | 
			
		||||
						<object class="NSArray" key="dict.sortedKeys">
 | 
			
		||||
@ -884,6 +914,30 @@
 | 
			
		||||
							<string>NSButton</string>
 | 
			
		||||
						</object>
 | 
			
		||||
					</object>
 | 
			
		||||
					<object class="NSMutableDictionary" key="toOneOutletInfosByName">
 | 
			
		||||
						<bool key="EncodedWithXMLCoder">YES</bool>
 | 
			
		||||
						<object class="NSArray" key="dict.sortedKeys">
 | 
			
		||||
							<bool key="EncodedWithXMLCoder">YES</bool>
 | 
			
		||||
							<string>addButtonPopUp</string>
 | 
			
		||||
							<string>outlineView</string>
 | 
			
		||||
							<string>removeButton</string>
 | 
			
		||||
						</object>
 | 
			
		||||
						<object class="NSMutableArray" key="dict.values">
 | 
			
		||||
							<bool key="EncodedWithXMLCoder">YES</bool>
 | 
			
		||||
							<object class="IBToOneOutletInfo">
 | 
			
		||||
								<string key="name">addButtonPopUp</string>
 | 
			
		||||
								<string key="candidateClassName">NSPopUpButton</string>
 | 
			
		||||
							</object>
 | 
			
		||||
							<object class="IBToOneOutletInfo">
 | 
			
		||||
								<string key="name">outlineView</string>
 | 
			
		||||
								<string key="candidateClassName">HSOutlineView</string>
 | 
			
		||||
							</object>
 | 
			
		||||
							<object class="IBToOneOutletInfo">
 | 
			
		||||
								<string key="name">removeButton</string>
 | 
			
		||||
								<string key="candidateClassName">NSButton</string>
 | 
			
		||||
							</object>
 | 
			
		||||
						</object>
 | 
			
		||||
					</object>
 | 
			
		||||
					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 | 
			
		||||
						<string key="majorKey">IBProjectSource</string>
 | 
			
		||||
						<string key="minorKey">../base/DirectoryPanel.h</string>
 | 
			
		||||
@ -1437,6 +1491,13 @@
 | 
			
		||||
						<string key="NS.key.0">showWindow:</string>
 | 
			
		||||
						<string key="NS.object.0">id</string>
 | 
			
		||||
					</object>
 | 
			
		||||
					<object class="NSMutableDictionary" key="actionInfosByName">
 | 
			
		||||
						<string key="NS.key.0">showWindow:</string>
 | 
			
		||||
						<object class="IBActionInfo" key="NS.object.0">
 | 
			
		||||
							<string key="name">showWindow:</string>
 | 
			
		||||
							<string key="candidateClassName">id</string>
 | 
			
		||||
						</object>
 | 
			
		||||
					</object>
 | 
			
		||||
					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 | 
			
		||||
						<string key="majorKey">IBFrameworkSource</string>
 | 
			
		||||
						<string key="minorKey">AppKit.framework/Headers/NSWindowController.h</string>
 | 
			
		||||
@ -1445,6 +1506,7 @@
 | 
			
		||||
			</object>
 | 
			
		||||
		</object>
 | 
			
		||||
		<int key="IBDocument.localizationMode">0</int>
 | 
			
		||||
		<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
 | 
			
		||||
		<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
 | 
			
		||||
			<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
 | 
			
		||||
			<integer value="1050" key="NS.object.0"/>
 | 
			
		||||
@ -1460,5 +1522,18 @@
 | 
			
		||||
		<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
 | 
			
		||||
		<string key="IBDocument.LastKnownRelativeProjectPath">../../se/dupeguru.xcodeproj</string>
 | 
			
		||||
		<int key="IBDocument.defaultPropertyAccessControl">3</int>
 | 
			
		||||
		<object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
 | 
			
		||||
			<bool key="EncodedWithXMLCoder">YES</bool>
 | 
			
		||||
			<object class="NSArray" key="dict.sortedKeys">
 | 
			
		||||
				<bool key="EncodedWithXMLCoder">YES</bool>
 | 
			
		||||
				<string>NSMenuCheckmark</string>
 | 
			
		||||
				<string>NSMenuMixedState</string>
 | 
			
		||||
			</object>
 | 
			
		||||
			<object class="NSMutableArray" key="dict.values">
 | 
			
		||||
				<bool key="EncodedWithXMLCoder">YES</bool>
 | 
			
		||||
				<string>{9, 8}</string>
 | 
			
		||||
				<string>{7, 2}</string>
 | 
			
		||||
			</object>
 | 
			
		||||
		</object>
 | 
			
		||||
	</data>
 | 
			
		||||
</archive>
 | 
			
		||||
 | 
			
		||||
@ -2,13 +2,13 @@
 | 
			
		||||
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
 | 
			
		||||
	<data>
 | 
			
		||||
		<int key="IBDocument.SystemTarget">1050</int>
 | 
			
		||||
		<string key="IBDocument.SystemVersion">10C540</string>
 | 
			
		||||
		<string key="IBDocument.InterfaceBuilderVersion">740</string>
 | 
			
		||||
		<string key="IBDocument.AppKitVersion">1038.25</string>
 | 
			
		||||
		<string key="IBDocument.HIToolboxVersion">458.00</string>
 | 
			
		||||
		<string key="IBDocument.SystemVersion">10F569</string>
 | 
			
		||||
		<string key="IBDocument.InterfaceBuilderVersion">788</string>
 | 
			
		||||
		<string key="IBDocument.AppKitVersion">1038.29</string>
 | 
			
		||||
		<string key="IBDocument.HIToolboxVersion">461.00</string>
 | 
			
		||||
		<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
 | 
			
		||||
			<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
 | 
			
		||||
			<string key="NS.object.0">740</string>
 | 
			
		||||
			<string key="NS.object.0">788</string>
 | 
			
		||||
		</object>
 | 
			
		||||
		<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
 | 
			
		||||
			<bool key="EncodedWithXMLCoder">YES</bool>
 | 
			
		||||
@ -434,6 +434,7 @@
 | 
			
		||||
				<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
 | 
			
		||||
				<string key="NSMinSize">{451, 177}</string>
 | 
			
		||||
				<string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
 | 
			
		||||
				<string key="NSFrameAutosaveName">DetailsPanel</string>
 | 
			
		||||
			</object>
 | 
			
		||||
		</object>
 | 
			
		||||
		<object class="IBObjectContainer" key="IBDocument.Objects">
 | 
			
		||||
@ -866,6 +867,13 @@
 | 
			
		||||
						<string key="NS.key.0">detailsTable</string>
 | 
			
		||||
						<string key="NS.object.0">NSTableView</string>
 | 
			
		||||
					</object>
 | 
			
		||||
					<object class="NSMutableDictionary" key="toOneOutletInfosByName">
 | 
			
		||||
						<string key="NS.key.0">detailsTable</string>
 | 
			
		||||
						<object class="IBToOneOutletInfo" key="NS.object.0">
 | 
			
		||||
							<string key="name">detailsTable</string>
 | 
			
		||||
							<string key="candidateClassName">NSTableView</string>
 | 
			
		||||
						</object>
 | 
			
		||||
					</object>
 | 
			
		||||
					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 | 
			
		||||
						<string key="majorKey">IBProjectSource</string>
 | 
			
		||||
						<string key="minorKey">../base/DetailsPanel.h</string>
 | 
			
		||||
@ -891,6 +899,35 @@
 | 
			
		||||
							<string>NSProgressIndicator</string>
 | 
			
		||||
						</object>
 | 
			
		||||
					</object>
 | 
			
		||||
					<object class="NSMutableDictionary" key="toOneOutletInfosByName">
 | 
			
		||||
						<bool key="EncodedWithXMLCoder">YES</bool>
 | 
			
		||||
						<object class="NSArray" key="dict.sortedKeys">
 | 
			
		||||
							<bool key="EncodedWithXMLCoder">YES</bool>
 | 
			
		||||
							<string>dupeImage</string>
 | 
			
		||||
							<string>dupeProgressIndicator</string>
 | 
			
		||||
							<string>refImage</string>
 | 
			
		||||
							<string>refProgressIndicator</string>
 | 
			
		||||
						</object>
 | 
			
		||||
						<object class="NSMutableArray" key="dict.values">
 | 
			
		||||
							<bool key="EncodedWithXMLCoder">YES</bool>
 | 
			
		||||
							<object class="IBToOneOutletInfo">
 | 
			
		||||
								<string key="name">dupeImage</string>
 | 
			
		||||
								<string key="candidateClassName">NSImageView</string>
 | 
			
		||||
							</object>
 | 
			
		||||
							<object class="IBToOneOutletInfo">
 | 
			
		||||
								<string key="name">dupeProgressIndicator</string>
 | 
			
		||||
								<string key="candidateClassName">NSProgressIndicator</string>
 | 
			
		||||
							</object>
 | 
			
		||||
							<object class="IBToOneOutletInfo">
 | 
			
		||||
								<string key="name">refImage</string>
 | 
			
		||||
								<string key="candidateClassName">NSImageView</string>
 | 
			
		||||
							</object>
 | 
			
		||||
							<object class="IBToOneOutletInfo">
 | 
			
		||||
								<string key="name">refProgressIndicator</string>
 | 
			
		||||
								<string key="candidateClassName">NSProgressIndicator</string>
 | 
			
		||||
							</object>
 | 
			
		||||
						</object>
 | 
			
		||||
					</object>
 | 
			
		||||
					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 | 
			
		||||
						<string key="majorKey">IBProjectSource</string>
 | 
			
		||||
						<string key="minorKey">DetailsPanel.h</string>
 | 
			
		||||
@ -903,6 +940,13 @@
 | 
			
		||||
						<string key="NS.key.0">detailsTable</string>
 | 
			
		||||
						<string key="NS.object.0">NSTableView</string>
 | 
			
		||||
					</object>
 | 
			
		||||
					<object class="NSMutableDictionary" key="toOneOutletInfosByName">
 | 
			
		||||
						<string key="NS.key.0">detailsTable</string>
 | 
			
		||||
						<object class="IBToOneOutletInfo" key="NS.object.0">
 | 
			
		||||
							<string key="name">detailsTable</string>
 | 
			
		||||
							<string key="candidateClassName">NSTableView</string>
 | 
			
		||||
						</object>
 | 
			
		||||
					</object>
 | 
			
		||||
					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 | 
			
		||||
						<string key="majorKey">IBUserSource</string>
 | 
			
		||||
						<string key="minorKey"/>
 | 
			
		||||
@ -1423,6 +1467,13 @@
 | 
			
		||||
						<string key="NS.key.0">showWindow:</string>
 | 
			
		||||
						<string key="NS.object.0">id</string>
 | 
			
		||||
					</object>
 | 
			
		||||
					<object class="NSMutableDictionary" key="actionInfosByName">
 | 
			
		||||
						<string key="NS.key.0">showWindow:</string>
 | 
			
		||||
						<object class="IBActionInfo" key="NS.object.0">
 | 
			
		||||
							<string key="name">showWindow:</string>
 | 
			
		||||
							<string key="candidateClassName">id</string>
 | 
			
		||||
						</object>
 | 
			
		||||
					</object>
 | 
			
		||||
					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 | 
			
		||||
						<string key="majorKey">IBFrameworkSource</string>
 | 
			
		||||
						<string key="minorKey">AppKit.framework/Headers/NSWindowController.h</string>
 | 
			
		||||
@ -1431,6 +1482,7 @@
 | 
			
		||||
			</object>
 | 
			
		||||
		</object>
 | 
			
		||||
		<int key="IBDocument.localizationMode">0</int>
 | 
			
		||||
		<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
 | 
			
		||||
		<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
 | 
			
		||||
			<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
 | 
			
		||||
			<integer value="1050" key="NS.object.0"/>
 | 
			
		||||
@ -1446,5 +1498,9 @@
 | 
			
		||||
		<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
 | 
			
		||||
		<nil key="IBDocument.LastKnownRelativeProjectPath"/>
 | 
			
		||||
		<int key="IBDocument.defaultPropertyAccessControl">3</int>
 | 
			
		||||
		<object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
 | 
			
		||||
			<string key="NS.key.0">NSApplicationIcon</string>
 | 
			
		||||
			<string key="NS.object.0">{128, 128}</string>
 | 
			
		||||
		</object>
 | 
			
		||||
	</data>
 | 
			
		||||
</archive>
 | 
			
		||||
 | 
			
		||||
@ -12,7 +12,7 @@ import logging
 | 
			
		||||
import os
 | 
			
		||||
import os.path as op
 | 
			
		||||
 | 
			
		||||
from PyQt4.QtCore import QTimer, QObject, QCoreApplication, QUrl, SIGNAL
 | 
			
		||||
from PyQt4.QtCore import QTimer, QObject, QCoreApplication, QUrl, SIGNAL, pyqtSignal
 | 
			
		||||
from PyQt4.QtGui import QDesktopServices, QFileDialog, QDialog, QMessageBox
 | 
			
		||||
 | 
			
		||||
from hscommon import job
 | 
			
		||||
@ -86,7 +86,10 @@ class DupeGuru(DupeGuruBase, QObject):
 | 
			
		||||
            self._nagTimer = QTimer()
 | 
			
		||||
            self.connect(self._nagTimer, SIGNAL('timeout()'), self.mustShowNag)
 | 
			
		||||
            self._nagTimer.start(0)
 | 
			
		||||
        self.main_window.show()
 | 
			
		||||
        if self.prefs.mainWindowIsMaximized:
 | 
			
		||||
            self.main_window.showMaximized()
 | 
			
		||||
        else:
 | 
			
		||||
            self.main_window.show()
 | 
			
		||||
        self.load()
 | 
			
		||||
        
 | 
			
		||||
        self.connect(QCoreApplication.instance(), SIGNAL('aboutToQuit()'), self.application_will_terminate)
 | 
			
		||||
@ -205,8 +208,13 @@ class DupeGuru(DupeGuruBase, QObject):
 | 
			
		||||
            self.prefs.save()
 | 
			
		||||
            self._update_options()
 | 
			
		||||
    
 | 
			
		||||
    #--- Signals
 | 
			
		||||
    willSavePrefs = pyqtSignal()
 | 
			
		||||
    
 | 
			
		||||
    #--- Events
 | 
			
		||||
    def application_will_terminate(self):
 | 
			
		||||
        self.willSavePrefs.emit()
 | 
			
		||||
        self.prefs.save()
 | 
			
		||||
        self.save()
 | 
			
		||||
        self.save_ignore_list()
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@ -20,15 +20,23 @@ class DetailsDialog(QDialog):
 | 
			
		||||
        self.app = app
 | 
			
		||||
        self.model = DetailsPanel(self, app)
 | 
			
		||||
        self._setupUi()
 | 
			
		||||
        if self.app.prefs.detailsWindowRect is not None:
 | 
			
		||||
            self.setGeometry(self.app.prefs.detailsWindowRect)
 | 
			
		||||
        self.tableModel = DetailsModel(self.model)
 | 
			
		||||
        # tableView is defined in subclasses
 | 
			
		||||
        self.tableView.setModel(self.tableModel)
 | 
			
		||||
        self.model.connect()
 | 
			
		||||
        
 | 
			
		||||
        self.app.willSavePrefs.connect(self.appWillSavePrefs)
 | 
			
		||||
    
 | 
			
		||||
    def _setupUi(self): # Virtual
 | 
			
		||||
        pass
 | 
			
		||||
    
 | 
			
		||||
    # model --> view
 | 
			
		||||
    #--- Events
 | 
			
		||||
    def appWillSavePrefs(self):
 | 
			
		||||
        self.app.prefs.detailsWindowRect = self.geometry()
 | 
			
		||||
    
 | 
			
		||||
    #--- model --> view
 | 
			
		||||
    def refresh(self):
 | 
			
		||||
        self.tableModel.reset()
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@ -26,6 +26,7 @@ class DirectoriesDialog(QDialog, Ui_DirectoriesDialog):
 | 
			
		||||
        self.connect(self.addButton, SIGNAL('clicked()'), self.addButtonClicked)
 | 
			
		||||
        self.connect(self.removeButton, SIGNAL('clicked()'), self.removeButtonClicked)
 | 
			
		||||
        self.connect(self.treeView.selectionModel(), SIGNAL('selectionChanged(QItemSelection,QItemSelection)'), self.selectionChanged)
 | 
			
		||||
        self.app.willSavePrefs.connect(self.appWillSavePrefs)
 | 
			
		||||
    
 | 
			
		||||
    def _setupUi(self):
 | 
			
		||||
        self.setupUi(self)
 | 
			
		||||
@ -40,6 +41,9 @@ class DirectoriesDialog(QDialog, Ui_DirectoriesDialog):
 | 
			
		||||
        header.setResizeMode(0, QHeaderView.Stretch)
 | 
			
		||||
        header.setResizeMode(1, QHeaderView.Fixed)
 | 
			
		||||
        header.resizeSection(1, 100)
 | 
			
		||||
        
 | 
			
		||||
        if self.app.prefs.directoriesWindowRect is not None:
 | 
			
		||||
            self.setGeometry(self.app.prefs.directoriesWindowRect)
 | 
			
		||||
    
 | 
			
		||||
    def _updateRemoveButton(self):
 | 
			
		||||
        indexes = self.treeView.selectedIndexes()
 | 
			
		||||
@ -51,6 +55,7 @@ class DirectoriesDialog(QDialog, Ui_DirectoriesDialog):
 | 
			
		||||
        node = index.internalPointer()
 | 
			
		||||
        # label = 'Remove' if node.parent is None else 'Exclude'
 | 
			
		||||
    
 | 
			
		||||
    #--- Events
 | 
			
		||||
    def addButtonClicked(self):
 | 
			
		||||
        title = "Select a directory to add to the scanning list"
 | 
			
		||||
        flags = QFileDialog.ShowDirsOnly
 | 
			
		||||
@ -60,6 +65,9 @@ class DirectoriesDialog(QDialog, Ui_DirectoriesDialog):
 | 
			
		||||
        self.lastAddedFolder = dirpath
 | 
			
		||||
        self.app.add_directory(dirpath)
 | 
			
		||||
    
 | 
			
		||||
    def appWillSavePrefs(self):
 | 
			
		||||
        self.app.prefs.directoriesWindowRect = self.geometry()
 | 
			
		||||
    
 | 
			
		||||
    def doneButtonClicked(self):
 | 
			
		||||
        self.hide()
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@ -34,9 +34,9 @@ class MainWindow(QMainWindow, Ui_MainWindow):
 | 
			
		||||
        
 | 
			
		||||
        self.connect(self.actionQuit, SIGNAL('triggered()'), QCoreApplication.instance().quit)
 | 
			
		||||
        self.connect(self.menuColumns, SIGNAL('triggered(QAction*)'), self.columnToggled)
 | 
			
		||||
        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.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
 | 
			
		||||
@ -96,6 +96,9 @@ class MainWindow(QMainWindow, Ui_MainWindow):
 | 
			
		||||
        self.statusLabel = QLabel(self)
 | 
			
		||||
        self.statusbar.addPermanentWidget(self.statusLabel, 1)
 | 
			
		||||
        
 | 
			
		||||
        if self.app.prefs.mainWindowRect is not None and not self.app.prefs.mainWindowIsMaximized:
 | 
			
		||||
            self.setGeometry(self.app.prefs.mainWindowRect)
 | 
			
		||||
        
 | 
			
		||||
        # Linux setup
 | 
			
		||||
        if sys.platform == 'linux2':
 | 
			
		||||
            self.actionCheckForUpdate.setVisible(False) # This only works on Windows
 | 
			
		||||
@ -116,18 +119,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
 | 
			
		||||
            h.setSectionHidden(index, not visible)
 | 
			
		||||
        h.setResizeMode(0, QHeaderView.Stretch)
 | 
			
		||||
    
 | 
			
		||||
    def _save_columns(self):
 | 
			
		||||
        h = self.resultsView.header()
 | 
			
		||||
        widths = []
 | 
			
		||||
        visible = []
 | 
			
		||||
        for i in range(len(self.app.data.COLUMNS)):
 | 
			
		||||
            widths.append(h.sectionSize(i))
 | 
			
		||||
            visible.append(not h.isSectionHidden(i))
 | 
			
		||||
        prefs = self.app.prefs
 | 
			
		||||
        prefs.columns_width = widths
 | 
			
		||||
        prefs.columns_visible = visible
 | 
			
		||||
        prefs.save()
 | 
			
		||||
    
 | 
			
		||||
    def _update_column_actions_status(self):
 | 
			
		||||
        h = self.resultsView.header()
 | 
			
		||||
        for action in self._column_actions:
 | 
			
		||||
@ -288,8 +279,18 @@ class MainWindow(QMainWindow, Ui_MainWindow):
 | 
			
		||||
        self.app.show_help()
 | 
			
		||||
    
 | 
			
		||||
    #--- Events
 | 
			
		||||
    def application_will_terminate(self):
 | 
			
		||||
        self._save_columns()
 | 
			
		||||
    def appWillSavePrefs(self):
 | 
			
		||||
        prefs = self.app.prefs
 | 
			
		||||
        h = self.resultsView.header()
 | 
			
		||||
        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
 | 
			
		||||
        prefs.mainWindowIsMaximized = self.isMaximized()
 | 
			
		||||
        prefs.mainWindowRect = self.geometry()
 | 
			
		||||
    
 | 
			
		||||
    def columnToggled(self, action):
 | 
			
		||||
        colid = action.column_index
 | 
			
		||||
 | 
			
		||||
@ -16,11 +16,12 @@ class Preferences(PreferencesBase):
 | 
			
		||||
        PreferencesBase.__init__(self)
 | 
			
		||||
        self.reset_columns()
 | 
			
		||||
    
 | 
			
		||||
    def _load_specific(self, settings, get):
 | 
			
		||||
    def _load_specific(self, settings):
 | 
			
		||||
        # load prefs specific to the dg edition
 | 
			
		||||
        pass
 | 
			
		||||
    
 | 
			
		||||
    def _load_values(self, settings, get):
 | 
			
		||||
    def _load_values(self, settings):
 | 
			
		||||
        get = self.get_value
 | 
			
		||||
        self.filter_hardness = get('FilterHardness', self.filter_hardness)
 | 
			
		||||
        self.mix_file_kind = get('MixFileKind', self.mix_file_kind)
 | 
			
		||||
        self.use_regexp = get('UseRegexp', self.use_regexp)
 | 
			
		||||
@ -33,9 +34,15 @@ class Preferences(PreferencesBase):
 | 
			
		||||
            if width > 0:
 | 
			
		||||
                self.columns_width[index] = width
 | 
			
		||||
        self.columns_visible = get('ColumnsVisible', self.columns_visible)
 | 
			
		||||
        
 | 
			
		||||
        self.mainWindowIsMaximized = get('MainWindowIsMaximized', self.mainWindowIsMaximized)
 | 
			
		||||
        self.mainWindowRect = self.get_rect('MainWindowRect', self.mainWindowRect)
 | 
			
		||||
        self.detailsWindowRect = self.get_rect('DetailsWindowRect', self.detailsWindowRect)
 | 
			
		||||
        self.directoriesWindowRect = self.get_rect('DirectoriesWindowRect', self.directoriesWindowRect)
 | 
			
		||||
        
 | 
			
		||||
        self.registration_code = get('RegistrationCode', self.registration_code)
 | 
			
		||||
        self.registration_email = get('RegistrationEmail', self.registration_email)
 | 
			
		||||
        self._load_specific(settings, get)
 | 
			
		||||
        self._load_specific(settings)
 | 
			
		||||
    
 | 
			
		||||
    def _reset_specific(self):
 | 
			
		||||
        # reset prefs specific to the dg edition
 | 
			
		||||
@ -48,6 +55,12 @@ class Preferences(PreferencesBase):
 | 
			
		||||
        self.remove_empty_folders = False
 | 
			
		||||
        self.destination_type = 1
 | 
			
		||||
        self.custom_command = ''
 | 
			
		||||
        
 | 
			
		||||
        self.mainWindowIsMaximized = False
 | 
			
		||||
        self.mainWindowRect = None
 | 
			
		||||
        self.detailsWindowRect = None
 | 
			
		||||
        self.directoriesWindowRect = None
 | 
			
		||||
        
 | 
			
		||||
        self.registration_code = ''
 | 
			
		||||
        self.registration_email = ''
 | 
			
		||||
        self._reset_specific()
 | 
			
		||||
@ -56,11 +69,12 @@ class Preferences(PreferencesBase):
 | 
			
		||||
        self.columns_width = [width for width, _ in self.COLUMNS_DEFAULT_ATTRS]
 | 
			
		||||
        self.columns_visible = [visible for _, visible in self.COLUMNS_DEFAULT_ATTRS]
 | 
			
		||||
    
 | 
			
		||||
    def _save_specific(self, settings, set_):
 | 
			
		||||
    def _save_specific(self, settings):
 | 
			
		||||
        # save prefs specific to the dg edition
 | 
			
		||||
        pass
 | 
			
		||||
    
 | 
			
		||||
    def _save_values(self, settings, set_):
 | 
			
		||||
    def _save_values(self, settings):
 | 
			
		||||
        set_ = self.set_value
 | 
			
		||||
        set_('FilterHardness', self.filter_hardness)
 | 
			
		||||
        set_('MixFileKind', self.mix_file_kind)
 | 
			
		||||
        set_('UseRegexp', self.use_regexp)
 | 
			
		||||
@ -69,7 +83,13 @@ class Preferences(PreferencesBase):
 | 
			
		||||
        set_('CustomCommand', self.custom_command)
 | 
			
		||||
        set_('ColumnsWidth', self.columns_width)
 | 
			
		||||
        set_('ColumnsVisible', self.columns_visible)
 | 
			
		||||
        
 | 
			
		||||
        set_('MainWindowIsMaximized', self.mainWindowIsMaximized)
 | 
			
		||||
        self.set_rect('MainWindowRect', self.mainWindowRect)
 | 
			
		||||
        self.set_rect('DetailsWindowRect', self.detailsWindowRect)
 | 
			
		||||
        self.set_rect('DirectoriesWindowRect', self.directoriesWindowRect)
 | 
			
		||||
        
 | 
			
		||||
        set_('RegistrationCode', self.registration_code)
 | 
			
		||||
        set_('RegistrationEmail', self.registration_email)
 | 
			
		||||
        self._save_specific(settings, set_)
 | 
			
		||||
        self._save_specific(settings)
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@ -33,7 +33,8 @@ class Preferences(PreferencesBase):
 | 
			
		||||
        (80, False), # dupe count
 | 
			
		||||
    ]
 | 
			
		||||
    
 | 
			
		||||
    def _load_specific(self, settings, get):
 | 
			
		||||
    def _load_specific(self, settings):
 | 
			
		||||
        get = self.get_value
 | 
			
		||||
        self.scan_type = get('ScanType', self.scan_type)
 | 
			
		||||
        self.word_weighting = get('WordWeighting', self.word_weighting)
 | 
			
		||||
        self.match_similar = get('MatchSimilar', self.match_similar)
 | 
			
		||||
@ -56,7 +57,8 @@ class Preferences(PreferencesBase):
 | 
			
		||||
        self.scan_tag_genre = False
 | 
			
		||||
        self.scan_tag_year = False
 | 
			
		||||
    
 | 
			
		||||
    def _save_specific(self, settings, set_):
 | 
			
		||||
    def _save_specific(self, settings):
 | 
			
		||||
        set_ = self.set_value
 | 
			
		||||
        set_('ScanType', self.scan_type)
 | 
			
		||||
        set_('WordWeighting', self.word_weighting)
 | 
			
		||||
        set_('MatchSimilar', self.match_similar)
 | 
			
		||||
 | 
			
		||||
@ -23,13 +23,13 @@ class Preferences(PreferencesBase):
 | 
			
		||||
        (80, False), # dupe count
 | 
			
		||||
    ]
 | 
			
		||||
    
 | 
			
		||||
    def _load_specific(self, settings, get):
 | 
			
		||||
        self.match_scaled = get('MatchScaled', self.match_scaled)
 | 
			
		||||
    def _load_specific(self, settings):
 | 
			
		||||
        self.match_scaled = self.get_value('MatchScaled', self.match_scaled)
 | 
			
		||||
    
 | 
			
		||||
    def _reset_specific(self):
 | 
			
		||||
        self.filter_hardness = 95
 | 
			
		||||
        self.match_scaled = False
 | 
			
		||||
    
 | 
			
		||||
    def _save_specific(self, settings, set_):
 | 
			
		||||
        set_('MatchScaled', self.match_scaled)
 | 
			
		||||
    def _save_specific(self, settings):
 | 
			
		||||
        self.set_value('MatchScaled', self.match_scaled)
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@ -23,7 +23,8 @@ class Preferences(PreferencesBase):
 | 
			
		||||
        (80, False), # dupe count
 | 
			
		||||
    ]
 | 
			
		||||
    
 | 
			
		||||
    def _load_specific(self, settings, get):
 | 
			
		||||
    def _load_specific(self, settings):
 | 
			
		||||
        get = self.get_value
 | 
			
		||||
        self.scan_type = get('ScanType', self.scan_type)
 | 
			
		||||
        self.word_weighting = get('WordWeighting', self.word_weighting)
 | 
			
		||||
        self.match_similar = get('MatchSimilar', self.match_similar)
 | 
			
		||||
@ -38,7 +39,8 @@ class Preferences(PreferencesBase):
 | 
			
		||||
        self.ignore_small_files = True
 | 
			
		||||
        self.small_file_threshold = 10 # KB
 | 
			
		||||
    
 | 
			
		||||
    def _save_specific(self, settings, set_):
 | 
			
		||||
    def _save_specific(self, settings):
 | 
			
		||||
        set_ = self.set_value
 | 
			
		||||
        set_('ScanType', self.scan_type)
 | 
			
		||||
        set_('WordWeighting', self.word_weighting)
 | 
			
		||||
        set_('MatchSimilar', self.match_similar)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user