From a34bd72d54ddf7717514dc691fc727f039aa24c7 Mon Sep 17 00:00:00 2001 From: Wiktor Mazur Date: Sat, 24 Jul 2021 13:43:57 +0200 Subject: [PATCH] Consistent version management --- setup.py | 4 ++-- src/gui/app.py | 21 ++------------------- src/gui/modules/about.py | 5 +++-- src/utils/version.py | 6 +++++- 4 files changed, 12 insertions(+), 24 deletions(-) diff --git a/setup.py b/setup.py index 686944f..8e73e27 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,5 @@ from setuptools import setup, find_packages - +from src.utils import version install_requires = [ "requests==2.26.0", @@ -11,7 +11,7 @@ install_requires = [ setup( name='aostats', - version='1.0.0', + version=version.get_version(), packages=find_packages('.', include=('src*')), package_data={'': ['**/*.png']}, include_package_data=True, diff --git a/src/gui/app.py b/src/gui/app.py index c766ace..752b86c 100644 --- a/src/gui/app.py +++ b/src/gui/app.py @@ -17,7 +17,6 @@ from ..utils.config import config from .modules.main import MainWidget from .styling import style from ..utils.version import current_version as get_current_version -from ..utils.version import latest_url from ..utils.version import latest_version as get_latest_version from ..utils.assets import path from ..utils.assets import scripts @@ -30,18 +29,6 @@ def fix_npcap(): sys.exit(0) -def get_modt(always_on_top): - motd_url = 'https://mazurwiktor.github.io/aostats/motd' - msg = QMessageBox() - msg.setWindowIcon(QtGui.QIcon(path('albion-stats-icon.png'))) - msg.setObjectName("Motd") - msg.setWindowTitle("Message of the day") - msg.setInformativeText(str(requests.get(motd_url).text)) - msg.setStandardButtons(QMessageBox.Ok) - - return msg - - def run(): initialization_result = initialize() @@ -66,16 +53,12 @@ def run(): widget.setWindowTitle('Albion Online Stats') widget.setWindowIcon(QtGui.QIcon(path('albion-stats-icon.png'))) - modt = get_modt(['always_on_top']) - if window_config['always_on_top']: widget.setWindowFlag(Qt.WindowStaysOnTopHint) - modt.setWindowFlag(Qt.WindowStaysOnTopHint) if window_config['frameless']: widget.setWindowFlag(Qt.FramelessWindowHint) widget.show() - modt.show() current_version, latest_version = ( get_current_version(), get_latest_version()) @@ -85,8 +68,8 @@ def run(): msg.setIcon(QMessageBox.Warning) msg.setWindowTitle("Update available!") msg.setText("Another version of app is avaliable.") - msg.setInformativeText("You are using app in version {}, new version {} available here".format( - current_version, latest_version, latest_url)) + msg.setInformativeText("You are using app in version {}, latest version is {}".format( + current_version, latest_version)) msg.setStandardButtons(QMessageBox.Ok) msg.show() diff --git a/src/gui/modules/about.py b/src/gui/modules/about.py index cd051b0..2b08e6e 100644 --- a/src/gui/modules/about.py +++ b/src/gui/modules/about.py @@ -1,5 +1,6 @@ -from PySide2.QtWidgets import QMessageBox # type: ignore +from PySide2.QtWidgets import QMessageBox # noqa type: ignore +from ...utils.version import get_version text = """ This software is free to use and delivered to you with a lot on fun :) @@ -18,7 +19,7 @@ class About(QMessageBox): def __init__(self): QMessageBox.__init__(self) self.setIcon(QMessageBox.Information) - self.setWindowTitle("Albion online stats") + self.setWindowTitle(f"Albion online stats {get_version()}") self.setText(text) self.setInformativeText(' Report Bug/Feature request | Contribute | Download | Donate '.format( "https://github.com/mazurwiktor/albion-online-stats/issues/new/choose", diff --git a/src/utils/version.py b/src/utils/version.py index a2c8c6f..0c22329 100644 --- a/src/utils/version.py +++ b/src/utils/version.py @@ -1,11 +1,15 @@ import os import requests -_version = "0.11.12" +_version = "1.0.0" latest_url = "https://github.com/mazurwiktor/albion-online-stats/releases/latest" +def get_version(): + return _version + + def latest_version(): req = requests.get(latest_url) if req.status_code == 200: