1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2025-03-10 05:34:36 +00:00

Deduplicated scan type combobox creation code between SE and ME (soon to be shared by PE) (Qt).

This commit is contained in:
Virgil Dupras 2011-04-20 15:18:21 +02:00
parent 9d5f3029d0
commit de23ce90d8
3 changed files with 24 additions and 32 deletions

View File

@ -25,6 +25,19 @@ class PreferencesDialogBase(QDialog):
self.buttonBox.accepted.connect(self.accept)
self.buttonBox.rejected.connect(self.reject)
def _setupScanTypeBox(self, labels):
self.scanTypeHLayout = QHBoxLayout()
self.scanTypeLabel = QLabel(self)
self.scanTypeLabel.setText(tr("Scan Type:"))
self.scanTypeLabel.setMinimumSize(QSize(100, 0))
self.scanTypeLabel.setMaximumSize(QSize(100, 16777215))
self.scanTypeHLayout.addWidget(self.scanTypeLabel)
self.scanTypeComboBox = QComboBox(self)
for label in labels:
self.scanTypeComboBox.addItem(label)
self.scanTypeHLayout.addWidget(self.scanTypeComboBox)
self.widgetsVLayout.addLayout(self.scanTypeHLayout)
def _setupFilterHardnessBox(self):
self.filterHardnessHLayout = QHBoxLayout()
self.filterHardnessLabel = QLabel(self)

View File

@ -7,9 +7,9 @@
# http://www.hardcoded.net/licenses/bsd_license
import sys
from PyQt4.QtCore import SIGNAL, QSize
from PyQt4.QtGui import (QVBoxLayout, QHBoxLayout, QLabel, QComboBox, QSizePolicy, QSpacerItem,
QWidget, QApplication)
from PyQt4.QtCore import QSize
from PyQt4.QtGui import (QVBoxLayout, QHBoxLayout, QLabel, QSizePolicy, QSpacerItem, QWidget,
QApplication)
from hscommon.trans import tr
from core.scanner import ScanType
@ -30,24 +30,12 @@ class PreferencesDialog(PreferencesDialogBase):
def __init__(self, parent, app):
PreferencesDialogBase.__init__(self, parent, app)
self.connect(self.scanTypeComboBox, SIGNAL('currentIndexChanged(int)'), self.scanTypeChanged)
self.scanTypeComboBox.currentIndexChanged[int].connect(self.scanTypeChanged)
def _setupPreferenceWidgets(self):
self.horizontalLayout = QHBoxLayout()
self.label_2 = QLabel(self)
self.label_2.setText(tr("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(tr("Filename"))
self.scanTypeComboBox.addItem(tr("Filename - Fields"))
self.scanTypeComboBox.addItem(tr("Filename - Fields (No Order)"))
self.scanTypeComboBox.addItem(tr("Tags"))
self.scanTypeComboBox.addItem(tr("Contents"))
self.scanTypeComboBox.addItem(tr("Audio Contents"))
self.horizontalLayout.addWidget(self.scanTypeComboBox)
self.widgetsVLayout.addLayout(self.horizontalLayout)
scanTypeLabels = [tr(s) for s in ["Filename", "Filename - Fields",
"Filename - Fields (No Order)", "Tags", "Contents", "Audio Contents"]]
self._setupScanTypeBox(scanTypeLabels)
self._setupFilterHardnessBox()
self.widgetsVLayout.addLayout(self.filterHardnessHLayout)
self.widget = QWidget(self)

View File

@ -8,8 +8,8 @@
import sys
from PyQt4.QtCore import QSize
from PyQt4.QtGui import (QVBoxLayout, QHBoxLayout, QLabel, QComboBox, QSizePolicy, QSpacerItem,
QWidget, QLineEdit, QApplication)
from PyQt4.QtGui import (QVBoxLayout, QHBoxLayout, QLabel, QSizePolicy, QSpacerItem, QWidget,
QLineEdit, QApplication)
from hscommon.trans import tr
from hscommon.util import tryint
@ -32,17 +32,8 @@ class PreferencesDialog(PreferencesDialogBase):
self.scanTypeComboBox.currentIndexChanged[int].connect(self.scanTypeChanged)
def _setupPreferenceWidgets(self):
self.horizontalLayout = QHBoxLayout()
self.label_2 = QLabel(self)
self.label_2.setText(tr("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)
for label in [tr("Filename"), tr("Contents"), tr("Folders")]:
self.scanTypeComboBox.addItem(label)
self.horizontalLayout.addWidget(self.scanTypeComboBox)
self.widgetsVLayout.addLayout(self.horizontalLayout)
scanTypeLabels = [tr(s) for s in ["Filename", "Contents", "Folders"]]
self._setupScanTypeBox(scanTypeLabels)
self._setupFilterHardnessBox()
self.widgetsVLayout.addLayout(self.filterHardnessHLayout)
self.widget = QWidget(self)