def browse_script(self): """ Browse the filepool """ s = pool_widget.select_from_pool(self.experiment.main_window) if s == "": return self.auto_line_edit["file"].setText(s) self.apply_edit_changes()
def browse_video(self): """ This function is called when the browse button is clicked to select a video from the file pool. It displays a filepool dialog and changes the video_src field based on the selection. """ s = pool_widget.select_from_pool(self.experiment.main_window) if str(s) == "": return self.auto_line_edit["video_src"].setText(s) self.apply_edit_changes()
def browse_script(self): """ Browse the filepool """ s = pool_widget.select_from_pool(self.experiment.main_window) if str(s) == "": return self.auto_line_edit["file"].setText(s) self.apply_edit_changes()
def browse_video(self): """ This function is called when the browse button is clicked to select a video from the file pool. It displays a filepool dialog and changes the video_src field based on the selection. """ s = pool_widget.select_from_pool(self.experiment.main_window) if s == "": return self.auto_line_edit["video_src"].setText(s) self.apply_edit_changes()
def add(self, from_pos, to_pos): """ Add an item to the sketchpad item list """ item = {} item["type"] = self.tool item["fill"] = self.fill item["color"] = self.color item["penwidth"] = self.penwidth item["show_if"] = self.show_if if self.tool in ("ellipse", "rect"): if to_pos[0] > from_pos[0]: item["x"] = from_pos[0] item["w"] = to_pos[0] - from_pos[0] else: item["x"] = to_pos[0] item["w"] = from_pos[0] - to_pos[0] if to_pos[1] > from_pos[1]: item["y"] = from_pos[1] item["h"] = to_pos[1] - from_pos[1] else: item["y"] = to_pos[1] item["h"] = from_pos[1] - to_pos[1] elif self.tool in ("arrow", "line"): item["x1"] = from_pos[0] item["y1"] = from_pos[1] item["x2"] = to_pos[0] item["y2"] = to_pos[1] item["arrow_size"] = self.arrow_size elif self.tool == "fixdot": item["x"] = to_pos[0] item["y"] = to_pos[1] elif self.tool == "circle": item["x"] = from_pos[0] item["y"] = from_pos[1] item["r"] = 2 * math.sqrt((from_pos[0] - to_pos[0])**2 + (from_pos[1] - to_pos[1])**2) elif self.tool == "textline": text, ok = QtGui.QInputDialog.getText( self.ui.view, "New textline", "Please enter a text for the textline") if not ok: return item["x"] = to_pos[0] item["y"] = to_pos[1] item["text"] = text item["center"] = self.center item["font_family"] = self.font_family item["font_size"] = self.font_size elif self.tool == "image": #path = QtGui.QFileDialog.getOpenFileName(self.ui.view, "Please select an image to add to the sketchpad") path = pool_widget.select_from_pool( self.sketchpad.experiment.main_window) if path == None or str(path) == "": return item["x"] = to_pos[0] item["y"] = to_pos[1] item["file"] = str(path) item["scale"] = self.scale item["center"] = self.center elif self.tool == "gabor": item["x"] = to_pos[0] item["y"] = to_pos[1] item = self.gabor_dialog(item) if item == None: return elif self.tool == "noise": item["x"] = to_pos[0] item["y"] = to_pos[1] item = self.noise_dialog(item) if item == None: return item = self.sketchpad.unfix_coordinates(item) self.sketchpad.items.append(item) self.sketchpad.apply_edit_changes() self.refresh()
def add(self, from_pos, to_pos): """ Add an item to the sketchpad item list """ item = {} item["type"] = self.tool item["fill"] = self.fill item["color"] = self.color item["penwidth"] = self.penwidth item["show_if"] = self.show_if if self.tool in ("ellipse", "rect"): if to_pos[0] > from_pos[0]: item["x"] = from_pos[0] item["w"] = to_pos[0] - from_pos[0] else: item["x"] = to_pos[0] item["w"] = from_pos[0] - to_pos[0] if to_pos[1] > from_pos[1]: item["y"] = from_pos[1] item["h"] = to_pos[1] - from_pos[1] else: item["y"] = to_pos[1] item["h"] = from_pos[1] - to_pos[1] elif self.tool in ("arrow", "line"): item["x1"] = from_pos[0] item["y1"] = from_pos[1] item["x2"] = to_pos[0] item["y2"] = to_pos[1] item["arrow_size"] = self.arrow_size elif self.tool == "fixdot": item["x"] = to_pos[0] item["y"] = to_pos[1] elif self.tool == "circle": item["x"] = from_pos[0] item["y"] = from_pos[1] item["r"] = 2 * math.sqrt( (from_pos[0] - to_pos[0]) ** 2 + (from_pos[1] - to_pos[1]) ** 2 ) elif self.tool == "textline": text, ok = QtGui.QInputDialog.getText(self.ui.view, "New textline", "Please enter a text for the textline") if not ok: return item["x"] = to_pos[0] item["y"] = to_pos[1] item["text"] = text item["center"] = self.center item["font_family"] = self.font_family item["font_size"] = self.font_size elif self.tool == "image": #path = QtGui.QFileDialog.getOpenFileName(self.ui.view, "Please select an image to add to the sketchpad") path = pool_widget.select_from_pool(self.sketchpad.experiment.main_window) if path == None or str(path) == "": return item["x"] = to_pos[0] item["y"] = to_pos[1] item["file"] = str(path) item["scale"] = self.scale item["center"] = self.center elif self.tool == "gabor": item["x"] = to_pos[0] item["y"] = to_pos[1] item = self.gabor_dialog(item) if item == None: return elif self.tool == "noise": item["x"] = to_pos[0] item["y"] = to_pos[1] item = self.noise_dialog(item) if item == None: return item = self.sketchpad.unfix_coordinates(item) self.sketchpad.items.append(item) self.sketchpad.apply_edit_changes() self.refresh()