-
Notifications
You must be signed in to change notification settings - Fork 5
/
BaseCommand.py
36 lines (27 loc) · 937 Bytes
/
BaseCommand.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import sys
if sys.version_info < (3,):
from lib.thread_progress import ThreadProgress
from lib.show_error import *
from lib.command_setup import command_setup
from lib.printer import p
else:
from .lib.thread_progress import ThreadProgress
from .lib.show_error import *
from .lib.command_setup import command_setup
from .lib.printer import p
class BaseCommand():
def run(self, modifier='', edit=None):
setup_was_successful = command_setup(self)
if not setup_was_successful:
p('Setup was not successful')
if modifier:
self.view.modifier = modifier
else:
self.view.modifier = None
if edit:
self.view.edit = edit
return setup_was_successful
def init_thread(self, Thread, progress_message):
thread = Thread(self)
thread.start()
ThreadProgress(thread, progress_message, '')