class URLChoosePage(QtGui.QWizardPage):
    def __init__(self, parent=None):
        super(URLChoosePage, self).__init__(parent)
        self.parent = parent
        self.last_selected = None

        self.ui = Ui_WrapperTrainingPage()
        self.ui.setupUi(self)

        self.setCommitPage(True)
        self.setButtonText(QtGui.QWizard.CommitButton, "Train")

        self.registerField("url*", self.ui.urlLine)

        self.ui.urls.itemSelectionChanged.connect(self.update_url_line)

    def initializePage(self):
        urls_list = []

        # Populate available URLs
        for collection in self.parent.wrapper_gw.find_wrapper_collections():
            if collection.url in urls_list:
                continue
            item = QtGui.QTreeWidgetItem(self.ui.urls)
            item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
            item.setText(0, QtGui.QApplication.translate("", collection.url, None, QtGui.QApplication.UnicodeUTF8))
            urls_list.append(collection.url)

    def update_url_line(self):
        items = self.ui.urls.selectedItems()
        if not items:
            return
        selected = items[0]
        self.ui.urlLine.setText(selected.text(0))
    def __init__(self, parent=None):
        super(URLChoosePage, self).__init__(parent)
        self.parent = parent
        self.last_selected = None

        self.ui = Ui_WrapperTrainingPage()
        self.ui.setupUi(self)

        self.setCommitPage(True)
        self.setButtonText(QtGui.QWizard.CommitButton, "Train")

        self.registerField('url*', self.ui.urlLine)

        self.ui.urls.itemSelectionChanged.connect(self.update_url_line)
    def __init__(self, parent=None):
        super(URLChoosePage, self).__init__(parent)
        self.parent = parent
        self.last_selected = None

        self.ui = Ui_WrapperTrainingPage()
        self.ui.setupUi(self)

        self.setCommitPage(True)
        self.setButtonText(QtGui.QWizard.CommitButton, "Train")

        self.registerField("url*", self.ui.urlLine)

        self.ui.urls.itemSelectionChanged.connect(self.update_url_line)
class URLChoosePage(QtGui.QWizardPage):
    def __init__(self, parent=None):
        super(URLChoosePage, self).__init__(parent)
        self.parent = parent
        self.last_selected = None

        self.ui = Ui_WrapperTrainingPage()
        self.ui.setupUi(self)

        self.setCommitPage(True)
        self.setButtonText(QtGui.QWizard.CommitButton, "Train")

        self.registerField('url*', self.ui.urlLine)

        self.ui.urls.itemSelectionChanged.connect(self.update_url_line)

    def initializePage(self):
        urls_list = []

        # Populate available URLs
        for collection in self.parent.wrapper_gw.find_wrapper_collections():
            if collection.url in urls_list:
                continue
            item = QtGui.QTreeWidgetItem(self.ui.urls)
            item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
            item.setText(
                0,
                QtGui.QApplication.translate("", collection.url, None,
                                             QtGui.QApplication.UnicodeUTF8))
            urls_list.append(collection.url)

    def update_url_line(self):
        items = self.ui.urls.selectedItems()
        if not items:
            return
        selected = items[0]
        self.ui.urlLine.setText(selected.text(0))