Esempio n. 1
0
 def __init__(self):
     super(DatabasePublisher, self).__init__()
     self.setWindowTitle('Jinx Database Publisher')
     self.resize(900, 500)
     self.setWindowIcon(
         QtGui.QIcon('/home/mhamid/Pictures/jinx-pipe-icon.png'))
     self.mainLayout = QtWidgets.QVBoxLayout(self)
     self.setLayout(self.mainLayout)
     self.schemasTabWidget = QtWidgets.QTabWidget()
     self.publishLayout = QtWidgets.QHBoxLayout()
     self.publishButton = QtWidgets.QPushButton('Publish')
     self.publishButton.setFixedSize(200, 42)
     self.publishAllButton = QtWidgets.QPushButton('Publish All')
     self.publishAllButton.setFixedSize(200, 42)
     self.mainLayout.addWidget(self.schemasTabWidget)
     self.mainLayout.addLayout(self.publishLayout)
     self.publishLayout.setAlignment(QtCore.Qt.AlignRight)
     self.publishLayout.addWidget(self.publishButton,
                                  alignment=QtCore.Qt.AlignRight)
     self.publishLayout.addWidget(self.publishAllButton,
                                  alignment=QtCore.Qt.AlignRight)
     self.setup_tabs()
     self.publishButton.clicked.connect(self.publish)
     self.publishAllButton.clicked.connect(lambda: self.publish(all=True))
     self.dbHandler = getHandler()
     self.allTabs = [
         self.schemasTabWidget.widget(i)
         for i in range(self.schemasTabWidget.count())
     ]
Esempio n. 2
0
    def parent(self):
        super(Leaf, self).parent()
        db = mongorm.getHandler()
        filt = mongorm.getFilter()
        filt.search(db['stalk'], uuid=self.stalk_uuid)
        stalk = db['stalk'].one(filt)

        return stalk
Esempio n. 3
0
    def parent(self):
        super(Stalk, self).parent()
        db = mongorm.getHandler()
        filt = mongorm.getFilter()
        filt.search(db['twig'], uuid=self.twig_uuid)
        stem = db['twig'].one(filt)

        return stem
Esempio n. 4
0
    def parent(self):
        super(Twig, self).parent()
        db = mongorm.getHandler()
        filt = mongorm.getFilter()
        filt.search(db['stem'], uuid=self.stem_uuid)
        stem = db['stem'].one(filt)

        return stem
Esempio n. 5
0
    def parent(self, interfaceType):
        super(Stem, self).parent()
        db = mongorm.getHandler()
        filt = mongorm.getFilter()
        filt.search(db[interfaceType], uuid=self.parent_uuid)
        job = db[interfaceType].one(filt)

        return job
Esempio n. 6
0
 def children(self, interfaceType):
     super(Job, self).children()
     db = mongorm.getHandler()
     filt = mongorm.getFilter()
     filt.search(db["stem"], job=self.job)
     stems = db["stem"].all(filt)
     if stems.hasObjects():
         return stems
     else:
         return None
Esempio n. 7
0
 def children(self, interfaceType):
     super(Stem, self).children()
     db = mongorm.getHandler()
     filt = mongorm.getFilter()
     filt.setInterface(db[interfaceType])
     filt.overrideFilterStrings({"stem_uuid": self.uuid} if interfaceType ==
                                "twig" else {"parent_uuid": self.uuid})
     twigs = db[interfaceType].all(filt)
     if twigs.hasObjects():
         return twigs
     else:
         return None
Esempio n. 8
0
 def siblings(self, includeSelf=False):
     db = mongorm.getHandler()
     filt = mongorm.getFilter()
     filt.search(db['job'])
     siblings = db['job'].all(filt)
     if not siblings.size() < 2:
         if includeSelf:
             return siblings
         else:
             siblings.remove_object(self)
             return siblings
     else:
         return None
Esempio n. 9
0
 def siblings(self, includeSelf=True):
     db = mongorm.getHandler()
     filt = mongorm.getFilter()
     filt.search(db['leaf'], stalk_uuid=self.stalk_uuid)
     siblings = db['leaf'].all(filt)
     if not siblings.size() < 2:
         if includeSelf:
             return siblings
         else:
             siblings.remove_object(self)
             return siblings
     else:
         return None
Esempio n. 10
0
 def children(self):
     """
     Returns all leaf objects associated with this (self) stalk.
     """
     super(Stalk, self).children()
     db = mongorm.getHandler()
     filt = mongorm.getFilter()
     filt.search(db['leaf'], stalk_uuid=self.uuid)
     leafs = db['leaf'].all(filt)
     if leafs.hasObjects():
         return leafs
     else:
         return None
Esempio n. 11
0
 def children(self):
     """
     Returns all stalk versions associated with this (self) twig.
     """
     super(Twig, self).children()
     db = mongorm.getHandler()
     filt = mongorm.getFilter()
     filt.search(db['stalk'], twig_uuid=self.uuid)
     stalks = db['stalk'].all(filt)
     if stalks.hasObjects():
         return stalks
     else:
         return None
Esempio n. 12
0
            gridHint = QtWidgets.QApplication.style().styleHint(
                QtWidgets.QStyle.SH_Table_GridLineColor, self.viewOptions(),
                self, None)
            gridColor = QtGui.QColor.fromRgb(gridHint & 0xffffffff)
            painter.setPen(QtGui.QPen(gridColor, 0, QtCore.Qt.SolidLine))
            painter.drawLine(rect.left(), rect.bottom(), rect.right(),
                             rect.bottom())
            painter.restore()


if __name__ == '__main__':
    import sys
    import qdarkstyle
    from jinxqt.modelview.datasource.interfaces.twig import TwigDataSource
    import mongorm
    db = mongorm.getHandler()
    app = QtWidgets.QApplication(sys.argv)
    app.setStyleSheet(qdarkstyle.load_stylesheet_pyside2())
    win = TreeView()
    model = Model()
    handler = mongorm.getHandler()
    filter = mongorm.getFilter()
    datasource = TwigDataSource(handler)
    datasource._filter.search(datasource._interface)
    model.setDataSource(datasource)
    win.setModel(model)

    win.header().moveSection(0, 1)
    win.header().setFirstSectionMovable(True)

    win._resizeAllColumnsToContents()