From 468afc0a6de2c4097215f19388fc083ba18dbb2c Mon Sep 17 00:00:00 2001 From: eliasdoehne Date: Sat, 13 Oct 2018 14:21:25 +0200 Subject: [PATCH] Use pkg_resources.parse_version to compare versions, changed version IDs to v0.2.0 --- README.md | 7 ++++--- mod/Dashboard/interface/browser.gui | 4 ++-- setup.py | 2 -- src/stellarisdashboard/dash_server.py | 9 +++++++-- src/stellarisdashboard/templates/layout.html | 5 +++-- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 9ec3ad2..0342ae8 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,14 @@ The stellaris dashboard is a program that reads your Stellaris save files while you play the game and shows you more detailed information and stats about your playthrough. +**Important**: This program only works for **singleplayer** games. + # Features There are two main components: A **timeline dashboard** which shows you graphs of many statistics about the empires in your game, and an **event ledger** listing the events that define the history of your game. By using [the game mod](https://steamcommunity.com/sharedfiles/filedetails/?id=1466534202) available on the steam workshop, the dashboard is available directly in-game through the integrated browser (by clicking the help icon). -**Important**: This program only works for **singleplayer** games. Also, other mods may or may not work, the program is developed with the vanilla game in mind. Which version of Stellaris is supported by a particular release should be annotated in the release notes, so if you use an older version of Stellaris, you could download one of the older releases, or try your luck with the most recent one. - ## Timeline Dashboard Here is an animation of the timeline dashboard in action: @@ -116,7 +116,8 @@ The dashboard is quite complex and to my knowledge, making a mod with these feat 1. Budget numbers (especially if sectors are involved) may not always match up exactly (but should be close) 2. Loading save files out of order (with respect to in-game time) is not supported, and this will screw up the data. 3. Renaming things (leaders, planets, systems etc) after they have been added to the database might cause issues. - + 4. The dashboard may not work with other mods, it is developed with the vanilla game in mind. + If an error occurs, please try restarting the dashboard program. If you run into problems that don't go away after restarting, please start a new discussion topic [on the Steam workshop](https://steamcommunity.com/sharedfiles/filedetails/discussions/1466534202). diff --git a/mod/Dashboard/interface/browser.gui b/mod/Dashboard/interface/browser.gui index 194e0ea..5994609 100644 --- a/mod/Dashboard/interface/browser.gui +++ b/mod/Dashboard/interface/browser.gui @@ -88,7 +88,7 @@ guiTypes = { quadTextureSprite = "GFX_button_timeline_index" position = { x = -280 y = 26 } Orientation = UPPER_RIGHT - web_link="http://127.0.0.1:28053/" + web_link="http://127.0.0.1:28053/checkversion/v0.2.0" shortcut = "J" } buttonType = @@ -106,7 +106,7 @@ guiTypes = { quadTextureSprite = "GFX_button_event_history" position = { x = -150 y = 21 } Orientation = UPPER_RIGHT - web_link="http://127.0.0.1:28053/checkversion/v0.1.5/history" + web_link="http://127.0.0.1:28053/checkversion/v0.2.0/history" shortcut = "L" } diff --git a/setup.py b/setup.py index 352d93d..710b568 100644 --- a/setup.py +++ b/setup.py @@ -37,8 +37,6 @@ print("Using pre-built C-extension if available, or (slow) fallback solution.") extension_modules = [] -# TODO: Fix the Cython extensions! - setup( name="stellarisdashboard", ext_modules=extension_modules, diff --git a/src/stellarisdashboard/dash_server.py b/src/stellarisdashboard/dash_server.py index 3b178e6..1230cd4 100644 --- a/src/stellarisdashboard/dash_server.py +++ b/src/stellarisdashboard/dash_server.py @@ -11,6 +11,7 @@ import plotly.graph_objs as go from dash.dependencies import Input, Output from flask import render_template, request, redirect +from pkg_resources import parse_version from stellarisdashboard import config, models, visualization_data, game_info @@ -22,11 +23,15 @@ timeline_app.css.config.serve_locally = True timeline_app.scripts.config.serve_locally = True -VERSION_ID = "v0.1.5" +VERSION_ID = "v0.2.0" def is_old_version(requested_version: str) -> bool: - return requested_version != VERSION_ID + try: + req_version = parse_version(requested_version) + return parse_version(VERSION_ID) < req_version + except Exception: + return False @flask_app.route("/") diff --git a/src/stellarisdashboard/templates/layout.html b/src/stellarisdashboard/templates/layout.html index e971897..6a855ac 100644 --- a/src/stellarisdashboard/templates/layout.html +++ b/src/stellarisdashboard/templates/layout.html @@ -9,8 +9,9 @@ {%if show_old_version_notice%}

You may be using an old version of the stellaris dashboard program. You are using version {{ version }}, and the requested version was {{ update_version_id }}. - You can get the most current version on Github. - + You can get the current version on Github. +

+

This update notice can be disabled in the Dashboard Settings.

{%endif%}