# Path: Canard_settings.py
# class TUSLCache:
#     def __init__(self):
#     def __del__(self):
#     def setProperty(self,uri,obj):
#     def getProperty(self,uri=None):
#     def setObjectClass(self,uri,obj):
#     def getObjectClass(self,uri=None):
#     def insertCache(self,uri,objType,obj):
#     def retrieveCache(self,uri,objType):
# def getPref(key,default=None):
# def setPref(key,value):


import sqblUI
import isoLangCodes
import logging
        import urllib2
    import os, sys
from PyQt4 import QtCore, QtGui
from SQBLmodel import _ns, _namespaces 
from lxml import etree
from Canard_settings import TUSLObjectCache as cache

class repoDialog(QtGui.QDialog, sqblUI.repositorySearch.Ui_Dialog):
    def __init__(self,parent=None,objectType=None,repositories=[],language='en'):
        QtGui.QDialog.__init__(self,parent)
        self.setupUi(self)
        self.language = language
        self.items = None
        self.currentURI = None
        if objectType is not None:
            self.objectTypeValue = objectType
            self.objectType.setVisible(False)
            self.objectTypeLabel.setVisible(False)
        for repository in repositories:
            print repository
            self.repositoryURLs.addItem(repository)

        self.search.clicked.connect(self.doSearch)
        self.retrievedItems.itemSelectionChanged.connect(self.updateDesc)

    def doSearch(self):
        self.retrievedItems.clear()
        url = self.createURL()
        repo = self.repositoryURLs.currentText()
        try:
            x = urllib2.urlopen(url)
            self.items = etree.fromstring(x.read())

# Path: Canard_settings.py
# class TUSLCache:
#     def __init__(self):
#     def __del__(self):
#     def setProperty(self,uri,obj):
#     def getProperty(self,uri=None):
#     def setObjectClass(self,uri,obj):
#     def getObjectClass(self,uri=None):
#     def insertCache(self,uri,objType,obj):
#     def retrieveCache(self,uri,objType):
# def getPref(key,default=None):
# def setPref(key,value):


# Path: SQBLWidgets/repositoryDialog.py
import sqblUI
import isoLangCodes
import logging
        import urllib2
    import os, sys
from PyQt4 import QtCore, QtGui
from SQBLmodel import _ns, _namespaces 
from lxml import etree
from Canard_settings import TUSLObjectCache as cache


class repoDialog(QtGui.QDialog, sqblUI.repositorySearch.Ui_Dialog):
    def __init__(self,parent=None,objectType=None,repositories=[],language='en'):
        QtGui.QDialog.__init__(self,parent)
        self.setupUi(self)
        self.language = language
        self.items = None
        self.currentURI = None
        if objectType is not None:
            self.objectTypeValue = objectType
            self.objectType.setVisible(False)
            self.objectTypeLabel.setVisible(False)
        for repository in repositories:
            print repository
            self.repositoryURLs.addItem(repository)

        self.search.clicked.connect(self.doSearch)
        self.retrievedItems.itemSelectionChanged.connect(self.updateDesc)

    def doSearch(self):
        self.retrievedItems.clear()
        url = self.createURL()
        repo = self.repositoryURLs.currentText()
        try:
            x = urllib2.urlopen(url)
            self.items = etree.fromstring(x.read())

            print x