|
59 | 59 | from PyQt6.QtWidgets import (QApplication, QWidget, QCheckBox, QComboBox, QDialogButtonBox, QGridLayout, # @UnusedImport @Reimport @UnresolvedImport
|
60 | 60 | QHBoxLayout, QVBoxLayout, QHeaderView, QLabel, QLineEdit, QTextEdit, QListView, # @UnusedImport @Reimport @UnresolvedImport
|
61 | 61 | QPushButton, QSpinBox, QTableWidget, QTableWidgetItem, QTabWidget, QSizePolicy, # @UnusedImport @Reimport @UnresolvedImport
|
62 |
| - QGroupBox, QToolButton) # @UnusedImport @Reimport @UnresolvedImport |
| 62 | + QGroupBox, QToolButton, QFrame) # @UnusedImport @Reimport @UnresolvedImport |
63 | 63 | # from PyQt6 import sip # @UnusedImport @Reimport @UnresolvedImport
|
64 | 64 | except ImportError:
|
65 | 65 | from PyQt5.QtCore import Qt, pyqtSignal, pyqtSlot, QRegularExpression, QSettings, QTimer, QEvent, QLocale, QSignalBlocker # type: ignore # @UnusedImport @Reimport @UnresolvedImport
|
66 | 66 | from PyQt5.QtGui import QColor, QIntValidator, QRegularExpressionValidator, QKeySequence, QPalette # type: ignore # @UnusedImport @Reimport @UnresolvedImport
|
67 | 67 | from PyQt5.QtWidgets import (QApplication, QWidget, QCheckBox, QComboBox, QDialogButtonBox, QGridLayout, # type: ignore # @UnusedImport @Reimport @UnresolvedImport
|
68 | 68 | QHBoxLayout, QVBoxLayout, QHeaderView, QLabel, QLineEdit, QTextEdit, QListView, # @UnusedImport @Reimport @UnresolvedImport
|
69 | 69 | QPushButton, QSpinBox, QTableWidget, QTableWidgetItem, QTabWidget, QSizePolicy, # @UnusedImport @Reimport @UnresolvedImport
|
70 |
| - QGroupBox, QToolButton) # @UnusedImport @Reimport @UnresolvedImport |
| 70 | + QGroupBox, QToolButton, QFrame) # @UnusedImport @Reimport @UnresolvedImport |
71 | 71 | # try:
|
72 | 72 | # from PyQt5 import sip # type: ignore # @Reimport @UnresolvedImport @UnusedImport
|
73 | 73 | # except ImportError:
|
@@ -983,11 +983,13 @@ def __init__(self, parent:QWidget, aw:'ApplicationWindow', activeTab:int = 0) ->
|
983 | 983 | self.addRecentButton = QPushButton('+')
|
984 | 984 | self.addRecentButton.clicked.connect(self.addRecentRoast)
|
985 | 985 | self.addRecentButton.setFocusPolicy(Qt.FocusPolicy.NoFocus)
|
| 986 | + self.addRecentButton.setToolTip(QApplication.translate('Tooltip','Add roast properties to list of recent roasts')) |
986 | 987 |
|
987 | 988 | # delete from recent
|
988 | 989 | self.delRecentButton = QPushButton('-')
|
989 | 990 | self.delRecentButton.clicked.connect(self.delRecentRoast)
|
990 | 991 | self.delRecentButton.setFocusPolicy(Qt.FocusPolicy.NoFocus)
|
| 992 | + self.delRecentButton.setToolTip(QApplication.translate('Tooltip','Remove roast properties from list of recent roasts')) |
991 | 993 |
|
992 | 994 | self.recentRoastEnabled()
|
993 | 995 |
|
@@ -1299,26 +1301,49 @@ def __init__(self, parent:QWidget, aw:'ApplicationWindow', activeTab:int = 0) ->
|
1299 | 1301 | self.plus_coffees_combo.setMinimumContentsLength(15)
|
1300 | 1302 | self.plus_blends_combo.setMinimumContentsLength(10)
|
1301 | 1303 | self.plus_stores_combo.setMinimumContentsLength(10)
|
1302 |
| - self.plus_stores_combo.setMaximumWidth(120) |
| 1304 | + self.plus_stores_combo.setMaximumWidth(130) |
1303 | 1305 | self.plus_coffees_combo.setSizePolicy(QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Maximum)
|
1304 | 1306 | self.plus_coffees_combo.setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
|
1305 | 1307 | self.plus_blends_combo.setSizePolicy(QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Maximum)
|
1306 | 1308 | self.plus_blends_combo.setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
|
1307 | 1309 | self.plus_stores_combo.setSizePolicy(QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Maximum)
|
1308 | 1310 | self.plus_stores_combo.setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
|
1309 | 1311 | # plus widget row
|
| 1312 | + |
| 1313 | + plusLineStores = QHBoxLayout() |
| 1314 | + plusLineStores.addSpacing(10) |
| 1315 | + plusLineStores.addWidget(self.plusStoreslabel) |
| 1316 | + plusLineStores.addSpacing(5) |
| 1317 | + plusLineStores.addWidget(self.plus_stores_combo) |
| 1318 | + plusLineStores.setContentsMargins(0, 0, 0, 0) # left, top, right, bottom |
| 1319 | + plusLineStores.setSpacing(5) |
| 1320 | + |
| 1321 | + self.plusLineStoresFrame = QFrame() |
| 1322 | + self.plusLineStoresFrame.setLayout(plusLineStores) |
| 1323 | + |
1310 | 1324 | plusLine = QHBoxLayout()
|
1311 | 1325 | plusLine.addWidget(self.plus_coffees_combo)
|
1312 |
| - plusLine.addSpacing(15) |
| 1326 | + plusLine.addSpacing(10) |
1313 | 1327 | plusLine.addWidget(self.plusBlendslabel)
|
1314 |
| - plusLine.addSpacing(5) |
| 1328 | + plusLine.addSpacing(4) |
1315 | 1329 | plusLine.addWidget(self.plus_blends_combo)
|
1316 | 1330 | plusLine.addWidget(self.plus_custom_blend_button)
|
1317 |
| - plusLine.addSpacing(15) |
1318 |
| - plusLine.addWidget(self.plusStoreslabel) |
1319 |
| - plusLine.addSpacing(5) |
1320 |
| - plusLine.addWidget(self.plus_stores_combo) |
1321 |
| - textLayout.addWidget(self.plus_selected_line,4,1) |
| 1331 | + plusLine.addWidget(self.plusLineStoresFrame) |
| 1332 | + |
| 1333 | + plusLine.setStretch(0, 3) |
| 1334 | + plusLine.setStretch(4, 3) |
| 1335 | + plusLine.setStretch(6, 1) |
| 1336 | + |
| 1337 | + self.label_origin_flag = QCheckBox(QApplication.translate('CheckBox','Standard bean labels')) |
| 1338 | + self.label_origin_flag.setToolTip(QApplication.translate('Tooltip',"Beans are listed as 'origin, name' if ticked, otherwise as 'name, origin'")) |
| 1339 | + self.label_origin_flag.setChecked(bool(plus.stock.coffee_label_normal_order)) |
| 1340 | + self.label_origin_flag.stateChanged.connect(self.labelOriginFlagChanged) |
| 1341 | + |
| 1342 | + selectedLineLayout = QHBoxLayout() |
| 1343 | + selectedLineLayout.addWidget(self.plus_selected_line) |
| 1344 | + selectedLineLayout.addStretch() |
| 1345 | + selectedLineLayout.addWidget(self.label_origin_flag) |
| 1346 | + textLayout.addLayout(selectedLineLayout,4,1) |
1322 | 1347 | textLayout.addWidget(plusCoffeeslabel,5,0)
|
1323 | 1348 | textLayout.addLayout(plusLine,5,1)
|
1324 | 1349 | textLayoutPlusOffset = 2 # to insert the plus widget row, we move the remaining ones one step lower
|
@@ -1901,19 +1926,13 @@ def populatePlusCoffeeBlendCombos(self, storeIndex:Optional[int] = None) -> None
|
1901 | 1926 | if len(self.plus_stores) == 1:
|
1902 | 1927 | self.plus_default_store = plus.stock.getStoreId(self.plus_stores[0])
|
1903 | 1928 | if len(self.plus_stores) < 2:
|
1904 |
| - #self.plusStoreslabel.setVisible(False) |
1905 |
| - if self.plusStoreslabel.isVisible(): |
1906 |
| - self.plusStoreslabel.hide() |
1907 |
| - #self.plus_stores_combo.setVisible(False) |
1908 |
| - if self.plus_stores_combo.isVisible(): |
1909 |
| - self.plus_stores_combo.hide() |
| 1929 | +# self.plusStoreslabel.hide() |
| 1930 | +# self.plus_stores_combo.hide() |
| 1931 | + self.plusLineStoresFrame.hide() |
1910 | 1932 | else:
|
1911 |
| - #self.plusStoreslabel.setVisible(True) |
1912 |
| - if not self.plusStoreslabel.isVisible(): |
1913 |
| - self.plusStoreslabel.show() |
1914 |
| - #self.plus_stores_combo.setVisible(True) |
1915 |
| - if not self.plus_stores_combo.isVisible(): |
1916 |
| - self.plus_stores_combo.show() |
| 1933 | +# self.plusStoreslabel.show() |
| 1934 | +# self.plus_stores_combo.show() |
| 1935 | + self.plusLineStoresFrame.show() |
1917 | 1936 | except Exception as e: # pylint: disable=broad-except
|
1918 | 1937 | _log.exception(e)
|
1919 | 1938 | self.plus_stores_combo.blockSignals(True)
|
@@ -2221,17 +2240,7 @@ def coffeeSelectionChanged(self, n:int) -> None:
|
2221 | 2240 | self.plus_store_selected_label = sd['location_label']
|
2222 | 2241 | cd = plus.stock.getCoffeeCoffeeDict(selected_coffee)
|
2223 | 2242 | self.plus_coffee_selected = cd.get('hr_id','')
|
2224 |
| - origin = '' |
2225 |
| - if 'origin' in cd and cd['origin'] is not None: |
2226 |
| - origin = cd['origin'] |
2227 |
| - picked = '' |
2228 |
| - if 'crop_date' in cd and 'picked' in cd['crop_date'] and len(cd['crop_date']['picked']) > 0 and cd['crop_date']['picked'][0] is not None and plus.stock.has_duplicate_origin_label(cd): |
2229 |
| - picked = f"{cd['crop_date']['picked'][0]}, " |
2230 |
| - if origin: |
2231 |
| - origin = f'{origin} ' |
2232 |
| - elif origin: |
2233 |
| - picked = ', ' |
2234 |
| - self.plus_coffee_selected_label = f"{origin}{picked}{cd.get('label','')}" |
| 2243 | + self.plus_coffee_selected_label = plus.stock.coffeeLabel(cd) |
2235 | 2244 | self.plus_blend_selected_label = None
|
2236 | 2245 | self.plus_blend_selected_spec = None
|
2237 | 2246 | self.plus_blend_selected_spec_labels = None
|
@@ -4168,6 +4177,11 @@ def roastpropertiesChanged(self, _:int = 0) -> None:
|
4168 | 4177 | else:
|
4169 | 4178 | self.aw.qmc.roastpropertiesflag = 0
|
4170 | 4179 |
|
| 4180 | + @pyqtSlot(int) |
| 4181 | + def labelOriginFlagChanged(self, _:int = 0) -> None: |
| 4182 | + plus.stock.coffee_label_normal_order = self.label_origin_flag.isChecked() |
| 4183 | + self.populatePlusCoffeeBlendCombos() # update the plus stock popups to display the correct bean label format |
| 4184 | + |
4171 | 4185 | @pyqtSlot(int)
|
4172 | 4186 | def roastpropertiesAutoOpenChanged(self, _:int = 0) -> None:
|
4173 | 4187 | if self.roastpropertiesAutoOpen.isChecked():
|
|
0 commit comments