Skip to main content

No project description provided

Project description

OTLMOW-GUI

PyPI otlmow-gui-downloads Unittests PyPI - Python Version GitHub issues coverage

Summary

The main use case of the otlmow-gui is to provide a graphical user interface for the OTLMOW project. It is built using the PyQt6 framework and is compatible with Python 3.7 and higher. This will eventually replace the OTL wizard.

OTLMOW Project

This project aims to implement the Flemish data standard OTL (https://wegenenverkeer.data.vlaanderen.be/) in Python. It is split into different packages to reduce compatibility issues

Install with pip

You can download install the OTL Wizard here if you're on Windows. Or you can use a Python virtual environment on any platform, install this package and run the otlwizard command.

Installing a virtual environment

  • Make sure you have Python 3.7 or higher installed and that your python environment variable points to it.
  • Create a new folder for your virtual environment and navigate to it in a terminal.
  • Create a new virtual environment with the command:
python -m venv venv

Activate the virtual environment

  • On Windows:
venv\Scripts\activate
  • On MacOS/Linux:
source venv/bin/activate

Installing this package

Install the package with pip and uv (recommended):

pip install uv
uv pip install otlmow-gui

Run the OTL wizard command

After installing, you can now run the OTL wizard with the command:

otlwizard

Setup development environment guide

NEEDS atleast python 3.13.2 to use the pyinstaller_script.py to create an .exe file

Follow these steps to start working with the OTL-wizard 2 source code and run de development version
Each step will have the required commands in a PowerShell terminal as administrator (windows) starting from an empty folder.

  1. Clone this repository into a folder or use an IDE to setup a project from this repository.

    git clone https://github.com/davidvlaminck/OTLMOW-GUI.git
    cd .\OTLMOW-GUI\ 
    
  2. Setup a virtual python >= 3.13.2 environment and install the requirements.txt

    python -m venv venv # your python environment variable needs to point to a python version higher than 3.13.2
    Set-ExecutionPolicy RemoteSigned # needed to let PowerShell execute .ps scripts
    venv\Scripts\activate
    python --version #shows the version of your python check if it is >3.13.2
    pip install -r requirements.txt
    
  3. (SKIPABLE) To use de SDF-file functionality (only windows) install the FDO Toolbox, you can find the installer in this repository at:

    LatestReleaseMulti/additional_programs/FDOToolbox-Release-v1.5.3-x64-Setup.exe
    
  4. To run the OTL wizard 2 open a terminal in de root of the project and activate your virtual environment,
    then run the following:

    python "OTL Wizard 2.py"
    

exe and installer creation guide

Follow these steps (NOT PowerShell commands) to create a new executable of OTL Wizard 2 and a new installer. These are ready for distribution then.

  1. Make sure you have a python 3.13 environment with the requirements.txt installed set up, see Setup development environment guide
    NOTE: Keep using PyInstaller 6.10.0, newer version can get false positives on Windows Defender. Lookout for detections of Wacatac.B!ml, Wacatac.H!ml, Wacapew.C!ml these are false positives. They get detected only when you compile with newer versions and not when you compile with older versions of PyInstaller. If any user has a detection, it is most likely because of an outdated Windows Defender. Ask them to update Windows and/or Windows Defender.

  2. To change the version number of OTL Wizard 2, you need to change two version variables.
    These are:
    variable version = "<your_version_number>" in pyproject.toml
    variable #define MyAppVersion "<your_version_number>" in LatestReleaseMulti/inno_setup_installer_setup_script.iss

  3. Run the pyinstaller_script.py in that environment.
    This will make the file:LatestReleaseMulti/OTL Wizard 2/OTL Wizard 2.exe
    and accompanying folder:LatestReleaseMulti/OTL Wizard 2/data

  4. Sign the LatestReleaseMulti/OTL Wizard 2/OTL Wizard 2.exe file with windows signtool to get this signtool you need to install the windows SDK
    Get a certificate from the Vlaamse Overheid or Agentschap Wegen en Verkeer.
    Use this certificate to sign the generated exe-file with the command:
    C:\"Program Files (x86)"\"Windows Kits"\10\"App Certification Kit"\signtool.exe sign /f "<absolute path to certificate file>" /fd SHA256 "<absolute path to OTL Wizard 2.exe file>"

  5. Download and install Inno Setup Compiler

  6. In the LatestReleaseMulti/inno_setup_installer_setup_script.iss script replace the MyAppDevRoot variable with the absolute path to the root of your project (the folder with the pyproject.toml in)
    In the Inno Setup Compiler interface the compile button is here:
    inno_setup_compile_button

  7. Open LatestReleaseMulti/inno_setup_installer_setup_script.iss with Inno Setup Compiler and compile.
    This should create LatestReleaseMulti/OTL wizard 2 installer V<version>.exe

  8. Sign the LatestReleaseMulti/OTL wizard 2 installer V<version>.exe file with windows signtool from step 3 Use the same certificate from the Vlaamse Overheid or Agentschap Wegen en Verkeer as that from step 3.
    Use this certificate to sign the generated installer exe-file with the command:
    C:\"Program Files (x86)"\"Windows Kits"\10\"App Certification Kit"\signtool.exe sign /f "<absolute path to certificate file>" /fd SHA256 "<absolute path to OTL wizard 2 installer V<version>.exe file>"

  9. To make the zipped version (no install needed).
    Place the following files and folders into a folder and zip it preferrably with the foldername: OTL Wizard 2 V<your version number>:
    File:LatestReleaseMulti/OTL Wizard 2/OTL Wizard 2.exe (preferrably rename it to OTL Wizard 2 V<your version number>.exe)
    Folder:LatestReleaseMulti/OTL Wizard 2/data
    Folder:LatestReleaseMulti/additional_programs
    The zip should look like this:
    zip_contents_example.png

  10. Until V1.1 publishing to the wider audience is done by placing both the zip and installer-exe file in folder LatestRelease and push to or merge into the master branch of this repository (OTLMOW-GUI) (needs permission from repository owner)

Translations guide

This guide is for when you want to change translations in the program or if you are adding text that needs translations

The easiest way to add translations to the code is by using the code: GlobalTranslate._("<new text that needs translating>")
In most screen classes however you can use self._("<new text that needs translating>")
These functions will return the translation for the given text

For more info on how the translations are applied in the code look at the babel documentation

Follow these steps (MOST are PowerShell commands) to add/change translations:

  1. Install babel in the python environment pip install babel

  2. Generate the locale\base.pot file from the strings (those in _(<to_be_extracted_string>)) in your python code by running:
    pybabel extract -F babel.cfg -o locale\base.pot .\Domain .\GUI .\Exceptions

  3. Update the locale\\<language_code>\LC_MESSAGES\message.po files to the new base.pot with:
    pybabel update -i .\locale\base.pot -d locale --no-fuzzy-matching

  4. Find your new_text_key in the locale\\<language_code>\LC_MESSAGES\message.po of each language and fill in the tranlation for that text in like:

    msgid "new_text_key"
    msgstr "The translation for this new key"
    

    if you don't know all the text_keys you added you can search for msgstr "" to find all msgids that have no translation yet

  5. Compile new translations into messages.mo files pybabel compile -d locale

Custom logging implementation usage

This project has a custom logging class called OTLLogger.py, it is build on the standard logging library.
Instead of using logging.debug("message") you should use OTLLogger.logger.debug("message")

This custom logger can also display the time between 2 OTLLogger.logger.debug() calls by adding the same timing_ref to the extra argument in both log calls. Example:

OTLLogger.logger.debug(f"Execute OtlmowConverter.from_file_to_objects({file_path.name})", 
                            extra={"timing_ref": f"file_to_objects_{file_path.stem}"})

object_lists = list(OtlmowConverter.from_file_to_objects(file_path,**kwargs))

OTLLogger.logger.debug(f"Execute OtlmowConverter.from_file_to_objects({file_path.name}) ({len(object_lists)} objects)", 
                            extra={"timing_ref": f"file_to_objects_{file_path.stem}"})

The sleeping cat GIF link

https://giphy.com/gifs/xUA7aZtd2GIfzYDR5e

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

otlmow_gui-1.1.4.tar.gz (3.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

otlmow_gui-1.1.4-py3-none-any.whl (3.2 MB view details)

Uploaded Python 3

File details

Details for the file otlmow_gui-1.1.4.tar.gz.

File metadata

  • Download URL: otlmow_gui-1.1.4.tar.gz
  • Upload date:
  • Size: 3.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for otlmow_gui-1.1.4.tar.gz
Algorithm Hash digest
SHA256 82dbfc9c0102f2792e868d7973842109b76c39c4d3af87378e095c4bc457860b
MD5 c376b086af3d9c682e4d393b8403d2df
BLAKE2b-256 2ad7d2dfae285c0ad2a94031739b28bb8ee7c40b95e82b4c1106fea190ced699

See more details on using hashes here.

Provenance

The following attestation bundles were made for otlmow_gui-1.1.4.tar.gz:

Publisher: release.yml on davidvlaminck/OTLMOW-GUI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file otlmow_gui-1.1.4-py3-none-any.whl.

File metadata

  • Download URL: otlmow_gui-1.1.4-py3-none-any.whl
  • Upload date:
  • Size: 3.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for otlmow_gui-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 bcb546a650027fd76759c983e769f05f0b661e5b23f8ebb8850ecfea6fc4bce6
MD5 c2d71b834d42c5ebd5d1f718fd15effc
BLAKE2b-256 998efc385992cd6be0471c1e533542e11dcf9145170b934ac3cf22f18aa4ae9a

See more details on using hashes here.

Provenance

The following attestation bundles were made for otlmow_gui-1.1.4-py3-none-any.whl:

Publisher: release.yml on davidvlaminck/OTLMOW-GUI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page