Consolidate controls into compact horizontal layout
- Combine database and filter sections into single horizontal row - Reduce vertical space usage by ~60% for control area - Use shorter button labels (Add DB, Clear) to save space - Add visual separators between control sections - Compact filter controls into inline layouts - Make database path label more compact with word wrap - Integrate analyze button into controls row - Significantly increase space available for data display
This commit is contained in:
+51
-43
@@ -361,80 +361,88 @@ class MainWindow(QMainWindow):
|
|||||||
self.mainLayout.setContentsMargins(10, 10, 10, 10)
|
self.mainLayout.setContentsMargins(10, 10, 10, 10)
|
||||||
self.mainLayout.setSpacing(8)
|
self.mainLayout.setSpacing(8)
|
||||||
|
|
||||||
# Create top section for database selection
|
# Create compact controls section
|
||||||
self.createDatabaseSection()
|
self.createControlsSection()
|
||||||
|
|
||||||
# Create filter section
|
|
||||||
self.createFilterSection()
|
|
||||||
|
|
||||||
# Create tabs for results
|
# Create tabs for results
|
||||||
self.createTabs()
|
self.createTabs()
|
||||||
|
|
||||||
# Create analyze button
|
|
||||||
self.analyzeButton = QPushButton("Analyze Transfers")
|
|
||||||
self.analyzeButton.clicked.connect(self.analyzeTransfers)
|
|
||||||
self.mainLayout.addWidget(self.analyzeButton)
|
|
||||||
|
|
||||||
# Initial database check
|
# Initial database check
|
||||||
if os.path.exists("transfers.db"):
|
if os.path.exists("transfers.db"):
|
||||||
self.db_paths.append("transfers.db")
|
self.db_paths.append("transfers.db")
|
||||||
self.dbPathsLabel.setText("Database(s): transfers.db")
|
self.dbPathsLabel.setText("Database(s): transfers.db")
|
||||||
|
|
||||||
def createDatabaseSection(self):
|
def createControlsSection(self):
|
||||||
# Database selection section
|
# Compact controls section
|
||||||
dbSection = QGroupBox("Database Files")
|
controlsGroup = QGroupBox("Controls")
|
||||||
dbLayout = QVBoxLayout()
|
controlsLayout = QHBoxLayout()
|
||||||
dbLayout.setContentsMargins(10, 10, 10, 10)
|
controlsLayout.setContentsMargins(10, 10, 10, 10)
|
||||||
dbLayout.setSpacing(5)
|
controlsLayout.setSpacing(15)
|
||||||
|
|
||||||
# Create layout for database selection buttons
|
# Database controls
|
||||||
buttonLayout = QHBoxLayout()
|
dbControlsLayout = QVBoxLayout()
|
||||||
|
dbControlsLayout.setSpacing(3)
|
||||||
|
|
||||||
# Add database button
|
dbButtonsLayout = QHBoxLayout()
|
||||||
addDbButton = QPushButton("Add Database File")
|
addDbButton = QPushButton("Add DB")
|
||||||
addDbButton.clicked.connect(self.addDatabaseFile)
|
addDbButton.clicked.connect(self.addDatabaseFile)
|
||||||
buttonLayout.addWidget(addDbButton)
|
clearDbButton = QPushButton("Clear")
|
||||||
|
|
||||||
# Clear databases button
|
|
||||||
clearDbButton = QPushButton("Clear Database Files")
|
|
||||||
clearDbButton.clicked.connect(self.clearDatabaseFiles)
|
clearDbButton.clicked.connect(self.clearDatabaseFiles)
|
||||||
buttonLayout.addWidget(clearDbButton)
|
dbButtonsLayout.addWidget(addDbButton)
|
||||||
|
dbButtonsLayout.addWidget(clearDbButton)
|
||||||
|
|
||||||
dbLayout.addLayout(buttonLayout)
|
|
||||||
|
|
||||||
# Label to show selected databases
|
|
||||||
self.dbPathsLabel = QLabel("No database files selected")
|
self.dbPathsLabel = QLabel("No database files selected")
|
||||||
dbLayout.addWidget(self.dbPathsLabel)
|
self.dbPathsLabel.setMaximumWidth(200)
|
||||||
|
self.dbPathsLabel.setWordWrap(True)
|
||||||
|
self.dbPathsLabel.setStyleSheet("font-size: 9pt; color: #666;")
|
||||||
|
|
||||||
dbSection.setLayout(dbLayout)
|
dbControlsLayout.addLayout(dbButtonsLayout)
|
||||||
self.mainLayout.addWidget(dbSection)
|
dbControlsLayout.addWidget(self.dbPathsLabel)
|
||||||
|
|
||||||
def createFilterSection(self):
|
# Filter controls
|
||||||
# Filter options section
|
filterControlsLayout = QVBoxLayout()
|
||||||
filterSection = QGroupBox("Filters")
|
filterControlsLayout.setSpacing(3)
|
||||||
filterLayout = QFormLayout()
|
|
||||||
filterLayout.setContentsMargins(10, 10, 10, 10)
|
|
||||||
filterLayout.setVerticalSpacing(5)
|
|
||||||
|
|
||||||
# Time period filter
|
# Time period
|
||||||
|
periodLayout = QHBoxLayout()
|
||||||
|
periodLayout.addWidget(QLabel("Period:"))
|
||||||
self.periodComboBox = QComboBox()
|
self.periodComboBox = QComboBox()
|
||||||
self.periodComboBox.addItems(["All time", "Last month", "Last year"])
|
self.periodComboBox.addItems(["All time", "Last month", "Last year"])
|
||||||
self.periodComboBox.setCurrentText("All time")
|
self.periodComboBox.setCurrentText("All time")
|
||||||
filterLayout.addRow("Time period:", self.periodComboBox)
|
periodLayout.addWidget(self.periodComboBox)
|
||||||
|
|
||||||
# Top N filter
|
# Top N
|
||||||
|
topLayout = QHBoxLayout()
|
||||||
|
topLayout.addWidget(QLabel("Top N:"))
|
||||||
self.topSpinBox = QSpinBox()
|
self.topSpinBox = QSpinBox()
|
||||||
self.topSpinBox.setMinimum(1)
|
self.topSpinBox.setMinimum(1)
|
||||||
self.topSpinBox.setMaximum(100)
|
self.topSpinBox.setMaximum(100)
|
||||||
self.topSpinBox.setValue(10)
|
self.topSpinBox.setValue(10)
|
||||||
filterLayout.addRow("Show top N entries:", self.topSpinBox)
|
self.topSpinBox.setMaximumWidth(60)
|
||||||
|
topLayout.addWidget(self.topSpinBox)
|
||||||
|
|
||||||
|
filterControlsLayout.addLayout(periodLayout)
|
||||||
|
filterControlsLayout.addLayout(topLayout)
|
||||||
|
|
||||||
|
# Analyze button
|
||||||
|
self.analyzeButton = QPushButton("Analyze Transfers")
|
||||||
|
self.analyzeButton.clicked.connect(self.analyzeTransfers)
|
||||||
|
self.analyzeButton.setMinimumHeight(40)
|
||||||
|
|
||||||
|
# Add all sections to main layout
|
||||||
|
controlsLayout.addLayout(dbControlsLayout)
|
||||||
|
controlsLayout.addWidget(QLabel("|")) # Separator
|
||||||
|
controlsLayout.addLayout(filterControlsLayout)
|
||||||
|
controlsLayout.addWidget(QLabel("|")) # Separator
|
||||||
|
controlsLayout.addWidget(self.analyzeButton)
|
||||||
|
controlsLayout.addStretch()
|
||||||
|
|
||||||
# Hidden variables to replace checkboxes
|
# Hidden variables to replace checkboxes
|
||||||
self.uploadsCheckBox = True
|
self.uploadsCheckBox = True
|
||||||
self.downloadsCheckBox = True
|
self.downloadsCheckBox = True
|
||||||
|
|
||||||
filterSection.setLayout(filterLayout)
|
controlsGroup.setLayout(controlsLayout)
|
||||||
self.mainLayout.addWidget(filterSection)
|
self.mainLayout.addWidget(controlsGroup)
|
||||||
|
|
||||||
def createTabs(self):
|
def createTabs(self):
|
||||||
# Create tab widget
|
# Create tab widget
|
||||||
|
|||||||
Reference in New Issue
Block a user