Skip to content

Commit b1a8d3c

Browse files
committed
enh: unify action button size, alignment, and spacing across all tabs
1 parent 792adc1 commit b1a8d3c

8 files changed

Lines changed: 39 additions & 15 deletions

File tree

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- fix: cache download resource file size
66
- fix: action button behavior in downloads panel (#94)
77
- fix: action button behavior in uploads panel
8+
- enh: unify action button size, alignment, and spacing across all tabs
89
- enh: allow sharing individual datasets instead of collections (#32)
910
- enh: add preview option for dataset description in upload dialog (#52)
1011
- enh: introduce write lock for eternal job updates

dcoraid/gui/dbview/filter_base.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ def set_entry(self, row, entry):
100100
# tool buttons (2nd column)
101101
widact = QtWidgets.QWidget(self)
102102
horz_layout = QtWidgets.QHBoxLayout(widact)
103-
horz_layout.setContentsMargins(0, 0, 5, 0)
104103
horz_layout.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight)
104+
horz_layout.setSpacing(2)
105+
horz_layout.setContentsMargins(0, 0, 2, 0)
105106

106-
col_width = 0
107107
for action in self.get_entry_actions(row, entry):
108108
if action["name"] in self.active_actions:
109109
tbact = QtWidgets.QToolButton(widact)
@@ -113,10 +113,8 @@ def set_entry(self, row, entry):
113113
tbact.clicked.connect(action["function"])
114114
horz_layout.addWidget(tbact)
115115
row_height = tbact.geometry().height()
116-
col_width += row_height
117-
tbact.setFixedWidth(row_height)
116+
tbact.setFixedSize(row_height - 2, row_height - 2)
118117

119-
self.tableWidget.setColumnWidth(1, col_width)
120118
self.tableWidget.setCellWidget(row, 1, widact)
121119

122120
return widact

dcoraid/gui/panel_downloads/widget_actions_download.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ def __init__(self, job, *args, **kwargs):
2929
self.tb_view.clicked.connect(self.on_view)
3030
self.tb_folder.clicked.connect(self.on_folder)
3131

32+
for tbact in [self.tb_delete,
33+
self.tb_error,
34+
self.tb_retry,
35+
self.tb_view,
36+
self.tb_folder,
37+
]:
38+
row_height = tbact.geometry().height()
39+
tbact.setFixedSize(row_height - 2, row_height - 2)
40+
3241
@QtCore.pyqtSlot()
3342
def on_delete(self):
3443
self.delete_job.emit(self.job.job_id)

dcoraid/gui/panel_downloads/widget_actions_download.ui

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<property name="bottomMargin">
3030
<number>0</number>
3131
</property>
32-
<item>
32+
<item alignment="Qt::AlignmentFlag::AlignRight">
3333
<widget class="QToolButton" name="tb_delete">
3434
<property name="toolTip">
3535
<string>Remove from queue (DCOR data is not deleted)</string>
@@ -42,7 +42,7 @@
4242
</property>
4343
</widget>
4444
</item>
45-
<item>
45+
<item alignment="Qt::AlignmentFlag::AlignRight">
4646
<widget class="QToolButton" name="tb_error">
4747
<property name="toolTip">
4848
<string>Show error message</string>
@@ -55,7 +55,7 @@
5555
</property>
5656
</widget>
5757
</item>
58-
<item>
58+
<item alignment="Qt::AlignmentFlag::AlignRight">
5959
<widget class="QToolButton" name="tb_retry">
6060
<property name="toolTip">
6161
<string>Retry upload</string>
@@ -68,7 +68,7 @@
6868
</property>
6969
</widget>
7070
</item>
71-
<item>
71+
<item alignment="Qt::AlignmentFlag::AlignRight">
7272
<widget class="QToolButton" name="tb_folder">
7373
<property name="toolTip">
7474
<string>Open download location</string>
@@ -81,7 +81,7 @@
8181
</property>
8282
</widget>
8383
</item>
84-
<item>
84+
<item alignment="Qt::AlignmentFlag::AlignRight">
8585
<widget class="QToolButton" name="tb_view">
8686
<property name="toolTip">
8787
<string>View dataset online</string>

dcoraid/gui/panel_downloads/widget_download.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,10 @@ def update_job_status(self):
253253
QtCore.QEventLoop.ProcessEventsFlag.AllEvents, 300)
254254
self.setUpdatesEnabled(True)
255255

256+
header = self.horizontalHeader()
257+
header.setSectionResizeMode(
258+
5, QtWidgets.QHeaderView.ResizeMode.ResizeToContents)
259+
256260
def set_label_item(self, row, col, label):
257261
"""Get/Create a Qlabel at the specified position
258262

dcoraid/gui/panel_uploads/widget_actions_upload.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ def __init__(self, job, *args, **kwargs):
2727
self.tb_retry.clicked.connect(self.on_retry)
2828
self.tb_view.clicked.connect(self.on_view)
2929

30+
for tbact in [self.tb_abort,
31+
self.tb_delete,
32+
self.tb_error,
33+
self.tb_retry,
34+
self.tb_view,
35+
]:
36+
row_height = tbact.geometry().height()
37+
tbact.setFixedSize(row_height - 2, row_height - 2)
38+
3039
@QtCore.pyqtSlot()
3140
def on_abort(self):
3241
self.abort_job.emit(self.job.dataset_id)

dcoraid/gui/panel_uploads/widget_actions_upload.ui

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<property name="bottomMargin">
3030
<number>0</number>
3131
</property>
32-
<item>
32+
<item alignment="Qt::AlignmentFlag::AlignRight">
3333
<widget class="QToolButton" name="tb_delete">
3434
<property name="toolTip">
3535
<string>Remove from queue (DCOR data is not deleted)</string>
@@ -42,7 +42,7 @@
4242
</property>
4343
</widget>
4444
</item>
45-
<item>
45+
<item alignment="Qt::AlignmentFlag::AlignRight">
4646
<widget class="QToolButton" name="tb_abort">
4747
<property name="toolTip">
4848
<string>Abort job</string>
@@ -55,7 +55,7 @@
5555
</property>
5656
</widget>
5757
</item>
58-
<item>
58+
<item alignment="Qt::AlignmentFlag::AlignRight">
5959
<widget class="QToolButton" name="tb_error">
6060
<property name="toolTip">
6161
<string>Show error message</string>
@@ -68,7 +68,7 @@
6868
</property>
6969
</widget>
7070
</item>
71-
<item>
71+
<item alignment="Qt::AlignmentFlag::AlignRight">
7272
<widget class="QToolButton" name="tb_retry">
7373
<property name="toolTip">
7474
<string>Retry upload</string>
@@ -81,7 +81,7 @@
8181
</property>
8282
</widget>
8383
</item>
84-
<item>
84+
<item alignment="Qt::AlignmentFlag::AlignRight">
8585
<widget class="QToolButton" name="tb_view">
8686
<property name="toolTip">
8787
<string>View dataset online</string>

dcoraid/gui/panel_uploads/widget_upload.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,9 @@ def update_job_status(self):
509509

510510
# enable updates again
511511
self.setUpdatesEnabled(True)
512+
header = self.horizontalHeader()
513+
header.setSectionResizeMode(
514+
5, QtWidgets.QHeaderView.ResizeMode.ResizeToContents)
512515

513516
def set_label_item(self, row, col, label):
514517
"""Get/Create a Qlabel at the specified position

0 commit comments

Comments
 (0)