Created
January 15, 2011 16:01
-
-
Save baoilleach/780996 to your computer and use it in GitHub Desktop.
This file makes Jens happy because it allows Avogadro to be controlled by kinect...almost
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from PyQt4.QtCore import * | |
from PyQt4.QtGui import * | |
##import sys | |
##sys.path.append("C:\\Python26\\Lib\\site-packages") | |
##sys.path.append("C:\\Python26\\lib") | |
import Avogadro as avo | |
class Extension(QObject): | |
def __init__(self): | |
QObject.__init__(self) | |
def name(self): # Recommended | |
return "Control with kinect" | |
def description(self): # Recommended | |
return "Control with kinect" | |
def actions(self): # Required | |
actions = [] | |
# Actions are just instances of the QAction class from PyQt4 | |
action = QAction(self) | |
action.setText("Control with kinect") | |
actions.append(action) | |
return actions | |
def performAction(self, action, glwidget): # Required | |
# Only one action so need to check its identity | |
currentMol = glwidget.molecule | |
center = currentMol.center | |
avo.Navigate.rotate(glwidget, center, 10, 0) # rotate around y | |
## avo.Navigate.zoom(glwidget, center, -50) # zoom in | |
currentMol.update() # Force update where molecule is opened from file(!) | |
return None |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment