root / grc / src / grc / gui / elements / Platform.py @ 3a31e070
History | View | Annotate | Download (1.6 kB)
| 1 | """
|
|---|---|
| 2 | Copyright 2008 Free Software Foundation, Inc.
|
| 3 | This file is part of GNU Radio
|
| 4 | |
| 5 | GNU Radio Companion is free software; you can redistribute it and/or
|
| 6 | modify it under the terms of the GNU General Public License
|
| 7 | as published by the Free Software Foundation; either version 2
|
| 8 | of the License, or (at your option) any later version.
|
| 9 | |
| 10 | GNU Radio Companion is distributed in the hope that it will be useful,
|
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 | GNU General Public License for more details.
|
| 14 | |
| 15 | You should have received a copy of the GNU General Public License
|
| 16 | along with this program; if not, write to the Free Software
|
| 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
| 18 | """
|
| 19 | ##@package grc.gui.elements.Platform
|
| 20 | #Graphical platform to turn an existing platform into a gui platform.
|
| 21 | |
| 22 | from FlowGraph import FlowGraph |
| 23 | from Connection import Connection |
| 24 | from Block import Block |
| 25 | from Port import Port |
| 26 | from Param import Param |
| 27 | |
| 28 | def conjoin_classes(name, c1, c2): |
| 29 | exec("""
|
| 30 | class %s(c1, c2):
|
| 31 | def __init__(self, *args, **kwargs):
|
| 32 | c1.__init__(self, *args, **kwargs)
|
| 33 | c2.__init__(self, *args, **kwargs)
|
| 34 | """%name, locals()) |
| 35 | return locals()[name] |
| 36 | |
| 37 | def Platform(platform): |
| 38 | #combine with gui class
|
| 39 | for attr, value in ( |
| 40 | ('FlowGraph', FlowGraph),
|
| 41 | ('Connection', Connection),
|
| 42 | ('Block', Block),
|
| 43 | ('Source', Port),
|
| 44 | ('Sink', Port),
|
| 45 | ('Param', Param),
|
| 46 | ): |
| 47 | old_value = getattr(platform, attr)
|
| 48 | c = conjoin_classes(attr, old_value, value) |
| 49 | setattr(platform, attr, c)
|
| 50 | return platform
|
| 51 |