Esempio n. 1
0
        def paint( self, focused ):
            
            if not self.widget: return

            if focused:
                attr = ckitcore.Attribute( fg=ckit_theme.getColor("select_fg"), bg=ckit_theme.getColor("select_bg"))
            else:
                attr = ckitcore.Attribute( fg=ckit_theme.getColor("fg"))

            self.dialog.putString( self.x+self.indent, self.y, self.dialog.width(), 1, attr, self.text )

            self.widget.enableCursor(focused)
            self.widget.paint()
Esempio n. 2
0
    def load( self, filename, strength ):
    
        self.pil_image = Image.open(filename)
        self.pil_image = self.pil_image.convert( "RGBA" )
        
        bg = ckit_theme.getColor("bg")
        bgcolor_pil_image = Image.new( "RGBA", self.pil_image.size, (bg[0],bg[1],bg[2],255) ) 

        self.pil_image = Image.blend( self.pil_image, bgcolor_pil_image, (100-strength)/100.0 )
Esempio n. 3
0
    def load(self, filename, strength):

        self.pil_image = Image.open(filename)
        self.pil_image = self.pil_image.convert("RGBA")

        bg = ckit_theme.getColor("bg")
        bgcolor_pil_image = Image.new("RGBA", self.pil_image.size,
                                      (bg[0], bg[1], bg[2], 255))

        self.pil_image = Image.blend(self.pil_image, bgcolor_pil_image,
                                     (100 - strength) / 100.0)
Esempio n. 4
0
 def paint( self, focused ):
     if not self.isVisible(): return
     attr = ckitcore.Attribute( fg=ckit_theme.getColor("fg"))
     self.dialog.putString( self.x+self.indent, self.y, self.dialog.width(), 1, attr, self.text )
Esempio n. 5
0
    def __init__( self, parent_window, text, items ):

        self.parent_window = parent_window

        parent_window_rect = parent_window.getWindowRect()
        window_x, window_y = (parent_window_rect[0] + parent_window_rect[2])//2, (parent_window_rect[1] + parent_window_rect[3])//2

        ckit_textwindow.TextWindow.__init__(
            self,
            x=window_x,
            y=window_y,
            width=1,
            height=1,
            origin= ORIGIN_X_CENTER | ORIGIN_Y_CENTER,
            parent_window=parent_window,
            bg_color = ckit_theme.getColor("bg"),
            caret0_color = ckit_theme.getColor("caret0"),
            caret1_color = ckit_theme.getColor("caret1"),
            show = False,
            resizable = False,
            title = text,
            minimizebox = False,
            maximizebox = False,
            caret = True,
            close_handler = self.onClose,
            keydown_handler = self.onKeyDown,
            char_handler = self.onChar,
            )

        self.setCaretPosition( -1, -1 )

        # 部品初期化
        self.items = items
        self.rebuildItems()
        
        # ウインドウサイズ調整
        self.setPosSize(
            x=window_x,
            y=window_y,
            width=self.window_width,
            height=self.window_height,
            origin= ORIGIN_X_CENTER | ORIGIN_Y_CENTER
            )
        self.show(True)

        # 初期フォーカス位置
        self.focus = 0
        while True:
            if self.focus >= len(self.items):
                self.focus = None
                break
            if self.items[self.focus].focusable():
                break
            self.focus += 1

        self.result = Dialog.RESULT_CANCEL

        try:
            self.wallpaper = ckit_wallpaper.Wallpaper(self)
            self.wallpaper.copy( self.parent_window )
            self.wallpaper.adjust()
        except:
            self.wallpaper = None

        self.paint()