Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes
idlelib.TreeWidget.FileTreeItem Class Reference
Inheritance diagram for idlelib.TreeWidget.FileTreeItem:
Inheritance graph
[legend]
Collaboration diagram for idlelib.TreeWidget.FileTreeItem:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def GetText
def IsEditable
def SetText
def GetIconName
def IsExpandable
def GetSubList
def GetLabelText
def GetSelectedIconName
def OnDoubleClick

Public Attributes

 path

Static Public Attributes

 expandable = None

Detailed Description

Example TreeItem subclass -- browse the file system.

Definition at line 364 of file TreeWidget.py.


Constructor & Destructor Documentation

def idlelib.TreeWidget.FileTreeItem.__init__ (   self,
  path 
)
Example TreeItem subclass -- browse the file system.

Definition at line 368 of file TreeWidget.py.

00368 
00369     def __init__(self, path):
00370         self.path = path

Here is the caller graph for this function:


Member Function Documentation

Return name of icon to be displayed normally.

Reimplemented from idlelib.TreeWidget.TreeItem.

Definition at line 388 of file TreeWidget.py.

00388 
00389     def GetIconName(self):
00390         if not self.IsExpandable():
00391             return "python" # XXX wish there was a "file" icon

Here is the call graph for this function:

def idlelib.TreeWidget.TreeItem.GetLabelText (   self) [inherited]
Return label text string to display in front of text (if any).

Reimplemented in idlelib.StackViewer.VariablesTreeItem, and idlelib.ObjectBrowser.ObjectTreeItem.

Definition at line 319 of file TreeWidget.py.

00319 
00320     def GetLabelText(self):
00321         """Return label text string to display in front of text (if any)."""

Return name of icon to be displayed when selected.

Definition at line 352 of file TreeWidget.py.

00352 
00353     def GetSelectedIconName(self):
00354         """Return name of icon to be displayed when selected."""

Return list of items forming sublist.

Reimplemented from idlelib.TreeWidget.TreeItem.

Definition at line 395 of file TreeWidget.py.

00395 
00396     def GetSubList(self):
00397         try:
00398             names = os.listdir(self.path)
00399         except os.error:
00400             return []
00401         names.sort(key = os.path.normcase)
00402         sublist = []
00403         for name in names:
00404             item = FileTreeItem(os.path.join(self.path, name))
00405             sublist.append(item)
00406         return sublist
00407 
00408 
00409 # A canvas widget with scroll bars and some useful bindings

Return text string to display.

Reimplemented from idlelib.TreeWidget.TreeItem.

Definition at line 371 of file TreeWidget.py.

00371 
00372     def GetText(self):
00373         return os.path.basename(self.path) or self.path

Return whether the item's text may be edited.

Reimplemented from idlelib.TreeWidget.TreeItem.

Definition at line 374 of file TreeWidget.py.

00374 
00375     def IsEditable(self):
00376         return os.path.basename(self.path) != ""

Return whether there are subitems.

Reimplemented from idlelib.TreeWidget.TreeItem.

Definition at line 392 of file TreeWidget.py.

00392 
00393     def IsExpandable(self):
00394         return os.path.isdir(self.path)

def idlelib.TreeWidget.TreeItem.OnDoubleClick (   self) [inherited]
Called on a double-click on the item.

Reimplemented in idlelib.ClassBrowser.MethodBrowserTreeItem, idlelib.ClassBrowser.ClassBrowserTreeItem, idlelib.StackViewer.FrameTreeItem, and idlelib.ClassBrowser.ModuleBrowserTreeItem.

Definition at line 358 of file TreeWidget.py.

00358 
00359     def OnDoubleClick(self):
00360         """Called on a double-click on the item."""
00361 
00362 
00363 # Example application

def idlelib.TreeWidget.FileTreeItem.SetText (   self,
  text 
)
Change the item's text (if it is editable).

Reimplemented from idlelib.TreeWidget.TreeItem.

Definition at line 377 of file TreeWidget.py.

00377 
00378     def SetText(self, text):
00379         newpath = os.path.dirname(self.path)
00380         newpath = os.path.join(newpath, text)
00381         if os.path.dirname(newpath) != os.path.dirname(self.path):
00382             return
00383         try:
00384             os.rename(self.path, newpath)
00385             self.path = newpath
00386         except os.error:
00387             pass


Member Data Documentation

idlelib.TreeWidget.TreeItem.expandable = None [static, inherited]
Do not override!  Called by TreeNode.

Definition at line 322 of file TreeWidget.py.

Definition at line 369 of file TreeWidget.py.


The documentation for this class was generated from the following file: