import numpy, vigra
import random

from ilastik.gui.ribbons.ilastikTabBase import IlastikTabBase

from PyQt4 import QtGui, QtCore

from ilastik.gui.iconMgr import ilastikIcons

from ilastik.gui.overlaySelectionDlg import OverlaySelectionDialog
from ilastik.gui.overlayWidget import OverlayWidget
from ilastik.gui.shortcutmanager import shortcutManager
from ilastik.gui import volumeeditor as ve

class HelpTab(IlastikTabBase, QtGui.QWidget):
    name = 'Help'
    position = 101
    moduleName = "Help"
    
    def __init__(self, parent=None):
        IlastikTabBase.__init__(self, parent)
        QtGui.QWidget.__init__(self, parent)
        
        self._initContent()
        self._initConnects()
        
    def on_activation(self):
        overlayWidget = OverlayWidget(self.ilastik.labelWidget, self.ilastik.project.dataMgr)
        overlayWidget.setVisible(False)
        self.ilastik.labelWidget.setOverlayWidget(overlayWidget)
        self.ilastik.labelWidget.setLabelWidget(ve.DummyLabelWidget())
               
    def on_deActivation(self):
        pass
        
    def _initContent(self):

        tl = QtGui.QHBoxLayout()      
        self.btnShortcuts = QtGui.QPushButton(QtGui.QIcon(ilastikIcons.Help),'Shortcuts')
        self.btnAbout = QtGui.QPushButton(QtGui.QIcon(ilastikIcons.Help),'About')
      
        self.btnShortcuts.setToolTip('Show a list of ilastik shortcuts')
        
        tl.addWidget(self.btnShortcuts)
        tl.addWidget(self.btnAbout)
        tl.addStretch()
        
        self.setLayout(tl)
        #self.shortcutManager = shortcutManager()
        
    def _initConnects(self):
        self.connect(self.btnShortcuts, QtCore.SIGNAL('clicked()'), self.on_btnShortcuts_clicked)
        
    def on_btnShortcuts_clicked(self):
        shortcutManager.showDialog(self.ilastik)
@@ -725,32 +725,306 @@
 tivation(self):%0A
+        ovs = self.ilastik._activeImage.module%5Bself.__class__.moduleName%5D.getOverlayRefs()%0A        if len(ovs) == 0:%0A            raw = self.ilastik._activeImage.overlayMgr%5B%22Raw Data%22%5D%0A            if raw is not None:%0A                ovs.append(raw.getRef())%0A                %0A
         overlayW

fix help ribbon