patch: support for ppu04

ppu = PyPiUpdater 0.4.0
This commit is contained in:
Mr Finchum 2025-01-31 16:31:20 +00:00
parent 2476dd8b1f
commit 21f1d9fc01
5 changed files with 27 additions and 11 deletions

View file

@ -1,6 +1,11 @@
# Changelog
## 0.8.x
### 0.8.2: Patch for New PyPiUpdater Version
- Updated to support **PyPiUpdater 0.4.0**.
- Now stores version information locally, preventing an "unknown" state on the first updater launch.
- Users still need to press the **Update** button to verify the latest version, ensuring an internet connection is available.
### 0.8.1: Fix
- Fixed a misspelling of `PyPiUpdater` in the build file, which prevented v0.8.0 from being installed.

View file

@ -11,7 +11,7 @@ readme = "pip_README.md"
requires-python = ">=3.8"
dependencies = [
"optima35>=1.0.0, <2.0.0",
"PyPiUpdater>=0.3.0, <1.0.0",
"PyPiUpdater>=0.4.0, <1.0.0",
"pyside6",
"PyYAML",
]

View file

@ -470,7 +470,7 @@ class UpdaterWindow(QMainWindow, Ui_Updater_Window):
self.ui.setupUi(self)
from PyPiUpdater import PyPiUpdater
# Update log file location
self.update_log_file = os.path.expanduser("~/.config/OptimaLab35/update.log")
self.update_log_file = os.path.expanduser("~/.config/OptimaLab35/update_log.json")
# Store local versions
self.optimalab35_localversion = optimalab35_localversion
self.optima35_localversion = optima35_localversion
@ -478,8 +478,10 @@ class UpdaterWindow(QMainWindow, Ui_Updater_Window):
# Create PyPiUpdater instances
self.ppu_ol35 = PyPiUpdater("OptimaLab35", self.optimalab35_localversion, self.update_log_file)
self.ppu_o35 = PyPiUpdater("optima35", self.optima35_localversion, self.update_log_file)
self.ol35_last_state = self.ppu_ol35.get_last_state()
self.o35_last_state = self.ppu_o35.get_last_state()
self.last_update = self.ppu_o35.last_update_date_string()
#self.last_update = self.ppu_o35.last_update_date_string()
# Track which packages need an update
self.updates_available = {"OptimaLab35": False, "optima35": False}
@ -493,14 +495,20 @@ class UpdaterWindow(QMainWindow, Ui_Updater_Window):
return
else:
self.ui.label_dev.setVisible(False)
self.ui.label_optimalab35_localversion.setText(self.optimalab35_localversion)
self.ui.label_optima35_localversion.setText(self.optima35_localversion)
self.ui.label_latest_version.setText("Latest version")
self.ui.label_optimalab35_latestversion.setText(self.ol35_last_state[1])
self.ui.label_optima35_latestversion.setText(self.o35_last_state[1])
self.ui.update_and_restart_Button.setEnabled(False)
# Connect buttons to functions
self.ui.check_for_update_Button.clicked.connect(self.check_for_updates)
self.ui.update_and_restart_Button.clicked.connect(self.update_and_restart)
self.ui.label_last_check_2.setText(self.last_update)
self.ui.label_last_check_2.setText(str(self.ol35_last_state[0]))
def dev_mode(self):
self.ui.update_and_restart_Button.setEnabled(False)
@ -534,7 +542,10 @@ class UpdaterWindow(QMainWindow, Ui_Updater_Window):
self.ui.update_and_restart_Button.setEnabled(True)
self.ppu_o35.record_update_check()
self.ui.label_last_check_2.setText(self.ppu_o35.last_update_date_string())
self.ppu_ol35.record_update_check()
last_date = self.ppu_ol35.get_last_state()
self.ui.label_last_check_2.setText(last_date[0])
self.ui.label_latest_version.setText("Online version")
self.ui.check_for_update_Button.setEnabled(True)
def update_and_restart(self):

View file

@ -66,11 +66,11 @@ class Ui_Updater_Window(object):
self.gridLayout.addWidget(self.label_optima35_latestversion, 3, 2, 1, 1)
self.label_3 = QLabel(self.widget_2)
self.label_3.setObjectName(u"label_3")
self.label_3.setAlignment(Qt.AlignRight|Qt.AlignTrailing|Qt.AlignVCenter)
self.label_latest_version = QLabel(self.widget_2)
self.label_latest_version.setObjectName(u"label_latest_version")
self.label_latest_version.setAlignment(Qt.AlignRight|Qt.AlignTrailing|Qt.AlignVCenter)
self.gridLayout.addWidget(self.label_3, 0, 2, 1, 1)
self.gridLayout.addWidget(self.label_latest_version, 0, 2, 1, 1)
self.label = QLabel(self.widget_2)
self.label.setObjectName(u"label")
@ -135,7 +135,7 @@ class Ui_Updater_Window(object):
self.label_optimalab35_latestversion.setText(QCoreApplication.translate("Updater_Window", u"unknown", None))
self.label_2.setText(QCoreApplication.translate("Updater_Window", u"optima35", None))
self.label_optima35_latestversion.setText(QCoreApplication.translate("Updater_Window", u"unknown", None))
self.label_3.setText(QCoreApplication.translate("Updater_Window", u"Latest version", None))
self.label_latest_version.setText(QCoreApplication.translate("Updater_Window", u"Latest version", None))
self.label.setText(QCoreApplication.translate("Updater_Window", u"OptimaLab35", None))
self.label_9.setText(QCoreApplication.translate("Updater_Window", u"Package", None))
self.label_optimalab35_localversion.setText(QCoreApplication.translate("Updater_Window", u"0.0.0", None))

View file

@ -76,7 +76,7 @@
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_3">
<widget class="QLabel" name="label_latest_version">
<property name="text">
<string>Latest version</string>
</property>