コード例 #1
0
    def browse(self):

        s = pool_widget.select_from_pool(self.main_window)
        if not s:
            return
        self.edit.setText(s)
        self.editingFinished.emit()
コード例 #2
0
ファイル: pool_select.py プロジェクト: alisdt/OpenSesame
	def browse(self):

		s = pool_widget.select_from_pool(self.main_window)
		if not s:
			return
		self.edit.setText(s)
		self.editingFinished.emit()
コード例 #3
0
    def browse_sample(self):
        """Present a file dialog to browse for the sample"""

        s = pool_widget.select_from_pool(self.experiment.main_window)
        if unicode(s) == "":
            return
        self.sampler_widget.ui.edit_sample.setText(s)
        self.apply_edit_changes()
コード例 #4
0
ファイル: sampler.py プロジェクト: Evertox/OpenSesame
	def browse_sample(self):
	
		"""Present a file dialog to browse for the sample"""
		
		s = pool_widget.select_from_pool(self.experiment.main_window)
		if unicode(s) == "":
			return			
		self.sampler_widget.ui.edit_sample.setText(s)
		self.apply_edit_changes()
コード例 #5
0
    def browse_sample(self):
        """
		desc:
			Presents a file dialog to browse for the sample.
		"""

        s = pool_widget.select_from_pool(self.main_window)
        if str(s) == u'':
            return
        self.sampler_widget.ui.edit_sample.setText(s)
        self.apply_edit_changes()
コード例 #6
0
ファイル: sampler.py プロジェクト: amandinerey/OpenSesame
	def browse_sample(self):

		"""
		desc:
			Presents a file dialog to browse for the sample.
		"""

		s = pool_widget.select_from_pool(self.main_window)
		if str(s) == u'':
			return
		self.sampler_widget.ui.edit_sample.setText(s)
		self.apply_edit_changes()
コード例 #7
0
    def mouse_press(cls, sketchpad, pos):

        from libqtopensesame.widgets import pool_widget
        _file = pool_widget.select_from_pool(sketchpad.main_window,
                                             parent=sketchpad._edit_widget)
        if _file == u'':
            return None
        properties = {
            u'x': pos[0],
            u'y': pos[1],
            u'file': _file,
            u'scale': sketchpad.current_scale(),
            u'center': sketchpad.current_center(),
            u'show_if': sketchpad.current_show_if()
        }
        e = image(sketchpad, properties=properties)
        return e
コード例 #8
0
ファイル: _image.py プロジェクト: JdenHartog/OpenSesame
	def mouse_press(cls, sketchpad, pos):

		from libqtopensesame.widgets import pool_widget
		_file = pool_widget.select_from_pool(sketchpad.main_window,
			parent=sketchpad._edit_widget)
		if _file == u'':
			return None
		properties = {
			u'x':		pos[0],
			u'y':		pos[1],
			u'file':	_file,
			u'scale':	sketchpad.current_scale(),
			u'center':	sketchpad.current_center(),
			u'show_if': sketchpad.current_show_if()
		}
		e = image(sketchpad, properties=properties)
		return e
コード例 #9
0
ファイル: qtplugin.py プロジェクト: wzzwwbx/OpenSesame
		def browse_pool():
			s = pool_widget.select_from_pool(self.experiment.main_window)
			if unicode(s) == "":
				return
			edit_widget.setText(s)
			self.apply_edit_changes()
コード例 #10
0
 def browse_pool():
     s = pool_widget.select_from_pool(self.experiment.main_window)
     if str(s) == "":
         return
     edit_widget.setText(s)
     self.apply_edit_changes()
コード例 #11
0
	def add(self, from_pos, to_pos):

		"""
		Add an item to the sketchpad item list

		Arguments:
		from_pos -- an (x, y) tuple containing the top-left corner
		to_pos -- an (x, y) tuple containing the bottom-right corner
		"""

		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"] = self.sketchpad.experiment.sanitize(text)
			item["center"] = self.center
			item["html"] = self.html
			item["font_family"] = self.font_family
			item["font_size"] = self.font_size
			item["font_italic"] = self.sketchpad.experiment.auto_type( \
				self.font_italic)
			item["font_bold"] = self.sketchpad.experiment.auto_type( \
				self.font_bold)

		elif self.tool == "image":
			path = pool_widget.select_from_pool(self.sketchpad.experiment.main_window)
			if path == None or unicode(path) == "":
				return
			item["x"] = to_pos[0]
			item["y"] = to_pos[1]
			item["file"] = unicode(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()
コード例 #12
0
    def add(self, from_pos, to_pos):
        """
		Add an item to the sketchpad item list

		Arguments:
		from_pos -- an (x, y) tuple containing the top-left corner
		to_pos -- an (x, y) tuple containing the bottom-right corner
		"""

        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"] = self.sketchpad.experiment.sanitize(text)
            item["center"] = self.center
            item["html"] = self.html
            item["font_family"] = self.font_family
            item["font_size"] = self.font_size
            item["font_italic"] = self.sketchpad.experiment.auto_type( \
             self.font_italic)
            item["font_bold"] = self.sketchpad.experiment.auto_type( \
             self.font_bold)

        elif self.tool == "image":
            path = pool_widget.select_from_pool(
                self.sketchpad.experiment.main_window)
            if path == None or unicode(path) == "":
                return
            item["x"] = to_pos[0]
            item["y"] = to_pos[1]
            item["file"] = unicode(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()