Skip to content

Commit

Permalink
Add QScrollArea into all properties widgets
Browse files Browse the repository at this point in the history
In addition, adapt to property changes in ToolboxUI

Re spine-tools/Spine-Toolbox#2794
  • Loading branch information
ptsavol committed Aug 16, 2024
1 parent 4ce33aa commit b4b6dd3
Show file tree
Hide file tree
Showing 47 changed files with 1,718 additions and 1,188 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-e git+https://github.com/spine-tools/Spine-Database-API.git#egg=spinedb_api
-e git+https://github.com/spine-tools/spine-engine.git#egg=spine_engine
-e git+https://github.com/spine-tools/Spine-Toolbox.git#egg=spinetoolbox
-e git+https://github.com/spine-tools/Spine-Toolbox.git@issue_2794#egg=spinetoolbox
-e .
2 changes: 1 addition & 1 deletion spine_items/data_connection/data_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def _add_file_references(self, paths):
@Slot(bool)
def show_add_db_reference_dialog(self, _=False):
"""Opens a dialog where user can select a url to be added as reference for this Data Connection."""
selector = UrlSelectorDialog(self._toolbox.qsettings(), False, self._toolbox, self._toolbox)
selector = UrlSelectorDialog(self._toolbox.qsettings, False, self._toolbox, self._toolbox)
result = selector.exec()
if result == UrlSelectorDialog.DialogCode.Rejected:
return
Expand Down
64 changes: 40 additions & 24 deletions spine_items/data_connection/ui/data_connection_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
################################################################################
## Form generated from reading UI file 'data_connection_properties.ui'
##
## Created by: Qt User Interface Compiler version 6.5.2
## Created by: Qt User Interface Compiler version 6.7.2
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
Expand All @@ -28,8 +28,8 @@
QPainter, QPalette, QPixmap, QRadialGradient,
QTransform)
from PySide6.QtWidgets import (QAbstractItemView, QApplication, QHBoxLayout, QHeaderView,
QSizePolicy, QSpacerItem, QToolButton, QVBoxLayout,
QWidget)
QScrollArea, QSizePolicy, QSpacerItem, QToolButton,
QVBoxLayout, QWidget)

from spine_items.widgets import (DataTreeView, ReferencesTreeView)
from spine_items import resources_icons_rc
Expand All @@ -42,76 +42,92 @@ def setupUi(self, Form):
self.action_new_file_reference = QAction(Form)
self.action_new_file_reference.setObjectName(u"action_new_file_reference")
icon = QIcon()
icon.addFile(u":/icons/plus.svg", QSize(), QIcon.Normal, QIcon.Off)
icon.addFile(u":/icons/plus.svg", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
self.action_new_file_reference.setIcon(icon)
self.action_new_db_reference = QAction(Form)
self.action_new_db_reference.setObjectName(u"action_new_db_reference")
self.action_new_db_reference.setIcon(icon)
self.verticalLayout = QVBoxLayout(Form)
self.verticalLayout_2 = QVBoxLayout(Form)
self.verticalLayout_2.setSpacing(0)
self.verticalLayout_2.setObjectName(u"verticalLayout_2")
self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
self.scrollArea = QScrollArea(Form)
self.scrollArea.setObjectName(u"scrollArea")
self.scrollArea.setWidgetResizable(True)
self.scrollAreaWidgetContents = QWidget()
self.scrollAreaWidgetContents.setObjectName(u"scrollAreaWidgetContents")
self.scrollAreaWidgetContents.setGeometry(QRect(0, 0, 272, 436))
self.verticalLayout = QVBoxLayout(self.scrollAreaWidgetContents)
self.verticalLayout.setSpacing(0)
self.verticalLayout.setObjectName(u"verticalLayout")
self.treeView_dc_references = ReferencesTreeView(Form)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.treeView_dc_references = ReferencesTreeView(self.scrollAreaWidgetContents)
self.treeView_dc_references.setObjectName(u"treeView_dc_references")
sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
sizePolicy = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.treeView_dc_references.sizePolicy().hasHeightForWidth())
self.treeView_dc_references.setSizePolicy(sizePolicy)
self.treeView_dc_references.setContextMenuPolicy(Qt.CustomContextMenu)
self.treeView_dc_references.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
self.treeView_dc_references.setAcceptDrops(True)
self.treeView_dc_references.setSelectionMode(QAbstractItemView.ExtendedSelection)
self.treeView_dc_references.setTextElideMode(Qt.ElideLeft)
self.treeView_dc_references.setVerticalScrollMode(QAbstractItemView.ScrollPerPixel)
self.treeView_dc_references.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
self.treeView_dc_references.setTextElideMode(Qt.TextElideMode.ElideLeft)
self.treeView_dc_references.setVerticalScrollMode(QAbstractItemView.ScrollMode.ScrollPerPixel)
self.treeView_dc_references.header().setStretchLastSection(True)

self.verticalLayout.addWidget(self.treeView_dc_references)

self.horizontalLayout_2 = QHBoxLayout()
self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
self.toolButton_add = QToolButton(Form)
self.toolButton_add = QToolButton(self.scrollAreaWidgetContents)
self.toolButton_add.setObjectName(u"toolButton_add")
icon1 = QIcon()
icon1.addFile(u":/icons/file-download.svg", QSize(), QIcon.Normal, QIcon.Off)
icon1.addFile(u":/icons/file-download.svg", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
self.toolButton_add.setIcon(icon1)
self.toolButton_add.setPopupMode(QToolButton.InstantPopup)
self.toolButton_add.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup)

self.horizontalLayout_2.addWidget(self.toolButton_add)

self.horizontalSpacer_2 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
self.horizontalSpacer_2 = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)

self.horizontalLayout_2.addItem(self.horizontalSpacer_2)

self.toolButton_minus = QToolButton(Form)
self.toolButton_minus = QToolButton(self.scrollAreaWidgetContents)
self.toolButton_minus.setObjectName(u"toolButton_minus")
sizePolicy1 = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
sizePolicy1 = QSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed)
sizePolicy1.setHorizontalStretch(0)
sizePolicy1.setVerticalStretch(0)
sizePolicy1.setHeightForWidth(self.toolButton_minus.sizePolicy().hasHeightForWidth())
self.toolButton_minus.setSizePolicy(sizePolicy1)
icon2 = QIcon()
icon2.addFile(u":/icons/minus.svg", QSize(), QIcon.Normal, QIcon.Off)
icon2.addFile(u":/icons/minus.svg", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
self.toolButton_minus.setIcon(icon2)
self.toolButton_minus.setPopupMode(QToolButton.InstantPopup)
self.toolButton_minus.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup)

self.horizontalLayout_2.addWidget(self.toolButton_minus)


self.verticalLayout.addLayout(self.horizontalLayout_2)

self.treeView_dc_data = DataTreeView(Form)
self.treeView_dc_data = DataTreeView(self.scrollAreaWidgetContents)
self.treeView_dc_data.setObjectName(u"treeView_dc_data")
sizePolicy.setHeightForWidth(self.treeView_dc_data.sizePolicy().hasHeightForWidth())
self.treeView_dc_data.setSizePolicy(sizePolicy)
self.treeView_dc_data.setContextMenuPolicy(Qt.CustomContextMenu)
self.treeView_dc_data.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
self.treeView_dc_data.setAcceptDrops(True)
self.treeView_dc_data.setSelectionMode(QAbstractItemView.ExtendedSelection)
self.treeView_dc_data.setTextElideMode(Qt.ElideLeft)
self.treeView_dc_data.setVerticalScrollMode(QAbstractItemView.ScrollPerPixel)
self.treeView_dc_data.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
self.treeView_dc_data.setTextElideMode(Qt.TextElideMode.ElideLeft)
self.treeView_dc_data.setVerticalScrollMode(QAbstractItemView.ScrollMode.ScrollPerPixel)
self.treeView_dc_data.setIndentation(5)
self.treeView_dc_data.setUniformRowHeights(True)
self.treeView_dc_data.header().setStretchLastSection(True)

self.verticalLayout.addWidget(self.treeView_dc_data)

self.scrollArea.setWidget(self.scrollAreaWidgetContents)

self.verticalLayout_2.addWidget(self.scrollArea)


self.retranslateUi(Form)

Expand Down
Loading

0 comments on commit b4b6dd3

Please sign in to comment.