### Install Pyfa Project Dependencies Source: https://github.com/pyfa-org/pyfa/blob/master/CONTRIBUTING.md This command installs all required Python packages for the Pyfa project, as specified in the 'requirements.txt' file. It ensures all necessary libraries are present within the active virtual environment. ```bash pip install -r PyfaDEV\requirements.txt ``` -------------------------------- ### List Installed Python Packages Source: https://github.com/pyfa-org/pyfa/blob/master/CONTRIBUTING.md This command displays a list of all Python packages installed in the currently active virtual environment. It's useful for verifying that all project dependencies have been successfully installed. ```bash pip list ``` -------------------------------- ### Install Pytest for Pyfa Testing Source: https://github.com/pyfa-org/pyfa/blob/master/CONTRIBUTING.md This command installs the 'pytest' framework into the active virtual environment. Pytest is a popular and powerful tool used for writing and running automated tests for Python applications. ```bash pip install pytest ``` -------------------------------- ### Run Pyfa Application for Testing Source: https://github.com/pyfa-org/pyfa/blob/master/CONTRIBUTING.md This command starts the main Pyfa application script. It serves as a final check to ensure that the project is correctly set up and can launch without errors after all dependencies and assets are in place. ```python python PyfaDEV\pyfa.py ``` -------------------------------- ### Activate Pyfa Virtual Environment Source: https://github.com/pyfa-org/pyfa/blob/master/CONTRIBUTING.md These commands activate the 'PyfaEnv' virtual environment, making its Python interpreter and installed packages available in the current shell session. Activation is crucial before installing dependencies or running project scripts. ```cmd PyfaEnv\scripts\activate.bat ``` ```bash source /Scripts/activate ``` -------------------------------- ### Execute Pyfa Project Tests Source: https://github.com/pyfa-org/pyfa/blob/master/CONTRIBUTING.md These commands run the automated tests for the Pyfa project using the installed 'pytest' framework. Running tests is crucial for verifying the functionality and stability of the codebase during development. ```python python -m pytest ``` ```bash py.test ``` -------------------------------- ### Create Python Virtual Environment for Pyfa Source: https://github.com/pyfa-org/pyfa/blob/master/CONTRIBUTING.md This command creates a dedicated Python virtual environment named 'PyfaEnv'. Using a virtual environment isolates project dependencies from the system's global Python installation, preventing conflicts. ```bash python -m venv PyfaEnv ``` -------------------------------- ### Clone Pyfa Project Repository Source: https://github.com/pyfa-org/pyfa/blob/master/CONTRIBUTING.md This command clones the Pyfa project's Git repository into a new directory named 'PyfaDEV'. It's the initial step to obtain the project source code for local development. ```bash git clone PyfaDEV ``` -------------------------------- ### Common Markdown Syntax Examples Source: https://github.com/pyfa-org/pyfa/blob/master/docs/index.md This snippet demonstrates various fundamental Markdown syntax elements, including different header levels, bulleted and numbered lists, text formatting (bold, italic, code), and embedding links and images. It serves as a quick reference for styling content in Markdown files. ```markdown Syntax highlighted code block # Header 1 ## Header 2 ### Header 3 - Bulleted - List 1. Numbered 2. List **Bold** and _Italic_ and `Code` text [Link](url) and ![Image](src) ``` -------------------------------- ### GNU gettext PO File Translation Example Source: https://github.com/pyfa-org/pyfa/blob/master/locale/README.md Demonstrates a basic `msgid` (original English string) and `msgstr` (translated string) pair as found in a `.po` file, illustrating how `gettext` maps source text to its translated version. ```gettext msgid "Click to toggle between effective HP and raw HP" msgstr "点击切换有效HP和原始HP" ``` -------------------------------- ### Install pyfa on macOS using Homebrew Source: https://github.com/pyfa-org/pyfa/blob/master/README.md This command installs the pyfa application on macOS using the Homebrew package manager. It utilizes the `--cask` option for installing graphical applications available as Homebrew casks. ```Shell $ brew install --cask pyfa ``` -------------------------------- ### Build Pyfa Translations and Database Source: https://github.com/pyfa-org/pyfa/blob/master/CONTRIBUTING.md These commands execute Python scripts to compile language translations and update the project's database. These steps are essential for the application's localization features and data management. ```python python scripts\compile_lang.py python db_update.py ``` -------------------------------- ### Python Project Dependency List Source: https://github.com/pyfa-org/pyfa/blob/master/requirements.txt This snippet details the specific Python packages and their pinned versions that the pyfa project relies on. It is typically found in a 'requirements.txt' file and is used to install all necessary libraries for the project. ```Python Requirements wxPython==4.2.1 logbook==1.7.0.post0 numpy==1.26.2 matplotlib==3.8.2 python-dateutil==2.8.2 requests==2.31.0 sqlalchemy==1.4.50 cryptography==42.0.4 markdown2==2.4.11 packaging==23.2 roman==4.1 beautifulsoup4==4.12.2 pyyaml==6.0.1 python-jose==3.3.0 requests-cache==1.1.1 ``` -------------------------------- ### JavaScript Client-Side Authentication Logic for pyfa Proxy Source: https://github.com/pyfa-org/pyfa/blob/master/docs/callback.html This JavaScript code manages the client-side authentication flow for pyfa. It includes functions to toggle UI elements, perform asynchronous HTTP GET requests, parse authentication state from URL parameters, display the authentication token, and communicate with a local pyfa server to finalize the authentication process, providing user feedback based on server responses. ```JavaScript debugger; function showCode() { var element = document.getElementById(`mode1`); element.classList.remove("hidden"); element = document.getElementById(`showBtn`); element.classList.add("hidden"); } function httpPostAsync(url, callback) { var xmlHttp = new XMLHttpRequest(); xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == XMLHttpRequest.DONE) callback(xmlHttp); } xmlHttp.open("GET", url, true); // true for asynchronous xmlHttp.send(null); } const urlSearchParams = new URLSearchParams(window.location.search); const params = Object.fromEntries(urlSearchParams.entries()); let stateInfo; try { stateInfo = JSON.parse(atob(params.state)) } catch (err) { // something has happened and we cannot continue. // todo: show a simple message and exit. throw err; } // we always want to show the text box for manual. var element = document.getElementById(`mode${stateInfo.mode}`); element.classList.remove("hidden"); if (stateInfo.mode === 0) { let p = document.getElementById(`mode1-p`); p.prepend(document.createElement("hr")) } debugger; document.getElementById(`authCodeText`).value = btoa(JSON.stringify(params)) if (stateInfo.mode == 0) { // auto / server mode httpPostAsync(stateInfo.redirect + window.location.search, (req)=>{ debugger; const msgDiv = document.getElementById(`mode0-msg`); if (req.status === 200) { msgDiv.innerHTML ="Success! You may close this window and return to the application."; return; } else if (req.status === 0){ msgDiv.innerHTML = "Error! Server response not received.

The local pyfa server may have timed out, or may not have started correctly.

"; } else if (req.status === 400){ msgDiv.innerHTML = `Error!

${req.responseText}

` } else { msgDiv.innerHTML = `Error!

There was an unknown error. Please report this to the pyfa issues page.

` } showCode() // todo: bad request error when it's not an error itself, but rather }) // todo: post message to local EVE server } ``` -------------------------------- ### Initialize PO file for new language Source: https://github.com/pyfa-org/pyfa/blob/master/locale/README.md This command initializes a new PO file for a specific language. It takes the PO template ('locale/lang.pot') as input, specifies the target locale ('ll_CC'), and outputs the new PO file to 'locale/ll_CC/LC_MESSAGES/lang.po'. This file should be checked into version control. ```console $ msginit -i locale/lang.pot -l ll_CC -o locale/ll_CC/LC_MESSAGES/lang.po -s ``` -------------------------------- ### Generate new template for translation Source: https://github.com/pyfa-org/pyfa/blob/master/locale/README.md This command collects all Python (.py) file paths and uses xgettext to extract translatable string literals into 'locale/lang.pot'. It explains the 'find' command for collecting files and various xgettext options like --from-code, -o, -d, -k (for different keyword patterns), -f, and -s. The output 'locale/lang.pot' is a PO template for Crowdin translation. ```console $ find * -name "*.py" | xgettext --from-code=UTF-8 -o locale/lang.pot -d lang -k_t -k_t:1,2,3t -k_t:1,2c,2t -f - -s ``` -------------------------------- ### Generate machine readable MO file Source: https://github.com/pyfa-org/pyfa/blob/master/locale/README.md These commands generate machine-readable .mo files from .po translation files. The first command compiles a single locale, the second iterates through all available locales using a bash loop, and the third provides an alternative for compilation using a Python script without the need for normal gettext tools. ```console $ msgfmt locale/ll_CC/LC_MESSAGES/lang.po -o locale/ll_CC/LC_MESSAGES/lang.mo ``` ```bash for f in locale/*/; do \n msgfmt $f/LC_MESSAGES/lang.po -o $f/LC_MESSAGES/lang.mo\ndone ``` ```python python3 scripts/compile_lang.py ``` -------------------------------- ### Compile pyfa Language Files from Source Source: https://github.com/pyfa-org/pyfa/blob/master/locale/README.md Command to compile `.mo` language files, which are necessary for translations to function correctly when running pyfa directly from its source repository. ```Python python3 scripts\compile_lang.py ``` -------------------------------- ### Merge two or more PO files Source: https://github.com/pyfa-org/pyfa/blob/master/locale/README.md This command merges two or more PO files into a new one. Note that 'msgcat' performs a simple stack merge, not a 3-way merge, so it is advised to check and fix the output before committing to Git. ```console $ msgcat -s path/to/old.po [path/to/another.po] -o path/to/new.po ``` -------------------------------- ### Linux Locale Configuration for pyfa Source: https://github.com/pyfa-org/pyfa/blob/master/locale/README.md Provides instructions to resolve locale-related errors in pyfa on Debian-based Linux distributions by enabling the `en_US.UTF-8` locale and regenerating system locale files. ```Configuration File # en_US.UTF-8 UTF-8 ``` ```Shell locale-gen ``` -------------------------------- ### Update PO file for existing translation Source: https://github.com/pyfa-org/pyfa/blob/master/locale/README.md This command updates an existing PO file ('locale/ll_CC/LC_MESSAGES/lang.po') by merging it with the latest PO template ('locale/lang.pot'). ```console $ msgmerge -s locale/ll_CC/LC_MESSAGES/lang.po locale/lang.pot ``` -------------------------------- ### CSS Styling for pyfa Authentication Proxy Page Source: https://github.com/pyfa-org/pyfa/blob/master/docs/callback.html This CSS defines the visual appearance and layout of the pyfa authentication proxy page, including general body styles, heading sizes, element visibility (hidden, success, error states), textarea and button styling, and dark mode adjustments. ```CSS body { width: 700px; margin: 150px auto; } h1 { font-size: 40px; } h2 { font-size: 32px; } body { font: 20px Helvetica, sans-serif; color: #333; } #article { display: block; text-align: left; width: 650px; margin: 0 auto; } .hidden { display:none; } .success { color: #28a745; } .error { color: #dc3545; } textarea { width: 100%; height: 100px; } hr { border-width: 1px 0 0 0; border-style: solid; border-color: #333; } button { cursor: pointer; background-color: white; border: 1px solid #333; color: #333; padding: 8px 11px; text-align: center; text-decoration: none; display: inline-block; } @media (prefers-color-scheme: dark) { body { background-color: #333; color: white; } textarea { width: 100%; height: 100px; background-color: #aaa;} button { background-color: #333; border: 1px solid white; color: white; } hr { border-color: white; } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.