def applyQuery( self ): """ Sets the query for this widget from the quick query text builder. """ query = Q.fromString(nativestring(self.uiQueryTXT.text())) self.setQuery(query) self.uiQueryTXT.setText('')
def applyQuery(self): """ Sets the query for this widget from the quick query text builder. """ query = Q.fromString(str(self.uiQueryTXT.text())) self.setQuery(query) self.uiQueryTXT.setText('')
def addQuery( self ): """ Sets the query for this widget from the quick query text builder. """ insert_item = self.uiQueryTREE.currentItem() if ( insert_item and not insert_item.isSelected() ): insert_item = None # create the query if ( self.uiQueryTXT.text() ): query = Q.fromString(str(self.uiQueryTXT.text())) self.uiQueryTXT.setText('') else: query = Q() # determine where to create the item at tree = self.uiQueryTREE if ( not insert_item ): # determine if we are already joining queries together count = tree.topLevelItemCount() # create the first item if ( not count ): XQueryItem(tree, query) else: if ( 1 < count ): join = tree.topLevelItem(count - 2).text(0) else: join = 'and' # create the join item & query item XJoinItem(tree, join) XQueryItem(tree, query) # add a query into a group elif ( insert_item.childCount() ): count = insert_item.childCount() join = insert_item.child(count - 2).text(0) # add the query to the group XJoinItem(insert_item, join) XQueryItem(tree, query) # add a query underneath another item else: parent_item = insert_item.parent() # add into the tree if ( not parent_item ): count = tree.topLevelItemCount() index = tree.indexOfTopLevelItem(insert_item) # add to the end if ( index == count - 1 ): if ( 1 < count ): join = tree.topLevelItem(count - 2).text(0) else: join = 'and' XJoinItem(tree, join) XQueryItem(tree, query) # insert in the middle else: join_item = tree.topLevelItem(index + 1) join = join_item.text(0) XJoinItem(tree, join, preceeding = join_item) XQueryItem(tree, query, preceeding = join_item) else: count = parent_item.childCount() index = parent_item.indexOfChild(insert_item) # add to the end if ( index == count - 1 ): if ( 1 < count ): join = parent_item.child(count - 2).text(0) else: join = 'and' XJoinItem(parent_item, join) XQueryItem(parent_item, query) # insert in the middle else: join_item = parent_item.child(index + 1) join = join_item.text(0) XJoinItem(parent_item, join, preceeding = join_item) XQueryItem(parent_item, join, preceeding = join_item)
def addQuery(self): """ Sets the query for this widget from the quick query text builder. """ insert_item = self.uiQueryTREE.currentItem() if (insert_item and not insert_item.isSelected()): insert_item = None # create the query if (self.uiQueryTXT.text()): query = Q.fromString(nativestring(self.uiQueryTXT.text())) self.uiQueryTXT.setText('') else: query = Q() # determine where to create the item at tree = self.uiQueryTREE if (not insert_item): # determine if we are already joining queries together count = tree.topLevelItemCount() # create the first item if (not count): XQueryItem(tree, query) else: if (1 < count): join = tree.topLevelItem(count - 2).text(0) else: join = 'and' # create the join item & query item XJoinItem(tree, join) XQueryItem(tree, query) # add a query into a group elif (insert_item.childCount()): count = insert_item.childCount() join = insert_item.child(count - 2).text(0) # add the query to the group XJoinItem(insert_item, join) XQueryItem(tree, query) # add a query underneath another item else: parent_item = insert_item.parent() # add into the tree if (not parent_item): count = tree.topLevelItemCount() index = tree.indexOfTopLevelItem(insert_item) # add to the end if (index == count - 1): if (1 < count): join = tree.topLevelItem(count - 2).text(0) else: join = 'and' XJoinItem(tree, join) XQueryItem(tree, query) # insert in the middle else: join_item = tree.topLevelItem(index + 1) join = join_item.text(0) XJoinItem(tree, join, preceeding=join_item) XQueryItem(tree, query, preceeding=join_item) else: count = parent_item.childCount() index = parent_item.indexOfChild(insert_item) # add to the end if (index == count - 1): if (1 < count): join = parent_item.child(count - 2).text(0) else: join = 'and' XJoinItem(parent_item, join) XQueryItem(parent_item, query) # insert in the middle else: join_item = parent_item.child(index + 1) join = join_item.text(0) XJoinItem(parent_item, join, preceeding=join_item) XQueryItem(parent_item, join, preceeding=join_item)