Python gi.repository.Gtk.RadioButton() Examples
The following are 8
code examples of gi.repository.Gtk.RadioButton().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
gi.repository.Gtk
, or try the search function
.
Example #1
Source File: abstract_tool.py From drawing with GNU General Public License v3.0 | 6 votes |
def build_row(self): """Build the GtkRadioButton for the sidebar. This method stores it as 'self.row', but does not pack it in the bar, and does not return it.""" self.row = Gtk.RadioButton(relief=Gtk.ReliefStyle.NONE, \ draw_indicator=False, valign=Gtk.Align.CENTER, \ tooltip_text=self.label) self.row.set_detailed_action_name('win.active_tool::' + self.id) self.label_widget = Gtk.Label(label=self.label) if self.get_settings().get_boolean('big-icons'): size = Gtk.IconSize.LARGE_TOOLBAR else: size = Gtk.IconSize.SMALL_TOOLBAR image = Gtk.Image().new_from_icon_name(self.icon_name, size) box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=8) box.add(image) box.add(self.label_widget) self.row.add(box) self.row.show_all()
Example #2
Source File: customwidgets.py From rednotebook with GNU General Public License v2.0 | 6 votes |
def add_radio_option(self, object, label, tooltip=""): sensitive = object.is_available() group = self.buttons[0] if self.buttons else None button = Gtk.RadioButton(group=group) button.set_tooltip_markup(tooltip) button.set_label(label) button.object = object button.set_sensitive(sensitive) self.pack_start(button, False, False, 0) self.buttons.append(button) if tooltip: description = Gtk.Label() description.set_alignment(0.0, 0.5) description.set_markup(" " * 10 + tooltip) description.set_sensitive(sensitive) self.pack_start(description, False, False, 0)
Example #3
Source File: import_tags.py From gtg with GNU General Public License v3.0 | 5 votes |
def _populate_gtk(self, width): """ Populates the widgets @param width: the length of the radio buttons """ title_label = Gtk.Label() title_label.set_alignment(xalign=0, yalign=0) title_label.set_markup(f"<big><b>{self.title}</b></big>") self.pack_start(title_label, True, True, 0) align = Gtk.Alignment.new(0, 0, 1, 0) align.set_padding(0, 0, 10, 0) self.pack_start(align, True, True, 0) vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) align.add(vbox) self.all_tags_radio = Gtk.RadioButton(group=None, label=self.anybox_text) vbox.pack_start(self.all_tags_radio, True, True, 0) self.some_tags_radio = Gtk.RadioButton(group=self.all_tags_radio, label=self.somebox_text) self.some_tags_radio.set_size_request(width=width, height=-1) box = Gtk.Box() vbox.pack_start(box, True, True, 0) box.pack_start(self.some_tags_radio, False, True, 0) self.tags_entry = Gtk.Entry() box.pack_start(self.tags_entry, True, True, 0)
Example #4
Source File: preferences.py From drawing with GNU General Public License v3.0 | 5 votes |
def build_radio_btn(self, label, btn_id, key, group): btn = Gtk.RadioButton(label=label, visible=True, group=group) active_id = self._settings.get_string(key) btn.set_active(btn_id == active_id) btn.connect('toggled', self.on_radio_btn_changed, key, btn_id) return btn
Example #5
Source File: dialogs.py From games_nebula with GNU General Public License v3.0 | 4 votes |
def create_list(self, options_list): message_dialog = Gtk.MessageDialog( None, 0, Gtk.MessageType.QUESTION, Gtk.ButtonsType.OK, _("Choose version:") ) message_dialog.set_default_size(360, 0) content_area = message_dialog.get_content_area() content_area.set_property('margin_top', 10) content_area.set_property('margin_bottom', 10) content_area.set_property('margin_left', 10) content_area.set_property('margin_right', 10) options_list = options_list.split(', ') def cb_radiobutton(radiobutton): self.option = radiobutton.get_label() box = Gtk.Box( orientation=Gtk.Orientation.VERTICAL, spacing = 10 ) radiobutton1 = Gtk.RadioButton( label = options_list[0] ) radiobutton1.connect('clicked', cb_radiobutton) box.pack_start(radiobutton1, True, True, 0) for i in range(1, len(options_list)): radiobutton = Gtk.RadioButton( label = options_list[i] ) radiobutton.connect('clicked', cb_radiobutton) radiobutton.join_group(radiobutton1) box.pack_start(radiobutton, True, True, 0) content_area.pack_start(box, True, True, 0) self.option = options_list[0] message_dialog.show_all() response = message_dialog.run() message_dialog.destroy() return self.option
Example #6
Source File: wizard.py From syncthing-gtk with GNU General Public License v2.0 | 4 votes |
def init_page(self): """ Permits user to set WebUI settings """ # Wall of text label = WrappedLabel( "<b>" + _("WebUI setup") + "</b>" + "\n\n" + _("Syncthing can be managed remotely using WebUI and " "even if you are going to use Syncthing-GTK, WebUI needs " "to be enabled, as Syncthing-GTK uses it to communicate " "with the Syncthing daemon.") + "\n\n" + _("If you prefer to be able to manage Syncthing remotely, " "over the internet or on your local network, select <b>listen " "on all interfaces</b> and set username and password to " "protect Syncthing from unauthorized access.") + "\n" + _("Otherwise, select <b>listen on localhost</b>, so only " "users and programs on this computer will be able to " "interact with Syncthing.") + "\n" ) # Radiobuttons lbl_radios = WrappedLabel("<b>" + _("WebUI Listen Addresses") + "</b>") self.rb_localhost = Gtk.RadioButton(label=_("Listen on _localhost")) self.rb_all_intfs = Gtk.RadioButton.new_from_widget(self.rb_localhost) self.rb_all_intfs.set_label(_("Listen on _all interfaces")) for x in (self.rb_localhost, self.rb_all_intfs): x.set_use_underline(True) x.set_property('margin-left', 15) # Username & password input boxes self.tx_username = Gtk.Entry() self.tx_password = Gtk.Entry() self.lbl_username = WrappedLabel(_("_Username")) self.lbl_password = WrappedLabel(_("_Password")) self.lbl_username.set_mnemonic_widget(self.tx_username) self.lbl_password.set_mnemonic_widget(self.tx_password) self.tx_password.set_visibility(False) self.tx_password.props.caps_lock_warning = True for x in (self.lbl_username, self.lbl_password): x.set_use_underline(True) x.set_property('margin-left', 45) x.set_property('margin-bottom', 5) for x in (self.tx_username, self.tx_password): x.set_property('margin-bottom', 5) # Connect signals for x in (self.rb_localhost, self.rb_all_intfs): x.connect("toggled", self.cb_stuff_changed) for x in (self.tx_username, self.tx_password): x.connect("changed", self.cb_stuff_changed) x.connect("delete-text", self.cb_stuff_changed) x.connect("insert-text", self.cb_stuff_changed) # Attach everything self.attach(label, 0, 0, 3, 1) self.attach(lbl_radios, 0, 1, 3, 1) self.attach(self.rb_localhost, 0, 2, 2, 1) self.attach(self.rb_all_intfs, 0, 3, 2, 1) self.attach(self.lbl_username, 0, 4, 1, 1) self.attach(self.lbl_password, 0, 5, 1, 1) self.attach(self.tx_username, 1, 4, 2, 1) self.attach(self.tx_password, 1, 5, 2, 1)
Example #7
Source File: exports.py From rednotebook with GNU General Public License v2.0 | 4 votes |
def __init__(self, journal, *args, **kwargs): AssistantPage.__init__(self, *args, **kwargs) self.journal = journal self.all_days_button = Gtk.RadioButton(label=_("Export all days")) self.selected_text_button = Gtk.RadioButton(group=self.all_days_button) self.one_day_button = Gtk.RadioButton( label=_("Export currently visible day"), group=self.all_days_button ) self.sel_days_button = Gtk.RadioButton( label=_("Export days in the selected time range"), group=self.all_days_button, ) self.pack_start(self.all_days_button, False, False, 0) self.pack_start(self.one_day_button, False, False, 0) self.pack_start(self.selected_text_button, False, False, 0) self.pack_start(self.sel_days_button, False, False, 0) label1 = Gtk.Label() label1.set_markup("<b>" + _("From:") + "</b>") label2 = Gtk.Label() label2.set_markup("<b>" + _("To:") + "</b>") show_week_numbers = self.journal.config.read("weekNumbers") self.calendar1 = Calendar(week_numbers=show_week_numbers) self.calendar2 = Calendar(week_numbers=show_week_numbers) vbox1 = Gtk.VBox() vbox2 = Gtk.VBox() vbox1.pack_start(label1, False, False, 0) vbox1.pack_start(self.calendar1, True, True, 0) vbox2.pack_start(label2, False, False, 0) vbox2.pack_start(self.calendar2, True, True, 0) hbox = Gtk.HBox() hbox.pack_start(vbox1, True, True, 0) hbox.pack_start(vbox2, True, True, 0) self.pack_start(hbox, True, True, 0) self.sel_days_button.connect("toggled", self._on_select_days_toggled) self.all_days_button.set_active(True) self._set_select_days(False)
Example #8
Source File: exports.py From rednotebook with GNU General Public License v2.0 | 4 votes |
def __init__(self, journal, assistant, *args, **kwargs): AssistantPage.__init__(self, *args, **kwargs) self.journal = journal self.assistant = assistant self.text_and_tags_button = Gtk.RadioButton(label=_("Export text and tags")) self.text_only_button = Gtk.RadioButton( label=_("Export text only"), group=self.text_and_tags_button ) self.tags_only_button = Gtk.RadioButton( label=_("Export tags only"), group=self.text_and_tags_button ) self.filter_tags_button = Gtk.CheckButton(label=_("Filter days by tags")) self.pack_start(self.text_and_tags_button, False, False, 0) self.pack_start(self.text_only_button, False, False, 0) self.pack_start(self.tags_only_button, False, False, 0) self.pack_start(Gtk.HSeparator(), False, False, 0) self.pack_start(self.filter_tags_button, False, False, 0) self.available_categories = customwidgets.CustomListView( [(_("Available tags"), str)] ) self.selected_categories = customwidgets.CustomListView( [(_("Selected tags"), str)] ) left_scroll = Gtk.ScrolledWindow() left_scroll.add(self.available_categories) right_scroll = Gtk.ScrolledWindow() right_scroll.add(self.selected_categories) self.select_button = Gtk.Button(_("Select") + " >>") self.deselect_button = Gtk.Button("<< " + _("Deselect")) self.select_button.connect("clicked", self.on_select_category) self.deselect_button.connect("clicked", self.on_deselect_category) centered_vbox = Gtk.VBox() centered_vbox.pack_start(self.select_button, True, False, 0) centered_vbox.pack_start(self.deselect_button, True, False, 0) vbox = Gtk.VBox() vbox.pack_start(centered_vbox, True, False, 0) hbox = Gtk.HBox() hbox.pack_start(left_scroll, True, True, 0) hbox.pack_start(vbox, False, False, 0) hbox.pack_start(right_scroll, True, True, 0) self.pack_start(hbox, True, True, 0) self.error_text = Gtk.Label(label="") self.error_text.set_alignment(0.0, 0.5) self.pack_end(self.error_text, False, False, 0) self.text_and_tags_button.set_active(True) self.filter_tags_button.connect("toggled", self.check_selection)