本文整理汇总了Python中ubuntutweak.factory.WidgetFactory类的典型用法代码示例。如果您正苦于以下问题:Python WidgetFactory类的具体用法?Python WidgetFactory怎么用?Python WidgetFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WidgetFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self):
TweakModule.__init__(self)
valid_themes = self._get_valid_themes()
theme_box = GridPack(
WidgetFactory.create('Switch',
label=self.utext_event_sounds,
key='org.gnome.desktop.sound.event-sounds',
backend='gsettings'),
WidgetFactory.create('Switch',
label=self.utext_login_sound,
key='50_unity-greeter.gschema.override::com.canonical.unity-greeter#play-ready-sound',
backend='systemconfig'),
WidgetFactory.create('Switch',
label=self.utext_input_feedback,
key='org.gnome.desktop.sound.input-feedback-sounds',
backend='gsettings'),
WidgetFactory.create('ComboBox',
label=self.utext_sound_theme,
key='org.gnome.desktop.sound.theme-name',
backend='gsettings',
texts=valid_themes,
values=valid_themes),
)
self.add_start(theme_box, False, False, 0)
示例2: __init__
def __init__(self):
TweakModule.__init__(self)
hibernate_box = WidgetFactory.create('CheckButton',
label=_('Lock screen on hibernate'),
enable_reset=True,
backend=GConf,
key='/apps/gnome-power-manager/lock/hibernate')
suspend_box = WidgetFactory.create('CheckButton',
label=_('Lock screen on suspend'),
enable_reset=True,
backend=GConf,
key='/apps/gnome-power-manager/lock/suspend')
screensaver_box = WidgetFactory.create('CheckButton',
label=_('Use Screensaver lock settings'),
enable_reset=True,
backend=GConf,
key='/apps/gnome-power-manager/lock/use_screensaver_settings')
hibernate_button = hibernate_box.get_data('widget')
suspend_button = suspend_box.get_data('widget')
screensaver_button = screensaver_box.get_data('widget')
screensaver_button.connect('toggled', self.on_screensaver_button_toggled,
(hibernate_button, suspend_button))
self.on_screensaver_button_toggled(screensaver_button, (hibernate_button, suspend_button))
box = TablePack(_('Advanced Power Management Settings'), (
WidgetFactory.create('CheckButton',
label=_('Enable "Lock screen" when "Blank Screen" activates'),
enable_reset=True,
backend=GConf,
key='/apps/gnome-power-manager/lock/blank_screen'),
screensaver_box, hibernate_box, suspend_box
))
self.add_start(box, False, False, 0)
示例3: __init__
def __init__(self):
TweakModule.__init__(self)
box = ListPack(_("System Security options"), (
WidgetFactory.create("CheckButton",
label=_('Disable "Lock Screen"'),
key="org.gnome.desktop.lockdown.disable-lock-screen",
backend="gsettings",
enable_reset=True),
WidgetFactory.create("CheckButton",
label=_("Disable printing"),
key="org.gnome.desktop.lockdown.disable-printing",
backend="gsettings",
enable_reset=True),
WidgetFactory.create("CheckButton",
label=_("Disable printer settings"),
key="org.gnome.desktop.lockdown.disable-print-setup",
backend="gsettings",
enable_reset=True),
WidgetFactory.create("CheckButton",
label=_("Disable save to disk"),
key="org.gnome.desktop.lockdown.disable-save-to-disk",
backend="gsettings",
enable_reset=True),
WidgetFactory.create("CheckButton",
label=_('Disable "Fast User Switching"'),
key="org.gnome.desktop.lockdown.disable-user-switching",
backend="gsettings",
enable_reset=True),
), padding=2)
self.add_start(box, False, False, 0)
示例4: __init__
def __init__(self, item):
GObject.GObject.__init__(self)
self.show_button = WidgetFactory.create("CheckButton",
label=item["label"],
key=item["visible_key"],
backend="gsettings")
self.show_button.connect('toggled', self.on_show_button_changed)
self.pack_start(self.show_button, False, False, 0)
self.show_hbox = Gtk.HBox(spacing=12)
self.pack_start(self.show_hbox, False, False, 0)
if not self.show_button.get_active():
self.show_hbox.set_sensitive(False)
icon = Gtk.Image.new_from_icon_name(item["icon_name"], Gtk.IconSize.DIALOG)
self.show_hbox.pack_start(icon, False, False, 0)
self.rename_button = WidgetFactory.create("StringCheckButton",
label=_('Rename'),
key=item["name_key"],
backend="gsettings")
self.rename_button.connect('toggled', self.on_show_button_changed)
vbox = Gtk.VBox(spacing=6)
self.show_hbox.pack_start(vbox, False, False, 0)
vbox.pack_start(self.rename_button, False, False, 0)
self.entry = WidgetFactory.create("Entry", key=item["name_key"], backend="gsettings")
self.entry.connect('insert-at-cursor', self.on_entry_focus_out)
if not self.rename_button.get_active():
self.entry.set_sensitive(False)
vbox.pack_start(self.entry, False, False, 0)
示例5: __init__
def __init__(self):
TweakModule.__init__(self)
valid_themes = theme.get_valid_themes()
valid_icon_themes = theme.get_valid_icon_themes()
valid_cursor_themes = theme.get_valid_cursor_themes()
valid_window_themes = theme.get_valid_window_themes()
theme_choose_button = Gtk.FileChooserButton()
theme_choose_button.connect('file-set', self.on_file_set)
icon_label, self.icon_theme, icon_reset_button = WidgetFactory.create('ComboBox',
label=self.utext_icon_theme,
key='org.gnome.desktop.interface.icon-theme',
backend='gsettings',
texts=valid_icon_themes,
values=valid_icon_themes,
enable_reset=True)
if system.CODENAME == 'precise':
window_theme_label, window_theme_combox, window_theme_reset_button = WidgetFactory.create('ComboBox',
label=self.utext_window_theme,
key='/apps/metacity/general/theme',
backend='gconf',
texts=valid_window_themes,
values=valid_window_themes,
enable_reset=True)
else:
window_theme_label, window_theme_combox, window_theme_reset_button = WidgetFactory.create('ComboBox',
label=self.utext_window_theme,
key='org.gnome.desktop.wm.preferences.theme',
backend='gsettings',
texts=valid_window_themes,
values=valid_window_themes,
enable_reset=True)
theme_box = GridPack(
WidgetFactory.create('ComboBox',
label=self.utext_gtk_theme,
key='org.gnome.desktop.interface.gtk-theme',
backend='gsettings',
texts=valid_themes,
values=valid_themes,
enable_reset=True),
(icon_label, self.icon_theme, icon_reset_button),
WidgetFactory.create('ComboBox',
label=self.utext_cursor_theme,
key='org.gnome.desktop.interface.cursor-theme',
backend='gsettings',
texts=valid_cursor_themes,
values=valid_cursor_themes,
enable_reset=True),
(window_theme_label, window_theme_combox, window_theme_reset_button),
Gtk.Separator(),
(Gtk.Label(_('Install theme:')), theme_choose_button),
)
self.add_start(theme_box, False, False, 0)
示例6: __init__
def __init__(self):
TweakModule.__init__(self, "loginsettings.ui")
log.debug('Start to build "Session Options"')
self.options_box = ListPack(
_("Login Options"),
(
WidgetFactory.create(
"UserCheckButton",
user="gdm",
label=_("Disable user list in GDM"),
enable_reset=True,
key="/apps/gdm/simple-greeter/disable_user_list",
),
WidgetFactory.create(
"UserCheckButton",
user="gdm",
label=_("Play sound at login"),
enable_reset=True,
key="/desktop/gnome/sound/event_sounds",
),
WidgetFactory.create(
"UserCheckButton",
user="gdm",
label=_("Disable showing the restart button"),
enable_reset=True,
key="/apps/gdm/simple-greeter/disable_restart_buttons",
),
),
)
for item in self.options_box.items:
log.debug("Set widget %s to sensitive False", item)
item.set_sensitive(False)
log.debug('Build "Session Options" finished')
self.add_start(self.options_box, False, False, 0)
self.icon_setting = UserGconfSetting("/apps/gdm/simple-greeter/logo_icon_name")
self.icon_theme_setting = UserGconfSetting("/desktop/gnome/interface/icon_theme")
self._setup_logo_image()
self._setup_background_image()
self.vbox1.unparent()
self.vbox1.set_sensitive(False)
box = ListPack(_("Login Theme"), (self.vbox1))
self.add_start(box, False, False, 0)
hbox = Gtk.HBox(spacing=12)
polkit_button = PolkitButton(PK_ACTION_TWEAK)
polkit_button.connect("authenticated", self.on_polkit_action)
hbox.pack_end(polkit_button, False, False, 0)
self.add_start(hbox, False, False, 0)
示例7: __init__
def __init__(self):
TweakModule.__init__(self, 'loginsettings.ui')
valid_themes = theme.get_valid_themes()
valid_icon_themes = theme.get_valid_icon_themes()
notes_label = Gtk.Label()
notes_label.set_property('halign', Gtk.Align.START)
notes_label.set_markup('<span size="smaller">%s</span>' % \
_('Note: you may need to reboot to take effect'))
notes_label._ut_left = 1
self.login_box = GridPack(
WidgetFactory.create('Switch',
label=self.utext_allow_guest,
key='/etc/lightdm/lightdm.conf::SeatDefaults#allow-guest',
default=True,
backend='systemconfig'),
notes_label,
WidgetFactory.create('Switch',
label=self.utext_draw_grid,
key='50_unity-greeter.gschema.override::com.canonical.unity-greeter#draw-grid',
backend='systemconfig'),
WidgetFactory.create('Switch',
label=self.utext_login_sound,
key='50_unity-greeter.gschema.override::com.canonical.unity-greeter#play-ready-sound',
backend='systemconfig'),
WidgetFactory.create('ComboBox',
label=self.utext_gtk_theme,
key='50_unity-greeter.gschema.override::com.canonical.unity-greeter#theme-name',
backend='systemconfig',
texts=valid_themes,
values=valid_themes),
WidgetFactory.create('ComboBox',
label=self.utext_icon_theme,
key='50_unity-greeter.gschema.override::com.canonical.unity-greeter#icon-theme-name',
backend='systemconfig',
texts=valid_icon_themes,
values=valid_icon_themes),
)
self.login_box.set_sensitive(False)
self.add_start(self.login_box, False, False, 0)
if system.CODENAME != 'saucy':
self.add_start(Gtk.Separator(), False, False, 6)
self._setup_logo_image()
self._setup_background_image()
box = ListPack('', (self.main_vbox))
self.add_start(box, False, False, 0)
示例8: __init__
def __init__(self):
TweakModule.__init__(self)
show_permission_button, show_permission_reset = WidgetFactory.create("CheckButton",
label=self.utext_advanced_properties,
enable_reset=True,
key="org.gnome.nautilus.preferences.show-advanced-permissions",
backend="gsettings")
box = GridPack(
(Gtk.Label(_("File browser:")), show_permission_button, show_permission_reset),
WidgetFactory.create("CheckButton",
label=self.utext_pathbar,
enable_reset=True,
blank_label=True,
key="org.gnome.nautilus.preferences.always-use-location-entry",
backend="gsettings"),
Gtk.Separator(),
WidgetFactory.create('Switch',
key='org.gnome.desktop.media-handling.automount',
enable_reset=True,
label=self.utext_automount,
backend="gsettings"),
WidgetFactory.create('Switch',
key='org.gnome.desktop.media-handling.automount-open',
enable_reset=True,
label=self.utext_open,
backend="gsettings"),
WidgetFactory.create('Switch',
key='org.gnome.desktop.media-handling.autorun-never',
enable_reset=True,
reverse=True,
label=self.utext_prompt,
backend="gsettings"),
Gtk.Separator(),
WidgetFactory.create('Scale',
key='org.gnome.nautilus.icon-view.thumbnail-size',
enable_reset=True,
min=16, max=512,
step=16,
label=self.utext_thumbnail_icon_size,
backend="gsettings"),
WidgetFactory.create('Scale',
key='org.gnome.desktop.thumbnail-cache.maximum-age',
enable_reset=True,
min=-1, max=180,
step=1,
label=self.utext_thumbnail_cache_age,
backend="gsettings"),
WidgetFactory.create('Scale',
key='org.gnome.desktop.thumbnail-cache.maximum-size',
enable_reset=True,
min=-1, max=512,
step=1,
label=self.utext_thumbnail_cache_size,
backend="gsettings"),
)
self.add_start(box, False, False, 0)
示例9: __init__
def __init__(self):
TweakModule.__init__(self)
self.show_button = WidgetFactory.create(
"CheckButton", label=_("Show desktop icons"), key="/apps/nautilus/preferences/show_desktop", backend=GConf
)
self.show_button.connect("toggled", self.on_show_button_changed)
self.add_start(self.show_button, False, False, 0)
self.show_button_box = Gtk.HBox(spacing=12)
self.add_start(self.show_button_box, False, False, 0)
if not self.show_button.get_active():
self.show_button_box.set_sensitive(False)
label = Gtk.Label(label=" ")
self.show_button_box.pack_start(label, False, False, 0)
vbox = Gtk.VBox(spacing=6)
self.show_button_box.pack_start(vbox, False, False, 0)
for item in desktop_icons:
vbox.pack_start(DesktopIcon(item), False, False, 0)
button = WidgetFactory.create(
"CheckButton",
label=_('Show "Network" icon on desktop'),
key="/apps/nautilus/desktop/network_icon_visible",
backend=GConf,
)
vbox.pack_start(button, False, False, 0)
button = WidgetFactory.create(
"CheckButton",
label=_("Show mounted volumes on desktop"),
key="/apps/nautilus/desktop/volumes_visible",
backend=GConf,
)
vbox.pack_start(button, False, False, 0)
button = WidgetFactory.create(
"CheckButton",
label=_('Show contents of "Home Folder" on desktop (Logout for changes to take effect)'),
key="/apps/nautilus/preferences/desktop_is_home_dir",
backend=GConf,
)
vbox.pack_start(button, False, False, 0)
示例10: __init__
def __init__(self):
TweakModule.__init__(self)
box = ListPack(
_("System Security options"),
(
WidgetFactory.create(
"CheckButton",
label=_('Disable "Lock Screen"'),
key="/desktop/gnome/lockdown/disable_lock_screen",
backend=GConf,
enable_reset=True,
),
WidgetFactory.create(
"CheckButton",
label=_("Disable printing"),
key="/desktop/gnome/lockdown/disable_printing",
backend=GConf,
enable_reset=True,
),
WidgetFactory.create(
"CheckButton",
label=_("Disable printer settings"),
key="/desktop/gnome/lockdown/disable_print_setup",
backend=GConf,
enable_reset=True,
),
WidgetFactory.create(
"CheckButton",
label=_("Disable save to disk"),
key="/desktop/gnome/lockdown/disable_save_to_disk",
backend=GConf,
enable_reset=True,
),
WidgetFactory.create(
"CheckButton",
label=_('Disable "Fast User Switching"'),
key="/desktop/gnome/lockdown/disable_user_switching",
backend=GConf,
enable_reset=True,
),
),
padding=2,
)
self.add_start(box, False, False, 0)
示例11: __init__
def __init__(self):
TweakModule.__init__(self)
box = ListPack(_("File Browser"), (
WidgetFactory.create("CheckButton",
label=_('Show advanced permissions in the Nautilus "File Properties" window'),
enable_reset=True,
key="org.gnome.nautilus.preferences.show-advanced-permissions",
backend="gsettings"),
WidgetFactory.create("CheckButton",
label=_('Always use the location entry, instead of the pathbar'),
enable_reset=True,
key="org.gnome.nautilus.preferences.always-use-location-entry",
backend="gsettings")))
self.add_start(box, False, False, 0)
box = TablePack(_('Thumbnail Settings'), (
WidgetFactory.create('SpinButton',
key='org.gnome.nautilus.icon-view.thumbnail-size',
enable_reset=True,
min=16, max=512, step=16,
label=_('Default thumbnail icon size (pixels)'),
backend="gsettings"),
WidgetFactory.create('SpinButton',
key='org.gnome.desktop.thumbnail-cache.maximum-size',
enable_reset=True,
min=-1, max=512, step=1,
label=_('Maximum thumbnail cache size (megabytes)'),
backend="gsettings"),
WidgetFactory.create('SpinButton',
key='org.gnome.desktop.thumbnail-cache.maximum-age',
enable_reset=True,
min=-1, max=180, step=1,
label=_('Thumbnail cache time (days)'),
backend="gsettings"),
))
self.add_start(box, False, False, 0)
box = TablePack(_('Automatically Mount Settings'), (
WidgetFactory.create('CheckButton',
key='org.gnome.desktop.media-handling.automount',
enable_reset=True,
label=_('Whether to automatically mount media'),
backend="gsettings"),
WidgetFactory.create('CheckButton',
key='org.gnome.desktop.media-handling.automount-open',
enable_reset=True,
label=_('Whether to automatically open a folder for automounted media'),
backend="gsettings"),
WidgetFactory.create('CheckButton',
key='org.gnome.desktop.media-handling.autorun-never',
enable_reset=True,
label=_('Never prompt or autorun/autostart programs when media are inserted'),
backend="gsettings"),
))
self.add_start(box, False, False, 0)
示例12: __init__
def __init__(self):
TweakModule.__init__(self)
box = GridPack(
WidgetFactory.create("Switch",
label=self.utext_pathbar,
enable_reset=True,
key="org.gnome.nautilus.preferences.always-use-location-entry",
backend="gsettings"),
WidgetFactory.create('Switch',
key='org.gnome.nautilus.preferences.enable-interactive-search',
enable_reset=True,
reverse=True,
label=self.recursive_search,
backend="gsettings"),
WidgetFactory.create('Switch',
key='org.gnome.desktop.media-handling.automount',
enable_reset=True,
label=self.utext_automount,
backend="gsettings"),
WidgetFactory.create('Switch',
key='org.gnome.desktop.media-handling.automount-open',
enable_reset=True,
label=self.utext_open,
backend="gsettings"),
WidgetFactory.create('Switch',
key='org.gnome.desktop.media-handling.autorun-never',
enable_reset=True,
reverse=True,
label=self.utext_prompt,
backend="gsettings"),
Gtk.Separator(),
WidgetFactory.create('Scale',
key='org.gnome.nautilus.icon-view.thumbnail-size',
enable_reset=True,
min=16, max=512,
step=16,
label=self.utext_thumbnail_icon_size,
backend="gsettings"),
WidgetFactory.create('Scale',
key='org.gnome.desktop.thumbnail-cache.maximum-age',
enable_reset=True,
min=-1, max=180,
step=1,
label=self.utext_thumbnail_cache_age,
backend="gsettings"),
WidgetFactory.create('Scale',
key='org.gnome.desktop.thumbnail-cache.maximum-size',
enable_reset=True,
min=-1, max=512,
step=1,
label=self.utext_thumbnail_cache_size,
backend="gsettings"),
)
self.add_start(box, False, False, 0)
示例13: __init__
def __init__(self):
TweakModule.__init__(self)
show_label, show_switch = WidgetFactory.create(
"Switch",
label=self.utext_show_icon,
key="org.gnome.desktop.background.show-desktop-icons",
backend="gsettings",
)
setting_list = []
show_switch.connect("notify::active", self.on_show_button_changed, setting_list)
for item in desktop_icons:
setting_list.append(DesktopIcon(item))
volumes_button = WidgetFactory.create(
"CheckButton",
label=self.utext_mount_volume,
key="org.gnome.nautilus.desktop.volumes-visible",
backend="gsettings",
)
setting_list.append(volumes_button)
home_contents_button = WidgetFactory.create(
"CheckButton",
label=self.utext_home_folder,
key="org.gnome.nautilus.preferences.desktop-is-home-dir",
backend="gsettings",
)
setting_list.append(home_contents_button)
notes_label = Gtk.Label()
notes_label.set_property("halign", Gtk.Align.START)
notes_label.set_markup(
'<span size="smaller">%s</span>' % _("Note: switch off this option will make the desktop unclickable")
)
notes_label._ut_left = 1
grid_box = GridPack((show_label, show_switch), notes_label, *setting_list)
self.add_start(grid_box)
self.on_show_button_changed(show_switch, None, setting_list)
示例14: __init__
def __init__(self):
TweakModule.__init__(self)
self.is_arabic = os.getenv('LANG').startswith('ar')
hbox = Gtk.HBox(spacing=12)
hbox.pack_start(self.create_edge_setting(), True, False, 0)
self.add_start(hbox, False, False, 0)
self.add_start(Gtk.Separator(), False, False, 6)
grid_pack = GridPack(
WidgetFactory.create("Scale",
label=self.utext_edge_delay,
key="core.edge_delay",
backend="compiz",
min=0,
max=1000,
step=50,
enable_reset=True),
WidgetFactory.create("Scale",
label=self.utext_hsize,
key="core.hsize",
backend="compiz",
min=1,
max=16,
step=1,
enable_reset=True),
WidgetFactory.create("Scale",
label=self.utext_vsize,
key="core.vsize",
backend="compiz",
min=1,
max=16,
step=1,
enable_reset=True),
)
self.add_start(grid_pack, False, False, 0)
示例15: __init__
def __init__(self):
TweakModule.__init__(self, 'loginsettings.ui')
if system.CODENAME != 'oneiric':
valid_themes = theme.get_valid_themes()
valid_icon_themes = theme.get_valid_icon_themes()
self.login_box = GridPack(
WidgetFactory.create('Switch',
label=self.utext_draw_grid,
key='50_unity-greeter.gschema.override::com.canonical.unity-greeter#draw-grid',
backend='systemconfig'),
WidgetFactory.create('Switch',
label=self.utext_login_sound,
key='50_unity-greeter.gschema.override::com.canonical.unity-greeter#play-ready-sound',
backend='systemconfig'),
WidgetFactory.create('ComboBox',
label=self.utext_gtk_theme,
key='50_unity-greeter.gschema.override::com.canonical.unity-greeter#theme-name',
backend='systemconfig',
texts=valid_themes,
values=valid_themes),
WidgetFactory.create('ComboBox',
label=self.utext_icon_theme,
key='50_unity-greeter.gschema.override::com.canonical.unity-greeter#icon-theme-name',
backend='systemconfig',
texts=valid_icon_themes,
values=valid_icon_themes),
)
self.login_box.set_sensitive(False)
self.add_start(self.login_box, False, False, 0)
self.add_start(Gtk.Separator(), False, False, 6)
self._setup_logo_image()
self._setup_background_image()
box = ListPack('', (self.main_vbox))
self.add_start(box, False, False, 0)