Update
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
# -*- coding: UTF-8 -*-
|
||||
import webbrowser
|
||||
|
||||
from ngSkinTools2.api import versioncheck
|
||||
@@ -27,10 +28,10 @@ def show(parent, silent_mode):
|
||||
result.setLayout(layout)
|
||||
layout.setContentsMargins(20, 30, 20, 20)
|
||||
|
||||
header = QtWidgets.QLabel("<strong>Checking for update...</strong>")
|
||||
result1 = QtWidgets.QLabel("Current version: <strong>2.0.0</strong>")
|
||||
result2 = QtWidgets.QLabel("Update available: 2.0.1")
|
||||
download = QtWidgets.QPushButton("Download ngSkinTools v2.0.1")
|
||||
header = QtWidgets.QLabel(u"<strong>检查更新中...</strong>")
|
||||
result1 = QtWidgets.QLabel(u"当前版本: <strong>2.1.4</strong>")
|
||||
result2 = QtWidgets.QLabel("最新版本: 2.1.4")
|
||||
download = QtWidgets.QPushButton("下载 中文ngSkinTools v2.0.1")
|
||||
# layout.addWidget(QtWidgets.QLabel("Checking for updates..."))
|
||||
layout.addWidget(header)
|
||||
layout.addWidget(result1)
|
||||
@@ -52,16 +53,16 @@ def show(parent, silent_mode):
|
||||
:type info: ngSkinTools2.api.versioncheck.
|
||||
"""
|
||||
|
||||
header.setText("<strong>{0}</strong>".format('Update available!' if info.update_available else 'ngSkinTools is up to date.'))
|
||||
header.setText("<strong>{0}</strong>".format('更新可用!' if info.update_available else '中文ngSkinTools 已经是最新版.'))
|
||||
result1.setVisible(True)
|
||||
result1.setText("Current version: <strong>{0}</strong>".format(version.pluginVersion()))
|
||||
result1.setText(u"当前版本: <strong>{0}</strong>".format(version.pluginVersion()))
|
||||
if info.update_available:
|
||||
result2.setVisible(True)
|
||||
result2.setText(
|
||||
"Update available: <strong>{0}</strong>, released on {1}".format(info.latest_version, info.update_date.strftime("%d %B, %Y"))
|
||||
u"最新版本: <strong>{0}</strong>, 发布于 {1}".format(info.latest_version, info.update_date.strftime("%d %B, %Y"))
|
||||
)
|
||||
download.setVisible(True)
|
||||
download.setText("Download ngSkinTools v" + info.latest_version)
|
||||
download.setText(u"下载 中文ngSkinTools v" + info.latest_version)
|
||||
|
||||
@qt.on(download.clicked)
|
||||
def open_link():
|
||||
@@ -71,10 +72,10 @@ def show(parent, silent_mode):
|
||||
|
||||
# noinspection PyShadowingNames
|
||||
def buttonsRow(window):
|
||||
btn_close = QtWidgets.QPushButton("Close")
|
||||
btn_close = QtWidgets.QPushButton("取消")
|
||||
btn_close.setMinimumWidth(100 * scale_multiplier)
|
||||
|
||||
check_do_on_startup = bind_checkbox(QtWidgets.QCheckBox("Check for updates at startup"), config.checkForUpdatesAtStartup)
|
||||
check_do_on_startup = bind_checkbox(QtWidgets.QCheckBox("启动时检查更新"), config.checkForUpdatesAtStartup)
|
||||
|
||||
layout = QtWidgets.QHBoxLayout()
|
||||
layout.addWidget(check_do_on_startup)
|
||||
@@ -88,7 +89,7 @@ def show(parent, silent_mode):
|
||||
window = QtWidgets.QWidget(parent, Qt.Window | Qt.WindowTitleHint | Qt.CustomizeWindowHint)
|
||||
window.resize(400 * scale_multiplier, 200 * scale_multiplier)
|
||||
window.setAttribute(Qt.WA_DeleteOnClose)
|
||||
window.setWindowTitle("ngSkinTools2 version update")
|
||||
window.setWindowTitle("ngSkinTools2 (中文) 版本更新")
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
window.setLayout(layout)
|
||||
layout.setContentsMargins(0, 0, 0, 0)
|
||||
@@ -106,14 +107,14 @@ def show(parent, silent_mode):
|
||||
if info.update_available:
|
||||
window.show()
|
||||
else:
|
||||
log.info("not showing the window")
|
||||
log.info("未显示窗口")
|
||||
window.close()
|
||||
|
||||
cleanup.registerCleanupHandler(window.close)
|
||||
|
||||
@qt.on(window.destroyed)
|
||||
def closed():
|
||||
log.info("deleting update window")
|
||||
log.info("删除更新窗口")
|
||||
|
||||
versioncheck.download_update_info(success_callback=success_signal.emit, failure_callback=error_signal.emit)
|
||||
|
||||
@@ -129,4 +130,4 @@ def show_and_start_update(parent):
|
||||
def build_action_check_for_updates(parent):
|
||||
from ngSkinTools2.ui import actions
|
||||
|
||||
return actions.define_action(parent, "Check for Updates...", callback=lambda: show_and_start_update(parent))
|
||||
return actions.define_action(parent, "检查更新...", callback=lambda: show_and_start_update(parent))
|
||||
|
||||
Reference in New Issue
Block a user