import sys from PyQt5 import QtGui, QtCore from Gui import MainWindow from PyQt5.QtWidgets import * if __name__ == '__main__': app = QApplication(sys.argv) app.setStyle('Fusion') palette = QtGui.QPalette() palette.setColor(QtGui.QPalette.Window, QtGui.QColor(53, 53, 53)) palette.setColor(QtGui.QPalette.WindowText, QtCore.Qt.white) palette.setColor(QtGui.QPalette.Base, QtGui.QColor(53, 53, 53)) palette.setColor(QtGui.QPalette.AlternateBase, QtGui.QColor(53, 53, 53)) palette.setColor(QtGui.QPalette.ToolTipBase, QtCore.Qt.white) palette.setColor(QtGui.QPalette.ToolTipText, QtCore.Qt.white) palette.setColor(QtGui.QPalette.Text, QtCore.Qt.white) palette.setColor(QtGui.QPalette.Button, QtGui.QColor(53, 53, 53)) palette.setColor(QtGui.QPalette.ButtonText, QtCore.Qt.white) palette.setColor(QtGui.QPalette.Highlight, QtGui.QColor(73, 1, 89, 35).lighter()) palette.setColor(QtGui.QPalette.HighlightedText, QtCore.Qt.white) app.setPalette(palette) window = MainWindow.WidgetGallery() window.show() sys.exit(app.exec_())
import sys from PyQt5.QtWidgets import QApplication from Gui import MainWindow if __name__ == "__main__": app = QApplication(sys.argv) window = MainWindow() #window.statusbar.showMessage('Ready') window.show() sys.exit(app.exec_())
import sys from PyQt5.QtWidgets import QApplication from Gui import MainWindow if __name__ == '__main__': app = QApplication(sys.argv) window = MainWindow.MainWindow() window.show() sys.exit(app.exec_())
globals.stop = False try: mainWindow.setWidget("Main") mainWindow.clearPacketsList() thread = SnifferThread("Sniffer", mainWindow.getCurrentInterface()) thread.start() except (AttributeError): mainWindow.setWidget("Other") # Get interfaces list to be shown in the interfaces window def getInterfacesList(): ifList = [] for i in ifaces.data.keys(): ifList.append(i) return ifList if __name__ == "__main__": app = QtWidgets.QApplication(sys.argv) app.setStyle('Fusion') globals.init() mainWindow = MainWindow() mainWindow.setWindowTitle('Packet Sniffer') mainWindow.connectStart(startHandler) mainWindow.connectRestart(startHandler) mainWindow.connectStop(stopHandler) mainWindow.addInterfaces(getInterfacesList()) mainWindow.show() sys.exit(app.exec_())
def startHandler(): globals.stop = False try: mainWindow.setWidget("Main") mainWindow.clearPacketsList() thread = SnifferThread("Sniffer", mainWindow.getCurrentInterface()) thread.start() except (AttributeError): mainWindow.setWidget("Other") # Get interfaces list to be shown in the interfaces window def getInterfacesList(): ifList = [] for i in ifaces.data.keys(): ifList.append(i) return ifList if __name__ == "__main__": global ui app = QtWidgets.QApplication(sys.argv) globals.init() mainWindow = MainWindow() mainWindow.connectStart(startHandler) mainWindow.connectRestart(startHandler) mainWindow.connectStop(stopHandler) mainWindow.addInterfaces(getInterfacesList()) mainWindow.show() sys.exit(app.exec_())
# Vera Worri # driven and dampened compound pendulum with bar magnet at theta= 90 degrees ####################################################################################################################### #imported packages from Gui import MainWindow from PyQt5 import QtWidgets, QtGui import sys if __name__ == '__main__': app = QtWidgets.QApplication(sys.argv) window = MainWindow() app.setWindowIcon(QtGui.QIcon('default.ico')) window.setWindowIcon(QtGui.QIcon('default.ico')) window.show() status = app.exec_() sys.exit(status)
def start(method, settings, gui, stdinRead): if gui: from PyQt5 import QtGui, QtCore, QtWidgets sip.setapi('QDate', 2) sip.setapi('QDateTime', 2) sip.setapi('QString', 2) sip.setapi('QTextStream', 2) sip.setapi('QTime', 2) sip.setapi('QUrl', 2) sip.setapi('QVariant', 2) startPuzzle = None endPuzzle = None row = 0 col = 0 if not stdinRead: row = 4 col = 4 startPuzzle = np.array([[0, 1, 2, 7], [8, 9, 12, 10], [13, 3, 6, 4], [15, 14, 11, 5]]) endPuzzle = np.zeros((row, col), int) element = 1 for i in range(row): for j in range(col): endPuzzle[i][j] = element element += 1 endPuzzle[-1][-1] = 0 else: iteration = 0 for line in sys.stdin: line = line.split() if not iteration: row = int(line[0]) col = int(line[1]) startPuzzle = np.zeros((row, col), np.uint8) else: for i in range(col): startPuzzle[iteration - 1][i] = int(line[i]) iteration += 1 endPuzzle = np.zeros((row, col), np.uint8) element = 1 for i in range(row): for j in range(col): endPuzzle[i][j] = element element += 1 endPuzzle[-1][-1] = 0 start = Node(startPuzzle) end = Node(endPuzzle) solutionNode = None visitedNodes = 0 startFullTime = time.perf_counter() if start.checkSolvability(): if method == "bfs": bfs = Bfs(start, end, settings) bfs.solve() solutionNode = bfs.solutionNode visitedNodes = bfs.counterNodes elif method == "dfs": dfs = Dfs(start, end, settings) dfs.solve() solutionNode = dfs.solutionNode visitedNodes = dfs.counterNodes elif method == "astar": astar = AStar(start, end, settings) astar.solve() solutionNode = astar.solutionNode visitedNodes = astar.counterNodes else: print("Unknow method") sys.exit(3) solutionStates = [] solutionMoves = [] while solutionNode.parent: solutionStates.append(solutionNode.getPuzzles()) solutionMoves.append(solutionNode.move) solutionNode = solutionNode.parent print(len(solutionMoves)) for i in range(len(solutionMoves) - 1, -1, -1): print(solutionMoves[i], end="") print() else: print(-1) fullTime = "%.4f" % (time.perf_counter() - startFullTime) print() print("Stats:") print('Full Time: ', fullTime, ' sec') if start.checkSolvability(): print('Steps to solution: ', len(solutionMoves)) print('Visited nodes: ', visitedNodes) if gui and start.checkSolvability(): app = QtWidgets.QApplication(sys.argv) app.setApplicationName("15Puzzles") main = MainWindow(row, col, startPuzzle, 0, solutionMoves) main.show() app.exec_()