Before and After:
Run this script in Blender's text editor and press Line Numbers button to refresh the pop-up:
import bpy
def draw_prop(layout, data_path, prop):
context = bpy.context
data = eval(data_path)
if data:
layout.prop(data, prop)
else:
layout.label("%s is None" % data_path, icon='ERROR')
class TestDialog(bpy.types.Operator):
bl_idname = "test.dialog"
bl_label = "Test"
def check(self, context):
return True
def draw(self, context):
draw_prop(self.layout, "context.area", "width")
draw_prop(self.layout, "context.region", "width")
draw_prop(self.layout, "context.space_data", "show_line_numbers")
def execute(self, context):
return {'FINISHED'}
def invoke(self, context, event):
return context.window_manager.invoke_props_dialog(self)
bpy.utils.register_class(TestDialog)
bpy.ops.test.dialog('INVOKE_DEFAULT')