Skip to content

Commit

Permalink
Moved some parts of create_overview back to OSCR. (#20)
Browse files Browse the repository at this point in the history
* Minor change to how summary is generated (moved out of OSCR)

* Moved parts of create_overview back to OSCR.

* Incremented version to 2024.03a040

* Incremented version to 2024.03a040
  • Loading branch information
Kraust authored Mar 5, 2024
1 parent ec1ad33 commit 705a8dd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 27 deletions.
27 changes: 1 addition & 26 deletions OSCRUI/displayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,38 +63,12 @@ def _create_overview(combat: Combat) -> tuple:
converts dictionary containing player data to table data for the front page
'''
table = list()
total_damage = 0
total_damage_taken = 0
total_attacks = 0
total_heals = 0

DPS_graph_data = dict()
DMG_graph_data = dict()
graph_time = dict()

for player in combat.player_dict.values():
total_damage += player.total_damage
total_damage_taken += player.total_damage_taken
total_attacks += player.attacks_in_num
total_heals += player.total_heals

for player in combat.player_dict.values():
try:
player.damage_share = player.total_damage / total_damage * 100
except ZeroDivisionError:
player.damage_share = 0.0
try:
player.taken_damage_share = player.total_damage_taken / total_damage_taken * 100
except ZeroDivisionError:
player.taken_damage_share = 0.0
try:
player.attacks_in_share = player.attacks_in_num / total_attacks * 100
except ZeroDivisionError:
player.attacks_in_share = 0.0
try:
player.heal_share = player.total_heals / total_heals * 100
except ZeroDivisionError:
player.heal_share = 0.0
table.append((*player,))

DPS_graph_data[player.handle] = player.DPS_graph_data
Expand Down Expand Up @@ -127,6 +101,7 @@ def create_overview(self):
tbl = create_overview_table(self, current_table)
bar_layout.addWidget(tbl, stretch=4)


@setup_plot
def create_grouped_bar_plot(self, data: dict[str, tuple], time_reference: dict[str, tuple],
bar_widget: PlotWidget) -> QVBoxLayout:
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class Launcher():

version = '2024.3a32'
version = '2024.03a040'

# holds the style of the app
theme = {
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@ oscr = "main:Launcher.launch"
[tool.hatch.version]
path = "main.py"
pattern = "\\s*version = '(?P<version>.*)'"

[tool.black]
target-version = ['py38']
line-length = 110

0 comments on commit 705a8dd

Please sign in to comment.