Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use Sparkle in pyqt5 #2204

Closed
duolabmeng6 opened this issue Jul 15, 2022 · 1 comment
Closed

How to use Sparkle in pyqt5 #2204

duolabmeng6 opened this issue Jul 15, 2022 · 1 comment

Comments

@duolabmeng6
Copy link

duolabmeng6 commented Jul 15, 2022

I'm sorry to ask this question because I didn't find a solution when I read the document.

I use it. python PySide6 use pyinstaller Construction App

Can I use sparkle to update my app automatically?

@duolabmeng6
Copy link
Author

duolabmeng6 commented Jul 15, 2022

I saw this tutorial, but it didn't work.
https://fman.io/blog/codesigning-and-automatic-updates-for-pyqt-apps/

#839

import sys

from PySide6.QtCore import QRect
from PySide6.QtWidgets import *


class MainWin(QMainWindow):
    def __init__(self):
        super().__init__()
        self.setGeometry(QRect(100, 100, 400, 300))
        self.setWindowTitle('Sparkle Test')
        # 创建按钮
        self.btn = QPushButton(self)
        self.btn.setText('Check for Updates')
        self.btn.setGeometry(QRect(20, 20, 200, 40))
        self.btn.show()
        # self.aboutToQuit.connect(about_to_quit)

        self.show()


QT_APP = QApplication([])

APPCAST_URL = 'http://127.0.0.1:8000/SampleAppcast.xml'
SPARKLE_PATH = '/Users/chensuilong/Downloads/Sparkle-2.2.0/Sparkle.framework'

from objc import pathForFramework, loadBundle

sparkle_path = pathForFramework(SPARKLE_PATH)
objc_namespace = dict()
loadBundle('Sparkle', objc_namespace, bundle_path=sparkle_path)


def about_to_quit():
    print('about to quit')
    # 见 https://github.com/sparkle-project/Sparkle/issues/839
    objc_namespace['NSApplication'].sharedApplication().terminate_(None)


QT_APP.aboutToQuit.connect(about_to_quit)
sparkle = objc_namespace['SUUpdater'].sharedUpdater()
sparkle.setAutomaticallyChecksForUpdates_(True)
sparkle.setAutomaticallyDownloadsUpdates_(True)
NSURL = objc_namespace['NSURL']
sparkle.setFeedURL_(NSURL.URLWithString_(APPCAST_URL))
sparkle.checkForUpdatesInBackground()

window = MainWin()
window.btn.clicked.connect(about_to_quit)

sys.exit(QT_APP.exec())

I downloaded version 2.2.0 from the official website.
Write the above script according to your tutorial
But it didn't work.

I hope there are bosses who have used pyqt to help.

@zorgiepoo zorgiepoo changed the title Please tell me how to use it in pyqt5 How to use Sparkle in pyqt5 Jul 16, 2022
@sparkle-project sparkle-project locked and limited conversation to collaborators Jul 16, 2022
@zorgiepoo zorgiepoo converted this issue into discussion #2205 Jul 16, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant