semvec/pypi-packages huggingface dataset:
tweliter 0.5.4
Write TWELITE series firmware (beta)
Requires Python: <4.0,>=3.12

<a href="https://mono-wireless.com/jp/index.html">
    <img src="https://mono-wireless.com/common/images/logo/logo.svg" alt="mono wireless logo" title="MONO WIRELESS" align="right" height="35" />
</a>

# tweliter

A Python module for writing TWELITE series firmware. (beta)

[![MW-OSSLA](https://img.shields.io/badge/License-MW--OSSLA-e4007f)](LICENSE)

## Overview

Write firmware over TWELITE R series via USB.

This module is executable in standalone and importable for your scripts.

## Installation

The module is available in [PyPI](https://pypi.org/project/tweliter/).

Use `pip`

```
pip install tweliter
```

or `poetry`

```
poetry add tweliter
```

### Linux

Sometimes you need to set permission with `udev`.

1. Create `/etc/udev/rules.d/99-ftdi.rules`

```sh
# TWELITE R / MONOSTICK (FT232R / 0403:6001)
SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", MODE="0666"

# TWELITE R2 / R3 (FT230X / 0403:6015)
SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6015", MODE="0666"
```

2. Reload udev rules

```sh
sudo udevadm control --reload-rules
sudo udevadm trigger
```

## Usage

### Command line

Simply

```shell
$ tweliter dir/SomeApp_BLUE.bin
```

or use verification

```shell
$ tweliter --verify dir/SomeApp_BLUE.bin
```

FTDI chip can be filtered by [URL](https://eblot.github.io/pyftdi/urlscheme.html)

```shell
$ tweliter --url ftdi://:ft-x:/1 dir/SomeApp_BLUE.bin
```

or product type(s)

```shell
$ tweliter --type TWELITE_R2,TWELITE_R3 dir/SomeApp_BLUE.bin
```

### In script

```python
from pathlib import Path
from tweliter import Tweliter

file = Path("firmware/SomeApp_BLUE.bin")

try:
    with Tweliter(
        type_filter=Tweliter.Type.TWELITE_R2 | Tweliter.Type.TWELITE_R3
    ) as liter:
        # Get serial interface
        ser = liter.get_serial_instance()
        # Write firmware
        liter.write(ser, file, verify=True)
        # Show startup message
        print(liter.get_startup_message_after(ser, "!INF"))
except IOError as e:
    print(f"Couldn't connect {e}")
except RuntimeError as e:
    print(f"Failed to write {e}")
```

## LICENSE

MW-OSSLA
nicegui-pdf 0.0.7
A PDF viewer for nicegui based on pdf.js
Requires Python: >=3.12

# nicegui-pdf
A NiceGUI PDF component (using pdf.js) to nicely integrate PDFs without the need for iframes without having any control on which page is shown or without the possibility to read the seelcted text. Install with

`pip install nicegui-pdf`


A quick example on how to use the component is given next:

```python
from nicegui import ui, app
from nicegui_pdf import PdfViewer

# [...] 

state = {
    "current_page": 1,
}

# [...]

ui.number().bind_value(state, "current_page")

path = app.add_static_file(local_file="example/paper.pdf")
PdfViewer(path).classes("w-full").style(
    "border: solid 1px gray;"
).bind_current_page(
    state
)
```


# Features
- Full integration of PDF files into NiceGUI
- Two-way binding of `current_page`
- One-way binidng of `num_pages`, `is_rendering` and `selected_text`


A full example demonstrating all features is given in `example/main.py`:
<p align="center">
    <img src="https://raw.githubusercontent.com/peerdavid/nicegui-pdf/main/assets/screenshot.png" alt="table" width="700"/>
</p> 



## ToDo's
- [x] Integrate pdf.js and add a basic PDF viewer
- [x] Bind current page
- [x] Implement text overlay for selected text
- [x] Bind to selected text
- [x] Bind number of pages
- [x] Binding for is rendering
- [x] Resize PDF on window resize
- [ ] Bind path (load new pdf document)

Optional
- [ ] Highlight text
- [ ] Show outline 


## Disclaimer
I'm neither a JS, NiceGUI or VUE expert. I simply tested a few things and found that an older version of PDF.js can be integrated as a custom NiceGUI component. Therefore, I cannot give any warranty etc. but still I'm trying to maintain this code. If you find any bugs or have feature requests, please open an issue or a pull request.


## Donate
If you like it and want to buy me a coffee:

[![](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/donate/?hosted_button_id=Y4PDJU84LC3N2)

Thank you so much!

## References
- PDF.js (https://mozilla.github.io/pdf.js/)