Beispiel #1
0
	def _restoreButton(self, but):
		# restore former function of translation (but == 0) or
		# pivot button (but == 1)
		restoreFunc = self.normMouse[but]
		restoreArgs = self.labelValues[self.clipMouse[but]] + (
								restoreFunc,)
		mousemodes.setButtonFunction(*restoreArgs)
Beispiel #2
0
	def _mouseModeCB(self):
		but, mods = self.labelValues[self._modeButton]
		if self.mouseModeVar.get():
			self._formerMouseMode = mousemodes.getFuncName(but,mods)
			mousemodes.setButtonFunction(but, mods, "rotate bond")
		else:
			mousemodes.setButtonFunction(but, mods,
							self._formerMouseMode)
    def unbind_mouse_button(self):

        if self.bound_button:
            button, modifiers = self.bound_button
            from chimera import mousemodes
            def_mode = mousemodes.getDefault(button, modifiers)
            if def_mode:
                mousemodes.setButtonFunction(button, modifiers, def_mode)
            self.bound_button = None
  def enable(self, enable = True, button = '3', modifiers = [],
             one_use = False,):

    from chimera import mousemodes
    if enable:
      mousemodes.setButtonFunction(button, modifiers, 'resize surfaces')
      self.one_use = (button, modifiers)
    else:
      def_mode = mousemodes.getDefault(button, modifiers)
      mousemodes.setButtonFunction(button, modifiers, def_mode)
Beispiel #5
0
    def unbind_mouse_button(self):
        """unbind_mouse_button()

        """

        if self.bound_button:
            button, modifiers = self.bound_button
            from chimera import mousemodes
            def_mode = mousemodes.getDefault(button, modifiers)
            if def_mode:
                mousemodes.setButtonFunction(button, modifiers, def_mode)
            self.bound_button = None
Beispiel #6
0
    def bind_mouse_button(self, button, modifiers):
        """bind_mouse_button(button, modifiers)

        """

        # first unbind and then bind
        self.unbind_mouse_button()
        
        from chimera import mousemodes
        mousemodes.setButtonFunction(button, modifiers, self.mode_name)

        self.bound_button = (button, modifiers)
    def set_mouse_mode(self, constrain, unconstrained_mode_name,
                       constrained_mode_name):

        find_binding = self.find_mouse_binding
        uc_button, uc_modifiers = find_binding(unconstrained_mode_name)
        c_button, c_modifiers = find_binding(constrained_mode_name)
        if constrain:
            if c_button == None and uc_button:
                from chimera import mousemodes
                mousemodes.setButtonFunction(uc_button, uc_modifiers,
                                             constrained_mode_name)
            # TODO: should warn if no button is assigned
        else:
            if c_button and uc_button == None:
                from chimera import mousemodes
                mousemodes.setButtonFunction(c_button, c_modifiers,
                                             unconstrained_mode_name)
Beispiel #8
0
	def _mouseFuncCB(self):
		self.status("")
		if not self.mouseLabelingVar.get():
			if hasattr(self, "_prevMouse"):
				setButtonFunction("1", (), self._prevMouse)
				delattr(self, "_prevMouse")
		elif self.mlLabelVar.get() == self.MOUSE_LABEL_TEXT:
			if not hasattr(self, "_prevMouse"):
				self._prevMouse = getFuncName("1", ())
			setButtonFunction("1", (), "place text")
		else:
			if not hasattr(self, "_prevMouse"):
				self._prevMouse = getFuncName("1", ())
			setButtonFunction("1", (), "place key")
Beispiel #9
0
 def _mouseFuncCB(self):
     self.status("")
     if not self.mouseLabelingVar.get():
         if hasattr(self, "_prevMouse"):
             setButtonFunction("1", (), self._prevMouse)
             delattr(self, "_prevMouse")
     elif self.mlLabelVar.get() == self.MOUSE_LABEL_TEXT:
         if not hasattr(self, "_prevMouse"):
             self._prevMouse = getFuncName("1", ())
         setButtonFunction("1", (), "place text")
     else:
         if not hasattr(self, "_prevMouse"):
             self._prevMouse = getFuncName("1", ())
         setButtonFunction("1", (), "place key")
    def bind_mouse_button(self, button, modifiers):

        self.unbind_mouse_button()
        from chimera import mousemodes
        mousemodes.setButtonFunction(button, modifiers, self.mode_name)
        self.bound_button = (button, modifiers)
Beispiel #11
0
    def bind_mouse_button_cb(self):

        bname = self.mouse_button.variable.get()
        button, modifiers = self.button_spec(bname)
        from chimera import mousemodes
        mousemodes.setButtonFunction(button, modifiers, 'pick blobs')
Beispiel #12
0
 def _restoreButton(self, but):
     # restore former function of translation (but == 0) or
     # pivot button (but == 1)
     restoreFunc = self.normMouse[but]
     restoreArgs = self.labelValues[self.clipMouse[but]] + (restoreFunc, )
     mousemodes.setButtonFunction(*restoreArgs)
Beispiel #13
0
 def _activateMouse(self, but, butName):
     self.clipMouse[but] = butName
     args = self.labelValues[butName] + (
         ["plane translate", "plane rotate"][but], )
     mousemodes.setButtonFunction(*args)
Beispiel #14
0
	def _activateMouse(self, but, butName):
		self.clipMouse[but] = butName
		args = self.labelValues[butName] + (["plane translate",
							"plane rotate"][but],)
		mousemodes.setButtonFunction(*args)