Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes
idlelib.Debugger.NamespaceViewer Class Reference

List of all members.

Public Member Functions

def __init__
def load_dict
def close

Public Attributes

 master
 title
 repr
 frame
 label
 vbar
 canvas
 subframe
 sfid
 dict
 Because of (temporary) limitations on the dict_keys type (not yet public or pickleable), have the subprocess to send a list of keys, not a dict_keys object.

Static Public Attributes

int dict = 1

Detailed Description

Definition at line 406 of file Debugger.py.


Constructor & Destructor Documentation

def idlelib.Debugger.NamespaceViewer.__init__ (   self,
  master,
  title,
  dict = None 
)

Definition at line 408 of file Debugger.py.

00408 
00409     def __init__(self, master, title, dict=None):
00410         width = 0
00411         height = 40
00412         if dict:
00413             height = 20*len(dict) # XXX 20 == observed height of Entry widget
00414         self.master = master
00415         self.title = title
00416         import reprlib
00417         self.repr = reprlib.Repr()
00418         self.repr.maxstring = 60
00419         self.repr.maxother = 60
00420         self.frame = frame = Frame(master)
00421         self.frame.pack(expand=1, fill="both")
00422         self.label = Label(frame, text=title, borderwidth=2, relief="groove")
00423         self.label.pack(fill="x")
00424         self.vbar = vbar = Scrollbar(frame, name="vbar")
00425         vbar.pack(side="right", fill="y")
00426         self.canvas = canvas = Canvas(frame,
00427                                       height=min(300, max(40, height)),
00428                                       scrollregion=(0, 0, width, height))
00429         canvas.pack(side="left", fill="both", expand=1)
00430         vbar["command"] = canvas.yview
00431         canvas["yscrollcommand"] = vbar.set
00432         self.subframe = subframe = Frame(canvas)
00433         self.sfid = canvas.create_window(0, 0, window=subframe, anchor="nw")
00434         self.load_dict(dict)

Here is the caller graph for this function:


Member Function Documentation

Definition at line 491 of file Debugger.py.

00491 
00492     def close(self):
00493         self.frame.destroy()

Here is the caller graph for this function:

def idlelib.Debugger.NamespaceViewer.load_dict (   self,
  dict,
  force = 0,
  rpc_client = None 
)

Definition at line 437 of file Debugger.py.

00437 
00438     def load_dict(self, dict, force=0, rpc_client=None):
00439         if dict is self.dict and not force:
00440             return
00441         subframe = self.subframe
00442         frame = self.frame
00443         for c in list(subframe.children.values()):
00444             c.destroy()
00445         self.dict = None
00446         if not dict:
00447             l = Label(subframe, text="None")
00448             l.grid(row=0, column=0)
00449         else:
00450             #names = sorted(dict)
00451             ###
00452             # Because of (temporary) limitations on the dict_keys type (not yet
00453             # public or pickleable), have the subprocess to send a list of
00454             # keys, not a dict_keys object.  sorted() will take a dict_keys
00455             # (no subprocess) or a list.
00456             #
00457             # There is also an obscure bug in sorted(dict) where the
00458             # interpreter gets into a loop requesting non-existing dict[0],
00459             # dict[1], dict[2], etc from the RemoteDebugger.DictProxy.
00460             ###
00461             keys_list = dict.keys()
00462             names = sorted(keys_list)
00463             ###
00464             row = 0
00465             for name in names:
00466                 value = dict[name]
00467                 svalue = self.repr.repr(value) # repr(value)
00468                 # Strip extra quotes caused by calling repr on the (already)
00469                 # repr'd value sent across the RPC interface:
00470                 if rpc_client:
00471                     svalue = svalue[1:-1]
00472                 l = Label(subframe, text=name)
00473                 l.grid(row=row, column=0, sticky="nw")
00474                 l = Entry(subframe, width=0, borderwidth=0)
00475                 l.insert(0, svalue)
00476                 l.grid(row=row, column=1, sticky="nw")
00477                 row = row+1
00478         self.dict = dict
00479         # XXX Could we use a <Configure> callback for the following?
00480         subframe.update_idletasks() # Alas!
00481         width = subframe.winfo_reqwidth()
00482         height = subframe.winfo_reqheight()
00483         canvas = self.canvas
00484         self.canvas["scrollregion"] = (0, 0, width, height)
00485         if height > 300:
00486             canvas["height"] = 300
00487             frame.pack(expand=1)
00488         else:
00489             canvas["height"] = height
00490             frame.pack(expand=0)


Member Data Documentation

Definition at line 425 of file Debugger.py.

Definition at line 435 of file Debugger.py.

Because of (temporary) limitations on the dict_keys type (not yet public or pickleable), have the subprocess to send a list of keys, not a dict_keys object.

sorted() will take a dict_keys (no subprocess) or a list.

There is also an obscure bug in sorted(dict) where the interpreter gets into a loop requesting non-existing dict[0], dict[1], dict[2], etc from the RemoteDebugger.DictProxy.

Definition at line 444 of file Debugger.py.

Definition at line 419 of file Debugger.py.

Definition at line 421 of file Debugger.py.

Definition at line 413 of file Debugger.py.

Definition at line 416 of file Debugger.py.

Definition at line 432 of file Debugger.py.

Definition at line 431 of file Debugger.py.

Definition at line 414 of file Debugger.py.

Definition at line 423 of file Debugger.py.


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