New generator: AllEdges showing all the standard edge types
This commit is contained in:
parent
b7bd6306d1
commit
0f999a89ad
|
@ -0,0 +1,54 @@
|
|||
#!/usr/bin/env python3
|
||||
# Copyright (C) 2013-2018 Florian Festi
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from boxes import *
|
||||
|
||||
class AllEdges(Boxes):
|
||||
"""Showing all edge types"""
|
||||
|
||||
ui_group = "Misc"
|
||||
|
||||
def __init__(self):
|
||||
Boxes.__init__(self)
|
||||
|
||||
self.addSettingsArgs(edges.FingerJointSettings)
|
||||
self.addSettingsArgs(edges.StackableSettings)
|
||||
self.addSettingsArgs(edges.HingeSettings)
|
||||
self.addSettingsArgs(edges.LidSettings)
|
||||
self.addSettingsArgs(edges.ClickSettings)
|
||||
self.addSettingsArgs(edges.FlexSettings)
|
||||
|
||||
self.buildArgParser(x=100)
|
||||
|
||||
def render(self):
|
||||
x = self.x
|
||||
t = self.thickness
|
||||
# Initialize canvas
|
||||
self.open()
|
||||
|
||||
chars = list(self.edges.keys())
|
||||
chars.sort(key=lambda c: c.lower() + (c if c.isupper() else ''))
|
||||
chars.reverse()
|
||||
|
||||
for c in chars:
|
||||
self.moveTo(0, 15*t)
|
||||
self.ctx.save()
|
||||
self.moveTo(x, 0, 180)
|
||||
self.edges[c](x, h=4*t)
|
||||
self.ctx.restore()
|
||||
self.text("%s - %s" % (c, self.edges[c].description), y=5*t)
|
||||
|
||||
self.close()
|
Loading…
Reference in New Issue