Beispiel #1
0
    def build_widget(self):
        layout = QtGui.QVBoxLayout()
        layout.setMargin(4)
        layout.setSpacing(2)
        self.searchBox = QSearchBox(True, False, self)
        layout.addWidget(self.searchBox)
        radio_layout = QtGui.QHBoxLayout()
        radio_layout.setSpacing(5)
        radio_layout.setAlignment(QtCore.Qt.AlignLeft)
        radio_layout.addWidget(QtGui.QLabel("Search:"))
        searchAll = QtGui.QRadioButton("Open Vistrails")
        searchCurrent = QtGui.QRadioButton("Current Vistrail")
        searchWorkflow = QtGui.QRadioButton("Current Workflow")
        self.level_group = QtGui.QButtonGroup()
        self.level_group.addButton(searchAll)
        self.level_group.addButton(searchCurrent)
        self.level_group.addButton(searchWorkflow)
        self.level_map = \
            Bidict([(QueryController.LEVEL_ALL, searchAll),
                    (QueryController.LEVEL_VISTRAIL, searchCurrent),
                    (QueryController.LEVEL_WORKFLOW, searchWorkflow)])
        radio_layout.addWidget(searchAll)
        radio_layout.addWidget(searchCurrent)
        radio_layout.addWidget(searchWorkflow)
        searchCurrent.setChecked(True)
        
        self.editButton = QtGui.QPushButton("Edit")
        self.editButton.setEnabled(False)
        self.backButton = QtGui.QPushButton("Back to Search")
        self.backButton.setEnabled(False)
        radio_layout.addStretch(1)
        radio_layout.addWidget(self.editButton, 0, QtCore.Qt.AlignRight)
        radio_layout.addWidget(self.backButton, 0, QtCore.Qt.AlignRight)
        layout.addLayout(radio_layout)
        self.setLayout(layout)

        self.connect(self.searchBox, QtCore.SIGNAL('resetSearch()'),
                     self.resetSearch)
        self.connect(self.searchBox, QtCore.SIGNAL('executeSearch(QString)'),
                     self.executeSearch)
        self.connect(self.searchBox, QtCore.SIGNAL('refineMode(bool)'),
                     self.refineMode)
        self.connect(self.backButton, QtCore.SIGNAL('clicked()'),
                     self.backToSearch)
        self.connect(self.editButton, QtCore.SIGNAL('clicked()'),
                     self.doEdit)
        self.connect(self.level_group, 
                     QtCore.SIGNAL('buttonClicked(QAbstractButton*)'),
                     self.levelChanged)
    def __init__(self, parent=None):
        """ QSearchToolBar(parent: QWidget) -> QSearchToolBar
        
        """
        QAddonToolBar.__init__(self, parent)
        self.setWindowTitle('Search')
        self.setIconSize(QtCore.QSize(16, 16))

        self.searchBox = QSearchBox(self)
        self.searchBox.resetButton.hide()
        self.searchBox.searchButton.hide()
        self.searchBox.searchEdit.setToolTip('Search Examples: "setAttr", "before:4 July 2009", "user:bob"')

        self.viewAction = QtGui.QToolButton(self)
        self.viewAction.setIcon(CurrentTheme.QUERY_ARROW_ICON)
        self.viewAction.setToolTip('View')
        self.viewAction.setStatusTip('Search or refine view')
        self.viewAction.setPopupMode(QtGui.QToolButton.InstantPopup)
        self.viewAction.setMenu(self.searchBox.searchMenu)
        self.addWidget(self.viewAction)

        self.addWidget(self.searchBox)

        self.connect(self.searchBox, QtCore.SIGNAL('executeSearch(QString)'),
                     self.executeSearch)
        self.connect(self.searchBox, QtCore.SIGNAL('refineMode(bool)'),
                     self.refineMode)
        self.connect(self.searchBox, QtCore.SIGNAL('resetSearch()'),
                     self.resetSearch)

        tva = self.toggleViewAction()
        tva.setIcon(CurrentTheme.QUERY_VIEW_ICON)
        tva.setToolTip('Search')
        tva.setStatusTip('Search and refine the version tree')
        tva.setShortcut('Ctrl+F')
Beispiel #3
0
    def build_gui(self, path_type):
        layout = QtGui.QVBoxLayout()
        self.search_ref = QSearchBox(False, False)

        self.connect(self.search_ref, QtCore.SIGNAL('executeSearch(QString)'),
                     self.search_string)
        self.connect(self.search_ref, QtCore.SIGNAL('resetSearch()'),
                     self.reset_search)

        layout.addWidget(self.search_ref)
        self.ref_widget = PersistentRefView(path_type, self)
        layout.addWidget(self.ref_widget)
        layout.setMargin(0)
        self.setLayout(layout)
Beispiel #4
0
    def build_gui(self, is_input, path_type):
        self.current_path = ""

        layout = QtGui.QVBoxLayout()
        #         layout.setMargin(0)
        #         layout.setSpacing(0)

        if not is_input:
            self.managed_change = \
                QtGui.QRadioButton("Always Create New Reference")
            layout.addWidget(self.managed_change)
            self.connect(self.managed_change, QtCore.SIGNAL("toggled(bool)"),
                         self.managed_toggle)

        else:
            self.managed_change = None

        self.managed_new = QtGui.QRadioButton("Create New Reference")
        self.connect(self.managed_new, QtCore.SIGNAL("toggled(bool)"),
                     self.new_toggle)
        layout.addWidget(self.managed_new)
        self.new_group = QtGui.QGroupBox()
        new_layout = QtGui.QGridLayout()
        self.new_file = None
        if is_input:
            new_layout.addWidget(QtGui.QLabel("Path:"), 0, 0)
            self.new_file = self.get_chooser_layout()
            new_layout.addLayout(self.new_file, 0, 1)
            self.connect(self.new_file, QtCore.SIGNAL("pathnameChanged()"),
                         self.new_file_changed)
        new_layout.addWidget(QtGui.QLabel("Name:"), 1, 0)
        self.name_edit = QtGui.QLineEdit()
        new_layout.addWidget(self.name_edit, 1, 1)
        new_layout.addWidget(QtGui.QLabel("Tags:"), 2, 0)
        self.tags_edit = QtGui.QLineEdit()
        new_layout.addWidget(self.tags_edit, 2, 1)
        self.new_group.setLayout(new_layout)
        layout.addWidget(self.new_group)

        self.managed_existing = QtGui.QRadioButton("Use Existing Reference")
        self.connect(self.managed_existing, QtCore.SIGNAL("toggled(bool)"),
                     self.existing_toggle)
        layout.addWidget(self.managed_existing)
        self.existing_group = QtGui.QGroupBox()
        existing_layout = QtGui.QVBoxLayout()
        self.search_ref = QSearchBox(False, False)

        self.connect(self.search_ref, QtCore.SIGNAL('executeSearch(QString)'),
                     self.search_string)
        self.connect(self.search_ref, QtCore.SIGNAL('resetSearch()'),
                     self.reset_search)

        existing_layout.addWidget(self.search_ref)
        self.ref_widget = ManagedRefView(path_type, self)
        existing_layout.addWidget(self.ref_widget)
        self.existing_group.setLayout(existing_layout)
        layout.addWidget(self.existing_group)

        self.keep_local = QtGui.QCheckBox("Keep Local Version")
        layout.addWidget(self.keep_local)
        self.connect(self.keep_local, QtCore.SIGNAL("toggled(bool)"),
                     self.local_toggle)
        self.local_group = QtGui.QGroupBox()
        local_layout = QtGui.QGridLayout()
        self.local_path = self.get_chooser_layout()
        local_layout.addLayout(self.local_path, 0, 0, 1, 2)

        self.r_priority_local = QtGui.QCheckBox("Read From Local Path")
        local_layout.addWidget(self.r_priority_local, 1, 0)
        self.write_managed_checkbox = QtGui.QCheckBox("Write To Local Path")
        local_layout.addWidget(self.write_managed_checkbox, 1, 1)
        self.local_group.setLayout(local_layout)
        layout.addWidget(self.local_group)

        if is_input:
            self.r_priority_local.setEnabled(True)
            self.write_managed_checkbox.setEnabled(False)
        else:
            self.r_priority_local.setEnabled(False)
            self.write_managed_checkbox.setEnabled(True)

        button_layout = QtGui.QHBoxLayout()
        button_layout.setDirection(QtGui.QBoxLayout.RightToLeft)
        button_layout.setAlignment(QtCore.Qt.AlignRight)
        ok_button = QtGui.QPushButton("OK")
        ok_button.setFixedWidth(100)
        self.connect(ok_button, QtCore.SIGNAL('clicked()'), self.ok_triggered)
        button_layout.addWidget(ok_button)
        cancel_button = QtGui.QPushButton("Cancel")
        cancel_button.setFixedWidth(100)
        self.connect(cancel_button, QtCore.SIGNAL('clicked()'), self.cancel)
        button_layout.addWidget(cancel_button)
        layout.addLayout(button_layout)
        self.setLayout(layout)
Beispiel #5
0
    def __init__(self, param, parent=None):
        QtGui.QDialog.__init__(self, parent)
        # two tabs, one for starting from managed, one for local file
        # options are set accordingly
        # uuid assigned when options are set, either new or existing
        # don't compute uuid for local file that hasn't been run
        # need ManagedReference parameter
        # allow user to pass contents in to ManagedRef
        self.setWindowTitle("Configure Managed Reference...")

        self.settings = {
            'ref_id': None,
            'ref_version': None,
            'local_path': None,
            'versioning': False,
            'local_read_priority': True,
            'write_back': True
        }

        self.current_file = ""
        db_file = "/vistrails/managed/files.db"

        layout = QtGui.QVBoxLayout()
        managed_group = QtGui.QGroupBox("Managed Data")
        managed_layout = QtGui.QVBoxLayout()
        search = QSearchBox(False, False)

        def keyPressEvent(obj, e):
            print "got to key press event", e.key()
            if e.key() in (QtCore.Qt.Key_Return, QtCore.Qt.Key_Enter):
                if obj.currentText():
                    obj.emit(QtCore.SIGNAL('executeSearch(QString)'),
                             obj.searchEdit.currentText())
                else:
                    obj.emit(QtCore.SIGNAL('resetSearch()'))
            QtGui.QComboBox.keyPressEvent(obj, e)

        print 'keyPressEvent:', search.searchEdit.keyPressEvent
        search.searchEdit.keyPressEvent = keyPressEvent
        print 'keyPressEvent:', search.searchEdit.keyPressEvent
        self.connect(search, QtCore.SIGNAL('executeSearch(QString)'),
                     self.search_string)
        self.connect(search, QtCore.SIGNAL('resetSearch()'), self.reset_search)
        managed_layout.addWidget(search)
        self.table = ManagedRefView(db_file, self)
        managed_layout.addWidget(self.table)
        managed_group.setLayout(managed_layout)
        layout.addWidget(managed_group)

        local_group = QtGui.QGroupBox("Local Data")
        local_layout = QtGui.QHBoxLayout()
        self.filename_edit = QtGui.QLineEdit()
        local_layout.addWidget(self.filename_edit)

        filename_button = QtGui.QToolButton()
        filename_button.setIcon(
            QtGui.QIcon(filename_button.style().standardPixmap(
                QtGui.QStyle.SP_DirOpenIcon)))
        filename_button.setIconSize(QtCore.QSize(12, 12))
        filename_button.connect(filename_button, QtCore.SIGNAL('clicked()'),
                                self.choose_file)
        local_layout.addWidget(filename_button)
        local_group.setLayout(local_layout)
        layout.addWidget(local_group)

        pref_layout = QtGui.QHBoxLayout()
        version_group = QtGui.QGroupBox("Versioning")
        version_layout = QtGui.QVBoxLayout()
        version_off = QtGui.QRadioButton("Create New ID")
        version_layout.addWidget(version_off)
        version_on = QtGui.QRadioButton("Create New Version")
        version_layout.addWidget(version_on)
        version_group.setLayout(version_layout)
        pref_layout.addWidget(version_group)

        r_priority_group = QtGui.QGroupBox("Read Priority")
        r_priority_layout = QtGui.QVBoxLayout()
        r_priority_off = QtGui.QRadioButton("Local")
        r_priority_layout.addWidget(r_priority_off)
        r_priority_on = QtGui.QRadioButton("Managed Store")
        r_priority_layout.addWidget(r_priority_on)
        r_priority_group.setLayout(r_priority_layout)
        pref_layout.addWidget(r_priority_group)

        w_priority_group = QtGui.QGroupBox("Write Priority")
        w_priority_layout = QtGui.QVBoxLayout()
        w_priority_off = QtGui.QRadioButton("Local")
        w_priority_layout.addWidget(w_priority_off)
        w_priority_on = QtGui.QRadioButton("Managed Store")
        w_priority_layout.addWidget(w_priority_on)
        w_priority_group.setLayout(w_priority_layout)
        pref_layout.addWidget(w_priority_group)
        layout.addLayout(pref_layout)

        button_layout = QtGui.QHBoxLayout()
        button_layout.setDirection(QtGui.QBoxLayout.RightToLeft)
        button_layout.setAlignment(QtCore.Qt.AlignRight)
        ok_button = QtGui.QPushButton("OK")
        ok_button.setFixedWidth(100)
        self.connect(ok_button, QtCore.SIGNAL('clicked()'), self.close)
        button_layout.addWidget(ok_button)
        cancel_button = QtGui.QPushButton("Cancel")
        cancel_button.setFixedWidth(100)
        self.connect(cancel_button, QtCore.SIGNAL('clicked()'), self.cancel)
        button_layout.addWidget(cancel_button)
        layout.addLayout(button_layout)
        self.setLayout(layout)
Beispiel #6
0
class QQueryBox(QtGui.QWidget):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.build_widget()
        self.controller = None

    def set_controller(self, controller=None):
        self.controller = controller

    def build_widget(self):
        layout = QtGui.QVBoxLayout()
        layout.setMargin(4)
        layout.setSpacing(2)
        self.searchBox = QSearchBox(True, False, self)
        layout.addWidget(self.searchBox)
        radio_layout = QtGui.QHBoxLayout()
        radio_layout.setSpacing(5)
        radio_layout.setAlignment(QtCore.Qt.AlignLeft)
        radio_layout.addWidget(QtGui.QLabel("Search:"))
        searchAll = QtGui.QRadioButton("Open Vistrails")
        searchCurrent = QtGui.QRadioButton("Current Vistrail")
        searchWorkflow = QtGui.QRadioButton("Current Workflow")
        self.level_group = QtGui.QButtonGroup()
        self.level_group.addButton(searchAll)
        self.level_group.addButton(searchCurrent)
        self.level_group.addButton(searchWorkflow)
        self.level_map = \
            Bidict([(QueryController.LEVEL_ALL, searchAll),
                    (QueryController.LEVEL_VISTRAIL, searchCurrent),
                    (QueryController.LEVEL_WORKFLOW, searchWorkflow)])
        radio_layout.addWidget(searchAll)
        radio_layout.addWidget(searchCurrent)
        radio_layout.addWidget(searchWorkflow)
        searchCurrent.setChecked(True)
        
        self.editButton = QtGui.QPushButton("Edit")
        self.editButton.setEnabled(False)
        self.backButton = QtGui.QPushButton("Back to Search")
        self.backButton.setEnabled(False)
        radio_layout.addStretch(1)
        radio_layout.addWidget(self.editButton, 0, QtCore.Qt.AlignRight)
        radio_layout.addWidget(self.backButton, 0, QtCore.Qt.AlignRight)
        layout.addLayout(radio_layout)
        self.setLayout(layout)

        self.connect(self.searchBox, QtCore.SIGNAL('resetSearch()'),
                     self.resetSearch)
        self.connect(self.searchBox, QtCore.SIGNAL('executeSearch(QString)'),
                     self.executeSearch)
        self.connect(self.searchBox, QtCore.SIGNAL('refineMode(bool)'),
                     self.refineMode)
        self.connect(self.backButton, QtCore.SIGNAL('clicked()'),
                     self.backToSearch)
        self.connect(self.editButton, QtCore.SIGNAL('clicked()'),
                     self.doEdit)
        self.connect(self.level_group, 
                     QtCore.SIGNAL('buttonClicked(QAbstractButton*)'),
                     self.levelChanged)

    def resetSearch(self, emit_signal=True):
        """
        resetSearch() -> None

        """
        if self.controller and emit_signal:
            self.controller.reset_search()
            self.emit(QtCore.SIGNAL('textQueryChange(bool)'), False)
        else:
            self.searchBox.clearSearch()

    def backToSearch(self):
        if self.controller:
            self.controller.back_to_search()

    def doEdit(self):
        if self.controller:
            self.controller.goto_edit()

    def levelChanged(self, button):
        self.controller.set_level(self.level_map.inverse[button])

    def setLevel(self, level):
        self.level_map[level].setChecked(True)

    def executeSearch(self, text):
        """
        executeSearch(text: QString) -> None

        """
        s = str(text)
        if self.controller:
            self.controller.run_search(s)
            # try:
            #     search = CombinedSearch(s, 
            #     search = SearchCompiler(s).searchStmt
            # except SearchParseError, e:
            #     debug.warning("Search Parse Error", str(e))
            #     search = None
            # self.controller.set_search(search, s)
            # self.emit(QtCore.SIGNAL('textQueryChange(bool)'), s!='')

    def refineMode(self, on):
        """
        refineMode(on: bool) -> None
        
        """
        if self.controller:
            self.controller.set_refine(on)

    def getCurrentText(self):
        return self.searchBox.getCurrentText()

    def setManualResetEnabled(self, boolVal):
        self.searchBox.setManualResetEnabled(boolVal)
    def __init__(self, parent=None):
        """ QVersionProp(parent: QWidget) -> QVersionProp
        Initialize the main layout
        
        """
        QtGui.QWidget.__init__(self, parent)
        self.setWindowTitle('Properties')

        vLayout = QtGui.QVBoxLayout()
        vLayout.setMargin(0)
        vLayout.setSpacing(5)
        self.setLayout(vLayout)

        self.searchBox = QSearchBox(self)
        vLayout.addWidget(self.searchBox)
        
        gLayout = QtGui.QGridLayout()
        gLayout.setMargin(0)
        gLayout.setSpacing(5)
        gLayout.setColumnMinimumWidth(1,5)
        gLayout.setRowMinimumHeight(0,24)
        gLayout.setRowMinimumHeight(1,24)
        gLayout.setRowMinimumHeight(2,24)
        gLayout.setRowMinimumHeight(3,24)        
        vLayout.addLayout(gLayout)
        
        tagLabel = QtGui.QLabel('Tag:', self)
        gLayout.addWidget(tagLabel, 0, 0, 1, 1)

        editLayout = QtGui.QHBoxLayout()
        editLayout.setMargin(0)
        editLayout.setSpacing(2)
        self.tagEdit = QtGui.QLineEdit()
        tagLabel.setBuddy(self.tagEdit)
        editLayout.addWidget(self.tagEdit)
        self.tagEdit.setEnabled(False)

        self.tagReset = QtGui.QToolButton(self)
        self.tagReset.setIcon(QtGui.QIcon(
                self.style().standardPixmap(QtGui.QStyle.SP_DialogCloseButton)))
        self.tagReset.setIconSize(QtCore.QSize(12,12))
        self.tagReset.setAutoRaise(True)
        self.tagReset.setEnabled(False)
        editLayout.addWidget(self.tagReset)

        gLayout.addLayout(editLayout, 0, 2, 1, 1)

        userLabel = QtGui.QLabel('User:'******'', self)
        gLayout.addWidget(self.userEdit, 1, 2, 1, 1)

        dateLabel = QtGui.QLabel('Date:', self)
        gLayout.addWidget(dateLabel, 2, 0, 1, 1)

        self.dateEdit = QtGui.QLabel('', self)
        gLayout.addWidget(self.dateEdit, 2, 2, 1, 1)

        self.notesLabel = QtGui.QLabel('Notes:')
        gLayout.addWidget(self.notesLabel, 3, 0, 1, 1)

        self.versionNotes = QVersionNotes()
        vLayout.addWidget(self.versionNotes)
        self.versionNotes.setEnabled(False)

        self.versionEmbed = QVersionEmbed()
        vLayout.addWidget(self.versionEmbed)
        self.versionEmbed.setVisible(False)
        
        self.connect(self.tagEdit, QtCore.SIGNAL('editingFinished()'),
                     self.tagFinished)
        self.connect(self.tagEdit, QtCore.SIGNAL('textChanged(QString)'),
                     self.tagChanged)
        self.connect(self.tagReset, QtCore.SIGNAL('clicked()'),
                     self.tagCleared)
        self.connect(self.searchBox, QtCore.SIGNAL('resetSearch()'),
                     self.resetSearch)
        self.connect(self.searchBox, QtCore.SIGNAL('executeSearch(QString)'),
                     self.executeSearch)
        self.connect(self.searchBox, QtCore.SIGNAL('refineMode(bool)'),
                     self.refineMode)

        self.controller = None
        self.versionNumber = -1
        self.refineMode(False)
class QVersionProp(QtGui.QWidget, QToolWindowInterface):
    """
    QVersionProp is a widget holding property of a version including
    tagname and notes
    
    """    
    def __init__(self, parent=None):
        """ QVersionProp(parent: QWidget) -> QVersionProp
        Initialize the main layout
        
        """
        QtGui.QWidget.__init__(self, parent)
        self.setWindowTitle('Properties')

        vLayout = QtGui.QVBoxLayout()
        vLayout.setMargin(0)
        vLayout.setSpacing(5)
        self.setLayout(vLayout)

        self.searchBox = QSearchBox(self)
        vLayout.addWidget(self.searchBox)
        
        gLayout = QtGui.QGridLayout()
        gLayout.setMargin(0)
        gLayout.setSpacing(5)
        gLayout.setColumnMinimumWidth(1,5)
        gLayout.setRowMinimumHeight(0,24)
        gLayout.setRowMinimumHeight(1,24)
        gLayout.setRowMinimumHeight(2,24)
        gLayout.setRowMinimumHeight(3,24)        
        vLayout.addLayout(gLayout)
        
        tagLabel = QtGui.QLabel('Tag:', self)
        gLayout.addWidget(tagLabel, 0, 0, 1, 1)

        editLayout = QtGui.QHBoxLayout()
        editLayout.setMargin(0)
        editLayout.setSpacing(2)
        self.tagEdit = QtGui.QLineEdit()
        tagLabel.setBuddy(self.tagEdit)
        editLayout.addWidget(self.tagEdit)
        self.tagEdit.setEnabled(False)

        self.tagReset = QtGui.QToolButton(self)
        self.tagReset.setIcon(QtGui.QIcon(
                self.style().standardPixmap(QtGui.QStyle.SP_DialogCloseButton)))
        self.tagReset.setIconSize(QtCore.QSize(12,12))
        self.tagReset.setAutoRaise(True)
        self.tagReset.setEnabled(False)
        editLayout.addWidget(self.tagReset)

        gLayout.addLayout(editLayout, 0, 2, 1, 1)

        userLabel = QtGui.QLabel('User:'******'', self)
        gLayout.addWidget(self.userEdit, 1, 2, 1, 1)

        dateLabel = QtGui.QLabel('Date:', self)
        gLayout.addWidget(dateLabel, 2, 0, 1, 1)

        self.dateEdit = QtGui.QLabel('', self)
        gLayout.addWidget(self.dateEdit, 2, 2, 1, 1)

        self.notesLabel = QtGui.QLabel('Notes:')
        gLayout.addWidget(self.notesLabel, 3, 0, 1, 1)

        self.versionNotes = QVersionNotes()
        vLayout.addWidget(self.versionNotes)
        self.versionNotes.setEnabled(False)

        self.versionEmbed = QVersionEmbed()
        vLayout.addWidget(self.versionEmbed)
        self.versionEmbed.setVisible(False)
        
        self.connect(self.tagEdit, QtCore.SIGNAL('editingFinished()'),
                     self.tagFinished)
        self.connect(self.tagEdit, QtCore.SIGNAL('textChanged(QString)'),
                     self.tagChanged)
        self.connect(self.tagReset, QtCore.SIGNAL('clicked()'),
                     self.tagCleared)
        self.connect(self.searchBox, QtCore.SIGNAL('resetSearch()'),
                     self.resetSearch)
        self.connect(self.searchBox, QtCore.SIGNAL('executeSearch(QString)'),
                     self.executeSearch)
        self.connect(self.searchBox, QtCore.SIGNAL('refineMode(bool)'),
                     self.refineMode)

        self.controller = None
        self.versionNumber = -1
        self.refineMode(False)

    def updateController(self, controller):
        """ updateController(controller: VistrailController) -> None
        Assign the controller to the property page
        
        """
        self.controller = controller
        self.versionNotes.controller = controller
        self.versionEmbed.controller = controller

    def updateVersion(self, versionNumber):
        """ updateVersion(versionNumber: int) -> None
        Update the property page of the version
        
        """
        self.versionNumber = versionNumber
        self.versionNotes.updateVersion(versionNumber)
        self.versionEmbed.updateVersion(versionNumber)
        
        if self.controller:
            if self.controller.vistrail.actionMap.has_key(versionNumber):
                action = self.controller.vistrail.actionMap[versionNumber]
                name = self.controller.vistrail.getVersionName(versionNumber)
                self.tagEdit.setText(name)
                self.userEdit.setText(action.user)
                self.dateEdit.setText(action.date)
                self.tagEdit.setEnabled(True)
                self.versionEmbed.setVisible(self.versionEmbed.check_version() and
                                            versionNumber > 0)
                return
            else:
                self.tagEdit.setEnabled(False)
                self.tagReset.setEnabled(False)
        self.tagEdit.setText('')
        self.userEdit.setText('')
        self.dateEdit.setText('')
        

    def tagFinished(self):
        """ tagFinished() -> None
        Update the new tag to vistrail
        
        """
        if self.controller:
            self.controller.update_current_tag(str(self.tagEdit.text()))

    def tagChanged(self, text):
        """ tagChanged(text: QString) -> None
        Update the button state if there is text

        """
        self.tagReset.setEnabled(text != '')

    def tagCleared(self):
        """ tagCleared() -> None
        Remove the tag
        
        """ 
        self.tagEdit.setText('')
        self.tagFinished()
        
    def resetSearch(self, emit_signal=True):
        """
        resetSearch() -> None

        """
        if self.controller and emit_signal:
            self.controller.set_search(None)
            self.emit(QtCore.SIGNAL('textQueryChange(bool)'), False)
        else:
            self.searchBox.clearSearch()
    
    def executeSearch(self, text):
        """
        executeSearch(text: QString) -> None

        """
        s = str(text)
        if self.controller:
            try:
                search = SearchCompiler(s).searchStmt
            except SearchParseError, e:
                QtGui.QMessageBox.warning(self,
                                          QtCore.QString("Search Parse Error"),
                                          QtCore.QString(str(e)),
                                          QtGui.QMessageBox.Ok,
                                          QtGui.QMessageBox.NoButton,
                                          QtGui.QMessageBox.NoButton)
                search = None
            self.controller.set_search(search, s)
            self.emit(QtCore.SIGNAL('textQueryChange(bool)'), s!='')
class QSearchToolBar(QAddonToolBar):
    """
    QSearchToolBar contains a search box for querying the versions.  By
    selecting the reset button, the toolbar is hidden.

    """
    def __init__(self, parent=None):
        """ QSearchToolBar(parent: QWidget) -> QSearchToolBar
        
        """
        QAddonToolBar.__init__(self, parent)
        self.setWindowTitle('Search')
        self.setIconSize(QtCore.QSize(16, 16))

        self.searchBox = QSearchBox(self)
        self.searchBox.resetButton.hide()
        self.searchBox.searchButton.hide()
        self.searchBox.searchEdit.setToolTip('Search Examples: "setAttr", "before:4 July 2009", "user:bob"')

        self.viewAction = QtGui.QToolButton(self)
        self.viewAction.setIcon(CurrentTheme.QUERY_ARROW_ICON)
        self.viewAction.setToolTip('View')
        self.viewAction.setStatusTip('Search or refine view')
        self.viewAction.setPopupMode(QtGui.QToolButton.InstantPopup)
        self.viewAction.setMenu(self.searchBox.searchMenu)
        self.addWidget(self.viewAction)

        self.addWidget(self.searchBox)

        self.connect(self.searchBox, QtCore.SIGNAL('executeSearch(QString)'),
                     self.executeSearch)
        self.connect(self.searchBox, QtCore.SIGNAL('refineMode(bool)'),
                     self.refineMode)
        self.connect(self.searchBox, QtCore.SIGNAL('resetSearch()'),
                     self.resetSearch)

        tva = self.toggleViewAction()
        tva.setIcon(CurrentTheme.QUERY_VIEW_ICON)
        tva.setToolTip('Search')
        tva.setStatusTip('Search and refine the version tree')
        tva.setShortcut('Ctrl+F')

    def resetSearch(self):
        """ Reset the search of the current controller """
        if self.controller!=None:
            self.controller.set_search(None)        

    def showEvent(self, e):
        """ showEvent(e) -> None
        Make sure that we get the search focus
        
        """
        QAddonToolBar.showEvent(self, e)
        self.searchBox.setFocus(QtCore.Qt.ActiveWindowFocusReason)

    def hideEvent(self, e):
        """ hideEvent() -> None
        Make sure that the search is reset
        
        """
        QAddonToolBar.hideEvent(self, e)
        self.resetSearch()

    def executeSearch(self, text):
        """ executeSearch(text: QString) -> None
        Change the version view with query
        
        """
        s = str(text)
        if self.controller:
            try:
                search = SearchCompiler(s).searchStmt
            except SearchParseError, e:
                QtGui.QMessageBox.warning(self,
                                          QtCore.QString("Search Parse Error"),
                                          QtCore.QString(str(e)),
                                          QtGui.QMessageBox.Ok,
                                          QtGui.QMessageBox.NoButton,
                                          QtGui.QMessageBox.NoButton)
                search = None
            self.controller.set_search(search, s)