Esempio n. 1
0
    def view(self):
        # remove old widgets
        self.viewFrame.clearGrid()

        # table name
        self.zAxisRows = 0
        self.dataCols = 0
        self.dataRows = 0
        self.colHdrRows = 0
        self.dataRows = 0
        xFilters = []

        self.analyzeColHdrs(self.parentFacts, 1)
        self.colHdrTopRow = self.zAxisRows + (2 if self.zAxisRows else 1)
        self.dataFirstRow = self.colHdrTopRow + self.colHdrRows
        self.dataFirstCol = 2
        
        gridHdr(self.gridTblHdr, 0, 0, 
                self.tupleFact.concept.label(lang=self.lang), 
                anchor="nw",
                #columnspan=(self.dataFirstCol - 1),
                rowspan=(self.dataFirstRow),
                wraplength=200)
        self.xAxis(self.dataFirstCol, self.colHdrTopRow, self.colHdrTopRow + self.colHdrRows - 1, 
                   self.tupleFact.modelTupleFacts, xFilters, True, True, True)
        self.bodyCells(self.dataFirstRow, 0, self.parentFacts, xFilters, True)
Esempio n. 2
0
    def zAxis(self, row, zAxisObj, zFilters):
        for axisMbrRel in self.axisMbrRelSet.fromModelObject(zAxisObj):
            zAxisObj = axisMbrRel.toModelObject
            zFilters.append((self.inheritedPrimaryItemQname(zAxisObj),
                             self.inheritedExplicitDims(zAxisObj),
                             zAxisObj.genLabel(lang=self.lang)))
            priorZfilter = len(zFilters)
            self.zAxis(None, zAxisObj, zFilters)
            if row is not None:
                gridBorder(self.gridColHdr, self.dataFirstCol, row, TOPBORDER, columnspan=2)
                gridBorder(self.gridColHdr, self.dataFirstCol, row, LEFTBORDER)
                gridBorder(self.gridColHdr, self.dataFirstCol, row, RIGHTBORDER, columnspan=2)
                gridHdr(self.gridColHdr, self.dataFirstCol, row,
                        zAxisObj.genLabel(lang=self.lang), 
                        anchor="w", columnspan=2,
                        wraplength=200,
                        objectId=zAxisObj.objectId(),
                        onClick=self.onClick)
                nextZfilter = len(zFilters)
                if nextZfilter > priorZfilter:    # no combo box choices nested
                    self.combobox = gridCombobox(
                                 self.gridColHdr, self.dataFirstCol + 2, row,
                                 values=[zFilter[2] for zFilter in zFilters[priorZfilter:nextZfilter]],
                                 selectindex=self.zFilterIndex,
                                 comboboxselected=self.comboBoxSelected)
                    gridBorder(self.gridColHdr, self.dataFirstCol + 2, row, RIGHTBORDER)
                    row += 1

        if not zFilters:
            zFilters.append( (None,set()) )  # allow empty set operations
Esempio n. 3
0
    def view(self):
        # remove old widgets
        self.viewFrame.clearGrid()

        # table name
        self.zAxisRows = 0
        self.dataCols = 0
        self.dataRows = 0
        self.colHdrRows = 0
        self.dataRows = 0
        xFilters = []

        self.analyzeColHdrs(self.parentFacts, 1)
        self.colHdrTopRow = self.zAxisRows + (2 if self.zAxisRows else 1)
        self.dataFirstRow = self.colHdrTopRow + self.colHdrRows
        self.dataFirstCol = 2
        
        gridHdr(self.gridTblHdr, 0, 0, 
                self.tupleFact.concept.label(lang=self.lang), 
                anchor="nw",
                #columnspan=(self.dataFirstCol - 1),
                rowspan=(self.dataFirstRow),
                wraplength=200)
        self.xAxis(self.dataFirstCol, self.colHdrTopRow, self.colHdrTopRow + self.colHdrRows - 1, 
                   self.tupleFact.modelTupleFacts, xFilters, True, True, True)
        self.bodyCells(self.dataFirstRow, 0, self.parentFacts, xFilters, True)
Esempio n. 4
0
    def view(self, viewTblELR=None):
        if viewTblELR:  # specific table selection
            self.tblELR = viewTblELR
        else:   # first or subsequenct reloading (language, dimensions, other change)
            self.loadTablesMenu()  # load menus (and initialize if first time
            viewTblELR = self.tblELR

        # remove old widgets
        self.viewFrame.clearGrid()

        tblAxisRelSet, xAxisObj, yAxisObj, zAxisObj = getTblAxes(self, viewTblELR) 
        
        if tblAxisRelSet:
            
            gridHdr(self.gridTblHdr, 0, 0, 
                    self.roledefinition, 
                    anchor="nw",
                    #columnspan=(self.dataFirstCol - 1),
                    #rowspan=(self.dataFirstRow),
                    wraplength=200) # in screen units
            zFilters = []
            self.zAxis(1, zAxisObj, zFilters)
            xFilters = []
            self.xAxis(self.dataFirstCol, self.colHdrTopRow, self.colHdrTopRow + self.colHdrRows - 1, 
                       xAxisObj, xFilters, self.xAxisChildrenFirst.get(), True, True)
            self.yAxis(1, self.dataFirstRow,
                       yAxisObj, self.yAxisChildrenFirst.get(), True, True)
            self.factPrototypes = []
            self.bodyCells(self.dataFirstRow, yAxisObj, xFilters, zFilters, self.yAxisChildrenFirst.get())
Esempio n. 5
0
    def view(self, viewTblELR=None, newInstance=None):
        if newInstance is not None:
            self.modelXbrl = newInstance # a save operation has created a new instance to use subsequently
        if viewTblELR:  # specific table selection
            self.tblELR = viewTblELR
        else:   # first or subsequenct reloading (language, dimensions, other change)
            self.loadTablesMenu()  # load menus (and initialize if first time
            viewTblELR = self.tblELR

        # remove old widgets
        self.viewFrame.clearGrid()

        tblAxisRelSet, xAxisObj, yAxisObj, zAxisObjs = getTblAxes(self, viewTblELR) 
        if self.zComboBoxIndex is None:
            self.zComboBoxIndex = list(repeat(0, len(zAxisObjs))) # start with 0 indices
            self.zFilterIndex = list(repeat(0, len(zAxisObjs)))
        
        if tblAxisRelSet:
            
            gridHdr(self.gridTblHdr, 0, 0, 
                    self.roledefinition, 
                    anchor="nw",
                    #columnspan=(self.dataFirstCol - 1),
                    #rowspan=(self.dataFirstRow),
                    wraplength=200) # in screen units
            zFilters = []
            for i, zAxisObj in enumerate(zAxisObjs):
                self.zAxis(1 + i, zAxisObj, zFilters)
            xFilters = []
            self.xAxis(self.dataFirstCol, self.colHdrTopRow, self.colHdrTopRow + self.colHdrRows - 1, 
                       xAxisObj, xFilters, self.xAxisChildrenFirst.get(), True, True)
            self.yAxis(1, self.dataFirstRow,
                       yAxisObj, self.yAxisChildrenFirst.get(), True, True)
            self.factPrototypes = []
            self.bodyCells(self.dataFirstRow, yAxisObj, xFilters, zFilters, self.yAxisChildrenFirst.get())
Esempio n. 6
0
    def view(self):
        # remove old widgets
        self.viewFrame.clearGrid()

        # table name
        self.zAxisRows = 0
        self.dataCols = 0
        self.colHdrRows = 0
        self.dataRows = 0
        xFilters = []

        self.analyzeColHdrs(self.parentFacts, 1)
        self.colHdrTopRow = self.zAxisRows + (2 if self.zAxisRows else 1)
        self.dataFirstRow = self.colHdrTopRow + self.colHdrRows
        self.dataFirstCol = 2

        gridHdr(
            self.gridTblHdr,
            0,
            0,
            self.tupleFact.concept.label(lang=self.lang),
            anchor="nw",
            #columnspan=(self.dataFirstCol - 1),
            rowspan=(self.dataFirstRow),
            wraplength=200)
        self.xAxis(self.dataFirstCol, self.colHdrTopRow,
                   self.colHdrTopRow + self.colHdrRows - 1,
                   self.tupleFact.modelTupleFacts, xFilters, True, True, True)
        #Because the different tuples of the same concept might have
        #different structures, they cannot all be displayed with one header.
        self.bodyCells(self.dataFirstRow, 0, [self.tupleFact], xFilters, True)
Esempio n. 7
0
 def xAxis(self, leftCol, topRow, rowBelow, tupleFacts, xFilters, childrenFirst, renderNow, atTop):
     parentRow = rowBelow
     noDescendants = True
     rightCol = leftCol
     widthToSpanParent = 0
     sideBorder = not xFilters
     if atTop and sideBorder and childrenFirst:
         gridBorder(self.gridColHdr, self.dataFirstCol, 1, LEFTBORDER, rowspan=self.dataFirstRow)
     for xAxisChildObj in tupleFacts:
         isItem = xAxisChildObj.isItem
         noDescendants = False
         rightCol, row, width, leafNode = self.xAxis(leftCol, topRow + 1, rowBelow, xAxisChildObj.modelTupleFacts, xFilters, # nested items before totals
                                                     childrenFirst, childrenFirst, False)
         if row - 1 < parentRow:
             parentRow = row - 1
         #if not leafNode: 
         #    rightCol -= 1
         widthToSpanParent += width
         label = xAxisChildObj.concept.label(lang=self.lang)
         if childrenFirst:
             thisCol = rightCol
             sideBorder = RIGHTBORDER
         else:
             thisCol = leftCol
             sideBorder = LEFTBORDER
         if renderNow:
             columnspan = (rightCol - leftCol + (1 if isItem else 0))
             gridBorder(self.gridColHdr, leftCol, topRow, TOPBORDER, columnspan=columnspan)
             gridBorder(self.gridColHdr, leftCol, topRow, 
                        sideBorder, columnspan=columnspan,
                        rowspan=(rowBelow - topRow + 1) )
             gridHdr(self.gridColHdr, leftCol, topRow, 
                     label if label else "         ", 
                     anchor="center",
                     columnspan=(rightCol - leftCol + (1 if isItem else 0)),
                     rowspan=(row - topRow + 1) if leafNode else 1,
                     wraplength=width,
                     objectId=xAxisChildObj.objectId(),
                     onClick=self.onClick)
             if isItem:
                 gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1, BOTTOMBORDER)
                 xFilters.append(xAxisChildObj.concept,
                                  )
         if isItem:
             rightCol += 1
         if renderNow and not childrenFirst:
             self.xAxis(leftCol + (1 if isItem else 0), topRow + 1, rowBelow, xAxisChildObj.modelTupleFacts, xFilters, childrenFirst, True, False) # render on this pass
         leftCol = rightCol
     if atTop and sideBorder and not childrenFirst:
         gridBorder(self.gridColHdr, rightCol - 1, 1, RIGHTBORDER, rowspan=self.dataFirstRow)
     return (rightCol, parentRow, widthToSpanParent, noDescendants)
Esempio n. 8
0
 def xAxis(self, leftCol, topRow, rowBelow, tupleFacts, xFilters, childrenFirst, renderNow, atTop):
     parentRow = rowBelow
     noDescendants = True
     rightCol = leftCol
     widthToSpanParent = 0
     sideBorder = not xFilters
     if atTop and sideBorder and childrenFirst:
         gridBorder(self.gridColHdr, self.dataFirstCol, 1, LEFTBORDER, rowspan=self.dataFirstRow)
     for xAxisChildObj in tupleFacts:
         isItem = xAxisChildObj.isItem
         noDescendants = False
         rightCol, row, width, leafNode = self.xAxis(leftCol, topRow + 1, rowBelow, xAxisChildObj.modelTupleFacts, xFilters, # nested items before totals
                                                     childrenFirst, childrenFirst, False)
         if row - 1 < parentRow:
             parentRow = row - 1
         #if not leafNode: 
         #    rightCol -= 1
         widthToSpanParent += width
         label = xAxisChildObj.concept.label(lang=self.lang)
         if childrenFirst:
             thisCol = rightCol
             sideBorder = RIGHTBORDER
         else:
             thisCol = leftCol
             sideBorder = LEFTBORDER
         if renderNow:
             columnspan = (rightCol - leftCol + (1 if isItem else 0))
             gridBorder(self.gridColHdr, leftCol, topRow, TOPBORDER, columnspan=columnspan)
             gridBorder(self.gridColHdr, leftCol, topRow, 
                        sideBorder, columnspan=columnspan,
                        rowspan=(rowBelow - topRow + 1) )
             gridHdr(self.gridColHdr, leftCol, topRow, 
                     label if label else "         ", 
                     anchor="center",
                     columnspan=(rightCol - leftCol + (1 if isItem else 0)),
                     rowspan=(row - topRow + 1) if leafNode else 1,
                     wraplength=width,
                     objectId=xAxisChildObj.objectId(),
                     onClick=self.onClick)
             if isItem:
                 gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1, BOTTOMBORDER)
                 xFilters.append(xAxisChildObj.concept,
                                  )
         if isItem:
             rightCol += 1
         if renderNow and not childrenFirst:
             self.xAxis(leftCol + (1 if isItem else 0), topRow + 1, rowBelow, xAxisChildObj.modelTupleFacts, xFilters, childrenFirst, True, False) # render on this pass
         leftCol = rightCol
     if atTop and sideBorder and not childrenFirst:
         gridBorder(self.gridColHdr, rightCol - 1, 1, RIGHTBORDER, rowspan=self.dataFirstRow)
     return (rightCol, parentRow, widthToSpanParent, noDescendants)
Esempio n. 9
0
    def view(self, viewTblELR=None, newInstance=None):
        startedAt = time.time()
        self.blockMenuEvents += 1
        if newInstance is not None:
            self.modelXbrl = newInstance # a save operation has created a new instance to use subsequently
            clearZchoices = False
        if viewTblELR:  # specific table selection
            self.tblELR = viewTblELR
            clearZchoices = True
        else:   # first or subsequenct reloading (language, dimensions, other change)
            self.loadTablesMenu()  # load menus (and initialize if first time
            viewTblELR = self.tblELR
            clearZchoices = self.zOrdinateChoices is None

        if clearZchoices:
            self.zOrdinateChoices = {}

        # remove old widgets
        self.viewFrame.clearGrid()

        tblAxisRelSet, xOrdCntx, yOrdCntx, zOrdCntx = getTblAxes(self, viewTblELR) 
        
        if tblAxisRelSet:
            
            gridHdr(self.gridTblHdr, 0, 0, 
                    self.roledefinition, 
                    anchor="nw",
                    #columnspan=(self.dataFirstCol - 1),
                    #rowspan=(self.dataFirstRow),
                    wraplength=200) # in screen units
            zAspects = defaultdict(set)
            self.zAxis(1, zOrdCntx, zAspects, clearZchoices)
            xOrdCntxs = []
            self.xAxis(self.dataFirstCol, self.colHdrTopRow, self.colHdrTopRow + self.colHdrRows - 1, 
                       xOrdCntx, xOrdCntxs, self.xAxisChildrenFirst.get(), True, True)
            self.yAxis(1, self.dataFirstRow,
                       yOrdCntx, self.yAxisChildrenFirst.get(), True, True)
            for fp in self.factPrototypes: # dereference prior facts
                fp.clear()
            self.factPrototypes = []
            self.bodyCells(self.dataFirstRow, yOrdCntx, xOrdCntxs, zAspects, self.yAxisChildrenFirst.get())
                
            # data cells
                
        self.modelXbrl.profileStat("viewTable_" + os.path.basename(viewTblELR), time.time() - startedAt)

        #self.gridView.config(scrollregion=self.gridView.bbox(constants.ALL))
        self.blockMenuEvents -= 1
Esempio n. 10
0
    def view(self, viewTblELR=None, newInstance=None):
        startedAt = time.time()
        self.blockMenuEvents += 1
        if newInstance is not None:
            self.modelXbrl = newInstance # a save operation has created a new instance to use subsequently
            clearZchoices = False
        if viewTblELR:  # specific table selection
            self.tblELR = viewTblELR
            clearZchoices = True
        else:   # first or subsequenct reloading (language, dimensions, other change)
            clearZchoices = self.zOrdinateChoices is None
            if clearZchoices: # also need first time initialization
                self.loadTablesMenu()  # load menus (and initialize if first time
            viewTblELR = self.tblELR
            
        if not self.tblELR:
            return  # no table to display

        if clearZchoices:
            self.zOrdinateChoices = {}

        # remove old widgets
        self.viewFrame.clearGrid()

        tblAxisRelSet, xTopStructuralNode, yTopStructuralNode, zTopStructuralNode = resolveAxesStructure(self, viewTblELR) 
        
        if tblAxisRelSet:
            self.aspectEntryObjectIdsNode.clear()
            self.aspectEntryObjectIdsCell.clear()
            #print("tbl hdr width rowHdrCols {0}".format(self.rowHdrColWidth))
            self.gridTblHdr.tblHdrWraplength = 200 # to  adjust dynamically during configure callbacks
            self.gridTblHdr.tblHdrLabel = \
                gridHdr(self.gridTblHdr, 0, 0, 
                        (self.modelTable.genLabel(lang=self.lang, strip=True) or  # use table label, if any 
                         self.roledefinition),
                        anchor="nw",
                        #columnspan=(self.dataFirstCol - 1),
                        #rowspan=(self.dataFirstRow),
                        wraplength=200) # in screen units
                        #wraplength=sum(self.rowHdrColWidth)) # in screen units
            zAspectStructuralNodes = defaultdict(set)
            self.zAxis(1, zTopStructuralNode, zAspectStructuralNodes, clearZchoices)
            xStructuralNodes = []
            self.xAxis(self.dataFirstCol, self.colHdrTopRow, self.colHdrTopRow + self.colHdrRows - 1, 
                       xTopStructuralNode, xStructuralNodes, self.xAxisChildrenFirst.get(), True, True)
            self.yAxis(1, self.dataFirstRow,
                       yTopStructuralNode, self.yAxisChildrenFirst.get(), True, True)
            for fp in self.factPrototypes: # dereference prior facts
                if fp is not None:
                    fp.clear()
            self.factPrototypes = []
            self.bodyCells(self.dataFirstRow, yTopStructuralNode, xStructuralNodes, zAspectStructuralNodes, self.yAxisChildrenFirst.get())
                
            # data cells
            #print("body cells done")
                
        self.modelXbrl.profileStat("viewTable_" + os.path.basename(viewTblELR), time.time() - startedAt)

        #self.gridView.config(scrollregion=self.gridView.bbox(constants.ALL))
        self.blockMenuEvents -= 1
Esempio n. 11
0
 def zAxis(self, row):
     if row is not None:
         gridBorder(self.gridColHdr, self.dataFirstCol, row, TOPBORDER, columnspan=2)
         gridBorder(self.gridColHdr, self.dataFirstCol, row, LEFTBORDER)
         gridBorder(self.gridColHdr, self.dataFirstCol, row, RIGHTBORDER, columnspan=2)
         gridHdr(self.gridColHdr, self.dataFirstCol, row,
                 "Link role (schedule)", 
                 anchor="w", columnspan=2,
                 wraplength=200,
                 objectId="zAxisLabel",
                 onClick=self.onClick)
         self.combobox = gridCombobox(
                      self.gridColHdr, self.dataFirstCol + 2, row,
                      values=[definition for definition,linkrole in self.definedLinkroles],
                      selectindex=self.zFilterIndex,
                      comboboxselected=self.comboBoxSelected)
         gridBorder(self.gridColHdr, self.dataFirstCol + 2, row, RIGHTBORDER)
         row += 1
Esempio n. 12
0
 def zAxis(self, row):
     if row is not None:
         gridBorder(self.gridColHdr, self.dataFirstCol, row, TOPBORDER, columnspan=2)
         gridBorder(self.gridColHdr, self.dataFirstCol, row, LEFTBORDER)
         gridBorder(self.gridColHdr, self.dataFirstCol, row, RIGHTBORDER, columnspan=2)
         gridHdr(self.gridColHdr, self.dataFirstCol, row,
                 "Link role (schedule)", 
                 anchor="w", columnspan=2,
                 wraplength=200,
                 objectId="zAxisLabel",
                 onClick=self.onClick)
         self.combobox = gridCombobox(
                      self.gridColHdr, self.dataFirstCol + 2, row,
                      values=[definition for definition,linkrole in self.definedLinkroles],
                      selectindex=self.zFilterIndex,
                      comboboxselected=self.comboBoxSelected)
         gridBorder(self.gridColHdr, self.dataFirstCol + 2, row, RIGHTBORDER)
         row += 1
Esempio n. 13
0
    def view(self, viewTblELR=None, newInstance=None):
        if newInstance is not None:
            self.modelXbrl = newInstance  # a save operation has created a new instance to use subsequently
        if viewTblELR:  # specific table selection
            self.tblELR = viewTblELR
        else:  # first or subsequenct reloading (language, dimensions, other change)
            self.loadTablesMenu()  # load menus (and initialize if first time
            viewTblELR = self.tblELR

        # remove old widgets
        self.viewFrame.clearGrid()

        tblAxisRelSet, xAxisObj, yAxisObj, zAxisObjs = getTblAxes(
            self, viewTblELR)
        if self.zComboBoxIndex is None:
            self.zComboBoxIndex = list(repeat(
                0, len(zAxisObjs)))  # start with 0 indices
            self.zFilterIndex = list(repeat(0, len(zAxisObjs)))

        if tblAxisRelSet:

            gridHdr(
                self.gridTblHdr,
                0,
                0,
                self.roledefinition,
                anchor="nw",
                #columnspan=(self.dataFirstCol - 1),
                #rowspan=(self.dataFirstRow),
                wraplength=200)  # in screen units
            zFilters = []
            for i, zAxisObj in enumerate(zAxisObjs):
                self.zAxis(1 + i, zAxisObj, zFilters)
            xFilters = []
            self.xAxis(self.dataFirstCol, self.colHdrTopRow,
                       self.colHdrTopRow + self.colHdrRows - 1, xAxisObj,
                       xFilters, self.xAxisChildrenFirst.get(), True, True)
            self.yAxis(1, self.dataFirstRow, yAxisObj,
                       self.yAxisChildrenFirst.get(), True, True)
            self.factPrototypes = []
            self.bodyCells(self.dataFirstRow, yAxisObj, xFilters, zFilters,
                           self.yAxisChildrenFirst.get())
Esempio n. 14
0
    def zAxis(self, row, zAxisObj, zFilters):
        for axisMbrRel in self.axisMbrRelSet.fromModelObject(zAxisObj):
            zAxisObj = axisMbrRel.toModelObject
            zFilters.append(
                (
                    self.inheritedPrimaryItemQname(zAxisObj),
                    self.inheritedExplicitDims(zAxisObj),
                    zAxisObj.genLabel(lang=self.lang),
                )
            )
            priorZfilter = len(zFilters)
            self.zAxis(None, zAxisObj, zFilters)
            if row is not None:
                gridBorder(self.gridColHdr, self.dataFirstCol, row, TOPBORDER, columnspan=2)
                gridBorder(self.gridColHdr, self.dataFirstCol, row, LEFTBORDER)
                gridBorder(self.gridColHdr, self.dataFirstCol, row, RIGHTBORDER, columnspan=2)
                gridHdr(
                    self.gridColHdr,
                    self.dataFirstCol,
                    row,
                    zAxisObj.genLabel(lang=self.lang),
                    anchor="w",
                    columnspan=2,
                    wraplength=200,
                    objectId=zAxisObj.objectId(),
                    onClick=self.onClick,
                )
                nextZfilter = len(zFilters)
                if nextZfilter > priorZfilter:  # no combo box choices nested
                    self.combobox = gridCombobox(
                        self.gridColHdr,
                        self.dataFirstCol + 2,
                        row,
                        values=[zFilter[2] for zFilter in zFilters[priorZfilter:nextZfilter]],
                        selectindex=self.zFilterIndex,
                        comboboxselected=self.comboBoxSelected,
                    )
                    gridBorder(self.gridColHdr, self.dataFirstCol + 2, row, RIGHTBORDER)
                    row += 1

        if not zFilters:
            zFilters.append((None, set()))  # allow empty set operations
Esempio n. 15
0
 def yAxis(self, row, indent, yAxisParentObj, atLeft, childrenFirst):
     col = 0
     isEntirelyAbstract = True
     for axisMbrRel in self.axisMbrRelSet.fromModelObject(yAxisParentObj):
         yAxisHdrObj = axisMbrRel.toModelObject
         if yAxisHdrObj.abstract == "false":
             isEntirelyAbstract= False
             break
     for axisMbrRel in self.axisMbrRelSet.fromModelObject(yAxisParentObj):
         yAxisHdrObj = axisMbrRel.toModelObject
         if childrenFirst:
             row = self.yAxis(row, 
                              indent + (0 if isEntirelyAbstract else 20), 
                              yAxisHdrObj, atLeft and col == 0, 
                              childrenFirst)
         if yAxisHdrObj.abstract == "false":
             gridBorder(self.gridRowHdr, 1, row, TOPBORDER)
             gridBorder(self.gridRowHdr, 1, row, LEFTBORDER)
             gridHdr(self.gridRowHdr, 1, row, 
                     yAxisHdrObj.genLabel(lang=self.lang), 
                     anchor="w",
                     padding=(indent,0,0,0) if indent is not None else None,
                     wraplength=200,
                     objectId=yAxisHdrObj.objectId(),
                     onClick=self.onClick)
             col = 2
             if self.rowHdrDocRow:
                 gridBorder(self.gridRowHdr, col, row, TOPBORDER)
                 gridBorder(self.gridRowHdr, col, row, LEFTBORDER)
                 gridHdr(self.gridRowHdr, col, row, 
                         yAxisHdrObj.genLabel(role="http://www.xbrl.org/2008/role/documentation",
                                                lang=self.lang), 
                         anchor="w",
                         wraplength=100,
                         objectId=yAxisHdrObj.objectId(),
                         onClick=self.onClick)
                 col += 1
             if self.rowHdrCodeRow:
                 gridBorder(self.gridRowHdr, col, row, TOPBORDER)
                 gridBorder(self.gridRowHdr, col, row, LEFTBORDER)
                 gridHdr(self.gridRowHdr, col, row, 
                         yAxisHdrObj.genLabel(role="http://www.eurofiling.info/role/2010/coordinate-code"),
                         anchor="w",
                         wraplength=40,
                         objectId=yAxisHdrObj.objectId(),
                         onClick=self.onClick)
                 col += 1
             gridBorder(self.gridRowHdr, col - 1, row, RIGHTBORDER)
             row += 1
         if not childrenFirst:
             row = self.yAxis(row, 
                              indent + (0 if isEntirelyAbstract else 20), 
                              yAxisHdrObj, atLeft and col == 0, 
                              childrenFirst)
     if atLeft and col > 0:
         gridBorder(self.gridRowHdr, 1, row, BOTTOMBORDER, columnspan=col)
     return row
Esempio n. 16
0
    def zAxis(self, row, zAxisObj, zFilters):
        priorZfilter = len(zFilters)
        
        for axisMbrRel in self.axisMbrRelSet.fromModelObject(zAxisObj):
            zAxisObj = axisMbrRel.toModelObject
            zFilters.append((inheritedPrimaryItemQname(self, zAxisObj),
                             inheritedExplicitDims(self, zAxisObj),
                             zAxisObj.genLabel(lang=self.lang),
                             zAxisObj.objectId()))
            self.zAxis(None, zAxisObj, zFilters)
            
        if row is not None:
            nextZfilter = len(zFilters)
            gridBorder(self.gridColHdr, self.dataFirstCol, row, TOPBORDER, columnspan=2)
            gridBorder(self.gridColHdr, self.dataFirstCol, row, LEFTBORDER)
            gridBorder(self.gridColHdr, self.dataFirstCol, row, RIGHTBORDER, columnspan=2)
            if nextZfilter > priorZfilter + 1:  # combo box, use header on zAxis
                label = axisMbrRel.fromModelObject.genLabel(lang=self.lang)
            else: # no combo box, use label on coord
                label = zAxisObj.genLabel(lang=self.lang)
            hdr = gridHdr(self.gridColHdr, self.dataFirstCol, row,
                          label, 
                          anchor="w", columnspan=2,
                          wraplength=200, # in screen units
                          objectId=zAxisObj.objectId(),
                          onClick=self.onClick)
            if nextZfilter > priorZfilter + 1:    # multiple choices, use combo box
                zIndex = row - 1
                selectIndex = self.zComboBoxIndex[zIndex]
                combobox = gridCombobox(
                             self.gridColHdr, self.dataFirstCol + 2, row,
                             values=[zFilter[2] for zFilter in zFilters[priorZfilter:nextZfilter]],
                             selectindex=selectIndex,
                             columnspan=2,
                             comboboxselected=self.comboBoxSelected)
                combobox.zIndex = zIndex
                zFilterIndex = priorZfilter + selectIndex
                self.zFilterIndex[zIndex] = zFilterIndex
                combobox.objectId = hdr.objectId = zFilters[zFilterIndex][3]
                gridBorder(self.gridColHdr, self.dataFirstCol + 3, row, RIGHTBORDER)
                row += 1

        if not zFilters:
            zFilters.append( (None,set()) )  # allow empty set operations
Esempio n. 17
0
 def zAxis(self, row, zStructuralNode, zAspects, clearZchoices):
     if zStructuralNode is not None:
         gridBorder(self.gridColHdr, self.dataFirstCol, row, TOPBORDER, columnspan=2)
         gridBorder(self.gridColHdr, self.dataFirstCol, row, LEFTBORDER)
         gridBorder(self.gridColHdr, self.dataFirstCol, row, RIGHTBORDER, columnspan=2)
         label = zStructuralNode.header(lang=self.lang)
         hdr = gridHdr(self.gridColHdr, self.dataFirstCol, row,
                       label, 
                       anchor="w", columnspan=2,
                       wraplength=200, # in screen units
                       objectId=zStructuralNode.objectId(),
                       onClick=self.onClick)
 
         if zStructuralNode.choiceStructuralNodes: # combo box
             valueHeaders = [''.ljust(zChoiceStructuralNode.indent * 4) + # indent if nested choices 
                             (zChoiceStructuralNode.header(lang=self.lang) or '')
                             for zChoiceStructuralNode in zStructuralNode.choiceStructuralNodes]
             combobox = gridCombobox(
                          self.gridColHdr, self.dataFirstCol + 2, row,
                          values=valueHeaders,
                          selectindex=zStructuralNode.choiceNodeIndex,
                          columnspan=2,
                          comboboxselected=self.onComboBoxSelected)
             combobox.zStructuralNode = zStructuralNode
             combobox.zChoiceOrdIndex = row - 1
             combobox.objectId = hdr.objectId = zStructuralNode.objectId()
             gridBorder(self.gridColHdr, self.dataFirstCol + 3, row, RIGHTBORDER)
 
         if zStructuralNode.childStructuralNodes:
             for zStructuralNode in zStructuralNode.childStructuralNodes:
                 self.zAxis(row + 1, zStructuralNode, zAspects, clearZchoices)
         else: # nested-nost element, aspects process inheritance
             for aspect in aspectModels[self.aspectModel]:
                 for ruleAspect in aspectRuleAspects.get(aspect, (aspect,)):
                     if zStructuralNode.hasAspect(ruleAspect): #implies inheriting from other z axes
                         if ruleAspect == Aspect.DIMENSIONS:
                             for dim in (zStructuralNode.aspectValue(Aspect.DIMENSIONS) or emptyList):
                                 zAspects[dim].add(zStructuralNode)
                         else:
                             zAspects[ruleAspect].add(zStructuralNode)
Esempio n. 18
0
    def __init__(self, mainWin, options):
        parent = mainWin.parent
        self.modelManager = mainWin.modelManager
        super(DialogFormulaParameters, self).__init__(parent)
        self.parent = parent
        self.options = options
        parentGeometry = re.match("(\d+)x(\d+)[+]?([-]?\d+)[+]?([-]?\d+)",
                                  parent.geometry())
        dialogX = int(parentGeometry.group(3))
        dialogY = int(parentGeometry.group(4))
        self.accepted = False

        self.transient(self.parent)
        self.title(_("Formula Parameters and Trace Options"))

        frame = Frame(self)
        '''
        dialogFrame = Frame(frame, width=500)
        dialogFrame.columnconfigure(0, weight=1)
        dialogFrame.rowconfigure(0, weight=1)
        dialogFrame.grid(row=0, column=0, columnspan=4, sticky=(N, S, E, W), padx=3, pady=3)
        '''

        # mainWin.showStatus(_("loading formula options and parameters"))

        # load grid
        gridHdr(frame, 1, 0, "Parameters", columnspan=3)
        gridHdr(frame, 1, 1, "QName")
        gridHdr(frame, 2, 1, "Type")
        gridHdr(frame, 3, 1, "Value")

        self.gridCells = []
        y = 2
        dataTypes = ("xs:string", "xs:integer", "xs:decimal", "xs:date",
                     "xs:datetime", "xs:QName")
        for parameter in options["parameterValues"].items():
            paramQname, paramTypeValue = parameter
            if isinstance(paramTypeValue, (tuple, list)):
                paramType, paramValue = paramTypeValue  # similar to modelTestcaseObject, where values() are (type,value)
            else:
                paramType = None
                paramValue = paramTypeValue
            self.gridCells.append((gridCell(frame, 1, y, paramQname),
                                   gridCombobox(frame,
                                                2,
                                                y,
                                                paramType,
                                                values=dataTypes),
                                   gridCell(frame, 3, y, paramValue)))
            y += 1
        # extra entry for new cells
        for i in range(5):
            self.gridCells.append(
                (gridCell(frame, 1,
                          y), gridCombobox(frame, 2, y, values=dataTypes),
                 gridCell(frame, 3, y)))
            y += 1
        y += 1

        # checkbox entries
        label(frame, 1, y, "Parameter Trace:")
        label(frame, 1, y + 3, "API Calls Trace:")
        label(frame, 1, y + 8, "Testcase Results:")
        label(frame, 2, y, "Variable Set Trace:")
        label(frame, 3, y, "Variables Trace:")
        self.checkboxes = (
            checkbox(frame, 1, y + 1, "Expression Result",
                     "traceParameterExpressionResult"),
            checkbox(frame, 1, y + 2, "Input Value",
                     "traceParameterInputValue"),
            checkbox(frame, 1, y + 4, "Expression Source",
                     "traceCallExpressionSource"),
            checkbox(frame, 1, y + 5, "Expression Code",
                     "traceCallExpressionCode"),
            checkbox(frame, 1, y + 6, "Expression Evaluation",
                     "traceCallExpressionEvaluation"),
            checkbox(frame, 1, y + 7, "Expression Result",
                     "traceCallExpressionResult"),
            checkbox(frame, 1, y + 9, "Capture Warnings",
                     "testcaseResultsCaptureWarnings"),
            checkbox(frame, 2, y + 1, "Expression Source",
                     "traceVariableSetExpressionSource"),
            checkbox(frame, 2, y + 2, "Expression Code",
                     "traceVariableSetExpressionCode"),
            checkbox(frame, 2, y + 3, "Expression Evaluation",
                     "traceVariableSetExpressionEvaluation"),
            checkbox(frame, 2, y + 4, "Expression Result",
                     "traceVariableSetExpressionResult"),
            checkbox(frame, 2, y + 5, "Assertion Result Counts",
                     "traceAssertionResultCounts"),
            checkbox(frame, 2, y + 6, "Assertion Satisfied [info]",
                     "traceSatisfiedAssertions"),
            checkbox(frame, 2, y + 7, "Assertion Unsatisfied [error]",
                     "errorUnsatisfiedAssertions"),
            checkbox(frame, 2, y + 8, "Assertion Unsatisfied [info]",
                     "traceUnsatisfiedAssertions"),
            checkbox(frame, 2, y + 9, "Formula Rules", "traceFormulaRules"),
            checkbox(frame, 2, y + 10, "Evaluation Timing",
                     "timeVariableSetEvaluation"),
            checkbox(frame, 3, y + 1, "Variable Dependencies",
                     "traceVariablesDependencies"),
            checkbox(frame, 3, y + 2, "Variables Order",
                     "traceVariablesOrder"),
            checkbox(frame, 3, y + 3, "Expression Source",
                     "traceVariableExpressionSource"),
            checkbox(frame, 3, y + 4, "Expression Code",
                     "traceVariableExpressionCode"),
            checkbox(frame, 3, y + 5, "Expression Evaluation",
                     "traceVariableExpressionEvaluation"),
            checkbox(frame, 3, y + 6, "Expression Result",
                     "traceVariableExpressionResult"),
            checkbox(frame, 3, y + 7, "Filter Winnowing",
                     "traceVariableFilterWinnowing"),
            checkbox(frame, 3, y + 8, "Filters Result",
                     "traceVariableFiltersResult")

            # Note: if adding to this list keep ModelFormulaObject.FormulaOptions in sync
        )
        y += 11

        mainWin.showStatus(None)

        label(frame, 1, y, "IDs:")
        self.idsEntry = gridCell(frame, 1, y, options.get("runIDs"))
        self.idsEntry.grid(columnspan=2, padx=30)
        _w = 8 if self.modelManager.cntlr.isMac else 12
        okButton = Button(frame, text=_("OK"), width=_w, command=self.ok)
        cancelButton = Button(frame,
                              text=_("Cancel"),
                              width=_w,
                              command=self.close)
        okButton.grid(row=y, column=3, sticky=W, pady=3)
        cancelButton.grid(row=y, column=3, sticky=E, pady=3, padx=3)

        frame.grid(row=0, column=0, sticky=(N, S, E, W))
        frame.columnconfigure(1, weight=3)
        frame.columnconfigure(2, weight=1)
        frame.columnconfigure(3, weight=3)
        window = self.winfo_toplevel()
        window.columnconfigure(0, weight=1)
        self.geometry("+{0}+{1}".format(dialogX + 50, dialogY + 100))

        #self.bind("<Return>", self.ok)
        #self.bind("<Escape>", self.close)

        self.protocol("WM_DELETE_WINDOW", self.close)
        self.grab_set()
        self.wait_window(self)
Esempio n. 19
0
 def xAxis(self, leftCol, topRow, rowBelow, xParentStructuralNode,
           xStructuralNodes, childrenFirst, renderNow, atTop):
     if xParentStructuralNode is not None:
         parentRow = rowBelow
         noDescendants = True
         rightCol = leftCol
         widthToSpanParent = 0
         sideBorder = not xStructuralNodes
         if atTop and sideBorder and childrenFirst:
             gridBorder(self.gridColHdr,
                        self.dataFirstCol,
                        1,
                        LEFTBORDER,
                        rowspan=self.dataFirstRow)
         for xStructuralNode in xParentStructuralNode.childStructuralNodes:
             if not xStructuralNode.isRollUp:
                 noDescendants = False
                 rightCol, row, width, leafNode = self.xAxis(
                     leftCol,
                     topRow + 1,
                     rowBelow,
                     xStructuralNode,
                     xStructuralNodes,  # nested items before totals
                     childrenFirst,
                     childrenFirst,
                     False)
                 if row - 1 < parentRow:
                     parentRow = row - 1
                 #if not leafNode:
                 #    rightCol -= 1
                 nonAbstract = not xStructuralNode.isAbstract
                 if nonAbstract:
                     width += 100  # width for this label, in screen units
                 widthToSpanParent += width
                 label = xStructuralNode.header(
                     lang=self.lang,
                     returnGenLabel=isinstance(
                         xStructuralNode.definitionNode,
                         (ModelClosedDefinitionNode, ModelEuAxisCoord)))
                 if childrenFirst:
                     thisCol = rightCol
                     sideBorder = RIGHTBORDER
                 else:
                     thisCol = leftCol
                     sideBorder = LEFTBORDER
                 if renderNow:
                     columnspan = (rightCol - leftCol +
                                   (1 if nonAbstract else 0))
                     gridBorder(self.gridColHdr,
                                leftCol,
                                topRow,
                                TOPBORDER,
                                columnspan=columnspan)
                     gridBorder(self.gridColHdr,
                                leftCol,
                                topRow,
                                sideBorder,
                                columnspan=columnspan,
                                rowspan=(rowBelow - topRow + 1))
                     gridHdr(
                         self.gridColHdr,
                         leftCol,
                         topRow,
                         label if label else "         ",
                         anchor="center",
                         columnspan=(rightCol - leftCol +
                                     (1 if nonAbstract else 0)),
                         rowspan=(row - topRow + 1) if leafNode else 1,
                         wraplength=width,  # screen units
                         objectId=xStructuralNode.objectId(),
                         onClick=self.onClick)
                     if nonAbstract:
                         for i, role in enumerate(self.colHdrNonStdRoles):
                             gridBorder(
                                 self.gridColHdr, thisCol,
                                 self.dataFirstRow -
                                 len(self.colHdrNonStdRoles) + i, TOPBORDER)
                             gridBorder(
                                 self.gridColHdr, thisCol,
                                 self.dataFirstRow -
                                 len(self.colHdrNonStdRoles) + i,
                                 sideBorder)
                             gridHdr(
                                 self.gridColHdr,
                                 thisCol,
                                 self.dataFirstRow -
                                 len(self.colHdrNonStdRoles) + i,
                                 xStructuralNode.header(role=role,
                                                        lang=self.lang),
                                 anchor="center",
                                 wraplength=100,  # screen units
                                 objectId=xStructuralNode.objectId(),
                                 onClick=self.onClick)
                         ''' was
                         if self.colHdrDocRow:
                             gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1 - self.rowHdrCodeCol, TOPBORDER)
                             gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1 - self.rowHdrCodeCol, sideBorder)
                             gridHdr(self.gridColHdr, thisCol, self.dataFirstRow - 1 - self.rowHdrCodeCol, 
                                     xStructuralNode.header(role="http://www.xbrl.org/2008/role/documentation",
                                                            lang=self.lang), 
                                     anchor="center",
                                     wraplength=100, # screen units
                                     objectId=xStructuralNode.objectId(),
                                     onClick=self.onClick)
                         if self.colHdrCodeRow:
                             gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1, TOPBORDER)
                             gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1, sideBorder)
                             gridHdr(self.gridColHdr, thisCol, self.dataFirstRow - 1, 
                                     xStructuralNode.header(role="http://www.eurofiling.info/role/2010/coordinate-code"),
                                     anchor="center",
                                     wraplength=100, # screen units
                                     objectId=xStructuralNode.objectId(),
                                     onClick=self.onClick)
                         '''
                         gridBorder(self.gridColHdr, thisCol,
                                    self.dataFirstRow - 1, BOTTOMBORDER)
                         xStructuralNodes.append(xStructuralNode)
                 if nonAbstract:
                     rightCol += 1
                 if renderNow and not childrenFirst:
                     self.xAxis(leftCol + (1 if nonAbstract else 0),
                                topRow + 1, rowBelow, xStructuralNode,
                                xStructuralNodes, childrenFirst, True,
                                False)  # render on this pass
                 leftCol = rightCol
         if atTop and sideBorder and not childrenFirst:
             gridBorder(self.gridColHdr,
                        rightCol - 1,
                        1,
                        RIGHTBORDER,
                        rowspan=self.dataFirstRow)
         return (rightCol, parentRow, widthToSpanParent, noDescendants)
Esempio n. 20
0
    def yAxis(self, leftCol, row, yParentStructuralNode, childrenFirst,
              renderNow, atLeft):
        if yParentStructuralNode is not None:
            nestedBottomRow = row
            if atLeft:
                gridBorder(
                    self.gridRowHdr,
                    self.rowHdrCols +
                    len(self.rowHdrNonStdRoles
                        ),  # was: self.rowHdrDocCol + self.rowHdrCodeCol, 
                    self.dataFirstRow,
                    RIGHTBORDER,
                    rowspan=self.dataRows)
                gridBorder(self.gridRowHdr,
                           1,
                           self.dataFirstRow + self.dataRows - 1,
                           BOTTOMBORDER,
                           columnspan=(
                               self.rowHdrCols + len(self.rowHdrNonStdRoles)
                           ))  # was: self.rowHdrDocCol + self.rowHdrCodeCol))
            for yStructuralNode in yParentStructuralNode.childStructuralNodes:
                if not yStructuralNode.isRollUp:
                    nestRow, nextRow = self.yAxis(
                        leftCol + 1,
                        row,
                        yStructuralNode,  # nested items before totals
                        childrenFirst,
                        childrenFirst,
                        False)

                    isAbstract = (
                        yStructuralNode.isAbstract or
                        (yStructuralNode.childStructuralNodes
                         and not isinstance(
                             yStructuralNode.definitionNode,
                             (ModelClosedDefinitionNode, ModelEuAxisCoord))))
                    isNonAbstract = not isAbstract
                    label = yStructuralNode.header(
                        lang=self.lang,
                        returnGenLabel=isinstance(
                            yStructuralNode.definitionNode,
                            (ModelClosedDefinitionNode, ModelEuAxisCoord)))
                    topRow = row
                    if childrenFirst and isNonAbstract:
                        row = nextRow
                    if renderNow:
                        columnspan = self.rowHdrCols - leftCol + 1 if isNonAbstract or nextRow == row else None
                        gridBorder(self.gridRowHdr,
                                   leftCol,
                                   topRow,
                                   LEFTBORDER,
                                   rowspan=(nestRow - topRow + 1))
                        gridBorder(
                            self.gridRowHdr,
                            leftCol,
                            topRow,
                            TOPBORDER,
                            columnspan=(1 if childrenFirst and nextRow > row
                                        else columnspan))
                        if childrenFirst and row > topRow:
                            gridBorder(self.gridRowHdr,
                                       leftCol + 1,
                                       row,
                                       TOPBORDER,
                                       columnspan=(self.rowHdrCols - leftCol))
                        depth = yStructuralNode.depth
                        gridHdr(
                            self.gridRowHdr,
                            leftCol,
                            row,
                            label if label is not None else "         ",
                            anchor=("w" if isNonAbstract or nestRow == row else
                                    "center"),
                            columnspan=columnspan,
                            rowspan=(nestRow - row if isAbstract else None),
                            # wraplength is in screen units
                            wraplength=(self.rowHdrColWidth[depth] if
                                        isAbstract else self.rowHdrWrapLength -
                                        sum(self.rowHdrColWidth[0:depth])),
                            #minwidth=self.rowHdrColWidth[leftCol],
                            minwidth=(16 if isNonAbstract and nextRow > topRow
                                      else None),
                            objectId=yStructuralNode.objectId(),
                            onClick=self.onClick)
                        if isNonAbstract:
                            for i, role in enumerate(self.rowHdrNonStdRoles):
                                isCode = "code" in role
                                docCol = self.dataFirstCol - len(
                                    self.rowHdrNonStdRoles) + i
                                gridBorder(self.gridRowHdr, docCol, row,
                                           TOPBORDER)
                                gridBorder(self.gridRowHdr, docCol, row,
                                           LEFTBORDER)
                                gridHdr(
                                    self.gridRowHdr,
                                    docCol,
                                    row,
                                    yStructuralNode.header(role=role,
                                                           lang=self.lang),
                                    anchor="c" if isCode else "w",
                                    wraplength=40
                                    if isCode else 100,  # screen units
                                    objectId=yStructuralNode.objectId(),
                                    onClick=self.onClick)
                            ''' was:
                            if self.rowHdrDocCol:
                                docCol = self.dataFirstCol - 1 - self.rowHdrCodeCol
                                gridBorder(self.gridRowHdr, docCol, row, TOPBORDER)
                                gridBorder(self.gridRowHdr, docCol, row, LEFTBORDER)
                                gridHdr(self.gridRowHdr, docCol, row, 
                                        yStructuralNode.header(role="http://www.xbrl.org/2008/role/documentation",
                                                             lang=self.lang), 
                                        anchor="w",
                                        wraplength=100, # screen units
                                        objectId=yStructuralNode.objectId(),
                                        onClick=self.onClick)
                            if self.rowHdrCodeCol:
                                codeCol = self.dataFirstCol - 1
                                gridBorder(self.gridRowHdr, codeCol, row, TOPBORDER)
                                gridBorder(self.gridRowHdr, codeCol, row, LEFTBORDER)
                                gridHdr(self.gridRowHdr, codeCol, row, 
                                        yStructuralNode.header(role="http://www.eurofiling.info/role/2010/coordinate-code"),
                                        anchor="center",
                                        wraplength=40, # screen units
                                        objectId=yStructuralNode.objectId(),
                                        onClick=self.onClick)
                            # gridBorder(self.gridRowHdr, leftCol, self.dataFirstRow - 1, BOTTOMBORDER)
                            '''
                    if isNonAbstract:
                        row += 1
                    elif childrenFirst:
                        row = nextRow
                    if nestRow > nestedBottomRow:
                        nestedBottomRow = nestRow + (isNonAbstract
                                                     and not childrenFirst)
                    if row > nestedBottomRow:
                        nestedBottomRow = row
                    #if renderNow and not childrenFirst:
                    #    dummy, row = self.yAxis(leftCol + 1, row, yStructuralNode, childrenFirst, True, False) # render on this pass
                    if not childrenFirst:
                        dummy, row = self.yAxis(leftCol + 1, row,
                                                yStructuralNode, childrenFirst,
                                                renderNow,
                                                False)  # render on this pass
            return (nestedBottomRow, row)
Esempio n. 21
0
    def view(self, viewTblELR=None, newInstance=None):
        startedAt = time.time()
        self.blockMenuEvents += 1
        if newInstance is not None:
            self.modelXbrl = newInstance  # a save operation has created a new instance to use subsequently
            clearZchoices = False
        if viewTblELR:  # specific table selection
            self.tblELR = viewTblELR
            clearZchoices = True
        else:  # first or subsequenct reloading (language, dimensions, other change)
            clearZchoices = self.zOrdinateChoices is None
            if clearZchoices:  # also need first time initialization
                self.loadTablesMenu(
                )  # load menus (and initialize if first time
            viewTblELR = self.tblELR

        if not self.tblELR:
            return  # no table to display

        if clearZchoices:
            self.zOrdinateChoices = {}

        # remove old widgets
        self.viewFrame.clearGrid()

        tblAxisRelSet, xTopStructuralNode, yTopStructuralNode, zTopStructuralNode = resolveAxesStructure(
            self, viewTblELR)

        if tblAxisRelSet:
            #print("tbl hdr width rowHdrCols {0}".format(self.rowHdrColWidth))
            self.gridTblHdr.tblHdrWraplength = 200  # to  adjust dynamically during configure callbacks
            self.gridTblHdr.tblHdrLabel = \
                gridHdr(self.gridTblHdr, 0, 0,
                        (self.modelTable.genLabel(lang=self.lang, strip=True) or  # use table label, if any 
                         self.roledefinition),
                        anchor="nw",
                        #columnspan=(self.dataFirstCol - 1),
                        #rowspan=(self.dataFirstRow),
                        wraplength=200) # in screen units
            #wraplength=sum(self.rowHdrColWidth)) # in screen units
            zAspects = defaultdict(set)
            self.zAxis(1, zTopStructuralNode, zAspects, clearZchoices)
            xStructuralNodes = []
            self.xAxis(self.dataFirstCol, self.colHdrTopRow,
                       self.colHdrTopRow + self.colHdrRows - 1,
                       xTopStructuralNode, xStructuralNodes,
                       self.xAxisChildrenFirst.get(), True, True)
            self.yAxis(1, self.dataFirstRow, yTopStructuralNode,
                       self.yAxisChildrenFirst.get(), True, True)
            for fp in self.factPrototypes:  # dereference prior facts
                if fp is not None:
                    fp.clear()
            self.factPrototypes = []
            self.bodyCells(self.dataFirstRow, yTopStructuralNode,
                           xStructuralNodes, zAspects,
                           self.yAxisChildrenFirst.get())

            # data cells
            #print("body cells done")

        self.modelXbrl.profileStat("viewTable_" + os.path.basename(viewTblELR),
                                   time.time() - startedAt)

        #self.gridView.config(scrollregion=self.gridView.bbox(constants.ALL))
        self.blockMenuEvents -= 1
Esempio n. 22
0
    def zAxis(self, row, zStructuralNode, zAspects, clearZchoices):
        if zStructuralNode is not None:
            gridBorder(self.gridColHdr,
                       self.dataFirstCol,
                       row,
                       TOPBORDER,
                       columnspan=2)
            gridBorder(self.gridColHdr, self.dataFirstCol, row, LEFTBORDER)
            gridBorder(self.gridColHdr,
                       self.dataFirstCol,
                       row,
                       RIGHTBORDER,
                       columnspan=2)
            label = zStructuralNode.header(lang=self.lang)
            hdr = gridHdr(
                self.gridColHdr,
                self.dataFirstCol,
                row,
                label,
                anchor="w",
                columnspan=2,
                wraplength=200,  # in screen units
                objectId=zStructuralNode.objectId(),
                onClick=self.onClick)

            if zStructuralNode.choiceStructuralNodes:  # combo box
                valueHeaders = [
                    ''.ljust(zChoiceStructuralNode.indent * 4)
                    +  # indent if nested choices 
                    (zChoiceStructuralNode.header(lang=self.lang) or '')
                    for zChoiceStructuralNode in
                    zStructuralNode.choiceStructuralNodes
                ]
                combobox = gridCombobox(
                    self.gridColHdr,
                    self.dataFirstCol + 2,
                    row,
                    values=valueHeaders,
                    selectindex=zStructuralNode.choiceNodeIndex,
                    columnspan=2,
                    comboboxselected=self.onComboBoxSelected)
                combobox.zStructuralNode = zStructuralNode
                combobox.zChoiceOrdIndex = row - 1
                combobox.objectId = hdr.objectId = zStructuralNode.objectId()
                gridBorder(self.gridColHdr, self.dataFirstCol + 3, row,
                           RIGHTBORDER)

            if zStructuralNode.childStructuralNodes:
                for zStructuralNode in zStructuralNode.childStructuralNodes:
                    self.zAxis(row + 1, zStructuralNode, zAspects,
                               clearZchoices)
            else:  # nested-nost element, aspects process inheritance
                for aspect in aspectModels[self.aspectModel]:
                    for ruleAspect in aspectRuleAspects.get(
                            aspect, (aspect, )):
                        if zStructuralNode.hasAspect(
                                ruleAspect
                        ):  #implies inheriting from other z axes
                            if ruleAspect == Aspect.DIMENSIONS:
                                for dim in (zStructuralNode.aspectValue(
                                        Aspect.DIMENSIONS) or emptyList):
                                    zAspects[dim].add(zStructuralNode)
                            else:
                                zAspects[ruleAspect].add(zStructuralNode)
Esempio n. 23
0
    def yAxis(self, leftCol, row, yAxisParentObj, childrenFirst, renderNow,
              atLeft):
        nestedBottomRow = row
        if atLeft:
            gridBorder(self.gridRowHdr,
                       self.rowHdrCols + self.rowHdrDocCol +
                       self.rowHdrCodeCol,
                       self.dataFirstRow,
                       RIGHTBORDER,
                       rowspan=self.dataRows)
            gridBorder(self.gridRowHdr,
                       1,
                       self.dataFirstRow + self.dataRows - 1,
                       BOTTOMBORDER,
                       columnspan=(self.rowHdrCols + self.rowHdrDocCol +
                                   self.rowHdrCodeCol))
        for axisMbrRel in self.axisMbrRelSet.fromModelObject(yAxisParentObj):
            yAxisHdrObj = axisMbrRel.toModelObject
            nestRow, nextRow = self.yAxis(
                leftCol + 1,
                row,
                yAxisHdrObj,  # nested items before totals
                childrenFirst,
                childrenFirst,
                False)

            isNonAbstract = yAxisHdrObj.abstract == "false"
            isAbstract = not isNonAbstract
            label = yAxisHdrObj.genLabel(lang=self.lang)
            topRow = row
            if childrenFirst and isNonAbstract:
                row = nextRow
            if renderNow:
                columnspan = self.rowHdrCols - leftCol + 1 if isNonAbstract or nextRow == row else None
                gridBorder(self.gridRowHdr,
                           leftCol,
                           topRow,
                           LEFTBORDER,
                           rowspan=(nestRow - topRow + 1))
                gridBorder(self.gridRowHdr,
                           leftCol,
                           topRow,
                           TOPBORDER,
                           columnspan=(1 if childrenFirst and nextRow > row
                                       else columnspan))
                if childrenFirst and row > topRow:
                    gridBorder(self.gridRowHdr,
                               leftCol + 1,
                               row,
                               TOPBORDER,
                               columnspan=(self.rowHdrCols - leftCol))
                gridHdr(
                    self.gridRowHdr,
                    leftCol,
                    row,
                    label if label else "         ",
                    anchor=("w"
                            if isNonAbstract or nestRow == row else "center"),
                    columnspan=columnspan,
                    rowspan=(nestRow - row if isAbstract else None),
                    # wraplength is in screen units
                    wraplength=(self.rowHdrColWidth[leftCol]
                                if isAbstract else self.rowHdrWrapLength -
                                sum(self.rowHdrColWidth[i]
                                    for i in range(leftCol))),
                    minwidth=(16
                              if isNonAbstract and nextRow > topRow else None),
                    objectId=yAxisHdrObj.objectId(),
                    onClick=self.onClick)
                if isNonAbstract:
                    if self.rowHdrDocCol:
                        docCol = self.dataFirstCol - 1 - self.rowHdrCodeCol
                        gridBorder(self.gridRowHdr, docCol, row, TOPBORDER)
                        gridBorder(self.gridRowHdr, docCol, row, LEFTBORDER)
                        gridHdr(
                            self.gridRowHdr,
                            docCol,
                            row,
                            yAxisHdrObj.genLabel(
                                role=
                                "http://www.xbrl.org/2008/role/documentation",
                                lang=self.lang),
                            anchor="w",
                            wraplength=100,  # screen units
                            objectId=yAxisHdrObj.objectId(),
                            onClick=self.onClick)
                    if self.rowHdrCodeCol:
                        codeCol = self.dataFirstCol - 1
                        gridBorder(self.gridRowHdr, codeCol, row, TOPBORDER)
                        gridBorder(self.gridRowHdr, codeCol, row, LEFTBORDER)
                        gridHdr(
                            self.gridRowHdr,
                            codeCol,
                            row,
                            yAxisHdrObj.genLabel(
                                role=
                                "http://www.eurofiling.info/role/2010/coordinate-code"
                            ),
                            anchor="center",
                            wraplength=40,  # screen units
                            objectId=yAxisHdrObj.objectId(),
                            onClick=self.onClick)
                    # gridBorder(self.gridRowHdr, leftCol, self.dataFirstRow - 1, BOTTOMBORDER)
            if isNonAbstract:
                row += 1
            elif childrenFirst:
                row = nextRow
            if nestRow > nestedBottomRow:
                nestedBottomRow = nestRow + (not childrenFirst)
            if row > nestedBottomRow:
                nestedBottomRow = row
            #if renderNow and not childrenFirst:
            #    dummy, row = self.yAxis(leftCol + 1, row, yAxisHdrObj, childrenFirst, True, False) # render on this pass
            if not childrenFirst:
                dummy, row = self.yAxis(leftCol + 1, row, yAxisHdrObj,
                                        childrenFirst, renderNow,
                                        False)  # render on this pass
        return (nestedBottomRow, row)
Esempio n. 24
0
 def xAxis(self, leftCol, topRow, rowBelow, xParentOrdCntx, xOrdCntxs, childrenFirst, renderNow, atTop):
     parentRow = rowBelow
     noDescendants = True
     rightCol = leftCol
     widthToSpanParent = 0
     sideBorder = not xOrdCntxs
     if atTop and sideBorder and childrenFirst:
         gridBorder(self.gridColHdr, self.dataFirstCol, 1, LEFTBORDER, rowspan=self.dataFirstRow)
     for xOrdCntx in xParentOrdCntx.subOrdinateContexts:
         noDescendants = False
         rightCol, row, width, leafNode = self.xAxis(leftCol, topRow + 1, rowBelow, xOrdCntx, xOrdCntxs, # nested items before totals
                                                     childrenFirst, childrenFirst, False)
         if row - 1 < parentRow:
             parentRow = row - 1
         #if not leafNode: 
         #    rightCol -= 1
         nonAbstract = not xOrdCntx.isAbstract
         if nonAbstract:
             width += 100 # width for this label, in screen units
         widthToSpanParent += width
         label = xOrdCntx.header(lang=self.lang)
         if childrenFirst:
             thisCol = rightCol
             sideBorder = RIGHTBORDER
         else:
             thisCol = leftCol
             sideBorder = LEFTBORDER
         if renderNow:
             columnspan = (rightCol - leftCol + (1 if nonAbstract else 0))
             gridBorder(self.gridColHdr, leftCol, topRow, TOPBORDER, columnspan=columnspan)
             gridBorder(self.gridColHdr, leftCol, topRow, 
                        sideBorder, columnspan=columnspan,
                        rowspan=(rowBelow - topRow + 1) )
             gridHdr(self.gridColHdr, leftCol, topRow, 
                     label if label else "         ", 
                     anchor="center",
                     columnspan=(rightCol - leftCol + (1 if nonAbstract else 0)),
                     rowspan=(row - topRow + 1) if leafNode else 1,
                     wraplength=width, # screen units
                     objectId=xOrdCntx.objectId(),
                     onClick=self.onClick)
             if nonAbstract:
                 if self.colHdrDocRow:
                     gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1 - self.rowHdrCodeCol, TOPBORDER)
                     gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1 - self.rowHdrCodeCol, sideBorder)
                     gridHdr(self.gridColHdr, thisCol, self.dataFirstRow - 1 - self.rowHdrCodeCol, 
                             xOrdCntx.header(role="http://www.xbrl.org/2008/role/documentation",
                                                    lang=self.lang), 
                             anchor="center",
                             wraplength=100, # screen units
                             objectId=xOrdCntx.objectId(),
                             onClick=self.onClick)
                 if self.colHdrCodeRow:
                     gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1, TOPBORDER)
                     gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1, sideBorder)
                     gridHdr(self.gridColHdr, thisCol, self.dataFirstRow - 1, 
                             xOrdCntx.header(role="http://www.eurofiling.info/role/2010/coordinate-code"),
                             anchor="center",
                             wraplength=100, # screen units
                             objectId=xOrdCntx.objectId(),
                             onClick=self.onClick)
                 gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1, BOTTOMBORDER)
                 xOrdCntxs.append(xOrdCntx)
         if nonAbstract:
             rightCol += 1
         if renderNow and not childrenFirst:
             self.xAxis(leftCol + (1 if nonAbstract else 0), topRow + 1, rowBelow, xOrdCntx, xOrdCntxs, childrenFirst, True, False) # render on this pass
         leftCol = rightCol
     if atTop and sideBorder and not childrenFirst:
         gridBorder(self.gridColHdr, rightCol - 1, 1, RIGHTBORDER, rowspan=self.dataFirstRow)
     return (rightCol, parentRow, widthToSpanParent, noDescendants)
Esempio n. 25
0
    def __init__(self, mainWin, options):
        parent = mainWin.parent
        super(DialogFind, self).__init__(parent)
        self.parent = parent
        self.modelManager = mainWin.modelManager
        self.modelXbrl = None  # set when Find pressed, this blocks next prematurely
        if options is None: options = newFindOptions
        self.options = options
        parentGeometry = re.match("(\d+)x(\d+)[+]?([-]?\d+)[+]?([-]?\d+)",
                                  parent.geometry())
        dialogW = int(parentGeometry.group(1))
        dialogH = int(parentGeometry.group(2))
        dialogX = int(parentGeometry.group(3))
        dialogY = int(parentGeometry.group(4))
        self.accepted = False

        self.transient(self.parent)
        self.title(_("Find"))

        self.objsList = []  # next may be tried before anything is found

        frame = Frame(self)

        # load grid
        findLabel = gridHdr(frame, 1, 0, "Find:", anchor="w")
        findLabel.grid(padx=8)
        self.cbExpr = gridCombobox(frame,
                                   1,
                                   1,
                                   values=options["priorExpressions"])
        self.cbExpr.grid(columnspan=3, padx=8)
        ToolTip(
            self.cbExpr,
            text=
            _("Enter expression to find, or select from combo box drop down history list."
              ),
            wraplength=240)

        y = 2

        # checkbox entries
        label(frame, 1, y, "Direction:")
        label(frame, 1, y + 3, "Match:")
        scopeLabel = label(frame, 2, y, "Scope:")
        ToolTip(scopeLabel,
                text=_("Scope for an XBRL document (instance or DTS).  "
                       "For an RSS Feed, all properties are matched.  "),
                wraplength=240)
        rbUp = radiobutton(frame, 1, y + 1, "Up", "up", "direction")
        ToolTip(rbUp,
                text=_("Find/Next up (on screen) from last to first match."),
                wraplength=240)
        rbDn = radiobutton(frame, 1, y + 2, "Down", "down", "direction",
                           rbUp.valueVar)
        ToolTip(rbDn,
                text=_("Find/Next down (on screen) from first to last match."),
                wraplength=240)
        rbText = radiobutton(frame, 1, y + 4, "Text (ignore case)", "text",
                             "exprType")
        ToolTip(
            rbText,
            text=_(
                "Expression is a set of characters to match, ignoring case.  "
                "The match may occur anywhere within the scope. "),
            wraplength=360)
        rbRegex = radiobutton(frame, 1, y + 5, "Regular expression", "regex",
                              "exprType", rbText.valueVar)
        ToolTip(
            rbRegex,
            text=
            _('A regular expression to match, anywhere in the scope, ignoring case.  '
              'For example, "cash" would match cash anywhere in a string (like cash on hand), '
              'whereas "^cash$" would match a full string to only contain cash. '
              'Use regular expression metacharacters, e.g., "." for any single character, '
              '".*" for any number of wild characters, .{3} for exactly 3 wild characters. '
              ),
            wraplength=360)
        rbXPath = radiobutton(frame, 1, y + 6, "XPath 2 expression", "xpath",
                              "exprType", rbText.valueVar)
        ToolTip(
            rbXPath,
            text=
            _('An XPath 2 expression, where the context element, ".", is a candidate concept QName, if any concept scope is checked, '
              'and a candidate fact item, if any fact scope is checked.  The XPath 2 functions do not need an "fn:" prefix (but it is defined).  '
              'The XBRL Functions Registry functions do require an "xfi:" prefix.  Constructors require an "xs:" prefix.  '
              'The expression is considered "matched" for the candidate concept QNames or fact items where the effective boolean value of the expression is "true()".  '
              ),
            wraplength=360)
        self.optionControls = (
            rbUp,
            rbDn,
            rbText,
            rbRegex,
            rbXPath,
            #checkbox(frame, 2, y + 1, "All", "all"),
            checkbox(frame, 2, y + 1, "Concept label", "conceptLabel"),
            checkbox(frame, 2, y + 2, "   name", "conceptName"),
            checkbox(frame, 2, y + 3, "   type", "conceptType"),
            checkbox(frame, 2, y + 4, "   subs group", "conceptSubs"),
            checkbox(frame, 2, y + 5, "   period type", "conceptPer"),
            checkbox(frame, 2, y + 6, "   balance", "conceptBal"),
            checkbox(frame, 3, y + 1, "Fact label", "factLabel"),
            checkbox(frame, 3, y + 2, "   name", "factName"),
            checkbox(frame, 3, y + 3, "   value", "factValue"),
            checkbox(frame, 3, y + 4, "   context", "factCntx"),
            checkbox(frame, 3, y + 5, "   unit", "factUnit"),
            checkbox(frame, 3, y + 6, "Messages", "messagesLog"),

            # Note: if adding to this list keep Finder.FindOptions in sync
        )
        y += 7
        resultLabel = gridHdr(frame, 1, y, "Result:", anchor="w")
        resultLabel.grid(padx=8)
        self.resultText = gridCell(frame, 1, y + 1)
        self.resultText.grid(columnspan=3, padx=8)
        self.resultText.config(state="readonly")
        y += 2

        mainWin.showStatus(None)

        buttonFrame = Frame(frame)
        buttonFrame.grid(columnspan=4, sticky=E, padx=8)
        findButton = Button(buttonFrame,
                            text=_("Find"),
                            width=12,
                            command=self.find)
        ToolTip(
            findButton,
            text=
            _('Compile (if regular expression or XPath 2), and find first match (if down direction) or last match (if up direction).  '
              ),
            wraplength=240)
        nextButton = Button(buttonFrame,
                            text=_("Next"),
                            width=12,
                            command=self.next)
        ToolTip(
            nextButton,
            text=_(
                'Advance to the next matched object (in selected direction).  '
            ),
            wraplength=240)
        closeButton = Button(buttonFrame,
                             text=_("Close"),
                             width=12,
                             command=self.close)
        ToolTip(closeButton,
                text=_('Close the find dialog.  '),
                wraplength=240)
        findButton.grid(row=1, column=1, pady=3)
        nextButton.grid(row=1, column=2, pady=3)
        closeButton.grid(row=1, column=3, padx=3)

        frame.grid(row=0, column=0, sticky=(N, S, E, W))
        frame.columnconfigure(1, weight=1)
        frame.columnconfigure(2, weight=1)
        frame.columnconfigure(3, weight=1)
        window = self.winfo_toplevel()
        window.columnconfigure(0, weight=1)
        if self.options["geometry"]:
            self.geometry(self.options["geometry"])
        else:
            self.geometry("+{0}+{1}".format(dialogX + 50, dialogY + 100))

        #self.bind("<Return>", self.ok)
        #self.bind("<Escape>", self.close)

        self.protocol("WM_DELETE_WINDOW", self.close)

        # make this dialog non-modal
        self.focus_set()
Esempio n. 26
0
 def xAxis(self, leftCol, topRow, rowBelow, xAxisParentObj, xFilters, childrenFirst, renderNow, atTop):
     parentRow = rowBelow
     noDescendants = True
     rightCol = leftCol
     widthToSpanParent = 0
     sideBorder = not xFilters
     if atTop and sideBorder and childrenFirst:
         gridBorder(self.gridColHdr, self.dataFirstCol, 1, LEFTBORDER, rowspan=self.dataFirstRow)
     for axisMbrRel in self.axisMbrRelSet.fromModelObject(xAxisParentObj):
         noDescendants = False
         xAxisHdrObj = axisMbrRel.toModelObject
         rightCol, row, width, leafNode = self.xAxis(leftCol, topRow + 1, rowBelow, xAxisHdrObj, xFilters, # nested items before totals
                                                     childrenFirst, childrenFirst, False)
         if row - 1 < parentRow:
             parentRow = row - 1
         #if not leafNode: 
         #    rightCol -= 1
         nonAbstract = xAxisHdrObj.abstract == "false"
         if nonAbstract:
             width += 100 # width for this label, in screen units
         widthToSpanParent += width
         label = xAxisHdrObj.genLabel(lang=self.lang)
         if childrenFirst:
             thisCol = rightCol
             sideBorder = RIGHTBORDER
         else:
             thisCol = leftCol
             sideBorder = LEFTBORDER
         if renderNow:
             columnspan = (rightCol - leftCol + (1 if nonAbstract else 0))
             gridBorder(self.gridColHdr, leftCol, topRow, TOPBORDER, columnspan=columnspan)
             gridBorder(self.gridColHdr, leftCol, topRow, 
                        sideBorder, columnspan=columnspan,
                        rowspan=(rowBelow - topRow + 1) )
             gridHdr(self.gridColHdr, leftCol, topRow, 
                     label if label else "         ", 
                     anchor="center",
                     columnspan=(rightCol - leftCol + (1 if nonAbstract else 0)),
                     rowspan=(row - topRow + 1) if leafNode else 1,
                     wraplength=width, # screen units
                     objectId=xAxisHdrObj.objectId(),
                     onClick=self.onClick)
             if nonAbstract:
                 if self.colHdrDocRow:
                     gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1 - self.rowHdrCodeCol, TOPBORDER)
                     gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1 - self.rowHdrCodeCol, sideBorder)
                     gridHdr(self.gridColHdr, thisCol, self.dataFirstRow - 1 - self.rowHdrCodeCol, 
                             xAxisHdrObj.genLabel(role="http://www.xbrl.org/2008/role/documentation",
                                                    lang=self.lang), 
                             anchor="center",
                             wraplength=100, # screen units
                             objectId=xAxisHdrObj.objectId(),
                             onClick=self.onClick)
                 if self.colHdrCodeRow:
                     gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1, TOPBORDER)
                     gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1, sideBorder)
                     gridHdr(self.gridColHdr, thisCol, self.dataFirstRow - 1, 
                             xAxisHdrObj.genLabel(role="http://www.eurofiling.info/role/2010/coordinate-code"),
                             anchor="center",
                             wraplength=100, # screen units
                             objectId=xAxisHdrObj.objectId(),
                             onClick=self.onClick)
                 gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1, BOTTOMBORDER)
                 xFilters.append((inheritedPrimaryItemQname(self, xAxisHdrObj),
                                  inheritedExplicitDims(self, xAxisHdrObj)))
         if nonAbstract:
             rightCol += 1
         if renderNow and not childrenFirst:
             self.xAxis(leftCol + (1 if nonAbstract else 0), topRow + 1, rowBelow, xAxisHdrObj, xFilters, childrenFirst, True, False) # render on this pass
         leftCol = rightCol
     if atTop and sideBorder and not childrenFirst:
         gridBorder(self.gridColHdr, rightCol - 1, 1, RIGHTBORDER, rowspan=self.dataFirstRow)
     return (rightCol, parentRow, widthToSpanParent, noDescendants)
Esempio n. 27
0
 def xAxis(self, leftCol, topRow, rowBelow, xParentStructuralNode, xStructuralNodes, childrenFirst, renderNow, atTop):
     if xParentStructuralNode is not None:
         parentRow = rowBelow
         noDescendants = True
         rightCol = leftCol
         widthToSpanParent = 0
         sideBorder = not xStructuralNodes
         if atTop and sideBorder and childrenFirst:
             gridBorder(self.gridColHdr, self.dataFirstCol, 1, LEFTBORDER, rowspan=self.dataFirstRow)
         for xStructuralNode in xParentStructuralNode.childStructuralNodes:
             if not xStructuralNode.isRollUp:
                 noDescendants = False
                 rightCol, row, width, leafNode = self.xAxis(leftCol, topRow + 1, rowBelow, xStructuralNode, xStructuralNodes, # nested items before totals
                                                             childrenFirst, childrenFirst, False)
                 if row - 1 < parentRow:
                     parentRow = row - 1
                 #if not leafNode: 
                 #    rightCol -= 1
                 nonAbstract = not xStructuralNode.isAbstract
                 if nonAbstract:
                     width += 100 # width for this label, in screen units
                 widthToSpanParent += width
                 label = xStructuralNode.header(lang=self.lang,
                                                returnGenLabel=isinstance(xStructuralNode.definitionNode, (ModelClosedDefinitionNode, ModelEuAxisCoord)))
                 if childrenFirst:
                     thisCol = rightCol
                     sideBorder = RIGHTBORDER
                 else:
                     thisCol = leftCol
                     sideBorder = LEFTBORDER
                 if renderNow:
                     columnspan = (rightCol - leftCol + (1 if nonAbstract else 0))
                     gridBorder(self.gridColHdr, leftCol, topRow, TOPBORDER, columnspan=columnspan)
                     gridBorder(self.gridColHdr, leftCol, topRow, 
                                sideBorder, columnspan=columnspan,
                                rowspan=(rowBelow - topRow + 1) )
                     gridHdr(self.gridColHdr, leftCol, topRow, 
                             label if label else "         ", 
                             anchor="center",
                             columnspan=(rightCol - leftCol + (1 if nonAbstract else 0)),
                             rowspan=(row - topRow + 1) if leafNode else 1,
                             wraplength=width, # screen units
                             objectId=xStructuralNode.objectId(),
                             onClick=self.onClick)
                     if nonAbstract:
                         for i, role in enumerate(self.colHdrNonStdRoles):
                             gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - len(self.colHdrNonStdRoles) + i, TOPBORDER)
                             gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - len(self.colHdrNonStdRoles) + i, sideBorder)
                             gridHdr(self.gridColHdr, thisCol, self.dataFirstRow - len(self.colHdrNonStdRoles) + i, 
                                     xStructuralNode.header(role=role, lang=self.lang), 
                                     anchor="center",
                                     wraplength=100, # screen units
                                     objectId=xStructuralNode.objectId(),
                                     onClick=self.onClick)
                         ''' was
                         if self.colHdrDocRow:
                             gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1 - self.rowHdrCodeCol, TOPBORDER)
                             gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1 - self.rowHdrCodeCol, sideBorder)
                             gridHdr(self.gridColHdr, thisCol, self.dataFirstRow - 1 - self.rowHdrCodeCol, 
                                     xStructuralNode.header(role="http://www.xbrl.org/2008/role/documentation",
                                                            lang=self.lang), 
                                     anchor="center",
                                     wraplength=100, # screen units
                                     objectId=xStructuralNode.objectId(),
                                     onClick=self.onClick)
                         if self.colHdrCodeRow:
                             gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1, TOPBORDER)
                             gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1, sideBorder)
                             gridHdr(self.gridColHdr, thisCol, self.dataFirstRow - 1, 
                                     xStructuralNode.header(role="http://www.eurofiling.info/role/2010/coordinate-code"),
                                     anchor="center",
                                     wraplength=100, # screen units
                                     objectId=xStructuralNode.objectId(),
                                     onClick=self.onClick)
                         '''
                         gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1, BOTTOMBORDER)
                         xStructuralNodes.append(xStructuralNode)
                 if nonAbstract:
                     rightCol += 1
                 if renderNow and not childrenFirst:
                     self.xAxis(leftCol + (1 if nonAbstract else 0), topRow + 1, rowBelow, xStructuralNode, xStructuralNodes, childrenFirst, True, False) # render on this pass
                 leftCol = rightCol
         if atTop and sideBorder and not childrenFirst:
             gridBorder(self.gridColHdr, rightCol - 1, 1, RIGHTBORDER, rowspan=self.dataFirstRow)
         return (rightCol, parentRow, widthToSpanParent, noDescendants)
Esempio n. 28
0
 def yAxis(self, row, indent, yAxisParentObj, atLeft, childrenFirst):
     col = 0
     isEntirelyAbstract = True
     for axisMbrRel in self.axisMbrRelSet.fromModelObject(yAxisParentObj):
         yAxisHdrObj = axisMbrRel.toModelObject
         if yAxisHdrObj.abstract == "false":
             isEntirelyAbstract = False
             break
     for axisMbrRel in self.axisMbrRelSet.fromModelObject(yAxisParentObj):
         yAxisHdrObj = axisMbrRel.toModelObject
         if childrenFirst:
             row = self.yAxis(
                 row, indent + (0 if isEntirelyAbstract else 20), yAxisHdrObj, atLeft and col == 0, childrenFirst
             )
         if yAxisHdrObj.abstract == "false":
             gridBorder(self.gridRowHdr, 1, row, TOPBORDER)
             gridBorder(self.gridRowHdr, 1, row, LEFTBORDER)
             gridHdr(
                 self.gridRowHdr,
                 1,
                 row,
                 yAxisHdrObj.genLabel(lang=self.lang),
                 anchor="w",
                 padding=(indent, 0, 0, 0) if indent is not None else None,
                 wraplength=200,
                 objectId=yAxisHdrObj.objectId(),
                 onClick=self.onClick,
             )
             col = 2
             if self.rowHdrDocRow:
                 gridBorder(self.gridRowHdr, col, row, TOPBORDER)
                 gridBorder(self.gridRowHdr, col, row, LEFTBORDER)
                 gridHdr(
                     self.gridRowHdr,
                     col,
                     row,
                     yAxisHdrObj.genLabel(role="http://www.xbrl.org/2008/role/documentation", lang=self.lang),
                     anchor="w",
                     wraplength=100,
                     objectId=yAxisHdrObj.objectId(),
                     onClick=self.onClick,
                 )
                 col += 1
             if self.rowHdrCodeRow:
                 gridBorder(self.gridRowHdr, col, row, TOPBORDER)
                 gridBorder(self.gridRowHdr, col, row, LEFTBORDER)
                 gridHdr(
                     self.gridRowHdr,
                     col,
                     row,
                     yAxisHdrObj.genLabel(role="http://www.eurofiling.info/role/2010/coordinate-code"),
                     anchor="w",
                     wraplength=40,
                     objectId=yAxisHdrObj.objectId(),
                     onClick=self.onClick,
                 )
                 col += 1
             gridBorder(self.gridRowHdr, col - 1, row, RIGHTBORDER)
             row += 1
         if not childrenFirst:
             row = self.yAxis(
                 row, indent + (0 if isEntirelyAbstract else 20), yAxisHdrObj, atLeft and col == 0, childrenFirst
             )
     if atLeft and col > 0:
         gridBorder(self.gridRowHdr, 1, row, BOTTOMBORDER, columnspan=col)
     return row
Esempio n. 29
0
 def xAxis(self, leftCol, topRow, rowBelow, xAxisParentObj, xFilters, childrenFirst, renderNow, atTop):
     parentRow = rowBelow
     noDescendants = True
     rightCol = leftCol
     widthToSpanParent = 0
     sideBorder = not xFilters
     if atTop and sideBorder and childrenFirst:
         gridBorder(self.gridColHdr, self.dataFirstCol, 1, LEFTBORDER, rowspan=self.dataFirstRow)
     for axisMbrRel in self.axisMbrRelSet.fromModelObject(xAxisParentObj):
         noDescendants = False
         xAxisHdrObj = axisMbrRel.toModelObject
         rightCol, row, width, leafNode = self.xAxis(leftCol, topRow + 1, rowBelow, xAxisHdrObj, xFilters, # nested items before totals
                                                     childrenFirst, childrenFirst, False)
         if row - 1 < parentRow:
             parentRow = row - 1
         #if not leafNode: 
         #    rightCol -= 1
         nonAbstract = xAxisHdrObj.abstract == "false"
         if nonAbstract:
             width += 100 # width for this label
         widthToSpanParent += width
         label = xAxisHdrObj.genLabel(lang=self.lang)
         if childrenFirst:
             thisCol = rightCol
             sideBorder = RIGHTBORDER
         else:
             thisCol = leftCol
             sideBorder = LEFTBORDER
         if renderNow:
             columnspan = (rightCol - leftCol + (1 if nonAbstract else 0))
             gridBorder(self.gridColHdr, leftCol, topRow, TOPBORDER, columnspan=columnspan)
             gridBorder(self.gridColHdr, leftCol, topRow, 
                        sideBorder, columnspan=columnspan,
                        rowspan=(rowBelow - topRow + 1) )
             gridHdr(self.gridColHdr, leftCol, topRow, 
                     label if label else "         ", 
                     anchor="center",
                     columnspan=(rightCol - leftCol + (1 if nonAbstract else 0)),
                     rowspan=(row - topRow + 1) if leafNode else 1,
                     wraplength=width,
                     objectId=xAxisHdrObj.objectId(),
                     onClick=self.onClick)
             if nonAbstract:
                 if self.colHdrDocRow:
                     gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1 - self.rowHdrCodeRow, TOPBORDER)
                     gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1 - self.rowHdrCodeRow, sideBorder)
                     gridHdr(self.gridColHdr, thisCol, self.dataFirstRow - 1 - self.rowHdrCodeRow, 
                             xAxisHdrObj.genLabel(role="http://www.xbrl.org/2008/role/documentation",
                                                    lang=self.lang), 
                             anchor="center",
                             wraplength=100,
                             objectId=xAxisHdrObj.objectId(),
                             onClick=self.onClick)
                 if self.colHdrCodeRow:
                     gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1, TOPBORDER)
                     gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1, sideBorder)
                     gridHdr(self.gridColHdr, thisCol, self.dataFirstRow - 1, 
                             xAxisHdrObj.genLabel(role="http://www.eurofiling.info/role/2010/coordinate-code"),
                             anchor="w",
                             wraplength=100,
                             objectId=xAxisHdrObj.objectId(),
                             onClick=self.onClick)
                 gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1, BOTTOMBORDER)
                 xFilters.append((self.inheritedPrimaryItemQname(xAxisHdrObj),
                                  self.inheritedExplicitDims(xAxisHdrObj)))
         if nonAbstract:
             rightCol += 1
         if renderNow and not childrenFirst:
             self.xAxis(leftCol + (1 if nonAbstract else 0), topRow + 1, rowBelow, xAxisHdrObj, xFilters, childrenFirst, True, False) # render on this pass
         leftCol = rightCol
     if atTop and sideBorder and not childrenFirst:
         gridBorder(self.gridColHdr, rightCol - 1, 1, RIGHTBORDER, rowspan=self.dataFirstRow)
     return (rightCol, parentRow, widthToSpanParent, noDescendants)
Esempio n. 30
0
    def zAxis(self, row, zAxisObj, zFilters):
        priorZfilter = len(zFilters)

        for axisMbrRel in self.axisMbrRelSet.fromModelObject(zAxisObj):
            zAxisObj = axisMbrRel.toModelObject
            zFilters.append(
                (inheritedPrimaryItemQname(self, zAxisObj),
                 inheritedExplicitDims(self, zAxisObj),
                 zAxisObj.genLabel(lang=self.lang), zAxisObj.objectId()))
            self.zAxis(None, zAxisObj, zFilters)

        if row is not None:
            nextZfilter = len(zFilters)
            gridBorder(self.gridColHdr,
                       self.dataFirstCol,
                       row,
                       TOPBORDER,
                       columnspan=2)
            gridBorder(self.gridColHdr, self.dataFirstCol, row, LEFTBORDER)
            gridBorder(self.gridColHdr,
                       self.dataFirstCol,
                       row,
                       RIGHTBORDER,
                       columnspan=2)
            if nextZfilter > priorZfilter + 1:  # combo box, use header on zAxis
                label = axisMbrRel.fromModelObject.genLabel(lang=self.lang)
            else:  # no combo box, use label on coord
                label = zAxisObj.genLabel(lang=self.lang)
            hdr = gridHdr(
                self.gridColHdr,
                self.dataFirstCol,
                row,
                label,
                anchor="w",
                columnspan=2,
                wraplength=200,  # in screen units
                objectId=zAxisObj.objectId(),
                onClick=self.onClick)
            if nextZfilter > priorZfilter + 1:  # multiple choices, use combo box
                zIndex = row - 1
                selectIndex = self.zComboBoxIndex[zIndex]
                combobox = gridCombobox(
                    self.gridColHdr,
                    self.dataFirstCol + 2,
                    row,
                    values=[
                        zFilter[2]
                        for zFilter in zFilters[priorZfilter:nextZfilter]
                    ],
                    selectindex=selectIndex,
                    columnspan=2,
                    comboboxselected=self.comboBoxSelected)
                combobox.zIndex = zIndex
                zFilterIndex = priorZfilter + selectIndex
                self.zFilterIndex[zIndex] = zFilterIndex
                combobox.objectId = hdr.objectId = zFilters[zFilterIndex][3]
                gridBorder(self.gridColHdr, self.dataFirstCol + 3, row,
                           RIGHTBORDER)
                row += 1

        if not zFilters:
            zFilters.append((None, set()))  # allow empty set operations
Esempio n. 31
0
    def view(self, viewTblELR=None):
        if viewTblELR:  # specific table selection
            self.tblELR = viewTblELR
        else:   # first or subsequenct reloading (language, dimensions, other change)
            self.loadTablesMenu()  # load menus (and initialize if first time
            viewTblELR = self.tblELR

        tblAxisRelSet = self.modelXbrl.relationshipSet(XbrlConst.euTableAxis, viewTblELR)
        self.axisMbrRelSet = self.modelXbrl.relationshipSet(XbrlConst.euAxisMember, viewTblELR)
        if tblAxisRelSet is None or len(tblAxisRelSet.modelRelationships) == 0:
            self.modelXbrl.modelManager.addToLog(_("no table relationships for {0}").format(self.arcrole))
            return False
        # remove old widgets
        self.viewFrame.clearGrid()

        # table name
        modelRoleTypes = self.modelXbrl.roleTypes.get(viewTblELR)
        if modelRoleTypes is not None and len(modelRoleTypes) > 0:
            roledefinition = modelRoleTypes[0].definition
            if roledefinition is None or roledefinition == "":
                roledefinition = os.path.basename(viewTblELR)       
        for table in tblAxisRelSet.rootConcepts:            
            self.dataCols = 0
            self.dataRows = 0
            self.colHdrDocRow = False
            self.colHdrCodeRow = False
            self.colHdrRows = 0
            self.dataRows = 0
            self.rowHdrMaxIndent = 0
            self.rowHdrDocRow = False
            self.rowHdrCodeRow = False
            self.zAxisRows = 0
            
            xAxisObj = yAxisObj = zAxisObj = None
            for tblAxisRel in tblAxisRelSet.fromModelObject(table):
                axisType = tblAxisRel.element.getAttribute("axisType")
                axisObj = tblAxisRel.toModelObject
                if axisType == "xAxis": xAxisObj = axisObj
                elif axisType == "yAxis": yAxisObj = axisObj
                elif axisType == "zAxis": zAxisObj = axisObj
                self.analyzeHdrs(axisObj, 1, axisType)
            self.colHdrTopRow = self.zAxisRows + (2 if self.zAxisRows else 1)
            self.dataFirstRow = self.colHdrTopRow + self.colHdrRows + self.colHdrDocRow + self.colHdrCodeRow
            self.dataFirstCol = 2 + self.rowHdrDocRow + self.rowHdrCodeRow
            #for i in range(self.dataFirstRow + self.dataRows):
            #    self.gridView.rowconfigure(i)
            #for i in range(self.dataFirstCol + self.dataCols):
            #    self.gridView.columnconfigure(i)
            
            gridHdr(self.gridTblHdr, 0, 0, 
                    roledefinition, 
                    anchor="nw",
                    #columnspan=(self.dataFirstCol - 1),
                    #rowspan=(self.dataFirstRow),
                    wraplength=200)
            zFilters = []
            self.zAxis(1, zAxisObj, zFilters)
            xFilters = []
            self.xAxis(self.dataFirstCol, self.colHdrTopRow, self.colHdrTopRow + self.colHdrRows - 1, 
                       xAxisObj, xFilters, self.xAxisChildrenFirst.get(), True, True)
            self.yAxis(self.dataFirstRow, 0, yAxisObj, True, self.yAxisChildrenFirst.get())
            self.bodyCells(self.dataFirstRow, 0, yAxisObj, xFilters, zFilters, self.yAxisChildrenFirst.get())
Esempio n. 32
0
    def __init__(self, mainWin, options):
        parent = mainWin.parent
        super(DialogFormulaParameters, self).__init__(parent)
        self.parent = parent
        self.options = options
        parentGeometry = re.match("(\d+)x(\d+)[+]?([-]?\d+)[+]?([-]?\d+)", parent.geometry())
        dialogX = int(parentGeometry.group(3))
        dialogY = int(parentGeometry.group(4))
        self.accepted = False

        self.transient(self.parent)
        self.title(_("Formula Parameters and Trace Options"))
        
        frame = Frame(self)

        '''
        dialogFrame = Frame(frame, width=500)
        dialogFrame.columnconfigure(0, weight=1)
        dialogFrame.rowconfigure(0, weight=1)
        dialogFrame.grid(row=0, column=0, columnspan=4, sticky=(N, S, E, W), padx=3, pady=3)
        '''
        
        # mainWin.showStatus(_("loading formula options and parameters"))
        
        # load grid
        gridHdr(frame, 1, 0, "Parameters", columnspan=3)
        gridHdr(frame, 1, 1, "QName")
        gridHdr(frame, 2, 1, "Type")
        gridHdr(frame, 3, 1, "Value")
        
        self.gridCells = []
        y = 2
        dataTypes = ("xs:string", "xs:integer", "xs:decimal", "xs:date", "xs:datetime", "xs:QName")
        for parameter in options["parameterValues"].items():
            paramQname, paramTypeValue = parameter
            if isinstance(paramTypeValue, (tuple,list)):
                paramType, paramValue = paramTypeValue  # similar to modelTestcaseObject, where values() are (type,value)
            else:
                paramType = None
                paramValue = paramTypeValue
            self.gridCells.append( (
                gridCell(frame, 1, y, paramQname),
                gridCombobox(frame, 2, y, paramType, values=dataTypes),
                gridCell(frame, 3, y, paramValue)) )
            y += 1
        # extra entry for new cells
        for i in range(5):
            self.gridCells.append( (
                gridCell(frame, 1, y),
                gridCombobox(frame, 2, y, values=dataTypes),
                gridCell(frame, 3, y)) )
            y += 1
        y += 1
        
        # checkbox entries
        label(frame, 1, y, "Parameter Trace:")
        label(frame, 1, y + 3, "API Calls Trace:")
        label(frame, 2, y, "Variable Set Trace:")
        label(frame, 3, y, "Variables Trace:")
        self.checkboxes = (
           checkbox(frame, 1, y + 1, 
                    "Expression Result", 
                    "traceParameterExpressionResult"),
           checkbox(frame, 1, y + 2,
                    "Input Value", 
                    "traceParameterInputValue"),
           checkbox(frame, 1, y + 4, 
                    "Expression Source", 
                    "traceCallExpressionSource"),
           checkbox(frame, 1, y + 5, 
                    "Expression Code", 
                    "traceCallExpressionCode"),
           checkbox(frame, 1, y + 6, 
                    "Expression Evaluation", 
                    "traceCallExpressionEvaluation"),
           checkbox(frame, 1, y + 7,
                    "Expression Result", 
                    "traceCallExpressionResult"),

           checkbox(frame, 2, y + 1, 
                    "Expression Source", 
                    "traceVariableSetExpressionSource"),
           checkbox(frame, 2, y + 2, 
                    "Expression Code", 
                    "traceVariableSetExpressionCode"),
           checkbox(frame, 2, y + 3, 
                    "Expression Evaluation", 
                    "traceVariableSetExpressionEvaluation"),
           checkbox(frame, 2, y + 4,
                    "Expression Result", 
                    "traceVariableSetExpressionResult"),
           checkbox(frame, 2, y + 5,
                    "Assertion Result Counts", 
                    "traceAssertionResultCounts"),
           checkbox(frame, 2, y + 6,
                    "Formula Rules", 
                    "traceFormulaRules"),
           checkbox(frame, 3, y + 1, 
                    "Variable Dependencies", 
                    "traceVariablesDependencies"),
           checkbox(frame, 3, y + 2, 
                    "Variables Order", 
                    "traceVariablesOrder"),
           checkbox(frame, 3, y + 3, 
                    "Expression Source", 
                    "traceVariableExpressionSource"),
           checkbox(frame, 3, y + 4, 
                    "Expression Code", 
                    "traceVariableExpressionCode"),
           checkbox(frame, 3, y + 5, 
                    "Expression Evaluation", 
                    "traceVariableExpressionEvaluation"),
           checkbox(frame, 3, y + 6, 
                    "Expression Result", 
                    "traceVariableExpressionResult"),
           checkbox(frame, 3, y + 7, 
                    "Filter Winnowing", 
                    "traceVariableFilterWinnowing"),
           checkbox(frame, 3, y + 8, 
                    "Filters Result", 
                    "traceVariableFiltersResult")
        
           # Note: if adding to this list keep ModelFormulaObject.FormulaOptions in sync
        
           )
        y += 9
        
        mainWin.showStatus(None)

        okButton = Button(frame, text=_("OK"), width=12, command=self.ok)
        cancelButton = Button(frame, text=_("Cancel"), width=12, command=self.close)
        okButton.grid(row=y, column=2, sticky=E, pady=3)
        cancelButton.grid(row=y, column=3, sticky=E, pady=3, padx=3)
        
        frame.grid(row=0, column=0, sticky=(N,S,E,W))
        frame.columnconfigure(1, weight=3)
        frame.columnconfigure(2, weight=1)
        frame.columnconfigure(3, weight=3)
        window = self.winfo_toplevel()
        window.columnconfigure(0, weight=1)
        self.geometry("+{0}+{1}".format(dialogX+50,dialogY+100))
        
        #self.bind("<Return>", self.ok)
        #self.bind("<Escape>", self.close)
        
        self.protocol("WM_DELETE_WINDOW", self.close)
        self.grab_set()
        self.wait_window(self)
Esempio n. 33
0
 def yAxis(self, leftCol, row, yAxisParentObj, childrenFirst, renderNow, atLeft):
     nestedBottomRow = row
     if atLeft:
         gridBorder(self.gridRowHdr, self.rowHdrCols + self.rowHdrDocCol + self.rowHdrCodeCol, 
                    self.dataFirstRow, 
                    RIGHTBORDER, 
                    rowspan=self.dataRows)
         gridBorder(self.gridRowHdr, 1, self.dataFirstRow + self.dataRows - 1, 
                    BOTTOMBORDER, 
                    columnspan=(self.rowHdrCols + self.rowHdrDocCol + self.rowHdrCodeCol))
     for axisMbrRel in self.axisMbrRelSet.fromModelObject(yAxisParentObj):
         yAxisHdrObj = axisMbrRel.toModelObject
         nestRow, nextRow = self.yAxis(leftCol + 1, row, yAxisHdrObj,  # nested items before totals
                                 childrenFirst, childrenFirst, False)
         
         isNonAbstract = yAxisHdrObj.abstract == "false"
         isAbstract = not isNonAbstract
         label = yAxisHdrObj.genLabel(lang=self.lang)
         topRow = row
         if childrenFirst and isNonAbstract:
             row = nextRow
         if renderNow:
             columnspan = self.rowHdrCols - leftCol + 1 if isNonAbstract or nextRow == row else None
             gridBorder(self.gridRowHdr, leftCol, topRow, LEFTBORDER, 
                        rowspan=(nestRow - topRow + 1) )
             gridBorder(self.gridRowHdr, leftCol, topRow, TOPBORDER, 
                        columnspan=(1 if childrenFirst and nextRow > row else columnspan))
             if childrenFirst and row > topRow:
                 gridBorder(self.gridRowHdr, leftCol + 1, row, TOPBORDER, 
                            columnspan=(self.rowHdrCols - leftCol))
             gridHdr(self.gridRowHdr, leftCol, row, 
                     label if label else "         ", 
                     anchor=("w" if isNonAbstract or nestRow == row else "center"),
                     columnspan=columnspan,
                     rowspan=(nestRow - row if isAbstract else None),
                     # wraplength is in screen units
                     wraplength=(self.rowHdrColWidth[leftCol] if isAbstract else
                                 self.rowHdrWrapLength -
                                   sum(self.rowHdrColWidth[i] for i in range(leftCol))),
                     minwidth=(16 if isNonAbstract and nextRow > topRow else None),
                     objectId=yAxisHdrObj.objectId(),
                     onClick=self.onClick)
             if isNonAbstract:
                 if self.rowHdrDocCol:
                     docCol = self.dataFirstCol - 1 - self.rowHdrCodeCol
                     gridBorder(self.gridRowHdr, docCol, row, TOPBORDER)
                     gridBorder(self.gridRowHdr, docCol, row, LEFTBORDER)
                     gridHdr(self.gridRowHdr, docCol, row, 
                             yAxisHdrObj.genLabel(role="http://www.xbrl.org/2008/role/documentation",
                                                  lang=self.lang), 
                             anchor="w",
                             wraplength=100, # screen units
                             objectId=yAxisHdrObj.objectId(),
                             onClick=self.onClick)
                 if self.rowHdrCodeCol:
                     codeCol = self.dataFirstCol - 1
                     gridBorder(self.gridRowHdr, codeCol, row, TOPBORDER)
                     gridBorder(self.gridRowHdr, codeCol, row, LEFTBORDER)
                     gridHdr(self.gridRowHdr, codeCol, row, 
                             yAxisHdrObj.genLabel(role="http://www.eurofiling.info/role/2010/coordinate-code"),
                             anchor="center",
                             wraplength=40, # screen units
                             objectId=yAxisHdrObj.objectId(),
                             onClick=self.onClick)
                 # gridBorder(self.gridRowHdr, leftCol, self.dataFirstRow - 1, BOTTOMBORDER)
         if isNonAbstract:
             row += 1
         elif childrenFirst:
             row = nextRow
         if nestRow > nestedBottomRow:
             nestedBottomRow = nestRow + (not childrenFirst)
         if row > nestedBottomRow:
             nestedBottomRow = row
         #if renderNow and not childrenFirst:
         #    dummy, row = self.yAxis(leftCol + 1, row, yAxisHdrObj, childrenFirst, True, False) # render on this pass
         if not childrenFirst:
             dummy, row = self.yAxis(leftCol + 1, row, yAxisHdrObj, childrenFirst, renderNow, False) # render on this pass
     return (nestedBottomRow, row)
Esempio n. 34
0
    def __init__(self, mainWin, options):
        parent = mainWin.parent
        super(DialogFind, self).__init__(parent)
        self.parent = parent
        self.modelManager = mainWin.modelManager
        self.modelXbrl = None   # set when Find pressed, this blocks next prematurely
        if options is None: options = newFindOptions
        self.options = options
        parentGeometry = re.match("(\d+)x(\d+)[+]?([-]?\d+)[+]?([-]?\d+)", parent.geometry())
        dialogW = int(parentGeometry.group(1))
        dialogH = int(parentGeometry.group(2))
        dialogX = int(parentGeometry.group(3))
        dialogY = int(parentGeometry.group(4))
        self.accepted = False

        self.transient(self.parent)
        self.title(_("Find"))
        
        self.objsList = [] # next may be tried before anything is found
        
        frame = Frame(self)

        # load grid
        findLabel = gridHdr(frame, 1, 0, "Find:", anchor="w")
        findLabel.grid(padx=8)
        self.cbExpr = gridCombobox(frame, 1, 1, values=options["priorExpressions"])
        self.cbExpr.grid(columnspan=3, padx=8)
        ToolTip(self.cbExpr, text=_("Enter expression to find, or select from combo box drop down history list."), wraplength=240)

        y = 2
        
        # checkbox entries
        label(frame, 1, y, "Direction:")
        label(frame, 1, y + 3, "Match:")
        scopeLabel = label(frame, 2, y, "Scope:")
        ToolTip(scopeLabel, text=_("Scope for an XBRL document (instance or DTS).  "
                                   "For an RSS Feed, all properties are matched.  "), wraplength=240)
        rbUp = radiobutton(frame, 1, y+1, "Up", "up", "direction")
        ToolTip(rbUp, text=_("Find/Next up (on screen) from last to first match."), wraplength=240)
        rbDn = radiobutton(frame, 1, y+2, "Down", "down", "direction", rbUp.valueVar)
        ToolTip(rbDn, text=_("Find/Next down (on screen) from first to last match."), wraplength=240)
        rbText = radiobutton(frame, 1, y+4, "Text (ignore case)", "text", "exprType")
        ToolTip(rbText, text=_("Expression is a set of characters to match, ignoring case.  "
                               "The match may occur anywhere within the scope. "), wraplength=360)
        rbRegex = radiobutton(frame, 1, y+5, "Regular expression", "regex", "exprType", rbText.valueVar)
        ToolTip(rbRegex, text=_('A regular expression to match, anywhere in the scope, ignoring case.  '
                                'For example, "cash" would match cash anywhere in a string (like cash on hand), '
                                'whereas "^cash$" would match a full string to only contain cash. ' 
                                'Use regular expression metacharacters, e.g., "." for any single character, '
                                '".*" for any number of wild characters, .{3} for exactly 3 wild characters. '), wraplength=360)
        rbXPath = radiobutton(frame, 1, y+6, "XPath 2 expression", "xpath", "exprType", rbText.valueVar)
        ToolTip(rbXPath, text=_('An XPath 2 expression, where the context element, ".", is a candidate concept QName, if any concept scope is checked, '
                                'and a candidate fact item, if any fact scope is checked.  The XPath 2 functions do not need an "fn:" prefix (but it is defined).  '
                                'The XBRL Functions Registry functions do require an "xfi:" prefix.  Constructors require an "xs:" prefix.  '
                                'The expression is considered "matched" for the candidate concept QNames or fact items where the effective boolean value of the expression is "true()".  '), wraplength=360)
        self.optionControls = (
           rbUp,
           rbDn,
           rbText,
           rbRegex,
           rbXPath,
           #checkbox(frame, 2, y + 1, "All", "all"),
           checkbox(frame, 2, y + 1, "Concept label", "conceptLabel"),
           checkbox(frame, 2, y + 2, "   name", "conceptName"),
           checkbox(frame, 2, y + 3, "   type", "conceptType"),
           checkbox(frame, 2, y + 4, "   subs group", "conceptSubs"),
           checkbox(frame, 2, y + 5, "   period type", "conceptPer"),
           checkbox(frame, 2, y + 6, "   balance", "conceptBal"),
           checkbox(frame, 3, y + 1, "Fact label", "factLabel"),
           checkbox(frame, 3, y + 2, "   name", "factName"),
           checkbox(frame, 3, y + 3, "   value", "factValue"),
           checkbox(frame, 3, y + 4, "   context", "factCntx"),
           checkbox(frame, 3, y + 5, "   unit", "factUnit"),
           checkbox(frame, 3, y + 6, "Messages", "messagesLog"),
        
           # Note: if adding to this list keep Finder.FindOptions in sync
        
           )
        y += 7
        resultLabel = gridHdr(frame, 1, y, "Result:", anchor="w")
        resultLabel.grid(padx=8)
        self.resultText = gridCell(frame, 1, y + 1)
        self.resultText.grid(columnspan=3, padx=8)
        self.resultText.config(state="readonly")
        y += 2
        
        mainWin.showStatus(None)

        buttonFrame = Frame(frame)
        buttonFrame.grid(columnspan=4, sticky=E, padx=8)
        findButton = Button(buttonFrame, text=_("Find"), width=12, command=self.find)
        ToolTip(findButton, text=_('Compile (if regular expression or XPath 2), and find first match (if down direction) or last match (if up direction).  '), wraplength=240)
        nextButton = Button(buttonFrame, text=_("Next"), width=12, command=self.next)
        ToolTip(nextButton, text=_('Advance to the next matched object (in selected direction).  '), wraplength=240)
        closeButton = Button(buttonFrame, text=_("Close"), width=12, command=self.close)
        ToolTip(closeButton, text=_('Close the find dialog.  '), wraplength=240)
        findButton.grid(row=1, column=1, pady=3)
        nextButton.grid(row=1, column=2, pady=3)
        closeButton.grid(row=1, column=3, padx=3)
        
        frame.grid(row=0, column=0, sticky=(N,S,E,W))
        frame.columnconfigure(1, weight=1)
        frame.columnconfigure(2, weight=1)
        frame.columnconfigure(3, weight=1)
        window = self.winfo_toplevel()
        window.columnconfigure(0, weight=1)
        if self.options["geometry"]:
            self.geometry(self.options["geometry"])
        else:
            self.geometry("+{0}+{1}".format(dialogX+50,dialogY+100))
        
        #self.bind("<Return>", self.ok)
        #self.bind("<Escape>", self.close)
        
        self.protocol("WM_DELETE_WINDOW", self.close)
        
        # make this dialog non-modal
        self.focus_set()
Esempio n. 35
0
    def view(self, viewTblELR=None):
        if viewTblELR:  # specific table selection
            self.tblELR = viewTblELR
        else:  # first or subsequenct reloading (language, dimensions, other change)
            self.loadTablesMenu()  # load menus (and initialize if first time
            viewTblELR = self.tblELR

        tblAxisRelSet = self.modelXbrl.relationshipSet(XbrlConst.euTableAxis, viewTblELR)
        self.axisMbrRelSet = self.modelXbrl.relationshipSet(XbrlConst.euAxisMember, viewTblELR)
        if tblAxisRelSet is None or len(tblAxisRelSet.modelRelationships) == 0:
            self.modelXbrl.modelManager.addToLog(_("no table relationships for {0}").format(self.arcrole))
            return False
        # remove old widgets
        self.viewFrame.clearGrid()

        # table name
        modelRoleTypes = self.modelXbrl.roleTypes.get(viewTblELR)
        if modelRoleTypes is not None and len(modelRoleTypes) > 0:
            roledefinition = modelRoleTypes[0].definition
            if roledefinition is None or roledefinition == "":
                roledefinition = os.path.basename(viewTblELR)
        for table in tblAxisRelSet.rootConcepts:
            self.dataCols = 0
            self.dataRows = 0
            self.colHdrDocRow = False
            self.colHdrCodeRow = False
            self.colHdrRows = 0
            self.dataRows = 0
            self.rowHdrMaxIndent = 0
            self.rowHdrDocRow = False
            self.rowHdrCodeRow = False
            self.zAxisRows = 0

            xAxisObj = yAxisObj = zAxisObj = None
            for tblAxisRel in tblAxisRelSet.fromModelObject(table):
                axisType = tblAxisRel.element.getAttribute("axisType")
                axisObj = tblAxisRel.toModelObject
                if axisType == "xAxis":
                    xAxisObj = axisObj
                elif axisType == "yAxis":
                    yAxisObj = axisObj
                elif axisType == "zAxis":
                    zAxisObj = axisObj
                self.analyzeHdrs(axisObj, 1, axisType)
            self.colHdrTopRow = self.zAxisRows + (2 if self.zAxisRows else 1)
            self.dataFirstRow = self.colHdrTopRow + self.colHdrRows + self.colHdrDocRow + self.colHdrCodeRow
            self.dataFirstCol = 2 + self.rowHdrDocRow + self.rowHdrCodeRow
            # for i in range(self.dataFirstRow + self.dataRows):
            #    self.gridView.rowconfigure(i)
            # for i in range(self.dataFirstCol + self.dataCols):
            #    self.gridView.columnconfigure(i)

            gridHdr(
                self.gridTblHdr,
                0,
                0,
                roledefinition,
                anchor="nw",
                # columnspan=(self.dataFirstCol - 1),
                # rowspan=(self.dataFirstRow),
                wraplength=200,
            )
            zFilters = []
            self.zAxis(1, zAxisObj, zFilters)
            xFilters = []
            self.xAxis(
                self.dataFirstCol,
                self.colHdrTopRow,
                self.colHdrTopRow + self.colHdrRows - 1,
                xAxisObj,
                xFilters,
                self.xAxisChildrenFirst.get(),
                True,
                True,
            )
            self.yAxis(self.dataFirstRow, 0, yAxisObj, True, self.yAxisChildrenFirst.get())
            self.bodyCells(self.dataFirstRow, 0, yAxisObj, xFilters, zFilters, self.yAxisChildrenFirst.get())
Esempio n. 36
0
 def yAxis(self, leftCol, row, yParentStructuralNode, childrenFirst, renderNow, atLeft):
     if yParentStructuralNode is not None:
         nestedBottomRow = row
         if atLeft:
             gridBorder(self.gridRowHdr, self.rowHdrCols + len(self.rowHdrNonStdRoles), # was: self.rowHdrDocCol + self.rowHdrCodeCol, 
                        self.dataFirstRow, 
                        RIGHTBORDER, 
                        rowspan=self.dataRows)
             gridBorder(self.gridRowHdr, 1, self.dataFirstRow + self.dataRows - 1, 
                        BOTTOMBORDER, 
                        columnspan=(self.rowHdrCols + len(self.rowHdrNonStdRoles))) # was: self.rowHdrDocCol + self.rowHdrCodeCol))
         for yStructuralNode in yParentStructuralNode.childStructuralNodes:
             if not yStructuralNode.isRollUp:
                 nestRow, nextRow = self.yAxis(leftCol + 1, row, yStructuralNode,  # nested items before totals
                                         childrenFirst, childrenFirst, False)
                 
                 isAbstract = (yStructuralNode.isAbstract or 
                               (yStructuralNode.childStructuralNodes and
                                not isinstance(yStructuralNode.definitionNode, (ModelClosedDefinitionNode, ModelEuAxisCoord))))
                 isNonAbstract = not isAbstract
                 label = yStructuralNode.header(lang=self.lang,
                                                returnGenLabel=isinstance(yStructuralNode.definitionNode, (ModelClosedDefinitionNode, ModelEuAxisCoord)))
                 topRow = row
                 if childrenFirst and isNonAbstract:
                     row = nextRow
                 if renderNow:
                     columnspan = self.rowHdrCols - leftCol + 1 if isNonAbstract or nextRow == row else None
                     gridBorder(self.gridRowHdr, leftCol, topRow, LEFTBORDER, 
                                rowspan=(nestRow - topRow + 1) )
                     gridBorder(self.gridRowHdr, leftCol, topRow, TOPBORDER, 
                                columnspan=(1 if childrenFirst and nextRow > row else columnspan))
                     if childrenFirst and row > topRow:
                         gridBorder(self.gridRowHdr, leftCol + 1, row, TOPBORDER, 
                                    columnspan=(self.rowHdrCols - leftCol))
                     depth = yStructuralNode.depth
                     gridHdr(self.gridRowHdr, leftCol, row, 
                             label if label is not None else "         ", 
                             anchor=("w" if isNonAbstract or nestRow == row else "center"),
                             columnspan=columnspan,
                             rowspan=(nestRow - row if isAbstract else None),
                             # wraplength is in screen units
                             wraplength=(self.rowHdrColWidth[depth] if isAbstract else
                                         self.rowHdrWrapLength - sum(self.rowHdrColWidth[0:depth])),
                             #minwidth=self.rowHdrColWidth[leftCol],
                             minwidth=(16 if isNonAbstract and nextRow > topRow else None),
                             objectId=yStructuralNode.objectId(),
                             onClick=self.onClick)
                     if isNonAbstract:
                         for i, role in enumerate(self.rowHdrNonStdRoles):
                             isCode = "code" in role
                             docCol = self.dataFirstCol - len(self.rowHdrNonStdRoles) + i
                             gridBorder(self.gridRowHdr, docCol, row, TOPBORDER)
                             gridBorder(self.gridRowHdr, docCol, row, LEFTBORDER)
                             gridHdr(self.gridRowHdr, docCol, row, 
                                     yStructuralNode.header(role=role, lang=self.lang), 
                                     anchor="c" if isCode else "w",
                                     wraplength=40 if isCode else 100, # screen units
                                     objectId=yStructuralNode.objectId(),
                                     onClick=self.onClick)
                         ''' was:
                         if self.rowHdrDocCol:
                             docCol = self.dataFirstCol - 1 - self.rowHdrCodeCol
                             gridBorder(self.gridRowHdr, docCol, row, TOPBORDER)
                             gridBorder(self.gridRowHdr, docCol, row, LEFTBORDER)
                             gridHdr(self.gridRowHdr, docCol, row, 
                                     yStructuralNode.header(role="http://www.xbrl.org/2008/role/documentation",
                                                          lang=self.lang), 
                                     anchor="w",
                                     wraplength=100, # screen units
                                     objectId=yStructuralNode.objectId(),
                                     onClick=self.onClick)
                         if self.rowHdrCodeCol:
                             codeCol = self.dataFirstCol - 1
                             gridBorder(self.gridRowHdr, codeCol, row, TOPBORDER)
                             gridBorder(self.gridRowHdr, codeCol, row, LEFTBORDER)
                             gridHdr(self.gridRowHdr, codeCol, row, 
                                     yStructuralNode.header(role="http://www.eurofiling.info/role/2010/coordinate-code"),
                                     anchor="center",
                                     wraplength=40, # screen units
                                     objectId=yStructuralNode.objectId(),
                                     onClick=self.onClick)
                         # gridBorder(self.gridRowHdr, leftCol, self.dataFirstRow - 1, BOTTOMBORDER)
                         '''
                 if isNonAbstract:
                     row += 1
                 elif childrenFirst:
                     row = nextRow
                 if nestRow > nestedBottomRow:
                     nestedBottomRow = nestRow + (isNonAbstract and not childrenFirst)
                 if row > nestedBottomRow:
                     nestedBottomRow = row
                 #if renderNow and not childrenFirst:
                 #    dummy, row = self.yAxis(leftCol + 1, row, yStructuralNode, childrenFirst, True, False) # render on this pass
                 if not childrenFirst:
                     dummy, row = self.yAxis(leftCol + 1, row, yStructuralNode, childrenFirst, renderNow, False) # render on this pass
         return (nestedBottomRow, row)
Esempio n. 37
0
 def __init__(self, mainWin):
     super(DialogLanguage, self).__init__(mainWin.parent)
     self.mainWin = mainWin
     self.parent = mainWin.parent
     parentGeometry = re.match("(\d+)x(\d+)[+]?([-]?\d+)[+]?([-]?\d+)", self.parent.geometry())
     dialogX = int(parentGeometry.group(3))
     dialogY = int(parentGeometry.group(4))
     self.transient(self.parent)
     self.title(_("arelle - User Interface and Labels language code settings"))
     self.languageCodes = languageCodes()
     langs = (["System default language ({0})".format(mainWin.modelManager.defaultLang)] +
              sorted(self.languageCodes.keys() if self.mainWin.isMSW else
                     [k 
                      for avail in [availableLocales()] # unix/Mac locale -a supported locale codes
                      for k, v in self.languageCodes.items()
                      if v.partition(" ")[0] in avail]
                     ))
     self.uiLang = mainWin.config.get("userInterfaceLangOverride", "")
     if self.uiLang == "" or self.uiLang == mainWin.modelManager.defaultLang:
         self.uiLangIndex = 0
     else:
         self.uiLangIndex = None
         for i, langName in enumerate(langs):
             if i > 0 and self.uiLang in self.languageCodes[langName]:
                 self.uiLangIndex = i
                 break
     self.labelLang = mainWin.config.get("labelLangOverride", "")
     if self.labelLang == "" or self.labelLang == mainWin.modelManager.defaultLang:
         self.labelLangIndex = 0
     else:
         self.labelLangIndex = None
         for i, langName in enumerate(langs):
             if i > 0 and self.labelLang in self.languageCodes[langName]:
                 self.labelLangIndex = i
                 break
     
     frame = Frame(self)
     
     defaultLanguage = mainWin.modelManager.defaultLang
     for langName, langCodes in self.languageCodes.items():
         if mainWin.modelManager.defaultLang in langCodes:
             defaultLanguage += ", " + langName
             break
     gridHdr(frame, 0, 0, _(
              "The system default language is: {0} \n\n"
              "You may override with a different language for user interface language and locale settings, and for language of taxonomy linkbase labels to display. \n\n").format(
             defaultLanguage),
           columnspan=5, wraplength=400)
     label(frame, 0, 1, _("User Interface:"))
     self.cbUiLang = gridCombobox(frame, 1, 1, values=langs, selectindex=self.uiLangIndex, columnspan=4)
     label(frame, 0, 2, _("Labels:"))
     self.cbLabelLang = gridCombobox(frame, 1, 2, values=langs, selectindex=self.labelLangIndex, columnspan=4)
     self.cbUiLang.focus_set()
     okButton = Button(frame, text=_("OK"), command=self.ok)
     cancelButton = Button(frame, text=_("Cancel"), command=self.close)
     okButton.grid(row=3, column=2, sticky=E, pady=3)
     cancelButton.grid(row=3, column=3, columnspan=2, sticky=EW, pady=3, padx=3)
     frame.grid(row=0, column=0, sticky=(N,S,E,W))
     frame.columnconfigure(1, weight=1)
     window = self.winfo_toplevel()
     window.columnconfigure(0, weight=1)
     self.geometry("+{0}+{1}".format(dialogX+50,dialogY+100))
     
     self.bind("<Return>", self.ok)
     self.bind("<Escape>", self.close)
     
     self.protocol("WM_DELETE_WINDOW", self.close)
     self.grab_set()
     self.wait_window(self)