restoreentry.py 文件源码

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

项目:apart-gtk 作者: alexheretic 项目源码 文件源码
def __init__(self, main_view: 'MainView', core: ApartCore, z_options: List[str]):
        Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL, expand=True, halign=Gtk.Align.CENTER)
        self.main_view = main_view
        self.core = core
        self.z_options = z_options

        self.title = Gtk.Label('', xalign=0.5)
        self.title.get_style_context().add_class('dim-label')

        self.image_label = Gtk.Label("Image File", xalign=1.0)
        self.image_label.get_style_context().add_class('dim-label')
        self.image_entry = Gtk.FileChooserButton(title='Select Image File')
        image_file_filter = Gtk.FileFilter()
        image_file_filter.set_name('Apart Image files')
        for z_option in z_options:
            image_file_filter.add_pattern('*.apt.*.{}'.format(z_option))
            if z_option == 'zst':  # also support .zstd from v0.14
                image_file_filter.add_pattern('*.apt.*.zstd')
        self.image_entry.add_filter(image_file_filter)
        self.image_entry.connect('selection-changed', lambda v: self.on_image_select())

        self.options = Gtk.Grid(row_spacing=6)
        self.options.get_style_context().add_class('new-clone-options')
        self.options.attach(self.title, left=0, top=0, width=2, height=1)
        self.options.attach(self.image_label, left=0, top=1, width=1, height=1)
        self.options.attach(self.image_entry, left=1, top=1, width=1, height=1)

        self.cancel_btn = Gtk.Button('Cancel')
        self.cancel_btn.connect('clicked', lambda v: self.main_view.show_progress())
        self.start_btn = Gtk.Button('Restore Partition')
        self.start_btn.set_sensitive(False)
        self.start_btn.connect('clicked', lambda v: self.user_confirm())

        self.buttons = Gtk.Box(halign=Gtk.Align.END)
        self.buttons.get_style_context().add_class('new-clone-buttons')
        self.buttons.add(self.cancel_btn)
        self.buttons.add(self.start_btn)

        self.add(self.options)
        self.options.attach_next_to(self.buttons, sibling=self.image_label,
                                    side=Gtk.PositionType.BOTTOM, width=2, height=1)
        self.last_part_info = None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号