tuikit/application.py
author Radek Brich <radek.brich@devl.cz>
Fri, 18 Jan 2013 22:36:50 +0100
changeset 62 2f61931520c9
parent 59 729fcdfe6b57
child 63 2a0e04091898
permissions -rw-r--r--
Rework layouts: Layout is now normal Container which places its children upon resize event. Drop TopWindow, top is now any subclass of Container. Add floater concept: floaters are widgets drawn over normal widgets, not clipped by parent. Add HScrollbar and Scrollbar abstract base class.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     1
# -*- coding: utf-8 -*-
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     2
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     3
import logging
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     4
import time
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     5
62
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
     6
from tuikit.layout import AnchorLayout
0
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     7
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     8
59
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
     9
class Timer:
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    10
    def __init__(self):
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    11
        self.timeouts = []
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    12
        self.timelast = None
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    13
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    14
    def add_timeout(self, delay, callback):
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    15
        """Register callback to be called after delay seconds.
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    16
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    17
        delay -- in seconds, float
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    18
        callback -- function to be called with no parameters
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    19
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    20
        """
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    21
        if not len(self.timeouts):
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    22
            self.timelast = time.time()
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    23
        self.timeouts += [[delay, callback]]
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    24
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    25
    def remove_timeout(self, callback):
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    26
        """Unregister callback previously registered with add_timeout."""
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    27
        for timeout in self.timeouts[:]:
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    28
            if timeout[1] == callback:
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    29
                self.timeouts.remove(timeout)
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    30
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    31
    def has_timeout(self):
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    32
        return len(self.timeouts) > 0
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    33
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    34
    def nearest_timeout(self):
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    35
        if not self.has_timeout():
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    36
            return None
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    37
        return min(self.timeouts)[0]
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    38
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    39
    def process_timeouts(self):
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    40
        if not self.has_timeout():
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    41
            return
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    42
        now = time.time()
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    43
        lasted = now - self.timelast
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    44
        self.timelast = now
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    45
        for timeout in self.timeouts[:]:
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    46
            adjusted_delay = timeout[0] - lasted
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    47
            if adjusted_delay <= 0.0:
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    48
                timeout[1]()
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    49
                self.timeouts.remove(timeout)
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    50
            else:
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    51
                timeout[0] = adjusted_delay
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    52
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
    53
0
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    54
class Application:
32
088b92ffb119 Clean up, refactoring. Rename EventSource to Emitter, begin merging emit() method with handle().
Radek Brich <radek.brich@devl.cz>
parents: 30
diff changeset
    55
13
19ebde2fd594 Add more generated documentation.
Radek Brich <radek.brich@devl.cz>
parents: 11
diff changeset
    56
    '''Application class. Defines main loop.'''
32
088b92ffb119 Clean up, refactoring. Rename EventSource to Emitter, begin merging emit() method with handle().
Radek Brich <radek.brich@devl.cz>
parents: 30
diff changeset
    57
62
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
    58
    def __init__(self, top_layout=AnchorLayout, driver='curses'):
13
19ebde2fd594 Add more generated documentation.
Radek Brich <radek.brich@devl.cz>
parents: 11
diff changeset
    59
        '''Create application.'''
62
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
    60
        self._setup_logging()
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
    61
        
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
    62
        # Top widget
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
    63
        self._top = None
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
    64
        self._timer = Timer()
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
    65
        self.top = top_layout()
32
088b92ffb119 Clean up, refactoring. Rename EventSource to Emitter, begin merging emit() method with handle().
Radek Brich <radek.brich@devl.cz>
parents: 30
diff changeset
    66
0
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    67
        self.quit = False
32
088b92ffb119 Clean up, refactoring. Rename EventSource to Emitter, begin merging emit() method with handle().
Radek Brich <radek.brich@devl.cz>
parents: 30
diff changeset
    68
62
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
    69
        #: Driver class instance (render + input), e.g. DriverCurses.
29
c0cdef06fd16 Import only one driver from application.
Radek Brich <radek.brich@devl.cz>
parents: 24
diff changeset
    70
        self.driver = self.get_driver_instance(driver)
32
088b92ffb119 Clean up, refactoring. Rename EventSource to Emitter, begin merging emit() method with handle().
Radek Brich <radek.brich@devl.cz>
parents: 30
diff changeset
    71
62
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
    72
    def _setup_logging(self):
0
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    73
        self.log = logging.getLogger('tuikit')
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    74
        self.log.setLevel(logging.DEBUG)
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    75
        handler = logging.FileHandler('./tuikit.log')
15
c55b4749e562 Add Pager.
Radek Brich <radek.brich@devl.cz>
parents: 13
diff changeset
    76
        formatter = logging.Formatter('%(asctime)s %(levelname)-5s %(message)s', '%y-%m-%d %H:%M:%S')
c55b4749e562 Add Pager.
Radek Brich <radek.brich@devl.cz>
parents: 13
diff changeset
    77
        handler.setFormatter(formatter)
0
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    78
        self.log.addHandler(handler)
62
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
    79
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
    80
    @property
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
    81
    def top(self):
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
    82
        return self._top
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
    83
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
    84
    @top.setter
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
    85
    def top(self, value):
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
    86
        self._top = value
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
    87
        self._top.top = value
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
    88
        self._top.timer = self._timer
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
    89
        self._top.add_handler('draw', self._on_top_draw)
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
    90
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
    91
    def _on_top_draw(self, ev):
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
    92
        ev.driver.erase()
0
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    93
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    94
    def start(self):
13
19ebde2fd594 Add more generated documentation.
Radek Brich <radek.brich@devl.cz>
parents: 11
diff changeset
    95
        '''Start application. Runs main loop.'''
62
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
    96
        self.log.info('=== start ===')
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
    97
        self.driver.start(self.main_loop)
0
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    98
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    99
    def terminate(self):
13
19ebde2fd594 Add more generated documentation.
Radek Brich <radek.brich@devl.cz>
parents: 11
diff changeset
   100
        '''Terminate application.'''
0
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   101
        self.quit = True
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   102
62
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
   103
    def main_loop(self):
13
19ebde2fd594 Add more generated documentation.
Radek Brich <radek.brich@devl.cz>
parents: 11
diff changeset
   104
        '''The main loop.'''
62
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
   105
        self.apply_theme()
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
   106
        self._top._size = self.driver.size  # link top widget size to screen size
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
   107
        self._top.emit('resize')
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
   108
        timer = self._timer
0
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   109
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   110
        while True:
62
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
   111
            self._top.draw(self.driver, 0, 0)
23
4e72fd2a0e14 Rename BackendCurses to DriverCurses. Add DriverDummy - dummy driver for debugging purposes. Move clipping stack from driver to common.ClipStack class.
Radek Brich <radek.brich@devl.cz>
parents: 21
diff changeset
   112
            self.driver.commit()
0
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   113
59
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
   114
            timeout = timer.nearest_timeout()
24
b248ef500557 Add DriverPygame (incomplete). Move unicode graphics constants to UnicodeGraphics class. Move shared parts of drivers to Driver base class.
Radek Brich <radek.brich@devl.cz>
parents: 23
diff changeset
   115
            events = self.driver.getevents(timeout)
59
729fcdfe6b57 Cleanup timeouts.
Radek Brich <radek.brich@devl.cz>
parents: 57
diff changeset
   116
            timer.process_timeouts()
0
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   117
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   118
            for event in events:
24
b248ef500557 Add DriverPygame (incomplete). Move unicode graphics constants to UnicodeGraphics class. Move shared parts of drivers to Driver base class.
Radek Brich <radek.brich@devl.cz>
parents: 23
diff changeset
   119
                if event[0] == 'quit':
b248ef500557 Add DriverPygame (incomplete). Move unicode graphics constants to UnicodeGraphics class. Move shared parts of drivers to Driver base class.
Radek Brich <radek.brich@devl.cz>
parents: 23
diff changeset
   120
                    self.quit = True
b248ef500557 Add DriverPygame (incomplete). Move unicode graphics constants to UnicodeGraphics class. Move shared parts of drivers to Driver base class.
Radek Brich <radek.brich@devl.cz>
parents: 23
diff changeset
   121
                else:
62
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
   122
                    self._top.emit(event[0], *event[1:])
0
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   123
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   124
            if self.quit:
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   125
                break
62
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
   126
        self.log.info('=== quit ===')
0
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   127
7
d4a291b31cbb New color management - named colors.
Radek Brich <radek.brich@devl.cz>
parents: 1
diff changeset
   128
62
2f61931520c9 Rework layouts: Layout is now normal Container which places its children upon resize event.
Radek Brich <radek.brich@devl.cz>
parents: 59
diff changeset
   129
    def apply_theme(self):
52
50a1857557da Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
   130
        #TODO: allow custom colors:
50a1857557da Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
   131
        #    e.g. "blue (#2020FF) on black (#101010), underline"
50a1857557da Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
   132
        #    color in brackets is used when driver supports custom colors
23
4e72fd2a0e14 Rename BackendCurses to DriverCurses. Add DriverDummy - dummy driver for debugging purposes. Move clipping stack from driver to common.ClipStack class.
Radek Brich <radek.brich@devl.cz>
parents: 21
diff changeset
   133
        driver = self.driver
4e72fd2a0e14 Rename BackendCurses to DriverCurses. Add DriverDummy - dummy driver for debugging purposes. Move clipping stack from driver to common.ClipStack class.
Radek Brich <radek.brich@devl.cz>
parents: 21
diff changeset
   134
        driver.setcolor('normal',                  'white on black')
4e72fd2a0e14 Rename BackendCurses to DriverCurses. Add DriverDummy - dummy driver for debugging purposes. Move clipping stack from driver to common.ClipStack class.
Radek Brich <radek.brich@devl.cz>
parents: 21
diff changeset
   135
        driver.setcolor('strong',                  'white on black, bold')
4e72fd2a0e14 Rename BackendCurses to DriverCurses. Add DriverDummy - dummy driver for debugging purposes. Move clipping stack from driver to common.ClipStack class.
Radek Brich <radek.brich@devl.cz>
parents: 21
diff changeset
   136
        driver.setcolor('active',                  'black on cyan')
4e72fd2a0e14 Rename BackendCurses to DriverCurses. Add DriverDummy - dummy driver for debugging purposes. Move clipping stack from driver to common.ClipStack class.
Radek Brich <radek.brich@devl.cz>
parents: 21
diff changeset
   137
        driver.setcolor('window:normal',           'white on blue')
4e72fd2a0e14 Rename BackendCurses to DriverCurses. Add DriverDummy - dummy driver for debugging purposes. Move clipping stack from driver to common.ClipStack class.
Radek Brich <radek.brich@devl.cz>
parents: 21
diff changeset
   138
        driver.setcolor('window:controls',         'white on blue, bold')
4e72fd2a0e14 Rename BackendCurses to DriverCurses. Add DriverDummy - dummy driver for debugging purposes. Move clipping stack from driver to common.ClipStack class.
Radek Brich <radek.brich@devl.cz>
parents: 21
diff changeset
   139
        driver.setcolor('window:controls-active',  'cyan on blue, bold')
4e72fd2a0e14 Rename BackendCurses to DriverCurses. Add DriverDummy - dummy driver for debugging purposes. Move clipping stack from driver to common.ClipStack class.
Radek Brich <radek.brich@devl.cz>
parents: 21
diff changeset
   140
        driver.setcolor('button',                  'black on white')
4e72fd2a0e14 Rename BackendCurses to DriverCurses. Add DriverDummy - dummy driver for debugging purposes. Move clipping stack from driver to common.ClipStack class.
Radek Brich <radek.brich@devl.cz>
parents: 21
diff changeset
   141
        driver.setcolor('button-active',           'black on cyan')
4e72fd2a0e14 Rename BackendCurses to DriverCurses. Add DriverDummy - dummy driver for debugging purposes. Move clipping stack from driver to common.ClipStack class.
Radek Brich <radek.brich@devl.cz>
parents: 21
diff changeset
   142
        driver.setcolor('menu',                    'black on cyan')
4e72fd2a0e14 Rename BackendCurses to DriverCurses. Add DriverDummy - dummy driver for debugging purposes. Move clipping stack from driver to common.ClipStack class.
Radek Brich <radek.brich@devl.cz>
parents: 21
diff changeset
   143
        driver.setcolor('menu-active',             'white on cyan, bold')
30
05500124d7fb Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents: 29
diff changeset
   144
        driver.setcolor('combo:normal',            'black on green')
13
19ebde2fd594 Add more generated documentation.
Radek Brich <radek.brich@devl.cz>
parents: 11
diff changeset
   145
29
c0cdef06fd16 Import only one driver from application.
Radek Brich <radek.brich@devl.cz>
parents: 24
diff changeset
   146
c0cdef06fd16 Import only one driver from application.
Radek Brich <radek.brich@devl.cz>
parents: 24
diff changeset
   147
    def get_driver_instance(self, name):
c0cdef06fd16 Import only one driver from application.
Radek Brich <radek.brich@devl.cz>
parents: 24
diff changeset
   148
        module = __import__('tuikit.driver_' + name, fromlist=['driverclass'])
c0cdef06fd16 Import only one driver from application.
Radek Brich <radek.brich@devl.cz>
parents: 24
diff changeset
   149
        return module.driverclass()
c0cdef06fd16 Import only one driver from application.
Radek Brich <radek.brich@devl.cz>
parents: 24
diff changeset
   150