Completed
Push — master ( e004f0...1a0efd )
by Daniel
01:07
created

ThreadPlugin   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 14
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __init__() 0 3 1
A deactivate() 0 2 1
A activate() 0 2 1
A thread_func() 0 3 1
1
from groundwork.patterns import GwThreadsPattern
2
3
4
class ThreadPlugin(GwThreadsPattern):
5
    def __init__(self, *args, **kwargs):
6
        self.name = self.__class__.__name__
7
        super().__init__(*args, **kwargs)
8
9
    def activate(self):
10
        self.threads.register("test_thread", self.thread_func, description="Test Thread")
11
12
    def thread_func(self, plugin, **kwargs):
13
        print("Thread executed by %s" % plugin.name)
14
        return "Done"
15
16
    def deactivate(self):
17
        pass
18