[Bf-blender-cvs] [2e5d9a73f7b] master: UI: Improved Script Execution Warning

Yevgeny Makarov noreply at git.blender.org
Sun Dec 13 21:40:24 CET 2020


Commit: 2e5d9a73f7b957114972185e996c0e36aadd4652
Author: Yevgeny Makarov
Date:   Sun Dec 13 12:39:28 2020 -0800
Branches: master
https://developer.blender.org/rB2e5d9a73f7b957114972185e996c0e36aadd4652

UI: Improved Script Execution Warning

New dialog box layout with large alert icon for the Python script execution warning popup.

Differential Revision: https://developer.blender.org/D9390

Reviewed by Hans Goudey

===================================================================

M	source/blender/windowmanager/intern/wm_files.c

===================================================================

diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 5b21b2397e7..d179cc456f4 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -2959,30 +2959,25 @@ static uiBlock *block_create_autorun_warning(struct bContext *C,
                                              void *UNUSED(arg1))
 {
   wmWindowManager *wm = CTX_wm_manager(C);
-  const uiStyle *style = UI_style_get_dpi();
-  const int text_points_max = MAX2(style->widget.points, style->widgetlabel.points);
-  const int dialog_width = text_points_max * 44 * U.dpi_fac;
 
   uiBlock *block = UI_block_begin(C, region, "autorun_warning_popup", UI_EMBOSS);
-
   UI_block_flag_enable(
       block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_LOOP | UI_BLOCK_NO_WIN_CLIP | UI_BLOCK_NUMSELECT);
   UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP);
   UI_block_emboss_set(block, UI_EMBOSS);
 
-  uiLayout *layout = UI_block_layout(
-      block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 10, 2, dialog_width, 0, 0, style);
+  uiLayout *layout = uiItemsAlertBox(block, 44, ALERT_ICON_ERROR);
 
-  /* Text and some vertical space */
+  /* Title and explanation text. */
   uiLayout *col = uiLayoutColumn(layout, true);
   uiItemL_ex(col,
              TIP_("For security reasons, automatic execution of Python scripts "
                   "in this file was disabled:"),
-             ICON_ERROR,
+             ICON_NONE,
              true,
              false);
-  uiItemL_ex(col, G.autoexec_fail, ICON_BLANK1, false, true);
-  uiItemL(col, TIP_("This may lead to unexpected behavior"), ICON_BLANK1);
+  uiItemL_ex(col, G.autoexec_fail, ICON_NONE, false, true);
+  uiItemL(col, TIP_("This may lead to unexpected behavior"), ICON_NONE);
 
   uiItemS(layout);
 
@@ -2995,7 +2990,7 @@ static uiBlock *block_create_autorun_warning(struct bContext *C,
           TIP_("Permanently allow execution of scripts"),
           ICON_NONE);
 
-  uiItemS(layout);
+  uiItemS_ex(layout, 3.0f);
 
   /* Buttons */
   uiBut *but;



More information about the Bf-blender-cvs mailing list