From 9ae5f44e2f87cc87b1c98d756923b7785a801333 Mon Sep 17 00:00:00 2001 From: CPD Date: Mon, 17 Mar 2025 16:42:25 +0100 Subject: [PATCH] Change left widget defaults --- cpdctrl_gui/ui/main_window.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/cpdctrl_gui/ui/main_window.py b/cpdctrl_gui/ui/main_window.py index c39d9ea..e346b84 100644 --- a/cpdctrl_gui/ui/main_window.py +++ b/cpdctrl_gui/ui/main_window.py @@ -5,7 +5,7 @@ from PyQt6.QtCore import Qt, QTimer, QFileSystemWatcher from PyQt6.QtWidgets import QMainWindow, QWidget, QHBoxLayout, QLabel, QStatusBar, QFileDialog, \ QVBoxLayout from PyQt6.QtWidgets import QTabWidget -from PyQt6.QtGui import QIcon, QPixmap, QAction, QKeySequence +from PyQt6.QtGui import QIcon, QPixmap, QAction, QKeySequence, QDragEnterEvent from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QMessageBox from ..resources import get_resource_path @@ -79,16 +79,17 @@ class MainWindow(QMainWindow): # Left: Toolbox self.w_lefttab = QTabWidget(self) self.w_lefttab.setMinimumWidth(300) + self.w_lefttab.setMaximumWidth(400) layout.addWidget(self.w_lefttab) metadata_init_dict = AppConfig.MEAS_CFG.get_or("metadata", {}) # Measurement settings self.w_measurement_settings = MeasurementSettings() - self.w_lefttab.addTab(self.w_measurement_settings, "Measurement settings") + self.w_lefttab.addTab(self.w_measurement_settings, "Measurement Settings") # Measurement metadata self.w_metadata = MetadataInput(metadata_init_dict) self.w_metadata.metadataChanged.connect(self._metadata_updated) - self.w_lefttab.addTab(self.w_metadata, "Measurement metadata") + self.w_lefttab.addTab(self.w_metadata, "Measurement Metadata") # TODO: the call_f solution isnt pretty # TODO: only accept single file? class RightTab(QTabWidget): @@ -97,10 +98,13 @@ class MainWindow(QMainWindow): self.setAcceptDrops(True) self.call_f = call_f def dragEnterEvent(self, event): - if event.mimeData().hasUrls(): - event.accept() - else: + if not event.mimeData().hasUrls(): event.ignore() + if len(event.mimeData().urls()) != 1: + event.ignore() + event.setDropAction(Qt.DropAction.LinkAction) + event.accept() + def dropEvent(self, event): for url in event.mimeData().urls(): file_path = url.path()[1:]