Skip to content

Commit

Permalink
Updated OSCR client, Enabled New Upload Result Dialog (#36)
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
  • Loading branch information
Kraust authored May 27, 2024
1 parent ec94c6d commit 0732de1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 18 deletions.
21 changes: 9 additions & 12 deletions OSCRUI/leagueconnector.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import gzip
import os
import tempfile
import json

import OSCR_django_client
from OSCR.utilities import logline_to_str
Expand All @@ -12,7 +13,7 @@
from .datafunctions import CustomThread, analyze_log_callback
from .datamodels import LeagueTableModel, SortingProxy
from .style import theme_font
from .subwindows import show_warning
from .subwindows import show_warning, uploadresult_dialog
from .textedit import format_datetime_str

LADDER_HEADER = (
Expand Down Expand Up @@ -203,7 +204,9 @@ def upload_callback(self):
)
file.write(data)
file.flush()
self.league_api.upload(file.name)
res = self.league_api.upload(file.name)
if res:
uploadresult_dialog(self, res)
os.remove(file.name)


Expand All @@ -228,23 +231,17 @@ def __init__(self, address=None):
def upload(self, filename):
"""Upload a combat log located at path for analysis"""

reply = QMessageBox()
reply.setWindowTitle("Open Source Combatlog Reader")

try:
res = self.api_combatlog.combatlog_upload(file=filename)
lines = []
for entry in res:
lines.append(entry.detail)
reply.setText("\n".join(lines))
return self.api_combatlog.combatlog_upload(file=filename)
except OSCR_django_client.exceptions.ServiceException as e:
reply = QMessageBox()
reply.setWindowTitle("Open Source Combatlog Reader")
try:
data = json.loads(e.body)
reply.setText(data.get("detail", "Failed to parse error from server"))
except Exception as e:
reply.setText("Failed to parse error from server")

reply.exec()
reply.exec()

def download(self, id):
"""Download a combat log"""
Expand Down
8 changes: 4 additions & 4 deletions OSCRUI/subwindows.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,22 +219,22 @@ def uploadresult_dialog(self, result):
else:
table_style = {'background-color': '@bg', 'padding': (5, 3, 3, 3), 'margin': 0}
icon_table_style = {'background-color': '@bg', 'padding': (3, 3, 3, 3), 'margin': 0}
if line['updated']:
if line.updated:
icon = self.icons['check'].pixmap(icon_size)
else:
icon = self.icons['dash'].pixmap(icon_size)
status_label = create_label(self, '', style_override=icon_table_style)
status_label.setPixmap(icon)
status_label.setSizePolicy(SMINMIN)
content_layout.addWidget(status_label, row, 0)
name_label = create_label(self, line['name'], style_override=table_style)
name_label = create_label(self, line.name, style_override=table_style)
name_label.setSizePolicy(SMINMAX)
content_layout.addWidget(name_label, row, 1)
value_label = create_label(self, str(line['value']), style_override=table_style)
value_label = create_label(self, str(line.value), style_override=table_style)
value_label.setSizePolicy(SMINMAX)
value_label.setAlignment(ARIGHT)
content_layout.addWidget(value_label, row, 2)
detail_label = create_label(self, line['detail'], style_override=table_style)
detail_label = create_label(self, line.detail, style_override=table_style)
detail_label.setSizePolicy(SMINMAX)
content_layout.addWidget(detail_label, row, 3)
top_margin = {'margin-top': self.theme['defaults']['isp']}
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class Launcher():

version = '2024.05b270'
version = '2024.05b271'
__version__ = '0.2'

# holds the style of the app
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 = [
"pyqtgraph>=0.13.4",
"numpy>=1.26.1",
"STO-OSCR>=2024.5b270",
"OSCR-django-client>=2024.3b40",
"OSCR-django-client>=2024.4b130",
]
requires-python = ">=3.10"
authors = []
Expand Down

0 comments on commit 0732de1

Please sign in to comment.