PropertiesDialog.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:bcloud 作者: wangYanJava 项目源码 文件源码
def __init__(self, icon_window, app, path):
        file_path, file_name = os.path.split(path)
        # modify file_name if path is '/'
        if not file_name:
            file_name = '/'
        super().__init__(file_name + _(' Properties'), app.window,
                         Gtk.DialogFlags.MODAL,
                         (Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE))
        self.set_border_width(15)

        box = self.get_content_area()

        grid = Gtk.Grid()
        grid.props.row_spacing = 8
        if Config.GTK_GE_312:
            grid.props.margin_start = 15
        else:
            grid.props.margin_left = 15
        grid.props.column_spacing = 15
        box.pack_start(grid, True, True, 10)

        name_label = LeftLabel(_('Name:'))
        grid.attach(name_label, 0, 0, 1, 1)
        name_label2 = SelectableLeftLabel(file_name)
        grid.attach(name_label2, 1, 0, 1, 1)

        location_label = LeftLabel(_('Location:'))
        grid.attach(location_label, 0, 1, 1, 1)
        location_label2 = SelectableLeftLabel(file_path)
        grid.attach(location_label2, 1, 1, 1, 1)

        file_count = 0
        folder_count = 0
        for row in icon_window.liststore:
            if row[ISDIR_COL]:
                folder_count = folder_count + 1
            else:
                file_count = file_count + 1
        contents = _('{0} folders, {1} files').format(folder_count, file_count)
        content_label = LeftLabel(_('Contents:'))
        grid.attach(content_label, 0, 2, 1, 1)
        content_label2 = SelectableLeftLabel(contents)
        grid.attach(content_label2, 1, 2, 1, 1)

        box.show_all()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号