def do_create_configure_widget(self): table = Gtk.Table(3, 2, Gtk.true()) table.set_row_spacings(5) table.set_col_spacings(5) lbl_racerpath = Gtk.Label("Racer path: ") lbl_rustsrc = Gtk.Label("Rust source path: ") self.txt_racerpath = Gtk.TextView() self.txt_rustsrc = Gtk.TextView() rust_src_path = self.racer.get_rust_src_path() racer_path = self.racer.get_racer_path() self.txt_racerpath.get_buffer().set_text(racer_path) self.txt_rustsrc.get_buffer().set_text(rust_src_path) btn_save = Gtk.Button("Save") btn_save.connect("clicked", self.on_btn_save_clicked) table.attach(lbl_racerpath, 0, 1, 0, 1) table.attach(lbl_rustsrc, 0, 1, 1, 2) table.attach(self.txt_racerpath, 1, 2, 0, 1) table.attach(self.txt_rustsrc, 1, 2, 1, 2) table.attach(btn_save, 0, 2, 2, 3) return table
def __init__(self, title, cb, partitionsToReuse=True): # pylint: disable-msg=W0231 Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL, spacing=6) self.members = [] self.pageTitle = title # Create a box where we store the "Here's how you create a new blah" info. self._createBox = Gtk.Grid() self._createBox.set_row_spacing(6) self._createBox.set_column_spacing(6) self._createBox.set_margin_left(16) label = Gtk.Label(_("You haven't created any mount points for your " "%(product)s %(version)s installation yet. " "You can:") % {"product" : productName, "version" : productVersion}) label.set_line_wrap(True) label.set_alignment(0, 0.5) self._createBox.attach(label, 0, 0, 2, 1) dot = Gtk.Label("•") dot.set_hexpand(False) self._createBox.attach(dot, 0, 1, 1, 1) self._createNewButton = Gtk.LinkButton("", label=_("_Click here to create them automatically.")) label = self._createNewButton.get_children()[0] label.set_alignment(0, 0.5) label.set_hexpand(True) label.set_line_wrap(True) label.set_use_underline(True) self._createNewButton.set_has_tooltip(False) self._createNewButton.set_halign(Gtk.Align.START) self._createNewButton.connect("clicked", cb) self._createNewButton.connect("activate-link", lambda *args: Gtk.true()) self._createBox.attach(self._createNewButton, 1, 1, 1, 1) dot = Gtk.Label("•") dot.set_hexpand(False) self._createBox.attach(dot, 0, 2, 1, 1) label = Gtk.Label(_("Create new mount points by clicking the '+' button.")) label.set_alignment(0, 0.5) label.set_hexpand(True) label.set_line_wrap(True) self._createBox.attach(label, 1, 2, 1, 1) if partitionsToReuse: dot = Gtk.Label("•") dot.set_hexpand(False) self._createBox.attach(dot, 0, 3, 1, 1) label = Gtk.Label(_("Or, assign new mount points to existing partitions after selecting them below.")) label.set_alignment(0, 0.5) label.set_hexpand(True) label.set_line_wrap(True) self._createBox.attach(label, 1, 3, 1, 1) self.add(self._createBox)
def create_form_view(form, values=None, use_markup=True): FormView.schema_type = form form_view = FormView() for field_i in form_view.form.schema.field_schema: name_i = field_i.name form_field_i = form_view.form.fields[name_i] if values and name_i in values: value = values[name_i] else: value = form_field_i.element.default_value if not form_field_i.element.set(value): raise ValueError('"%s" is not a valid value for field "%s"' % (value, name_i)) form_field_i.proxy.set_widget_value(value) if hasattr(form_field_i.widget, 'set_activates_default'): form_field_i.widget.set_activates_default(Gtk.true()) form_field_i.label_widget.set_use_markup(use_markup) return form_view
def __init__(self, title, createClickedCB, autopartTypeChangedCB, partitionsToReuse=True): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL, spacing=6) self.members = [] self.pageTitle = title # Create a box where we store the "Here's how you create a new blah" info. self._createBox = Gtk.Grid() self._createBox.set_row_spacing(6) self._createBox.set_column_spacing(6) self._createBox.set_margin_left(16) label = Gtk.Label(_("You haven't created any mount points for your %s %s installation yet. You can:") % (productName, productVersion)) label.set_line_wrap(True) label.set_alignment(0, 0.5) self._createBox.attach(label, 0, 0, 2, 1) dot = Gtk.Label("•") dot.set_alignment(0.5, 0.4) dot.set_hexpand(False) self._createBox.attach(dot, 0, 1, 1, 1) self._createNewButton = Gtk.LinkButton("", label=_("_Click here to create them automatically.")) label = self._createNewButton.get_children()[0] label.set_alignment(0, 0.5) label.set_hexpand(True) label.set_line_wrap(True) label.set_use_underline(True) # Create this now to pass into the callback. It will be populated later # on in this method. combo = Gtk.ComboBoxText() combo.connect("changed", autopartTypeChangedCB) self._createNewButton.set_has_tooltip(False) self._createNewButton.set_halign(Gtk.Align.START) self._createNewButton.connect("clicked", createClickedCB, combo) self._createNewButton.connect("activate-link", lambda *args: Gtk.true()) self._createBox.attach(self._createNewButton, 1, 1, 1, 1) dot = Gtk.Label("•") dot.set_alignment(0.5, 0) dot.set_hexpand(False) self._createBox.attach(dot, 0, 2, 1, 1) label = Gtk.Label(_("Create new mount points by clicking the '+' button.")) label.set_alignment(0, 0.5) label.set_hexpand(True) label.set_line_wrap(True) self._createBox.attach(label, 1, 2, 1, 1) if partitionsToReuse: dot = Gtk.Label("•") dot.set_alignment(0.5, 0) dot.set_hexpand(False) self._createBox.attach(dot, 0, 3, 1, 1) label = Gtk.Label(_("Or, assign new mount points to existing partitions after selecting them below.")) label.set_alignment(0, 0.5) label.set_hexpand(True) label.set_line_wrap(True) self._createBox.attach(label, 1, 3, 1, 1) label = Gtk.Label(_("_New mount points will use the following partitioning scheme:")) label.set_alignment(0, 0.5) label.set_line_wrap(True) label.set_use_underline(True) self._createBox.attach(label, 0, 4, 2, 1) label.set_mnemonic_widget(combo) combo.append_text(_("Standard Partition")) combo.append_text(_("BTRFS")) combo.append_text(_("LVM")) combo.append_text(_("LVM Thin Provisioning")) combo.set_active(2) combo.set_margin_left(18) combo.set_margin_right(18) combo.set_hexpand(False) self._createBox.attach(combo, 0, 5, 2, 1) self.add(self._createBox)
def __init__(self, title, createClickedCB, autopartTypeChangedCB, partitionsToReuse=True): # pylint: disable=super-init-not-called,non-parent-init-called Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL, spacing=6) self.members = [] self.pageTitle = title # Create a box where we store the "Here's how you create a new blah" info. self._createBox = Gtk.Grid() self._createBox.set_row_spacing(6) self._createBox.set_column_spacing(6) self._createBox.set_margin_left(16) label = Gtk.Label(label=_("You haven't created any mount points for your " "%(product)s %(version)s installation yet. " "You can:") % {"product" : productName, "version" : productVersion}, wrap=True, xalign=0, yalign=0.5) self._createBox.attach(label, 0, 0, 2, 1) dot = Gtk.Label(label="•", xalign=0.5, yalign=0.4, hexpand=False) self._createBox.attach(dot, 0, 1, 1, 1) self._createNewButton = Gtk.LinkButton(uri="", label=C_("GUI|Custom Partitioning|Autopart Page", "_Click here to create them automatically.")) label = self._createNewButton.get_children()[0] label.set_alignment(0, 0.5) label.set_hexpand(True) label.set_line_wrap(True) label.set_use_underline(True) # Create this now to pass into the callback. It will be populated later # on in this method. store = Gtk.ListStore(str, int) combo = Gtk.ComboBox(model=store) cellrendr = Gtk.CellRendererText() combo.pack_start(cellrendr, True) combo.add_attribute(cellrendr, "text", 0) combo.connect("changed", autopartTypeChangedCB) self._createNewButton.set_has_tooltip(False) self._createNewButton.set_halign(Gtk.Align.START) self._createNewButton.connect("clicked", createClickedCB, combo) self._createNewButton.connect("activate-link", lambda *args: Gtk.true()) self._createBox.attach(self._createNewButton, 1, 1, 1, 1) dot = Gtk.Label(label="•", xalign=0.5, yalign=0, hexpand=False) self._createBox.attach(dot, 0, 2, 1, 1) label = Gtk.Label(label=_("Create new mount points by clicking the '+' button."), xalign=0, yalign=0.5, hexpand=True, wrap=True) self._createBox.attach(label, 1, 2, 1, 1) if partitionsToReuse: dot = Gtk.Label(label="•", xalign=0.5, yalign=0, hexpand=False) self._createBox.attach(dot, 0, 3, 1, 1) label = Gtk.Label(label=_("Or, assign new mount points to existing " "partitions after selecting them below."), xalign=0, yalign=0.5, hexpand=True, wrap=True) self._createBox.attach(label, 1, 3, 1, 1) label = Gtk.Label(label=C_("GUI|Custom Partitioning|Autopart Page", "_New mount points will use the following partitioning scheme:"), xalign=0, yalign=0.5, wrap=True, use_underline=True) self._createBox.attach(label, 0, 4, 2, 1) label.set_mnemonic_widget(combo) autopart_choices = (c for c in AUTOPART_CHOICES if is_supported_device_type(AUTOPART_DEVICE_TYPES[c[1]])) default = None for name, code in autopart_choices: itr = store.append([_(name), code]) if code == DEFAULT_AUTOPART_TYPE: default = itr combo.set_margin_left(18) combo.set_margin_right(18) combo.set_hexpand(False) combo.set_active_iter(default or store.get_iter_first()) self._createBox.attach(combo, 0, 5, 2, 1) self.add(self._createBox)
def __init__(self, title, createClickedCB, autopartTypeChangedCB, partitionsToReuse=True): super().__init__(title) # Create a box where we store the "Here's how you create a new blah" info. self._createBox = Gtk.Grid() self._createBox.set_row_spacing(6) self._createBox.set_column_spacing(6) self._createBox.set_margin_left(16) label = Gtk.Label( label=_("You haven't created any mount points for your " "%(product)s %(version)s installation yet. " "You can:") % { "product": productName, "version": productVersion }, wrap=True, xalign=0, yalign=0.5) self._createBox.attach(label, 0, 0, 2, 1) dot = Gtk.Label(label="•", xalign=0.5, yalign=0.4, hexpand=False) self._createBox.attach(dot, 0, 1, 1, 1) self._createNewButton = Gtk.LinkButton( uri="", label=C_("GUI|Custom Partitioning|Autopart Page", "_Click here to create them automatically.")) label = self._createNewButton.get_children()[0] label.set_alignment(0, 0.5) label.set_hexpand(True) label.set_line_wrap(True) label.set_use_underline(True) # Create this now to pass into the callback. It will be populated later # on in this method. store = Gtk.ListStore(str, int) combo = Gtk.ComboBox(model=store) cellrendr = Gtk.CellRendererText() combo.pack_start(cellrendr, True) combo.add_attribute(cellrendr, "text", 0) combo.connect("changed", autopartTypeChangedCB) self._createNewButton.set_has_tooltip(False) self._createNewButton.set_halign(Gtk.Align.START) self._createNewButton.connect("clicked", createClickedCB, combo) self._createNewButton.connect("activate-link", lambda *args: Gtk.true()) self._createBox.attach(self._createNewButton, 1, 1, 1, 1) dot = Gtk.Label(label="•", xalign=0.5, yalign=0, hexpand=False) self._createBox.attach(dot, 0, 2, 1, 1) label = Gtk.Label( label=_("Create new mount points by clicking the '+' button."), xalign=0, yalign=0.5, hexpand=True, wrap=True) self._createBox.attach(label, 1, 2, 1, 1) if partitionsToReuse: dot = Gtk.Label(label="•", xalign=0.5, yalign=0, hexpand=False) self._createBox.attach(dot, 0, 3, 1, 1) label = Gtk.Label(label=_( "Or, assign new mount points to existing " "partitions after selecting them below."), xalign=0, yalign=0.5, hexpand=True, wrap=True) self._createBox.attach(label, 1, 3, 1, 1) label = Gtk.Label(label=C_( "GUI|Custom Partitioning|Autopart Page", "_New mount points will use the following partitioning scheme:"), xalign=0, yalign=0.5, wrap=True, use_underline=True) self._createBox.attach(label, 0, 4, 2, 1) label.set_mnemonic_widget(combo) autopart_choices = ( c for c in AUTOPART_CHOICES if is_supported_device_type(AUTOPART_DEVICE_TYPES[c[1]])) default = None for name, code in autopart_choices: itr = store.append([_(name), code]) if code == DEFAULT_AUTOPART_TYPE: default = itr combo.set_margin_left(18) combo.set_margin_right(18) combo.set_hexpand(False) combo.set_active_iter(default or store.get_iter_first()) self._createBox.attach(combo, 0, 5, 2, 1) self.add(self._createBox)
def _on_context_menu(self, webview, context, event, hit): return Gtk.true()
def __init__(self, title, cb, partitionsToReuse=True): # pylint: disable-msg=W0231 Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL, spacing=6) self.members = [] self.pageTitle = title # Create a box where we store the "Here's how you create a new blah" info. self._createBox = Gtk.Grid() self._createBox.set_row_spacing(6) self._createBox.set_column_spacing(6) self._createBox.set_margin_left(16) label = Gtk.Label( _("You haven't created any mount points for your " "%(product)s %(version)s installation yet. " "You can:") % { "product": productName, "version": productVersion }) label.set_line_wrap(True) label.set_alignment(0, 0.5) self._createBox.attach(label, 0, 0, 2, 1) dot = Gtk.Label("•") dot.set_hexpand(False) self._createBox.attach(dot, 0, 1, 1, 1) self._createNewButton = Gtk.LinkButton( "", label=_("_Click here to create them automatically.")) label = self._createNewButton.get_children()[0] label.set_alignment(0, 0.5) label.set_hexpand(True) label.set_line_wrap(True) label.set_use_underline(True) self._createNewButton.set_has_tooltip(False) self._createNewButton.set_halign(Gtk.Align.START) self._createNewButton.connect("clicked", cb) self._createNewButton.connect("activate-link", lambda *args: Gtk.true()) self._createBox.attach(self._createNewButton, 1, 1, 1, 1) dot = Gtk.Label("•") dot.set_hexpand(False) self._createBox.attach(dot, 0, 2, 1, 1) label = Gtk.Label( _("Create new mount points by clicking the '+' button.")) label.set_alignment(0, 0.5) label.set_hexpand(True) label.set_line_wrap(True) self._createBox.attach(label, 1, 2, 1, 1) if partitionsToReuse: dot = Gtk.Label("•") dot.set_hexpand(False) self._createBox.attach(dot, 0, 3, 1, 1) label = Gtk.Label( _("Or, assign new mount points to existing partitions after selecting them below." )) label.set_alignment(0, 0.5) label.set_hexpand(True) label.set_line_wrap(True) self._createBox.attach(label, 1, 3, 1, 1) self.add(self._createBox)
def __init__(self, title, createClickedCB, autopartTypeChangedCB, partitionsToReuse=True): # pylint: disable=W0231,W0233 Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL, spacing=6) self.members = [] self.pageTitle = title # Create a box where we store the "Here's how you create a new blah" info. self._createBox = Gtk.Grid() self._createBox.set_row_spacing(6) self._createBox.set_column_spacing(6) self._createBox.set_margin_left(16) label = Gtk.Label(label=_("You haven't created any mount points for your " "%(product)s %(version)s installation yet. " "You can:") % {"product" : productName, "version" : productVersion}, wrap=True, xalign=0, yalign=0.5) self._createBox.attach(label, 0, 0, 2, 1) dot = Gtk.Label(label="•", xalign=0.5, yalign=0.4, hexpand=False) self._createBox.attach(dot, 0, 1, 1, 1) self._createNewButton = Gtk.LinkButton(uri="", label=_("_Click here to create them automatically.")) label = self._createNewButton.get_children()[0] label.set_alignment(0, 0.5) label.set_hexpand(True) label.set_line_wrap(True) label.set_use_underline(True) # Create this now to pass into the callback. It will be populated later # on in this method. combo = Gtk.ComboBoxText() combo.connect("changed", autopartTypeChangedCB) self._createNewButton.set_has_tooltip(False) self._createNewButton.set_halign(Gtk.Align.START) self._createNewButton.connect("clicked", createClickedCB, combo) self._createNewButton.connect("activate-link", lambda *args: Gtk.true()) self._createBox.attach(self._createNewButton, 1, 1, 1, 1) dot = Gtk.Label(label="•", xalign=0.5, yalign=0, hexpand=False) self._createBox.attach(dot, 0, 2, 1, 1) label = Gtk.Label(label=_("Create new mount points by clicking the '+' button."), xalign=0, yalign=0.5, hexpand=True, wrap=True) self._createBox.attach(label, 1, 2, 1, 1) if partitionsToReuse: dot = Gtk.Label(label="•", xalign=0.5, yalign=0, hexpand=False) self._createBox.attach(dot, 0, 3, 1, 1) label = Gtk.Label(label=_("Or, assign new mount points to existing partitions after selecting them below."), xalign=0, yalign=0.5, hexpand=True, wrap=True) self._createBox.attach(label, 1, 3, 1, 1) label = Gtk.Label(label=_("_New mount points will use the following partitioning scheme:"), xalign=0, yalign=0.5, wrap=True, use_underline=True) self._createBox.attach(label, 0, 4, 2, 1) label.set_mnemonic_widget(combo) combo.append_text(_("Standard Partition")) combo.append_text(_("BTRFS")) combo.append_text(_("LVM")) combo.append_text(_("LVM Thin Provisioning")) combo.set_active(2) combo.set_margin_left(18) combo.set_margin_right(18) combo.set_hexpand(False) self._createBox.attach(combo, 0, 5, 2, 1) self.add(self._createBox)
def __init__(self, title, createClickedCB, autopartTypeChangedCB, partitionsToReuse=True): # pylint: disable=super-init-not-called,non-parent-init-called Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL, spacing=6) self.members = [] self.pageTitle = title # Create a box where we store the "Here's how you create a new blah" info. self._createBox = Gtk.Grid() self._createBox.set_row_spacing(6) self._createBox.set_column_spacing(6) self._createBox.set_margin_left(16) label = Gtk.Label( label=_("You haven't created any mount points for your " "%(product)s %(version)s installation yet. " "You can:") % { "product": productName, "version": productVersion }, wrap=True, xalign=0, yalign=0.5) self._createBox.attach(label, 0, 0, 2, 1) dot = Gtk.Label(label="•", xalign=0.5, yalign=0.4, hexpand=False) self._createBox.attach(dot, 0, 1, 1, 1) self._createNewButton = Gtk.LinkButton( uri="", label=_("_Click here to create them automatically.")) label = self._createNewButton.get_children()[0] label.set_alignment(0, 0.5) label.set_hexpand(True) label.set_line_wrap(True) label.set_use_underline(True) # Create this now to pass into the callback. It will be populated later # on in this method. store = Gtk.ListStore(str, int) combo = Gtk.ComboBox(model=store) cellrendr = Gtk.CellRendererText() combo.pack_start(cellrendr, True) combo.add_attribute(cellrendr, "text", 0) combo.connect("changed", autopartTypeChangedCB) self._createNewButton.set_has_tooltip(False) self._createNewButton.set_halign(Gtk.Align.START) self._createNewButton.connect("clicked", createClickedCB, combo) self._createNewButton.connect("activate-link", lambda *args: Gtk.true()) self._createBox.attach(self._createNewButton, 1, 1, 1, 1) dot = Gtk.Label(label="•", xalign=0.5, yalign=0, hexpand=False) self._createBox.attach(dot, 0, 2, 1, 1) label = Gtk.Label( label=_("Create new mount points by clicking the '+' button."), xalign=0, yalign=0.5, hexpand=True, wrap=True) self._createBox.attach(label, 1, 2, 1, 1) if partitionsToReuse: dot = Gtk.Label(label="•", xalign=0.5, yalign=0, hexpand=False) self._createBox.attach(dot, 0, 3, 1, 1) label = Gtk.Label(label=_( "Or, assign new mount points to existing " "partitions after selecting them below."), xalign=0, yalign=0.5, hexpand=True, wrap=True) self._createBox.attach(label, 1, 3, 1, 1) label = Gtk.Label(label=_( "_New mount points will use the following partitioning scheme:"), xalign=0, yalign=0.5, wrap=True, use_underline=True) self._createBox.attach(label, 0, 4, 2, 1) label.set_mnemonic_widget(combo) for item in (AUTOPART_CHOICES): itr = store.append([_(item[0]), item[1]]) if item[1] == DEFAULT_AUTOPART_TYPE: default = itr combo.set_margin_left(18) combo.set_margin_right(18) combo.set_hexpand(False) combo.set_active_iter(default) self._createBox.attach(combo, 0, 5, 2, 1) self.add(self._createBox)