temp hack to make the popup show wider when running the edit description operator

This commit is contained in:
Campbell Barton 2009-11-23 00:56:19 +00:00
parent caab05ec8c
commit 8e09171d5b
3 changed files with 14 additions and 6 deletions

@ -248,9 +248,9 @@ class WM_OT_context_cycle_enum(bpy.types.Operator):
return ('FINISHED',) return ('FINISHED',)
doc_id = StringProperty(name="Doc ID", doc_id = StringProperty(name="Doc ID",
description="ID for the documentation", maxlen=1024, default="") description="", maxlen=1024, default="", hidden=True)
doc_new = StringProperty(name="Doc New", doc_new = StringProperty(name="Edit Description",
description="", maxlen=1024, default="") description="", maxlen=1024, default="")

@ -3497,7 +3497,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
RNA_string_set(&ptr_props, "doc_id", buf); RNA_string_set(&ptr_props, "doc_id", buf);
RNA_string_set(&ptr_props, "doc_new", RNA_property_description(but->rnaprop)); RNA_string_set(&ptr_props, "doc_new", RNA_property_description(but->rnaprop));
uiItemFullO(layout, "Edit Docs (TODO)", 0, "WM_OT_doc_edit", ptr_props.data, WM_OP_INVOKE_DEFAULT, 0); uiItemFullO(layout, "Submit Description", 0, "WM_OT_doc_edit", ptr_props.data, WM_OP_INVOKE_DEFAULT, 0);
} }
else if (but->optype) { else if (but->optype) {
WM_operator_py_idname(buf, but->optype->idname); WM_operator_py_idname(buf, but->optype->idname);
@ -3511,7 +3511,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
RNA_string_set(&ptr_props, "doc_id", buf); RNA_string_set(&ptr_props, "doc_id", buf);
RNA_string_set(&ptr_props, "doc_new", but->optype->description); RNA_string_set(&ptr_props, "doc_new", but->optype->description);
uiItemFullO(layout, "Edit Docs (TODO)", 0, "WM_OT_doc_edit", ptr_props.data, WM_OP_INVOKE_DEFAULT, 0); uiItemFullO(layout, "Submit Description", 0, "WM_OT_doc_edit", ptr_props.data, WM_OP_INVOKE_DEFAULT, 0);
} }
} }

@ -699,7 +699,9 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
uiBlock *block; uiBlock *block;
uiLayout *layout; uiLayout *layout;
uiStyle *style= U.uistyles.first; uiStyle *style= U.uistyles.first;
int columns= 2, width= 300;
block= uiBeginBlock(C, ar, "redo_popup", UI_EMBOSS); block= uiBeginBlock(C, ar, "redo_popup", UI_EMBOSS);
uiBlockClearFlag(block, UI_BLOCK_LOOP); uiBlockClearFlag(block, UI_BLOCK_LOOP);
uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN|UI_BLOCK_RET_1); uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN|UI_BLOCK_RET_1);
@ -710,14 +712,20 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
op->properties= IDP_New(IDP_GROUP, val, "wmOperatorProperties"); op->properties= IDP_New(IDP_GROUP, val, "wmOperatorProperties");
} }
// XXX - hack, only for editing docs
if(strcmp(op->type->idname, "WM_OT_doc_edit")==0) {
columns= 1;
width= 500;
}
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 300, 20, style); layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, width, 20, style);
uiItemL(layout, op->type->name, 0); uiItemL(layout, op->type->name, 0);
if(op->type->ui) if(op->type->ui)
op->type->ui((bContext*)C, &ptr, layout); op->type->ui((bContext*)C, &ptr, layout);
else else
uiDefAutoButsRNA(C, layout, &ptr, 2); uiDefAutoButsRNA(C, layout, &ptr, columns);
uiPopupBoundsBlock(block, 4.0f, 0, 0); uiPopupBoundsBlock(block, 4.0f, 0, 0);
uiEndBlock(C, block); uiEndBlock(C, block);