|
| 1 | +from typing import Union |
| 2 | + |
1 | 3 | from qtpy.QtCore import Qt |
2 | 4 | from qtpy.QtCore import QUrl |
3 | 5 | from qtpy.QtGui import QDesktopServices |
@@ -62,7 +64,7 @@ def add_blank(widget, layout): |
62 | 64 |
|
63 | 65 | def open_file_dialog( |
64 | 66 | widget, |
65 | | - possible_paths=[""], |
| 67 | + possible_paths: list = [""], |
66 | 68 | load_as_folder: bool = False, |
67 | 69 | filetype: str = "Image file (*.tif *.tiff)", |
68 | 70 | ): |
@@ -159,7 +161,7 @@ def make_n_spinboxes( |
159 | 161 | parent=None, |
160 | 162 | double=False, |
161 | 163 | fixed=True, |
162 | | -): |
| 164 | +) -> Union[list, QWidget]: |
163 | 165 | """ |
164 | 166 |
|
165 | 167 | Args: |
@@ -303,7 +305,7 @@ def make_combobox( |
303 | 305 | """Creates a dropdown menu with a title and adds specified entries to it |
304 | 306 |
|
305 | 307 | Args: |
306 | | - entries array(str): Entries to add to the dropdown menu. Defaults to None, no entries if None |
| 308 | + entries (array(str)): Entries to add to the dropdown menu. Defaults to None, no entries if None |
307 | 309 | parent (QWidget): parent QWidget to add dropdown menu to. Defaults to None, no parent is set if None |
308 | 310 | label (str) : if not None, creates a QLabel with the contents of 'label', and returns the label as well |
309 | 311 | fixed (bool): if True, will set the size policy of the dropdown menu to Fixed in h and w. Defaults to True. |
@@ -367,14 +369,22 @@ def make_checkbox( |
367 | 369 |
|
368 | 370 |
|
369 | 371 | def combine_blocks( |
370 | | - second, first, min_spacing=0, horizontal=True, l=11, t=3, r=11, b=11 |
| 372 | + right_or_below, |
| 373 | + left_or_above, |
| 374 | + min_spacing=0, |
| 375 | + horizontal=True, |
| 376 | + l=11, |
| 377 | + t=3, |
| 378 | + r=11, |
| 379 | + b=11, |
371 | 380 | ): |
372 | | - """Combines two QWidget objects and puts them side by side (label on the left and button on the right) |
| 381 | + """Combines two QWidget objects and puts them side by side (first on the left/top and second on the right/bottom depending on "horizontal") |
| 382 | + Weird argument names due the initial implementation of it. # TODO maybe fix arg names |
373 | 383 |
|
374 | 384 | Args: |
375 | | - horizontal (bool): whether to stack widgets laterally or horizontally |
376 | | - second (QWidget): Second widget, to be displayed right/below of the label |
377 | | - first (QWidget): First widget, to be added on the left/above of button |
| 385 | + horizontal (bool): whether to stack widgets vertically (False) or horizontally (True) |
| 386 | + left_or_above (QWidget): First widget, to be added on the left/above of "second" |
| 387 | + right_or_below (QWidget): Second widget, to be displayed right/below of "first" |
378 | 388 | min_spacing (int): Minimum spacing between the two widgets (from the start of label to the start of button) |
379 | 389 |
|
380 | 390 | Returns: |
@@ -407,9 +417,9 @@ def combine_blocks( |
407 | 417 | # temp_layout.setColumnMinimumWidth(1,100) |
408 | 418 | # temp_layout.setSizeConstraint(QLayout.SetMinAndMaxSize) |
409 | 419 |
|
410 | | - temp_layout.addWidget(first, r1, c1) # , alignment=LEFT_AL) |
| 420 | + temp_layout.addWidget(left_or_above, r1, c1) # , alignment=LEFT_AL) |
411 | 421 | # temp_layout.addStretch(100) |
412 | | - temp_layout.addWidget(second, r2, c2) # , alignment=LEFT_AL) |
| 422 | + temp_layout.addWidget(right_or_below, r2, c2) # , alignment=LEFT_AL) |
413 | 423 | temp_widget.setLayout(temp_layout) |
414 | 424 | return temp_widget |
415 | 425 |
|
|
0 commit comments