def showWindow(self, console=False): if console and isConsoleApp(): return self.show() self.activateWindow() if console: self.tabs.setCurrentIndex(0)
wbi = QtGui.QTreeWidgetItem(self.twModules, [m]) wbi.setIcon(0, self.office_icons["Module"]) macro_list = macro_tree[m] for j in macro_list: ic = self.office_icons.get(macro_list[j], None) child = QtGui.QTreeWidgetItem([j]) if ic: child.setIcon(0, ic) wbi.addChild(child) wbi.setExpanded(True) def btnExit_clicked(self): self.server.shutdown() self.server.server_close() QtGui.qApp.quit() def closeEvent(self, event): if event.type() == event.Close: event.ignore() self.hide() @QtCore.pyqtSlot(object, object) def startMacro(self, macro, wb): with TempTrayIcon(self.tray, "%s\nRunning: %s"%(self.tray.toolTip(), macro.__name__), QtGui.QStyle.SP_ArrowRight): macro(wb) stdout = None if isConsoleApp() else "txtConsole" #redirect output if no console QtApp(SimplePython, ontop=True, hidden=True, stdout=stdout, tray={"icon": r"res\icon.png", "tip": "SimplePython Server"})