Пример #1
0
    def __init__(self, link, parent=None):
        super(PropertiesDialog, self).__init__(parent)

        mainLayout = QtGui.QVBoxLayout()
        #mainLayout.setSizeConstraint(QtGui.QLayout.SetFixedSize)

        self.__doc = link.doc()
        self.__rev = link.rev()
        if self.__doc:
            isDoc = True
            banner = "document"
            l = Connector().lookupDoc(self.__doc)
            stores = [
                s for s in l.stores()
                if Connector().lookupRev(l.rev(s), [s]) == [s]
            ]
        else:
            isDoc = False
            banner = "revision"
            stores = Connector().lookupRev(self.__rev)

        if len(stores) == 0:
            QtGui.QMessageBox.warning(
                self, 'Missing document',
                'The requested document was not found on any store.')
            sys.exit(1)

        self.__docTab = DocumentTab(link.store(), stores, banner)
        self.__docTab.switchStore.connect(self.__switchStore)
        self.__revTab = RevisionTab()
        self.__annoTab = AnnotationTab(isDoc)
        self.__annoTab.changed.connect(self.__changed)
        self.__hisTab = HistoryTab()

        tabWidget = QtGui.QTabWidget()
        tabWidget.addTab(self.__annoTab, "Annotation")
        tabWidget.addTab(self.__hisTab, "History")

        if isDoc:
            self.__buttonBox = QtGui.QDialogButtonBox(
                QtGui.QDialogButtonBox.Save | QtGui.QDialogButtonBox.Close)
            self.__buttonBox.button(
                QtGui.QDialogButtonBox.Save).setEnabled(False)
            self.__buttonBox.accepted.connect(self.__save)
            self.__buttonBox.rejected.connect(self.reject)
        else:
            self.__buttonBox = QtGui.QDialogButtonBox(
                QtGui.QDialogButtonBox.Ok)
            self.__buttonBox.accepted.connect(self.accept)

        mainLayout.addWidget(self.__docTab)
        mainLayout.addWidget(self.__revTab)
        mainLayout.addWidget(tabWidget)
        mainLayout.addWidget(self.__buttonBox)
        self.setLayout(mainLayout)

        self.__switchStore(self.__docTab.activeStore())

        self.setWindowTitle("Properties of %s" % (self.__annoTab.getTitle()))
Пример #2
0
    def __init__(self, link, parent=None):
        super(PropertiesDialog, self).__init__(parent)

        mainLayout = QtGui.QVBoxLayout()
        # mainLayout.setSizeConstraint(QtGui.QLayout.SetFixedSize)

        self.__doc = link.doc()
        self.__rev = link.rev()
        if self.__doc:
            isDoc = True
            banner = "document"
            l = Connector().lookupDoc(self.__doc)
            stores = [s for s in l.stores() if Connector().lookupRev(l.rev(s), [s]) == [s]]
        else:
            isDoc = False
            banner = "revision"
            stores = Connector().lookupRev(self.__rev)

        if len(stores) == 0:
            QtGui.QMessageBox.warning(self, "Missing document", "The requested document was not found on any store.")
            sys.exit(1)

        self.__docTab = DocumentTab(link.store(), stores, banner)
        self.__docTab.switchStore.connect(self.__switchStore)
        self.__revTab = RevisionTab()
        self.__annoTab = AnnotationTab(isDoc)
        self.__annoTab.changed.connect(self.__changed)
        self.__hisTab = HistoryTab()

        tabWidget = QtGui.QTabWidget()
        tabWidget.addTab(self.__annoTab, "Annotation")
        tabWidget.addTab(self.__hisTab, "History")

        if isDoc:
            self.__buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Save | QtGui.QDialogButtonBox.Close)
            self.__buttonBox.button(QtGui.QDialogButtonBox.Save).setEnabled(False)
            self.__buttonBox.accepted.connect(self.__save)
            self.__buttonBox.rejected.connect(self.reject)
        else:
            self.__buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok)
            self.__buttonBox.accepted.connect(self.accept)

        mainLayout.addWidget(self.__docTab)
        mainLayout.addWidget(self.__revTab)
        mainLayout.addWidget(tabWidget)
        mainLayout.addWidget(self.__buttonBox)
        self.setLayout(mainLayout)

        self.__switchStore(self.__docTab.activeStore())

        self.setWindowTitle("Properties of %s" % (self.__annoTab.getTitle()))
Пример #3
0
    def test_sync_ff_err(self):
        (doc, rev1, rev2) = self.createMerge("public.data", {}, {"FILE": "left1"}, {"FILE": "right1"})

        watch = self.watchDoc(doc, connector.Watch.EVENT_MODIFIED)

        self.startSync("ff", self.store1, self.store2)
        self.startSync("ff", self.store2, self.store1)

        self.assertFalse(watch.waitForWatch(1))

        # check that doc is not synced
        l = Connector().lookupDoc(doc)
        self.assertEqual(len(l.revs()), 2)
        self.assertEqual(l.rev(self.store1), rev1)
        self.assertEqual(l.rev(self.store2), rev2)
Пример #4
0
	def test_sync_ff_err(self):
		(doc, rev1, rev2) = self.createMerge("public.data", {}, {'FILE' : "left1"},
			{'FILE' : "right1"})

		watch = self.watchDoc(doc, connector.Watch.EVENT_MODIFIED)

		self.startSync('ff', self.store1, self.store2)
		self.startSync('ff', self.store2, self.store1)

		self.assertFalse(watch.waitForWatch(1))

		# check that doc is not synced
		l = Connector().lookupDoc(doc)
		self.assertEqual(len(l.revs()), 2)
		self.assertEqual(l.rev(self.store1), rev1)
		self.assertEqual(l.rev(self.store2), rev2)