def viewRenderedGrid(modelXbrl, tabWin, lang=None):
    modelXbrl.modelManager.showStatus(_("viewing rendering"))
    view = ViewRenderedGrid(modelXbrl, tabWin, lang)

    view.blockMenuEvents = 1

    menu = view.contextMenu()
    optionsMenu = Menu(view.viewFrame, tearoff=0)
    optionsMenu.add_command(
        label=_("New fact item options"),
        underline=0,
        command=lambda: getNewFactItemOptions(modelXbrl.modelManager.cntlr,
                                              view.newFactItemOptions))
    view.ignoreDimValidity.trace("w", view.viewReloadDueToMenuAction)
    optionsMenu.add_checkbutton(label=_("Ignore Dimensional Validity"),
                                underline=0,
                                variable=view.ignoreDimValidity,
                                onvalue=True,
                                offvalue=False)
    view.xAxisChildrenFirst.trace("w", view.viewReloadDueToMenuAction)
    optionsMenu.add_checkbutton(label=_("X-Axis Children First"),
                                underline=0,
                                variable=view.xAxisChildrenFirst,
                                onvalue=True,
                                offvalue=False)
    view.yAxisChildrenFirst.trace("w", view.viewReloadDueToMenuAction)
    optionsMenu.add_checkbutton(label=_("Y-Axis Children First"),
                                underline=0,
                                variable=view.yAxisChildrenFirst,
                                onvalue=True,
                                offvalue=False)
    menu.add_cascade(label=_("Options"), menu=optionsMenu, underline=0)
    view.tablesMenu = Menu(view.viewFrame, tearoff=0)
    menu.add_cascade(label=_("Tables"), menu=view.tablesMenu, underline=0)
    view.tablesMenuLength = 0
    view.menuAddLangs()
    saveMenu = Menu(view.viewFrame, tearoff=0)
    saveMenu.add_command(label=_("HTML file"),
                         underline=0,
                         command=lambda: view.modelXbrl.modelManager.cntlr.
                         fileSave(view=view, fileType="html"))
    saveMenu.add_command(label=_("XML infoset"),
                         underline=0,
                         command=lambda: view.modelXbrl.modelManager.cntlr.
                         fileSave(view=view, fileType="xml"))
    saveMenu.add_command(label=_("XBRL instance"),
                         underline=0,
                         command=view.saveInstance)
    menu.add_cascade(label=_("Save"), menu=saveMenu, underline=0)
    view.view()
    view.blockSelectEvent = 1
    view.blockViewModelObject = 0
    view.viewFrame.bind("<Enter>", view.cellEnter, '+')
    view.viewFrame.bind("<Leave>", view.cellLeave, '+')
    view.blockMenuEvents = 0
 def saveInstance(self):
     if not self.newFactItemOptions.entityIdentScheme:  # not initialized yet
         if not getNewFactItemOptions(self.modelXbrl.modelManager.cntlr, self.newFactItemOptions):
             return # new instance not set
     newFilename = None # only used when a new instance must be created
     if self.modelXbrl.modelDocument.type != ModelDocument.Type.INSTANCE:
         newFilename = self.modelXbrl.modelManager.cntlr.fileSave(view=self, fileType="xbrl")
         if not newFilename:
             return  # saving cancelled
     # continue saving in background
     thread = threading.Thread(target=lambda: self.backgroundSaveInstance(newFilename))
     thread.daemon = True
     thread.start()
Exemple #3
0
def getFactItemOptions(dts, cntlr):
    newFactItemOptions = None
    for view in dts.views:
        if isinstance(view, ViewRenderedGrid):
            if (not view.newFactItemOptions.entityIdentScheme
                    or  # not initialized yet
                    not view.newFactItemOptions.entityIdentValue or
                    not view.newFactItemOptions.monetaryUnit or
                    not view.newFactItemOptions.startDateDate or
                    not view.newFactItemOptions.endDateDate):
                if not getNewFactItemOptions(cntlr, view.newFactItemOptions):
                    return None
            newFactItemOptions = view.newFactItemOptions
            break
    return newFactItemOptions
Exemple #4
0
 def saveInstance(self):
     if not self.newFactItemOptions.entityIdentScheme:  # not initialized yet
         if not getNewFactItemOptions(self.modelXbrl.modelManager.cntlr,
                                      self.newFactItemOptions):
             return  # new instance not set
     newFilename = None  # only used when a new instance must be created
     if self.modelXbrl.modelDocument.type != ModelDocument.Type.INSTANCE:
         newFilename = self.modelXbrl.modelManager.cntlr.fileSave(
             view=self, fileType="xbrl")
         if not newFilename:
             return  # saving cancelled
     # continue saving in background
     thread = threading.Thread(
         target=lambda: self.backgroundSaveInstance(newFilename))
     thread.daemon = True
     thread.start()
def viewRenderedGrid(modelXbrl, tabWin, lang=None):
    modelXbrl.modelManager.showStatus(_("viewing rendering"))
    view = ViewRenderedGrid(modelXbrl, tabWin, lang)
        
    view.blockMenuEvents = 1

    menu = view.contextMenu()
    optionsMenu = Menu(view.viewFrame, tearoff=0)
    optionsMenu.add_command(label=_("New fact item options"), underline=0, command=lambda: getNewFactItemOptions(modelXbrl.modelManager.cntlr, view.newFactItemOptions))
    view.ignoreDimValidity.trace("w", view.viewReloadDueToMenuAction)
    optionsMenu.add_checkbutton(label=_("Ignore Dimensional Validity"), underline=0, variable=view.ignoreDimValidity, onvalue=True, offvalue=False)
    view.xAxisChildrenFirst.trace("w", view.viewReloadDueToMenuAction)
    optionsMenu.add_checkbutton(label=_("X-Axis Children First"), underline=0, variable=view.xAxisChildrenFirst, onvalue=True, offvalue=False)
    view.yAxisChildrenFirst.trace("w", view.viewReloadDueToMenuAction)
    optionsMenu.add_checkbutton(label=_("Y-Axis Children First"), underline=0, variable=view.yAxisChildrenFirst, onvalue=True, offvalue=False)
    menu.add_cascade(label=_("Options"), menu=optionsMenu, underline=0)
    view.tablesMenu = Menu(view.viewFrame, tearoff=0)
    menu.add_cascade(label=_("Tables"), menu=view.tablesMenu, underline=0)
    view.tablesMenuLength = 0
    view.menuAddLangs()
    saveMenu = Menu(view.viewFrame, tearoff=0)
    saveMenu.add_command(label=_("HTML file"), underline=0, command=lambda: view.modelXbrl.modelManager.cntlr.fileSave(view=view, fileType="html"))
    saveMenu.add_command(label=_("Table layout infoset"), underline=0, command=lambda: view.modelXbrl.modelManager.cntlr.fileSave(view=view, fileType="xml"))
    saveMenu.add_command(label=_("XBRL instance"), underline=0, command=view.saveInstance)
    menu.add_cascade(label=_("Save"), menu=saveMenu, underline=0)
    view.view()
    view.blockSelectEvent = 1
    view.blockViewModelObject = 0
    view.viewFrame.bind("<Enter>", view.cellEnter, '+')
    view.viewFrame.bind("<Leave>", view.cellLeave, '+')
    view.viewFrame.bind("<1>", view.onClick, '+')
    view.blockMenuEvents = 0