Ejemplo n.º 1
0
 def openQueryBox(self):
     num = self.tabViews.currentIndex()
     view = self.listViews[num]
     qb = QueryBox(parent = self,
                             metadata = self.metadata,
                             globalApplicationDict = self.globalApplicationDict,
                             table = view['topHierarchyTable'],
                             )
     qb.setWindowFlags(Qt.Dialog)
     qb.setWindowModality(Qt.WindowModal)
     qb.setWindowTitle('Edit a query for table '+view['topHierarchyTable'])
     qb.show()
     self.connect(qb, SIGNAL('New query applied'), self.newQueryApplied)
Ejemplo n.º 2
0
 def openQueryBox(self):
     num = self.tabViews.currentIndex()
     view = self.listViews[num]
     qb = QueryBox(
         parent=self,
         metadata=self.metadata,
         globalApplicationDict=self.globalApplicationDict,
         table=view["topHierarchyTable"],
     )
     qb.setWindowFlags(Qt.Dialog)
     qb.setWindowModality(Qt.WindowModal)
     qb.setWindowTitle("Edit a query for table " + view["topHierarchyTable"])
     qb.show()
     self.connect(qb, SIGNAL("New query applied"), self.newQueryApplied)
Ejemplo n.º 3
0
    def __init__(
        self,
        parent=None,
        metadata=None,
        session=None,
        globalApplicationDict=None,
        table=None,
        #~ orientation = Qt.Horizontal,
        orientation=Qt.Vertical,
        query=None,
    ):
        QWidget.__init__(self, parent)
        self.metadata = metadata
        self.globalApplicationDict = globalApplicationDict
        self.table = table

        sp = QSplitter(orientation)

        self.mainLayout = QVBoxLayout()
        self.setLayout(self.mainLayout)
        self.mainLayout.addWidget(sp)

        self.queryBox = QueryBox(metadata=metadata,
                                 globalApplicationDict=globalApplicationDict,
                                 table=table,
                                 query=query)
        sp.addWidget(self.queryBox)
        self.connect(self.queryBox, SIGNAL('New query applied'),
                     self.refreshTree)

        #~ self.tree = QTreeWidget()
        self.tree = QtSqlTreeView(
            metadata=metadata,
            session=session,
            dictChildren={table: []},
            showColumns={},
            topHierarchyTable=table,
            topHierarchyQuery=query,
            context_menu=None,
        )
        sp.addWidget(self.tree)
Ejemplo n.º 4
0
class QueryResultBox(QWidget) :
    """
    Widget to write sql query et get the result in a list.
    """
    def __init__(self  , parent = None ,
                            metadata = None,
                            session = None,
                            globalApplicationDict = None,
                            table = None,
                            #~ orientation = Qt.Horizontal,
                            orientation = Qt.Vertical,
                            query = None,
                            ):
        QWidget.__init__(self, parent)
        self.metadata = metadata
        self.globalApplicationDict = globalApplicationDict
        self.table = table
        
        sp = QSplitter(orientation) 

        self.mainLayout = QVBoxLayout()
        self.setLayout(self.mainLayout)
        self.mainLayout.addWidget(sp)
        
        
        self.queryBox = QueryBox(metadata = metadata,
                            globalApplicationDict = globalApplicationDict,
                            table = table,
                            query = query )
        sp.addWidget(self.queryBox)
        self.connect(self.queryBox, SIGNAL('New query applied'), self.refreshTree)
        
        #~ self.tree = QTreeWidget()
        self.tree = QtSqlTreeView(metadata = metadata,
                                                session = session,
                                                dictChildren = { table:[] },
                                                showColumns = { },
                                                topHierarchyTable = table,
                                                topHierarchyQuery = query,
                                                context_menu = None,
                                                )
        sp.addWidget( self.tree )
        
    
    def refreshTree(self):
        query = self.queryBox.query()
        self.tree.applyNewFilterWithQuery( query )