def open(self): if not hasattr(self._parent, "_barx"): self._parent._barx = None if not hasattr(self._parent, "_bary"): self._parent._bary = None self._calcbounds() self.SetPort() viewrect, destrect = self._calctextbounds() flags = self._getflags() self.ted = waste.WENew(destrect, viewrect, flags) self.ted.WEInstallTabHooks() self.ted.WESetAlignment(WASTEconst.weFlushLeft) self.setfontsettings(self.fontsettings) self.settabsettings(self.tabsettings) self.ted.WEUseText(Res.Resource(self.temptext)) self.ted.WECalText() if self.selection: self.setselection(self.selection[0], self.selection[1]) self.selection = None else: self.selview() self.temptext = None self.updatescrollbars() self.bind("pageup", self.scrollpageup) self.bind("pagedown", self.scrollpagedown) self.bind("top", self.scrolltop) self.bind("bottom", self.scrollbottom) self.selchanged = 0
def __init__(self, window, rect, name, controlhandler=None): init_waste() self.last_mouse_was_down = 0 self.url = '' self.current_data_loaded = None self.tag_positions = {} self.bary = None self.anchor_offsets = [] self.anchor_hrefs = [] self.must_clear = 0 self.bg_color = (0xffff, 0xffff, 0xffff) self.fg_color = (0, 0, 0) self.an_color = (0xffff, 0, 0) self.font_normal = Fm.GetFNum('Times') self.font_tt = Fm.GetFNum('Courier') self.font_size = 12 self.name = name self.wid = window self.controlhandler = controlhandler l, t, r, b = rect self.rect = rect vr = l + LEFTMARGIN, t + TOPMARGIN, r - RIGHTMARGIN, b - BOTTOMMARGIN dr = (0, 0, vr[2] - vr[0], 0) Qd.SetPort(window) Qd.TextFont(4) Qd.TextSize(9) flags = WASTEconst.weDoAutoScroll | WASTEconst.weDoOutlineHilite self.ted = waste.WENew(dr, vr, flags) self._createscrollbars() self.do_activate()
def open(self, path, name, data): self.path = path self.name = name r = windowbounds(400, 400) w = Win.NewWindow(r, name, 1, 0, -1, 1, 0) self.wid = w vr = 0, 0, r[2] - r[0] - 15, r[3] - r[1] - 15 dr = (0, 0, 10240, 0) Qd.SetPort(w) Qd.TextFont(4) Qd.TextSize(9) flags = WASTEconst.weDoAutoScroll | WASTEconst.weDoOutlineHilite | \ WASTEconst.weDoMonoStyled | WASTEconst.weDoUndo self.ted = waste.WENew(dr, vr, flags) self.tedtexthandle = Res.Resource(data) self.ted.WEUseText(self.tedtexthandle) self.ted.WECalText() w.DrawGrowIcon() self.scrollbars() self.changed = 0 self.do_postopen() self.do_activate(1, None)
def open(self, path, name, data): self.path = path self.name = name r = windowbounds(400, 400) w = Win.NewWindow(r, name, 1, 0, -1, 1, 0) self.wid = w vr = LEFTMARGIN, 0, r[2] - r[0] - 15, r[3] - r[1] - 15 dr = (0, 0, vr[2], 0) Qd.SetPort(w) Qd.TextFont(4) Qd.TextSize(9) flags = WASTEconst.weDoAutoScroll | WASTEconst.weDoOutlineHilite | \ WASTEconst.weDoMonoStyled | WASTEconst.weDoUndo self.ted = waste.WENew(dr, vr, flags) self.ted.WEInstallTabHooks() style, soup = self.getstylesoup(self.path) self.ted.WEInsert(data, style, soup) self.ted.WESetSelection(0, 0) self.ted.WECalText() self.ted.WEResetModCount() w.DrawGrowIcon() self.scrollbars() self.do_postopen() self.do_activate(1, None)
# A minimal text editor.