Skip to content

Commit b17d220

Browse files
authored
Merge pull request #41 from hANSIc99/dev
v1.3 ready
2 parents bb6862a + 8bd1889 commit b17d220

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1613
-273
lines changed

CHANGES.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
1.3
2+
3+
Scheduler for manual trigger added
4+
Possibility to control running state programatically added
5+
Telegram bot control element added
6+
7+
18
1.2
29

310
Templates added

Containerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# Full multi-processing and multi-threading capable.
1010
#
1111
#
12-
#CreationDate: 17.03.2021
12+
#CreationDate: 05.04.2021
1313
#Creator: Stephan Avenwedde
1414
#
1515
#
@@ -75,11 +75,11 @@ RUN /usr/bin/python3 -m pip install pylint==2.7.4
7575
###################################
7676

7777

78-
COPY dist/Pythonic-1.2.tar.gz /
78+
COPY dist/Pythonic-1.3.tar.gz /
7979

80-
RUN /usr/bin/python3 -m pip install /Pythonic-1.2.tar.gz
80+
RUN /usr/bin/python3 -m pip install /Pythonic-1.3.tar.gz
8181

82-
RUN rm Pythonic-1.2.tar.gz
82+
RUN rm Pythonic-1.3.tar.gz
8383

8484
###################################
8585
# #

DOKU.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
## Documentation
2+
3+
4+
### Basic Elements
5+
6+
#### Scheduler
7+
<img src="https://github.com/hANSIc99/Pythonic/blob/master/src/Pythonic/public_html/static/Scheduler.png" alt="Scheduler">
8+
9+
The *Scheduler* activates subsequent elements depending on the set schedule.
10+
11+
- Start subsequent elements
12+
- Start by hand
13+
- Optional: Autostart on startup
14+
15+
#### Generic Pipe
16+
<img src="https://github.com/hANSIc99/Pythonic/blob/master/src/Pythonic/public_html/static/GenericPipe.png" alt="Scheduler">
17+
18+
The *Generic Pipe* processes the input data and terminates immediately after completion.
19+
20+
Intendet use:
21+
- Simple data processing
22+
- Tranformation of data between two elements
23+
24+
#### Generic Process
25+
<img src="https://github.com/hANSIc99/Pythonic/blob/master/src/Pythonic/public_html/static/GenericProcess.png" alt="Scheduler">
26+
27+
The *Generic Process* executes an infinite loop. The executions stops when a stop signal is received or, in case of multiprocessing, when the process is killed.
28+
29+
**Attention**: Every time the element is triggered another instance of the *Generic Process* is created.
30+
31+
Intendet use:
32+
- Listener application
33+
- Waiting for external events (e.g. TCP/IP related)
34+
35+
#### Process Pipe
36+
<img src="https://github.com/hANSIc99/Pythonic/blob/master/src/Pythonic/public_html/static/ProcessPipe.png" alt="Scheduler">
37+
38+
The *Process Pipe* executes an infinite loop. In contrast to *Generic Process* additional activations of the *Process Pipe* element won't cause
39+
the creation of additional instances. The payload of subsequent activations can be processed within the loop.
40+
41+
Intendet use:
42+
- Stream processing
43+
- Long running processes
44+
- Machine learning
45+
- Feed process with varying data
46+

TODOS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ Check if the 'inline'-keyword can be applied to some loops
1313

1414
5)
1515
Add debugging capabilities to Docker image
16+
17+
DataClasses
18+
Check if DataClasses can be used (elementtypes.py)

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
src/code-server/download.sh
1212

1313
# BUILD CONTAINER IMAGE
14-
podman build -t pythonicautomation/pythonic:1.2 .
14+
podman build -t pythonicautomation/pythonic:1.3 .

dist/Pythonic-1.3.tar.gz

5.04 MB
Binary file not shown.

setup.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name = 'Pythonic',
8-
version = '1.02',
8+
version = '1.03',
99
author = 'Stephan Avenwedde',
1010
author_email = '[email protected]',
1111
license = 'GPLv3',
@@ -16,18 +16,25 @@
1616
packages = ['Pythonic', 'Pythonic.executables'],
1717
package_dir = { '' : 'src'},
1818
package_data = { '' :
19-
['public_html/static/GenericPipe.png',
19+
[
20+
'public_html/static/ManualScheduler.png',
21+
'public_html/static/Scheduler.png',
22+
'public_html/static/ManualStopProcess.png',
23+
'public_html/static/StopProcess.png',
24+
'public_html/static/GenericPipe.png',
2025
'public_html/static/GenericProcess.png',
2126
'public_html/static/ProcessPipe.png',
22-
'public_html/static/Scheduler.png',
27+
'public_html/static/Telegram.png',
2328
'public_html/static/python.ico',
2429
'public_html/static/qtlogo.svg',
2530
'public_html/static/qtloader.js',
2631
'public_html/static/*.js',
2732
'public_html/static/*.wasm',
2833
'public_html/static/*.data',
2934
'public_html/templates/*.html',
30-
'public_html/config/Toolbox/Basic/*'
35+
'public_html/config/Toolbox/Basic/*',
36+
'public_html/config/Toolbox/Connectivity/Telegram.editor',
37+
'public_html/config/Toolbox/Connectivity/0Telegram.json'
3138
]
3239
},
3340
entry_points = {
@@ -37,7 +44,8 @@
3744
install_requires = [
3845
'PySide2==5.14.2.3',
3946
'eventlet>=0.27.0',
40-
'debugpy==1.2.1'
47+
'debugpy==1.2.1',
48+
'python-telegram-bot==13.4.1'
4149
],
4250
classifiers = [
4351
'Programming Language :: Python :: 3.7',

src/Pythonic/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ source ~/Dokumente/emsdk/emsdk_env.sh # Version 1.39.8
55
~/Qt/5.15.1/wasm_32/bin/qmake
66
# Set WASM define
77
#make DEFINES="-DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_WEBSOCKETS_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DWASM"
8-
#make clean
8+
make clean
99
make
1010

1111
cp *.html public_html/static/
1212
cp *.wasm public_html/static/
1313
cp *.js public_html/static/
14-
cp *.data public_html/static/
14+
cp *.data public_html/static/

src/Pythonic/configio.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from PySide2.QtCore import QThread, QObject, Signal, QMutex
77

88

9-
109
class ExecSysCMD(QThread):
1110

1211
cmd = None
@@ -28,7 +27,6 @@ def run(self):
2827
os.system(self.cmd['Unix'])
2928

3029

31-
3230
class ConfigWriter(QThread):
3331

3432
config = None
@@ -164,7 +162,7 @@ def cleanupThreadList(self):
164162
x.editorLoaded.disconnect(self.fwrdCmd)
165163
x.finished.disconnect(self.cleanupThreadList)
166164
x.deleteLater()
167-
165+
168166

169167
class ToolboxLoader(QThread):
170168

@@ -181,6 +179,8 @@ def run(self):
181179
#toolDirs = [ f for f in os.scandir(os.path.join(self.cwd + self.www_config + '/Toolbox/')) if f.is_dir() ]
182180
toolDirs = [ f for f in os.scandir(self.toolBoxPath) if f.is_dir() ]
183181
elements = [(d, f) for d in toolDirs for f in os.listdir(d.path) if f.endswith('.json')]
182+
elements.sort(key=lambda record: record[1]) # sort elements alphabetical
183+
elements.sort(key=lambda record: record[0].name) # sort groups alphabetical
184184
elementsJSON = []
185185

186186
for d, f in elements:
@@ -205,7 +205,6 @@ def run(self):
205205
self.tooldataLoaded.emit(cmd)
206206

207207

208-
209208
class ConfigLoader(QThread):
210209

211210
configLoaded = Signal(object)

src/Pythonic/element_types.py

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import logging
2-
1+
import logging, pickle
2+
from pathlib import Path
33

44

55
class Function():
@@ -76,4 +76,72 @@ def __setstate__(self, state):
7676

7777
def __getstate__(self):
7878
#logging.debug('__getstate__() called Record')
79-
return(self.bStop, self.data)
79+
return(self.bStop, self.data)
80+
81+
82+
def storePersist(func):
83+
84+
def wrapper(self, *args, **kwargs):
85+
86+
func(self, *args, **kwargs)
87+
88+
with open(self.filename, 'wb') as f:
89+
try:
90+
pickle.dump(self.copy(), f)
91+
except Exception as e:
92+
pass
93+
94+
return wrapper
95+
96+
97+
class ListPersist(list):
98+
99+
def __init__(self, name: str) -> None:
100+
# BAUSTELLE
101+
self.filename = Path.home() / 'Pythonic' / 'executables' / '{}.obj'.format(name)
102+
103+
if self.filename.exists():
104+
105+
with open(self.filename, 'rb') as f:
106+
107+
data = pickle.load(f)
108+
super().extend(data)
109+
110+
111+
112+
def reload(self):
113+
114+
if self.filename.exists():
115+
116+
with open(self.filename, 'rb') as f:
117+
118+
data = pickle.load(f)
119+
super().clear()
120+
super().extend(data)
121+
return True
122+
123+
else:
124+
return False
125+
126+
127+
128+
129+
@storePersist
130+
def append(self, __object) -> None:
131+
return super().append(__object)
132+
133+
@storePersist
134+
def extend(self, __iterable) -> None:
135+
return super().extend(__iterable)
136+
137+
@storePersist
138+
def remove(self, __value) -> None:
139+
return super().remove(__value)
140+
141+
@storePersist
142+
def pop(self, __index: int):
143+
return super().pop(__index=__index)
144+
145+
@storePersist
146+
def clear(self) -> None:
147+
return super().clear()

0 commit comments

Comments
 (0)