def __init__(self, core: ApartCore, z_options: List[str]):
Gtk.Stack.__init__(self)
self.core = core
self.z_options = z_options
self.get_style_context().add_class('progress-view')
self.next_notification = NotificationHelper()
self.nothing_label = Gtk.Label('Select a partition to clone', xalign=0.5, vexpand=True)
self.nothing_label.get_style_context().add_class('dim-label')
self.add(self.nothing_label)
self.content = Gtk.VBox(valign=Gtk.Align.START)
self.add(self.content)
self.running_jobs_label = Gtk.Label('Running', halign=Gtk.Align.START)
self.running_jobs_label.get_style_context().add_class('section-title')
self.content.add(self.running_jobs_label)
# self.running_jobs: Dict[str, RunningJob] = {} <- not compatible with 3.5
self.running_jobs = {}
self.running_jobs_grid = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL,
column_spacing=6,
row_spacing=6)
self.running_jobs_grid.get_style_context().add_class('jobs')
self.content.add(self.running_jobs_grid)
# self.finished_jobs: Dict[str, FinishedJob] = {} <- not compatible with 3.5
self.finished_jobs = {}
self.finished_jobs_label = Gtk.Label('History', halign=Gtk.Align.START)
self.finished_jobs_label.get_style_context().add_class('section-title')
self.content.add(self.finished_jobs_label)
self.finished_jobs_grid = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL,
column_spacing=6)
self.finished_jobs_grid.get_style_context().add_class('finished-jobs')
self.content.add(self.finished_jobs_grid)
self.show_all()
self.listener = MessageListener(message_predicate=lambda m: m['type'] in ['clone',
'restore',
'clone-failed',
'restore-failed'],
on_message=lambda m: GLib.idle_add(self.on_job_message, m),
listen_to=core)
GLib.timeout_add(interval=1000, function=self.update_jobs)
self.connect('destroy', self.save_history)
GLib.idle_add(self.read_history)
评论列表
文章目录