diff --git a/common/GPodderCore.qml b/common/GPodderCore.qml index 53f061b..7682b1f 100644 --- a/common/GPodderCore.qml +++ b/common/GPodderCore.qml @@ -25,6 +25,7 @@ import io.thp.pyotherside 1.0 Python { id: py + property string progname: 'gpodder' property bool ready: false signal downloading(int episode_id) signal downloadProgress(int episode_id, real progress) @@ -59,7 +60,9 @@ Python { // Load the Python side of things importModule('main', function() { - py.ready = true; + py.call('main.initialize', [py.progname], function() { + py.ready = true; + }); }); } diff --git a/desktop/gpodder.qml b/desktop/gpodder.qml index 11836ab..c6514bd 100644 --- a/desktop/gpodder.qml +++ b/desktop/gpodder.qml @@ -13,12 +13,6 @@ ApplicationWindow { GPodderCore { id: py - - onReadyChanged: { - if (ready) { - podcastListModel.reload(); - } - } } menuBar: MenuBar { diff --git a/main.py b/main.py index 5ad5ee4..361ebbf 100644 --- a/main.py +++ b/main.py @@ -51,9 +51,15 @@ def run_in_background_thread(f): class gPotherSide: def __init__(self): - self.core = core.Core() + self.core = None self._checking_for_new_episodes = False + def initialize(self, progname): + assert self.core is None, 'Already initialized' + + self.core = core.Core(progname=progname) + pyotherside.send('podcast-list-changed') + def atexit(self): self.core.shutdown() @@ -288,6 +294,7 @@ pyotherside.atexit(gpotherside.atexit) pyotherside.send('hello', gpodder.__version__, gpodder.__copyright__) # Exposed API Endpoints for calls from QML +initialize = gpotherside.initialize load_podcasts = gpotherside.load_podcasts load_episodes = gpotherside.load_episodes show_episode = gpotherside.show_episode diff --git a/touch/Main.qml b/touch/Main.qml index 1cb5093..9787ac5 100644 --- a/touch/Main.qml +++ b/touch/Main.qml @@ -27,6 +27,8 @@ Item { GPodderCore { id: py } GPodderPlayback { id: player } + GPodderPodcastListModel { id: podcastListModel } + property real scalef: width / 480 anchors.fill: parent diff --git a/touch/PodcastsPage.qml b/touch/PodcastsPage.qml index fa062fa..b339068 100644 --- a/touch/PodcastsPage.qml +++ b/touch/PodcastsPage.qml @@ -27,8 +27,6 @@ SlidePage { id: podcastsPage hasPull: true - Component.onCompleted: podcastListModel.reload(); - PullMenu { PullMenuItem { source: 'images/play.png' @@ -62,7 +60,7 @@ SlidePage { section.property: 'section' section.delegate: SectionHeader { text: section } - model: GPodderPodcastListModel { id: podcastListModel } + model: podcastListModel delegate: PodcastItem { onClicked: pgst.loadPage('EpisodesPage.qml', {'podcast_id': id, 'title': title});