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
Beispiel #2
0
    def __init__(self, mainWin, options):
        self.mainWin = mainWin
        parent = mainWin.parent
        super(DialogNewFactItemOptions, 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(_("New Fact Item Options"))
        
        frame = Frame(self)

        label(frame, 1, 1, "Entity scheme:")
        self.cellEntityIdentScheme = gridCell(frame, 2, 1, getattr(options,"entityIdentScheme",""), width=50)
        ToolTip(self.cellEntityIdentScheme, text=_("Enter the scheme for the context entity identifier"), wraplength=240)
        label(frame, 1, 2, "Entity identifier:")
        self.cellEntityIdentValue = gridCell(frame, 2, 2, getattr(options,"entityIdentValue",""))
        ToolTip(self.cellEntityIdentValue, text=_("Enter the entity identifier value (e.g., stock ticker)"), wraplength=240)
        label(frame, 1, 3, "Start date:")
        startDate = getattr(options,"startDate",None)
        self.cellStartDate = gridCell(frame, 2, 3, XmlUtil.dateunionValue(startDate) if startDate else "")
        ToolTip(self.cellStartDate, text=_("Enter the start date for the report period (e.g., 2010-01-01)"), wraplength=240)
        label(frame, 1, 4, "End date:")
        endDate = getattr(options,"endDate",None)
        self.cellEndDate = gridCell(frame, 2, 4, XmlUtil.dateunionValue(endDate, subtractOneDay=True) if endDate else "")
        ToolTip(self.cellEndDate, text=_("Enter the end date for the report period (e.g., 2010-12-31)"), wraplength=240)
        label(frame, 1, 5, "Monetary unit:")
        self.cellMonetaryUnit = gridCombobox(frame, 2, 5, getattr(options,"monetaryUnit",""), values=monetaryUnits)
        ToolTip(self.cellMonetaryUnit, text=_("Select a monetary unit (e.g., EUR)"), wraplength=240)
        label(frame, 1, 6, "Monetary decimals:")
        self.cellMonetaryDecimals = gridCell(frame, 2, 6, getattr(options,"monetaryDecimals","2"))
        ToolTip(self.cellMonetaryDecimals, text=_("Enter decimals for monetary items"), wraplength=240)
        label(frame, 1, 7, "Non-monetary decimals:")
        self.cellNonMonetaryDecimals = gridCell(frame, 2, 7, getattr(options,"nonMonetaryDecimals","0"))
        ToolTip(self.cellNonMonetaryDecimals, text=_("Enter decimals for non-monetary items (e.g., stock shares)"), wraplength=240)

        cancelButton = Button(frame, text=_("Cancel"), width=8, command=self.close)
        ToolTip(cancelButton, text=_("Cancel operation, discarding changes and entries"))
        okButton = Button(frame, text=_("OK"), width=8, command=self.ok)
        ToolTip(okButton, text=_("Accept the options as entered above"))
        cancelButton.grid(row=8, column=1, columnspan=3, sticky=E, pady=3, padx=3)
        okButton.grid(row=8, column=1, columnspan=3, sticky=E, pady=3, padx=86)
        
        frame.grid(row=0, column=0, sticky=(N,S,E,W))
        frame.columnconfigure(2, 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)
Beispiel #3
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
Beispiel #4
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
    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
Beispiel #6
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
Beispiel #7
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)
    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)
    def __init__(self, mainWin, options):
        self.mainWin = mainWin
        parent = mainWin.parent
        super(DialogRssWatch, 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(_("RSS Feed Processing Control"))
        
        frame = Frame(self)

        # checkbox entries
        label(frame, 1, 1, "RSS Feed:")
        feedSources = sorted(rssFeeds.keys())
        self.cellFeed = gridCombobox(frame, 2, 1, options.get("feedSource",""), values=feedSources)
        self.cellFeed.grid(pady=2)
        ToolTip(self.cellFeed, text=_("Select an RSS feed to process for item matching, formulas, and validations as selected below"), wraplength=240)
        label(frame, 1, 2, "Match fact text:")
        self.cellMatchText = gridCell(frame, 2, 2, options.get("matchTextExpr",""))
        ToolTip(self.cellMatchText, text=_("Enter a regular expression to be matched to the text of each filing instance fact item. "
                                           "Regular expressions may contain patterns to detect, such as ab.?c, for any single character between b and c, or ab.*c for any number of characters between b and c."), wraplength=240)
        label(frame, 1, 3, "Formula file:")
        self.cellFormulaFile = gridCell(frame,2, 3, options.get("formulaFileUri",""))
        ToolTip(self.cellFormulaFile, text=_("Select a formula linkbase to to evaluate each filing.  "
                                             "The formula linkbase may contain one or more assertions, the results of which is recorded in the log file.  "
                                             "If unsuccessful assertion alerts are selected and an e-mail address provided, the recipient will be notified of filings with assertions that do not pass."), wraplength=240)
        openFileImage = PhotoImage(file=os.path.join(mainWin.imagesDir, "toolbarOpenFile.gif"))
        chooseFormulaFileButton = Button(frame, image=openFileImage, width=12, command=self.chooseFormulaFile)
        chooseFormulaFileButton.grid(row=3, column=3, sticky=W)
        label(frame, 1, 4, "Log file:")
        self.cellLogFile = gridCell(frame,2, 4, options.get("logFileUri",""))
        ToolTip(self.cellLogFile, text=_("Select a log file in which to save an activity log, including validation results, matched item text, and formula results.\n\n "
                                         "Two files are produced, (1) .txt with the log messages, and (2) .csv with the RSS feed items and status.  "), wraplength=240)
        chooseLogFileButton = Button(frame, image=openFileImage, width=12, command=self.chooseLogFile)
        chooseLogFileButton.grid(row=4, column=3, sticky=W)
        label(frame, 1, 5, "E-mail alerts to:")
        self.cellEmailAddress = gridCell(frame,2, 5, options.get("emailAddress",""))
        ToolTip(self.cellEmailAddress, text=_("Specify e-mail recipient(s) for alerts per below."), wraplength=240)
        label(frame, 1, 6, "Latest pub date:")
        pubdate = getattr(options,"latestPubDate",None)
        self.cellLatestPubDate = gridCell(frame,2, 6, str(pubdate) if pubdate else "")
        ToolTip(self.cellLatestPubDate, text=_("Specify pub dateTime of last processed submission.  Next item to examine will be after this dateTime."), wraplength=240)
        clearImage = PhotoImage(file=os.path.join(mainWin.imagesDir, "toolbarDelete.gif"))
        clearPubDateButton = Button(frame, image=clearImage, width=12, command=self.clearPubDate)
        clearPubDateButton.grid(row=6, column=3, sticky=W)
        ToolTip(clearPubDateButton, text=_("Clear pub dateTime so that next cycle processes all entries in RSS feed."), wraplength=240)
        label(frame, 2, 7, "Validate:")
        label(frame, 2, 12, "Alert on:")
        self.checkboxes = (
           checkbox(frame, 2, 8, 
                    "XBRL 2.1 and Dimensions rules", 
                    "validateXbrlRules"),
           checkbox(frame, 2, 9, 
                    "Selected disclosure system rules", 
                    "validateDisclosureSystemRules"),
           checkbox(frame, 2, 10,
                    "Calculation linkbase roll-up", 
                    "validateCalcLinkbase"),
           checkbox(frame, 2, 11,
                    "Formula assertions", 
                    "validateFormulaAssertions"),
           checkbox(frame, 2, 13, 
                    "Facts with matching text", 
                    "alertMatchedFactText"),
           checkbox(frame, 2, 14,
                    "Unsuccessful formula assertions", 
                    "alertAssertionUnsuccessful"),
           checkbox(frame, 2, 15, 
                    "Validation errors", 
                    "alertValiditionError"),

        
           # Note: if adding to this list keep ModelFormulaObject.FormulaOptions in sync
        
           )
        
        mainWin.showStatus(None)

        cancelButton = Button(frame, text=_("Cancel"), width=8, command=self.close)
        ToolTip(cancelButton, text=_("Cancel operation, discarding changes and entries"))
        okButton = Button(frame, text=_("OK"), width=8, command=self.ok)
        ToolTip(okButton, text=_("Accept the options as entered above"))
        cancelButton.grid(row=16, column=1, columnspan=3, sticky=E, pady=3, padx=3)
        okButton.grid(row=16, column=1, columnspan=3, sticky=E, pady=3, padx=86)
        
        frame.grid(row=0, column=0, sticky=(N,S,E,W))
        frame.columnconfigure(2, 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)
Beispiel #10
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()
Beispiel #11
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()
 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)
Beispiel #13
0
    def __init__(self, mainWin, options):
        self.mainWin = mainWin
        parent = mainWin.parent
        super(DialogRssWatch, 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(_("RSS Feed Processing Control"))

        frame = Frame(self)
        frame.focus_set()

        # checkbox entries
        row = 1  # row number (to allow future plugins
        label(frame, 1, row, "RSS Feed:")
        feedSources = sorted(rssFeeds.keys())
        self.cellFeed = gridCombobox(frame,
                                     2,
                                     row,
                                     options.get("feedSource", ""),
                                     values=feedSources)
        self.cellFeed.grid(pady=2)
        ToolTip(
            self.cellFeed,
            text=
            _("Select an RSS feed to process for item matching, formulas, and validations as selected below"
              ),
            wraplength=240)
        row += 1
        label(frame, 1, row, "Match fact text:")
        self.cellMatchText = gridCell(frame, 2, row,
                                      options.get("matchTextExpr", ""))
        ToolTip(
            self.cellMatchText,
            text=
            _("Enter a regular expression to be matched to the text of each filing instance fact item. "
              "Regular expressions may contain patterns to detect, such as ab.?c, for any single character between b and c, or ab.*c for any number of characters between b and c."
              ),
            wraplength=240)
        row += 1
        label(frame, 1, row, "Formula file:")
        self.cellFormulaFile = gridCell(frame, 2, row,
                                        options.get("formulaFileUri", ""))
        ToolTip(
            self.cellFormulaFile,
            text=
            _("Select a formula linkbase to to evaluate each filing.  "
              "The formula linkbase may contain one or more assertions, the results of which is recorded in the log file.  "
              "If unsuccessful assertion alerts are selected and an e-mail address provided, the recipient will be notified of filings with assertions that do not pass."
              ),
            wraplength=240)
        openFileImage = PhotoImage(
            file=os.path.join(mainWin.imagesDir, "toolbarOpenFile.gif"))
        chooseFormulaFileButton = Button(frame,
                                         image=openFileImage,
                                         width=12,
                                         command=self.chooseFormulaFile)
        chooseFormulaFileButton.grid(row=row, column=3, sticky=W)
        row += 1
        openDatabaseImage = PhotoImage(
            file=os.path.join(mainWin.imagesDir, "toolbarOpenDatabase.gif"))
        for pluginXbrlMethod in pluginClassMethods(
                "DialogRssWatch.FileChoices"):
            pluginXbrlMethod(self, frame, row, options, mainWin, openFileImage,
                             openDatabaseImage)
            row += 1
        label(frame, 1, row, "Log file:")
        self.cellLogFile = gridCell(frame, 2, row,
                                    options.get("logFileUri", ""))
        ToolTip(
            self.cellLogFile,
            text=
            _("Select a log file in which to save an activity log, including validation results, matched item text, and formula results.\n\n "
              "If file ends in .xml it is xml-formatted, otherwise it is text. "
              ),
            wraplength=240)
        chooseLogFileButton = Button(frame,
                                     image=openFileImage,
                                     width=12,
                                     command=self.chooseLogFile)
        chooseLogFileButton.grid(row=row, column=3, sticky=W)
        row += 1
        label(frame, 1, row, "E-mail alerts to:")
        self.cellEmailAddress = gridCell(frame, 2, row,
                                         options.get("emailAddress", ""))
        ToolTip(self.cellEmailAddress,
                text=_("Specify e-mail recipient(s) for alerts per below."),
                wraplength=240)
        propertiesImage = PhotoImage(
            file=os.path.join(mainWin.imagesDir, "toolbarProperties.gif"))
        smtpSetupButton = Button(frame,
                                 image=propertiesImage,
                                 width=12,
                                 command=self.setupSmtp)
        smtpSetupButton.grid(row=row, column=3, sticky=W)
        ToolTip(
            smtpSetupButton,
            text=_("Enter/edit settings of outgoing e-mail server (SMTP)."),
            wraplength=240)
        row += 1
        label(frame, 1, row, "Latest pub date:")
        pubdate = getattr(options, "latestPubDate", None)
        self.cellLatestPubDate = gridCell(frame, 2, row,
                                          str(pubdate) if pubdate else "")
        ToolTip(
            self.cellLatestPubDate,
            text=
            _("Specify pub dateTime of last processed submission.  Next item to examine will be after this dateTime."
              ),
            wraplength=240)
        clearImage = PhotoImage(
            file=os.path.join(mainWin.imagesDir, "toolbarDelete.gif"))
        clearPubDateButton = Button(frame,
                                    image=clearImage,
                                    width=12,
                                    command=self.clearPubDate)
        clearPubDateButton.grid(row=row, column=3, sticky=W)
        ToolTip(
            clearPubDateButton,
            text=
            _("Clear pub dateTime so that next cycle processes all entries in RSS feed."
              ),
            wraplength=240)
        row += 1
        label(frame, 2, row, "Validate:")
        row += 1
        self.checkboxes = (
            checkbox(frame, 2, row, "XBRL 2.1 and Dimensions rules",
                     "validateXbrlRules"),
            checkbox(frame, 2, row + 1, "Selected disclosure system rules",
                     "validateDisclosureSystemRules"),
            checkbox(frame, 2, row + 2, "Calculation linkbase roll-up",
                     "validateCalcLinkbase"),
            checkbox(frame, 2, row + 3, "Formula assertions",
                     "validateFormulaAssertions"),
            # Note: if adding to this list keep ModelFormulaObject.FormulaOptions in sync
        )
        row += 4
        for pluginXbrlMethod in pluginClassMethods(
                "DialogRssWatch.ValidateChoices"):
            pluginXbrlMethod(self, frame, row, options, mainWin)
            row += 1
        label(frame, 2, row, "Alert on:")
        row += 1
        self.checkboxes += (
            checkbox(frame, 2, row, "Facts with matching text",
                     "alertMatchedFactText"),
            checkbox(frame, 2, row + 1, "Unsuccessful formula assertions",
                     "alertAssertionUnsuccessful"),
            checkbox(frame, 2, row + 2, "Validation errors",
                     "alertValiditionError"),
            # Note: if adding to this list keep ModelFormulaObject.FormulaOptions in sync
        )
        row += 3

        mainWin.showStatus(None)

        cancelButton = Button(frame,
                              text=_("Cancel"),
                              width=8,
                              command=self.close)
        ToolTip(cancelButton,
                text=_("Cancel operation, discarding changes and entries"))
        okButton = Button(frame, text=_("OK"), width=8, command=self.ok)
        ToolTip(okButton, text=_("Accept the options as entered above"))
        cancelButton.grid(row=row,
                          column=1,
                          columnspan=3,
                          sticky=E,
                          pady=3,
                          padx=3)
        okButton.grid(row=row,
                      column=1,
                      columnspan=3,
                      sticky=E,
                      pady=3,
                      padx=86)

        frame.grid(row=0, column=0, sticky=(N, S, E, W))
        frame.columnconfigure(2, 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)
Beispiel #14
0
    def __init__(self, parent, title, host=None, realm=None, useOsProxy=None, urlAddr=None, urlPort=None, user=None, password=None, database=None, timeout=None, dbType=None, showUrl=False, showUser=False, showHost=True, showRealm=True, showDatabase=False):
        super(DialogUserPassword, self).__init__(parent)
        self.parent = parent
        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(title)
        self.urlAddrVar = StringVar()
        self.urlAddrVar.set(urlAddr if urlAddr else "")
        self.urlPortVar = StringVar()
        self.urlPortVar.set(urlPort if urlPort else "")
        self.userVar = StringVar()
        self.userVar.set(user if user else "")
        self.passwordVar = StringVar()
        self.passwordVar.set(password if password else "")
        self.databaseVar = StringVar()
        self.databaseVar.set(database if database else "")
        self.timeoutVar = StringVar()
        self.timeoutVar.set(timeout if timeout else "")
        
        frame = Frame(self)
        y = 0
        if showHost:
            hostLabel = Label(frame, text=_("Host:"), underline=0)
            hostDisplay = Label(frame, text=host, width=30)
            if host and len(host) > 30:
                ToolTip(hostDisplay, text=host, wraplength=240)
            hostLabel.grid(row=y, column=0, sticky=W, pady=3, padx=3)
            hostDisplay.grid(row=y, column=1, columnspan=4, sticky=EW, pady=3, padx=3)
            y += 1
        if showRealm:
            realmLabel = Label(frame, text=_("Realm:"), underline=0)
            realmDisplay = Label(frame, text=realm, width=25)
            if realm and len(realm) > 30:
                ToolTip(realmDisplay, text=realm, wraplength=240)
            realmLabel.grid(row=y, column=0, sticky=W, pady=3, padx=3)
            realmDisplay.grid(row=y, column=1, columnspan=4, sticky=EW, pady=3, padx=3)
            y += 1
        self.enabledWidgets = []
        if useOsProxy is not None:
            if sys.platform.startswith("win"):
                hostProxy = _('Microsoft Windows Internet Settings')
            elif sys.platform in ("darwin", "macos"):
                hostProxy = _('Mac OS X System Configuration')
            else: # linux/unix
                hostProxy = _('environment variables')
            useOsProxyCb = checkbox(frame, 0, y, text=_("Use proxy server of {0}").format(hostProxy))
            useOsProxyCb.grid(columnspan=5)
            useOsProxyCb.valueVar.set(useOsProxy)
            ToolTip(useOsProxyCb, text=_("Check to use {0} \n"
                                         "Uncheck to specify: \n"
                                         "   No proxy if URL address is left blank, \n"
                                         "   Proxy via URL address if it is not blank, \n"
                                         "       with user and password (if provided)"
                                         ).format(hostProxy), wraplength=360)
            self.useOsProxyCb = useOsProxyCb
            useOsProxyCb.valueVar.trace("w", self.setEnabledState)

            y += 1
        if showUrl:
            urlAddrLabel = Label(frame, text=_("Address:"), underline=0)
            urlAddrEntry = Entry(frame, textvariable=self.urlAddrVar, width=16)
            urlPortLabel = Label(frame, text=_("Port:"), underline=0)
            urlPortEntry = Entry(frame, textvariable=self.urlPortVar, width=5)
            urlAddrEntry.focus_set()
            urlAddrLabel.grid(row=y, column=0, sticky=W, pady=3, padx=3)
            urlAddrEntry.grid(row=y, column=1, columnspan=2, sticky=EW, pady=3, padx=3)
            urlPortLabel.grid(row=y, column=3, sticky=W, pady=3, padx=3)
            urlPortEntry.grid(row=y, column=4, sticky=EW, pady=3, padx=3)
            ToolTip(urlAddrEntry, text=_("Enter URL address and port number \n"
                                         "  e.g., address: 168.1.2.3 port: 8080 \n"
                                         "  or address: proxy.myCompany.com port: 8080 \n"
                                         "  or leave blank to specify no proxy server"), wraplength=360)
            self.enabledWidgets.append(urlAddrEntry)
            self.enabledWidgets.append(urlPortEntry)
            y += 1
        userLabel = Label(frame, text=_("User:"******"Password:"******"*")
        passwordLabel.grid(row=y, column=0, sticky=W, pady=3, padx=3)
        passwordEntry.grid(row=y, column=1, columnspan=4, sticky=EW, pady=3, padx=3)
        self.enabledWidgets.append(passwordEntry)
        y += 1
        if showDatabase:
            urlDatabaseLabel = Label(frame, text=_("Database:"), underline=0)
            urlDatabaseEntry = Entry(frame, textvariable=self.databaseVar, width=25)
            urlDatabaseLabel.grid(row=y, column=0, sticky=W, pady=3, padx=3)
            urlDatabaseEntry.grid(row=y, column=1, columnspan=4, sticky=EW, pady=3, padx=3)
            ToolTip(urlAddrEntry, text=_("Enter database name (optional) or leave blank"), wraplength=360)
            self.enabledWidgets.append(urlDatabaseEntry)
            y += 1
            urlTimeoutLabel = Label(frame, text=_("Timeout:"), underline=0)
            urlTimeoutEntry = Entry(frame, textvariable=self.timeoutVar, width=25)
            urlTimeoutLabel.grid(row=y, column=0, sticky=W, pady=3, padx=3)
            urlTimeoutEntry.grid(row=y, column=1, columnspan=4, sticky=EW, pady=3, padx=3)
            ToolTip(urlAddrEntry, text=_("Enter timeout seconds (optional) or leave blank for default (60 secs.)"), wraplength=360)
            self.enabledWidgets.append(urlTimeoutEntry)
            y += 1
            dbTypeLabel = Label(frame, text=_("DB type:"), underline=0)
            dbTypeLabel.grid(row=y, column=0, sticky=W, pady=3, padx=3)
            self.cbDbType = gridCombobox(frame, 1, y, values=DBDescriptions, 
                                         selectindex=DBTypes.index(dbType) if dbType in DBTypes else None)
            self.cbDbType.grid(columnspan=4, pady=3, padx=3)
            y += 1
        okButton = Button(frame, text=_("OK"), command=self.ok)
        cancelButton = Button(frame, text=_("Cancel"), command=self.close)
        okButton.grid(row=y, column=2, sticky=E, pady=3)
        cancelButton.grid(row=y, column=3, columnspan=2, sticky=EW, pady=3, padx=3)
        y += 1
                
        if useOsProxy is not None:
            self.setEnabledState()

        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)
Beispiel #15
0
    def __init__(self, parent, title, host=None, realm=None, useOsProxy=None, urlAddr=None, urlPort=None, user=None, password=None, database=None, timeout=None, dbType=None, showUrl=False, showUser=False, showHost=True, showRealm=True, showDatabase=False):
        super(DialogUserPassword, self).__init__(parent)
        self.parent = parent
        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(title)
        self.urlAddrVar = StringVar()
        self.urlAddrVar.set(urlAddr if urlAddr else "")
        self.urlPortVar = StringVar()
        self.urlPortVar.set(urlPort if urlPort else "")
        self.userVar = StringVar()
        self.userVar.set(user if user else "")
        self.passwordVar = StringVar()
        self.passwordVar.set(password if password else "")
        self.databaseVar = StringVar()
        self.databaseVar.set(database if database else "")
        self.timeoutVar = StringVar()
        self.timeoutVar.set(timeout if timeout else "")
        
        frame = Frame(self)
        y = 0
        if showHost:
            hostLabel = Label(frame, text=_("Host:"), underline=0)
            hostDisplay = Label(frame, text=host, width=30)
            if host and len(host) > 30:
                ToolTip(hostDisplay, text=host, wraplength=240)
            hostLabel.grid(row=y, column=0, sticky=W, pady=3, padx=3)
            hostDisplay.grid(row=y, column=1, columnspan=4, sticky=EW, pady=3, padx=3)
            y += 1
        if showRealm:
            realmLabel = Label(frame, text=_("Realm:"), underline=0)
            realmDisplay = Label(frame, text=realm, width=25)
            if realm and len(realm) > 30:
                ToolTip(realmDisplay, text=realm, wraplength=240)
            realmLabel.grid(row=y, column=0, sticky=W, pady=3, padx=3)
            realmDisplay.grid(row=y, column=1, columnspan=4, sticky=EW, pady=3, padx=3)
            y += 1
        self.enabledWidgets = []
        if useOsProxy is not None:
            if sys.platform.startswith("win"):
                hostProxy = _('Microsoft Windows Internet Settings')
            elif sys.platform in ("darwin", "macos"):
                hostProxy = _('Mac OS X System Configuration')
            else: # linux/unix
                hostProxy = _('environment variables')
            useOsProxyCb = checkbox(frame, 0, y, text=_("Use proxy server of {0}").format(hostProxy))
            useOsProxyCb.grid(columnspan=5)
            useOsProxyCb.valueVar.set(useOsProxy)
            ToolTip(useOsProxyCb, text=_("Check to use {0} \n"
                                         "Uncheck to specify: \n"
                                         "   No proxy if URL address is left blank, \n"
                                         "   Proxy via URL address if it is not blank, \n"
                                         "       with user and password (if provided)"
                                         ).format(hostProxy), wraplength=360)
            self.useOsProxyCb = useOsProxyCb
            useOsProxyCb.valueVar.trace("w", self.setEnabledState)

            y += 1
        if showUrl:
            urlAddrLabel = Label(frame, text=_("Address:"), underline=0)
            urlAddrEntry = Entry(frame, textvariable=self.urlAddrVar, width=16)
            urlPortLabel = Label(frame, text=_("Port:"), underline=0)
            urlPortEntry = Entry(frame, textvariable=self.urlPortVar, width=5)
            urlAddrEntry.focus_set()
            urlAddrLabel.grid(row=y, column=0, sticky=W, pady=3, padx=3)
            urlAddrEntry.grid(row=y, column=1, columnspan=2, sticky=EW, pady=3, padx=3)
            urlPortLabel.grid(row=y, column=3, sticky=W, pady=3, padx=3)
            urlPortEntry.grid(row=y, column=4, sticky=EW, pady=3, padx=3)
            ToolTip(urlAddrEntry, text=_("Enter URL address and port number \n"
                                         "  e.g., address: 168.1.2.3 port: 8080 \n"
                                         "  or address: proxy.myCompany.com port: 8080 \n"
                                         "  or leave blank to specify no proxy server"), wraplength=360)
            self.enabledWidgets.append(urlAddrEntry)
            self.enabledWidgets.append(urlPortEntry)
            y += 1
        userLabel = Label(frame, text=_("User:"******"Password:"******"*")
        passwordLabel.grid(row=y, column=0, sticky=W, pady=3, padx=3)
        passwordEntry.grid(row=y, column=1, columnspan=4, sticky=EW, pady=3, padx=3)
        self.enabledWidgets.append(passwordEntry)
        y += 1
        if showDatabase:
            urlDatabaseLabel = Label(frame, text=_("Database:"), underline=0)
            urlDatabaseEntry = Entry(frame, textvariable=self.databaseVar, width=25)
            urlDatabaseLabel.grid(row=y, column=0, sticky=W, pady=3, padx=3)
            urlDatabaseEntry.grid(row=y, column=1, columnspan=4, sticky=EW, pady=3, padx=3)
            ToolTip(urlAddrEntry, text=_("Enter database name (optional) or leave blank"), wraplength=360)
            self.enabledWidgets.append(urlDatabaseEntry)
            y += 1
            urlTimeoutLabel = Label(frame, text=_("Timeout:"), underline=0)
            urlTimeoutEntry = Entry(frame, textvariable=self.timeoutVar, width=25)
            urlTimeoutLabel.grid(row=y, column=0, sticky=W, pady=3, padx=3)
            urlTimeoutEntry.grid(row=y, column=1, columnspan=4, sticky=EW, pady=3, padx=3)
            ToolTip(urlAddrEntry, text=_("Enter timeout seconds (optional) or leave blank for default (60 secs.)"), wraplength=360)
            self.enabledWidgets.append(urlTimeoutEntry)
            y += 1
            dbTypeLabel = Label(frame, text=_("DB type:"), underline=0)
            dbTypeLabel.grid(row=y, column=0, sticky=W, pady=3, padx=3)
            self.cbDbType = gridCombobox(frame, 1, y, values=DBDescriptions, 
                                         selectindex=DBTypes.index(dbType) if dbType in DBTypes else None)
            self.cbDbType.grid(columnspan=4, pady=3, padx=3)
            y += 1
        okButton = Button(frame, text=_("OK"), command=self.ok)
        cancelButton = Button(frame, text=_("Cancel"), command=self.close)
        okButton.grid(row=y, column=2, sticky=E, pady=3)
        cancelButton.grid(row=y, column=3, columnspan=2, sticky=EW, pady=3, padx=3)
        y += 1
                
        if useOsProxy is not None:
            self.setEnabledState()

        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)
Beispiel #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
    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)
Beispiel #18
0
    def __init__(self, mainWin):
        self.mainWin = mainWin
        parent = mainWin
        super(DialogNewFileOptions, self).__init__(parent)
        self.parent = parent
        parentGeometry = re.match("(\d+)x(\d+)[+]?([-]?\d+)[+]?([-]?\d+)", parent.geometry())
        dialogX = int(parentGeometry.group(3))
        dialogY = int(parentGeometry.group(4))
        self.accepted = False
        
        self.ebaTaxonomyVersion = EBA_TAXONOMY_DEFAULT_VERSION
        self.ebaReportingType = EBA_REPORTING_TYPE_DEFAULT
        self.setEntryPoints()
        self.ebaEntryPointKey = self.ebaEntryPointValues[0]
        self.options = EbaNewFileOptions(self.ebaTaxonomyVersion, self.ebaReportingType,
                                         self.ebaEntryPointValues[0])
        
        options = self.options

        self.transient(self.parent)
        self.title(_("New EBA File"))
        
        frame = Frame(self)
        frame.focus_set()
        
        label(frame, 1, 1, _("Taxonomy version:"))
        self.cellTaxonomyVersion = gridCombobox(frame, 2, 1, getattr(options,"ebaTaxonomyVersion", ""),
                                           values=EBA_TAXONOMY_VERSIONS_VALUES,
                                           comboboxselected = self.onTaxonomyVersionChanged,
                                           width=40)
        ToolTip(self.cellTaxonomyVersion, text=_("Select a taxonomy version"), wraplength=240)

        label(frame, 1, 2, _("EBA reporting type:"))
        self.cellReportType = gridCombobox(frame, 2, 2, getattr(options,"ebaReportingType", ""),
                                           values=EBA_REPORTING_TYPES_VALUES,
                                           comboboxselected = self.onReportTypeChanged,
                                           width=40)
        ToolTip(self.cellReportType, text=_("Select a report type"), wraplength=240)
        label(frame, 1, 3, _("Entry point:"))
        self.cellEntryPoint = gridCombobox(frame, 2, 3, getattr(options,"ebaEntryPointKey", ""),
                                           values=self.ebaEntryPointValues,
                                           comboboxselected = self.onEntryPointChanged,
                                           width=40)
        ToolTip(self.cellEntryPoint, text=_("Select an EBA entry point"), wraplength=240)
        currentRow = 4
        
        self.setEntryPointsCombo()


        cancelButton = Button(frame, text=_("Cancel"), width=8, command=self.close)
        ToolTip(cancelButton, text=_("Cancel operation"))
        okButton = Button(frame, text=_("New"), width=8, command=self.ok)
        ToolTip(okButton, text=_("Create a new file"))
        cancelButton.grid(row=currentRow, column=1, columnspan=3, sticky=E, pady=3, padx=3)
        okButton.grid(row=currentRow, column=1, columnspan=3, sticky=E, pady=3, padx=86)
        
        frame.grid(row=0, column=0, sticky=(N,S,E,W))
        frame.columnconfigure(2, weight=1)
        window = self.winfo_toplevel()
        window.columnconfigure(0, weight=1)
        self.geometry("+{0}+{1}".format(dialogX+50,dialogY+100))
        self.protocol("WM_DELETE_WINDOW", self.close)
        self.grab_set()
        self.wait_window(self)
Beispiel #19
0
    def __init__(self, mainWin, modelXbrl):
        parent = mainWin.parent
        super(DialogArcroleGroup, self).__init__(parent)
        self.mainWin = mainWin
        self.parent = parent
        self.modelXbrl = modelXbrl
        parentGeometry = re.match("(\d+)x(\d+)[+]?([-]?\d+)[+]?([-]?\d+)",
                                  parent.geometry())
        dialogX = int(parentGeometry.group(3))
        dialogY = int(parentGeometry.group(4))
        self.selectedGroup = None

        self.transient(self.parent)
        self.title(_("Select Arcrole Group"))

        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
        groupLabel = label(frame, 1, 0, _("Group:"))
        self.arcroleGroups = mainWin.config.get("arcroleGroups", {})
        arcroleGroupSelected = self.mainWin.config.get("arcroleGroupSelected")
        if arcroleGroupSelected in self.arcroleGroups:
            arcroleGroup = self.arcroleGroups[arcroleGroupSelected]
        else:
            arcroleGroup = []
            arcroleGroupSelected = None
        self.groupName = gridCombobox(frame,
                                      2,
                                      0,
                                      value=arcroleGroupSelected,
                                      values=sorted(self.arcroleGroups.keys()),
                                      comboboxselected=self.comboBoxSelected)
        groupToolTipMessage = _(
            "Select an existing arcrole group, or enter a name for a new arcrole group.  "
            "If selecting an existing group, it can be edited, and changes will be saved in the config file.  "
            "If nothing is changed for an existing group, the saved setting is not disturbed.  "
            "Arcroles with checkboxes below are shown only for arcroles that have relationships in the loaded DTS, "
            "but if an existing group is selected with more arcroles (that were not in the current DTS) then "
            "the prior setting with not-present arcroles is preserved. ")
        ToolTip(self.groupName, text=groupToolTipMessage, wraplength=360)
        ToolTip(groupLabel, text=groupToolTipMessage, wraplength=360)
        clearImage = PhotoImage(
            file=os.path.join(mainWin.imagesDir, "toolbarDelete.gif"))
        clearGroupNameButton = Button(frame,
                                      image=clearImage,
                                      width=12,
                                      command=self.clearGroupName)
        clearGroupNameButton.grid(row=0, column=3, sticky=W)
        ToolTip(
            clearGroupNameButton,
            text=
            _("Remove the currently selected arcrole group from the config file. "
              "After removing, you may select another arcrole, but must select 'OK' for the "
              "removal to be saved. "),
            wraplength=240)
        arcrolesLabel = label(frame, 1, 1, _("Arcroles:"))
        ToolTip(
            arcrolesLabel,
            text=_("Shows all the arcroles that are present in this DTS. "),
            wraplength=240)
        from arelle.ModelRelationshipSet import baseSetArcroles
        self.options = {}
        self.checkboxes = []
        y = 1
        for name, arcrole in baseSetArcroles(self.modelXbrl):
            if arcrole.startswith("http://"):
                self.options[arcrole] = arcrole in arcroleGroup
                self.checkboxes.append(
                    checkbox(frame, 2, y, name[1:], arcrole, columnspan=2))
                y += 1

        mainWin.showStatus(None)

        self.options[
            XbrlConst.
            arcroleGroupDetect] = XbrlConst.arcroleGroupDetect in arcroleGroup
        self.autoOpen = checkbox(frame, 1, y, _("detect"),
                                 XbrlConst.arcroleGroupDetect)
        self.autoOpen.grid(sticky=W, columnspan=2)
        self.checkboxes.append(self.autoOpen)
        ToolTip(
            self.autoOpen,
            text=
            _("If checked, this arcrole group will be detected if any arcrole of the group is present in a DTS, for example to open a treeview pane. "
              ),
            wraplength=240)
        okButton = Button(frame, text=_("OK"), width=8, command=self.ok)
        cancelButton = Button(frame,
                              text=_("Cancel"),
                              width=8,
                              command=self.close)
        cancelButton.grid(row=y,
                          column=1,
                          sticky=E,
                          columnspan=3,
                          pady=3,
                          padx=3)
        okButton.grid(row=y, column=1, sticky=E, columnspan=3, pady=3, padx=64)
        ToolTip(
            okButton,
            text=
            _("Open a treeview with named arcrole group and selected arcroles. "
              "If any changes were made to checkboxes or name, save in the config. "
              ),
            wraplength=240)
        ToolTip(
            cancelButton,
            text=
            _("Close this dialog, without saving arcrole group changes or opening a view pane. "
              ),
            wraplength=240)

        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)
Beispiel #20
0
    def __init__(self, mainWin):
        parent = mainWin.parent
        super(DialogTransformTester, self).__init__(parent)
        self.mainWin = mainWin
        self.parent = parent
        parentGeometry = re.match("(\d+)x(\d+)[+]?([-]?\d+)[+]?([-]?\d+)",
                                  parent.geometry())
        dialogX = int(parentGeometry.group(3))
        dialogY = int(parentGeometry.group(4))
        self.selectedGroup = None

        self.transient(self.parent)
        self.title(_("Transformation Tester"))

        frame = Frame(self)

        # setup tester
        xml = "<rootElement/>"
        self.modelXbrl = ModelXbrl.create(mainWin.modelManager,
                                          ModelDocument.Type.UnknownNonXML,
                                          initialXml=xml,
                                          isEntry=True)
        self.validator = ValidateXbrl.ValidateXbrl(self.modelXbrl)
        self.validator.validate(self.modelXbrl)  # required to set up
        mainWin.showStatus(_("Initializing Formula Grammar"))
        XPathParser.initializeParser(mainWin.modelManager)
        mainWin.showStatus(None)

        self.trRegs = sorted(ixtNamespaces.keys())
        self.trReg = self.trRegs[-1]  # default is latest
        self.trPrefixNSs = dict(
            (qn.prefix, qn.namespaceURI)
            for qn in self.modelXbrl.modelManager.customTransforms.keys())
        self.trRegs.extend(sorted(self.trPrefixNSs.keys()))
        self.trPrefixNSs.update(ixtNamespaces)
        self.trNames = self.getTrNames()

        # load grid
        trRegLabel = label(frame, 0, 0, _("Registry:"))
        self.trRegName = gridCombobox(
            frame,
            1,
            0,
            value=self.trReg,
            values=self.trRegs,
            comboboxselected=self.trRegComboBoxSelected)
        trRegToolTipMessage = _("Select Transformation Registry")
        ToolTip(self.trRegName, text=trRegToolTipMessage, wraplength=360)
        ToolTip(trRegLabel, text=trRegToolTipMessage, wraplength=360)

        trNameLabel = label(frame, 0, 1, _("Transform:"))
        self.trNameName = gridCombobox(
            frame,
            1,
            1,
            value="",
            values=self.trNames,
            comboboxselected=self.trNameComboBoxSelected)
        trRegToolTipMessage = _("Select or enter transform")
        ToolTip(self.trRegName, text=trRegToolTipMessage, wraplength=360)
        ToolTip(trRegLabel, text=trRegToolTipMessage, wraplength=360)

        sourceLabel = label(frame, 0, 2, _("Source text:"))
        ToolTip(sourceLabel,
                text=_("Enter the source text which is to be transformed. "),
                wraplength=240)
        self.sourceVar = StringVar()
        self.sourceVar.set("")
        sourceEntry = Entry(frame, textvariable=self.sourceVar, width=50)
        sourceLabel.grid(row=2, column=0, sticky=W)
        sourceEntry.grid(row=2, column=1, sticky=EW, pady=3, padx=3)

        resultLabel = label(frame, 1, 3, _("Result:"))
        ToolTip(sourceLabel, text=_("Transformation result. "), wraplength=240)
        self.resultVar = StringVar()
        self.resultVar.set("")
        resultEntry = Entry(frame, textvariable=self.resultVar, width=50)
        resultLabel.grid(row=3, column=0, sticky=W)
        resultEntry.grid(row=3, column=1, sticky=EW, pady=3, padx=3)

        mainWin.showStatus(None)

        btnPad = 2 if mainWin.isMSW else 0  # buttons too narrow on windows
        okButton = Button(frame,
                          text=_("Transform"),
                          width=8 + btnPad,
                          command=self.ok)
        cancelButton = Button(frame,
                              text=_("Done"),
                              width=4 + btnPad,
                              command=self.close)
        cancelButton.grid(row=4,
                          column=0,
                          sticky=E,
                          columnspan=2,
                          pady=3,
                          padx=3)
        okButton.grid(row=4, column=0, sticky=E, columnspan=2, pady=3, padx=64)
        ToolTip(okButton,
                text=_("Transform the source entered. "),
                wraplength=240)
        ToolTip(cancelButton, text=_("Close this dialog. "), wraplength=240)

        frame.grid(row=0, column=0, sticky=(N, S, E, W))
        frame.columnconfigure(1, weight=3)
        frame.columnconfigure(2, weight=1)
        window = self.winfo_toplevel()
        window.columnconfigure(0, weight=1)
        self.geometry("+{0}+{1}".format(dialogX + 150, 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)
Beispiel #21
0
    def __init__(self, mainWin, options, reportType, endDate):
        self.reportType = reportType
        self.mainWin = mainWin
        self.endDate = endDate
        parent = mainWin
        super(DialogCssfSaveOptions, 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.accountingVersionValues = ACCOUNTING_VERSION_VALUES
        if reportType == SCOREP_REPORT:
            self.accountingVersionValues = self.accountingVersionValues + ACCOUNTING_SUBSIDIARY

        self.transient(self.parent)
        self.title(_("Save As CSSF Options"))
        
        frame = Frame(self)

        label(frame, 1, 1, _("Entity type:"))
        self.cellEntityType = gridCombobox(frame, 2, 1, getattr(options,"entityType",""), values=COMPANY_TYPE_VALUES)
        ToolTip(self.cellEntityType, text=_("Select an entity type"), wraplength=240)
        label(frame, 1, 2, _("CSSF entity code:"))
        self.cellCssfCode = gridCell(frame, 2, 2, getattr(options,"cssfCode",""))
        ToolTip(self.cellCssfCode, text=_("Enter a CSSF entity code (up to {0} digits)").format(CSSF_CODE_LENGTH), wraplength=240)
        currentRow = 3
        if reportType.endswith(COREP_REPORT_SUFFIX):
            label(frame, 1, currentRow, _("Ratio type:"))
            defaultValue = getattr(options, "ratioType","")
            if defaultValue not in RATIO_TYPE_VALUES:
                defaultValue = RATIO_TYPE_VALUES[0]
            self.cellRatioType = gridCombobox(frame, 2, currentRow, defaultValue, values=RATIO_TYPE_VALUES)
            ToolTip(self.cellRatioType, text=_("Select how the ratios are computed"), wraplength=240)
            currentRow += 1
        if reportType[0] != CONSOLIDATED_REPORT_PREFIX:
            label(frame, 1, currentRow, _("Accounting version:"))
            defaultValue = getattr(options, "accountingVersion", "")
            if defaultValue not in self.accountingVersionValues:
                defaultValue = ACCOUNTING_VERSION_DEFAULT
            self.cellAccountingVersion = gridCombobox(frame, 2, currentRow, defaultValue, values=self.accountingVersionValues)
            ToolTip(self.cellAccountingVersion, text=_("Select the accounting version"), wraplength=240)
            currentRow += 1
        if reportType == FINREP_REPORT:
            label(frame, 1, currentRow, _("Figures type:"))
            self.cellFiguresType = gridCombobox(frame, 2, currentRow, getattr(options,"figuresType",""), values=FIGURES_TYPE_VALUES)
            ToolTip(self.cellFiguresType, text=_("Select a figures type"), wraplength=240)
            currentRow += 1

        cancelButton = Button(frame, text=_("Cancel"), width=8, command=self.close)
        ToolTip(cancelButton, text=_("Cancel operation, discarding changes and entries"))
        okButton = Button(frame, text=_("OK"), width=8, command=self.ok)
        ToolTip(okButton, text=_("Accept the options as entered above"))
        cancelButton.grid(row=currentRow, column=1, columnspan=3, sticky=E, pady=3, padx=3)
        okButton.grid(row=currentRow, column=1, columnspan=3, sticky=E, pady=3, padx=86)
        
        frame.grid(row=0, column=0, sticky=(N,S,E,W))
        frame.columnconfigure(2, weight=1)
        window = self.winfo_toplevel()
        window.columnconfigure(0, weight=1)
        self.geometry("+{0}+{1}".format(dialogX+50,dialogY+100))
        self.protocol("WM_DELETE_WINDOW", self.close)
        self.grab_set()
        self.wait_window(self)
Beispiel #22
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)
Beispiel #23
0
     def __init__(self, tester):
         self.tester = tester
         self.mainWin = tester.cntlr
 
         parent = self.mainWin.parent
         super(DialogTransformTester, self).__init__(parent)
         self.parent = parent
         parentGeometry = re.match("(\d+)x(\d+)[+]?([-]?\d+)[+]?([-]?\d+)", parent.geometry())
         dialogX = int(parentGeometry.group(3))
         dialogY = int(parentGeometry.group(4))
         self.selectedGroup = None
 
         self.transient(self.parent)
         self.title(_("Transformation Tester"))
         
         frame = Frame(self)
         
         # load grid
         trRegLabel = label(frame, 0, 0, _("Registry:"))
         trReg = self.tester.trRegs[-1] # default is latest
         self.trRegName = gridCombobox(frame, 1, 0, 
                                       value=trReg,
                                       values=self.tester.trRegs, 
                                       comboboxselected=self.dialogTrRegComboBoxSelected)
         trRegToolTipMessage = _("Select Transformation Registry")
         ToolTip(self.trRegName, text=trRegToolTipMessage, wraplength=360)
         ToolTip(trRegLabel, text=trRegToolTipMessage, wraplength=360)
         
         trNameLabel = label(frame, 0, 1, _("Transform:"))
         self.trNameName = gridCombobox(frame, 1, 1, 
                                       value="",
                                       values=self.tester.getTrNames(trReg), 
                                       comboboxselected=self.dialogTrNameComboBoxSelected)
         trRegToolTipMessage = _("Select or enter transform")
         ToolTip(self.trRegName, text=trRegToolTipMessage, wraplength=360)
         ToolTip(trRegLabel, text=trRegToolTipMessage, wraplength=360)
 
         sourceLabel = label(frame, 0, 2, _("Source text:"))
         ToolTip(sourceLabel, text=_("Enter the source text which is to be transformed. "), wraplength=240)
         self.sourceVar = StringVar()
         self.sourceVar.set("")
         sourceEntry = Entry(frame, textvariable=self.sourceVar, width=50)
         sourceLabel.grid(row=2, column=0, sticky=W)
         sourceEntry.grid(row=2, column=1, sticky=EW, pady=3, padx=3)
 
         resultLabel = label(frame, 1, 3, _("Result:"))
         ToolTip(sourceLabel, text=_("Transformation result. "), wraplength=240)
         self.resultVar = StringVar()
         self.resultVar.set("")
         resultEntry = Entry(frame, textvariable=self.resultVar, width=50)
         resultLabel.grid(row=3, column=0, sticky=W)
         resultEntry.grid(row=3, column=1, sticky=EW, pady=3, padx=3)
 
         
         self.mainWin.showStatus(None)
 
         btnPad = 2 if self.mainWin.isMSW else 0 # buttons too narrow on windows
         okButton = Button(frame, text=_("Transform"), width=8 + btnPad, command=self.dialogOk)
         cancelButton = Button(frame, text=_("Done"), width=4 + btnPad, command=self.dialogClose)
         cancelButton.grid(row=4, column=0, sticky=E, columnspan=2, pady=3, padx=3)
         okButton.grid(row=4, column=0, sticky=E, columnspan=2, pady=3, padx=64)
         ToolTip(okButton, text=_("Transform the source entered. "), wraplength=240)
         ToolTip(cancelButton, text=_("Close this dialog. "), wraplength=240)
         
         frame.grid(row=0, column=0, sticky=(N,S,E,W))
         frame.columnconfigure(1, weight=3)
         frame.columnconfigure(2, weight=1)
         window = self.winfo_toplevel()
         window.columnconfigure(0, weight=1)
         self.geometry("+{0}+{1}".format(dialogX+150,dialogY+100))
         
         #self.bind("<Return>", self.ok)
         #self.bind("<Escape>", self.close)
         
         self.protocol("WM_DELETE_WINDOW", self.dialogClose)
         self.grab_set()
         
         self.wait_window(self)
Beispiel #24
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:
                 isAbstract = (yStructuralNode.isAbstract or 
                               (yStructuralNode.childStructuralNodes and
                                not isinstance(yStructuralNode.definitionNode, (ModelClosedDefinitionNode, ModelEuAxisCoord))))
                 isNonAbstract = not isAbstract
                 isLabeled = yStructuralNode.isLabeled
                 label = yStructuralNode.header(lang=self.lang,
                                                returnGenLabel=isinstance(yStructuralNode.definitionNode, (ModelClosedDefinitionNode, ModelEuAxisCoord)))
                 nestRow, nextRow = self.yAxis(leftCol + isLabeled, row, yStructuralNode,  # nested items before totals
                                         childrenFirst, childrenFirst, False)
                 
                 topRow = row
                 if childrenFirst and isNonAbstract:
                     row = nextRow
                 if renderNow and isLabeled:
                     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
                     wraplength = (self.rowHdrColWidth[depth] if isAbstract else
                                   self.rowHdrWrapLength - sum(self.rowHdrColWidth[0:depth]))
                     if label != OPEN_ASPECT_ENTRY_SURROGATE:
                         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=wraplength,
                                 #minwidth=self.rowHdrColWidth[leftCol],
                                 minwidth=(16 if isNonAbstract and nextRow > topRow else None),
                                 objectId=yStructuralNode.objectId(),
                                 onClick=self.onClick)
                     else:
                         self.aspectEntryObjectIdsNode[yStructuralNode.aspectEntryObjectId] = yStructuralNode
                         self.aspectEntryObjectIdsCell[yStructuralNode.aspectEntryObjectId] = gridCombobox(
                                  self.gridRowHdr, leftCol, row, 
                                  values=self.aspectEntryValues(yStructuralNode),  
                                  width=int(max(wraplength/16, 5)), # width is in characters, not screen units
                                  objectId=yStructuralNode.aspectEntryObjectId)
                     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 + isLabeled, row, yStructuralNode, childrenFirst, renderNow, False) # render on this pass
         return (nestedBottomRow, row)
Beispiel #25
0
    def __init__(self, mainWin, modelXbrl):
        parent = mainWin.parent
        super(DialogArcroleGroup, self).__init__(parent)
        self.mainWin = mainWin
        self.parent = parent
        self.modelXbrl = modelXbrl
        parentGeometry = re.match("(\d+)x(\d+)[+]?([-]?\d+)[+]?([-]?\d+)", parent.geometry())
        dialogX = int(parentGeometry.group(3))
        dialogY = int(parentGeometry.group(4))
        self.selectedGroup = None

        self.transient(self.parent)
        self.title(_("Select Arcrole Group"))
        
        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
        groupLabel = label(frame, 1, 0, _("Group:"))
        self.arcroleGroups = mainWin.config.get("arcroleGroups", {})
        arcroleGroupSelected = self.mainWin.config.get("arcroleGroupSelected")
        if arcroleGroupSelected in self.arcroleGroups:
            arcroleGroup = self.arcroleGroups[arcroleGroupSelected]
        else:
            arcroleGroup = []
            arcroleGroupSelected = None
        self.groupName = gridCombobox(frame, 2, 0, 
                                      value=arcroleGroupSelected,
                                      values=sorted(self.arcroleGroups.keys()), 
                                      comboboxselected=self.comboBoxSelected)
        groupToolTipMessage = _("Select an existing arcrole group, or enter a name for a new arcrole group.  "
                                "If selecting an existing group, it can be edited, and changes will be saved in the config file.  "
                                "If nothing is changed for an existing group, the saved setting is not disturbed.  "
                                "Arcroles with checkboxes below are shown only for arcroles that have relationships in the loaded DTS, "
                                "but if an existing group is selected with more arcroles (that were not in the current DTS) then "
                                "the prior setting with not-present arcroles is preserved. ") 
        ToolTip(self.groupName, text=groupToolTipMessage, wraplength=360)
        ToolTip(groupLabel, text=groupToolTipMessage, wraplength=360)
        clearImage = PhotoImage(file=os.path.join(mainWin.imagesDir, "toolbarDelete.gif"))
        clearGroupNameButton = Button(frame, image=clearImage, width=12, command=self.clearGroupName)
        clearGroupNameButton.grid(row=0, column=3, sticky=W)
        ToolTip(clearGroupNameButton, text=_("Remove the currently selected arcrole group from the config file. "
                                             "After removing, you may select another arcrole, but must select 'OK' for the "
                                             "removal to be saved. "), 
                wraplength=240)
        arcrolesLabel = label(frame, 1, 1, _("Arcroles:"))
        ToolTip(arcrolesLabel, text=_("Shows all the arcroles that are present in this DTS. "), 
                wraplength=240)
        from arelle.ModelRelationshipSet import baseSetArcroles
        self.options = {}
        self.checkboxes = []
        y = 1
        for name, arcrole in baseSetArcroles(self.modelXbrl):
            if arcrole.startswith("http://"):
                self.options[arcrole] = arcrole in arcroleGroup
                self.checkboxes.append( 
                   checkbox(frame, 2, y, 
                            name[1:], 
                            arcrole, 
                            columnspan=2)
                )
                y += 1
        
        mainWin.showStatus(None)

        self.options[XbrlConst.arcroleGroupDetect] = XbrlConst.arcroleGroupDetect in arcroleGroup
        self.autoOpen = checkbox(frame, 1, y, _("detect"), XbrlConst.arcroleGroupDetect)
        self.autoOpen.grid(sticky=W, columnspan=2)
        self.checkboxes.append(self.autoOpen)
        ToolTip(self.autoOpen, text=_("If checked, this arcrole group will be detected if any arcrole of the group is present in a DTS, for example to open a treeview pane. "), 
                wraplength=240)
        okButton = Button(frame, text=_("OK"), width=8, command=self.ok)
        cancelButton = Button(frame, text=_("Cancel"), width=8, command=self.close)
        cancelButton.grid(row=y, column=1, sticky=E, columnspan=3, pady=3, padx=3)
        okButton.grid(row=y, column=1, sticky=E, columnspan=3, pady=3, padx=64)
        ToolTip(okButton, text=_("Open a treeview with named arcrole group and selected arcroles. "
                                 "If any changes were made to checkboxes or name, save in the config. "), 
                wraplength=240)
        ToolTip(cancelButton, text=_("Close this dialog, without saving arcrole group changes or opening a view pane. "), 
                wraplength=240)
        
        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)