def __init__(self, parent): Gtk.Box.__init__(self, False, 0) self.ppa = ppa.PPA(self) self.handlers = {} self.parent = parent self.source_check = Gtk.CheckButton(label="Include source code") self.proposed_check = Gtk.CheckButton() settings_grid = Gtk.Grid() settings_grid.set_margin_left(12) settings_grid.set_margin_top(24) settings_grid.set_margin_right(12) settings_grid.set_margin_bottom(12) settings_grid.set_hexpand(True) settings_grid.set_halign(Gtk.Align.CENTER) self.add(settings_grid) sources_title = Gtk.Label("Official Sources") sources_title.set_halign(Gtk.Align.START) Gtk.StyleContext.add_class(sources_title.get_style_context(), "h2") settings_grid.attach(sources_title, 0, 0, 1, 1) sources_label = Gtk.Label( "Official sources are those provided by Pop!_OS " + "and its developers. \nIt's recommended to leave " + "these sources enabled.") sources_label.set_line_wrap(True) sources_label.set_halign(Gtk.Align.START) settings_grid.attach(sources_label, 0, 1, 1, 1) self.checks_grid = Gtk.VBox() self.checks_grid.set_margin_left(12) self.checks_grid.set_margin_top(24) self.checks_grid.set_margin_right(12) self.checks_grid.set_margin_bottom(12) settings_grid.attach(self.checks_grid, 0, 2, 1, 1) developer_options = Gtk.Expander() developer_options.set_label("Developer Options (Advanced)") settings_grid.attach(developer_options, 0, 3, 1, 1) self.developer_grid = Gtk.VBox() self.developer_grid.set_margin_left(12) self.developer_grid.set_margin_top(24) self.developer_grid.set_margin_right(12) self.developer_grid.set_margin_bottom(12) developer_options.add(self.developer_grid) developer_label = Gtk.Label("These options are those which are " + "primarily of interest to \ndevelopers.") developer_label.set_line_wrap(True) self.developer_grid.add(developer_label) self.developer_grid.add(self.source_check) self.developer_grid.add(self.proposed_check) self.init_distro() self.show_distro()
def __init__(self, parent): self.ppa = ppa.PPA(self) Gtk.HeaderBar.__init__(self) self.parent = parent self.set_show_close_button(True) self.set_has_subtitle(False) self.switcher = Gtk.StackSwitcher() self.switcher.set_baseline_position(Gtk.BaselinePosition.CENTER) self.set_custom_title(self.switcher) self.buttonbox = Gtk.Box() self.pack_end(self.buttonbox) # spinner self.spinner = Gtk.Spinner() self.buttonbox.add(self.spinner)
def __init__(self, parent): Gtk.Box.__init__(self, False, 0) self.ppa = p.PPA(self) self.parent = parent self.set_border_width(80) #win.resize(800,400) self.set_orientation(Gtk.Orientation.VERTICAL) description = Gtk.Label("Enter source line (ex: ppa:mirkobrombin/ppa) and press Enter") description.set_name('Description') description.set_justify(Gtk.Justification.CENTER) self.add(description) validate = Gtk.Label("Waiting for source") self.validate = validate validate.set_name('Validate') validate.set_justify(Gtk.Justification.CENTER) entry_grid = Gtk.Grid() self.add(entry_grid) entry = Gtk.Entry() entry.set_placeholder_text("Enter source line here...") entry.connect("key-release-event", self.on_entry_key_release) entry.connect("activate", self.on_entry_activate) entry.set_hexpand(True) entry_grid.attach(entry, 0, 0, 1, 1) # Add button ppa_add = Gtk.Button("Add") ppa_add.connect("clicked", self.on_entry_activate) Gtk.StyleContext.add_class(ppa_add.get_style_context(), "suggested-action") entry_grid.attach(ppa_add, 1, 0, 1, 1) self.add(validate)
def __init__(self, parent): self.sp = SoftwareProperties() Gtk.Box.__init__(self, False, 0) self.parent = parent self.ppa = ppa.PPA(self) self.content_grid = Gtk.Grid() self.content_grid.set_margin_top(24) self.content_grid.set_margin_left(12) self.content_grid.set_margin_right(12) self.content_grid.set_margin_bottom(12) self.content_grid.set_row_spacing(6) self.content_grid.set_hexpand(True) self.content_grid.set_vexpand(True) self.add(self.content_grid) sources_title = Gtk.Label("Extra Sources") Gtk.StyleContext.add_class(sources_title.get_style_context(), "h2") sources_title.set_halign(Gtk.Align.START) self.content_grid.attach(sources_title, 0, 0, 1, 1) sources_label = Gtk.Label( "These sources are for software provided by " + "a third party. They may present a security " + "risk or can cause system instability. " + "\nOnly add sources that you trust.") sources_label.set_line_wrap(True) sources_label.set_halign(Gtk.Align.START) sources_label.set_justify(Gtk.Justification.FILL) sources_label.set_hexpand(True) self.content_grid.attach(sources_label, 0, 1, 1, 1) list_grid = Gtk.Grid() self.content_grid.attach(list_grid, 0, 2, 1, 1) list_window = Gtk.ScrolledWindow() list_grid.attach(list_window, 0, 0, 1, 1) self.ppa_liststore = Gtk.ListStore(str, str) self.view = Gtk.TreeView(self.ppa_liststore) renderer = Gtk.CellRendererText() column = Gtk.TreeViewColumn('Source', renderer, markup=0) self.view.append_column(column) self.view.set_hexpand(True) self.view.set_vexpand(True) tree_selection = self.view.get_selection() tree_selection.connect('changed', self.on_row_change) list_window.add(self.view) # add button add_button = Gtk.Button.new_from_icon_name("list-add-symbolic", Gtk.IconSize.SMALL_TOOLBAR) Gtk.StyleContext.add_class(add_button.get_style_context(), "image-button") add_button.set_tooltip_text("Add New Source") add_button.connect("clicked", self.on_add_button_clicked) # edit button edit_button = Gtk.Button.new_from_icon_name("edit-symbolic", Gtk.IconSize.SMALL_TOOLBAR) Gtk.StyleContext.add_class(edit_button.get_style_context(), "image-button") edit_button.set_tooltip_text("Modify Selected Source") edit_button.connect("clicked", self.on_edit_button_clicked) action_bar = Gtk.ActionBar() Gtk.StyleContext.add_class(action_bar.get_style_context(), "inline-toolbar") action_bar.add(edit_button) action_bar.add(add_button) list_grid.attach(action_bar, 0, 1, 1, 1) self.generate_entries(self.ppa.get_isv())
def __init__(self, parent, repo_type, repo_uri, repo_version, repo_component, repo_archs): Gtk.Dialog.__init__(self, "Modify Source", parent, 0, (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_SAVE, Gtk.ResponseType.OK), modal=1, use_header_bar=1) self.ppa = ppa.PPA(self) self.parent = parent content_area = self.get_content_area() content_grid = Gtk.Grid() content_grid.set_margin_top(24) content_grid.set_margin_left(12) content_grid.set_margin_right(12) content_grid.set_margin_bottom(12) content_grid.set_column_spacing(12) content_grid.set_row_spacing(6) content_grid.set_halign(Gtk.Align.FILL) content_grid.set_hexpand(True) content_area.add(content_grid) type_label = Gtk.Label("Type") type_label.set_halign(Gtk.Align.END) uri_label = Gtk.Label("URI") uri_label.set_halign(Gtk.Align.END) version_label = Gtk.Label("Version") version_label.set_halign(Gtk.Align.END) component_label = Gtk.Label("Component") component_label.set_halign(Gtk.Align.END) content_grid.attach(type_label, 0, 0, 1, 1) content_grid.attach(uri_label, 0, 1, 1, 1) content_grid.attach(version_label, 0, 2, 1, 1) content_grid.attach(component_label, 0, 3, 1, 1) self.type_box = Gtk.ComboBoxText() self.type_box.append("deb", "Binary") self.type_box.append("deb-src", "Source code") self.type_box.set_active_id(repo_type) content_grid.attach(self.type_box, 1, 0, 1, 1) self.uri_entry = Gtk.Entry() self.uri_entry.set_hexpand(True) self.uri_entry.set_placeholder_text("https://ppa.launchpad.net/...") self.uri_entry.set_text(repo_uri) self.uri_entry.set_activates_default(False) self.uri_entry.set_width_chars(40) content_grid.attach(self.uri_entry, 1, 1, 1, 1) self.version_entry = Gtk.Entry() self.version_entry.set_placeholder_text("artful") self.version_entry.set_text(repo_version) self.version_entry.set_activates_default(False) content_grid.attach(self.version_entry, 1, 2, 1, 1) self.component_entry = Gtk.Entry() self.component_entry.set_placeholder_text("main") self.component_entry.set_text(repo_component[0]) self.component_entry.set_activates_default(False) content_grid.attach(self.component_entry, 1, 3, 1, 1) remove_button = Gtk.Button.new_with_label("Remove Source") Gtk.StyleContext.add_class(remove_button.get_style_context(), "destructive-action") remove_button.set_margin_top(12) remove_button.connect("clicked", self.on_remove_button_clicked) content_grid.attach(remove_button, 0, 4, 1, 1) Gtk.StyleContext.add_class( self.get_widget_for_response( Gtk.ResponseType.OK).get_style_context(), "suggested-action") self.show_all()
def __init__(self, parent): Gtk.Box.__init__(self, False, 0) self.parent = parent self.ppa = ppa.PPA(self) self.handlers = {} updates_grid = Gtk.Grid() updates_grid.set_margin_left(12) updates_grid.set_margin_top(24) updates_grid.set_margin_right(12) updates_grid.set_margin_bottom(12) updates_grid.set_hexpand(True) updates_grid.set_halign(Gtk.Align.CENTER) self.add(updates_grid) updates_title = Gtk.Label("Update Sources") updates_title.set_halign(Gtk.Align.START) Gtk.StyleContext.add_class(updates_title.get_style_context(), "h2") updates_grid.attach(updates_title, 0, 0, 1, 1) updates_label = Gtk.Label( "These sources control how Pop!_OS will " + "check for updates. \nIt is recommended to " + "leave these sources enabled.") updates_label.set_line_wrap(True) updates_label.set_halign(Gtk.Align.START) updates_grid.attach(updates_label, 0, 1, 1, 1) self.checks_grid = Gtk.VBox() self.checks_grid.set_margin_left(12) self.checks_grid.set_margin_top(24) self.checks_grid.set_margin_right(12) self.checks_grid.set_margin_bottom(12) updates_grid.attach(self.checks_grid, 0, 2, 1, 1) separator = Gtk.HSeparator() updates_grid.attach(separator, 0, 3, 1, 1) self.notifications_title = Gtk.Label("Update Notifications") self.notifications_title.set_halign(Gtk.Align.START) Gtk.StyleContext.add_class( self.notifications_title.get_style_context(), "h2") updates_grid.attach(self.notifications_title, 0, 4, 1, 1) self.notifications_label = Gtk.Label( "Change how Pop!_OS notifies you " + "about pending software updates.") self.notifications_label.set_line_wrap(True) self.notifications_label.set_halign(Gtk.Align.CENTER) updates_grid.attach(self.notifications_label, 0, 5, 1, 1) self.noti_grid = Gtk.Grid() self.noti_grid.set_margin_left(12) self.noti_grid.set_margin_top(12) self.noti_grid.set_margin_right(12) self.noti_grid.set_margin_bottom(12) updates_grid.attach(self.noti_grid, 0, 6, 1, 1) notify_check = Gtk.CheckButton.new_with_label( "Notify about new updates") self.noti_grid.attach(notify_check, 0, 0, 1, 1) auto_check = Gtk.CheckButton.new_with_label( "Automatically install " + "important security updates.") self.noti_grid.attach(auto_check, 0, 1, 1, 1) version_check = Gtk.CheckButton.new_with_label( "Notify about new versions " + "of Pop!_OS") self.noti_grid.attach(version_check, 0, 2, 1, 1) self.init_updates() self.show_updates()