From f0764c905977867c44e198d684b900daa0a78f13 Mon Sep 17 00:00:00 2001 From: Alexander Bus <busfromrus@gmail.com> Date: Thu, 11 Jan 2018 17:59:09 +0700 Subject: [PATCH] Better version handling --- cutelog/about_dialog.py | 1 + cutelog/config.py | 7 +++++-- cutelog/resources/ui/about_dialog.ui | 2 +- setup.py | 4 ++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/cutelog/about_dialog.py b/cutelog/about_dialog.py index e5d629a..5bba094 100644 --- a/cutelog/about_dialog.py +++ b/cutelog/about_dialog.py @@ -15,3 +15,4 @@ class AboutDialog(*AboutDialogBase): def setupUi(self): super().setupUi(self) + self.nameLabel.setText(CONFIG.full_name) diff --git a/cutelog/config.py b/cutelog/config.py index 7812d82..50adf4a 100644 --- a/cutelog/config.py +++ b/cutelog/config.py @@ -1,7 +1,7 @@ import os import sys import logging -from pkg_resources import resource_filename +from pkg_resources import resource_filename, get_distribution from collections import namedtuple from PyQt5 import QtCore from PyQt5.QtCore import QCoreApplication, QObject, pyqtSignal @@ -66,6 +66,8 @@ class Config(QObject): self.options = None self.option_spec = self.load_option_spec() self.options = self.load_options() + self.full_name = f"{QCoreApplication.applicationName()} "\ + f"{QCoreApplication.applicationVersion()}" # options that need fast access are also definded as attributes, which # are updated by calling update_attributes() @@ -231,7 +233,8 @@ def init_qt_info(): QCoreApplication.setOrganizationName('busimus') QCoreApplication.setOrganizationDomain('busz.me') QCoreApplication.setApplicationName('cutelog') - QCoreApplication.setApplicationVersion('1.0.2') + version = get_distribution(QCoreApplication.applicationName()).version + QCoreApplication.setApplicationVersion(version) def init_logging(): diff --git a/cutelog/resources/ui/about_dialog.ui b/cutelog/resources/ui/about_dialog.ui index 2947673..97dd992 100644 --- a/cutelog/resources/ui/about_dialog.ui +++ b/cutelog/resources/ui/about_dialog.ui @@ -31,7 +31,7 @@ </font> </property> <property name="text"> - <string>cutelog 1.0.2</string> + <string>cutelog</string> </property> </widget> </item> diff --git a/setup.py b/setup.py index ac4d69d..221ea03 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from os.path import dirname, join from setuptools import setup -VERSION = '1.0.2' +VERSION = '1.0.3' # def build_qt_resources(): @@ -42,7 +42,7 @@ setup( "Topic :: System :: Logging", "Topic :: System :: Monitoring", ], - download_url="https://github.com/busimus/cutelog/archive/cutelog-{}.zip".format(VERSION), + download_url="https://github.com/Busimus/cutelog/archive/{}.zip".format(VERSION), entry_points={'console_scripts': 'cutelog=cutelog.__main__:main'}, include_package_data=True, install_requires=['PyQt5;platform_system=="Darwin"', # it's better to use distro-supplied -- GitLab