예제 #1
0
def itemformat_Name_Ext_Size_YYMMDD_HHMM( window, item, width, userdata ):

    if item.isdir():
        str_size = "<DIR>"
    else:
        str_size = "%6s" % cfiler_misc.getFileSizeString(item.size())

    t = item.time()
    str_time = "%02d/%02d/%02d %02d:%02d" % ( t[0]%100, t[1], t[2], t[3], t[4] )

    str_size_time = "%s %s" % ( str_size, str_time )

    width = max(40,width)
    filename_width = width-len(str_size_time)

    if item.isdir():
        body, ext = item.getNameNfc(), None
    else:
        body, ext = ckit.splitExt(item.getNameNfc())

    if ext:
        body_width = min(width,filename_width-6)
        return ( ckit.adjustStringWidth(window,body,body_width,ckit.ALIGN_LEFT,ckit.ELLIPSIS_RIGHT)
               + ckit.adjustStringWidth(window,ext,6,ckit.ALIGN_LEFT,ckit.ELLIPSIS_NONE)
               + str_size_time )
    else:
        return ( ckit.adjustStringWidth(window,body,filename_width,ckit.ALIGN_LEFT,ckit.ELLIPSIS_RIGHT)
               + str_size_time )
예제 #2
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=ckit.getColor("bar_error_fg"))
     else:
         attr = ckit.Attribute( fg=ckit.getColor("bar_fg") )
     window.putString( x, y, width, height, attr, s )
예제 #3
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 )
예제 #4
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 )
예제 #5
0
    def paint( self, window, x, y, width, cursor, itemformat, userdata ):
        if cursor:
            line0=( LINE_BOTTOM, ckit.getColor("file_cursor") )
        else:
            line0=None

        attr = ckit.Attribute( fg=ckit.getColor("error_file_fg"), line0=line0 )

        s = "- no item -"
        s = ckit.adjustStringWidth(window,s,width,ckit.ALIGN_CENTER)
        window.putString( x, y, width, 1, attr, s )
예제 #6
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)
예제 #7
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)
예제 #8
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)
예제 #9
0
    def paint(self):

        width = self.width()
        height = self.height()

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

        area_size = ( client_rect[2]-client_rect[0], (height-1)*char_h+offset_y )
        
        if not self.img : return

        img_size = self.img.getSize()
        plane_size = ( int(img_size[0]*self._zoom), int(img_size[1]*self._zoom) )
        plane_topleft = [ (area_size[0]-plane_size[0])//2+self.pos[0], (area_size[1]-plane_size[1])//2+self.pos[1] ]

        if self.plane:
            self.plane.destroy()

        self.plane = ckit.ImagePlane( self, plane_topleft, plane_size, 4 )
        self.plane.setImage(self.img)

        self.setTitle( "%s - [ %s ]" % ( cfiler_resource.cfiler_appname, self.items[self.cursor].name ) )

        attribute_normal = ckit.Attribute( fg=ckit.getColor("fg"))
        for i in range(height-1):
            self.putString( 0, i, width, 1, attribute_normal, " " * width )

        self.plane_statusbar.setPosSize( 0, (height-1)*char_h+offset_y, client_rect[2], client_rect[3]-(height-1)*char_h+offset_y )
        
        if self.info:
            status_message_right = ":  %d%%  :  %s-mode  :  %s" % ( self._zoom*100, self.zoom_policy, self.info )
            error = False
        else:
            status_message_right = ": デコードエラー"
            error = True
        status_message_left = "[%d/%d]  %s" % ( self.cursor+1, len(self.items), self.items[self.cursor].name )
        status_message_left = ckit.adjustStringWidth( self, status_message_left, width-2-self.getStringWidth(status_message_right), ckit.ALIGN_LEFT, ckit.ELLIPSIS_RIGHT )
        self.status_bar_layer.setMessage( status_message_left + status_message_right, error )
        self.status_bar.paint( self, 0, height-1, width, 1 )
예제 #10
0
        def paintPane( pane, x, width ):
        
            diff_index = 0

            for i in range(height-1):

                index = pane.scroll_info.pos+i

                if index < len(pane.lines):
                    
                    attr=attribute_normal

                    while diff_index<len(pane.diff) and index+1 > pane.diff[diff_index][0] + pane.diff[diff_index][1]:
                        diff_index += 1
                        
                    if diff_index<len(pane.diff):
                    
                        d = pane.diff[diff_index]

                        if d[0] <= index+1 < d[0]+d[1]:
                            attr = attribute_differ[ d[2] ]
                        elif d[0]==index+2 and d[1]==0:
                            attr = attribute_differ_0[ d[2] ]
                        elif diff_index+1<len(pane.diff) and pane.diff[diff_index+1][0]==index+2 and pane.diff[diff_index+1][1]==0:
                            attr = attribute_differ_0[ pane.diff[diff_index+1][2] ]
                
                    str_lineno = str(index+1)
                    self.putString( x, y+i, width, 1, attribute_lineno, " "+" "*(keta-len(str_lineno))+str_lineno+" " )

                    self.putString( x+keta+2, y+i, width-keta+2, 1, attr, " " * (width-(keta+2)) )
                    self.putString( x+keta+2, y+i, width-keta+2, 1, attr, ckit.expandTab(self,pane.lines[index]) )
                else:
                    self.putString( x, y+i, width, 1, attribute_normal, " " * width )

            pane.status_message = "%d / %d : %s" % ( pane.scroll_info.pos+1, len(pane.lines), pane.encoding )
            pane.status_message = ckit.adjustStringWidth( self, pane.status_message, width, ckit.ALIGN_CENTER )
예제 #11
0
def itemformat_NameExt( window, item, width, userdata ):
    return ckit.adjustStringWidth( window, item.getNameNfc(), width, ckit.ALIGN_LEFT, ckit.ELLIPSIS_RIGHT )
예제 #12
0
    def paint(self):

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

        if self.status_bar:
            line0=( LINE_BOTTOM, ckit.getColor("file_cursor") )
            attribute_normal = ckit.Attribute( fg=ckit.getColor("fg"))
            attribute_normal_selected = ckit.Attribute( fg=ckit.getColor("fg"), line0=line0 )
            attribute_normal_marked = ckit.Attribute( fg=ckit.getColor("fg"), bg_gradation=( ckit.getColor("bookmark_file_bg1"), ckit.getColor("bookmark_file_bg2"), ckit.getColor("bookmark_file_bg1"), ckit.getColor("bookmark_file_bg2")) )
            attribute_normal_marked_selected = ckit.Attribute( fg=ckit.getColor("fg"), bg_gradation=( ckit.getColor("bookmark_file_bg1"), ckit.getColor("bookmark_file_bg2"), ckit.getColor("bookmark_file_bg1"), ckit.getColor("bookmark_file_bg2")), line0=line0 )
        else:
            attribute_normal = ckit.Attribute( fg=ckit.getColor("fg"))
            attribute_normal_selected = ckit.Attribute( fg=ckit.getColor("fg"), bg_gradation=( ckit.getColor("select_file_bg1"), ckit.getColor("select_file_bg2"), ckit.getColor("select_file_bg1"), ckit.getColor("select_file_bg2")) )
            attribute_normal_marked = ckit.Attribute( fg=ckit.getColor("fg"), bg_gradation=( ckit.getColor("bookmark_file_bg1"), ckit.getColor("bookmark_file_bg2"), ckit.getColor("bookmark_file_bg1"), ckit.getColor("bookmark_file_bg2")) )
            attribute_normal_marked_selected = attribute_normal_selected
        
        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 isinstance(item,ListItem):
                    name = item.name
                    mark = item.mark
                else:
                    name = item
                    mark = False

                name = unicodedata.normalize( "NFC", name )

                if self.select==index:
                    if mark:
                        attr=attribute_normal_marked_selected
                    else:
                        attr=attribute_normal_selected
                elif mark:
                    attr=attribute_normal_marked    
                else:
                    attr=attribute_normal

                self.putString( x, y+i, width, 1, attr, " " * width )
                self.putString( x, y+i, width, 1, attr, name )
            else:
                self.putString( x, y+i, width, 1, attribute_normal, " " * width )

        if self.status_bar:
            if self.isearch:
                attr = ckit.Attribute( fg=ckit.getColor("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)