本文整理汇总了Python中gi.repository.Gtk.CheckButton方法的典型用法代码示例。如果您正苦于以下问题:Python Gtk.CheckButton方法的具体用法?Python Gtk.CheckButton怎么用?Python Gtk.CheckButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gtk
的用法示例。
在下文中一共展示了Gtk.CheckButton方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_parental_button
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CheckButton [as 别名]
def create_parental_button(self):
desc = (
_(" Use different levels to:\n"
"- Block mature content in browser and YouTube\n"
"- Or restrict internet access to only Kano World activity")
).split('\n')
self.parental_button = Gtk.CheckButton()
box = LabelledListTemplate.label_button(
self.parental_button,
_("Parental lock"),
desc[0])
grid = self._labelled_list_helper(desc, box)
if get_parental_enabled():
parental_config_button = OrangeButton(_("Configure"))
parental_config_button.connect('button-press-event',
self.go_to_parental_config)
grid.attach(parental_config_button, 0, len(desc), 1, 1)
return grid
示例2: config_panel
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CheckButton [as 别名]
def config_panel(self, configdialog):
"""
Function that builds the widget in the configuration dialog
"""
grid = Gtk.Grid()
grid.set_border_width(12)
grid.set_column_spacing(6)
grid.set_row_spacing(6)
configdialog.add_checkbox(grid,
_('Use shading'),
0, 'preferences.relation-shade')
configdialog.add_checkbox(grid,
_('Display edit buttons'),
1, 'preferences.releditbtn')
checkbox = Gtk.CheckButton(label=_('View links as website links'))
theme = self._config.get('preferences.relation-display-theme')
checkbox.set_active(theme == 'WEBPAGE')
checkbox.connect('toggled', self._config_update_theme)
grid.attach(checkbox, 1, 2, 8, 1)
return _('Layout'), grid
示例3: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CheckButton [as 别名]
def __init__(self, option, dbstate, uistate, track, override=False):
Gtk.HBox.__init__(self)
self.__option = option
value_str = self.__option.get_value()
(attr_inc, attr_list) = value_str.split(',',1)
attr_list = attr_list.strip()
self.cb_w = Gtk.CheckButton(label="")
self.cb_w.connect('toggled', self.__value_changed)
self.l_w = Gtk.Label(label=_('restricted to:'))
self.l_w.set_sensitive(False)
self.e_w = Gtk.Entry()
self.e_w.set_text(attr_list)
self.e_w.connect('changed', self.__value_changed)
self.e_w.set_sensitive(False)
self.cb_w.set_active(attr_inc == 'True')
self.pack_start(self.cb_w, False, True, 0)
self.pack_end(self.e_w, True, True, 0)
self.pack_end(self.l_w, False, True, 5)
self.set_tooltip_text(self.__option.get_help())
示例4: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CheckButton [as 别名]
def __init__(self, markup_text=None, button_texts=None, checkbox_texts=None,
callback=None, callback_args=(),
message_type=Gtk.MessageType.INFO, flags=Gtk.DialogFlags.MODAL, parent=None,
width=-1, standalone=False, title="RAFCON", height=-1):
super(RAFCONColumnCheckboxDialog, self).__init__(markup_text, button_texts, callback, callback_args,
message_type, flags, parent, width, standalone, title, height)
checkbox_vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, constants.GRID_SIZE)
self.get_content_area().add(checkbox_vbox)
# this is not really needed i guess if I can get the checkboxes over the content area anyway
# TODO change this to a solution without the list.
if checkbox_texts:
self.checkboxes = []
for index, checkbox in enumerate(checkbox_texts):
self.checkboxes.append(Gtk.CheckButton(label=checkbox))
checkbox_vbox.pack_start(self.checkboxes[index], True, True, 1)
else:
logger.debug("Argument checkbox_text is None or empty, no checkboxes were created")
self.show_all()
self.run() if standalone else None
示例5: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CheckButton [as 别名]
def __init__(self, core_config_model, view, gui_config_model):
assert isinstance(view, PreferencesWindowView)
assert isinstance(core_config_model, ConfigModel)
assert isinstance(gui_config_model, ConfigModel)
ExtendedController.__init__(self, core_config_model, view)
self.core_config_model = core_config_model
self.gui_config_model = gui_config_model
self.observe_model(gui_config_model)
# (config_key, config_value, text_visible, toggle_activatable, toggle_visible, text_editable, toggle_value)
self.core_list_store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING, bool, bool, bool, bool, bool)
self.library_list_store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING)
self.gui_list_store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING, bool, bool, bool, bool, bool)
self.shortcut_list_store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING)
self._lib_counter = 0
self._gui_checkbox = Gtk.CheckButton(label="GUI Config")
self._core_checkbox = Gtk.CheckButton(label="Core Config")
self._last_path = self.core_config_model.config.path
示例6: display_value
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CheckButton [as 别名]
def display_value(self, key, w):
if key == "vfolders":
# Even more special case
rids = [ ]
# Get list of folders that share this device
for r in self.config["folders"]:
for n in r["devices"]:
if n["deviceID"] == self.id and r["id"] not in rids:
rids.append(r["id"])
# Create CheckButtons
for folder in reversed(sorted(self.app.folders.values(), key=lambda x : x["id"])):
b = Gtk.CheckButton(folder["path"], False)
b.set_tooltip_text(folder["id"])
self["vfolders"].pack_start(b, False, False, 0)
b.set_active(folder["id"] in rids)
self["vfolders"].show_all()
else:
EditorDialog.display_value(self, key, w)
#@Overrides
示例7: display_value
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CheckButton [as 别名]
def display_value(self, key, w):
"""
Sets value on UI element for single key. May be overridden
by subclass to handle special values.
"""
if isinstance(w, Gtk.SpinButton):
w.get_adjustment().set_value(ints(self.get_value(strip_v(key))))
elif isinstance(w, Gtk.Entry):
w.set_text(unicode(self.get_value(strip_v(key))))
elif isinstance(w, Gtk.ComboBox):
val = self.get_value(strip_v(key))
m = w.get_model()
for i in xrange(0, len(m)):
if str(val) == str(m[i][0]).strip():
w.set_active(i)
break
else:
w.set_active(0)
elif isinstance(w, Gtk.CheckButton):
w.set_active(self.get_value(strip_v(key)))
else:
log.warning("display_value: %s class cannot handle widget %s, key %s", self.__class__.__name__, w, key)
if not w is None: w.set_sensitive(False)
示例8: all_wallpaper_folder_interactives_set_sensitive
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CheckButton [as 别名]
def all_wallpaper_folder_interactives_set_sensitive(self, sensitive):
# listbox
# --> listboxrow []
# --> box
# --> checkbutton
# --> label
# --> button
for child in self.wallpapers_folders_popover_listbox.get_children():
for subchild in child.get_child().get_children():
if type(subchild) in [Gtk.CheckButton, Gtk.Button]:
subchild.set_sensitive(sensitive)
self.add_to_favorites_toggle.set_sensitive(sensitive)
self.builder.get_object('addWallpapersPath').set_sensitive(sensitive)
self.on_wallpapersFoldersPopoverListbox_row_selected(
self.wallpapers_folders_popover_listbox,
self.wallpapers_folders_popover_listbox.get_selected_row()
)
示例9: show_tool_chooser
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CheckButton [as 别名]
def show_tool_chooser(self):
win = Gtk.Window()
box = Gtk.Box(spacing=2)
box.set_orientation(Gtk.Orientation(1))
win.add(box)
for tool in self.tools:
self.tool_cbs[tool] = Gtk.CheckButton(label=tool + ": " + str(self.tools[tool]))
box.pack_start(self.tool_cbs[tool], False, False, 1)
button = Gtk.Button(label="Accept")
box.pack_start(button, False, False, 1)
win.show_all()
def on_accept(widget):
win.destroy()
tool_list = []
for toolx in self.tool_cbs:
if self.tool_cbs[toolx].get_active():
tool_list.append(toolx)
self.options["toolselection"] = ", ".join(tool_list)
self.to_form()
button.connect("activate", on_accept)
button.connect("clicked", on_accept)
示例10: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CheckButton [as 别名]
def __init__(self, app, multiple_files):
if multiple_files:
text = _('Do you want to remove unfinished tasks?')
else:
text = _('Do you want to remove unfinished task?')
super().__init__(app.window, Gtk.DialogFlags.MODAL,
Gtk.MessageType.WARNING, Gtk.ButtonsType.YES_NO,
text)
self.app = app
box = self.get_message_area()
remember_button = Gtk.CheckButton(_('Do not ask again'))
remember_button.set_active(
not self.app.profile['confirm-download-deletion'])
remember_button.connect('toggled', self.on_remember_button_toggled)
box.pack_start(remember_button, False, False, 0)
box.show_all()
示例11: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CheckButton [as 别名]
def __init__(self, account):
"""
:param account: Account
"""
Gtk.ListBoxRow.__init__(self)
self.get_style_context().add_class("account-row")
self._account = account
self.check_btn = Gtk.CheckButton()
self._account.connect("otp_updated", self._on_pin_updated)
self._build_widget()
self.show_all()
示例12: checked
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CheckButton [as 别名]
def checked(self):
"""
Whether the CheckButton is active or not.
:return: bool
"""
return self.check_btn.get_active()
示例13: _check_btn_toggled
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CheckButton [as 别名]
def _check_btn_toggled(self, *_):
"""
CheckButton signal Handler.
"""
self.emit("on_selected")
示例14: addReminder
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CheckButton [as 别名]
def addReminder(self,desc,date):
row = Gtk.ListBoxRow()
hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=50)
row.add(hbox)
ldesc = Gtk.Label(desc, xalign=0)
ldate = Gtk.Label(date, xalign=0)
cdone = Gtk.CheckButton()
hbox.pack_start(ldesc, True, True, 0)
hbox.pack_start(ldate, False, True, 0)
hbox.pack_start(cdone, False, True, 0)
self.lsbReminders.add(row)
#############
# Events #
#############
示例15: create_debug_button
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import CheckButton [as 别名]
def create_debug_button(self):
desc = (
_(" Having problems?\n"
"1) Enable this mode\n"
"2) Report a bug with the ? tool on the Desktop")
).split('\n')
self.debug_button = Gtk.CheckButton()
box = LabelledListTemplate.label_button(
self.debug_button,
_("Debug mode"),
desc[0]
)
return self._labelled_list_helper(desc, box)