-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMinion.py
161 lines (143 loc) · 6.53 KB
/
Minion.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
'''
******************************************************************************************
Assembly: BudgetPy
Filename: Minion.py
Author: Terry D. Eppler
Created: 05-31-2023
Last Modified By: Terry D. Eppler
Last Modified On: 06-01-2023
******************************************************************************************
<copyright file="Minion.py" company="Terry D. Eppler">
This is a Federal Budget, Finance, and Accounting application.
Copyright © 2024 Terry Eppler
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”),
to deal in the Software without restriction,
including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
You can contact me at: [email protected] or [email protected]
</copyright>
<summary>
Minion.py
</summary>
******************************************************************************************
'''
import subprocess as sp
from Booger import *
from Static import Client
class App( ):
'''
Constructor:
App( client: enum )
Purpose:
Class defines object providing factory methods run( ) and run( args ) that run
processes based on 'Client' enumeration input args
'''
def __init__( self, client: Client ):
self.app = client
self.sqlite = r'db\sqlite\gui\SQLiteDatabaseBrowserPortable.exe'
self.access = r'C:\Program Files\Microsoft Office\root\Office16\MSACCESS.EXE'
self.excel = r'C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE'
self.edge = r'C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe'
self.chrome = r'C:\Program Files\Google\Chrome\Application\chrome.exe'
self.control_panel = r'C:\Windows\System32\control.exe'
self.calculator = r'C:\Windows\System32\calc.exe'
self.outlook = r'C:\Program Files\Microsoft Office\root\Office16\OUTLOOK.EXE'
self.pyscripter = r'db\python\PyScripter\PyScripter.exe'
self.task_manager = r'C:\Windows\System32\Taskmgr.exe'
self.storage = r'C:\Users\teppler\AppData\Local\Microsoft\OneDrive\OneDrive.exe'
self.word = r'C:\Program Files\Microsoft Office\root\Office16\WINWORD.EXE'
def __dir__( self ) -> list[ str ]:
return [ 'sqlite', 'access', 'excel', 'chrome',
'edge', 'control', 'calculator', 'task_manager',
'outlook', 'pyscripter', 'storage', 'word',
'run', 'run_args' ]
def run( self ):
'''
Purpose:
Parameters:
Returns:
'''
try:
if self.app == Client.SQLite:
sp.Popen( self.sqlite )
elif self.app == Client.Access:
sp.Popen( self.access )
elif self.app == Client.Excel:
sp.Popen( self.excel )
elif self.app == Client.Edge:
sp.Popen( self.edge )
elif self.app == Client.Chrome:
sp.Popen( self.chrome )
elif self.app == Client.ControlPanel:
sp.Popen( self.control_panel )
elif self.app == Client.Calculator:
sp.Popen( self.calculator )
elif self.app == Client.Outlook:
sp.Popen( self.outlook )
elif self.app == Client.Pyscripter:
sp.Popen( self.pyscripter )
elif self.app == Client.TaskManager:
sp.Popen( self.task_manager )
elif self.app == Client.Storage:
sp.Popen( self.storage )
elif self.app == Client.Word:
sp.Popen( self.word )
except Exception as e:
_exc = Error( e )
_exc.module = 'Minion'
_exc.cause = 'App'
_exc.method = 'run( self )'
_err = ErrorDialog( _exc )
_err.show( )
def run_args( self, args: str ):
'''
Purpose:
Parameters:
Returns:
'''
try:
if args is not None and self.app == Client.SQLite:
if os.path.isfile( args ):
sp.Popen( [ self.sqlite, args ] )
elif args is not None and self.app == Client.Access:
if os.path.isfile( args ):
sp.Popen( [ self.access, args ] )
elif args is not None and self.app == Client.Excel:
if os.path.isfile( args ):
sp.Popen( [ self.excel, args ] )
elif args is not None and self.app == Client.Edge:
sp.Popen( args )
elif args is not None and self.app == Client.Chrome:
sp.Popen( [ self.chrome, args ] )
elif args is not None and self.app == Client.Outlook:
sp.Popen( [ self.outlook, args ] )
elif args is not None and self.app == Client.Pyscripter:
sp.Popen( [ self.pyscripter, args ] )
elif args is not None and self.app == Client.Word:
sp.Popen( [ self.__word, args ] )
elif args is not None and self.app == Client.TaskManager:
sp.Popen( [ self.task_manager, args ] )
elif args is not None and self.app == Client.ControlPanel:
sp.Popen( [ self.control_panel, args ] )
elif args is not None and self.app == Client.Storage:
sp.Popen( [ self.storage, args ] )
except Exception as e:
_exc = Error( e )
_exc.module = 'Minion'
_exc.cause = 'App'
_exc.method = 'run_args( self, args )'
_err = ErrorDialog( _exc )
_err.show( )