Skip to content

Commit

Permalink
Merge pull request #34 from Wolfmyths/future-update
Browse files Browse the repository at this point in the history
V2.0 - Rewrite
  • Loading branch information
Wolfmyths authored Jan 10, 2024
2 parents 6459822 + d79991b commit 19f3057
Show file tree
Hide file tree
Showing 28 changed files with 2,145 additions and 1,835 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ jobs:
name: Genshin-Stopwatch-Assets-${{ matrix.os }}
path: |
${{env.working-directory}}Genshin*
${{env.working-directory}}config.ini
${{env.working-directory}}save.txt
${{env.working-directory}}icon.ico
release-asset:
runs-on: ubuntu-latest

Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Images for README.md
img/

# Save Data
config.ini
save.txt

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
13 changes: 13 additions & 0 deletions FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: Wolfmyths
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
50 changes: 22 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,28 @@
![CSharp](https://img.shields.io/badge/CSharp(soon!)-.NET_7-purple)
![HTML](https://img.shields.io/badge/HTML-4-orange)

![Desktop Framework](https://img.shields.io/badge/Desktop_Framework-PyQt5-green)
![Desktop Framework](https://img.shields.io/badge/Desktop_Framework-PySide6-green)
![Mobile Framework](https://img.shields.io/badge/Mobile_Framework(soon!)-.NET_Maui-purple)

![Windows](https://img.shields.io/badge/Windows-Supported-green)
![MacOS](https://img.shields.io/badge/MacOS-Pre--Release-blue)
![Linux](https://img.shields.io/badge/Linux-Pre--Release-blue)
![iOS](https://img.shields.io/badge/iOS-TBD-lightgray)
![Android](https://img.shields.io/badge/Android-TBD-lightgray)
![OS](https://img.shields.io/badge/OS-Win|Mac|Linux|Android(TBD)|iOS(TBD)-blue)

[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/C0C4MJZS9)

# FAQ Table of Contents
* [What does Genshin Stopwatch do?](#what-does-genshin-stopwatch-do)
* [How are my stopwatches saved?](#how-are-my-stopwatches-saved)
* [What platforms is this compatible with?](#what-platforms-is-this-compatible-with)
* [It doesn't work!](#it-doesnt-work)
* [Does this program run on system startup?](#does-this-program-run-on-system-startup)
+ [Windows](#on-windows)
+ [MacOS](#on-macos)
+ [Linux](#on-linux)
* [Future Plans?](#future-plans)
* [Contributing](#contributing)
* [Credits](#credits)
- [Genshin Stopwatch](#genshin-stopwatch)
- [A program to help keep track of Genshin Impact's time gates.](#a-program-to-help-keep-track-of-genshin-impacts-time-gates)
- [FAQ Table of Contents](#faq-table-of-contents)
- [What does Genshin Stopwatch do?](#what-does-genshin-stopwatch-do)
- [How are my stopwatches saved?](#how-are-my-stopwatches-saved)
- [What platforms is this compatible with?](#what-platforms-is-this-compatible-with)
- [It doesn't work!](#it-doesnt-work)
- [Does this program run on system startup?](#does-this-program-run-on-system-startup)
- [On Windows:](#on-windows)
- [On MacOS:](#on-macos)
- [On Linux:](#on-linux)
- [Future Plans?](#future-plans)
- [Contributing](#contributing)
- [Credits](#credits)

## What does Genshin Stopwatch do?

Expand All @@ -52,9 +51,9 @@ notes = Hilichurl Camps

## What platforms is this compatible with?

At the moment only Windows machines can run this program.
Win 10 and up, MacOS, and Linux versions are available.

**There are plans to support Linux and MacOS, please see the latest [pre release](https://github.com/Wolfmyths/Genshin-Stopwatch/releases/tag/V1.5.5-pre) for QA testing and [issue #26](https://github.com/Wolfmyths/Genshin-Stopwatch/issues/26)**
MacOS/Linux versions are not tested so if there's any issues please submit an issue

**Android and iOS is also underway! Release TBD**

Expand Down Expand Up @@ -98,10 +97,6 @@ Every distro is different so you have to do this research on your own, sorry.

## Future Plans?

+ Restore Apprise Module support if they add more compatibility for Windows
- *This means the notification center will be used again*
+ Touch up on the UI a tiny bit for more clarity
+ MacOS/Linux Support *In Pre-Release Stage!*
+ Background pictures to choose from for the timers?
+ Translations? *(Not sure if this is necessary but if people want it I will make an effort)*
+ Mobile version? *In development! Release is still TBD*
Expand All @@ -119,14 +114,10 @@ For more information and background knowledge of the program, see [CONTRIBUTING.

+ [Contributors!](https://github.com/Wolfmyths/Genshin-Stopwatch/graphs/contributors) Without you guys I wouldn't have gotten as far into this project as I would have on my own. <br> You guys have taught me a lot. ❤️

+ [PyQt5](https://pypi.org/project/PyQt5/) for creating an open source easy-to-use framework.
+ [PySide6](https://www.qt.io/qt-for-python) for creating an open source easy-to-use framework.

+ [Pyinstaller](https://pypi.org/project/pyinstaller/) for creating a way to change python programs into an exe.

+ [Playsound](https://pypi.org/project/playsound/1.2.2/) for creating a cross platform module to easily play sound files.

+ [Itemize](https://freesound.org/people/Scrampunk/sounds/345297/) for creating this sound that is used for notifications

+ Color Pallets
- [Timeless](https://lospec.com/palette-list/timeless) AKA Dark by Archer on lospec.com
- [Light](https://www.color-hex.com/color-palette/106748) by wcburgess on color-hex.com
Expand All @@ -139,5 +130,8 @@ For more information and background knowledge of the program, see [CONTRIBUTING.
- [Koukasita](https://lospec.com/palette-list/koukasita) AKA Geo by namida on lospec.com

+ *(Previously used)*
- [PyQt5](https://pypi.org/project/PyQt5/) for creating an open source easy-to-use framework.
- [Playsound](https://pypi.org/project/playsound/1.2.2/) for creating a cross platform module to easily play sound files.
- [Itemize](https://freesound.org/people/Scrampunk/sounds/345297/) for creating this sound that is used for notifications
- [Apprise](https://pypi.org/project/apprise/) for creating an all-in-one notification module.
- [Win10Toast](https://pypi.org/project/win10toast/) for creating an easy way to implement windows notifications.
14 changes: 14 additions & 0 deletions createPyExe.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@echo on

echo Setting Variables
set disFolder="Genshin Stopwatch"
set Txt="requirements.txt"
set Spec="./src/python/main.spec"

echo Installing Dependencies
pip install -r %Txt%

echo Running Pyinstaller
pyinstaller --clean %Spec% --distpath ./%disFolder%

echo Installation Finished!
Binary file modified img/stopwatch_demo.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pyinstaller==5.13.0
PyQt5==5.15.9
PyQt5_sip==12.12.1
playsound==1.2.2
requests==2.31.0
PySide6==6.6.0
semantic-version==2.10.0

# External use
pyinstaller==6.2.0
65 changes: 65 additions & 0 deletions src/python/checkVersion.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import json

from PySide6.QtCore import QObject, QUrl, Signal
from PySide6.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkReply

from semantic_version import Version

from constants import VERSION

class checkUpdate(QObject):
'''
Instancing this object will run a series of
functions to get the latest Myth Mod Manager version.
`checkUpdate` will delete itself after it's finished.
'''

updateDetected = Signal(Version, str)
upToDate = Signal()
error = Signal()

def __init__(self) -> None:
super().__init__()

link = 'https://api.github.com/repos/Wolfmyths/Genshin-Stopwatch/releases/latest'

network = QNetworkAccessManager(self)
request = QNetworkRequest(QUrl(link))

self.reply = network.get(request)
self.reply.finished.connect(self.__reply_handler)

def __reply_handler(self) -> None:
reply: QNetworkReply = self.sender()

if reply.error() == QNetworkReply.NetworkError.NoError:
self.__checkVersion()
else:
self.error.emit()
self.deleteLater()

def __checkVersion(self) -> None:
reply: QNetworkReply = self.sender()

try:
data: dict = json.loads(reply.readAll().data().decode())
except Exception as e:
self.error.emit()
return

# Removing letters from version string
version: str = data['tag_name']

for s in version:
if not s.isdigit() and s != '.':
version = version.replace(s, '')

latestVersion = Version.coerce(version)

if latestVersion > VERSION:
self.updateDetected.emit(latestVersion, data['body'])
else:
self.upToDate.emit()

self.deleteLater()
36 changes: 36 additions & 0 deletions src/python/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import os
import sys
from datetime import timedelta
from enum import StrEnum

from semantic_version import Version

class TimeFormats(StrEnum):
Static_Timer = '%Y-%m-%d %I:%M:%S'
Finished_Date = '%B %d @ %I:%M %p'
Saved_Date = '%Y-%m-%d %H:%M:%S'


# Used for debugging, flag to see if program is ran through the main.py script or an exe
# This is used for when dealing with files that are packaged within the exe such as guide.html
IS_SCRIPT: bool = not getattr(sys, 'frozen', False)

# Loading paths, using `os.curdir` instead of `os.dirname(__file__)` because the file dir is in a temp dir
ROOT = os.path.abspath(os.path.dirname(__file__)) if not IS_SCRIPT else os.path.join(os.path.abspath(os.getcwd()), 'src', 'python')
CONFIG = os.path.abspath('config.ini')
SAVEFILE = os.path.abspath('save.txt')
ICON = os.path.join(ROOT, 'icon.ico')
GUIDE = os.path.join(ROOT, 'guide.html')

# Date Values
ZERO = timedelta(days=0, hours=0, seconds=0)
ONE = timedelta(seconds=1)

# Program Info
VERSION = Version(major=2, minor=0, patch=0)
PROGRAM_NAME = 'Genshin Stopwatch'

# Object Names
MAIN_WINDOW = 'mw'
SYS_TRAY = 'System Tray'
TOOLBAR = 'tb'
37 changes: 37 additions & 0 deletions src/python/dataParser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from configparser import ConfigParser
from typing import Self
from enum import StrEnum, auto
import os

from constants import SAVEFILE

class StopwatchDataKeys(StrEnum):
time_object = 'name'
time_finished = 'time finished'
time_original_duration = 'time original duration'
border_color = 'border color'
notes = auto()

class dataParser(ConfigParser):
def __init__(self):
super().__init__()

# Create save file if it doesn't exist
if not os.path.exists(SAVEFILE):
with open(SAVEFILE, 'w+') as f:
pass


self.read(SAVEFILE)

def __new__(cls) -> Self:

if not hasattr(cls, 'instance'):

cls.instance = super(dataParser, cls).__new__(cls)

return cls.instance

def save(self):
with open(SAVEFILE, 'w') as f:
self.write(f)
4 changes: 2 additions & 2 deletions src/python/guide.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- CONTRIBUTORS: PyQt5 uses a limited version of HTML 4 to parse HTML, for more see here: https://doc.qt.io/qt-5/richtext-html-subset.html -->
<!-- CONTRIBUTORS: PySide6 uses a limited version of HTML 4 to parse HTML, for more see here: https://doc.qt.io/qt-6/richtext-html-subset.html -->

<!DOCTYPE html>
<html lang="en-US">
Expand Down Expand Up @@ -172,7 +172,7 @@ <h2 id="realmxp">
Trust rank is how much can XP can be stored before collecting.
</li>
<li>
Adeptal energy is how fast you can earn the XP. (Adeptal energy a score of your teapot and how much is placed within it. It also determines your status.)
Adeptal energy is a score of your teapot and how much is placed within it. It also determines your status and how fast you can earn XP.
</li>
</ul>

Expand Down
Loading

0 comments on commit 19f3057

Please sign in to comment.