Skip to content

Commit 97fc1a9

Browse files
committed
Manual update feature for macOS and Linux
1 parent bf5d0bd commit 97fc1a9

File tree

6 files changed

+35
-15
lines changed

6 files changed

+35
-15
lines changed

pyqt_openai/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ def move_updater():
172172
ICON_FAVORITE_YES = os.path.join(ICON_PATH, "favorite_yes.svg")
173173
ICON_FOCUS_MODE = os.path.join(ICON_PATH, "focus_mode.svg")
174174
ICON_FULLSCREEN = os.path.join(ICON_PATH, "fullscreen.svg")
175+
ICON_UPDATE = os.path.join(ICON_PATH, "update.svg")
175176
ICON_GITHUB = os.path.join(ICON_PATH, "github.svg")
176177
ICON_HELP = os.path.join(ICON_PATH, "help.svg")
177178
ICON_HISTORY = os.path.join(ICON_PATH, "history.svg")

pyqt_openai/g4f_image_widget/g4fImageHome.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ def __init__(self, parent=None):
1212

1313
def __initUi(self):
1414
# TODO LANGUAGE
15-
title = QLabel("Welcome to GPT4Free Image Generation Page !", self)
15+
title = QLabel("Welcome to GPT4Free\n" +
16+
"Image Generation Page !", self)
1617
title.setFont(QFont(*LARGE_LABEL_PARAM))
1718
title.setAlignment(Qt.AlignmentFlag.AlignCenter)
1819

pyqt_openai/ico/update.svg

Lines changed: 1 addition & 0 deletions
Loading

pyqt_openai/mainWindow.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
ICON_PAYPAL,
4646
ICON_KOFI,
4747
ICON_PATREON,
48-
PATREON_URL,
48+
PATREON_URL, ICON_UPDATE,
4949
)
5050
from pyqt_openai.aboutDialog import AboutDialog
5151
from pyqt_openai.chat_widget.chatMainWidget import ChatMainWidget
@@ -168,6 +168,7 @@ def __setActions(self):
168168
self.__checkUpdateAction = QAction(
169169
LangClass.TRANSLATIONS["Check for Updates..."], self
170170
)
171+
self.__checkUpdateAction.setIcon(QIcon(ICON_UPDATE))
171172
self.__checkUpdateAction.triggered.connect(self.__checkUpdate)
172173

173174
self.__viewShortcutsAction = QAction(
@@ -325,6 +326,7 @@ def __setToolBar(self):
325326
self.__toolbar = QToolBar()
326327
self.__toolbar.addAction(self.__chooseAiAction)
327328
self.__toolbar.addAction(self.__settingsAction)
329+
self.__toolbar.addAction(self.__checkUpdateAction)
328330
self.__toolbar.addAction(self.__customizeAction)
329331
self.__toolbar.addAction(self.__githubAction)
330332
self.__toolbar.addAction(self.__discordAction)

pyqt_openai/updateSoftwareDialog.py

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
UPDATER_PATH,
2222
is_frozen,
2323
)
24+
from pyqt_openai.lang.translations import LangClass
2425

2526

2627
class UpdateSoftwareDialog(QDialog):
@@ -39,6 +40,7 @@ def __initUi(self):
3940
self.setWindowTitle("Update Software")
4041
self.setWindowFlags(Qt.WindowType.Window | Qt.WindowType.WindowCloseButtonHint)
4142
self.setModal(True)
43+
4244
lay = QVBoxLayout()
4345

4446
self.setLayout(lay)
@@ -49,17 +51,31 @@ def __initUi(self):
4951
self.releaseNoteBrowser = QTextBrowser()
5052
self.releaseNoteBrowser.setOpenExternalLinks(True)
5153

52-
update_url = f"https://github.com/{self.__owner}/{self.__repo}/releases/download/{self.__recent_version}/VividNode.zip"
54+
lay.addWidget(self.releaseNoteBrowser)
5355

54-
buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
55-
buttonBox.accepted.connect(lambda: run_updater(update_url))
56-
buttonBox.rejected.connect(self.reject)
56+
if sys.platform == "win32":
57+
update_url = f"https://github.com/{self.__owner}/{self.__repo}/releases/download/{self.__recent_version}/VividNode.zip"
5758

58-
askLbl = QLabel("Do you want to update?")
59+
buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
60+
buttonBox.accepted.connect(lambda: run_updater(update_url))
61+
buttonBox.rejected.connect(self.reject)
5962

60-
lay.addWidget(self.releaseNoteBrowser)
61-
lay.addWidget(askLbl)
62-
lay.addWidget(buttonBox)
63+
askLbl = QLabel("Do you want to update?")
64+
65+
lay.addWidget(askLbl)
66+
lay.addWidget(buttonBox)
67+
else:
68+
self.__updateManualLbl = QLabel()
69+
self.__updateManualLbl.setText(
70+
f'<b>{LangClass.TRANSLATIONS["Update Available"]}</b>'
71+
+
72+
f'''<br>
73+
Automatic updates are currently supported only on Windows.
74+
For manual updates, please click the link for the latest version and install the file appropriate for your operating system.
75+
Linux - Install via tar
76+
macOS - Install via dmg
77+
''')
78+
lay.addWidget(self.__updateManualLbl)
6379

6480

6581
def check_for_updates(current_version, owner, repo):
@@ -108,7 +124,6 @@ def check_for_updates_and_show_dialog(current_version, owner, repo):
108124
update_dialog.releaseNoteBrowser.setHtml(release_notes)
109125
update_dialog.exec()
110126

111-
112127
def update_software():
113128
# Replace with actual values
114129
current_version = __version__

version_info.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
#
66
VSVersionInfo(
77
ffi=FixedFileInfo(
8-
filevers=(1, 4, 1),
9-
prodvers=(1, 4, 1),
8+
filevers=(1, 5, 0),
9+
prodvers=(1, 5, 0),
1010
mask=0x3f,
1111
flags=0x0,
1212
OS=0x4,
@@ -19,10 +19,10 @@ VSVersionInfo(
1919
[
2020
StringTable(
2121
u'040904B0',
22-
[StringStruct(u'FileVersion', u'1.4.1'),
22+
[StringStruct(u'FileVersion', u'1.5.0'),
2323
StringStruct(u'ProductName', u'VividNode'),
2424
StringStruct(u'LegalCopyright', u'Copyright © 2024 Jung Gyu Yoon'),
25-
StringStruct(u'ProductVersion', u'1.4.1')])
25+
StringStruct(u'ProductVersion', u'1.5.0')])
2626
]),
2727
VarFileInfo([VarStruct(u'Translation', [1033, 1200])])
2828
]

0 commit comments

Comments
 (0)