Add tabWidget and podcasts category to UI

This commit is contained in:
Wiktor Zykubek 2023-06-18 16:14:26 +02:00
parent 30952ad2fb
commit 89cedd4f7c
No known key found for this signature in database
GPG Key ID: 0DAA9DC01449FCA2
3 changed files with 82 additions and 13 deletions

85
form.ui
View File

@ -6,19 +6,19 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>350</width> <width>400</width>
<height>500</height> <height>500</height>
</rect> </rect>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>350</width> <width>400</width>
<height>500</height> <height>500</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>350</width> <width>400</width>
<height>500</height> <height>500</height>
</size> </size>
</property> </property>
@ -44,7 +44,7 @@
<rect> <rect>
<x>9</x> <x>9</x>
<y>9</y> <y>9</y>
<width>332</width> <width>381</width>
<height>461</height> <height>461</height>
</rect> </rect>
</property> </property>
@ -52,19 +52,76 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QListWidget" name="groupsListWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>130</width> <width>150</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>130</width> <width>150</width>
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="radioTab">
<attribute name="title">
<string>Radio</string>
</attribute>
<widget class="QListWidget" name="radioGroupsListWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>150</width>
<height>400</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>400</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>150</width>
<height>400</height>
</size>
</property>
</widget>
</widget>
<widget class="QWidget" name="podcastTab">
<attribute name="title">
<string>Podcasty</string>
</attribute>
<widget class="QListWidget" name="podcastGroupsListWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>150</width>
<height>400</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>400</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>150</width>
<height>400</height>
</size>
</property>
</widget>
</widget>
</widget> </widget>
</item> </item>
<item> <item>
@ -99,6 +156,18 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
<property name="value"> <property name="value">
<number>70</number> <number>70</number>
</property> </property>
@ -124,7 +193,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>350</width> <width>400</width>
<height>22</height> <height>22</height>
</rect> </rect>
</property> </property>

View File

@ -34,7 +34,7 @@ class MainWindow(QMainWindow):
self.setVolume(DEFAULT_VOLUME) self.setVolume(DEFAULT_VOLUME)
self.printGroups() self.printGroups()
self.ui.groupsListWidget.itemClicked.connect(self.printStations) self.ui.radioGroupsListWidget.itemClicked.connect(self.printStations)
self.ui.stationsListWidget.itemClicked.connect(self.playRadio) self.ui.stationsListWidget.itemClicked.connect(self.playRadio)
self.ui.playbackToolButton.clicked.connect(self.togglePlayer) self.ui.playbackToolButton.clicked.connect(self.togglePlayer)
self.ui.volumeHorizontalSlider.valueChanged.connect(self.setVolume) self.ui.volumeHorizontalSlider.valueChanged.connect(self.setVolume)
@ -55,14 +55,14 @@ class MainWindow(QMainWindow):
return json.loads(resp.text) return json.loads(resp.text)
def printGroups(self) -> None: def printGroups(self) -> None:
"""Print groups (categories) in groupsListWidget.""" """Print groups (categories) in radioGroupsListWidget."""
self.ui.groupsListWidget.addItems( self.ui.radioGroupsListWidget.addItems(
[e["name"] for e in self.__stations_data["groups"]] [e["name"] for e in self.__stations_data["groups"]]
) )
def printStations(self) -> None: def printStations(self) -> None:
"""Print stations (channels) in stationsListWidget.""" """Print stations (channels) in stationsListWidget."""
group = self.ui.groupsListWidget.selectedItems()[0].text() group = self.ui.radioGroupsListWidget.selectedItems()[0].text()
group_id = None group_id = None
for e in self.__stations_data["groups"]: for e in self.__stations_data["groups"]:
if e["name"] == group: if e["name"] == group:

View File

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "openfm-qt" name = "openfm-qt"
version = "0.1.0" version = "0.2.0"
description = "Qt client for Polish internet radio Open FM." description = "Qt client for Polish internet radio Open FM."
authors = ["Wiktor Zykubek <wz-git@mailbox.org>"] authors = ["Wiktor Zykubek <wz-git@mailbox.org>"]
license = "ISC" license = "ISC"