import os
from PyQt4 import QtGui, QtCore
from . import workspaces

class Plugin(object):
    title = ''
    location = 'left' # left, bottom, right, app
    widget = None  # The widget for the plugin (set at loadWidget)
    
    def __init__(self,parent=None):
        self.parent = parent
    
    def load(self):
        '''Called when loading the plugin'''
        
    def loadWidget(self):
        '''Load the widget'''
        self.widget = workspaces.WorkspaceWidget(self.parent)
##        self.icon = QtGui.QIcon(self.parent.pluginPath+'workspaces/icon.png')
        
        QtGui.QShortcut(QtCore.Qt.ALT+QtCore.Qt.Key_W,self.parent,self.widget.togglePlugin) 
        
##        self.parent.ui.b_workspaces.clicked.disconnect(self.parent.showWorkspaceMenu)
##        
##        self.parent.ui.b_workspaces.clicked.connect(self.widget.toggleTab)
        
##        tabBar().moveTab(old_position, new_position)
        
        return self.widget