Skip to content

Commit

Permalink
WishlistWidget: re-order comboboxes to match the order in the library
Browse files Browse the repository at this point in the history
* Move filter combobox at the beginning of the top panel and move the order
combobox after it to replicate the order in the library view.
  • Loading branch information
loathingKernel committed Feb 25, 2024
1 parent 5ae9e6f commit 2fc729c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 60 deletions.
16 changes: 8 additions & 8 deletions rare/components/tabs/store/wishlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ def __init__(self, api: StoreAPI, parent=None):
self.wishlist_layout = FlowLayout()
self.ui.container_layout.addLayout(self.wishlist_layout, stretch=1)

filters = {
WishlistFilter.NONE: self.tr("All items"),
WishlistFilter.DISCOUNT: self.tr("Discount"),
}
for data, text in filters.items():
self.ui.filter_combo.addItem(text, data)
self.ui.filter_combo.currentIndexChanged.connect(self.filter_wishlist)

sortings = {
WishlistOrder.NAME: self.tr("Name"),
WishlistOrder.PRICE: self.tr("Price"),
Expand All @@ -82,14 +90,6 @@ def __init__(self, api: StoreAPI, parent=None):
self.ui.order_combo.addItem(text, data)
self.ui.order_combo.currentIndexChanged.connect(self.order_wishlist)

filters = {
WishlistFilter.NONE: self.tr("None"),
WishlistFilter.DISCOUNT: self.tr("Discount"),
}
for data, text in filters.items():
self.ui.filter_combo.addItem(text, data)
self.ui.filter_combo.currentIndexChanged.connect(self.filter_wishlist)

self.ui.reload_button.setIcon(qta_icon("fa.refresh", color="white"))
self.ui.reload_button.clicked.connect(self.update_wishlist)

Expand Down
21 changes: 3 additions & 18 deletions rare/ui/components/tabs/store/wishlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,9 @@ def setupUi(self, Wishlist):
self.main_layout.setObjectName("main_layout")
self.tool_layout = QtWidgets.QHBoxLayout()
self.tool_layout.setObjectName("tool_layout")
self.order_label = QtWidgets.QLabel(Wishlist)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.order_label.sizePolicy().hasHeightForWidth())
self.order_label.setSizePolicy(sizePolicy)
self.order_label.setObjectName("order_label")
self.tool_layout.addWidget(self.order_label)
self.filter_combo = QtWidgets.QComboBox(Wishlist)
self.filter_combo.setObjectName("filter_combo")
self.tool_layout.addWidget(self.filter_combo)
self.order_combo = QtWidgets.QComboBox(Wishlist)
self.order_combo.setObjectName("order_combo")
self.tool_layout.addWidget(self.order_combo)
Expand All @@ -36,14 +31,6 @@ def setupUi(self, Wishlist):
self.tool_layout.addWidget(self.reverse_check)
spacerItem = QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.tool_layout.addItem(spacerItem)
self.filter_label = QtWidgets.QLabel(Wishlist)
self.filter_label.setObjectName("filter_label")
self.tool_layout.addWidget(self.filter_label)
self.filter_combo = QtWidgets.QComboBox(Wishlist)
self.filter_combo.setObjectName("filter_combo")
self.tool_layout.addWidget(self.filter_combo)
spacerItem1 = QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.tool_layout.addItem(spacerItem1)
self.reload_button = QtWidgets.QPushButton(Wishlist)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
Expand Down Expand Up @@ -73,9 +60,7 @@ def setupUi(self, Wishlist):

def retranslateUi(self, Wishlist):
_translate = QtCore.QCoreApplication.translate
self.order_label.setText(_translate("Wishlist", "Sort by"))
self.reverse_check.setText(_translate("Wishlist", "Reverse"))
self.filter_label.setText(_translate("Wishlist", "Filter by"))
self.no_games_label.setText(_translate("Wishlist", "No games matching your filter"))


Expand Down
35 changes: 1 addition & 34 deletions rare/ui/components/tabs/store/wishlist.ui
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,7 @@
<item>
<layout class="QHBoxLayout" name="tool_layout">
<item>
<widget class="QLabel" name="order_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Sort by</string>
</property>
</widget>
<widget class="QComboBox" name="filter_combo"/>
</item>
<item>
<widget class="QComboBox" name="order_combo"/>
Expand All @@ -52,29 +42,6 @@
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="filter_label">
<property name="text">
<string>Filter by</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="filter_combo"/>
</item>
<item>
<spacer name="hspacer_right">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="reload_button">
<property name="sizePolicy">
Expand Down

0 comments on commit 2fc729c

Please sign in to comment.