[Bf-blender-cvs] [c3a83121717] soc-2020-info-editor: WIP Experimental: add basic UI/UX layout for log filtering
Mateusz GrzeliÅski
noreply at git.blender.org
Thu Aug 6 18:41:04 CEST 2020
Commit: c3a83121717ac2f5c3eb575165e92e3ffef7326f
Author: Mateusz Grzeliński
Date: Thu Aug 6 11:46:44 2020 +0200
Branches: soc-2020-info-editor
https://developer.blender.org/rBc3a83121717ac2f5c3eb575165e92e3ffef7326f
WIP Experimental: add basic UI/UX layout for log filtering
===================================================================
M release/scripts/startup/bl_ui/space_info.py
M release/scripts/startup/bl_ui/space_userpref.py
M source/blender/makesdna/DNA_space_types.h
M source/blender/makesrna/intern/rna_space.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_info.py b/release/scripts/startup/bl_ui/space_info.py
index 152bef10f92..b8569be0a3a 100644
--- a/release/scripts/startup/bl_ui/space_info.py
+++ b/release/scripts/startup/bl_ui/space_info.py
@@ -31,6 +31,7 @@ class INFO_HT_header(Header):
INFO_MT_editor_menus.draw_collapsible(context, layout)
row = layout.row(align=True)
row.prop(sinfo, "filter_text", text="")
+ row.prop(sinfo, "use_match_case", icon="SMALL_CAPS", text="")
layout.separator_spacer()
layout.separator_spacer()
@@ -138,10 +139,46 @@ class INFO_PT_report_type_visibility(Panel):
sinfo = context.space_data
- layout.label(text="Report Types Visibility")
- col = layout.column(align=True)
- col.prop(sinfo, "report_mask")
- layout.separator()
+ if sinfo.view == 'REPORTS':
+ layout.label(text="Report Types Visibility")
+ col = layout.column(align=True)
+ col.prop(sinfo, "report_mask")
+ layout.separator()
+ else:
+ layout.label(text="Filter Log Severity")
+ col = layout.column(align=True)
+ col.prop(sinfo, "log_severity_mask")
+ layout.separator()
+
+ box = layout.box()
+ row = box.row(align=True)
+ row.prop(sinfo, "use_log_file_line_filter", text="")
+ row.label(text="Filter File Line")
+ row.operator("preferences.autoexec_path_add", text="", icon='ADD', emboss=False)
+
+ box = layout.box()
+ row = box.row(align=True)
+ row.prop(sinfo, "use_log_type_filter", text="")
+ row.label(text="Filter Log Type")
+ row.operator("preferences.autoexec_path_add", text="", icon='ADD', emboss=False)
+
+ box = layout.box()
+ row = box.row(align=True)
+ row.prop(sinfo, "use_log_function_filter", text="")
+ row.label(text="Filter Log Function")
+ row.operator("preferences.autoexec_path_add", text="", icon='ADD', emboss=False)
+
+ # col = layout.column(align=True)
+ row = layout.row(align=True)
+ row.prop(sinfo, "use_log_level_filter", text="")
+ row.active = sinfo.use_log_level_filter
+ row.prop(sinfo, "filter_log_level", text="Max verbosity")
+
+ layout.label(text="Log Printing")
+ col = layout.column()
+ col.prop(sinfo, "log_format")
+ col.prop(sinfo, "use_short_file_line")
+ col.prop(sinfo, "use_log_message_new_line", text="Message In New Line")
classes = (
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 4aee07592e8..3bd6c72a674 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -647,6 +647,14 @@ class USERPREF_PT_system_video_sequencer(SystemPanel, CenterAlignMixIn, Panel):
class USERPREF_PT_system_logging(SystemPanel, CenterAlignMixIn, Panel):
bl_label = "Log & Debug"
+ def draw_header_preset(self, _context):
+ layout = self.layout
+ # TODO (grzelins) this is mocap:
+ layout.operator("preferences.studiolight_install", icon='IMPORT', text="Save*").type = 'WORLD'
+ layout.operator("preferences.studiolight_install", icon='IMPORT', text="Restore Default").type = 'WORLD'
+ layout.operator("preferences.studiolight_install", icon='PRESET', text="")
+ layout.separator()
+
def draw_centered(self, context, layout):
prefs = context.preferences
system = prefs.system
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 50da69d703f..2197885fcd8 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -102,6 +102,12 @@ enum {
/** \name Space Info
* \{ */
+/* SpaceInfo.filter_* */
+typedef struct SpaceInfoFilter {
+ struct SpaceInfoFilter *next, *prev;
+ char str_filter[256];
+} SpaceInfoFilter;
+
/* Info Header */
typedef struct SpaceInfo {
SpaceLink *next, *prev;
@@ -116,22 +122,67 @@ typedef struct SpaceInfo {
int active_report_index;
char search_string[64];
char view;
- char _pad1[7];
+ char use_match_case;
+ // char use_search_glob; // it can be default
+ char use_log_message_new_line;
+ char _pad1[5];
+
/* reports that were converted from CLOG */
ReportList *active_reports;
- // int clog_show;
+
+ int log_format;
+ char use_short_file_line;
+ /** for boolean properties use_log_*_filter */
+ char use_log_filter;
+ char _pad2[2];
+
+ int log_severity_mask;
+ int filter_log_level;
+
+ ListBase filter_log_file_line;
+ ListBase filter_log_type;
+ ListBase filter_log_function;
} SpaceInfo;
+/* SpaceInfo.use_log_filter */
+typedef enum eSpaceInfo_UseLogFilter {
+ INFO_FILTER_LOG_LEVEL = (1 << 0),
+ INFO_FILTER_FILE_LINE = (1 << 1),
+ INFO_FILTER_LOG_TYPE = (1 << 2),
+ INFO_FILTER_LOG_FUNCTION = (1 << 3),
+} eSpaceInfo_FilterMode;
+
+/* SpaceInfo.view */
typedef enum eSpaceInfo_View {
INFO_VIEW_REPORTS,
INFO_VIEW_CLOG,
} eSpaceInfo_View;
-/* SpaceInfo.clog_show */
-typedef enum eSpaceInfo_ClogShow {
- INFO_CLOG_SHOW_TIMESTAMP = (1 << 0),
- // ...
-} eSpaceInfo_ClogShow;
+/* SpaceInfo.log_severity_mask, keep in sync with CLG_Severity */
+typedef enum eSpaceInfo_LogSeverityMask {
+ INFO_CLOG_SEVERITY_DEBUG = (1 << 0),
+ INFO_CLOG_SEVERITY_VERBOSE = (1 << 1),
+ INFO_CLOG_SEVERITY_INFO = (1 << 2),
+ INFO_CLOG_SEVERITY_WARN = (1 << 3),
+ INFO_CLOG_SEVERITY_ERROR = (1 << 4),
+ INFO_CLOG_SEVERITY_FATAL = (1 << 5),
+} eSpaceInfo_LogSeverityMask;
+
+#define INFO_CLOG_SEVERITY_MASK_ALL \
+ INFO_CLOG_SEVERITY_DEBUG | INFO_CLOG_SEVERITY_VERBOSE | INFO_CLOG_SEVERITY_INFO | \
+ INFO_CLOG_SEVERITY_WARN | INFO_CLOG_SEVERITY_ERROR | INFO_CLOG_SEVERITY_FATAL
+
+/* SpaceInfo.log_format */
+typedef enum eSpaceInfo_logFormat {
+ INFO_LOG_SHOW_TIMESTAMP = (1 << 0),
+ INFO_LOG_SHOW_LOG_TYPE = (1 << 1),
+ INFO_LOG_SHOW_LEVEL = (1 << 2),
+ INFO_LOG_SHOW_FILE_LINE = (1 << 3),
+ INFO_LOG_SHOW_FUNCTION = (1 << 4),
+} eSpaceInfo_logFormat;
+
+#define INFO_LOG_FORMAT_DEFAULT \
+ INFO_LOG_SHOW_LEVEL | INFO_LOG_SHOW_FILE_LINE | INFO_LOG_SHOW_FUNCTION
/** \} */
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 5a8e6544903..f36e9fe15d5 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -6012,6 +6012,28 @@ static void rna_def_space_info(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Filter Report Type", "");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
+ static const EnumPropertyItem rna_enum_clog_filter_severity_items[] = {
+ {INFO_CLOG_SEVERITY_DEBUG,
+ "LOG_DEBUG",
+ ICON_SYSTEM,
+ "Debug",
+ "Only available in debug builds"},
+ {INFO_CLOG_SEVERITY_VERBOSE, "LOG_VERBOSE", ICON_PROPERTIES, "Verbose", ""},
+ {INFO_CLOG_SEVERITY_INFO, "LOG_INFO", ICON_INFO, "Info", ""},
+ {INFO_CLOG_SEVERITY_WARN, "LOG_WARN", ICON_ERROR, "Warning", ""},
+ {INFO_CLOG_SEVERITY_ERROR, "LOG_ERROR", ICON_CANCEL, "Error", ""},
+ {INFO_CLOG_SEVERITY_FATAL, "LOG_FATAL", ICON_X, "Fatal", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "log_severity_mask", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "log_severity_mask");
+ RNA_def_property_enum_items(prop, rna_enum_clog_filter_severity_items);
+ RNA_def_property_flag(prop, PROP_ENUM_FLAG);
+ RNA_def_property_enum_default(prop, INFO_CLOG_SEVERITY_MASK_ALL);
+ RNA_def_property_ui_text(prop, "Filter Log Severity", "");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
+
prop = RNA_def_property(srna, "filter_text", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "search_string");
RNA_def_property_ui_text(prop, "Log Filter", "Live filtering string");
@@ -6019,14 +6041,71 @@ static void rna_def_space_info(BlenderRNA *brna)
RNA_def_property_ui_icon(prop, ICON_VIEWZOOM, 0);
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO, NULL);
- static const EnumPropertyItem view_type_items[] = {
+ prop = RNA_def_property(srna, "use_short_file_line", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "use_short_file_line", true);
+ RNA_def_property_ui_text(prop, "Shorten File Path", "");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO, NULL);
+
+ prop = RNA_def_property(srna, "use_match_case", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "use_match_case", true);
+ RNA_def_property_ui_text(prop, "Match Case", "");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO, NULL);
+
+ prop = RNA_def_property(srna, "use_log_level_filter", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "use_log_filter", INFO_FILTER_LOG_LEVEL);
+ RNA_def_property_ui_text(prop, "Use Log Level Filter", "");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO, NULL);
+
+ prop = RNA_def_property(srna, "use_log_file_line_filter", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "use_log_filter", INFO_FILTER_FILE_LINE);
+ RNA_def_property_ui_text(prop, "Use Log File Line Filter", "");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO, NULL);
+
+ prop = RNA_def_property(srna, "use_log_type_filter", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "use_log_filter", INFO_FILTER_LOG_TYPE);
+ RNA_def_property_ui_text(prop, "Use Log Type Filter", "");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO, NULL);
+
+ prop = RNA_def_property(srna, "use_log_function_filter", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "use_log_filter", INFO_FILTER_LOG_FUNCTION);
+ RNA_def_property_ui_text(prop, "Use Log Function Filter", "");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO, NULL);
+
+ prop = RNA_def_property(srna, "use_log_message_new_line", PROP_BOOLEAN, PROP_NONE);
+ RN
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list