p3lib 1.1.116__tar.gz → 1.1.117__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {p3lib-1.1.116 → p3lib-1.1.117}/PKG-INFO +1 -1
- {p3lib-1.1.116 → p3lib-1.1.117}/pyproject.toml +1 -1
- {p3lib-1.1.116 → p3lib-1.1.117}/src/p3lib/ngt.py +82 -0
- {p3lib-1.1.116 → p3lib-1.1.117}/LICENSE +0 -0
- {p3lib-1.1.116 → p3lib-1.1.117}/README.md +0 -0
- {p3lib-1.1.116 → p3lib-1.1.117}/src/p3lib/__init__.py +0 -0
- {p3lib-1.1.116 → p3lib-1.1.117}/src/p3lib/ate.py +0 -0
- {p3lib-1.1.116 → p3lib-1.1.117}/src/p3lib/bokeh_auth.py +0 -0
- {p3lib-1.1.116 → p3lib-1.1.117}/src/p3lib/bokeh_gui.py +0 -0
- {p3lib-1.1.116 → p3lib-1.1.117}/src/p3lib/boot_manager.py +0 -0
- {p3lib-1.1.116 → p3lib-1.1.117}/src/p3lib/conduit.py +0 -0
- {p3lib-1.1.116 → p3lib-1.1.117}/src/p3lib/database_if.py +0 -0
- {p3lib-1.1.116 → p3lib-1.1.117}/src/p3lib/file_io.py +0 -0
- {p3lib-1.1.116 → p3lib-1.1.117}/src/p3lib/gnome_desktop_app.py +0 -0
- {p3lib-1.1.116 → p3lib-1.1.117}/src/p3lib/helper.py +0 -0
- {p3lib-1.1.116 → p3lib-1.1.117}/src/p3lib/json_networking.py +0 -0
- {p3lib-1.1.116 → p3lib-1.1.117}/src/p3lib/login.html +0 -0
- {p3lib-1.1.116 → p3lib-1.1.117}/src/p3lib/mqtt_rpc.py +0 -0
- {p3lib-1.1.116 → p3lib-1.1.117}/src/p3lib/netif.py +0 -0
- {p3lib-1.1.116 → p3lib-1.1.117}/src/p3lib/netplotly.py +0 -0
- {p3lib-1.1.116 → p3lib-1.1.117}/src/p3lib/pconfig.py +0 -0
- {p3lib-1.1.116 → p3lib-1.1.117}/src/p3lib/ssh.py +0 -0
- {p3lib-1.1.116 → p3lib-1.1.117}/src/p3lib/table_plot.py +0 -0
- {p3lib-1.1.116 → p3lib-1.1.117}/src/p3lib/uio.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: p3lib
|
3
|
-
Version: 1.1.
|
3
|
+
Version: 1.1.117
|
4
4
|
Summary: A group of python modules for networking, plotting data, config storage, automating boot scripts, ssh access and user input output.
|
5
5
|
Home-page: https://github.com/pjaos/p3lib
|
6
6
|
License: MIT
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "p3lib"
|
3
|
-
version = "1.1.
|
3
|
+
version = "1.1.117"
|
4
4
|
description = "A group of python modules for networking, plotting data, config storage, automating boot scripts, ssh access and user input output."
|
5
5
|
authors = ["Paul Austen <pjaos@gmail.com>"]
|
6
6
|
license = "MIT License"
|
@@ -12,6 +12,7 @@ import platform
|
|
12
12
|
from time import sleep
|
13
13
|
from queue import Queue
|
14
14
|
from time import time, strftime, localtime
|
15
|
+
from pathlib import Path
|
15
16
|
|
16
17
|
from p3lib.helper import getProgramVersion
|
17
18
|
|
@@ -836,3 +837,84 @@ class YesNoDialog(object):
|
|
836
837
|
def close(self):
|
837
838
|
"""@brief Close the boolean dialog."""
|
838
839
|
self._dialog.close()
|
840
|
+
|
841
|
+
class local_file_picker(ui.dialog):
|
842
|
+
"""@brief Allows the user to select local files and folders.
|
843
|
+
This is is a slight change on https://github.com/zauberzeug/nicegui/blob/main/examples/local_file_picker/local_file_picker.py"""
|
844
|
+
|
845
|
+
def __init__(self,
|
846
|
+
directory: str,
|
847
|
+
*,
|
848
|
+
upper_limit: str = None,
|
849
|
+
multiple: bool = False,
|
850
|
+
show_hidden_files: bool = False) -> None:
|
851
|
+
"""Local File Picker
|
852
|
+
|
853
|
+
This is a simple file picker that allows you to select a file from the local filesystem where NiceGUI is running.
|
854
|
+
|
855
|
+
:param directory: The directory to start in.
|
856
|
+
:param upper_limit: The directory to stop at (None: no limit, default: same as the starting directory).
|
857
|
+
:param multiple: Whether to allow multiple files to be selected.
|
858
|
+
:param show_hidden_files: Whether to show hidden files.
|
859
|
+
"""
|
860
|
+
super().__init__()
|
861
|
+
|
862
|
+
self.path = Path(directory).expanduser()
|
863
|
+
if upper_limit is None:
|
864
|
+
self.upper_limit = None
|
865
|
+
else:
|
866
|
+
self.upper_limit = Path(directory if upper_limit == ... else upper_limit).expanduser()
|
867
|
+
self.show_hidden_files = show_hidden_files
|
868
|
+
|
869
|
+
with self, ui.card():
|
870
|
+
self.add_drives_toggle()
|
871
|
+
self.grid = ui.aggrid({
|
872
|
+
'columnDefs': [{'field': 'name', 'headerName': 'File'}],
|
873
|
+
'rowSelection': 'multiple' if multiple else 'single',
|
874
|
+
}, html_columns=[0]).classes('w-96').classes('h-96').on('cellDoubleClicked', self.handle_double_click)
|
875
|
+
with ui.row().classes('w-full justify-end'):
|
876
|
+
self._select_folder_checkbox = ui.switch('Select Folder')
|
877
|
+
#self._select_folder_checkbox = ui.checkbox('Folder')
|
878
|
+
self._select_folder_checkbox.tooltip("Select this if you wish to select a folder.")
|
879
|
+
ui.button('Cancel', on_click=self.close).props('outline')
|
880
|
+
|
881
|
+
self.update_grid()
|
882
|
+
|
883
|
+
def add_drives_toggle(self):
|
884
|
+
if platform.system() == 'Windows':
|
885
|
+
import win32api
|
886
|
+
drives = win32api.GetLogicalDriveStrings().split('\000')[:-1]
|
887
|
+
self.drives_toggle = ui.toggle(drives, value=drives[0], on_change=self.update_drive)
|
888
|
+
|
889
|
+
def update_drive(self):
|
890
|
+
self.path = Path(self.drives_toggle.value).expanduser()
|
891
|
+
self.update_grid()
|
892
|
+
|
893
|
+
def update_grid(self) -> None:
|
894
|
+
paths = list(self.path.glob('*'))
|
895
|
+
if not self.show_hidden_files:
|
896
|
+
paths = [p for p in paths if not p.name.startswith('.')]
|
897
|
+
paths.sort(key=lambda p: p.name.lower())
|
898
|
+
paths.sort(key=lambda p: not p.is_dir())
|
899
|
+
|
900
|
+
self.grid.options['rowData'] = [
|
901
|
+
{
|
902
|
+
'name': f'📁 <strong>{p.name}</strong>' if p.is_dir() else p.name,
|
903
|
+
'path': str(p),
|
904
|
+
}
|
905
|
+
for p in paths
|
906
|
+
]
|
907
|
+
if (self.upper_limit is None and self.path != self.path.parent) or \
|
908
|
+
(self.upper_limit is not None and self.path != self.upper_limit):
|
909
|
+
self.grid.options['rowData'].insert(0, {
|
910
|
+
'name': '📁 <strong>..</strong>',
|
911
|
+
'path': str(self.path.parent),
|
912
|
+
})
|
913
|
+
self.grid.update()
|
914
|
+
|
915
|
+
def handle_double_click(self, e) -> None:
|
916
|
+
self.path = Path(e.args['data']['path'])
|
917
|
+
if self.path.is_dir() and not self._select_folder_checkbox.value:
|
918
|
+
self.update_grid()
|
919
|
+
else:
|
920
|
+
self.submit([str(self.path)])
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|