Nicegui widgets

From BITPlan Wiki
Revision as of 07:35, 18 November 2023 by Wf (talk | contribs)
Jump to navigation Jump to search

OsProject

OsProject
id  nicegui_widgets
state  active
owner  WolfgangFahl
title  nicegui_widgets
url  https://github.com/WolfgangFahl/nicegui_widgets
version  0.4.0
description  nicegui widgets, tools and base classes
date  2023-11-17
since  2023-09-12
until  

Motivation

Standarize nicegui App appearance and add utilities and widgets

Demo

http://ngdemo.bitplan.com


Installation

pip install ngwidgets
# alternatively if your pip is not a python3 pip
pip3 install ngwidgets 
# local install from source directory of ngwidgets 
pip install .

upgrade

pip install ngwidgets  -U
# alternatively if your pip is not a python3 pip
pip3 install ngwidgets -U


Features

  • standard project layout with README, License, pyproject.toml, github actions and scripts for installation and testing
  • layout and menu handling with setup_header, setup_footer and setup_content_div
  • background: BackgroundTaskHandler class to allow running long running tasks in a different thread with async/await
  • cmd: WebserverCmd class - makes a command line for single input webservers simpler
  • color_schema: ColorSchema class - allows to define color schemas by name e.g. "indigo()"
  • file_selector: FileSelector class - for selecting files from a tree structure such as a directory - in local mode with unrestricted access to the file system
  • input_webserver: InputWebserver skeleton class for a single input webserver that has a single file to work on
  • leaflet: leaflete class that wraps https://leafletjs.com/ as a component
  • profiler: Profiler class measures time - especially when running tests
  • progress: Progressbar subclasses NiceguiProgressbar and TqdmProgressbar allow to use a tdqm or nicegui ui_linear_progress in an exchangeable/compatible way
  • webserver: NiceGuiWebserver class for a default webserver with header/menu/footer and some utility functions WebserverConfig to configure copyright/version links and default_port
  • version info handling
  • about dialog
  • users: Users class for user authentication/credential handling
  • remote debugging support
  • aggrid ListOfDictGrid
  • dictedit

remote debugging support

[1] remote debugging is supported

relevant command line arguments

 --debugServer DEBUGSERVER
                        remote debug Server
  --debugPort DEBUGPORT
                        remote debug Port
  --debugRemotePath DEBUGREMOTEPATH
                        remote debug Server path mapping - remotePath - path
                        on debug server
  --debugLocalPath DEBUGLOCALPATH
                        remote debug Server path mapping - localPath - path on
                        machine where python runs

example remote debug session start

using https://github.com/BITPlan/diagrams project as an example

The remote IDE environment is an Eclipse workspace on a Mac in this example so /Users/wf/Documents/pyworkspace is the root of the source code tree remotely The local environment is an Ubuntu server machine where the code resides in /home/wf/source/python

# tunnel port 5678
ssh -R 5678:localhost:5678 server
cd source/python/diagrams
git pull
pip install .
# check that the remote debugging command line arguments are available
diagrams -h
# start your remote debugging in the IDE first 
# e.g. with the Eclipse menu entry pydev/Start debug server
diagrams -s --debugServer localhost --debugRemotePath=/Users/wf/Documents/pyworkspace/ --debugLocalPath=/home/wf/source/python/ --debug

In you IDE there should now be a break in the webserver.py class at:

           print(f"command line args are: {str(sys.argv)}")

Links

https://nicegui.io/