-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathlogik_projekt.py
executable file
·240 lines (193 loc) · 7.92 KB
/
logik_projekt.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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
#
# -------------------------------------------------------------------------- #
# DISCLAIMER: This file is part of LOGIK-PROJEKT.
# Copyright © 2024 man-made-mekanyzms
# LOGIK-PROJEKT creates directories, files, scripts & tools
# for use with Autodesk Flame and other software.
# LOGIK-PROJEKT is free software.
# You can redistribute it and/or modify it under the terms
# of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License,
# or any later version.
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
# You should have received a copy of the GNU General
# Public License along with this program.
# If not, see <https://www.gnu.org/licenses/>.
# Contact: [email protected]
# -------------------------------------------------------------------------- #
# File Name: logik_projekt.py
# Version: 1.9.9
# Created: 2024-01-19
# Modified: 2024-12-25
# ========================================================================== #
# This section defines the import statements and directory paths.
# ========================================================================== #
# Standard library imports
import argparse
import ast
import base64
import collections
import datetime
import getpass
import grp
import importlib
import io
import json
import os
import platform
import re
import shutil
import socket
import subprocess
import sys
import unittest
import xml
# -------------------------------------------------------------------------- #
def get_base_path():
if getattr(sys, 'frozen', False):
return sys._MEIPASS
else:
return os.path.abspath(
os.path.join(
os.path.dirname(__file__)
)
)
# -------------------------------------------------------------------------- #
def get_resource_path(relative_path):
base_path = get_base_path()
return os.path.join(
base_path,
relative_path
)
# -------------------------------------------------------------------------- #
# Set the path to the 'modules' directory
modules_dir = get_resource_path('modules')
# Set the path to the 'resources' directory
resources_dir = get_resource_path('resources')
# Append the modules path to the system path
if modules_dir not in sys.path:
sys.path.append(modules_dir)
# ========================================================================== #
# This section defines third party imports.
# ========================================================================== #
from modules.widgets.layout.layout_main import LayoutMain
from PySide6.QtWidgets import QApplication
from PySide6.QtCore import QProcess
# ========================================================================== #
# This section defines environment specific variables.
# ========================================================================== #
# These paths should be passed from the main app.
the_hostname = "delta"
the_projekt_os = "Linux"
the_software_version = "flame_2025.1.pr199"
the_sanitized_version = "2025_1"
the_framestore = "stonefs"
'''
Print the variables for debugging
print(f" Debug: the_hostname: {the_hostname}")
print(f" Debug: the_projekt_os: {the_projekt_os}")
print(f" Debug: the_software_version: {the_software_version}")
print(f" Debug: the_sanitized_version: {the_sanitized_version}")
'''
# ========================================================================== #
# This section defines common paths.
# ========================================================================== #
projekt_roots_config_path = os.path.join(
resources_dir,
'cfg',
'projekt_configuration',
'roots',
'projekt_roots.json'
)
# Read the JSON configuration file
try:
with open(projekt_roots_config_path, 'r') as config_file:
config = json.load(config_file)
except Exception as e:
print(f" Error reading JSON configuration file: {e}")
config = {}
# Define common directory paths
the_projekts_dir = config.get(
'the_projekts_dir',
"/PROJEKTS"
)
the_projekt_flame_dirs = config.get(
'the_projekt_flame_dirs',
"/opt/Autodesk/project"
)
the_adsk_dir = config.get(
'the_adsk_dir',
"/opt/Autodesk"
)
the_adsk_dir_linux = config.get(
'the_adsk_dir_linux',
"/opt/Autodesk"
)
the_adsk_dir_macos = config.get(
'the_adsk_dir_macos',
"/Applications/Autodesk"
)
'''
Print the variables for debugging
print(f" Debug: projekt_roots_config_path: {projekt_roots_config_path}")
print(f" Debug: the_projekts_dir: {the_projekts_dir}")
print(f" Debug: the_projekt_flame_dirs: {the_projekt_flame_dirs}")
print(f" Debug: the_adsk_dir: {the_adsk_dir}")
print(f" Debug: the_adsk_dir_linux: {the_adsk_dir_linux}")
print(f" Debug: the_adsk_dir_macos: {the_adsk_dir_macos}")
'''
# ========================================================================== #
# This section defines projekt specific paths.
# ========================================================================== #
# These paths should be passed from the main app.
the_projekt_name = "8888_new_job"
the_projekt_flame_name = f"{the_projekt_name}_{the_sanitized_version}_{the_hostname}"
separator = '# ' + '-' * 75 + ' #'
# ========================================================================== #
# This section defines how to handle the main script function.
# ========================================================================== #
if __name__ == "__main__":
# Create the application
app = QApplication(sys.argv)
# Create and show the main window
main_window = LayoutMain()
main_window.show()
# Run the event loop
sys.exit(app.exec())
# ========================================================================== #
# C2 A9 32 30 32 34 2D 4D 41 4E 2D 4D 41 44 45 2D 4D 45 4B 41 4E 59 5A 4D 53 #
# ========================================================================== #
# Changelist:
# -------------------------------------------------------------------------- #
# version: 0.0.1
# created: 2024-01-19 - 12:34:56
# comments: scripts to create flame projekts, presets & templates.
# -------------------------------------------------------------------------- #
# version: 0.1.0
# modified: 2024-04-20 - 16:20:00
# comments: refactored monolithic program into separate functions.
# -------------------------------------------------------------------------- #
# version: 0.5.0
# modified: 2024-05-24 - 20:24:00
# comments: merged flame_colortoolkit with projekt.
# -------------------------------------------------------------------------- #
# version: 0.6.0
# modified: 2024-05-25 - 15:00:03
# comments: started conversion to python3.
# -------------------------------------------------------------------------- #
# version: 0.7.0
# modified: 2024-06-21 - 18:21:03
# comments: started gui design with pyside6.
# -------------------------------------------------------------------------- #
# version: 0.9.9
# modified: 2024-08-31 - 16:51:09
# comments: prep for release - code appears to be functional
# -------------------------------------------------------------------------- #
# version: 1.9.9
# modified: 2024-12-25 - 09:50:12
# comments: Preparation for future features
# -------------------------------------------------------------------------- #