Skip to content
Snippets Groups Projects
Commit 42d5e009 authored by Ryan Inch's avatar Ryan Inch
Browse files

Collection Manager: Fix send_report error. Task: T69577

Transferred the send_report function and class from my
Advanced UI Menus addon that I forgot to include when
I first separated the Collection Manager from it.
parent f71c3ca1
No related branches found
No related tags found
No related merge requests found
......@@ -22,7 +22,7 @@ bl_info = {
"name": "Collection Manager",
"description": "Manage collections and their objects",
"author": "Ryan Inch",
"version": (1,8,3),
"version": (1,8,4),
"blender": (2, 80, 0),
"location": "View3D - Object Mode (Shortcut - M)",
"warning": '', # used for warning icon and text in addons panel
......@@ -55,6 +55,7 @@ addon_keymaps = []
classes = (
internals.CMListCollection,
internals.CMSendReport,
operators.ExpandAllOperator,
operators.ExpandSublevelOperator,
operators.CMExcludeOperator,
......
......@@ -18,7 +18,13 @@
# Copyright 2011, Ryan Inch
from bpy.types import PropertyGroup
import bpy
from bpy.types import (
PropertyGroup,
Operator,
)
from bpy.props import StringProperty
layer_collections = {}
......@@ -127,3 +133,66 @@ def create_property_group(context, tree):
if laycol["has_children"]:
create_property_group(context, laycol["children"])
class CMSendReport(Operator):
bl_label = "Send Report"
bl_idname = "view3d.cm_send_report"
message: StringProperty()
def draw(self, context):
layout = self.layout
first = True
string = ""
for num, char in enumerate(self.message):
if char == "\n":
if first:
layout.row().label(text=string, icon='ERROR')
first = False
else:
layout.row().label(text=string, icon='BLANK1')
string = ""
continue
string = string + char
if first:
layout.row().label(text=string, icon='ERROR')
else:
layout.row().label(text=string, icon='BLANK1')
def invoke(self, context, event):
wm = context.window_manager
max_len = 0
length = 0
for char in self.message:
if char == "\n":
if length > max_len:
max_len = length
length = 0
else:
length += 1
if length > max_len:
max_len = length
return wm.invoke_popup(self, width=(30 + (max_len*5.5)))
def execute(self, context):
self.report({'INFO'}, self.message)
print(self.message)
return {'FINISHED'}
def send_report(message):
def report():
window = bpy.context.window_manager.windows[0]
ctx = {'window': window, 'screen': window.screen, }
bpy.ops.view3d.cm_send_report(ctx, 'INVOKE_DEFAULT', message=message)
bpy.app.timers.register(report)
......@@ -36,6 +36,7 @@ from .internals import (
expanded,
layer_collections,
update_property_group,
send_report,
)
rto_history = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment