def methods_dependencies(self, path): function_connections = [] function_connections_tmp = MethodsDependencies().methods_dependency(path) function_names = MethodsDependencies().methods_list_from_directory(path) for element in function_connections_tmp: if element != []: function_connections.append(element) graph = Digraph('methodGraph', format='pdf', filename='methodGraph', node_attr={'color': 'skyblue', 'style': 'filled', 'shape': 'doublecircle'}) graph.attr(size='6,6', labelloc='b', label='Version: \n' + HashCommit.get_commit_hash(path)) for name in function_names: graph.node(name) for edge in function_connections: for x in edge: graph.edge(x[1], x[0], label=str(x[2])) try: graph.view(tempfile.mktemp('.moduleGraph')) except Exception: from gui.Window import Window Window.show_error(Window)
def files_with_definitions_dependencies(self, path): file_names = FilesDependencies.find_files_in_directory(self, path) names = [] sizes = [] graph = Digraph('filesMethodsDefinitionsGraph', strict=True, format='pdf', filename='filesMethodsDefinitionsGraph', node_attr={'color': 'khaki', 'style': 'filled', 'shape': 'doublecircle'}) graph.attr(size='50', labelloc='b', label='Version: \n' + HashCommit.get_commit_hash(path)) color = Color() for i in file_names: tmp = i.split(" ") names.append(tmp[0]) sizes.append(tmp[1]) for file, size in zip(names, sizes): same_function_dependencies = FilesWithDefinitionsDependencies.methods_in_file(self, path, file) graph.node(file, **{'width': str(float(size) / 15000), 'height': str(float(size) / 15000), 'color': color.__str__()}) for i in same_function_dependencies[file]: graph.edge(i, file) color.h += 0.05 try: graph.view(tempfile.mktemp('.filesMethodsDefinitionsGraph')) except Exception: from gui.Window import Window Window.show_error(Window)
def files_with_methods(self, path): file_names = FilesDependencies.find_files_in_directory(self, path) names = [] sizes = [] function_connections = [] function_connections_tmp = MethodsDependencies().methods_dependency( path) function_names = MethodsDependencies().methods_list_from_directory( path) for element in function_connections_tmp: if element != []: function_connections.append(element) graph = Digraph('filesMethodGraph', format='pdf', filename='filesMethodGraph', node_attr={ 'style': 'filled', 'shape': 'circle', 'color': 'skyblue' }) graph.attr(size='50', labelloc='b', label='Version: \n' + HashCommit.get_commit_hash(path)) with graph.subgraph(name='methods') as method_graph: method_graph.node_attr.update(style='filled', color='skyblue') for name in function_names: graph.node(name) for edge in function_connections: for x in edge: method_graph.edge(x[1], x[0], label=str(x[2])) with graph.subgraph(name='files') as files_graph: files_graph.node_attr.update(style='filled', color='mistyrose') for i in file_names: tmp = i.split(" ") names.append(tmp[0]) sizes.append(tmp[1]) for file, size in zip(names, sizes): files_graph.node( file, **{ 'width': str(float(size) / 15000), 'height': str(float(size) / 15000) }) dependencies, counter = FilesDependencies.find_files_dependencies( file, path, names) for dependent_file in dependencies: files_graph.edge(file, dependent_file, *{str(counter)}) try: graph.view(tempfile.mktemp('.filesMethodGraph')) except Exception: from gui.Window import Window Window.show_error(Window)
def module_dependency(self, path='.'): edges = ModuleDependencies().get_relation_names(path) graph = Digraph('moduleGraph', format='pdf', filename='moduleGraph', node_attr={'color': 'yellowgreen', 'style': 'filled', 'shape': 'doublecircle'}) graph.attr(size='50', labelloc='b', label='Version: \n' + HashCommit.get_commit_hash(path)) for i in edges: graph.edge(i[1][0], i[1][1], label=str(i[0])) try: graph.view(tempfile.mktemp('.moduleGraph')) except Exception: from gui.Window import Window Window.show_error(Window)
def files_with_modules(self, path): file_names = FilesDependencies.find_files_in_directory(self, path) names = [] sizes = [] edges = ModuleDependencies().get_relation_names(path) graph = Digraph('filesModulesGraph', format='pdf', filename='filesModulesGraph', node_attr={ 'style': 'filled', 'shape': 'circle' }) graph.attr(size='50', labelloc='b', label='Version: \n' + HashCommit.get_commit_hash(path)) with graph.subgraph(name='modules') as modules_graph: modules_graph.node_attr.update(style='filled', color='yellowgreen') for i in edges: modules_graph.edge(i[1][0], i[1][1], label=str(i[0])) with graph.subgraph(name='files') as files_graph: files_graph.node_attr.update(style='filled', color='mistyrose') for i in file_names: tmp = i.split(" ") names.append(tmp[0]) sizes.append(tmp[1]) for file, size in zip(names, sizes): files_graph.node( file, **{ 'width': str(float(size) / 15000), 'height': str(float(size) / 15000) }) dependencies, counter = FilesDependencies.find_files_dependencies( file, path, names) for dependent_file in dependencies: files_graph.edge(file, dependent_file, *{str(counter)}) try: graph.view(tempfile.mktemp('.filesModulesGraph')) except Exception: from gui.Window import Window Window.show_error(Window)
def modules_with_methods(self, path): function_connections = [] function_connections_tmp = MethodsDependencies().methods_dependency( path) edges = ModuleDependencies().get_relation_names(path) function_names = MethodsDependencies().methods_list_from_directory( path) for element in function_connections_tmp: if element != []: function_connections.append(element) graph = Digraph('modulesMethodGraph', format='pdf', filename='modulesMethodGraph', node_attr={ 'style': 'filled', 'shape': 'circle', 'color': 'skyblue' }) graph.attr(size='50', labelloc='b', label='Version: \n' + HashCommit.get_commit_hash(path)) with graph.subgraph(name='methods') as method_graph: method_graph.node_attr.update(style='filled', color='skyblue') for name in function_names: graph.node(name) for edge in function_connections: for x in edge: method_graph.edge(x[1], x[0], label=str(x[2])) with graph.subgraph(name='modules') as modules_graph: modules_graph.node_attr.update(style='filled', color='yellowgreen') for i in edges: modules_graph.edge(i[1][0], i[1][1], label=str(i[0])) try: graph.view(tempfile.mktemp('.modulesMethodGraph')) except Exception: from gui.Window import Window Window.show_error(Window)
def files_dependency(self, path): file_names = FilesDependencies.find_files_in_directory(self, path) names = [] sizes = [] graph = Digraph('filesGraph', format='pdf', filename='filesGraph', node_attr={'color': 'mistyrose', 'style': 'filled', 'shape': 'circle'}) graph.attr(size='50', labelloc='b', label='Version: \n' + HashCommit.get_commit_hash(path)) for i in file_names: tmp = i.split(" ") names.append(tmp[0]) sizes.append(tmp[1]) for file, size in zip(names, sizes): graph.node(file, **{'width': str(float(size) / 15000), 'height': str(float(size) / 15000)}) dependencies, counter = FilesDependencies.find_files_dependencies(file, path, names) for dependent_file in dependencies: graph.edge(file, dependent_file, *{str(counter)}) try: graph.view(tempfile.mktemp('.filesGraph')) except Exception: from gui.Window import Window Window.show_error(Window)
def main(): opponents = {} players = {} with open('opponents.csv', 'r') as opponentsFile: opponentList = csv.reader(opponentsFile, delimiter=",") for row in opponentList: opponent = Character(row[0], row[1], int(row[2]), int(row[3]), int(row[4]), int(row[5]), row[6]) opponents[row[1]] = opponent with open('players.csv', 'r') as playersFile: playersList = csv.reader(playersFile, delimiter=",") for row in playersList: player = Character(row[0], row[1], int(row[2]), int(row[3]), int(row[4]), int(row[5]), row[6]) players[row[1]] = player opponentsFile.close() playersFile.close() root = Tk() root.geometry("1025x640") root.resizable(width=False, height=False) Window(players, opponents, root) root.mainloop()
The crash was caused by jack, uninstalling jack seems to remove the crash. thanks to sparky-10 at : https://github.com/spatialaudio/python-sounddevice/issues/275 Hum. #################################### END OF IMPORTANT NOTE #################################### """ if __name__ == "__main__": app = QApplication() sharm = Sharm.Sharm() window = Window() window.show() window.resize(QSize(950, 620)) time.sleep(0.1) sharm.audio.startAudio() print("Init done.") app.exec_() sharm.close() # checking for threads main_thread = threading.current_thread()
def main(): test = Window() test.window.mainloop()
""" main @description : execution starts here, sets the application and initializes a win- dow. """ import sys from PyQt5.QtWidgets import QApplication from MainController import Controller from gui.Window import Window if __name__ == '__main__': app = QApplication(sys.argv) w = Window() c = Controller(w) app.exec()