Example #1
0
    def setupwidgets(self, text):
        topbarheight = 24
        popfieldwidth = 80
        self.lastlineno = None

        # make an editor
        self.editgroup = W.Group((0, topbarheight + 1, 0, 0))
        editor = W.PyEditor((0, 0, -15,-15), text,
                        fontsettings = self.fontsettings,
                        tabsettings = self.tabsettings,
                        file = self.getfilename())

        # make the widgets
        self.popfield = ClassFinder((popfieldwidth - 17, -15, 16, 16), [], self.popselectline)
        self.linefield = W.EditText((-1, -15, popfieldwidth - 15, 16), inset = (6, 1))
        self.editgroup._barx = W.Scrollbar((popfieldwidth - 2, -15, -14, 16), editor.hscroll, max = 32767)
        self.editgroup._bary = W.Scrollbar((-15, 14, 16, -14), editor.vscroll, max = 32767)
        self.editgroup.editor = editor  # add editor *after* scrollbars

        self.editgroup.optionsmenu = W.PopupMenu((-15, -1, 16, 16), [])
        self.editgroup.optionsmenu.bind('<click>', self.makeoptionsmenu)

        self.bevelbox = W.BevelBox((0, 0, 0, topbarheight))
        self.hline = W.HorizontalLine((0, topbarheight, 0, 0))
        self.infotext = W.TextBox((175, 6, -4, 14), backgroundcolor = (0xe000, 0xe000, 0xe000))
        self.runbutton = W.BevelButton((6, 4, 80, 16), runButtonLabels[0], self.run)
        self.runselbutton = W.BevelButton((90, 4, 80, 16), runSelButtonLabels[0], self.runselection)

        # bind some keys
        editor.bind("cmdr", self.runbutton.push)
        editor.bind("enter", self.runselbutton.push)
        editor.bind("cmdj", self.domenu_gotoline)
        editor.bind("cmdd", self.domenu_toggledebugger)
        editor.bind("<idle>", self.updateselection)

        editor.bind("cmde", searchengine.setfindstring)
        editor.bind("cmdf", searchengine.show)
        editor.bind("cmdg", searchengine.findnext)
        editor.bind("cmdshiftr", searchengine.replace)
        editor.bind("cmdt", searchengine.replacefind)

        self.linefield.bind("return", self.dolinefield)
        self.linefield.bind("enter", self.dolinefield)
        self.linefield.bind("tab", self.dolinefield)

        # intercept clicks
        editor.bind("<click>", self.clickeditor)
        self.linefield.bind("<click>", self.clicklinefield)
Example #2
0
 def __init__(self, object = None, title = None, closechildren = 0):
     if hasattr(object, '__name__'):
         name = object.__name__
     else:
         name = ''
     if title is None:
         title = 'Object browser'
         if name:
             title = title + ': ' + name
     self.w = w = W.Window((300, 400), title, minsize = (100, 100))
     w.info = W.TextBox((18, 8, -70, 15))
     w.updatebutton = W.BevelButton((-64, 4, 50, 16), 'Update', self.update)
     w.browser = BrowserWidget((-1, 24, 1, -14), None)
     w.bind('cmdu', w.updatebutton.push)
     w.open()
     self.set(object, name)