Skip to content

Commit 18c0f7e

Browse files
apps: added tlogg to the monorepo
1 parent 0984b73 commit 18c0f7e

31 files changed

Lines changed: 2323 additions & 3 deletions

.vscode/launch.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,17 @@
116116
"PYTHONPATH": "./apps/ttkode"
117117
}
118118
},
119+
{
120+
"name": "py Debug: Module tlogg",
121+
"type": "debugpy",
122+
"request": "launch",
123+
"module": "tlogg",
124+
"console": "integratedTerminal",
125+
"justMyCode": true,
126+
"env": {
127+
"PYTHONPATH": "./apps/tlogg"
128+
}
129+
},
119130
{
120131
"name": "Python: Demo",
121132
"type": "debugpy",

apps/tlogg/Makefile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
.PHONY: doc runGittk runDemo build deploy buildTest deployTest
2+
3+
.venv:
4+
python3 -m venv .venv
5+
. .venv/bin/activate ; \
6+
pip install -r docs/requirements.txt
7+
# Regen requirements;
8+
# pip freeze > docs/requirements.txt
9+
10+
build: .venv
11+
. .venv/bin/activate ; \
12+
rm -rf dist ; \
13+
tools/prepareBuild.sh release ; \
14+
cd tmp ; \
15+
python3 -m build
16+
17+
buildTest: .venv
18+
. .venv/bin/activate ; \
19+
rm -rf dist ; \
20+
tools/prepareBuild.sh test ; \
21+
cd tmp ; \
22+
python3 -m build ;
23+
24+
deployTest: .venv
25+
. .venv/bin/activate ; \
26+
python3 -m twine upload --repository testpypi tmp/dist/* --verbose
27+
28+
deploy: .venv
29+
. .venv/bin/activate ; \
30+
python3 -m twine upload tmp/dist/* --repository tlogg --verbose
31+
32+
#test: .venv
33+
# . .venv/bin/activate ; \
34+
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude .venv,build,tmp ; \
35+
# pytest demo/demo.py

apps/tlogg/README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
![Linux](https://img.shields.io/badge/-Linux-grey?logo=linux)
2+
![Usage](https://img.shields.io/badge/Usage-Terminal%20User%20Interface-yellow)
3+
![Python](https://img.shields.io/badge/Python-v3.8%5E-green?logo=python)
4+
![tlogg_version](https://img.shields.io/github/v/tag/ceccopierangiolieugenio/tlogg?label=version)
5+
[![pypi_version](https://img.shields.io/pypi/v/tlogg?label=pypi)](https://pypi.org/project/tlogg)
6+
[![pypi_version](https://img.shields.io/twitter/follow/Pier95886803?style=social&logo=twitter)](https://twitter.com/hashtag/pyTermTk?src=hashtag_click&f=live)
7+
8+
# tlogg
9+
A fast, advanced [text-based](https://en.wikipedia.org/wiki/Text-based_user_interface) log explorer written in [pyTermTk](https://github.com/ceccopierangiolieugenio/pyTermTk), inspired by [glogg - the fast, smart log explorer](https://github.com/nickbnf/glogg) and [klogg - Faster log explorer](https://klogg.filimonov.dev)(fork of glogg)
10+
11+
[![screenshot](https://raw.githubusercontent.com/ceccopierangiolieugenio/binaryRepo/master/tlogg/screenshot.003.png)](https://pypi.org/project/tlogg)
12+
## Features
13+
- Search Panel
14+
- Highlight
15+
- Bookmarks
16+
- Shiny ASCII Red Peppers
17+
18+
[![screenshot](https://raw.githubusercontent.com/ceccopierangiolieugenio/binaryRepo/master/tlogg/demo.001.gif)](https://pypi.org/project/tlogg)
19+
20+
- _Draggable_ **Tiling tabs**
21+
22+
[screenshot](https://github.com/ceccopierangiolieugenio/tlogg/assets/8876552/b3db13d9-48b4-485e-bc19-d655021479b6)
23+
24+
# Install from [pypi](https://pypi.org/project/tlogg)
25+
```bash
26+
pip install tlogg
27+
```
28+
## Enable the system Clipboard
29+
[pyTermTk](https://github.com/ceccopierangiolieugenio/pyTermTk) automatically support the system clipboard through [pyperclip](https://pypi.org/project/pyperclip/)
30+
```bash
31+
pip install pyperclip
32+
```
33+
# QuickRun
34+
```bash
35+
$ tlogg -h
36+
usage: tlogg [-h] [-c C] filename [filename ...]
37+
38+
positional arguments:
39+
filename the filename/s
40+
41+
optional arguments:
42+
-h, --help show this help message and exit
43+
-c C config folder (default: "/home/user/.config/tlogg")
44+
```
45+
46+
# Test
47+
### Clone
48+
```bash
49+
git clone https://github.com/ceccopierangiolieugenio/tlogg.git
50+
cd tlogg
51+
```
52+
### Run
53+
```
54+
python3 -m tlogg <File/s>
55+
```
56+

apps/tlogg/pyproject.toml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
[build-system]
2+
requires = ["setuptools>=45", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "tlogg"
7+
dynamic = ["version"]
8+
readme = {file = "README.md", content-type = "text/markdown"}
9+
authors = [
10+
{name = "Eugenio Parodi", email = "ceccopierangiolieugenio@googlemail.com"},
11+
]
12+
description = "A fast, advanced log explorer"
13+
requires-python = ">=3.9"
14+
license = {text = "MIT"}
15+
classifiers = [
16+
"Programming Language :: Python :: 3",
17+
"License :: OSI Approved :: MIT License",
18+
"Operating System :: OS Independent",
19+
"Development Status :: 3 - Alpha",
20+
"Environment :: Console",
21+
"Intended Audience :: Developers",
22+
"Intended Audience :: Information Technology",
23+
"Topic :: Terminals",
24+
"Topic :: Software Development :: User Interfaces",
25+
]
26+
dependencies = [
27+
'pyTermTk>=0.41.17-a.0',
28+
'appdirs',
29+
'copykitten',
30+
'pyyaml'
31+
]
32+
33+
[project.urls]
34+
Homepage = "https://github.com/ceccopierangiolieugenio/pyTermTk/tree/main/apps/tlogg"
35+
Repository = "https://github.com/ceccopierangiolieugenio/pyTermTk.git"
36+
Issues = "https://github.com/ceccopierangiolieugenio/pyTermTk/issues"
37+
Changelog = "https://github.com/ceccopierangiolieugenio/pyTermTk/blob/main/apps/tlogg/CHANGELOG.md"
38+
39+
[project.scripts]
40+
tlogg = "tlogg.__main__:main"
41+
42+
[tool.setuptools]
43+
packages = ["tlogg", "tlogg.app", "tlogg.plugins"]
44+
45+
[tool.setuptools.dynamic]
46+
version = {attr = "tlogg.__version__"}

apps/tlogg/tlogg/__init__.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# MIT License
2+
#
3+
# Copyright (c) 2021 Eugenio Parodi <ceccopierangiolieugenio AT googlemail DOT com>
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in all
13+
# copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
# SOFTWARE.
22+
23+
__version__:str = '0.2.7-a.3'
24+
25+
from .plugin import TloggPlugin
26+
from .proxy import tloggProxy, TloggViewerProxy
27+
from .helper import *

apps/tlogg/tlogg/__main__.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env python3
2+
3+
# MIT License
4+
#
5+
# Copyright (c) 2021 Eugenio Parodi <ceccopierangiolieugenio AT googlemail DOT com>
6+
#
7+
# Permission is hereby granted, free of charge, to any person obtaining a copy
8+
# of this software and associated documentation files (the "Software"), to deal
9+
# in the Software without restriction, including without limitation the rights
10+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
# copies of the Software, and to permit persons to whom the Software is
12+
# furnished to do so, subject to the following conditions:
13+
#
14+
# The above copyright notice and this permission notice shall be included in all
15+
# copies or substantial portions of the Software.
16+
#
17+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
# SOFTWARE.
24+
25+
from .app import main
26+
27+
if __name__ == '__main__':
28+
main()

apps/tlogg/tlogg/app/__init__.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
#!/usr/bin/env python3
3+
4+
# MIT License
5+
#
6+
# Copyright (c) 2021 Eugenio Parodi <ceccopierangiolieugenio AT googlemail DOT com>
7+
#
8+
# Permission is hereby granted, free of charge, to any person obtaining a copy
9+
# of this software and associated documentation files (the "Software"), to deal
10+
# in the Software without restriction, including without limitation the rights
11+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
# copies of the Software, and to permit persons to whom the Software is
13+
# furnished to do so, subject to the following conditions:
14+
#
15+
# The above copyright notice and this permission notice shall be included in all
16+
# copies or substantial portions of the Software.
17+
#
18+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24+
# SOFTWARE.
25+
26+
from .cfg import *
27+
from .glbl import *
28+
from .main import *

apps/tlogg/tlogg/app/about.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/usr/bin/env python3
2+
3+
# MIT License
4+
#
5+
# Copyright (c) 2021 Eugenio Parodi <ceccopierangiolieugenio AT googlemail DOT com>
6+
#
7+
# Permission is hereby granted, free of charge, to any person obtaining a copy
8+
# of this software and associated documentation files (the "Software"), to deal
9+
# in the Software without restriction, including without limitation the rights
10+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
# copies of the Software, and to permit persons to whom the Software is
12+
# furnished to do so, subject to the following conditions:
13+
#
14+
# The above copyright notice and this permission notice shall be included in all
15+
# copies or substantial portions of the Software.
16+
#
17+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
# SOFTWARE.
24+
25+
__all__ = ['About']
26+
27+
from TermTk.TTkCore.log import TTkLog
28+
from TermTk.TTkCore.color import TTkColor
29+
from TermTk import TTkAbout, TTkWindow
30+
from .cfg import TloggCfg
31+
32+
class About(TTkAbout):
33+
tlogg = [
34+
" __ ___ ",
35+
"/\ \__/\_ \ ",
36+
"\ \ ,_\//\ \ ___ __ __ ",
37+
" \ \ \/ \ \ \ / __`\ /'_ `\ /'_ `\ ",
38+
" \ \ \_ \_\ \_/\ \L\ \/\ \L\ \/\ \L\ \ ",
39+
" \ \__\/\____\ \____/\ \____ \ \____ \ ",
40+
" \/__/\/____/\/___/ \/___L\ \/___L\ \\",
41+
" /\____/ /\____/",
42+
" \_/__/ \_/__/ "]
43+
44+
__slots__=('_image')
45+
def __init__(self, *args, **kwargs):
46+
TTkAbout.__init__(self, *args, **kwargs)
47+
self._name = kwargs.get('name' , 'About' )
48+
self.setTitle('[PierCecco Cecco] Eugenio Parodi proudly presents...')
49+
self.resize(56,16)
50+
51+
52+
53+
def paintEvent(self, canvas):
54+
c = [0xFF,0xFF,0xFF]
55+
for y, line in enumerate(About.tlogg):
56+
canvas.drawText(pos=(13,3+y),text=line, color=TTkColor.fg(f'#{c[0]:02X}{c[1]:02X}{c[2]:02X}'))
57+
c[2]-=0x18
58+
c[0]-=0x08
59+
canvas.drawText(pos=(26,4),text=f" Version: {TloggCfg.version}", color=TTkColor.fg('#AAAAFF'))
60+
canvas.drawText(pos=(14,11),text=f"Powered By, pyTermTk")
61+
canvas.drawText(pos=(2,13),text=f"https://github.com/ceccopierangiolieugenio/tlogg", color=TTkColor.fg('#44FFFF'))
62+
canvas.drawText(pos=(2,14),text=f"https://github.com/ceccopierangiolieugenio/pyTermTk", color=TTkColor.fg('#44FFFF'))
63+
64+
TTkWindow.paintEvent(self, canvas)

apps/tlogg/tlogg/app/cfg.py

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/usr/bin/env python3
2+
3+
# MIT License
4+
#
5+
# Copyright (c) 2021 Eugenio Parodi <ceccopierangiolieugenio AT googlemail DOT com>
6+
#
7+
# Permission is hereby granted, free of charge, to any person obtaining a copy
8+
# of this software and associated documentation files (the "Software"), to deal
9+
# in the Software without restriction, including without limitation the rights
10+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
# copies of the Software, and to permit persons to whom the Software is
12+
# furnished to do so, subject to the following conditions:
13+
#
14+
# The above copyright notice and this permission notice shall be included in all
15+
# copies or substantial portions of the Software.
16+
#
17+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
# SOFTWARE.
24+
25+
__all__ = ['TloggCfg']
26+
27+
import os
28+
import yaml
29+
30+
from .. import __version__
31+
32+
class TloggCfg:
33+
version=__version__
34+
name="tlogg"
35+
cfgVersion = '1.0'
36+
pathCfg="."
37+
colors=[]
38+
filters=[]
39+
options={}
40+
searches=[]
41+
maxsearches=200
42+
43+
@staticmethod
44+
def save(searches=True, filters=True, colors=True, options=True):
45+
os.makedirs(TloggCfg.pathCfg, exist_ok=True)
46+
colorsPath = os.path.join(TloggCfg.pathCfg,'colors.yaml')
47+
filtersPath = os.path.join(TloggCfg.pathCfg,'filters.yaml')
48+
optionsPath = os.path.join(TloggCfg.pathCfg,'options.yaml')
49+
searchesPath = os.path.join(TloggCfg.pathCfg,'searches.yaml')
50+
51+
def writeCfg(path, cfg):
52+
fullCfg = {
53+
'version':TloggCfg.cfgVersion,
54+
'cfg':cfg }
55+
with open(path, 'w') as f:
56+
yaml.dump(fullCfg, f, sort_keys=False, default_flow_style=False)
57+
58+
if colors: writeCfg(colorsPath, TloggCfg.colors)
59+
if filters: writeCfg(filtersPath, TloggCfg.filters)
60+
if options: writeCfg(optionsPath, TloggCfg.options)
61+
if searches: writeCfg(searchesPath, TloggCfg.searches)
62+
63+
@staticmethod
64+
def load():
65+
colorsPath = os.path.join(TloggCfg.pathCfg,'colors.yaml')
66+
filtersPath = os.path.join(TloggCfg.pathCfg,'filters.yaml')
67+
optionsPath = os.path.join(TloggCfg.pathCfg,'options.yaml')
68+
searchesPath = os.path.join(TloggCfg.pathCfg,'searches.yaml')
69+
70+
if os.path.exists(colorsPath):
71+
with open(colorsPath) as f:
72+
TloggCfg.colors = yaml.load(f, Loader=yaml.SafeLoader)['cfg']
73+
if os.path.exists(filtersPath):
74+
with open(filtersPath) as f:
75+
TloggCfg.filters = yaml.load(f, Loader=yaml.SafeLoader)['cfg']
76+
if os.path.exists(optionsPath):
77+
with open(optionsPath) as f:
78+
TloggCfg.options = yaml.load(f, Loader=yaml.SafeLoader)['cfg']
79+
if os.path.exists(searchesPath):
80+
with open(searchesPath) as f:
81+
TloggCfg.searches = yaml.load(f, Loader=yaml.SafeLoader)['cfg']

0 commit comments

Comments
 (0)