-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add endpoint to show app version info via API and GUI.
Update the CI/CD pipeline to automatically place version information in the version.yml file prior to packaging the app. That way the app knows what version it is based on the tag.
- Loading branch information
Showing
7 changed files
with
98 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from PyQt5.QtWidgets import ( | ||
QWidget, | ||
QLabel, | ||
QVBoxLayout, | ||
) | ||
|
||
from application.common.decorators import timeit | ||
from operator_client import Operator | ||
|
||
|
||
class AboutWidget(QWidget): | ||
@timeit | ||
def __init__( | ||
self, | ||
client: Operator, | ||
parent: QWidget = None, | ||
): | ||
super(QWidget, self).__init__(parent) | ||
self._layout = QVBoxLayout() | ||
self._client = client | ||
self._initialized = False | ||
|
||
self.init_ui() | ||
|
||
def init_ui(self): | ||
v_layout = QVBoxLayout() | ||
|
||
version = self._client.app.get_app_version() | ||
q_label = QLabel(f"Software Version: {version}") | ||
v_layout.addWidget(q_label) | ||
|
||
self._layout.addLayout(v_layout) | ||
|
||
self.setFocus() | ||
self.setLayout(self._layout) | ||
self.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
version: 0.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ pyjwt | |
pyopenssl | ||
pyqt5 | ||
python-dotenv | ||
pyyaml | ||
requests | ||
validators==0.20.0 | ||
vdf==3.4 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import argparse | ||
import os | ||
import yaml | ||
|
||
|
||
def set_version(new_version: str): | ||
version_file = os.path.join("application", "static", "version.yml") | ||
|
||
with open(version_file, "r") as ver_file: | ||
version_data = yaml.safe_load(ver_file) | ||
ver_file.close() | ||
|
||
with open(version_file, "w") as ver_file: | ||
version_data["version"] = new_version | ||
yaml.dump(version_data, ver_file) | ||
ver_file.close() | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("-v", "--version", type=str, help="New Version String") | ||
args = parser.parse_args() | ||
|
||
if args.version is None: | ||
print("Error: Missing Argument! Try again.") | ||
else: | ||
print(f"Version String: {args.version}") | ||
set_version(args.version) |