Esempio n. 1
0
 def paint( self, window, x, y, width, height ):
     s = " %s" % ( self.message )
     s = ckit.adjustStringWidth( window, s, width-1 )
     if self.error:
         attr = ckit.Attribute(fg=cmemo_colortable.bar_error_fg)
     else:
         attr = ckit.Attribute( fg=cmemo_colortable.bar_fg )
     window.putString( x, y, width, height, attr, s )
Esempio n. 2
0
 def onSize(self, width, height):
     print("onSize")
     self.putString(0, 0, 20, 1,
                    ckit.Attribute(fg=(255, 255, 255), bg=(0, 0, 0)),
                    " %d, %d     " % (width, height))
     self.putString(0, 1, 20, 1,
                    ckit.Attribute(fg=(50, 50, 50), bg=(200, 200, 200)),
                    " 幅  高 ")
Esempio n. 3
0
    def paint(self):

        x = 0
        y = 0
        width = self.width()
        height = self.height()

        client_rect = self.getClientRect()
        offset_x, offset_y = self.charToClient(0, 0)
        char_w, char_h = self.getCharSize()

        attribute_normal = ckit.Attribute(fg=self.fg_color)

        for i in range(height):
            if i < len(self.lines):

                line = self.lines[i]

                if height == 1 and height < len(self.lines) and i == 0:
                    line = MemoWindow.line_mode_mark + line

                self.putString(0, y + i, width, 1, attribute_normal,
                               " " * width)
                self.putString(0, y + i, width, 1, attribute_normal, line)
            else:
                self.putString(0, y + i, width, 1, attribute_normal,
                               " " * width)

        self.plane_active.setPosition(
            (client_rect[2] - 13, client_rect[3] - 13))
Esempio n. 4
0
    def paint(self):

        x = 0
        y = 0
        width = self.width()
        height = self.itemsHeight()

        attribute_normal = ckit.Attribute(fg=cmemo_colortable.fg)
        attribute_normal_selected = ckit.Attribute(
            fg=cmemo_colortable.fg, bg=cmemo_colortable.select_bg)

        for i in range(height):
            index = self.scroll_info.pos + i
            if index < len(self.items):

                item = self.items[index]
                if isinstance(item, list) or isinstance(item, tuple):
                    item = item[0]

                if self.select == index:
                    attr = attribute_normal_selected
                else:
                    attr = attribute_normal
                self.putString(x, y + i, width, 1, attr, " " * width)
                self.putString(x, y + i, width, 1, attr, item)
            else:
                self.putString(x, y + i, width, 1, attribute_normal,
                               " " * width)

        if self.status_bar:
            if self.isearch:
                attr = ckit.Attribute(fg=cmemo_colortable.edit_fg)
                s = " Search : %s_" % (self.isearch.isearch_value)
                s = ckit.adjustStringWidth(self, s, width - 1)
                self.putString(0, self.height() - 1, width - 1, 1, attr, s)
            else:
                self.status_bar_layer.setMessage(
                    self.statusbar_handler(width, self.select))
                self.status_bar.paint(self, 0, self.height() - 1, width, 1)
        else:
            if self.isearch:
                s = " Search : %s_" % (self.isearch.isearch_value)
                self.setTitle(s)
            else:
                self.setTitle(self.title)
Esempio n. 5
0
    def paint(self):

        x = 0
        y = 0
        width = self.width()
        height = self.height()

        attr = ckit.Attribute(fg=(0, 0, 0), bg=(255, 255, 255))
        self.putString(x, y, width, 1, attr, self.text)
Esempio n. 6
0
    def paint(self):

        attribute_normal = ckit.Attribute(fg=cmemo_colortable.fg)
        attribute_normal_selected = ckit.Attribute(
            fg=cmemo_colortable.fg, bg=cmemo_colortable.select_bg)

        message_width = self.getStringWidth(self.message)
        self.putString((self.width() - message_width) // 2, 1, message_width,
                       1, attribute_normal, self.message)

        if self.msgbox_type == MSGBOX_TYPE_OK:
            btn_string = " OK "
            btn_width = self.getStringWidth(btn_string)
            self.putString((self.width() - btn_width) // 2, 3, btn_width, 1,
                           attribute_normal_selected, btn_string)

        elif self.msgbox_type == MSGBOX_TYPE_YESNO:

            btn1_string = "はい"
            btn1_width = self.getStringWidth(btn1_string)
            btn2_string = "いいえ"
            btn2_width = self.getStringWidth(btn2_string)

            if self.focus == MessageBox.BUTTON_YES:
                attr = attribute_normal_selected
            else:
                attr = attribute_normal

            self.putString((self.width() - btn1_width - btn2_width - 4) // 2,
                           3, btn1_width, 1, attr, btn1_string)

            if self.focus == MessageBox.BUTTON_NO:
                attr = attribute_normal_selected
            else:
                attr = attribute_normal

            self.putString((self.width() + btn1_width - btn2_width + 4) // 2,
                           3, btn2_width, 1, attr, btn2_string)
Esempio n. 7
0
 def paint(self, window, x, y, width, height):
     if self.music_player.position != None and self.music_player.length != None:
         right = " %s - %s " % (_timeString(self.music_player.position),
                                _timeString(self.music_player.length -
                                            self.music_player.position))
     else:
         right = " "
     left = " [ Music %d/%d ] %s" % (self.music_player.cursor + 1,
                                     len(self.music_player.items),
                                     self.music_player.song_name)
     left = ckit.adjustStringWidth(window, left, width - len(right),
                                   ckit.ALIGN_LEFT, ckit.ELLIPSIS_RIGHT)
     attr = ckit.Attribute(fg=ckit.getColor("bar_fg"))
     window.putString(x, y, width, y, attr, left + right)
Esempio n. 8
0
    def paint(self):

        if self.focus == CommandWindow.FOCUS_NAME:
            attr = ckit.Attribute(fg=ckit.getColor("select_fg"),
                                  bg=ckit.getColor("select_bg"))
        else:
            attr = ckit.Attribute(fg=ckit.getColor("fg"))
        self.putString(2, 1, self.width() - 2, 1, attr, "名前")

        self.name_edit.enableCursor(self.focus == CommandWindow.FOCUS_NAME)
        self.name_edit.paint()

        if self.focus == CommandWindow.FOCUS_FILE:
            attr = ckit.Attribute(fg=ckit.getColor("select_fg"),
                                  bg=ckit.getColor("select_bg"))
        else:
            attr = ckit.Attribute(fg=ckit.getColor("fg"))
        self.putString(2, 3, self.width() - 2, 1, attr, "ファイル")

        self.file_edit.enableCursor(self.focus == CommandWindow.FOCUS_FILE)
        self.file_edit.paint()

        if self.focus == CommandWindow.FOCUS_PARAM:
            attr = ckit.Attribute(fg=ckit.getColor("select_fg"),
                                  bg=ckit.getColor("select_bg"))
        else:
            attr = ckit.Attribute(fg=ckit.getColor("fg"))
        self.putString(2, 5, self.width() - 2, 1, attr, "パラメタ")

        self.param_edit.enableCursor(self.focus == CommandWindow.FOCUS_PARAM)
        self.param_edit.paint()

        if self.focus == CommandWindow.FOCUS_DIRECTORY:
            attr = ckit.Attribute(fg=ckit.getColor("select_fg"),
                                  bg=ckit.getColor("select_bg"))
        else:
            attr = ckit.Attribute(fg=ckit.getColor("fg"))
        self.putString(2, 7, self.width() - 2, 1, attr, "ディレクトリ")

        self.directory_edit.enableCursor(
            self.focus == CommandWindow.FOCUS_DIRECTORY)
        self.directory_edit.paint()
Esempio n. 9
0
    def __init__(self):
        
        ckit.TextWindow.__init__(
            self,
            x=20, 
            y=10, 
            width=80, 
            height=24,
            title_bar = True,
            title = "Ckit Test",
            sysmenu=True,
            activate_handler = self.onActivate,
            size_handler = self.onSize,
            close_handler = self.onClose,
            keydown_handler = self.onKeyDown,
            keyup_handler = self.onKeyUp,
            char_handler = self.onChar,
            )

        self.putString( 0, 0, 20, 1, ckit.Attribute( fg=(255,255,255), bg=(0,0,0) ), "Hello World!" )
Esempio n. 10
0
    def paint(self):

        # テキスト
        if 1:
            x, y, width, height = self.rectText()

            attr = ckit.Attribute(fg=(255, 255, 255))
            attr_selected = ckit.Attribute(fg=(255, 255, 255),
                                           bg=(30, 100, 150))

            selection_left, selection_right = self.selection
            if selection_left > selection_right:
                selection_left, selection_right = selection_right, selection_left

            for i in range(height):

                if self.scroll_info.pos + i < self.log.numLines():

                    if selection_left[
                            0] <= self.scroll_info.pos + i <= selection_right[
                                0]:

                        s = self.log.getLine(self.scroll_info.pos + i)

                        if selection_left[0] == self.scroll_info.pos + i:
                            left = selection_left[1]
                        else:
                            left = 0

                        if selection_right[0] == self.scroll_info.pos + i:
                            right = selection_right[1]
                        else:
                            right = len(s)

                        s = [s[0:left], s[left:right], s[right:len(s)]]

                        line_x = x

                        self.putString(line_x, y + i, width - line_x, 1, attr,
                                       s[0])
                        line_x += self.getStringWidth(s[0])

                        self.putString(line_x, y + i, width - line_x, 1,
                                       attr_selected, s[1])
                        line_x += self.getStringWidth(s[1])

                        self.putString(line_x, y + i, width - line_x, 1, attr,
                                       s[2])
                        line_x += self.getStringWidth(s[2])

                        self.putString(line_x, y + i, width - line_x, 1, attr,
                                       " " * (width - line_x))

                    else:
                        s = self.log.getLine(self.scroll_info.pos + i)
                        self.putString(x, y + i, width, 1, attr, s)
                        w = self.getStringWidth(s)
                        space_x = x + w
                        space_width = width - w
                        self.putString(space_x, y + i, space_width, 1, attr,
                                       " " * space_width)
                else:
                    self.putString(x, y + i, width, 1, attr, " " * width)

        # スクロールバー
        if 1:
            x, y, width, height = self.rectScrollbar()

            for i in range(height):
                self.putString(x, y + i, width, 1, attr, " " * width)

            client_rect = self.getClientRect()
            scrollbar_left, tmp = self.charToClient(self.width() - 2, 0)

            scrollbar1_height = client_rect[3] * self.height(
            ) // self.log.numLines()
            scrollbar1_height = min(scrollbar1_height, client_rect[3])
            scrollbar1_height = max(scrollbar1_height, 12)

            scrollbar1_pos = (client_rect[3] -
                              scrollbar1_height) * self.scroll_info.pos // max(
                                  (self.log.numLines() - self.height()), 1)

            self.plane_scrollbar0.setPosSize(scrollbar_left, 0,
                                             client_rect[2] - scrollbar_left,
                                             client_rect[3])
            self.plane_scrollbar1.setPosSize(scrollbar_left, scrollbar1_pos,
                                             client_rect[2] - scrollbar_left,
                                             scrollbar1_height)
Esempio n. 11
0
 def paint( self, window, x, y, width, height ):
     if len(self.layer_list)>0:
         self.layer_list[0].paint( window, x, y, width, height )
     else:
         attr = ckit.Attribute( fg=cmemo_colortable.bar_fg )
         window.putString( x, y, width, height, attr, " " * width )
Esempio n. 12
0
 def paint( self, window, x, y, width, height ):
     attr = ckit.Attribute( fg=cmemo_colortable.bar_fg )
     window.putString( x, y, width, height, attr, " " * width )
Esempio n. 13
0
 def paint(self, window, x, y, width, height):
     if len(self.layer_list) > 0:
         self.layer_list[0].paint(window, x, y, width, height)
     else:
         attr = ckit.Attribute(fg=ckit.getColor("bar_fg"))
         window.putString(x, y, width, height, attr, " " * width)
Esempio n. 14
0
 def paint(self, window, x, y, width, height):
     attr = ckit.Attribute(fg=ckit.getColor("bar_fg"))
     window.putString(x, y, width, height, attr, " " * width)