pymmcore-plus / pymmcore-widgets

A set of Qt-based widgets onto the pymmcore-plus model
https://pymmcore-plus.github.io/pymmcore-widgets
Other
12 stars 7 forks source link

style: fix pixel affine table #341

Closed tlambert03 closed 4 months ago

tlambert03 commented 4 months ago

closes #340

gselzer commented 4 months ago

Wow, speedy again @tlambert03!

I checked out 8a49893, and I unfortunately still see the issue 😕. I actually tried something similar yesterday, and was not successful. I can continue tinkering later if you'd like...

image

codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 90.59%. Comparing base (5957860) to head (8a49893).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #341 +/- ## ======================================= Coverage 90.59% 90.59% ======================================= Files 74 74 Lines 8375 8376 +1 ======================================= + Hits 7587 7588 +1 Misses 788 788 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

tlambert03 commented 4 months ago

ok, then the minimumSizeHint is not working on your display for some reason. on my windows it looks fine, but I don't have windows 11. can you show a screenshot of your display settings? including the scale and layout?

tlambert03 commented 4 months ago

can you edit the source code to this, and let me know how it looks?

class AffineTable(QTableWidgeT):
    def __init__(self):
        ...
        self.verticalHeader().setDefaultSectionSize(20)

    def sizeHint(self):
        sz = self.minimumSizeHint()
        sz.setHeight(self.rowHeight(0) * 3 + 2)
        return z
gselzer commented 4 months ago

diff:

diff --git a/src/pymmcore_widgets/_pixel_configuration_widget.py b/src/pymmcore_widgets/_pixel_configuration_widget.py
index ebfebd4..85b4a83 100644
--- a/src/pymmcore_widgets/_pixel_configuration_widget.py
+++ b/src/pymmcore_widgets/_pixel_configuration_widget.py
@@ -482,9 +482,12 @@ class AffineTable(QTableWidget):
         # add a spinbox in each cell of the table
         self._add_table_spinboxes()
         self.setValue(DEFAULT_AFFINE)
+        self.verticalHeader().setDefaultSectionSize(20)

     def sizeHint(self) -> Any:
-        return self.minimumSizeHint()
+        sz = self.minimumSizeHint()
+        sz.setHeight(self.rowHeight(0) * 3 + 2)
+        return sz

     def _add_table_spinboxes(self) -> None:
         """Add a spinbox in each cell of the table."""

result of python pymmcore-widgets/examples/pixel_configuration_widget.py: image