예제 #1
0
def sphinxDialogRssWatchFileChoices(dialog, frame, row, options, cntlr, openFileImage, openDatabaseImage):
    from tkinter import PhotoImage, N, S, E, W
    try:
        from tkinter.ttk import Button
    except ImportError:
        from ttk import Button
    from arelle.CntlrWinTooltip import ToolTip
    from arelle.UiUtil import gridCell, label
    # add sphinx formulas to RSS dialog
    def chooseSphinxFiles():
        sphinxFilesList = cntlr.uiFileDialog("open",
                multiple=True,  # expect multiple sphinx files
                title=_("arelle - Select sphinx rules file"),
                initialdir=cntlr.config.setdefault("rssWatchSphinxRulesFilesDir","."),
                filetypes=[(_("Sphinx files .xsr"), "*.xsr"), (_("Sphinx archives .xrb"), "*.xrb")],
                defaultextension=".xsr")
        if sphinxFilesList:
            dialog.options["rssWatchSphinxRulesFilesDir"] = os.path.dirname(sphinxFilesList[0])
            sphinxFilesPipeSeparated = '|'.join(sphinxFilesList)
            dialog.options["sphinxRulesFiles"] = sphinxFilesPipeSeparated
            dialog.cellSphinxFiles.setValue(sphinxFilesPipeSeparated)
        else:  # deleted
            dialog.options.pop("sphinxRulesFiles", "")  # remove entry
    label(frame, 1, row, "Sphinx rules:")
    dialog.cellSphinxFiles = gridCell(frame,2, row, options.get("sphinxRulesFiles",""))
    ToolTip(dialog.cellSphinxFiles, text=_("Select a sphinx rules (file(s) or archive(s)) to to evaluate each filing.  "
                                           "The results are recorded in the log file.  "), wraplength=240)
    chooseFormulaFileButton = Button(frame, image=openFileImage, width=12, command=chooseSphinxFiles)
    chooseFormulaFileButton.grid(row=row, column=3, sticky=W)
예제 #2
0
def dialogRssWatchDBextender(dialog, frame, row, options, cntlr, openFileImage, openDatabaseImage):
    from tkinter import PhotoImage, N, S, E, W
    from tkinter.simpledialog import askstring
    from arelle.CntlrWinTooltip import ToolTip
    from arelle.UiUtil import gridCell, label
    try:
        from tkinter.ttk import Button
    except ImportError:
        from ttk import Button
        
    def enterConnectionString():
        from arelle.DialogUserPassword import askDatabase
        # (user, password, host, port, database)
        db = askDatabase(cntlr.parent, dialog.cellDBconnection.value.split(',') if dialog.cellDBconnection.value else None)
        if db:
            dbConnectionString = ','.join(db)
            dialog.options["xbrlDBconnection"] = dbConnectionString 
            dialog.cellDBconnection.setValue(dbConnectionString)
        else:  # deleted
            dialog.options.pop("xbrlDBconnection", "")  # remove entry
    label(frame, 1, row, "DB Connection:")
    dialog.cellDBconnection = gridCell(frame,2, row, options.get("xbrlDBconnection",""))
    ToolTip(dialog.cellDBconnection, text=_("Enter an XBRL Database (Postgres) connection string.  "
                                           "E.g., host,port,user,password,db[,timeout].  "), wraplength=240)
    enterDBconnectionButton = Button(frame, image=openDatabaseImage, width=12, command=enterConnectionString)
    enterDBconnectionButton.grid(row=row, column=3, sticky=W)
예제 #3
0
파일: __init__.py 프로젝트: Arelle/Arelle
def sphinxDialogRssWatchFileChoices(dialog, frame, row, options, cntlr, openFileImage, openDatabaseImage, *args, **kwargs):
    from tkinter import PhotoImage, N, S, E, W
    try:
        from tkinter.ttk import Button
    except ImportError:
        from ttk import Button
    from arelle.CntlrWinTooltip import ToolTip
    from arelle.UiUtil import gridCell, label
    # add sphinx formulas to RSS dialog
    def chooseSphinxFiles():
        sphinxFilesList = cntlr.uiFileDialog("open",
                multiple=True,  # expect multiple sphinx files
                title=_("arelle - Select sphinx rules file"),
                initialdir=cntlr.config.setdefault("rssWatchSphinxRulesFilesDir","."),
                filetypes=[(_("Sphinx files .xsr"), "*.xsr"), (_("Sphinx archives .xrb"), "*.xrb")],
                defaultextension=".xsr")
        if sphinxFilesList:
            dialog.options["rssWatchSphinxRulesFilesDir"] = os.path.dirname(sphinxFilesList[0])
            sphinxFilesPipeSeparated = '|'.join(sphinxFilesList)
            dialog.options["sphinxRulesFiles"] = sphinxFilesPipeSeparated
            dialog.cellSphinxFiles.setValue(sphinxFilesPipeSeparated)
        else:  # deleted
            dialog.options.pop("sphinxRulesFiles", "")  # remove entry
    label(frame, 1, row, "Sphinx rules:")
    dialog.cellSphinxFiles = gridCell(frame,2, row, options.get("sphinxRulesFiles",""))
    ToolTip(dialog.cellSphinxFiles, text=_("Select a sphinx rules (file(s) or archive(s)) to to evaluate each filing.  "
                                           "The results are recorded in the log file.  "), wraplength=240)
    chooseFormulaFileButton = Button(frame, image=openFileImage, width=12, command=chooseSphinxFiles)
    chooseFormulaFileButton.grid(row=row, column=3, sticky=W)
예제 #4
0
def xbrlDBdialogRssWatchDBconnection(dialog, frame, row, options, cntlr,
                                     openFileImage, openDatabaseImage):
    from tkinter import PhotoImage, N, S, E, W
    try:
        from tkinter.ttk import Button
        from tkinter.simpledialog import askstring
    except ImportError:
        from ttk import Button
    from arelle.CntlrWinTooltip import ToolTip
    from arelle.UiUtil import gridCell, label

    # add sphinx formulas to RSS dialog
    def enterConnectionString():
        from arelle.DialogUserPassword import askDatabase
        # (user, password, host, port, database)
        db = askDatabase(
            cntlr.parent,
            dialog.cellDBconnection.value.split(',')
            if dialog.cellDBconnection.value else None)
        if db:
            dbConnectionString = ','.join(db)
            dialog.options["xbrlDBconnection"] = dbConnectionString
            dialog.cellDBconnection.setValue(dbConnectionString)
        else:  # deleted
            dialog.options.pop("xbrlDBconnection", "")  # remove entry

    label(frame, 1, row, "DB Connection:")
    dialog.cellDBconnection = gridCell(frame, 2, row,
                                       options.get("xbrlDBconnection", ""))
    ToolTip(dialog.cellDBconnection,
            text=_("Enter an XBRL Database (Postgres) connection string.  "
                   "E.g., pg://dbuser:dbpassword@dbhost:port.  "),
            wraplength=240)
    enterDBconnectionButton = Button(frame,
                                     image=openDatabaseImage,
                                     width=12,
                                     command=enterConnectionString)
    enterDBconnectionButton.grid(row=row, column=3, sticky=W)
예제 #5
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)
예제 #6
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)
예제 #7
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()
예제 #8
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)

        # 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)
예제 #9
0
 def __init__(self, mainWin):
     super(DialogLanguage, self).__init__(mainWin.parent)
     self.mainWin = mainWin
     self.parent = mainWin.parent
     parentGeometry = re.match("(\d+)x(\d+)[+]?([-]?\d+)[+]?([-]?\d+)", self.parent.geometry())
     dialogX = int(parentGeometry.group(3))
     dialogY = int(parentGeometry.group(4))
     self.transient(self.parent)
     self.title(_("arelle - User Interface and Labels language code settings"))
     self.languageCodes = languageCodes()
     langs = (["System default language ({0})".format(mainWin.modelManager.defaultLang)] +
              sorted(self.languageCodes.keys() if self.mainWin.isMSW else
                     [k 
                      for avail in [availableLocales()] # unix/Mac locale -a supported locale codes
                      for k, v in self.languageCodes.items()
                      if v.partition(" ")[0] in avail]
                     ))
     self.uiLang = mainWin.config.get("userInterfaceLangOverride", "")
     if self.uiLang == "" or self.uiLang == mainWin.modelManager.defaultLang:
         self.uiLangIndex = 0
     else:
         self.uiLangIndex = None
         for i, langName in enumerate(langs):
             if i > 0 and self.uiLang in self.languageCodes[langName]:
                 self.uiLangIndex = i
                 break
     self.labelLang = mainWin.config.get("labelLangOverride", "")
     if self.labelLang == "" or self.labelLang == mainWin.modelManager.defaultLang:
         self.labelLangIndex = 0
     else:
         self.labelLangIndex = None
         for i, langName in enumerate(langs):
             if i > 0 and self.labelLang in self.languageCodes[langName]:
                 self.labelLangIndex = i
                 break
     
     frame = Frame(self)
     
     defaultLanguage = mainWin.modelManager.defaultLang
     for langName, langCodes in self.languageCodes.items():
         if mainWin.modelManager.defaultLang in langCodes:
             defaultLanguage += ", " + langName
             break
     gridHdr(frame, 0, 0, _(
              "The system default language is: {0} \n\n"
              "You may override with a different language for user interface language and locale settings, and for language of taxonomy linkbase labels to display. \n\n").format(
             defaultLanguage),
           columnspan=5, wraplength=400)
     label(frame, 0, 1, _("User Interface:"))
     self.cbUiLang = gridCombobox(frame, 1, 1, values=langs, selectindex=self.uiLangIndex, columnspan=4)
     label(frame, 0, 2, _("Labels:"))
     self.cbLabelLang = gridCombobox(frame, 1, 2, values=langs, selectindex=self.labelLangIndex, columnspan=4)
     self.cbUiLang.focus_set()
     okButton = Button(frame, text=_("OK"), command=self.ok)
     cancelButton = Button(frame, text=_("Cancel"), command=self.close)
     okButton.grid(row=3, column=2, sticky=E, pady=3)
     cancelButton.grid(row=3, column=3, columnspan=2, sticky=EW, pady=3, padx=3)
     frame.grid(row=0, column=0, sticky=(N,S,E,W))
     frame.columnconfigure(1, weight=1)
     window = self.winfo_toplevel()
     window.columnconfigure(0, weight=1)
     self.geometry("+{0}+{1}".format(dialogX+50,dialogY+100))
     
     self.bind("<Return>", self.ok)
     self.bind("<Escape>", self.close)
     
     self.protocol("WM_DELETE_WINDOW", self.close)
     self.grab_set()
     self.wait_window(self)
예제 #10
0
    def __init__(self, mainWin, options):
        parent = mainWin.parent
        super(DialogFormulaParameters, self).__init__(parent)
        self.parent = parent
        self.options = options
        parentGeometry = re.match("(\d+)x(\d+)[+]?([-]?\d+)[+]?([-]?\d+)", parent.geometry())
        dialogX = int(parentGeometry.group(3))
        dialogY = int(parentGeometry.group(4))
        self.accepted = False

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

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

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

        okButton = Button(frame, text=_("OK"), width=12, command=self.ok)
        cancelButton = Button(frame, text=_("Cancel"), width=12, command=self.close)
        okButton.grid(row=y, column=2, sticky=E, pady=3)
        cancelButton.grid(row=y, column=3, sticky=E, pady=3, padx=3)
        
        frame.grid(row=0, column=0, sticky=(N,S,E,W))
        frame.columnconfigure(1, weight=3)
        frame.columnconfigure(2, weight=1)
        frame.columnconfigure(3, weight=3)
        window = self.winfo_toplevel()
        window.columnconfigure(0, weight=1)
        self.geometry("+{0}+{1}".format(dialogX+50,dialogY+100))
        
        #self.bind("<Return>", self.ok)
        #self.bind("<Escape>", self.close)
        
        self.protocol("WM_DELETE_WINDOW", self.close)
        self.grab_set()
        self.wait_window(self)
예제 #11
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)
        frame.focus_set()

        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:")
        self.cellStartDate = gridCell(frame, 2, 3, getattr(options,"startDate",""))
        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:")
        self.cellEndDate = gridCell(frame, 2, 4, getattr(options,"endDate",""))
        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)
예제 #12
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)
예제 #13
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)
예제 #14
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)
예제 #15
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)
예제 #16
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:")
        self.cellStartDate = gridCell(frame, 2, 3,
                                      getattr(options, "startDate", ""))
        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:")
        self.cellEndDate = gridCell(frame, 2, 4,
                                    getattr(options, "endDate", ""))
        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)
예제 #17
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)
예제 #18
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()
예제 #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)