Skip to content

Commit

Permalink
Workflow Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Kraust committed Oct 13, 2024
1 parent 82c1ee0 commit 478e2ef
Showing 1 changed file with 10 additions and 51 deletions.
61 changes: 10 additions & 51 deletions OSCRUI/datafunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,47 +71,7 @@ def analyze_log_callback(
self.settings.setValue('log_path', path)

parser.log_path = path
try:
parser.analyze_log_file()
except FileExistsError:
if self.settings.value('log_size_warning', type=bool):
action = log_size_warning(self, translate)
if action == 'split dialog':
split_dialog(self)
return
elif action == 'trim':
trim_logfile(self)
parser.analyze_log_file()
elif action == 'continue':
parser.analyze_massive_log_file()
elif action == 'cancel':
return

except Exception as ex:
error = QMessageBox()
error.setWindowTitle("Open Source Combatlog Reader")
try:
print(ex)
error_message = str(ex)[:60]
message = (
f"{self._('Failed to analyze the log file.')}\n\n"
f"{self._('Reason:')}\n{error_message}\n\n"
f"{self._('Please report this issue to Discord OSCR-Support channel.')}"
)
error.setText(message)
except Exception as ex:
print(ex)
error_message = str(ex)[:60]
message = (
f"{self._('Failed to analyze the log file.')}\n\n"
f"{self._('Reason:')}\n{error_message}\n\n"
f"{self._('Please report this issue to Discord OSCR-Support channel.')}"
)
error.setText(message)

error.setWindowTitle(self._("Open Source Combatlog Reader"))
error.setIcon(QMessageBox.Critical)
error.exec()
parser.analyze_log_file()

self.current_combats.clear()
self.current_combats.addItems(parser.analyzed_combats)
Expand Down Expand Up @@ -158,12 +118,12 @@ def copy_summary_callback(self, translate, parser_num: int = 1):
duration = self.parser1.active_combat.duration.total_seconds()
combat_time = f'{int(duration / 60):02}:{duration % 60:02.0f}'

summary = f'{{ OSCR }} {parser.active_combat.map}'
summary = f'OSCR {parser.active_combat.map}'
difficulty = parser.active_combat.difficulty
if difficulty and isinstance(difficulty, str) and difficulty != 'Unknown':
summary += f' ({difficulty}) - DPS / DMG [{combat_time}]: '
summary += f' ({difficulty}) - DPS [{combat_time}]: '
else:
summary += f' - DPS / DMG [{combat_time}]: '
summary += f' - DPS [{combat_time}]: '
players = sorted(
self.parser1.active_combat.player_dict.values(),
reverse=True,
Expand All @@ -172,8 +132,7 @@ def copy_summary_callback(self, translate, parser_num: int = 1):
parts = list()
for player in players:
parts.append(
f"`{player.handle}` {player.DPS:,.0f} / "
+ format_damage_number(player.total_damage))
f"{player.handle} {player.DPS:,.0f}")
summary += " | ".join(parts)

self.app.clipboard().setText(summary)
Expand Down Expand Up @@ -348,7 +307,7 @@ def copy_analysis_callback(self):
for col, value in row_data.items():
formatted_row.append(f'[{current_header[col]}] {format_function(value, col)}')
formatted_row_name = ''.join(row_name) if isinstance(row_name, tuple) else row_name
output.append(f"`{formatted_row_name}`: {' | '.join(formatted_row)}")
output.append(f"{formatted_row_name}: {' | '.join(formatted_row)}")
output_string = '\n'.join(output)
self.app.clipboard().setText(output_string)
elif copy_mode == self._('Global Max One Hit'):
Expand All @@ -367,7 +326,7 @@ def copy_analysis_callback(self):
max_one_hit_ability = max_one_hit_ability.get_data(0)
if isinstance(max_one_hit_ability, tuple):
max_one_hit_ability = ''.join(max_one_hit_ability)
output_string = (f'{{ OSCR }} {prefix}: {max_one_hit:,.2f} '
output_string = (f'OSCR {prefix}: {max_one_hit:,.2f} '
f'(`{"".join(max_one_hit_item.get_data(0))}` – '
f'{max_one_hit_ability})')
self.app.clipboard().setText(output_string)
Expand All @@ -388,7 +347,7 @@ def copy_analysis_callback(self):
max_one_hit_ability = max_one_hit_item.get_data(0)
if isinstance(max_one_hit_ability, tuple):
max_one_hit_ability = ''.join(max_one_hit_ability)
output_string = (f'{{ OSCR }} {prefix}: {max_one_hit:,.2f} '
output_string = (f'OSCR {prefix}: {max_one_hit:,.2f} '
f'(`{"".join(selected_row.get_data(0))}` – '
f'{max_one_hit_ability})')
self.app.clipboard().setText(output_string)
Expand All @@ -406,7 +365,7 @@ def copy_analysis_callback(self):
magnitudes.append((player_item.get_data(2), ''.join(player_item.get_data(0))))
magnitudes.sort(key=lambda x: x[0], reverse=True)
magnitudes = [f"`[{''.join(player)}]` {magnitude:,.2f}" for magnitude, player in magnitudes]
output_string = (f'{{ OSCR }} {prefix}: {" | ".join(magnitudes)}')
output_string = (f'OSCR {prefix}: {" | ".join(magnitudes)}')
self.app.clipboard().setText(output_string)
elif copy_mode == self._('Magnitude / s'):
if current_tab == 0:
Expand All @@ -422,5 +381,5 @@ def copy_analysis_callback(self):
magnitudes.append((player_item.get_data(1), ''.join(player_item.get_data(0))))
magnitudes.sort(key=lambda x: x[0], reverse=True)
magnitudes = [f"`[{''.join(player)}]` {magnitude:,.2f}" for magnitude, player in magnitudes]
output_string = (f'{{ OSCR }} {prefix}: {" | ".join(magnitudes)}')
output_string = (f'OSCR {prefix}: {" | ".join(magnitudes)}')
self.app.clipboard().setText(output_string)

0 comments on commit 478e2ef

Please sign in to comment.