def __init__(self,parent=None,flags=0):
        QtGui.QDialog.__init__(self,parent)

        self.sourceidf = idfdata.idfData()
        self.sourcemodel = idfabstractmodel.idfAbstractModel(self.sourceidf)
        self.destidf = idfdata.idfData()
        self.destmodel = idfabstractmodel.idfAbstractModel(self.destidf)
        self.sourceclasslist = QtGui.QTreeView()
        self.sourceclasslist.setModel(self.sourcemodel)
        self.sourceclasslist.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
        self.sourceclasslist.header().setClickable(True)
        self.destclasslist = QtGui.QTreeView()
        self.destclasslist.setModel(self.destmodel)
        self.classdata = QtGui.QTextEdit()
        self.classdata.setReadOnly(True)
        self.classdata.setWordWrapMode(QtGui.QTextOption.NoWrap)
        self.todest = QtGui.QPushButton('-->')
        self.tosource = QtGui.QPushButton('<--')
        buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel);
        self.loadfilebutton = QtGui.QPushButton('&Load IDF File')
        self.loaddependancies = QtGui.QCheckBox('&Copy Dependancies?')
        self.loaddependancies.setChecked(True)
        
        hl = QtGui.QHBoxLayout(self)
        vl = QtGui.QVBoxLayout()
        
        vl.addWidget(self.loadfilebutton)
        vl.addWidget(self.sourceclasslist)
        vl.addWidget(self.classdata)

        vc = QtGui.QVBoxLayout()
        vc.addStretch()
        vc.addWidget(self.todest)
        vc.addWidget(self.tosource)
        vc.addStretch()

        rv = QtGui.QVBoxLayout()
        
        rv.addWidget(self.destclasslist)
        rv.addWidget(self.loaddependancies)

        rv.addWidget(buttonBox)
        

        self.connect(buttonBox, QtCore.SIGNAL('accepted()'), self.accept);
        self.connect(buttonBox, QtCore.SIGNAL('rejected()'), self.reject);
        self.connect(self.todest, QtCore.SIGNAL('pressed()'), self.moveToDest);
        self.connect(self.tosource, QtCore.SIGNAL('pressed()'), self.moveToSource);
        self.connect(self.loadfilebutton, QtCore.SIGNAL('pressed()'), self.loadFile);
        self.connect(self.sourceclasslist, QtCore.SIGNAL('activated(QModelIndex)'), self.sourceListActivated);
        self.connect(self.sourceclasslist.header(),QtCore.SIGNAL('sectionClicked ( int )'),self.classlistsort)
        
        hl.addLayout(vl)
        hl.addLayout(vc)
        hl.addLayout(rv)
        self.selected = []
        self.loadFile()
        self.sortorderlist = [-1,-1]
    def classPage(self):
        self.idf = idfdata.idfData()
        self.model = idfabstractmodel.idfAbstractModel(self.idf)

        self.querylist = QtGui.QComboBox()
        self.querylist.addItems(['All','Classname','Name','Group','Dependancy','Reference','Fieldname','Fieldvalue'])

        self.queryline = QtGui.QLineEdit()
        self.querybutton = QtGui.QPushButton("Query")

        self.view = QtGui.QTreeView()
        self.view.setModel(self.model)
        self.view.sizePolicy().setHorizontalPolicy(QtGui.QSizePolicy.Fixed)
        self.view.header().setClickable(True)
        
        splitter = QtGui.QSplitter()
        widget = QtGui.QWidget()

        mainhbox = QtGui.QHBoxLayout(widget)
        self.viewwidget = QtGui.QWidget()
        vbox = QtGui.QVBoxLayout()
        vbox.setSizeConstraint(QtGui.QLayout.SetMinAndMaxSize)
        hbox = QtGui.QHBoxLayout()

        hbox.addWidget(self.querylist)
        hbox.addWidget(self.queryline)

        vbox.addLayout(hbox)
        vbox.addWidget(self.querybutton)
        vbox.addWidget(self.view)
        self.viewwidget.setLayout(vbox)
        splitter.addWidget(self.viewwidget)
#        mainhbox.addWidget(viewwidget)
        classvbox = QtGui.QVBoxLayout()
        self.classviewname = QtGui.QLabel()
        self.classview = QtGui.QTableView()
        self.delegate  = idfmodeldelegate.idfClassDelegate()
        self.classview.setItemDelegate(self.delegate)
        self.classview.setEditTriggers(QtGui.QAbstractItemView.AllEditTriggers)
        self.classview.horizontalHeader().setStretchLastSection(True)
        
        classvbox.addWidget(self.classviewname)
        classvbox.addWidget(self.classview)
        mainhbox.addLayout(classvbox)
        splitter.addWidget(widget)
        self.connect(self.view, QtCore.SIGNAL('activated (QModelIndex)'),self.classActivated)
        
        self.connect(self.querybutton, QtCore.SIGNAL('clicked ( bool)'),self.querybuttonclicked)
        self.connect(self.view.header(),QtCore.SIGNAL('sectionClicked ( int )'),self.viewlistsort)

        return splitter
 def openFile(self):
     self.fileName = QtGui.QFileDialog.getOpenFileName(self, "Open IDF File", ".", "*.idf *.IDF")
     print self.fileName
     if self.fileName == "":
         return
     self.idfdata.openIdf(self.fileName)
     self.parentmodel = idfabstractmodel.idfAbstractModel(self.idfdata)
     self.tabs.addTab(self.headerPage(), "IDF File Description")
     self.commentedit.setText(self.idfdata.comments)
     for g in self.idfdata.groups:
         t = idfeditorclasslistpage.idfEditorClassListPage(g, self.parentmodel)
         self.idfgroupsdict[g] = t
         self.tabs.addTab(t, g)
         self.createGroupAction(g)
globaldefault = defaultConstruction()













if __name__ == "__main__":
    import sys
    import idfdata
    from PyQt4 import QtGui

    try:
        fname = sys.argv[1]
    except:
        fname = '5ZoneTDV.idf'

    f = idfdata.idfData()
    f.openIdf(fname)

    model = idfabstractmodel.idfAbstractModel(f)
    default = defaultContruction(model)
    print default.defaultlist