Add second listWidget to display stations
This commit is contained in:
parent
aef131298b
commit
f57e1afe76
9
form.ui
9
form.ui
@ -43,7 +43,14 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QListWidget" name="listWidget"/>
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QListWidget" name="groupslistWidget"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QListWidget" name="stationslistWidget"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
@ -17,13 +17,13 @@ class MainWindow(QMainWindow):
|
|||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
self.ui = Ui_MainWindow()
|
self.ui = Ui_MainWindow()
|
||||||
self.ui.setupUi(self)
|
self.ui.setupUi(self)
|
||||||
self.getStations()
|
self.getGroups()
|
||||||
|
|
||||||
def getStations(self):
|
def getGroups(self):
|
||||||
resp = requests.get("https://open.fm/radio/api/v2/ofm/stations_slug.json")
|
resp = requests.get("https://open.fm/radio/api/v2/ofm/stations_slug.json")
|
||||||
json_ = json.loads(resp.text)
|
json_ = json.loads(resp.text)
|
||||||
for el in json_["groups"]:
|
for el in json_["groups"]:
|
||||||
self.ui.listWidget.addItem(el["name"])
|
self.ui.groupslistWidget.addItem(el["name"])
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user