本文整理汇总了Python中arelle.CntlrWinTooltip.ToolTip._schedule方法的典型用法代码示例。如果您正苦于以下问题:Python ToolTip._schedule方法的具体用法?Python ToolTip._schedule怎么用?Python ToolTip._schedule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arelle.CntlrWinTooltip.ToolTip
的用法示例。
在下文中一共展示了ToolTip._schedule方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from arelle.CntlrWinTooltip import ToolTip [as 别名]
# 或者: from arelle.CntlrWinTooltip.ToolTip import _schedule [as 别名]
class ViewTree:
def __init__(self, modelXbrl, tabWin, tabTitle, hasToolTip=False, lang=None):
self.tabWin = tabWin
self.viewFrame = Frame(tabWin)
self.viewFrame.grid(row=0, column=0, sticky=(N, S, E, W))
tabWin.add(self.viewFrame,text=tabTitle)
vScrollbar = Scrollbar(self.viewFrame, orient=VERTICAL)
hScrollbar = Scrollbar(self.viewFrame, orient=HORIZONTAL)
self.treeView = Treeview(self.viewFrame, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set)
self.treeView.grid(row=0, column=0, sticky=(N, S, E, W))
self.treeView.tag_configure("ELR", background="#E0F0FF")
self.treeView.tag_configure("even", background="#F0F0F0")
self.treeView.tag_configure("odd", background="#FFFFFF")
highlightColor = "#%04x%04x%04x" % self.treeView.winfo_rgb("SystemHighlight")
self.treeView.tag_configure("selected-ELR", background=highlightColor)
self.treeView.tag_configure("selected-even", background=highlightColor)
self.treeView.tag_configure("selected-odd", background=highlightColor)
self.treeViewSelection = ()
self.treeView.bind("<<TreeviewSelect>>", self.treeViewSelectionChange, '+')
hScrollbar["command"] = self.treeView.xview
hScrollbar.grid(row=1, column=0, sticky=(E,W))
vScrollbar["command"] = self.treeView.yview
vScrollbar.grid(row=0, column=1, sticky=(N,S))
self.viewFrame.columnconfigure(0, weight=1)
self.viewFrame.rowconfigure(0, weight=1)
self.modelXbrl = modelXbrl
self.hasToolTip = hasToolTip
self.toolTipText = StringVar()
if hasToolTip:
self.treeView.bind("<Motion>", self.motion, '+')
self.treeView.bind("<Leave>", self.leave, '+')
self.toolTipText = StringVar()
self.toolTip = ToolTip(self.treeView,
textvariable=self.toolTipText,
wraplength=480,
follow_mouse=True,
state="disabled")
self.toolTipColId = None
self.toolTipRowId = None
self.modelXbrl = modelXbrl
self.lang = lang
self.labelrole = None
if modelXbrl:
modelXbrl.views.append(self)
if not lang:
self.lang = modelXbrl.modelManager.defaultLang
def treeViewSelectionChange(self, event=None):
for node in self.treeViewSelection:
priorTags = self.treeView.item(node)["tags"]
if priorTags:
priorBgTag = priorTags[0]
if priorBgTag.startswith("selected-"):
self.treeView.item(node, tags=(priorBgTag[9:],))
self.treeViewSelection = self.treeView.selection()
for node in self.treeViewSelection:
priorTags = self.treeView.item(node)["tags"]
if priorTags:
self.treeView.item(node, tags=("selected-" + priorTags[0],))
def close(self):
if self.modelXbrl:
self.tabWin.forget(self.viewFrame)
self.modelXbrl.views.remove(self)
self.modelXbrl = None
def leave(self, *args):
self.toolTipColId = None
self.toolTipRowId = None
def motion(self, *args):
tvColId = self.treeView.identify_column(args[0].x)
tvRowId = self.treeView.identify_row(args[0].y)
if tvColId != self.toolTipColId or tvRowId != self.toolTipRowId:
self.toolTipColId = tvColId
self.toolTipRowId = tvRowId
newValue = None
if tvRowId and len(tvRowId) > 0:
try:
col = int(tvColId[1:])
if col == 0:
newValue = self.treeView.item(tvRowId,"text")
else:
values = self.treeView.item(tvRowId,"values")
if col <= len(values):
newValue = values[col - 1]
except ValueError:
pass
self.setToolTip(newValue, tvColId)
def setToolTip(self, text, colId="#0"):
self.toolTip._hide()
if isinstance(text,str) and len(text) > 0:
width = self.treeView.column(colId,"width")
if len(text) * 8 > width or '\n' in text:
self.toolTipText.set(text)
self.toolTip.configure(state="normal")
self.toolTip._schedule()
else:
self.toolTipText.set("")
#.........这里部分代码省略.........
示例2: ViewList
# 需要导入模块: from arelle.CntlrWinTooltip import ToolTip [as 别名]
# 或者: from arelle.CntlrWinTooltip.ToolTip import _schedule [as 别名]
class ViewList():
def __init__(self, modelXbrl, tabWin, tabTitle, hasToolTip=False):
self.tabWin = tabWin
self.viewFrame = Frame(tabWin)
self.viewFrame.grid(row=0, column=0, sticky=(N, S, E, W))
tabWin.add(self.viewFrame,text=tabTitle)
xmlScrollbar = Scrollbar(self.viewFrame, orient=VERTICAL)
self.listBox = Listbox(self.viewFrame, yscrollcommand=xmlScrollbar.set)
self.listBox.grid(row=0, column=0, sticky=(N, S, E, W))
#self.listBox.focus_set()
self.listBox.bind("<Motion>", self.listBoxMotion, '+')
self.listBox.bind("<Leave>", self.listBoxLeave, '+')
xmlScrollbar["command"] = self.listBox.yview
xmlScrollbar.grid(row=0, column=1, sticky=(N,S))
self.viewFrame.columnconfigure(0, weight=1)
self.viewFrame.rowconfigure(0, weight=1)
self.listBoxToolTipText = StringVar()
if hasToolTip:
self.listBoxToolTip = ToolTip(self.listBox, textvariable=self.listBoxToolTipText, wraplength=480, follow_mouse=True, state="disabled")
self.listBoxRow = -9999999
self.modelXbrl = modelXbrl
if modelXbrl:
modelXbrl.views.append(self)
def close(self):
self.tabWin.forget(self.viewFrame)
self.modelXbrl.views.remove(self)
self.modelXbrl = None
def select(self):
self.tabWin.select(self.viewFrame)
def append(self, line):
self.listBox.insert(END, line)
def clear(self):
self.listBox.delete(0,END)
def listBoxLeave(self, *args):
self.listBoxRow = -9999999
def lines(self):
return self.listBox.get(0,END)
def lineText(self, lineNumber):
return self.listBox.get(lineNumber)
def selectLine(self, lineNumber):
self.listBox.selection_clear(0,END)
self.listBox.selection_set(lineNumber)
def saveToFile(self, filename):
with open(filename, "w") as fh:
fh.writelines([logEntry + '\n' for logEntry in self.listBox.get(0,END)])
def copyToClipboard(self, cntlr=None, *ignore):
if cntlr is None: cntlr = self.modelXbrl.modelManager.cntlr
cntlr.clipboardData(text='\n'.join(self.listBox.get(0,END)))
def listBoxMotion(self, *args):
lbRow = self.listBox.nearest(args[0].y)
if lbRow != self.listBoxRow:
self.listBoxRow = lbRow
text = self.listBox.get(lbRow)
self.listBoxToolTip._hide()
if text and len(text) > 0:
if len(text) * 8 > 200:
self.listBoxToolTipText.set(text)
self.listBoxToolTip.configure(state="normal")
self.listBoxToolTip._schedule()
else:
self.listBoxToolTipText.set("")
self.listBoxToolTip.configure(state="disabled")
else:
self.listBoxToolTipText.set("")
self.listBoxToolTip.configure(state="disabled")
def contextMenu(self,contextMenuClick=None):
try:
return self.menu
except AttributeError:
if contextMenuClick is None: contextMenuClick = self.modelXbrl.modelManager.cntlr.contextMenuClick
self.menu = Menu( self.viewFrame, tearoff = 0 )
self.listBox.bind( contextMenuClick, self.popUpMenu )
return self.menu
def popUpMenu(self, event):
self.menu.post( event.x_root, event.y_root )
def menuAddSaveClipboard(self):
self.menu.add_command(label=_("Save to file"), underline=0, command=self.modelXbrl.modelManager.cntlr.fileSave)
if self.modelXbrl.modelManager.cntlr.hasClipboard:
self.menu.add_command(label=_("Copy to clipboard"), underline=0, command=self.copyToClipboard)
示例3: DialogOpenArchive
# 需要导入模块: from arelle.CntlrWinTooltip import ToolTip [as 别名]
# 或者: from arelle.CntlrWinTooltip.ToolTip import _schedule [as 别名]
#.........这里部分代码省略.........
if not self.isRss and len(path) > 1 and path[:-1] in loadedPaths:
parent = "file{0}".format(loadedPaths.index(path[:-1]))
else:
parent = ""
node = self.treeView.insert(parent, "end", "file{0}".format(i), text=path[-1])
if self.isRss:
self.treeView.set(node, "descr", form)
self.treeView.set(node, "date", date)
self.treeView.set(node, "instDoc", os.path.basename(instDoc))
if selection == filename:
selectedNode = node
loadedPaths.append(path)
i += 1
if selectedNode:
self.treeView.see(selectedNode)
self.treeView.selection_set(selectedNode)
mainWin.showStatus(None)
if openType == DISCLOSURE_SYSTEM:
y = 3
else:
y = 1
okButton = Button(frame, text=_("OK"), command=self.ok)
cancelButton = Button(frame, text=_("Cancel"), command=self.close)
okButton.grid(row=y, column=2, sticky=(S,E,W), pady=3)
cancelButton.grid(row=y, column=3, sticky=(S,E,W), pady=3, padx=3)
frame.grid(row=0, column=0, sticky=(N,S,E,W))
frame.columnconfigure(0, 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.toolTipText = StringVar()
if hasToolTip:
self.treeView.bind("<Motion>", self.motion, '+')
self.treeView.bind("<Leave>", self.leave, '+')
self.toolTipText = StringVar()
self.toolTip = ToolTip(self.treeView,
textvariable=self.toolTipText,
wraplength=640,
follow_mouse=True,
state="disabled")
self.toolTipRowId = None
self.protocol("WM_DELETE_WINDOW", self.close)
self.grab_set()
self.wait_window(self)
def ok(self, event=None):
selection = self.treeView.selection()
if len(selection) > 0:
filename = self.filenames[int(selection[0][4:])]
if isinstance(filename,tuple):
if self.isRss:
filename = filename[4]
else:
filename = filename[0]
if not filename.endswith("/"):
self.filesource.select(filename)
self.accepted = True
self.close()
def close(self, event=None):
self.parent.focus_set()
self.destroy()
def leave(self, *args):
self.toolTipRowId = None
def motion(self, *args):
tvRowId = self.treeView.identify_row(args[0].y)
if tvRowId != self.toolTipRowId:
self.toolTipRowId = tvRowId
newFileIndex = -1
if tvRowId and len(tvRowId) > 4:
try:
newFileIndex = int(tvRowId[4:])
except ValueError:
pass
self.setToolTip(newFileIndex)
def setToolTip(self, fileIndex):
self.toolTip._hide()
if fileIndex >= 0 and fileIndex < len(self.filenames):
filenameItem = self.filenames[fileIndex]
if isinstance(filenameItem, tuple):
self.toolTipText.set(filenameItem[1].replace("\\n","\n"))
self.toolTip.configure(state="normal")
self.toolTip._schedule()
else:
self.toolTipText.set("")
self.toolTip.configure(state="disabled")
else:
self.toolTipText.set("")
self.toolTip.configure(state="disabled")
示例4: DialogOpenArchive
# 需要导入模块: from arelle.CntlrWinTooltip import ToolTip [as 别名]
# 或者: from arelle.CntlrWinTooltip.ToolTip import _schedule [as 别名]
#.........这里部分代码省略.........
self.treeView.heading("#0", text="Name")
self.treeView["columns"] = ("url",)
self.treeView.column("url", width=350, anchor="w")
self.treeView.heading("url", text="URL")
for name, urls in self.nameToUrls.items():
displayUrl = urls[1] # display the canonical URL
self.treeView.insert("", "end", name, values=[displayUrl], text=name)
self.hasToolTip = True
else: # unknown openType
return None
if selectedNode:
self.treeView.see(selectedNode)
self.treeView.selection_set(selectedNode)
if self.showAltViewButton:
self.altViewButton.config(text=_("Show Files") if openType == ENTRY_POINTS else _("Show Entries"))
def ok(self, event=None):
selection = self.treeView.selection()
if len(selection) > 0:
if self.openType in (ARCHIVE, DISCLOSURE_SYSTEM):
filename = self.filenames[int(selection[0][4:])]
if isinstance(filename,tuple):
if self.isRss:
filename = filename[4]
else:
filename = filename[0]
if not filename.endswith("/"):
self.filesource.select(filename)
self.accepted = True
self.close()
elif self.openType == ENTRY_POINTS:
epName = selection[0]
#index 0 is the remapped Url, as opposed to the canonical one used for display
urlOrFile = self.nameToUrls[epName][0]
# load file source remappings
self.filesource.mappedPaths = \
dict((prefix,
remapping if isHttpUrl(remapping)
else (self.filesource.baseurl + os.sep + self.metadataFilePrefix +remapping.replace("/", os.sep)))
for prefix, remapping in self.remappings.items())
if not urlOrFile.endswith("/"):
# check if it's an absolute URL rather than a path into the archive
if isHttpUrl(urlOrFile):
self.filesource.select(urlOrFile) # absolute path selection
else:
# assume it's a path inside the archive:
self.filesource.select(self.metadataFilePrefix + urlOrFile)
self.accepted = True
self.close()
def close(self, event=None):
self.parent.focus_set()
self.destroy()
def showAltView(self, event=None):
if self.openType == ENTRY_POINTS:
self.loadTreeView(ARCHIVE, _("Select Entry Point"), _("File"))
else:
self.loadTreeView(ENTRY_POINTS, _("Select Archive File"), _("File"))
def leave(self, *args):
self.toolTipRowId = None
def motion(self, *args):
tvRowId = self.treeView.identify_row(args[0].y)
if tvRowId != self.toolTipRowId:
text = None
if self.openType in (ARCHIVE, DISCLOSURE_SYSTEM):
self.toolTipRowId = tvRowId
if tvRowId and len(tvRowId) > 4:
try:
text = self.filenames[ int(tvRowId[4:]) ]
if isinstance(text, tuple):
text = text[1].replace("\\n","\n")
except (KeyError, ValueError):
pass
elif self.openType == ENTRY_POINTS:
try:
epUrl = self.nameToUrls[tvRowId][1]
text = "{0}\n{1}".format(tvRowId, epUrl)
except KeyError:
pass
self.setToolTip(text)
def setToolTip(self, text):
self.toolTip._hide()
if text:
self.toolTipText.set(text)
self.toolTip.configure(state="normal")
self.toolTip._schedule()
else:
self.toolTipText.set("")
self.toolTip.configure(state="disabled")
示例5: __init__
# 需要导入模块: from arelle.CntlrWinTooltip import ToolTip [as 别名]
# 或者: from arelle.CntlrWinTooltip.ToolTip import _schedule [as 别名]
class ViewGrid:
def __init__(self, modelXbrl, tabWin, tabTitle, hasToolTip=False, lang=None):
self.tabWin = tabWin
#self.viewFrame = Frame(tabWin)
#self.viewFrame.grid(row=0, column=0, sticky=(N, S, E, W))
'''
paneWin = PanedWindow(self.viewFrame, orient=VERTICAL)
paneWin.grid(row=1, column=0, sticky=(N, S, E, W))
self.zGrid = scrollgrid(paneWin)
self.zGrid.grid(row=0, column=0, sticky=(N, S, E, W))
self.xyGrid = scrollgrid(paneWin)
self.xyGrid.grid(row=1, column=0, sticky=(N, S, E, W))
'''
'''
self.gridBody = scrollgrid(self.viewFrame)
self.gridBody.grid(row=0, column=0, sticky=(N, S, E, W))
'''
self.viewFrame = scrolledHeaderedFrame(tabWin)
self.gridTblHdr = self.viewFrame.tblHdrInterior
self.gridColHdr = self.viewFrame.colHdrInterior
self.gridRowHdr = self.viewFrame.rowHdrInterior
self.gridBody = self.viewFrame.bodyInterior
'''
self.viewFrame = scrolledFrame(tabWin)
self.gridTblHdr = self.gridRowHdr = self.gridColHdr = self.gridBody = self.viewFrame.interior
'''
tabWin.add(self.viewFrame,text=tabTitle)
self.modelXbrl = modelXbrl
self.hasToolTip = hasToolTip
self.toolTipText = StringVar()
if hasToolTip:
self.gridBody.bind("<Motion>", self.motion, '+')
self.gridBody.bind("<Leave>", self.leave, '+')
self.toolTipText = StringVar()
self.toolTip = ToolTip(self.gridBody,
textvariable=self.toolTipText,
wraplength=480,
follow_mouse=True,
state="disabled")
self.toolTipColId = None
self.toolTipRowId = None
self.modelXbrl = modelXbrl
self.contextMenuClick = self.modelXbrl.modelManager.cntlr.contextMenuClick
self.gridTblHdr.contextMenuClick = self.contextMenuClick
self.gridColHdr.contextMenuClick = self.contextMenuClick
self.gridRowHdr.contextMenuClick = self.contextMenuClick
self.gridBody.contextMenuClick = self.contextMenuClick
self.lang = lang
if modelXbrl:
modelXbrl.views.append(self)
if not lang:
self.lang = modelXbrl.modelManager.defaultLang
def close(self):
self.tabWin.forget(self.viewFrame)
self.modelXbrl.views.remove(self)
self.modelXbrl = None
def leave(self, *args):
self.toolTipColId = None
self.toolTipRowId = None
def motion(self, *args):
'''
tvColId = self.gridBody.identify_column(args[0].x)
tvRowId = self.gridBody.identify_row(args[0].y)
if tvColId != self.toolTipColId or tvRowId != self.toolTipRowId:
self.toolTipColId = tvColId
self.toolTipRowId = tvRowId
newValue = None
if tvRowId and len(tvRowId) > 0:
try:
col = int(tvColId[1:])
if col == 0:
newValue = self.gridBody.item(tvRowId,"text")
else:
values = self.gridBody.item(tvRowId,"values")
if col <= len(values):
newValue = values[col - 1]
except ValueError:
pass
self.setToolTip(newValue, tvColId)
'''
def setToolTip(self, text, colId="#0"):
self.toolTip._hide()
if isinstance(text,str) and len(text) > 0:
width = self.gridBody.column(colId,"width")
if len(text) * 8 > width or '\n' in text:
self.toolTipText.set(text)
self.toolTip.configure(state="normal")
self.toolTip._schedule()
else:
self.toolTipText.set("")
self.toolTip.configure(state="disabled")
else:
self.toolTipText.set("")
self.toolTip.configure(state="disabled")
#.........这里部分代码省略.........
示例6: DialogOpenTaxonomyPackage
# 需要导入模块: from arelle.CntlrWinTooltip import ToolTip [as 别名]
# 或者: from arelle.CntlrWinTooltip.ToolTip import _schedule [as 别名]
#.........这里部分代码省略.........
mainWin.showStatus(_("loading archive {0}").format(filesource.url))
self.filesource = filesource
self.filenames = filenames
selectedNode = None
metadata = filesource.file(filesource.url + os.sep + TAXONOMY_PACKAGE_FILE_NAME)[0]
try:
self.nameToUrls = parseTxmyPkg(mainWin, metadata)
except Exception as e:
self.close()
err = _("Failed to parse metadata; the underlying error was: {0}").format(e)
messagebox.showerror(_("Malformed taxonomy package"), err)
mainWin.addToLog(err)
return
for name, urls in self.nameToUrls.items():
displayUrl = urls[1] # display the canonical URL
self.treeView.insert("", "end", name, values=[displayUrl], text=name)
if selectedNode:
self.treeView.see(selectedNode)
self.treeView.selection_set(selectedNode)
mainWin.showStatus(None)
if openType == DISCLOSURE_SYSTEM:
y = 3
else:
y = 1
okButton = Button(frame, text=_("OK"), command=self.ok)
cancelButton = Button(frame, text=_("Cancel"), command=self.close)
okButton.grid(row=y, column=2, sticky=(S, E, W), pady=3)
cancelButton.grid(row=y, column=3, sticky=(S, E, W), pady=3, padx=3)
frame.grid(row=0, column=0, sticky=(N, S, E, W))
frame.columnconfigure(0, 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.toolTipText = StringVar()
self.treeView.bind("<Motion>", self.motion, '+')
self.treeView.bind("<Leave>", self.leave, '+')
self.toolTipText = StringVar()
self.toolTip = ToolTip(self.treeView,
textvariable=self.toolTipText,
wraplength=640,
follow_mouse=True,
state="disabled")
self.toolTipEpName = None
self.protocol("WM_DELETE_WINDOW", self.close)
self.grab_set()
self.wait_window(self)
def ok(self, event=None):
selection = self.treeView.selection()
if len(selection) > 0:
epName = selection[0]
#index 0 is the remapped Url, as opposed to the canonical one used for display
urlOrFile = self.nameToUrls[epName][0]
if not urlOrFile.endswith("/"):
# check if it's an absolute URL rather than a path into the archive
if urlOrFile.startswith("http://") or urlOrFile.startswith("https://"):
self.webUrl = urlOrFile
else:
# assume it's a path inside the archive:
self.filesource.select(urlOrFile)
self.accepted = True
self.close()
def close(self, event=None):
self.parent.focus_set()
self.destroy()
def leave(self, *args):
self.toolTipRowId = None
def motion(self, *args):
epName = self.treeView.identify_row(args[0].y)
if epName != self.toolTipEpName:
self.toolTipEpName = epName
try:
epUrl = self.nameToUrls[epName][1]
except KeyError:
epUrl = None
self.toolTip._hide()
if epName and epUrl:
self.toolTipText.set("{0}\n{1}".format(epName, epUrl))
self.toolTip.configure(state="normal")
self.toolTip._schedule()
else:
self.toolTipText.set("")
self.toolTip.configure(state="disabled")
示例7: DialogOpenArchive
# 需要导入模块: from arelle.CntlrWinTooltip import ToolTip [as 别名]
# 或者: from arelle.CntlrWinTooltip.ToolTip import _schedule [as 别名]
#.........这里部分代码省略.........
if len(selection) > 0:
if hasattr(self, "taxonomyPackage"):
# load file source remappings
self.filesource.mappedPaths = self.taxonomyPackage["remappings"]
filename = None
if self.openType in (ARCHIVE, DISCLOSURE_SYSTEM):
filename = self.filenames[int(selection[0][4:])]
if isinstance(filename,tuple):
if self.isRss:
filename = filename[4]
else:
filename = filename[0]
elif self.openType == ENTRY_POINTS:
epName = selection[0]
#index 0 is the remapped Url, as opposed to the canonical one used for display
# Greg Acsone reports [0] does not work for Corep 1.6 pkgs, need [1], old style packages
filenames = []
for _url, _type in self.packageContainedInstances: # check if selection was an inline instance
if _type == epName:
filenames.append(_url)
if not filenames: # else if it's a named taxonomy entry point
for url in self.taxonomyPackage["entryPoints"][epName]:
filename = url[0]
if not filename.endswith("/"):
# check if it's an absolute URL rather than a path into the archive
if not isHttpUrl(filename) and self.metadataFilePrefix != self.taxonomyPkgMetaInf:
# assume it's a path inside the archive:
filename = self.metadataFilePrefix + filename
filenames.append(filename)
if filenames:
self.filesource.select(filenames)
self.accepted = True
self.close()
return
elif self.openType in (PLUGIN, PACKAGE):
filename = self.filenames[int(selection[0][4:])][2]
if filename is not None and not filename.endswith("/"):
if hasattr(self, "taxonomyPackage"):
# attempt to unmap the filename to original file
# will be mapped again in loading, but this allows schemaLocation to be unmapped
for prefix, remapping in self.taxonomyPackage["remappings"].items():
if isHttpUrl(remapping):
remapStart = remapping
else:
remapStart = self.metadataFilePrefix + remapping
if filename.startswith(remapStart):
# set unmmapped file
filename = prefix + filename[len(remapStart):]
break
if self.openType in (PLUGIN, PACKAGE):
self.filesource.selection = filename
else:
self.filesource.select(filename)
self.accepted = True
self.close()
def close(self, event=None):
self.parent.focus_set()
self.destroy()
def showAltView(self, event=None):
if self.openType == ENTRY_POINTS:
self.loadTreeView(ARCHIVE, _("Select Entry Point"), _("File"))
else:
self.loadTreeView(ENTRY_POINTS, _("Select Archive File"), _("File"))
def leave(self, *args):
self.toolTipRowId = None
def motion(self, *args):
tvRowId = self.treeView.identify_row(args[0].y)
if tvRowId != self.toolTipRowId:
text = None
if self.openType in (ARCHIVE, DISCLOSURE_SYSTEM, PLUGIN, PACKAGE):
self.toolTipRowId = tvRowId
if tvRowId and len(tvRowId) > 4:
try:
text = self.filenames[ int(tvRowId[4:]) ]
if isinstance(text, tuple):
text = (text[1] or "").replace("\\n","\n")
except (KeyError, ValueError):
pass
elif self.openType == ENTRY_POINTS:
try:
text = "{0}\n{1}".format(tvRowId,
"\n".join(url[1] for url in self.taxonomyPackage["entryPoints"][tvRowId]))
except KeyError:
pass
self.setToolTip(text)
def setToolTip(self, text):
self.toolTip._hide()
if text:
self.toolTipText.set(text)
self.toolTip.configure(state="normal")
self.toolTip._schedule()
else:
self.toolTipText.set("")
self.toolTip.configure(state="disabled")
示例8: __init__
# 需要导入模块: from arelle.CntlrWinTooltip import ToolTip [as 别名]
# 或者: from arelle.CntlrWinTooltip.ToolTip import _schedule [as 别名]
#.........这里部分代码省略.........
self.toolTipColId = None
self.toolTipRowId = None
def motion(self, *args):
tvColId = self.treeView.identify_column(args[0].x)
tvRowId = self.treeView.identify_row(args[0].y)
if tvColId != self.toolTipColId or tvRowId != self.toolTipRowId:
self.toolTipColId = tvColId
self.toolTipRowId = tvRowId
newValue = self.getToolTip(tvRowId, tvColId)
if newValue is None and tvRowId and len(tvRowId) > 0:
try:
col = int(tvColId[1:])
if col == 0:
newValue = self.treeView.item(tvRowId,"text")
else:
values = self.treeView.item(tvRowId,"values")
if col <= len(values):
newValue = values[col - 1]
except ValueError:
pass
self.setToolTip(newValue, tvColId)
def getToolTip(self, rowId, colId):
return None
def setToolTip(self, text, colId="#0"):
self.toolTip._hide()
if isinstance(text,str) and len(text) > 0:
width = self.treeView.column(colId,"width")
if len(text) * 8 > width or '\n' in text:
self.toolTipText.set(text)
self.toolTip.configure(state="normal")
self.toolTip._schedule()
else:
self.toolTipText.set("")
self.toolTip.configure(state="disabled")
else:
self.toolTipText.set("")
self.toolTip.configure(state="disabled")
def contextMenu(self):
try:
return self.menu
except AttributeError:
try:
self.menu = Menu( self.viewFrame, tearoff = 0 )
self.treeView.bind( self.modelXbrl.modelManager.cntlr.contextMenuClick, self.popUpMenu, '+' )
return self.menu
except Exception as ex: # tkinter menu problem maybe
self.modelXbrl.info("arelle:internalException",
_("Exception creating context menu in %(title)s: %(error)s"),
modelObject=self.modelXbrl.modelDocument, title=self.tabTitle, error=str(ex))
self.menu = None
return None
def popUpMenu(self, event):
if self.menu:
self.menuRow = self.treeView.identify_row(event.y)
self.menuCol = self.treeView.identify_column(event.x)
self.menu.post( event.x_root, event.y_root )
def expand(self):
self.setTreeItemOpen(self.menuRow,open=True)
def setFiling(self, filingIndicator):