from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4 import QtDesigner
from Widgets.fileSelectorWidget import *

_logo_16x16_xpm=["16 16 15 1","   c #FFFFFF",".  c #CDCDCD",
"+  c #323232","@  c #808080","#  c #676767","$  c #0D0D0D",
"%  c #191919","&  c #000000","*  c #A5A5A5","=  c #404040",
"-  c #202020",";  c #4C4C4C",">  c #171717",",  c #989898",
"'  c #B9B9B9","                ","                ","                ",
"    .+   @#     ","    #$@ .%%     ","    +#@ @@+.    ",
"   .+.+ & .+    ","   @@ +*+ .+    ","   == @-=  @@   ",
"   &  =$.  @@   ","   &  ==    &   ","  ==  @@    @@  ",
"  &         .+  "," ;>          &  "," ,'           & ",
"                "]

_logo_pixmap = QtGui.QPixmap(_logo_16x16_xpm)
    
class fileSelectorWidgetPlugin(QtDesigner.QPyDesignerCustomWidgetPlugin):
    def __init__(self, parent = None):
        QtDesigner.QPyDesignerCustomWidgetPlugin.__init__(self)
        self.initialized = False
    
    def initialize(self, core):
        if self.initialized:
            return
        self.initialized  = True
    
    def isInitalized(self):
        return self.initialized
        
    def createWidget(self, parent):
        return fileSelectorWidget(parent)
    
    def name(self):
        return "fileSelectorWidget"
    
    def group(self):
        return "Input Widgets"
    
    def icon(self):
        return QtGui.QIcon(_logo_pixmap)
    
    def toolTip(self):
        return "File input dialog with edit line."
    
    def whatsThis(self):
        return "A file input dialog with a line edit and a button, creating a file selector."
    
    def isContainer(self):
        return False
    
    def domXml(self):
        return (
           '<widget class="fileSelectorWidget" name=\"fileSelector\">\n'
           " <property name=\"toolTip\" >\n"
           "  <string>File input dialog with edit line.</string>\n"
           " </property>\n"
           " <property name=\"whatsThis\" >\n"
           "  <string>A file input dialog with a line edit and a button, creating a file selector.</string>\n"
           " </property>\n"
           "</widget>\n"
           )

    def includeFile(self):
        return "Widgets.fileSelectorWidget"
