Skip to content

Conversation

@Chickaboo
Copy link
Member

This pull request introduces several improvements and refactorings across the codebase, focusing on standardizing exception handling, modernizing the player management dialog (especially around player data import), and updating build and configuration files for better maintainability and consistency.

Key changes include:

Exception Handling and Code Structure

  • Introduced a comprehensive exception hierarchy in exceptions.py, establishing GambitPairingException as the base for all custom exceptions, and organizing related exceptions into logical groups (pairing, tournament, player, result, validation, resource, API, configuration). This enables more robust and maintainable error handling throughout the application.

Player Management Dialog Improvements

  • Refactored player data import logic in player_management_dialog.py to use standardized adapters (cfc_api_to_player_dict, fide_api_to_player_dict), ensuring consistent field mapping and reducing manual field assignments. This improves reliability and maintainability when importing player data from CFC and FIDE APIs. [1] [2]
  • Enhanced the UI feedback for clipboard copy actions and improved icon handling by using SVG icons as a fallback, ensuring a more consistent and modern user experience. [1] [2]
  • Added internal state tracking for editing players and clarified docstrings for copy actions. [1] [2]

Dialog and UI Enhancements

  • Added PrintOptionsDialog to the dialogs module and its public API, making print options accessible in the GUI. [1] [2]
  • Improved the manual pairing dialog by disabling floating on the player pool dock widget to prevent detachment issues, and added a feature to auto-pair a selected player with the best available opponent based on rating. [1] [2]

Build, Configuration, and Metadata Updates

  • Updated build logic in make_executable.py to correctly handle platform-specific executable naming and simplify path handling.
  • Updated project URLs in pyproject.toml to point to the new GitHub repository location, and set up dynamic versioning using the gambitpairing.__version__ attribute. [1] [2]
  • Removed unnecessary comments and clarified dependencies in pyproject.toml.
  • Updated the application version string to remove the "(alpha)" label, reflecting a more stable release.

These changes collectively improve code maintainability, user experience, and project organization.

Chickaboo and others added 17 commits August 24, 2025 20:46
…-blocking notifications for player import, tournament creation, and tournament loading actions. Uses the show_notification utility to provide user feedback, improving the user experience with success and error messages. Falls back to message boxes if notifications fail.
Co-authored-by: Chickaboo <131608268+Chickaboo@users.noreply.github.com>
Fix tournament tab layout getting squished after manual pairing edits
fixed issue with button margins
Introduces a comprehensive exception hierarchy for application errors, refactors player management to use factory methods and standardized data adapters, and updates Dutch Swiss pairing logic to use explicit color constants (BLACK, WHITE) instead of ambiguous variables. Also moves print utilities to a new location, improves player editing and validation, and enhances logging and UI state management throughout the tournament and player tabs.
…dular view classes under the gui/views directory, improving maintainability and separation of concerns. Adds a new PrintOptionsDialog for flexible print selection, enhances the print output for pairings and standings with improved formatting and layout, and introduces gui_utils for shared GUI helpers. Updates mainwindow to use the new views, improves toolbar and placeholder handling, and updates resource paths and icons. Minor code cleanups and docstring adjustments are included.
Add GitHub Actions workflow for Python package publishing
If the clauses are needed, they should be documented and ideally logged.
New logic, AI suggestions implemented. 

Works on my machine. :)
… when tournament is in progress

- Add Record Results button to toolbar alongside Start Tournament button
- Show/hide buttons based on tournament state: Start when not started, Record when in progress
- Add dynamic separator that appears when tournament exists
- Hide Record button when tournament is finished
- Update toolbar comment to reflect new functionality
…e row height, and reduce header padding to prevent text truncation and widget clipping
…ays showing separator between file actions and tournament info
Copilot AI review requested due to automatic review settings January 22, 2026 23:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request introduces comprehensive improvements focusing on standardizing exception handling, modernizing player management (especially player data import), and updating build and configuration files for better maintainability.

Changes:

  • Introduced a comprehensive exception hierarchy with GambitPairingException as the base for all custom exceptions
  • Refactored player data import to use standardized adapters (cfc_api_to_player_dict, fide_api_to_player_dict)
  • Added new utility modules for validation, command execution, and API response adaptation
  • Refactored tournament management into specialized managers (RoundManager, ResultRecorder, TiebreakCalculator)
  • Enhanced UI with new header widget, improved dialogs, and better print functionality
  • Updated project metadata and build scripts for new repository location

Reviewed changes

Copilot reviewed 53 out of 71 changed files in this pull request and generated 18 comments.

Show a summary per file
File Description
src/gambitpairing/exceptions.py Comprehensive exception hierarchy with base GambitPairingException
src/gambitpairing/utils/validation.py Reusable validation functions with consistent error handling
src/gambitpairing/utils/api_adapters.py Adapters for converting API responses to Player objects
src/gambitpairing/utils/command_runner.py Utilities for subprocess command execution
src/gambitpairing/player/factory.py Factory pattern for creating Player/FidePlayer instances
src/gambitpairing/tournament/*.py Refactored tournament management with specialized managers
src/gambitpairing/gui/dialogs/player_management_dialog.py Improved player import using standardized adapters
src/gambitpairing/gui/views/**/*.py New view components with unified header widget
pyproject.toml Updated repository URLs and dynamic versioning
make_executable.py Fixed platform-specific executable naming
Comments suppressed due to low confidence (2)

src/gambitpairing/gui/dialogs/manual_pairing_dialog.py:1419

  • This assignment to '_auto_pair_selected_player' is unnecessary as it is redefined before this value is used.
    def _auto_pair_selected_player(self, item):

src/gambitpairing/gui/views/standings/standings_view.py:35

  • Import of 'create_print_button' is not used.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,263 @@
import logging
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'logging' is not used.

Suggested change
import logging

Copilot uses AI. Check for mistakes.
Helper class for managing the pairings table in the Tournament tab.
"""

import logging
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'logging' is not used.

Copilot uses AI. Check for mistakes.
import logging
from typing import List, Optional, Tuple

from PyQt6 import QtCore, QtGui, QtWidgets
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'QtCore' is not used.

Copilot uses AI. Check for mistakes.
from PyQt6 import QtCore, QtGui, QtWidgets
from PyQt6.QtCore import QObject, Qt, QThread, pyqtSignal

from gambitpairing.gui.gui_utils import get_colored_icon, set_svg_icon
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'set_svg_icon' is not used.

Suggested change
from gambitpairing.gui.gui_utils import get_colored_icon, set_svg_icon
from gambitpairing.gui.gui_utils import get_colored_icon

Copilot uses AI. Check for mistakes.
from gambitpairing.gui.gui_utils import get_colored_icon, set_svg_icon
from gambitpairing.gui.notification import show_notification
from gambitpairing.player import Player
from gambitpairing.player import Player, create_player_from_dict
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'create_player_from_dict' is not used.

Suggested change
from gambitpairing.player import Player, create_player_from_dict
from gambitpairing.player import Player

Copilot uses AI. Check for mistakes.
import logging
from typing import List, Optional, Tuple

from PyQt6 import QtCore, QtGui, QtWidgets
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'QtGui' is not used.

Copilot uses AI. Check for mistakes.
Comment on lines +45 to +53
from gambitpairing.constants import (
BYE_SCORE,
DRAW_SCORE,
LOSS_SCORE,
RESULT_BLACK_WIN,
RESULT_DRAW,
RESULT_WHITE_WIN,
WIN_SCORE,
)
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'LOSS_SCORE' is not used.
Import of 'DRAW_SCORE' is not used.
Import of 'RESULT_BLACK_WIN' is not used.
Import of 'RESULT_DRAW' is not used.
Import of 'RESULT_WHITE_WIN' is not used.

Copilot uses AI. Check for mistakes.
Comment on lines +62 to +63
except Exception:
pass
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'except' clause does nothing but pass and there is no explanatory comment.

Suggested change
except Exception:
pass
except Exception as exc:
logger.exception("Failed to show notification after importing players: %s", exc)

Copilot uses AI. Check for mistakes.
notification_type="success",
)
except Exception:
pass
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'except' clause does nothing but pass and there is no explanatory comment.

Suggested change
pass
logger.exception("Failed to show 'new tournament created' notification.")

Copilot uses AI. Check for mistakes.
Comment on lines +694 to +695
except Exception:
pass
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'except' clause does nothing but pass and there is no explanatory comment.

Suggested change
except Exception:
pass
except Exception as e:
logger.debug(
"Non-fatal error while showing 'tournament loaded' notification",
exc_info=e,
)

Copilot uses AI. Check for mistakes.
@Chickaboo Chickaboo merged commit 9464642 into main Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants