Remove obsolete implementation and simplify project structure
This commit is contained in:
57
src/anyimage/preferences.py
Normal file
57
src/anyimage/preferences.py
Normal file
@@ -0,0 +1,57 @@
|
||||
import bpy
|
||||
|
||||
from .runtime import DEFAULT_STORAGE_ROOT, runtime
|
||||
from .properties import device_enum_items
|
||||
|
||||
|
||||
class AnyImagePreferences(bpy.types.AddonPreferences):
|
||||
bl_idname = __package__
|
||||
|
||||
storage_root: bpy.props.StringProperty(
|
||||
name="Storage Root",
|
||||
description=(
|
||||
"Shared user-writable storage for the environment, models and jobs; "
|
||||
"all Blender versions can use the same directory"
|
||||
),
|
||||
subtype="DIR_PATH",
|
||||
default=str(DEFAULT_STORAGE_ROOT),
|
||||
)
|
||||
device: bpy.props.EnumProperty(
|
||||
name="Device",
|
||||
description=(
|
||||
"Inference device used by production tasks; only devices supported "
|
||||
"on this machine are listed"
|
||||
),
|
||||
items=device_enum_items,
|
||||
default=0,
|
||||
)
|
||||
|
||||
def draw(self, _context):
|
||||
layout = self.layout
|
||||
layout.prop(self, "storage_root")
|
||||
layout.prop(self, "device")
|
||||
layout.separator()
|
||||
layout.label(text=f"Environment: {runtime.environment_directory()}")
|
||||
if runtime.environment_ready():
|
||||
layout.label(text="Environment is installed", icon="CHECKMARK")
|
||||
else:
|
||||
install_row = layout.row()
|
||||
install_row.enabled = runtime.active_job is None
|
||||
install_row.operator(
|
||||
"anyimage.install_environment",
|
||||
text="Install Environment",
|
||||
icon="IMPORT",
|
||||
)
|
||||
mirror_row = layout.row()
|
||||
mirror_row.enabled = runtime.active_job is None
|
||||
mirror_row.operator(
|
||||
"anyimage.install_environment_mirror",
|
||||
text="Install Environment (Mirror)",
|
||||
icon="IMPORT",
|
||||
)
|
||||
layout.separator()
|
||||
layout.operator(
|
||||
"anyimage.open_server_log",
|
||||
text="Open Server Log",
|
||||
icon="TEXT",
|
||||
)
|
||||
Reference in New Issue
Block a user