Ejemplo n.º 1
0
Archivo: Text.py Proyecto: r-owen/RO
    def __init__ (self,
        master,
        helpText = None,
        helpURL = None,
        readOnly = False,
        isCurrent = True,
        useStateTags = False,
    **kargs):
        self.helpText = helpText
        self._readOnly = readOnly
        self._isCurrent = bool(isCurrent)
        
        Tkinter.Text.__init__(self, master, **kargs)

        CtxMenu.CtxMenuMixin.__init__(self, helpURL = helpURL)

        self._prefDict = WdgPrefs.getWdgPrefDict()
        self._sevPrefDict = WdgPrefs.getSevPrefDict()
        
        if self._readOnly:
            Bindings.makeReadOnly(self)
            self["takefocus"] = False

        # set up automatic update for bad background color pref
        self._prefDict["Bad Background"].addCallback(self._updateBGColor, callNow=False)
        
        if not self._isCurrent:
            self._updateBGColor()
        
        if useStateTags:
            for severity, pref in self._sevPrefDict.iteritems():
                if severity == RO.Constants.sevNormal:
                    # normal foreground color is already automatically updated
                    continue
                pref.addCallback(self._updateStateTagColors, callNow=False)
Ejemplo n.º 2
0
    def __init__(self,
                 master,
                 helpText=None,
                 helpURL=None,
                 readOnly=False,
                 isCurrent=True,
                 useStateTags=False,
                 **kargs):
        self.helpText = helpText
        self._readOnly = readOnly
        self._isCurrent = bool(isCurrent)

        Tkinter.Text.__init__(self, master, **kargs)

        CtxMenu.CtxMenuMixin.__init__(self, helpURL=helpURL)

        self._prefDict = WdgPrefs.getWdgPrefDict()
        self._sevPrefDict = WdgPrefs.getSevPrefDict()

        if self._readOnly:
            Bindings.makeReadOnly(self)
            self["takefocus"] = False

        # set up automatic update for bad background color pref
        self._prefDict["Bad Background"].addCallback(self._updateBGColor,
                                                     callNow=False)

        if not self._isCurrent:
            self._updateBGColor()

        if useStateTags:
            for severity, pref in self._sevPrefDict.iteritems():
                if severity == RO.Constants.sevNormal:
                    # normal foreground color is already automatically updated
                    continue
                pref.addCallback(self._updateStateTagColors, callNow=False)
Ejemplo n.º 3
0
    def __init__(self,
        master,
        maxTransfers = 1,
        maxLines = 500,
        helpURL = None,
    **kargs):
        Tkinter.Frame.__init__(self, master = master, **kargs)
        self._memDebugDict = {}
        
        self.maxLines = maxLines
        self.maxTransfers = maxTransfers
        self.selFTPGet = None # selected getter, for displaying details; None if none
        
        self.dispList = []  # list of displayed ftpGets
        self.getQueue = []  # list of unfinished (ftpGet, stateLabel, ftpCallback) triples

        self._timer = Timer()
        
        self.yscroll = Tkinter.Scrollbar (
            master = self,
            orient = "vertical",
        )
        self.text = Tkinter.Text (
            master = self,
            yscrollcommand = self.yscroll.set,
            wrap = "none",
            tabs = (8,),
            height = 4,
            width = 50,
        )
        self.yscroll.configure(command=self.text.yview)
        self.text.grid(row=0, column=0, sticky="nsew")
        self.yscroll.grid(row=0, column=1, sticky="ns")
        Bindings.makeReadOnly(self.text)
        if helpURL:
            CtxMenu.addCtxMenu(
                wdg = self.text,
                helpURL = helpURL + "#LogDisplay",
            )
        
        self.rowconfigure(0, weight=1)
        self.columnconfigure(0, weight=1)
        
        detFrame = Tkinter.Frame(self)
            
        gr = RO.Wdg.Gridder(detFrame, sticky="ew")
        
        self.fromWdg = RO.Wdg.StrEntry(
            master = detFrame,
            readOnly = True,
            helpURL = helpURL and helpURL + "#From",
            borderwidth = 0,
        )
        gr.gridWdg("From", self.fromWdg, colSpan=3)

        self.toWdg = RO.Wdg.StrEntry(
            master = detFrame,
            readOnly = True,
            helpURL = helpURL and helpURL + "#To",
            borderwidth = 0,
        )
        gr.gridWdg("To", self.toWdg, colSpan=2)
        
        self.stateWdg = RO.Wdg.StrEntry(
            master = detFrame,
            readOnly = True,
            helpURL = helpURL and helpURL + "#State",
            borderwidth = 0,
        )
        self.abortWdg = RO.Wdg.Button(
            master = detFrame,
            text = "Abort",
            command = self._abort,
            helpURL = helpURL and helpURL + "#Abort",
        )
        gr.gridWdg("State", self.stateWdg, colSpan=2)
        
        self.abortWdg.grid(row=1, column=2, rowspan=2, sticky="s")
        
        detFrame.columnconfigure(1, weight=1)
        
        detFrame.grid(row=1, column=0, columnspan=2, sticky="ew")
        
        self.text.bind("<ButtonPress-1>", self._selectEvt)
        self.text.bind("<B1-Motion>", self._selectEvt)
        
        self._updAllStatus()
        
        atexit.register(self._abortAll)
Ejemplo n.º 4
0
    def __init__(self,
        master,
        maxTransfers = 1,
        maxLines = 500,
        helpURL = None,
    **kargs):
        Tkinter.Frame.__init__(self, master = master, **kargs)
        self._memDebugDict = {}
        
        self.maxLines = maxLines
        self.maxTransfers = maxTransfers
        self.selHTTPGet = None # selected getter, for displaying details; None if none
        
        self.dispList = []  # list of displayed httpGets
        self.getQueue = []  # list of unfinished (httpGet, stateLabel) tuples
        
        self.yscroll = Tkinter.Scrollbar (
            master = self,
            orient = "vertical",
        )
        self.text = Tkinter.Text (
            master = self,
            yscrollcommand = self.yscroll.set,
            wrap = "none",
            tabs = (8,),
            height = 4,
            width = 50,
        )
        self.yscroll.configure(command=self.text.yview)
        self.text.grid(row=0, column=0, sticky="nsew")
        self.yscroll.grid(row=0, column=1, sticky="ns")
        Bindings.makeReadOnly(self.text)
        if helpURL:
            CtxMenu.addCtxMenu(
                wdg = self.text,
                helpURL = helpURL + "#LogDisplay",
            )
        
        self.rowconfigure(0, weight=1)
        self.columnconfigure(0, weight=1)
        
        detFrame = Tkinter.Frame(self)
            
        gr = RO.Wdg.Gridder(detFrame, sticky="ew")
        
        self.fromWdg = RO.Wdg.StrEntry(
            master = detFrame,
            readOnly = True,
            helpURL = helpURL and helpURL + "#From",
            borderwidth = 0,
        )
        gr.gridWdg("From", self.fromWdg, colSpan=3)

        self.toWdg = RO.Wdg.StrEntry(
            master = detFrame,
            readOnly = True,
            helpURL = helpURL and helpURL + "#To",
            borderwidth = 0,
        )
        gr.gridWdg("To", self.toWdg, colSpan=2)
        
        self.stateWdg = RO.Wdg.StrEntry(
            master = detFrame,
            readOnly = True,
            helpURL = helpURL and helpURL + "#State",
            borderwidth = 0,
        )
        self.abortWdg = RO.Wdg.Button(
            master = detFrame,
            text = "Abort",
            command = self._abort,
            helpURL = helpURL and helpURL + "#Abort",
        )
        gr.gridWdg("State", self.stateWdg, colSpan=2)
        
        self.abortWdg.grid(row=1, column=2, rowspan=2, sticky="s")
        
        detFrame.columnconfigure(1, weight=1)
        
        detFrame.grid(row=1, column=0, columnspan=2, sticky="ew")
        
        self.text.bind("<ButtonPress-1>", self._selectEvt)
        self.text.bind("<B1-Motion>", self._selectEvt)
        
        self._startNew()