Ejemplo n.º 1
0
 def _modified(self):
     signals.emit_signal(self, "modified")
Ejemplo n.º 2
0
    def register_palette_entry(self, name, foreground, background,
        mono=None, foreground_high=None, background_high=None):
        """Register a single palette entry.

        name -- new entry/attribute name
        foreground -- a string containing a comma-separated foreground 
            color and settings

            Color values:
            'default' (use the terminal's default foreground),
            'black', 'dark red', 'dark green', 'brown', 'dark blue',
            'dark magenta', 'dark cyan', 'light gray', 'dark gray',
            'light red', 'light green', 'yellow', 'light blue', 
            'light magenta', 'light cyan', 'white'

            Settings:
            'bold', 'underline', 'blink', 'standout'

            Some terminals use 'bold' for bright colors.  Most terminals
            ignore the 'blink' setting.  If the color is not given then
            'default' will be assumed. 

        background -- a string containing the background color

            Background color values:
            'default' (use the terminal's default background),
            'black', 'dark red', 'dark green', 'brown', 'dark blue',
            'dark magenta', 'dark cyan', 'light gray'
        
        mono -- a comma-separated string containing monochrome terminal 
            settings (see "Settings" above.)

            None = no terminal settings (same as 'default')

        foreground_high -- a string containing a comma-separated 
            foreground color and settings, standard foreground
            colors (see "Color values" above) or high-colors may 
            be used

            High-color example values:
            '#009' (0% red, 0% green, 60% red, like HTML colors)
            '#fcc' (100% red, 80% green, 80% blue)
            'g40' (40% gray, decimal), 'g#cc' (80% gray, hex),
            '#000', 'g0', 'g#00' (black),
            '#fff', 'g100', 'g#ff' (white)
            'h8' (color number 8), 'h255' (color number 255)

            None = use foreground parameter value

        background_high -- a string containing the background color,
            standard background colors (see "Background colors" above)
            or high-colors (see "High-color example values" above)
            may be used

            None = use background parameter value
        """
        basic = AttrSpec(foreground, background, 16)

        if type(mono) == type(()):
            # old style of specifying mono attributes was to put them
            # in a tuple.  convert to comma-separated string
            mono = ",".join(mono)
        if mono is None:
            mono = DEFAULT
        mono = AttrSpec(mono, DEFAULT, 1)
        
        if foreground_high is None:
            foreground_high = foreground
        if background_high is None:
            background_high = background
        high_88 = AttrSpec(foreground_high, background_high, 88)
        high_256 = AttrSpec(foreground_high, background_high, 256)

        signals.emit_signal(self, UPDATE_PALETTE_ENTRY,
            name, basic, mono, high_88, high_256)
        self._palette[name] = (basic, mono, high_88, high_256)
Ejemplo n.º 3
0
 def _emit(self, name, *args):
     """
     Convenience function to emit signals with self as first
     argument.
     """
     signals.emit_signal(self, name, self, *args)
Ejemplo n.º 4
0
    def register_palette_entry(self,
                               name,
                               foreground,
                               background,
                               mono=None,
                               foreground_high=None,
                               background_high=None):
        """Register a single palette entry.

        name -- new entry/attribute name
        foreground -- a string containing a comma-separated foreground 
            color and settings

            Color values:
            'default' (use the terminal's default foreground),
            'black', 'dark red', 'dark green', 'brown', 'dark blue',
            'dark magenta', 'dark cyan', 'light gray', 'dark gray',
            'light red', 'light green', 'yellow', 'light blue', 
            'light magenta', 'light cyan', 'white'

            Settings:
            'bold', 'underline', 'blink', 'standout'

            Some terminals use 'bold' for bright colors.  Most terminals
            ignore the 'blink' setting.  If the color is not given then
            'default' will be assumed. 

        background -- a string containing the background color

            Background color values:
            'default' (use the terminal's default background),
            'black', 'dark red', 'dark green', 'brown', 'dark blue',
            'dark magenta', 'dark cyan', 'light gray'
        
        mono -- a comma-separated string containing monochrome terminal 
            settings (see "Settings" above.)

            None = no terminal settings (same as 'default')

        foreground_high -- a string containing a comma-separated 
            foreground color and settings, standard foreground
            colors (see "Color values" above) or high-colors may 
            be used

            High-color example values:
            '#009' (0% red, 0% green, 60% red, like HTML colors)
            '#fcc' (100% red, 80% green, 80% blue)
            'g40' (40% gray, decimal), 'g#cc' (80% gray, hex),
            '#000', 'g0', 'g#00' (black),
            '#fff', 'g100', 'g#ff' (white)
            'h8' (color number 8), 'h255' (color number 255)

            None = use foreground parameter value

        background_high -- a string containing the background color,
            standard background colors (see "Background colors" above)
            or high-colors (see "High-color example values" above)
            may be used

            None = use background parameter value
        """
        basic = AttrSpec(foreground, background, 16)

        if type(mono) == type(()):
            # old style of specifying mono attributes was to put them
            # in a tuple.  convert to comma-separated string
            mono = ",".join(mono)
        if mono is None:
            mono = DEFAULT
        mono = AttrSpec(mono, DEFAULT, 1)

        if foreground_high is None:
            foreground_high = foreground
        if background_high is None:
            background_high = background
        high_88 = AttrSpec(foreground_high, background_high, 88)
        high_256 = AttrSpec(foreground_high, background_high, 256)

        signals.emit_signal(self, UPDATE_PALETTE_ENTRY, name, basic, mono,
                            high_88, high_256)
        self._palette[name] = (basic, mono, high_88, high_256)
Ejemplo n.º 5
0
 def _modified(self):
     signals.emit_signal(self, "modified")
Ejemplo n.º 6
0
 def _emit(self, name, *args):
     """
     Convenience function to emit signals with self as first
     argument.
     """
     signals.emit_signal(self, name, self, *args)