Skip to content

Commit

Permalink
Misc. Fixes (#49)
Browse files Browse the repository at this point in the history
* Added Combat Time to Copy Summary.

* Updated league connector for new backend.

* Update League Connector to use oscr.stobuilds.com (HTTP)

* Updated oscr.stobilds.com to use HTTPS

* Updated README

* Reworded

* Removed word

* Updated README again

* Updated to also reference CLA.

* Moved section down

* Updated Error message on log failure.

* Updated messages again.

* Updated pyproject.toml

* Updated error log reporting in league connector.

* And removed debug print

* Updated version

* Updated OSCR client, Enabled New Upload Result Dialog

* Updated Version

* Testing something.

* Testing something.

* Try something else

* Having fun yet?

* Bootstrap venv

* PS1

* bat

* idk I'm tired

* Woops

* Add executable

* Trying to use cx_Freeze

* Trying to get cx_Freeze working.

* Test Build

* czfreeze

* Test?

* More

* More testing

* idk

* ZIP Exclude Packages

* bdis_msi

* Try and include assets

* idk kinda stuck

* Check if frozen

* Compilation error

* Icon and Shortcut?

* Was using the wrong syntax

* Another typo

* Try and add more to the msi

* Typo

* Try this instead

* toml is very strange

* Doesn't like that ICON

* ico is not optional

* Good enough for now

* Only create MSI on release

* Bumped up version

* Remove OSCR_settings

* Updated build workflow

* Update to include README and LICENSE

* Feature: Separate Seasonal Records from Overall Records.

* restored templog_folder_path

* Checkpoint

* Adjusted minimum UI size.

* Updated pyproject.toml

* 1/2 Fixed Trimming

* 2/3 I messed up.

* 3/3 ok

* One more

* Use uploadv2 API.

* Update Requirementss

* Revert Chabge to datafunctions.py

* Renamed Build => Highest Damage Ability

* Working on Getting Flatpak Support

* More updates for Flatpak

* Updated Flatpak Hash

* Wrong  Version was Specified in pyproject.

* Removed flatpak file

* Cleanup

* Update Live Parser to be capturable with OBS on Windows.

* Update pyproject.toml

* Update Version
  • Loading branch information
Kraust authored Sep 6, 2024
1 parent bdde9e4 commit aea5f6e
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 27 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
__pycache__
build
dist
.venv
18 changes: 10 additions & 8 deletions OSCRUI/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from .translation import init_translation

from .leagueconnector import OSCRClient
from .iofunctions import get_asset_path, load_icon_series, load_icon, open_link, reset_temp_folder
from .iofunctions import get_asset_path, load_icon_series, load_icon, open_link
from .textedit import format_path
from .widgets import AnalysisPlot, BannerLabel, FlipButton, WidgetStorage
from .widgetbuilder import ABOTTOM, ACENTER, AHCENTER, ALEFT, ARIGHT, ATOP, AVCENTER
Expand Down Expand Up @@ -87,7 +87,6 @@ def __init__(self, theme, args, path, config, versions) -> None:
self.update_translation()
self.league_api = None

reset_temp_folder(self.config['templog_folder_path'])
self.app, self.window = self.create_main_window()
self.copy_shortcut = QShortcut(
QKeySequence.StandardKey.Copy, self.window, self.copy_analysis_table_callback)
Expand Down Expand Up @@ -159,8 +158,14 @@ def init_settings(self):
"""
Prepares settings. Loads stored settings. Saves current settings for next startup.
"""
settings_path = os.path.abspath(self.app_dir + self.config["settings_path"])
self.settings = QSettings(settings_path, QSettings.Format.IniFormat)

# For Windows, Keep the Local settings for now as people are more familiar with that.
if os.name == "nt":
settings_path = os.path.abspath(self.app_dir + self.config["settings_path"])
self.settings = QSettings(settings_path, QSettings.Format.IniFormat)
else:
self.settings = QSettings("OSCR", "OSCR-UI")

for setting, value in self.config['default_settings'].items():
if self.settings.value(setting, None) is None:
self.settings.setValue(setting, value)
Expand All @@ -173,8 +178,6 @@ def init_config(self):
"""
self.current_combat_id = -1
self.current_combat_path = ''
self.config['templog_folder_path'] = os.path.abspath(
self.app_dir + self.config['templog_folder_path'])
self.config['ui_scale'] = self.settings.value('ui_scale', type=float)
self.config['live_scale'] = self.settings.value('live_scale', type=float)
self.config['icon_size'] = round(
Expand All @@ -193,7 +196,6 @@ def parser_settings(self) -> dict:
setting = self.settings.value(setting_key, type=settings_type, defaultValue='')
if setting:
settings[setting_key] = setting
settings['templog_folder_path'] = self.config['templog_folder_path']
return settings

@property
Expand Down Expand Up @@ -1269,4 +1271,4 @@ def setup_settings_frame(self):
scroll_layout.addLayout(sec_2)

scroll_frame.setLayout(scroll_layout)
scroll_area.setWidget(scroll_frame)
scroll_area.setWidget(scroll_frame)
4 changes: 3 additions & 1 deletion OSCRUI/callbacks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os

from PySide6.QtWidgets import QFileDialog, QLineEdit
from PySide6.QtCore import QTemporaryDir

from OSCR import (
LIVE_TABLE_HEADER, OSCR, repair_logfile as oscr_repair_logfile, split_log_by_combat,
Expand Down Expand Up @@ -315,4 +316,5 @@ def repair_logfile(self):
"""
"""
log_path = os.path.abspath(self.entry.text())
oscr_repair_logfile(log_path, self.config['templog_folder_path'])
dir = QTemporaryDir()
oscr_repair_logfile(log_path, dir.path())
12 changes: 0 additions & 12 deletions OSCRUI/iofunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,18 +124,6 @@ def store_json(data: dict | list, path: str):
sys.stdout.write(f'[Error] Data could not be saved: {e}')


def reset_temp_folder(path: str):
'''
Deletes and re-creates folder housing temporary log files.
'''
if os.path.exists(path):
if os.path.isdir(path):
shutil.rmtree(path)
else:
raise FileExistsError(f'Expected path to folder, got "{path}"')
os.mkdir(path)


def sanitize_file_name(txt, chr_set='extended') -> str:
"""Converts txt to a valid filename.
Expand Down
8 changes: 7 additions & 1 deletion OSCRUI/leagueconnector.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from OSCR_django_client.api import (CombatlogApi, LadderApi, LadderEntriesApi,
VariantApi)
from PySide6.QtWidgets import QMessageBox
from PySide6.QtCore import QTemporaryDir

from .datafunctions import CustomThread, analyze_log_callback
from .datamodels import LeagueTableModel, SortingProxy
Expand Down Expand Up @@ -207,8 +208,13 @@ def download_and_view_combat(self, translation):
log_id = table_model._combatlog_id_list[row]
result = self.league_api.download(log_id)
result = gzip.decompress(result)

dir = QTemporaryDir()
if not dir.isValid():
raise Exception("Invalid temporary directory")

with tempfile.NamedTemporaryFile(
mode="w", encoding="utf-8", dir=self.config["templog_folder_path"], delete=False
mode="w", encoding="utf-8", dir=dir.path(), delete=False
) as file:
file.write(result.decode())
analyze_log_callback(
Expand Down
2 changes: 1 addition & 1 deletion OSCRUI/subwindows.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,11 +360,11 @@ def create_live_parser_window(self, translate):

live_window = LiveParserWindow()
live_window.setStyleSheet(get_style(self, 'live_parser'))
live_window.setWindowTitle("Live Parser")
live_window.setWindowFlags(
live_window.windowFlags()
| Qt.WindowType.WindowStaysOnTopHint
| Qt.WindowType.WindowDoesNotAcceptFocus
| Qt.WindowType.SubWindow
| Qt.WindowType.FramelessWindowHint)
# live_window.setAttribute(Qt.WidgetAttribute.WA_ShowWithoutActivating, True)
live_window.setWindowOpacity(self.settings.value('live_parser_opacity', type=float))
Expand Down
6 changes: 3 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

class Launcher():

version = '2024.08b210'
__version__ = '0.2'
version = '2024.09b50'
__version__ = '0.4'

# holds the style of the app
theme = {
Expand Down Expand Up @@ -758,7 +758,7 @@ def app_config() -> dict:
'heal_columns|12': True,
'heal_columns_length': 13,
'split_log_after': 480000,
'seconds_between_combats': 100,
'seconds_between_combats': 45,
'excluded_event_ids': ['Autodesc.Combatevent.Falling', ''],
'graph_resolution': 0.2,
'combats_to_parse': 10,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies = [
"PySide6==6.7.2",
"pyqtgraph==0.13.7",
"numpy==1.26.4",
"STO-OSCR>=2024.9b20",
"STO-OSCR>=2024.9b50",
"OSCR-django-client>=2024.9.2.1",
"pydantic==2.7.3",
]
Expand Down

0 comments on commit aea5f6e

Please sign in to comment.