本文整理汇总了Python中arelle.CntlrWinTooltip.ToolTip.configure方法的典型用法代码示例。如果您正苦于以下问题:Python ToolTip.configure方法的具体用法?Python ToolTip.configure怎么用?Python ToolTip.configure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arelle.CntlrWinTooltip.ToolTip
的用法示例。
在下文中一共展示了ToolTip.configure方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from arelle.CntlrWinTooltip import ToolTip [as 别名]
# 或者: from arelle.CntlrWinTooltip.ToolTip import configure [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 configure [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 configure [as 别名]
class DialogOpenArchive(Toplevel):
def __init__(self, mainWin, openType, filesource, filenames, title, colHeader):
parent = mainWin.parent
super().__init__(parent)
self.parent = parent
parentGeometry = re.match("(\d+)x(\d+)[+]?([-]?\d+)[+]?([-]?\d+)", parent.geometry())
dialogX = int(parentGeometry.group(3))
dialogY = int(parentGeometry.group(4))
self.accepted = False
self.transient(self.parent)
self.title(title)
frame = Frame(self)
treeFrame = Frame(frame, width=500)
vScrollbar = Scrollbar(treeFrame, orient=VERTICAL)
hScrollbar = Scrollbar(treeFrame, orient=HORIZONTAL)
self.treeView = Treeview(treeFrame, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set)
self.treeView.grid(row=0, column=0, sticky=(N, S, E, W))
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))
treeFrame.columnconfigure(0, weight=1)
treeFrame.rowconfigure(0, weight=1)
treeFrame.grid(row=0, column=0, columnspan=4, sticky=(N, S, E, W), padx=3, pady=3)
self.treeView.focus_set()
# set up treeView widget and tabbed pane
self.treeView.column("#0", width=500, anchor="w")
self.treeView.heading("#0", text=colHeader)
try:
self.isRss = filesource.isRss
if self.isRss:
self.treeView.column("#0", width=350, anchor="w")
self.treeView["columns"] = ("descr", "date", "instDoc")
self.treeView.column("descr", width=50, anchor="center", stretch=False)
self.treeView.heading("descr", text="Form")
self.treeView.column("date", width=170, anchor="w", stretch=False)
self.treeView.heading("date", text="Pub Date")
self.treeView.column("instDoc", width=200, anchor="w", stretch=False)
self.treeView.heading("instDoc", text="Instance Document")
except AttributeError:
self.isRss = False
mainWin.showStatus(_("loading archive {0}").format(filesource.url))
self.filesource = filesource
self.filenames = filenames
selection = filesource.selection
hasToolTip = False
loadedPaths = []
i = 0
selectedNode = None
for filename in self.filenames:
if isinstance(filename,tuple):
if self.isRss:
form, date, instDoc = filename[2:5]
filename = filename[0] # ignore tooltip
hasToolTip = True
if filename.endswith("/"):
filename = filename[:-1]
path = filename.split("/")
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)
#.........这里部分代码省略.........
示例4: DialogOpenArchive
# 需要导入模块: from arelle.CntlrWinTooltip import ToolTip [as 别名]
# 或者: from arelle.CntlrWinTooltip.ToolTip import configure [as 别名]
class DialogOpenArchive(Toplevel):
def __init__(self, mainWin, openType, filesource, filenames, title, colHeader, showAltViewButton=False):
parent = mainWin.parent
super(DialogOpenArchive, self).__init__(parent)
self.parent = parent
self.showAltViewButton = showAltViewButton
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)
frame = Frame(self)
treeFrame = Frame(frame, width=500)
vScrollbar = Scrollbar(treeFrame, orient=VERTICAL)
hScrollbar = Scrollbar(treeFrame, orient=HORIZONTAL)
self.treeView = Treeview(treeFrame, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set)
self.treeView.grid(row=0, column=0, sticky=(N, S, E, W))
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))
treeFrame.columnconfigure(0, weight=1)
treeFrame.rowconfigure(0, weight=1)
treeFrame.grid(row=0, column=0, columnspan=4, sticky=(N, S, E, W), padx=3, pady=3)
self.treeView.focus_set()
mainWin.showStatus(_("loading archive {0}").format(filesource.url))
self.filesource = filesource
self.filenames = filenames
self.selection = filesource.selection
self.hasToolTip = False
selectedNode = None
if openType == ENTRY_POINTS:
try:
metadataFiles = filesource.taxonomyPackageMetadataFiles
if len(metadataFiles) > 1:
raise IOError(_("Taxonomy package contained more than one metadata file: {0}.")
.format(', '.join(metadataFiles)))
metadataFile = metadataFiles[0]
metadata = filesource.file(filesource.url + os.sep + metadataFile)[0]
self.metadataFilePrefix = os.sep.join(os.path.split(metadataFile)[:-1])
if self.metadataFilePrefix:
self.metadataFilePrefix += os.sep
self.nameToUrls, self.remappings = 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
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)
if showAltViewButton:
self.altViewButton = Button(frame, command=self.showAltView)
self.altViewButton.grid(row=y, column=0, sticky=(S,W), pady=3, padx=3)
self.loadTreeView(openType, colHeader, title)
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 self.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 loadTreeView(self, openType, title, colHeader):
#.........这里部分代码省略.........
示例5: __init__
# 需要导入模块: from arelle.CntlrWinTooltip import ToolTip [as 别名]
# 或者: from arelle.CntlrWinTooltip.ToolTip import configure [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 configure [as 别名]
class DialogOpenTaxonomyPackage(Toplevel):
def __init__(self, mainWin, openType, filesource, filenames, title):
parent = mainWin.parent
super().__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.webUrl = None
self.transient(self.parent)
self.title(title)
frame = Frame(self)
treeFrame = Frame(frame, width=500)
vScrollbar = Scrollbar(treeFrame, orient=VERTICAL)
hScrollbar = Scrollbar(treeFrame, orient=HORIZONTAL)
self.treeView = Treeview(treeFrame, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set, columns=2)
self.treeView.grid(row=0, column=0, sticky=(N, S, E, W))
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))
treeFrame.columnconfigure(0, weight=1)
treeFrame.rowconfigure(0, weight=1)
treeFrame.grid(row=0, column=0, columnspan=4, sticky=(N, S, E, W), padx=3, pady=3)
self.treeView.focus_set()
# set up treeView widget and tabbed pane
self.treeView.column("#0", width=150, anchor="w")
self.treeView.heading("#0", text="Name")
self.treeView.column("#1", width=350, anchor="w")
self.treeView.heading("#1", text="URL")
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)
#.........这里部分代码省略.........
示例7: DialogOpenArchive
# 需要导入模块: from arelle.CntlrWinTooltip import ToolTip [as 别名]
# 或者: from arelle.CntlrWinTooltip.ToolTip import configure [as 别名]
class DialogOpenArchive(Toplevel):
def __init__(self, parent, openType, filesource, filenames, title, colHeader, showAltViewButton=False):
if isinstance(parent, Cntlr):
cntlr = parent
parent = parent.parent # parent is cntlrWinMain
else: # parent is a Toplevel dialog
cntlr = parent.cntlr
super(DialogOpenArchive, self).__init__(parent)
self.parent = parent
self.showAltViewButton = showAltViewButton
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)
frame = Frame(self)
treeFrame = Frame(frame, width=500)
vScrollbar = Scrollbar(treeFrame, orient=VERTICAL)
hScrollbar = Scrollbar(treeFrame, orient=HORIZONTAL)
self.treeView = Treeview(treeFrame, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set)
self.treeView.grid(row=0, column=0, sticky=(N, S, E, W))
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))
treeFrame.columnconfigure(0, weight=1)
treeFrame.rowconfigure(0, weight=1)
treeFrame.grid(row=0, column=0, columnspan=4, sticky=(N, S, E, W), padx=3, pady=3)
self.treeView.focus_set()
if openType not in (PLUGIN, PACKAGE):
cntlr.showStatus(_("loading archive {0}").format(filesource.url))
self.filesource = filesource
self.filenames = filenames
self.selection = filesource.selection
self.hasToolTip = False
selectedNode = None
if openType == ENTRY_POINTS:
try:
metadataFiles = filesource.taxonomyPackageMetadataFiles
''' take first for now
if len(metadataFiles) != 1:
raise IOError(_("Taxonomy package contained more than one metadata file: {0}.")
.format(', '.join(metadataFiles)))
'''
metadataFile = metadataFiles[0]
metadata = filesource.url + os.sep + metadataFile
self.metadataFilePrefix = os.sep.join(os.path.split(metadataFile)[:-1])
if self.metadataFilePrefix:
self.metadataFilePrefix += "/" # zip contents have /, never \ file seps
self.taxonomyPkgMetaInf = '{}/META-INF/'.format(
os.path.splitext(os.path.basename(filesource.url))[0])
self.taxonomyPackage = parsePackage(cntlr, filesource, metadata,
os.sep.join(os.path.split(metadata)[:-1]) + os.sep)
if self.taxonomyPackage["entryPoints"]:
# may have instance documents too
self.packageContainedInstances = []
packageContentTypeCounts = {}
for suffix in (".xhtml", ".htm", ".html"):
for potentialInstance in filesource.dir:
if potentialInstance.endswith(".xhtml"):
_type = "Inline Instance"
self.packageContainedInstances.append([potentialInstance, _type])
packageContentTypeCounts[potentialInstance] = packageContentTypeCounts.get(potentialInstance, 0) + 1
if self.packageContainedInstances:
break
if self.packageContainedInstances: # add sequences to any duplicated entry types
for _type, count in packageContentTypeCounts.items():
if count > 1:
_dupNo = 0
for i in range(len(self.packageContainedInstances)):
if self.packageContainedInstances[i][0] == _type:
_dupNo += 1
self.packageContainedInstances[i][0] = "{} {}".format(_type, _dupNo)
else:
# may be a catalog file with no entry oint names
openType = ARCHIVE # no entry points to show, just archive
self.showAltViewButton = False
except Exception as e:
self.close()
err = _("Failed to parse metadata; the underlying error was: {0}").format(e)
messagebox.showerror(_("Malformed taxonomy package"), err)
cntlr.addToLog(err)
return
if openType not in (PLUGIN, PACKAGE):
cntlr.showStatus(None)
if openType in (DISCLOSURE_SYSTEM, PLUGIN, PACKAGE):
y = 3
else:
#.........这里部分代码省略.........
示例8: __init__
# 需要导入模块: from arelle.CntlrWinTooltip import ToolTip [as 别名]
# 或者: from arelle.CntlrWinTooltip.ToolTip import configure [as 别名]
class ViewTree:
def __init__(self, modelXbrl, tabWin, tabTitle, hasToolTip=False, lang=None, editableColumns=[], valueChangedCallback=None):
self.tabWin = tabWin
self.viewFrame = Frame(tabWin)
self.viewFrame.view = self
self.viewFrame.grid(row=0, column=0, sticky=(N, S, E, W))
tabWin.add(self.viewFrame,text=tabTitle)
self.tabTitle = tabTitle # for error messages
vScrollbar = Scrollbar(self.viewFrame, orient=VERTICAL)
hScrollbar = Scrollbar(self.viewFrame, orient=HORIZONTAL)
self.isEbaTableIndex = False
if tabTitle.startswith('Tables'):
for pluginXbrlMethod in pluginClassMethods("CntlrWinMain.Modeling.LoadFilingIndicators"):
self.isEbaTableIndex = True
# for EBA and in case of table index, add a second column with the filing indicator
# (OK, it is not really sound to base this test on the title)
self.treeView = Treeview(self.viewFrame, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set, columns="Filing")
break
if not self.isEbaTableIndex:
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")
if modelXbrl.modelManager.cntlr.isMac or modelXbrl.modelManager.cntlr.isMSW:
highlightColor = "#%04x%04x%04x" % self.treeView.winfo_rgb("SystemHighlight")
else:
highlightColor = "#33339999ffff" # using MSW value for Unix/Linux which has no named colors
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.viewSelectionChange, '+')
self.treeView.bind("<1>", self.onViewClick, '+')
self.treeView.bind("<Double-1>", self.onDoubleClick, '+')
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
self.nameIsPrefixed = False
if modelXbrl:
modelXbrl.views.append(self)
if not lang:
self.lang = modelXbrl.modelManager.defaultLang
self.editableColumns = editableColumns
self.valueChangedCallback = valueChangedCallback
self.entryPopup = None
def refreshTitle(self):
tid = str(self.viewFrame)
text = "Tables (" + self.modelXbrl.getInstanceFilenameForView() + ")"
self.tabWin.tab(tid, text=text)
self.tabTitle = text
def clearTreeView(self):
self.treeViewSelection = ()
for node in self.treeView.get_children():
self.treeView.delete(node)
def viewSelectionChange(self, event=None):
for node in self.treeViewSelection:
self.removeSelection(node)
self.treeViewSelection = self.treeView.selection()
for node in self.treeViewSelection:
self.addSelection(node)
def removeSelection(self, node):
if self.treeView.exists(node):
priorTags = self.treeView.item(node)["tags"]
if priorTags:
newTags = tuple((i[9:] if i.startswith("selected-") else i) for i in priorTags)
self.treeView.item(node, tags=newTags)
def addSelection(self, node):
priorTags = self.treeView.item(node)["tags"]
if priorTags:
newTags = tuple(("selected-"+i if i in ['even', 'odd'] else i) for i in priorTags)
self.treeView.item(node, tags=newTags)
def onViewClick(self, *args):
#.........这里部分代码省略.........