def __init__(self, transaction=None, parent=None, terminal=True, debconf=True): Gtk.Dialog.__init__(self, parent=parent) self._expanded_size = None self.debconf = debconf # Setup the dialog self.set_border_width(6) self.set_resizable(False) self.get_content_area().set_spacing(6) # Setup the cancel button self.button_cancel = AptCancelButton(transaction) self.get_action_area().pack_start(self.button_cancel, False, False, 0) # Setup the status icon, label and progressbar hbox = Gtk.HBox() hbox.set_spacing(12) hbox.set_border_width(6) self.icon = AptRoleIcon() hbox.pack_start(self.icon, False, True, 0) vbox = Gtk.VBox() vbox.set_spacing(12) self.label_role = Gtk.Label() self.label_role.set_alignment(0, 0) vbox.pack_start(self.label_role, False, True, 0) vbox_progress = Gtk.VBox() vbox_progress.set_spacing(6) self.progress = AptProgressBar() vbox_progress.pack_start(self.progress, False, True, 0) self.label = AptStatusLabel() self.label._on_status_changed(None, STATUS_WAITING) vbox_progress.pack_start(self.label, False, True, 0) vbox.pack_start(vbox_progress, False, True, 0) hbox.pack_start(vbox, True, True, 0) self.expander = AptDetailsExpander(terminal=terminal) self.expander.connect("notify::expanded", self._on_expanded) vbox.pack_start(self.expander, True, True, 0) self.get_content_area().pack_start(hbox, True, True, 0) self._transaction = None self._signals = [] self.set_title("") self.realize() self.progress.set_size_request(350, -1) functions = Gdk.WMFunction.MOVE | Gdk.WMFunction.RESIZE try: self.get_window().set_functions(functions) except TypeError: # workaround for older and broken GTK typelibs self.get_window().set_functions(Gdk.WMFunction(functions)) if transaction is not None: self.set_transaction(transaction) # catch ESC and behave as if cancel was clicked self.connect("delete-event", self._on_dialog_delete_event)
def __init__(self, task, parent=None): Gtk.Dialog.__init__(self, parent=parent) self.task = task self.finished = False # Progress goes directly to this window task.client_progress_cb = self.window_client_progress_cb # finished callbacks route thru the installer # but we want to see them in this window also. self.final_finished_cb = task.client_finished_cb task.client_finished_cb = self.window_client_finished_cb self.pulse_timer = 0 self.active_task_state = task.progress_state self.real_progress_text = None self.num_dots = 0 # Setup the dialog self.set_border_width(6) self.set_resizable(False) self.get_content_area().set_spacing(6) # Setup the cancel button self.button = Gtk.Button.new_from_stock(Gtk.STOCK_CANCEL) self.button.set_use_stock(True) self.get_action_area().pack_start(self.button, False, False, 0) self.button.connect("clicked", self.on_button_clicked) self.button.show() # labels and progressbar hbox = Gtk.HBox() hbox.set_spacing(12) hbox.set_border_width(6) vbox = Gtk.VBox() vbox.set_spacing(12) self.phase_label = Gtk.Label() vbox.pack_start(self.phase_label, False, False, 0) self.phase_label.set_halign(Gtk.Align.START) vbox_progress = Gtk.VBox() vbox_progress.set_spacing(6) self.progress = Gtk.ProgressBar() vbox_progress.pack_start(self.progress, False, True, 0) self.progress_label = Gtk.Label() vbox_progress.pack_start(self.progress_label, False, False, 0) self.progress_label.set_halign(Gtk.Align.START) self.progress_label.set_line_wrap(True) self.progress_label.set_max_width_chars(60) vbox.pack_start(vbox_progress, False, True, 0) hbox.pack_start(vbox, True, True, 0) self.get_content_area().pack_start(hbox, True, True, 0) self.set_title(_("Flatpak Progress")) XApp.set_window_icon_name(self, "system-software-installer") hbox.show_all() self.realize() self.progress.set_size_request(350, -1) functions = Gdk.WMFunction.MOVE | Gdk.WMFunction.RESIZE try: self.get_window().set_functions(functions) except TypeError: # workaround for older and broken GTK typelibs self.get_window().set_functions(Gdk.WMFunction(functions)) self.update_labels() # catch ESC and behave as if cancel was clicked self.connect("delete-event", self._on_dialog_delete_event)