コード例 #1
0
ファイル: Text.py プロジェクト: 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)
コード例 #2
0
ファイル: IsCurrentMixin.py プロジェクト: goodeveryone/awsl
 def _setIsCurrentPrefDict(self):
     """Set self._isCurrentPrefDict"""
     self._isCurrentPrefDict[False] = WdgPrefs.getWdgPrefDict(
     )["Bad Background"]
     self._isCurrentPrefDict[True] = WdgPrefs.getWdgPrefDict(
     )["Background Color"]
     WdgPrefs.getWdgPrefDict()["Bad Background"].addCallback(
         self._updateIsCurrentColor, callNow=False)
コード例 #3
0
ファイル: SeverityMixin.py プロジェクト: goodeveryone/awsl
 def setSeverity(self, severity):
     """Update severity information.
     
     Raise ValueError if severity is not one of
     RO.Constants.sevDebug, sevNormal, sevWarning or sevError.
     """
     if self._severity != severity:
         if severity not in self._severityPrefDict:
             # either severityPrefDict does not exist yet
             # or severity is invalid or both
             if not self._severityPrefDict:
                 # set severityPrefDict and subscribe to prefs;
                 # then test severity again
                 self._severityPrefDict = WdgPrefs.getSevPrefDict()
                 for iterseverity, pref in self._severityPrefDict.iteritems(
                 ):
                     if iterseverity == RO.Constants.sevNormal:
                         # normal foreground color is already automatically updated
                         continue
                     pref.addCallback(self._updateSeverityColor,
                                      callNow=False)
             if severity not in self._severityPrefDict:
                 raise ValueError("Invalid severity %r" % (severity, ))
         self._severity = severity
         self._updateSeverityColor()
コード例 #4
0
ファイル: IsCurrentMixin.py プロジェクト: r-owen/RO
 def _setIsCurrentPrefDict(self):
     """Set self._isCurrentPrefDict"""
     self._isCurrentPrefDict[False] = (
         WdgPrefs.getWdgPrefDict()["Bad Background"],
         WdgPrefs.getWdgPrefDict()["Active Bad Background"],
     )
     self._isCurrentPrefDict[True] = (
         WdgPrefs.getWdgPrefDict()["Background Color"],
         WdgPrefs.getWdgPrefDict()["Active Background Color"],
     )
     WdgPrefs.getWdgPrefDict()["Background Color"].addCallback(self._updateIsCurrentColor, callNow=False)
     WdgPrefs.getWdgPrefDict()["Bad Background"].addCallback(self._updateIsCurrentColor, callNow=False)
コード例 #5
0
ファイル: Text.py プロジェクト: goodeveryone/awsl
    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)
コード例 #6
0
ファイル: SeverityMixin.py プロジェクト: r-owen/RO
 def setSeverity(self, severity):
     """Update severity information.
     
     Raise ValueError if severity is not one of
     RO.Constants.sevDebug, sevNormal, sevWarning or sevError.
     """
     if self._severity != severity:
         if severity not in self._severityPrefDict:
             # either severityPrefDict does not exist yet
             # or severity is invalid or both
             if not self._severityPrefDict:
                 # set severityPrefDict and subscribe to prefs;
                 # then test severity again
                 self._severityPrefDict = WdgPrefs.getSevPrefDict()
                 for iterseverity, pref in self._severityPrefDict.iteritems():
                     if iterseverity == RO.Constants.sevNormal:
                         # normal foreground color is already automatically updated
                         continue
                     pref.addCallback(self._updateSeverityColor, callNow=False)
             if severity not in self._severityPrefDict:
                 raise ValueError("Invalid severity %r" % (severity,))
         self._severity = severity
         self._updateSeverityColor()