MCPcopy Index your code
hub / github.com/rawpython/remi / default_icon

Function default_icon

editor/editor_widgets.py:444–461  ·  view source on GitHub ↗

A simple function to make a default svg icon for the widgets such icons can be replaced later with a good one

(name, view_w=1, view_h=0.6)

Source from the content-addressed store, hash-verified

442
443
444def default_icon(name, view_w=1, view_h=0.6):
445 """
446 A simple function to make a default svg icon for the widgets
447 such icons can be replaced later with a good one
448 """
449 icon = gui.Svg(width=50,height=30)
450 icon.set_viewbox(-view_w/2,-view_h/2,view_w,view_h)
451 text = gui.SvgText(0,0,name)
452 text.attributes['textLength'] = "100%"
453 text.attributes['lengthAdjust'] = "spacingAndGlyphs"
454 text.style['font-size'] = "0.2px"
455 text.style['text-anchor'] = "middle"
456 stroke_width = 0.01
457 rect = gui.SvgRectangle(-view_w/2+stroke_width,-view_h/2+stroke_width,view_w-stroke_width*2,view_h-stroke_width*2)
458 rect.set_fill("none")
459 rect.set_stroke(0.01,'black')
460 icon.append([rect, text])
461 return icon
462
463
464class WidgetHelper(gui.HBox):

Callers 1

__init__Method · 0.70

Calls 4

set_viewboxMethod · 0.95
set_fillMethod · 0.45
set_strokeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected