def action_create_project(self): self.create_project_window = CreateProjectWindow() self.create_project_window.exec_() if self.create_project_window.success: self.project = Project.load_from_file( self.create_project_window.project_location) self.project_file = self.create_project_window.project_location self.setup_project_tree() self.action_reset()
def action_open_file(self): home_dir = str(Path.home()) filename = QFileDialog.getOpenFileName( self, 'Open file', home_dir, 'project files (*.codespace)', options=QFileDialog.DontUseNativeDialog, ) if filename and filename[0]: self.project = Project.load_from_file(filename[0]) self.project_file = filename[0] self.setup_project_tree() self.action_reset()
def __init__(self, project_file): super().__init__() self.last_go_to_definition = time.time() self.next_instruction = None self.project_file = project_file self.editor_windows = {} self.setupUi(self) self.move_window_to_center() self.setup_editor() if project_file: self.project = Project.load_from_file(project_file) self.setup_project_tree() self.setup_display() self.setup_emulator() self.setup_keyboard() self.setup_doors() self.setup_antenna() self.setup_hardware() # menu buttons self.actionCreateProject.triggered.connect(self.action_create_project) self.actionOpenBinFile.triggered.connect(self.action_open_file) self.actionStep.triggered.connect(self.action_step) self.actionRun.triggered.connect(self.action_run) self.actionReset.triggered.connect(self.action_reset) # speed combobox self.speed_multiplier = 1 self.speed_changed() self.speed.currentIndexChanged.connect(self.speed_changed)