def main(*argv): p1 = SubSuperProto() p2 = SubSuperProto() p3 = SubSuperProto() p1.encapsulate(p2) p3.encapsulate(p2) p2.encapsulate(p3) print p3.children() print p2.children() print p1.receives() print p3.receives() t = TestClass() print t.foo() print print "===================================================================" file = inspect.getsourcefile(TestClass) # p1.__class__) #print file #mod = compiler.parseFile(file) ##print mod src = inspect.getsource(TestClass) # p1.__class__) #print src #ast = compile(src, '<string>', 'exec', _ast.PyCF_ONLY_AST) ast = compiler.parse(open(file).read()) #print ast sw = MyWalker() compiler.walk(ast, sw) print sw
def main(): import debuglog log = debuglog.get('objtree') from testclass import TestClass from PyQt5.QtWidgets import QMainWindow, QApplication class DummyMainWindow(QMainWindow): def __init__(_): super().__init__() _.initUI() def initUI(_): exitAction = QAction(QIcon('exit.png'), '&Exit', _) exitAction.setShortcut('Ctrl+Q') exitAction.setStatusTip('Exit application') exitAction.triggered.connect(qApp.quit) _.statusBar() menubar = _.menuBar() fileMenu = menubar.addMenu('&File') fileMenu.addAction(exitAction) _.setGeometry(300, 300, 300, 200) _.setWindowTitle('Module / Class / Object explorer') _.show() app = QApplication(sys.argv) ex = DummyMainWindow() ex.show() load_IconSet() # goes in the ctor obj1 = TestClass('x') obj2 = obj1 # slight problem with module, some object don't have a holder m = __import__('testclass') treeWidget = ObjectTreeWidget() treeWidget.addItem('A', obj1) treeWidget.addItem('A_instance2', obj2) treeWidget.addItem('module', m) treeWidget.move(400, 200) #treeWidget.header().resizeSection(0, treeWidget.width()/2) treeWidget.resize(900, 600) ex.setCentralWidget(treeWidget) app.exec_() print('running') app.closeAllWindows()
def refreshglobals(self,globs): self.listWidget.clear() self.globs = globs.items() self.label.setText("%i modules" % len(self.globs)) for name,obj in filter(not_classes_or_private, globs.items()): self.listWidget.addItem(ObjectItem(name,obj)) s = name + ' :: ' + str(type(obj)) try: s = obj.__module__ + '.' + s except AttributeError: pass # logger.debug(s + ' :: ' + str(type(obj))) self.listWidget.setSortingEnabled(True) self.listWidget.sortItems(Qt.AscendingOrder) if __name__ == '__main__': import sys from PyQt5.QtWidgets import (QApplication,QWidget) from testclass import TestClass #from globalsManager import filter_classes_private A = TestClass(0) app = QApplication(sys.argv) globalist = GlobalsListWidget(globals()) globalist.show() app.exec_()
# insert holder, name as model logger.debug('//%s %s' % (str(type(item)), item)) def addObjectToTree(_, item): _.objtree.treeWidget.addItem(item.name, item.obj) def close(_): _.globalistwid.close() def onKeyPressEvent(_, evt): print('ok', evt) if __name__ == '__main__': import sys from PyQt5.QtWidgets import (QApplication) from testclass import TestClass app = QApplication(sys.argv) A = TestClass(0) # in the current namespace b = PyqtiltWidget() ''' b.lerpSelector.show() b.lerpSelector.move(300,100) b.show() b.move(300,300) ''' app.exec_()
def hello_world(): testclass = TestClass() return testclass.getString()
#!/usr/bin/python from testclass import TestClass test = TestClass() test.say()
objecttree.load_IconSet() _.treeWidget = objecttree.ObjectTreeWidget() vbox = QVBoxLayout() _.setLayout(vbox) vbox.addWidget(_.treeWidget) def onKeyPressEvent(_,e): # for compatibilty calls when external calls + widgets focus _.treeWidget.keyPressEvent(e) if __name__ == '__main__': from PyQt5.QtWidgets import (QWidget, QApplication,QMainWindow) from testclass import TestClass import sys class DummyMainWindow(QMainWindow): def __init__(self): super().__init__() app = QApplication(sys.argv) ex = DummyMainWindow() objecttree.load_IconSet() obj = TestClass('123') otc = ObjectTreeControls() otc.treeWidget.addItem('aa', obj) otc.show() app.exec_()