-
Notifications
You must be signed in to change notification settings - Fork 5
/
em_setup.py
166 lines (137 loc) · 5.61 KB
/
em_setup.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
import bpy
from .functions import *
from bpy.types import Operator
from bpy.types import Menu, Panel, UIList, PropertyGroup
from . import sqlite_io
from .__init__ import get_bl_info
#####################################################################
#SETUP MENU
class EM_SetupPanel:
#devel_version = bpy.context.preferences.addons["EM-blender-tools"].bl_info.get('devel_version', 'Unknown version')
#bl_label = f"EM setup {devel_version}"
bl_info = get_bl_info()
devel_version = bl_info.get('devel_version', 'Unknown version')
bl_label = "EM setup " + devel_version
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
def draw(self, context):
layout = self.layout
scene = context.scene
em_settings = scene.em_settings
obj = context.object
if len(scene.em_list) > 0:
is_em_list = True
else:
is_em_list = False
row = layout.row(align=True)
split = row.split()
col = split.column()
col.label(text="EM file")
if scene.EM_file:
col = split.column(align=True)
if is_em_list:
button_load_text = 'Reload'
button_load_icon = 'FILE_REFRESH'
else:
button_load_text = 'Load'
button_load_icon = 'IMPORT'
col.operator("import.em_graphml", icon= button_load_icon, text=button_load_text)
else:
col.label(text="Select a GraphML file below", icon='SORT_ASC')
#row = layout.row()
if is_em_list:
col = split.column(align=True)
op = col.operator("list_icon.update", icon="PRESET", text='Refresh')
op.list_type = "all"
row = layout.row(align=True)
row.prop(context.scene, 'EM_file', toggle = True, text ="")
############# box con le statistiche del file ##################
box = layout.box()
row = box.row(align=True)
#row = layout.row(align=True)
split = row.split()
col = split.column()
col.label(text="US/USV")
#col = split.column()
col.prop(scene, "em_list", text='')
col = split.column()
col.label(text="Periods")
#col = split.column()
col.prop(scene, "epoch_list", text='')
col = split.column()
col.label(text="Properties")
#col = split.column()
col.prop(scene, "em_properties_list", text='')
col = split.column()
col.label(text="Sources")
#col = split.column()
col.prop(scene, "em_sources_list", text='')
################ da qui setto la cartella DosCo ##################
row = layout.row(align=True)
box = layout.box()
row = box.row()
row.prop(context.scene, 'EMDosCo_dir', toggle = True, text ="DosCo")
em_settings = bpy.context.window_manager.em_addon_settings
row.prop(em_settings, "dosco_advanced_options", text="advanced options")
if em_settings.dosco_advanced_options:
row = box.row()
row.label(text="Populate extractors, documents and combiners using DosCo files:")
row = box.row()
row.prop(em_settings, 'overwrite_url_with_dosco_filepath', text = "Overwrite paths")
row.prop(em_settings, 'preserve_web_url', text = "Preserve web urls (if any)")
#preserve_web_url = settings.preserve_web_url
#overwrite_url_with_dosco_filepath = settings.overwrite_url_with_dosco_filepath
# Ora puoi utilizzare `preserve_web_url` e `overwrite_url_with_dosco_filepath` nel tuo addon
################ da qui setto la lista delle sources ##################
row = layout.row()
box = layout.box()
row = box.row()
row.label(text="Source file (xlsx)")
row.operator("load.emdb_xlsx", icon="STICKY_UVS_DISABLE", text='')
row.operator("open_prefs_panel.em_tools", icon="SETTINGS", text="")
row = box.row()
row.prop(scene, "EMdb_xlsx_filepath", text="")
################ da qui porzione di pannello per EMdb #####################
row = layout.row(align=True)
box = layout.box()
row = box.row()
db_type_current = scene.current_db_type
split = row.split()
col = split.column()
col.label(text="EMdb file")
col = split.column(align=True)
op = col.operator("import.emdb_sqlite", icon= 'IMPORT', text='Import')
op.db_type = db_type_current
col = split.column(align=True)
col.menu(sqlite_io.EMdb_type_menu.bl_idname, text=db_type_current, icon='COLOR')
row = box.row()
#row = layout.row(align=True)
row.prop(context.scene, 'EMdb_file', toggle = True, text ="")
class VIEW3D_PT_SetupPanel(Panel, EM_SetupPanel):
bl_category = "EM"
bl_idname = "VIEW3D_PT_SetupPanel"
bl_context = "objectmode"
#SETUP MENU
#####################################################################
classes = [
VIEW3D_PT_SetupPanel]
def register():
for cls in classes:
bpy.utils.register_class(cls)
bpy.types.Scene.EMdb_file = StringProperty(
name = "EM db file",
default = "",
description = "Define the path to the EM db (sqlite) file",
subtype = 'FILE_PATH'
)
bpy.types.Scene.EMDosCo_dir = StringProperty(
name = "EM DosCo folder",
default = "",
description = "Define the path to the EM DosCo folder",
subtype = 'DIR_PATH'
)
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
del bpy.types.Scene.EMdb_file
del bpy.types.Scene.EMDosCo_dir