|
25 | 25 | import logging |
26 | 26 | from docopt import docopt |
27 | 27 | from pyperclip import copy as pyclipcopy |
| 28 | +from PyQt6.QtWidgets import QHBoxLayout, QSpacerItem, QSizePolicy |
28 | 29 | from PyQt6.QtCore import ( |
29 | 30 | QAbstractTableModel, |
30 | 31 | Qt, |
@@ -498,37 +499,38 @@ def _grid_layout(self, layout="h"): |
498 | 499 | widgets = ( |
499 | 500 | self.input_editor_label, |
500 | 501 | self.input_editor, |
501 | | - self.output_editor_label, |
502 | | - self.comparative_output_chkbox, |
503 | | - # self.output_lbl_comp_chk_layout, |
504 | 502 | self.output_editor, |
505 | 503 | ) |
506 | 504 | for widget in widgets: |
507 | 505 | self.gridLayout.removeWidget(widget) |
508 | 506 | widget.setParent(None) |
| 507 | + self.horizontalLayout.setParent(None) |
| 508 | + self.output_lbl_comp_chk_layout.setParent(None) |
509 | 509 | # (row, col, rowspan, colspan) |
510 | | - elements = ( |
511 | | - ( |
512 | | - (0, 0, 1, 1), # Position: 0x0 1 rowspan 1 colspan |
513 | | - (1, 0, 1, 1), # Position: 1x0 1 rowspan 1 colspan |
514 | | - (0, 1, 1, 1), # Position: 0x1 1 rowspan 1 colspan |
515 | | - (0, 1, 1, 1), # Position: 0x1 1 rowspan 1 colspan |
516 | | - (1, 1, 1, 1), # Position: 1x1 1 rowspan 1 colspan |
517 | | - ) |
518 | | - if layout == "v" |
519 | | - else ( |
520 | | - (0, 0, 1, 2), # Position: 0x0 1 rowspan 2 colspan |
521 | | - (1, 0, 1, 2), # Position: 1x0 1 rowspan 2 colspan |
522 | | - (2, 0, 1, 2), # Position: 2x0 1 rowspan 2 colspan |
523 | | - (2, 1, 1, 2), # Position: 2x0 1 rowspan 2 colspan |
524 | | - (3, 0, 1, 2), # Position: 3x0 1 rowspan 2 colspan |
525 | | - ) |
526 | | - ) |
| 510 | + elements = { |
| 511 | + "v": ( # VERTICAL |
| 512 | + (0, 0, 1, 1), |
| 513 | + (1, 0, 1, 1), |
| 514 | + (1, 1, 1, 1), |
| 515 | + ), |
| 516 | + "h": ( # HORIZONTAL |
| 517 | + (0, 0, 1, 2), |
| 518 | + (1, 0, 1, 2), |
| 519 | + (3, 0, 1, 2), |
| 520 | + ), |
| 521 | + } |
527 | 522 | for i, widget in enumerate(widgets): |
528 | | - self.gridLayout.addWidget(widget, *elements[i]) |
529 | | - self.output_lbl_comp_chk_layout.addWidget(self.output_editor_label) |
530 | | - self.output_lbl_comp_chk_layout.addWidget(self.comparative_output_chkbox) |
531 | | - # self.output_lbl_comp_chk_layout.addItem(self.output_spacer) |
| 523 | + self.gridLayout.addWidget(widget, *elements[layout][i]) |
| 524 | + |
| 525 | + self.horizontalLayout = QHBoxLayout() |
| 526 | + spacerMin = QSpacerItem(7, 0, QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Minimum) |
| 527 | + spacerMax = QSpacerItem(0, 0, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Maximum) |
| 528 | + self.horizontalLayout.addWidget(self.output_editor_label) |
| 529 | + self.horizontalLayout.addItem(spacerMin) |
| 530 | + self.horizontalLayout.addWidget(self.comparative_output_chkbox) |
| 531 | + self.horizontalLayout.addItem(spacerMax) |
| 532 | + span = {"v": (0, 1, 1, 2), "h": (2, 1, 1, 1)} |
| 533 | + self.gridLayout.addLayout(self.horizontalLayout, *span[layout]) |
532 | 534 |
|
533 | 535 | def _grid_full_input(self): |
534 | 536 | widgets = (self.output_editor_label, self.output_editor) |
|
0 commit comments