mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-10 05:34:36 +00:00
parent
a15a62f55c
commit
a71033d9d6
@ -5,11 +5,12 @@ result = Window(610, 400, "Re-Prioritize duplicates")
|
|||||||
promptLabel = Label(result, "Add criteria to the right box and click OK to send the dupes that "
|
promptLabel = Label(result, "Add criteria to the right box and click OK to send the dupes that "
|
||||||
"correspond the best to these criteria to their respective group's reference position. Read "
|
"correspond the best to these criteria to their respective group's reference position. Read "
|
||||||
"the help file for more information.")
|
"the help file for more information.")
|
||||||
categoryPopup = Popup(result)
|
split = SplitView(result, 2, vertical=True)
|
||||||
criteriaTable = ListView(result)
|
categoryPopup = Popup(split.subviews[0])
|
||||||
prioritizationTable = ListView(result)
|
criteriaTable = ListView(split.subviews[0])
|
||||||
addButton = Button(result, NLSTR("-->"))
|
prioritizationTable = ListView(split.subviews[1])
|
||||||
removeButton = Button(result, NLSTR("<--"))
|
addButton = Button(split.subviews[1], NLSTR("-->"))
|
||||||
|
removeButton = Button(split.subviews[1], NLSTR("<--"))
|
||||||
okButton = Button(result, "Ok")
|
okButton = Button(result, "Ok")
|
||||||
cancelButton = Button(result, "Cancel")
|
cancelButton = Button(result, "Cancel")
|
||||||
|
|
||||||
@ -27,24 +28,38 @@ cancelButton.action = Action(owner, 'cancel')
|
|||||||
okButton.keyEquivalent = '\\r'
|
okButton.keyEquivalent = '\\r'
|
||||||
cancelButton.keyEquivalent = '\\e'
|
cancelButton.keyEquivalent = '\\e'
|
||||||
|
|
||||||
|
# For layouts to correctly work, subviews need to have the dimensions they'll approximately have
|
||||||
|
# at runtime.
|
||||||
|
split.subviews[0].width = 260
|
||||||
|
split.subviews[0].height = 260
|
||||||
|
split.subviews[1].width = 340
|
||||||
|
split.subviews[1].height = 260
|
||||||
promptLabel.height *= 3 # 3 lines
|
promptLabel.height *= 3 # 3 lines
|
||||||
|
|
||||||
leftLayout = VLayout([categoryPopup, criteriaTable], width=262, filler=criteriaTable)
|
leftLayout = VLayout([categoryPopup, criteriaTable], filler=criteriaTable)
|
||||||
middleLayout = VLayout([addButton, removeButton], width=41)
|
middleLayout = VLayout([addButton, removeButton], width=41)
|
||||||
buttonLayout = HLayout([None, cancelButton, okButton])
|
buttonLayout = HLayout([None, cancelButton, okButton])
|
||||||
|
|
||||||
|
#pack split subview 0
|
||||||
|
leftLayout.fillAll()
|
||||||
|
|
||||||
|
#pack split subview 1
|
||||||
|
prioritizationTable.fillAll()
|
||||||
|
prioritizationTable.width -= 48
|
||||||
|
prioritizationTable.moveTo(Pack.Right)
|
||||||
|
middleLayout.moveNextTo(prioritizationTable, Pack.Left, align=Pack.Middle)
|
||||||
|
|
||||||
|
# Main layout
|
||||||
promptLabel.packToCorner(Pack.UpperLeft)
|
promptLabel.packToCorner(Pack.UpperLeft)
|
||||||
promptLabel.fill(Pack.Right)
|
promptLabel.fill(Pack.Right)
|
||||||
leftLayout.packRelativeTo(promptLabel, Pack.Below)
|
split.moveNextTo(promptLabel, Pack.Below)
|
||||||
middleLayout.packRelativeTo(leftLayout, Pack.Right, align=Pack.Above)
|
buttonLayout.moveNextTo(split, Pack.Below)
|
||||||
prioritizationTable.packRelativeTo(middleLayout, Pack.Right, align=Pack.Above)
|
|
||||||
buttonLayout.packRelativeTo(leftLayout, Pack.Below)
|
|
||||||
buttonLayout.fill(Pack.Right)
|
buttonLayout.fill(Pack.Right)
|
||||||
leftLayout.fill(Pack.Below)
|
split.fill(Pack.LowerRight)
|
||||||
middleLayout.packRelativeTo(leftLayout, Pack.Right, align=Pack.Middle)
|
|
||||||
prioritizationTable.fill(Pack.Below, goal=leftLayout.y)
|
|
||||||
prioritizationTable.fill(Pack.Right)
|
|
||||||
|
|
||||||
promptLabel.setAnchor(Pack.UpperLeft, growX=True)
|
promptLabel.setAnchor(Pack.UpperLeft, growX=True)
|
||||||
prioritizationTable.setAnchor(Pack.UpperLeft, growX=True, growY=True)
|
prioritizationTable.setAnchor(Pack.UpperLeft, growX=True, growY=True)
|
||||||
|
categoryPopup.setAnchor(Pack.UpperLeft, growX=True)
|
||||||
|
criteriaTable.setAnchor(Pack.UpperLeft, growX=True, growY=True)
|
||||||
|
split.setAnchor(Pack.UpperLeft, growX=True, growY=True)
|
||||||
buttonLayout.setAnchor(Pack.Below)
|
buttonLayout.setAnchor(Pack.Below)
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
from PyQt4.QtCore import Qt, QMimeData, QByteArray
|
from PyQt4.QtCore import Qt, QMimeData, QByteArray
|
||||||
from PyQt4.QtGui import (QDialog, QVBoxLayout, QHBoxLayout, QPushButton, QComboBox, QListView,
|
from PyQt4.QtGui import (QDialog, QVBoxLayout, QHBoxLayout, QPushButton, QComboBox, QListView,
|
||||||
QDialogButtonBox, QAbstractItemView, QLabel)
|
QDialogButtonBox, QAbstractItemView, QLabel, QStyle, QSplitter, QWidget, QSizePolicy)
|
||||||
|
|
||||||
from hscommon.trans import trget
|
from hscommon.trans import trget
|
||||||
from qtlib.selectable_list import ComboboxModel, ListviewModel
|
from qtlib.selectable_list import ComboboxModel, ListviewModel
|
||||||
@ -79,8 +79,8 @@ class PrioritizeDialog(QDialog):
|
|||||||
self.promptLabel.setWordWrap(True)
|
self.promptLabel.setWordWrap(True)
|
||||||
self.categoryCombobox = QComboBox()
|
self.categoryCombobox = QComboBox()
|
||||||
self.criteriaListView = QListView()
|
self.criteriaListView = QListView()
|
||||||
self.addCriteriaButton = QPushButton("-->")
|
self.addCriteriaButton = QPushButton(self.style().standardIcon(QStyle.SP_ArrowRight), "")
|
||||||
self.removeCriteriaButton = QPushButton("<--")
|
self.removeCriteriaButton = QPushButton(self.style().standardIcon(QStyle.SP_ArrowLeft), "")
|
||||||
self.prioritizationListView = QListView()
|
self.prioritizationListView = QListView()
|
||||||
self.prioritizationListView.setAcceptDrops(True)
|
self.prioritizationListView.setAcceptDrops(True)
|
||||||
self.prioritizationListView.setDragEnabled(True)
|
self.prioritizationListView.setDragEnabled(True)
|
||||||
@ -92,17 +92,26 @@ class PrioritizeDialog(QDialog):
|
|||||||
# layout
|
# layout
|
||||||
self.mainLayout = QVBoxLayout(self)
|
self.mainLayout = QVBoxLayout(self)
|
||||||
self.mainLayout.addWidget(self.promptLabel)
|
self.mainLayout.addWidget(self.promptLabel)
|
||||||
self.widgetsLayout = QHBoxLayout()
|
self.splitter = QSplitter()
|
||||||
|
sp = self.splitter.sizePolicy()
|
||||||
|
sp.setVerticalPolicy(QSizePolicy.Expanding)
|
||||||
|
self.splitter.setSizePolicy(sp)
|
||||||
|
self.leftSide = QWidget()
|
||||||
self.leftWidgetsLayout = QVBoxLayout()
|
self.leftWidgetsLayout = QVBoxLayout()
|
||||||
self.leftWidgetsLayout.addWidget(self.categoryCombobox)
|
self.leftWidgetsLayout.addWidget(self.categoryCombobox)
|
||||||
self.leftWidgetsLayout.addWidget(self.criteriaListView)
|
self.leftWidgetsLayout.addWidget(self.criteriaListView)
|
||||||
self.widgetsLayout.addLayout(self.leftWidgetsLayout)
|
self.leftSide.setLayout(self.leftWidgetsLayout)
|
||||||
|
self.splitter.addWidget(self.leftSide)
|
||||||
|
self.rightSide = QWidget()
|
||||||
|
self.rightWidgetsLayout = QHBoxLayout()
|
||||||
self.addRemoveButtonsLayout = QVBoxLayout()
|
self.addRemoveButtonsLayout = QVBoxLayout()
|
||||||
self.addRemoveButtonsLayout.addItem(verticalSpacer())
|
self.addRemoveButtonsLayout.addItem(verticalSpacer())
|
||||||
self.addRemoveButtonsLayout.addWidget(self.addCriteriaButton)
|
self.addRemoveButtonsLayout.addWidget(self.addCriteriaButton)
|
||||||
self.addRemoveButtonsLayout.addWidget(self.removeCriteriaButton)
|
self.addRemoveButtonsLayout.addWidget(self.removeCriteriaButton)
|
||||||
self.addRemoveButtonsLayout.addItem(verticalSpacer())
|
self.addRemoveButtonsLayout.addItem(verticalSpacer())
|
||||||
self.widgetsLayout.addLayout(self.addRemoveButtonsLayout)
|
self.rightWidgetsLayout.addLayout(self.addRemoveButtonsLayout)
|
||||||
self.widgetsLayout.addWidget(self.prioritizationListView)
|
self.rightWidgetsLayout.addWidget(self.prioritizationListView)
|
||||||
self.mainLayout.addLayout(self.widgetsLayout)
|
self.rightSide.setLayout(self.rightWidgetsLayout)
|
||||||
|
self.splitter.addWidget(self.rightSide)
|
||||||
|
self.mainLayout.addWidget(self.splitter)
|
||||||
self.mainLayout.addWidget(self.buttonBox)
|
self.mainLayout.addWidget(self.buttonBox)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user