Ejemplo n.º 1
0
    def init_edit_widget(self):

        """
        Constructs the GUI controls. Usually, you can omit this function
        altogether, but if you want to implement more advanced functionality,
        such as controls that are grayed out under certain conditions, you need
        to implement this here.
        """

        # First, call the parent constructor, which constructs the GUI controls
        # based on info.json.
        qtautoplugin.init_edit_widget(self)
        # If you specify a 'name' for a control in info.json, this control will
        # be available self.[name]. The type of the object depends on the
        # control. A checkbox will be a QCheckBox, a line_edit will be a
        # QLineEdit. Here we connect the stateChanged signal of the QCheckBox,
        # to the setEnabled() slot of the QLineEdit. This has the effect of
        # disabling the QLineEdit when the QCheckBox is uncheckhed. We also
        # explictly set the starting state.
        #self.line_edit_widget.setEnabled(self.checkbox_widget.isChecked())
        #self.checkbox_widget.stateChanged.connect(
        #    self.line_edit_widget.setEnabled)
        ELister = EvtExchanger()
        listofdevices = ELister.Attached()
        for i in listofdevices:
            self.VAS_ENCODERID_widget.addItem(i)
        self.VAS_TIMERNAME_widget.setEnabled(self.VAS_EXIT_METHOD_widget.currentText() == u'TIME')
        self.VAS_DURATION_widget.setEnabled(self.VAS_EXIT_METHOD_widget.currentText() == u'TIME')
        self.VAS_EXITKEY_widget.setEnabled(self.VAS_EXIT_METHOD_widget.currentText() == u'KEY')
        self.VAS_EXIT_METHOD_widget.currentTextChanged.connect(self.c)
Ejemplo n.º 2
0
	def prepare(self):
		item.item.prepare(self)
		self.EE = EvtExchanger()
		Device = self.EE.Select(self.var._productName)
		
		try:
			if Device is None:
				raise
		except:
			self.var._productName = u'DUMMY'
			self.Keyboard = Keyboard(self.experiment);
			if not type(self.var._responseTimeout) == int:
				self.var._responseTimeout = None
			oslogger.info("Cannot find ResponseBox: Using Keyboard instead")


		if not type(self.var._responseTimeout) == int and not type(self.var._responseTimeout) == float:
			self.var._responseTimeout = -1
		# Recode Allowed buttons to AllowedEventLines
		self.var.AllowedEventLines = 0
		try:
			AllowedList = self.var._allowedButtons.split(";")
			for x in AllowedList:
				self.var.AllowedEventLines +=  (1 << (int(x,10) -1))
		except:
			x = self.var._allowedButtons
			self.var.AllowedEventLines =  (1 << (x-1))
Ejemplo n.º 3
0
    def init_edit_widget(self):

        # Pass the word on to the parent
        qtautoplugin.init_edit_widget(self)

        EE = EvtExchanger()
        listofdevices = EE.Attached()
        for i in listofdevices:
            self.ProductName_widget.addItem(i)
Ejemplo n.º 4
0
    def prepare(self):
        item.item.prepare(self)
        self.EE = EvtExchanger()
        Device = self.EE.Select(self.var._productName)

        try:
            if Device is None:
                raise
        except:
            self.var._productName = u'DUMMY'
            oslogger.info("Cannot find eventexchanger: code to debugwindow")
Ejemplo n.º 5
0
    def prepare(self):

        """The preparation phase of the plug-in goes here."""
        item.prepare(self)
        self.EE = EvtExchanger()
        Devices = self.EE.Select(self.var.VAS_ENCODER_ID)

        try:
            self.EE.RENC_SetUp(1024, 0, int(1024*(self.var.VAS_CURSOR_STARTPOSITION/100.0)), 1, 1)
            if Devices[0] is None:
                raise

        except:
            self.var.VAS_ENCODER_ID = u"MOUSE"
            oslogger.info("Cannot find encoder input device: Using mouse")

                        
        
        # Checking the excistence of the VAS elements is only possible in the runphase
        # as only then the full canvas is availeable
        
        self.c = Canvas(self.experiment)
        
        self._Keyboard = Keyboard(self.experiment, timeout = 0);
        
        self._Mouse = Mouse(self.experiment)
        my_canvas = self.experiment.items[self.var.VAS_CANVAS_NAME].canvas
        
        try:
            if my_canvas[self.var.VAS_CURSOR_NAME] == None or my_canvas[self.var.VAS_BODY_NAME] == None:
                oslogger.info("Should not occur")
        except Exception as e:
            raise osexception(u"Prepare: READ the VAS manual:\n\rNo VAS elements found on the named canvas")
        
        self.c = self.experiment.items[self.var.VAS_CANVAS_NAME].canvas
        self.c[self.var.VAS_CURSOR_NAME].sx = (self.c[self.var.VAS_BODY_NAME].sx+self.c[self.var.VAS_BODY_NAME].ex) / 2.0
        self.c[self.var.VAS_CURSOR_NAME].ex = self.c[self.var.VAS_CURSOR_NAME].sx
        
        self.VASLENGTH = self.c[self.var.VAS_BODY_NAME].ex - self.c[self.var.VAS_BODY_NAME].sx
        self.SHOWTIMER = False
        if self.var.VAS_EXIT_METHOD == 'TIME':
            if my_canvas[self.var.VAS_CURSOR_NAME] != None:
                self.SHOWTIMER = True
                self.w = self.c[self.var.VAS_TIMER_NAME].ex - self.c[self.var.VAS_TIMER_NAME].sx
                self.h = self.c[self.var.VAS_TIMER_NAME].ey - self.c[self.var.VAS_TIMER_NAME].sy
                self.TIMER_DIR = 'vert'
                self.TIMERSIZE = self.h
                if (abs(self.w) > abs(self.h)): 
                    self.TIMER_DIR = 'horiz'
                    self.TIMERSIZE = self.w
Ejemplo n.º 6
0
	def prepare(self):
		self.experiment.set("ShockDuration", self.var._duration)
		self.var._min_intershock_interval = 1
		item.item.prepare(self)
		self.EE = EvtExchanger()
		Device = self.EE.Select(self.var._productName)

		try:
			if Device is None:
				raise
		except:
			self.var._productName = u"DUMMY"
			oslogger.warning("Did not find a shocker: code to debugwindow")
			
		if self.var._calibrate == u"Calibrate":
			self.Calibrate_Prepare()
		elif self.var._calibrate == u"Shock":
			self.Do_Shock_Prepare()
Ejemplo n.º 7
0
	def init_edit_widget(self):
	# Pass the word on to the parent
		qtautoplugin.init_edit_widget(self)

		EE = EvtExchanger()
		listOfDevices = EE.Attached(u"SHOCKER")
		# if there is no shocker attached, the selected name defaults to 'Dummy' again.
		if listOfDevices:
			for i in listOfDevices:
				self.ProductName_widget.addItem(i)
		else:
			self.var._productName = u"DUMMY"
		
		self.duration_widget.setEnabled(False)
		
		self.value_widget.returnPressed.connect(self.perc_check)
		self.Calibrate_widget.currentTextChanged.connect(self.type_check)
		self.value_widget.setEnabled(self.Calibrate_widget.currentText() == u'Shock')