本文整理汇总了Python中jarabe.controlpanel.inlinealert.InlineAlert.show方法的典型用法代码示例。如果您正苦于以下问题:Python InlineAlert.show方法的具体用法?Python InlineAlert.show怎么用?Python InlineAlert.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jarabe.controlpanel.inlinealert.InlineAlert
的用法示例。
在下文中一共展示了InlineAlert.show方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Power
# 需要导入模块: from jarabe.controlpanel.inlinealert import InlineAlert [as 别名]
# 或者: from jarabe.controlpanel.inlinealert.InlineAlert import show [as 别名]
class Power(SectionView):
def __init__(self, model, alerts):
SectionView.__init__(self)
self._model = model
self.restart_alerts = alerts
self._automatic_pm_valid = True
self._automatic_pm_change_handler = None
self.set_border_width(style.DEFAULT_SPACING * 2)
self.set_spacing(style.DEFAULT_SPACING)
group = Gtk.SizeGroup(Gtk.SizeGroupMode.HORIZONTAL)
self._automatic_pm_alert_box = Gtk.HBox(spacing=style.DEFAULT_SPACING)
separator_pm = Gtk.HSeparator()
self.pack_start(separator_pm, False, True, 0)
separator_pm.show()
label_pm = Gtk.Label(label=_('Power management'))
label_pm.set_alignment(0, 0)
self.pack_start(label_pm, False, True, 0)
label_pm.show()
box_pm = Gtk.VBox()
box_pm.set_border_width(style.DEFAULT_SPACING * 2)
box_pm.set_spacing(style.DEFAULT_SPACING)
box_automatic_pm = Gtk.HBox(spacing=style.DEFAULT_SPACING)
label_automatic_pm = Gtk.Label(label=
_('Automatic power management (increases battery life)'))
label_automatic_pm.set_alignment(0, 0.5)
self._automatic_button = Gtk.CheckButton()
self._automatic_button.set_alignment(0, 0)
box_automatic_pm.pack_start(self._automatic_button, False, True, 0)
box_automatic_pm.pack_start(label_automatic_pm, False, True, 0)
self._automatic_button.show()
label_automatic_pm.show()
group.add_widget(label_automatic_pm)
box_pm.pack_start(box_automatic_pm, False, True, 0)
box_automatic_pm.show()
self._automatic_pm_alert = InlineAlert()
label_automatic_pm_error = Gtk.Label()
group.add_widget(label_automatic_pm_error)
self._automatic_pm_alert_box.pack_start(label_automatic_pm_error,
expand=False, fill=True,
padding=0)
label_automatic_pm_error.show()
self._automatic_pm_alert_box.pack_start(self._automatic_pm_alert,
expand=False, fill=True,
padding=0)
box_pm.pack_end(self._automatic_pm_alert_box, False, True, 0)
self._automatic_pm_alert_box.show()
if 'automatic_pm' in self.restart_alerts:
self._automatic_pm_alert.props.msg = self.restart_msg
self._automatic_pm_alert.show()
self.pack_start(box_pm, False, True, 0)
box_pm.show()
self.setup()
def setup(self):
try:
automatic_state = self._model.get_automatic_pm()
except Exception, detail:
self._automatic_pm_alert.props.msg = detail
self._automatic_pm_alert.show()
else:
示例2: Frame
# 需要导入模块: from jarabe.controlpanel.inlinealert import InlineAlert [as 别名]
# 或者: from jarabe.controlpanel.inlinealert.InlineAlert import show [as 别名]
class Frame(SectionView):
def __init__(self, model, alerts):
SectionView.__init__(self)
self._model = model
self._corner_delay_sid = 0
self._corner_delay_is_valid = True
self._corner_delay_change_handler = None
self._edge_delay_sid = 0
self._edge_delay_is_valid = True
self._edge_delay_change_handler = None
self._trigger_size_sid = 0
self._trigger_size_is_valid = True
self._trigger_size_change_handler = None
self.restart_alerts = alerts
self.set_border_width(style.DEFAULT_SPACING * 2)
self.set_spacing(style.DEFAULT_SPACING)
self._group = Gtk.SizeGroup(Gtk.SizeGroupMode.HORIZONTAL)
separator = Gtk.HSeparator()
self.pack_start(separator, False, True, 0)
separator.show()
label_activation = Gtk.Label(label=_('Activation Delay'))
label_activation.set_alignment(0, 0)
self.pack_start(label_activation, False, True, 0)
label_activation.show()
self._box_sliders = Gtk.VBox()
self._box_sliders.set_border_width(style.DEFAULT_SPACING * 2)
self._box_sliders.set_spacing(style.DEFAULT_SPACING)
self._corner_delay_slider = None
self._corner_delay_alert = None
self._setup_corner()
self._edge_delay_slider = None
self._edge_delay_alert = None
self._setup_edge()
self._trigger_size_slider = None
self._trigger_size_alert = None
self._setup_trigger()
self.pack_start(self._box_sliders, False, True, 0)
self._box_sliders.show()
self.setup()
def _setup_corner(self):
box_delay = Gtk.HBox(spacing=style.DEFAULT_SPACING)
label_delay = Gtk.Label(label=_('Corner'))
label_delay.set_alignment(1, 0.75)
label_delay.modify_fg(Gtk.StateType.NORMAL,
style.COLOR_SELECTION_GREY.get_gdk_color())
box_delay.pack_start(label_delay, False, True, 0)
self._group.add_widget(label_delay)
label_delay.show()
adj = Gtk.Adjustment(value=100, lower=0, upper=_MAX_DELAY,
step_incr=100, page_incr=100, page_size=0)
self._corner_delay_slider = Gtk.HScale()
self._corner_delay_slider.set_adjustment(adj)
self._corner_delay_slider.set_digits(0)
self._corner_delay_slider.connect('format-value',
self.__corner_delay_format_cb)
box_delay.pack_start(self._corner_delay_slider, True, True, 0)
self._corner_delay_slider.show()
self._box_sliders.pack_start(box_delay, False, True, 0)
box_delay.show()
self._corner_delay_alert = InlineAlert()
label_delay_error = Gtk.Label()
self._group.add_widget(label_delay_error)
delay_alert_box = Gtk.HBox(spacing=style.DEFAULT_SPACING)
delay_alert_box.pack_start(label_delay_error, False, True, 0)
label_delay_error.show()
delay_alert_box.pack_start(self._corner_delay_alert, False, True, 0)
self._box_sliders.pack_start(delay_alert_box, False, True, 0)
delay_alert_box.show()
if 'corner_delay' in self.restart_alerts:
self._corner_delay_alert.props.msg = self.restart_msg
self._corner_delay_alert.show()
def _setup_edge(self):
box_delay = Gtk.HBox(spacing=style.DEFAULT_SPACING)
label_delay = Gtk.Label(label=_('Edge'))
label_delay.set_alignment(1, 0.75)
label_delay.modify_fg(Gtk.StateType.NORMAL,
style.COLOR_SELECTION_GREY.get_gdk_color())
box_delay.pack_start(label_delay, False, True, 0)
self._group.add_widget(label_delay)
label_delay.show()
adj = Gtk.Adjustment(value=100, lower=0, upper=_MAX_DELAY,
step_incr=100, page_incr=100, page_size=0)
self._edge_delay_slider = Gtk.HScale()
self._edge_delay_slider.set_adjustment(adj)
#.........这里部分代码省略.........
示例3: Network
# 需要导入模块: from jarabe.controlpanel.inlinealert import InlineAlert [as 别名]
# 或者: from jarabe.controlpanel.inlinealert.InlineAlert import show [as 别名]
class Network(SectionView):
def __init__(self, model, alerts):
SectionView.__init__(self)
self._model = model
self.restart_alerts = alerts
self._jabber_sid = 0
self._radio_valid = True
self._jabber_change_handler = None
self._radio_change_handler = None
self._wireless_configuration_reset_handler = None
self._start_jabber = self._model.get_jabber()
self._proxy_settings = {}
self._proxy_inline_alerts = {}
self.set_border_width(style.DEFAULT_SPACING * 2)
self.set_spacing(style.DEFAULT_SPACING)
group = Gtk.SizeGroup(Gtk.SizeGroupMode.HORIZONTAL)
self._radio_alert_box = Gtk.HBox(spacing=style.DEFAULT_SPACING)
scrolled = Gtk.ScrolledWindow()
scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
self.add(scrolled)
scrolled.show()
workspace = Gtk.VBox()
scrolled.add_with_viewport(workspace)
workspace.show()
separator_wireless = Gtk.HSeparator()
workspace.pack_start(separator_wireless, False, True, 0)
separator_wireless.show()
label_wireless = Gtk.Label(label=_('Wireless'))
label_wireless.set_alignment(0, 0)
workspace.pack_start(label_wireless, False, True, 0)
label_wireless.show()
box_wireless = Gtk.VBox()
box_wireless.set_border_width(style.DEFAULT_SPACING * 2)
box_wireless.set_spacing(style.DEFAULT_SPACING)
radio_info = Gtk.Label(label=_('The wireless radio may be turned'
' off to save battery life.'))
radio_info.set_alignment(0, 0)
radio_info.set_line_wrap(True)
radio_info.show()
box_wireless.pack_start(radio_info, False, True, 0)
box_radio = Gtk.HBox(spacing=style.DEFAULT_SPACING)
self._button = Gtk.CheckButton()
self._button.set_alignment(0, 0)
box_radio.pack_start(self._button, False, True, 0)
self._button.show()
label_radio = Gtk.Label(label=_('Radio'))
label_radio.set_alignment(0, 0.5)
box_radio.pack_start(label_radio, False, True, 0)
label_radio.show()
box_wireless.pack_start(box_radio, False, True, 0)
box_radio.show()
self._radio_alert = InlineAlert()
self._radio_alert_box.pack_start(self._radio_alert, False, True, 0)
box_radio.pack_end(self._radio_alert_box, False, True, 0)
self._radio_alert_box.show()
if 'radio' in self.restart_alerts:
self._radio_alert.props.msg = self.restart_msg
self._radio_alert.show()
wireless_info = Gtk.Label(
label=_('Discard wireless connections if'
' you have trouble connecting to the network'))
wireless_info.set_alignment(0, 0)
wireless_info.set_line_wrap(True)
wireless_info.show()
box_wireless.pack_start(wireless_info, False, True, 0)
box_clear_wireless = Gtk.HBox(spacing=style.DEFAULT_SPACING)
self._clear_wireless_button = Gtk.Button()
self._clear_wireless_button.set_label(
_('Discard wireless connections'))
box_clear_wireless.pack_start(
self._clear_wireless_button, False, True, 0)
if not self._model.have_wireless_networks():
self._clear_wireless_button.set_sensitive(False)
self._clear_wireless_button.show()
box_wireless.pack_start(box_clear_wireless, False, True, 0)
box_clear_wireless.show()
workspace.pack_start(box_wireless, False, True, 0)
box_wireless.show()
separator_mesh = Gtk.HSeparator()
workspace.pack_start(separator_mesh, False, False, 0)
separator_mesh.show()
label_mesh = Gtk.Label(label=_('Collaboration'))
label_mesh.set_alignment(0, 0)
#.........这里部分代码省略.........
示例4: AboutMe
# 需要导入模块: from jarabe.controlpanel.inlinealert import InlineAlert [as 别名]
# 或者: from jarabe.controlpanel.inlinealert.InlineAlert import show [as 别名]
class AboutMe(SectionView):
def __init__(self, model, alerts):
SectionView.__init__(self)
self._model = model
self.restart_alerts = alerts if alerts else set()
self._nick_sid = 0
self._color_valid = True
self._nick_valid = True
self._color = None
self._gender = ''
self._age = None
self.set_border_width(style.DEFAULT_SPACING * 2)
self.set_spacing(style.DEFAULT_SPACING)
self._color = XoColor(self._model.get_color())
self._original_nick = self._model.get_nick()
self._setup_color()
self._setup_nick()
self._setup_gender()
self._setup_age()
self._update_pickers(self._color)
self._nick_entry.set_text(self._original_nick)
self._color_valid = True
self._nick_valid = True
self.needs_restart = False
self._nick_entry.connect('changed', self.__nick_changed_cb)
for picker in self._pickers.values():
picker.connect('color-changed', self.__color_changed_cb)
self._female_picker.connect('gender-changed', self.__gender_changed_cb)
self._male_picker.connect('gender-changed', self.__gender_changed_cb)
for picker in self._age_pickers:
picker.connect('age-changed', self.__age_changed_cb)
def _setup_nick(self):
grid = Gtk.Grid()
grid.set_row_spacing(style.DEFAULT_SPACING)
grid.set_column_spacing(style.DEFAULT_SPACING)
self._nick_entry = Gtk.Entry()
self._nick_entry.set_width_chars(25)
grid.attach(self._nick_entry, 0, 0, 1, 1)
self._nick_entry.show()
alert_grid = Gtk.Grid()
self._nick_alert = InlineAlert()
alert_grid.attach(self._nick_alert, 0, 0, 1, 1)
if 'nick' in self.restart_alerts:
self._nick_alert.props.msg = self.restart_msg
self._nick_alert.show()
center_in_panel = Gtk.Alignment.new(0.5, 0, 0, 0)
center_in_panel.add(grid)
grid.show()
center_alert = Gtk.Alignment.new(0.5, 0, 0, 0)
center_alert.add(alert_grid)
alert_grid.show()
self.pack_start(center_in_panel, False, False, 0)
self.pack_start(center_alert, False, False, 0)
center_in_panel.show()
center_alert.show()
def _setup_color(self):
grid = Gtk.Grid()
grid.set_row_spacing(style.DEFAULT_SPACING)
grid.set_column_spacing(style.DEFAULT_SPACING)
self._color_alert = None
self._pickers = {
_PREVIOUS_FILL_COLOR: ColorPicker(_PREVIOUS_FILL_COLOR),
_NEXT_FILL_COLOR: ColorPicker(_NEXT_FILL_COLOR),
_CURRENT_COLOR: ColorPicker(_CURRENT_COLOR),
_NEXT_STROKE_COLOR: ColorPicker(_NEXT_STROKE_COLOR),
_PREVIOUS_STROKE_COLOR: ColorPicker(_PREVIOUS_STROKE_COLOR),
}
label_color = Gtk.Label(label=_('Click to change your color:'))
label_color.modify_fg(Gtk.StateType.NORMAL,
style.COLOR_SELECTION_GREY.get_gdk_color())
grid.attach(label_color, 0, 0, 3, 1)
label_color.show()
current = 0
for picker_index in sorted(self._pickers.keys()):
if picker_index == _CURRENT_COLOR:
left_separator = Gtk.SeparatorToolItem()
grid.attach(left_separator, current, 1, 1, 1)
left_separator.show()
#.........这里部分代码省略.........
示例5: TimeZone
# 需要导入模块: from jarabe.controlpanel.inlinealert import InlineAlert [as 别名]
# 或者: from jarabe.controlpanel.inlinealert.InlineAlert import show [as 别名]
class TimeZone(SectionView):
def __init__(self, model, alerts):
SectionView.__init__(self)
self._model = model
self.restart_alerts = alerts
self._zone_sid = 0
self._cursor_change_handler = None
self.set_border_width(style.DEFAULT_SPACING * 2)
self.set_spacing(style.DEFAULT_SPACING)
self.connect('realize', self.__realize_cb)
self._entry = iconentry.IconEntry()
self._entry.set_icon_from_name(iconentry.ICON_ENTRY_PRIMARY,
'entry-search')
self._entry.add_clear_button()
self.pack_start(self._entry, False, False, 0)
self._entry.show()
self._scrolled_window = Gtk.ScrolledWindow()
self._scrolled_window.set_policy(Gtk.PolicyType.NEVER,
Gtk.PolicyType.AUTOMATIC)
self._scrolled_window.set_shadow_type(Gtk.ShadowType.IN)
self._store = Gtk.ListStore(GObject.TYPE_STRING)
zones = model.read_all_timezones()
for zone in zones:
self._store.append([zone])
self._treeview = Gtk.TreeView(self._store)
self._treeview.set_search_entry(self._entry)
self._treeview.set_search_equal_func(self._search, None)
self._treeview.set_search_column(0)
self._scrolled_window.add(self._treeview)
self._treeview.show()
self._timezone_column = Gtk.TreeViewColumn(_('Timezone'))
self._cell = Gtk.CellRendererText()
self._timezone_column.pack_start(self._cell, True)
self._timezone_column.add_attribute(self._cell, 'text', 0)
self._timezone_column.set_sort_column_id(0)
self._treeview.append_column(self._timezone_column)
self.pack_start(self._scrolled_window, True, True, 0)
self._scrolled_window.show()
self._zone_alert_box = Gtk.HBox(spacing=style.DEFAULT_SPACING)
self.pack_start(self._zone_alert_box, False, False, 0)
self._zone_alert = InlineAlert()
self._zone_alert_box.pack_start(self._zone_alert, True, True, 0)
if 'zone' in self.restart_alerts:
self._zone_alert.props.msg = self.restart_msg
self._zone_alert.show()
self._zone_alert_box.show()
self.setup()
def setup(self):
zone = self._model.get_timezone()
for row in self._store:
if zone == row[0]:
self._treeview.set_cursor(row.path, self._timezone_column,
False)
self._treeview.scroll_to_cell(row.path, self._timezone_column,
True, 0.5, 0.5)
break
self.needs_restart = False
self._cursor_change_handler = self._treeview.connect(
'cursor-changed', self.__zone_changed_cd)
def undo(self):
self._treeview.disconnect(self._cursor_change_handler)
self._model.undo()
self._zone_alert.hide()
def __realize_cb(self, widget):
self._entry.grab_focus()
def _search(self, model, column, key, iterator, data=None):
value = model.get_value(iterator, column)
if key.lower() in value.lower():
return False
return True
def __zone_changed_cd(self, treeview, data=None):
list_, row = treeview.get_selection().get_selected()
if not row:
return False
if self._model.get_timezone() == self._store.get_value(row, 0):
return False
if self._zone_sid:
GObject.source_remove(self._zone_sid)
self._zone_sid = GObject.timeout_add(self._APPLY_TIMEOUT,
self.__zone_timeout_cb, row)
return True
#.........这里部分代码省略.........
示例6: Network
# 需要导入模块: from jarabe.controlpanel.inlinealert import InlineAlert [as 别名]
# 或者: from jarabe.controlpanel.inlinealert.InlineAlert import show [as 别名]
class Network(SectionView):
def __init__(self, model, alerts):
SectionView.__init__(self)
self._model = model
self.restart_alerts = alerts
self._jabber_sid = 0
self._jabber_valid = True
self._radio_valid = True
self._jabber_change_handler = None
self._radio_change_handler = None
self._wireless_configuration_reset_handler = None
self._start_jabber = self._model.get_jabber()
self.set_border_width(style.DEFAULT_SPACING * 2)
self.set_spacing(style.DEFAULT_SPACING)
group = Gtk.SizeGroup(Gtk.SizeGroupMode.HORIZONTAL)
self._radio_alert_box = Gtk.HBox(spacing=style.DEFAULT_SPACING)
self._jabber_alert_box = Gtk.HBox(spacing=style.DEFAULT_SPACING)
scrolled = Gtk.ScrolledWindow()
scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
self.add(scrolled)
scrolled.show()
workspace = Gtk.VBox()
scrolled.add_with_viewport(workspace)
workspace.show()
separator_wireless = Gtk.HSeparator()
workspace.pack_start(separator_wireless, False, True, 0)
separator_wireless.show()
label_wireless = Gtk.Label(label=_('Wireless'))
label_wireless.set_alignment(0, 0)
workspace.pack_start(label_wireless, False, True, 0)
label_wireless.show()
box_wireless = Gtk.VBox()
box_wireless.set_border_width(style.DEFAULT_SPACING * 2)
box_wireless.set_spacing(style.DEFAULT_SPACING)
radio_info = Gtk.Label(label=_('The wireless radio may be turned'
' off to save battery life.'))
radio_info.set_alignment(0, 0)
radio_info.set_line_wrap(True)
radio_info.show()
box_wireless.pack_start(radio_info, False, True, 0)
box_radio = Gtk.HBox(spacing=style.DEFAULT_SPACING)
self._button = Gtk.CheckButton()
self._button.set_alignment(0, 0)
box_radio.pack_start(self._button, False, True, 0)
self._button.show()
label_radio = Gtk.Label(label=_('Radio'))
label_radio.set_alignment(0, 0.5)
box_radio.pack_start(label_radio, False, True, 0)
label_radio.show()
box_wireless.pack_start(box_radio, False, True, 0)
box_radio.show()
self._radio_alert = InlineAlert()
self._radio_alert_box.pack_start(self._radio_alert, False, True, 0)
box_radio.pack_end(self._radio_alert_box, False, True, 0)
self._radio_alert_box.show()
if 'radio' in self.restart_alerts:
self._radio_alert.props.msg = self.restart_msg
self._radio_alert.show()
wireless_info = Gtk.Label(
label=_('Discard wireless connections if'
' you have trouble connecting to the network'))
wireless_info.set_alignment(0, 0)
wireless_info.set_line_wrap(True)
wireless_info.show()
box_wireless.pack_start(wireless_info, False, True, 0)
box_clear_wireless = Gtk.HBox(spacing=style.DEFAULT_SPACING)
self._clear_wireless_button = Gtk.Button()
self._clear_wireless_button.set_label(
_('Discard wireless connections'))
box_clear_wireless.pack_start(
self._clear_wireless_button, False, True, 0)
if not self._model.have_wireless_networks():
self._clear_wireless_button.set_sensitive(False)
self._clear_wireless_button.show()
box_wireless.pack_start(box_clear_wireless, False, True, 0)
box_clear_wireless.show()
workspace.pack_start(box_wireless, False, True, 0)
box_wireless.show()
separator_mesh = Gtk.HSeparator()
workspace.pack_start(separator_mesh, False, False, 0)
separator_mesh.show()
label_mesh = Gtk.Label(label=_('Collaboration'))
label_mesh.set_alignment(0, 0)
#.........这里部分代码省略.........
示例7: Network
# 需要导入模块: from jarabe.controlpanel.inlinealert import InlineAlert [as 别名]
# 或者: from jarabe.controlpanel.inlinealert.InlineAlert import show [as 别名]
class Network(SectionView):
def __init__(self, model, alerts):
SectionView.__init__(self)
self._model = model
self.restart_alerts = alerts
self._jabber_sid = 0
self._jabber_valid = True
self._radio_valid = True
self._jabber_change_handler = None
self._radio_change_handler = None
self._wireless_configuration_reset_handler = None
self.set_border_width(style.DEFAULT_SPACING * 2)
self.set_spacing(style.DEFAULT_SPACING)
group = Gtk.SizeGroup(Gtk.SizeGroupMode.HORIZONTAL)
self._radio_alert_box = Gtk.HBox(spacing=style.DEFAULT_SPACING)
self._jabber_alert_box = Gtk.HBox(spacing=style.DEFAULT_SPACING)
scrolled = Gtk.ScrolledWindow()
scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
self.add(scrolled)
scrolled.show()
workspace = Gtk.VBox()
scrolled.add_with_viewport(workspace)
workspace.show()
separator_wireless = Gtk.HSeparator()
workspace.pack_start(separator_wireless, False, True, 0)
separator_wireless.show()
label_wireless = Gtk.Label(label=_('Wireless'))
label_wireless.set_alignment(0, 0)
workspace.pack_start(label_wireless, False, True, 0)
label_wireless.show()
box_wireless = Gtk.VBox()
box_wireless.set_border_width(style.DEFAULT_SPACING * 2)
box_wireless.set_spacing(style.DEFAULT_SPACING)
radio_info = Gtk.Label(label=_('The wireless radio may be turned'
' off to save battery life.'))
radio_info.set_alignment(0, 0)
radio_info.set_line_wrap(True)
radio_info.show()
box_wireless.pack_start(radio_info, False, True, 0)
box_radio = Gtk.HBox(spacing=style.DEFAULT_SPACING)
self._button = Gtk.CheckButton()
self._button.set_alignment(0, 0)
box_radio.pack_start(self._button, False, True, 0)
self._button.show()
label_radio = Gtk.Label(label=_('Radio'))
label_radio.set_alignment(0, 0.5)
box_radio.pack_start(label_radio, False, True, 0)
label_radio.show()
box_wireless.pack_start(box_radio, False, True, 0)
box_radio.show()
self._radio_alert = InlineAlert()
self._radio_alert_box.pack_start(self._radio_alert, False, True, 0)
box_radio.pack_end(self._radio_alert_box, False, True, 0)
self._radio_alert_box.show()
if 'radio' in self.restart_alerts:
self._radio_alert.props.msg = self.restart_msg
self._radio_alert.show()
wireless_info = Gtk.Label(
label=_('Discard wireless connections if'
' you have trouble connecting to the network'))
wireless_info.set_alignment(0, 0)
wireless_info.set_line_wrap(True)
wireless_info.show()
box_wireless.pack_start(wireless_info, False, True, 0)
box_clear_wireless = Gtk.HBox(spacing=style.DEFAULT_SPACING)
self._clear_wireless_button = Gtk.Button()
self._clear_wireless_button.set_label(
_('Discard wireless connections'))
box_clear_wireless.pack_start(
self._clear_wireless_button, False, True, 0)
if not self._model.have_wireless_networks():
self._clear_wireless_button.set_sensitive(False)
self._clear_wireless_button.show()
box_wireless.pack_start(box_clear_wireless, False, True, 0)
box_clear_wireless.show()
workspace.pack_start(box_wireless, False, True, 0)
box_wireless.show()
separator_mesh = Gtk.HSeparator()
workspace.pack_start(separator_mesh, False, False, 0)
separator_mesh.show()
label_mesh = Gtk.Label(label=_('Collaboration'))
label_mesh.set_alignment(0, 0)
workspace.pack_start(label_mesh, False, True, 0)
#.........这里部分代码省略.........
示例8: Network
# 需要导入模块: from jarabe.controlpanel.inlinealert import InlineAlert [as 别名]
# 或者: from jarabe.controlpanel.inlinealert.InlineAlert import show [as 别名]
class Network(SectionView):
def __init__(self, model, alerts):
SectionView.__init__(self)
self._model = model
self.restart_alerts = alerts
self._jabber_sid = 0
self._jabber_valid = True
self._radio_valid = True
self._jabber_change_handler = None
self._radio_change_handler = None
self._network_configuration_reset_handler = None
self.set_border_width(style.DEFAULT_SPACING * 2)
self.set_spacing(style.DEFAULT_SPACING)
group = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
self._radio_alert_box = gtk.HBox(spacing=style.DEFAULT_SPACING)
self._jabber_alert_box = gtk.HBox(spacing=style.DEFAULT_SPACING)
workspace = gtk.VBox()
workspace.show()
separator_wireless = gtk.HSeparator()
workspace.pack_start(separator_wireless, expand=False)
separator_wireless.show()
label_wireless = gtk.Label(_('Wireless'))
label_wireless.set_alignment(0, 0)
workspace.pack_start(label_wireless, expand=False)
label_wireless.show()
box_wireless = gtk.VBox()
box_wireless.set_border_width(style.DEFAULT_SPACING * 2)
box_wireless.set_spacing(style.DEFAULT_SPACING)
radio_info = gtk.Label(_('Turn off the wireless radio to save battery'
' life'))
radio_info.set_alignment(0, 0)
radio_info.set_line_wrap(True)
radio_info.show()
box_wireless.pack_start(radio_info, expand=False)
box_radio = gtk.HBox(spacing=style.DEFAULT_SPACING)
self._button = gtk.CheckButton()
self._button.set_alignment(0, 0)
box_radio.pack_start(self._button, expand=False)
self._button.show()
label_radio = gtk.Label(_('Radio'))
label_radio.set_alignment(0, 0.5)
box_radio.pack_start(label_radio, expand=False)
label_radio.show()
box_wireless.pack_start(box_radio, expand=False)
box_radio.show()
self._radio_alert = InlineAlert()
self._radio_alert_box.pack_start(self._radio_alert, expand=False)
box_radio.pack_end(self._radio_alert_box, expand=False)
self._radio_alert_box.show()
if 'radio' in self.restart_alerts:
self._radio_alert.props.msg = self.restart_msg
self._radio_alert.show()
history_info = gtk.Label(_('Discard network history if you have'
' trouble connecting to the network'))
history_info.set_alignment(0, 0)
history_info.set_line_wrap(True)
history_info.show()
box_wireless.pack_start(history_info, expand=False)
box_clear_history = gtk.HBox(spacing=style.DEFAULT_SPACING)
self._clear_history_button = gtk.Button()
self._clear_history_button.set_label(_('Discard network history'))
box_clear_history.pack_start(self._clear_history_button, expand=False)
if not self._model.have_networks():
self._clear_history_button.set_sensitive(False)
self._clear_history_button.show()
box_wireless.pack_start(box_clear_history, expand=False)
box_clear_history.show()
workspace.pack_start(box_wireless, expand=False)
box_wireless.show()
separator_mesh = gtk.HSeparator()
workspace.pack_start(separator_mesh, False)
separator_mesh.show()
label_mesh = gtk.Label(_('Collaboration'))
label_mesh.set_alignment(0, 0)
workspace.pack_start(label_mesh, expand=False)
label_mesh.show()
box_mesh = gtk.VBox()
box_mesh.set_border_width(style.DEFAULT_SPACING * 2)
box_mesh.set_spacing(style.DEFAULT_SPACING)
server_info = gtk.Label(_("The server is the equivalent of what"
" room you are in; people on the same server"
" will be able to see each other, even when"
" they aren't on the same network."))
#.........这里部分代码省略.........
示例9: Language
# 需要导入模块: from jarabe.controlpanel.inlinealert import InlineAlert [as 别名]
# 或者: from jarabe.controlpanel.inlinealert.InlineAlert import show [as 别名]
class Language(SectionView):
def __init__(self, model, alerts):
SectionView.__init__(self)
self._model = model
self.restart_alerts = alerts
self.props.is_deferrable = False
self._lang_sid = 0
self._selected_lang_count = 0
self._labels = []
self._language_dict = {}
self._country_dict = {}
self._language_buttons = []
self._country_buttons = []
self._language_widgets = []
self._country_widgets = []
self._country_codes = []
self._add_remove_boxes = []
self._changed = False
self._cursor_change_handler = None
self._available_locales = self._model.read_all_languages()
self._selected_locales = self._model.get_languages()
for language, country, code in self._available_locales:
if language not in self._language_dict:
self._language_dict[language] = _translate_language(language)
self._country_dict[language] = [[code, country]]
else:
self._country_dict[language].append([code, country])
self.set_border_width(style.DEFAULT_SPACING * 2)
self.set_spacing(style.DEFAULT_SPACING)
explanation = gettext.gettext('Add languages in the order you prefer.'
' If a translation is not available,'
' the next in the list will be used.')
self._text = Gtk.Label(label=explanation)
self._text.set_line_wrap(True)
self._text.set_alignment(0, 0)
self.pack_start(self._text, False, False, 0)
self._text.show()
scrolled = Gtk.ScrolledWindow()
scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
scrolled.show()
self.pack_start(scrolled, True, True, 0)
self._table = Gtk.Table(rows=2, columns=4, homogeneous=False)
self._table.set_border_width(style.DEFAULT_SPACING * 2)
self._table.show()
scrolled.add_with_viewport(self._table)
self._lang_alert_box = Gtk.HBox(spacing=style.DEFAULT_SPACING)
self.pack_start(self._lang_alert_box, False, True, 0)
self._lang_alert = InlineAlert()
self._lang_alert_box.pack_start(self._lang_alert, True, True, 0)
if 'lang' in self.restart_alerts:
self._lang_alert.props.msg = self.restart_msg
self._lang_alert.show()
self._lang_alert_box.show()
self.setup()
def _add_row(self, locale_code=None):
"""Adds two rows to the table:
(1) the buttons and labels for language and country;
(2) the tables of languages and country options"""
self._selected_lang_count += 1
self._table.resize(self._selected_lang_count * 2, 3)
label = Gtk.Label(label=str(self._selected_lang_count))
label.modify_fg(Gtk.StateType.NORMAL,
style.COLOR_SELECTION_GREY.get_gdk_color())
self._labels.append(label)
self._attach_to_table(label, 0, 1, self._selected_lang_count * 2 - 1,
xpadding=1, ypadding=1)
label.show()
locale_language = None
locale_country = None
if locale_code is not None:
for language, country, code in self._available_locales:
if code == locale_code:
locale_language = language
locale_country = country
for language, country, code in self._available_locales:
if code == '.'.join([locale_code, 'utf8']):
locale_language = language
locale_country = country
language_palette = []
key_list = self._language_dict.keys()
for language_key in sorted(key_list):
language_palette.append(
{'label': self._language_dict[language_key],
#.........这里部分代码省略.........
示例10: Language
# 需要导入模块: from jarabe.controlpanel.inlinealert import InlineAlert [as 别名]
# 或者: from jarabe.controlpanel.inlinealert.InlineAlert import show [as 别名]
class Language(SectionView):
def __init__(self, model, alerts):
SectionView.__init__(self)
self._model = model
self.restart_alerts = alerts
self._lang_sid = 0
self._selected_lang_count = 0
self._labels = []
self._stores = []
self._comboboxes = []
self._add_remove_boxes = []
self._changed = False
self._cursor_change_handler = None
self._available_locales = self._model.read_all_languages()
self._selected_locales = self._model.get_languages()
self.set_border_width(style.DEFAULT_SPACING * 2)
self.set_spacing(style.DEFAULT_SPACING)
explanation = gettext.gettext('Add languages in the order you prefer.'
' If a translation is not available,'
' the next in the list will be used.')
self._text = Gtk.Label(label=explanation)
self._text.set_line_wrap(True)
self._text.set_alignment(0, 0)
self.pack_start(self._text, False, False, 0)
self._text.show()
scrolled = Gtk.ScrolledWindow()
scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
scrolled.show()
self.pack_start(scrolled, True, True, 0)
self._table = Gtk.Table(rows=1, columns=3, homogeneous=False)
self._table.set_border_width(style.DEFAULT_SPACING * 2)
self._table.show()
scrolled.add_with_viewport(self._table)
self._lang_alert_box = Gtk.HBox(spacing=style.DEFAULT_SPACING)
self.pack_start(self._lang_alert_box, False, True, 0)
self._lang_alert = InlineAlert()
self._lang_alert_box.pack_start(self._lang_alert, True, True, 0)
if 'lang' in self.restart_alerts:
self._lang_alert.props.msg = self.restart_msg
self._lang_alert.show()
self._lang_alert_box.show()
self.setup()
def _add_row(self, locale_code=None):
"""Adds a row to the table"""
self._selected_lang_count += 1
self._table.resize(self._selected_lang_count, 3)
label = Gtk.Label(label=str(self._selected_lang_count))
label.modify_fg(Gtk.StateType.NORMAL,
style.COLOR_SELECTION_GREY.get_gdk_color())
self._labels.append(label)
self._attach_to_table(label, 0, 1, padding=1)
label.show()
store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING)
for language, country, code in self._available_locales:
description = '%s (%s)' % (_translate_language(language),
_translate_country(country))
store.append([code, description])
combobox = Gtk.ComboBox(model=store)
cell = Gtk.CellRendererText()
combobox.pack_start(cell, True)
combobox.add_attribute(cell, 'text', 1)
if locale_code:
for row in store:
lang = locale_code.split('.')[0]
lang_column = row[0].split('.')[0]
if lang in lang_column:
combobox.set_active_iter(row.iter)
break
else:
combobox.set_active(1)
combobox.connect('changed', self.__combobox_changed_cb)
self._stores.append(store)
self._comboboxes.append(combobox)
self._attach_to_table(
combobox, 1, 2, yoptions=Gtk.AttachOptions.SHRINK)
add_remove_box = self._create_add_remove_box()
self._add_remove_boxes.append(add_remove_box)
self._attach_to_table(add_remove_box, 2, 3)
add_remove_box.show_all()
#.........这里部分代码省略.........
示例11: AboutMe
# 需要导入模块: from jarabe.controlpanel.inlinealert import InlineAlert [as 别名]
# 或者: from jarabe.controlpanel.inlinealert.InlineAlert import show [as 别名]
class AboutMe(SectionView):
def __init__(self, model, alerts):
SectionView.__init__(self)
self._model = model
self.restart_alerts = alerts
self._nick_sid = 0
self._color_valid = True
self._nick_valid = True
self.set_border_width(style.DEFAULT_SPACING * 2)
self.set_spacing(style.DEFAULT_SPACING)
self._group = Gtk.SizeGroup(Gtk.SizeGroupMode.HORIZONTAL)
self._color_label = Gtk.HBox(spacing=style.DEFAULT_SPACING)
self._color_box = Gtk.HBox(spacing=style.DEFAULT_SPACING)
self._color_alert_box = Gtk.HBox(spacing=style.DEFAULT_SPACING)
self._color_alert = None
self._pickers = {
_PREVIOUS_FILL_COLOR: ColorPicker(_PREVIOUS_FILL_COLOR),
_NEXT_FILL_COLOR: ColorPicker(_NEXT_FILL_COLOR),
_CURRENT_COLOR: ColorPicker(_CURRENT_COLOR),
_NEXT_STROKE_COLOR: ColorPicker(_NEXT_STROKE_COLOR),
_PREVIOUS_STROKE_COLOR: ColorPicker(_PREVIOUS_STROKE_COLOR),
}
self._setup_color()
initial_color = XoColor(self._model.get_color_xo())
self._update_pickers(initial_color)
self._nick_box = Gtk.HBox(spacing=style.DEFAULT_SPACING)
self._nick_alert_box = Gtk.HBox(spacing=style.DEFAULT_SPACING)
self._nick_entry = None
self._nick_alert = None
self._setup_nick()
self.setup()
def _setup_nick(self):
self._nick_entry = Gtk.Entry()
self._nick_entry.set_width_chars(25)
self._nick_box.pack_start(self._nick_entry, False, True, 0)
self._nick_entry.show()
label_entry_error = Gtk.Label()
self._group.add_widget(label_entry_error)
self._nick_alert_box.pack_start(label_entry_error, False, True, 0)
label_entry_error.show()
self._nick_alert = InlineAlert()
self._nick_alert_box.pack_start(self._nick_alert, True, True, 0)
if 'nick' in self.restart_alerts:
self._nick_alert.props.msg = self.restart_msg
self._nick_alert.show()
self._center_in_panel = Gtk.Alignment.new(0.5, 0, 0, 0)
self._center_in_panel.add(self._nick_box)
self.pack_start(self._center_in_panel, False, False, 0)
self.pack_start(self._nick_alert_box, False, False, 0)
self._nick_box.show()
self._nick_alert_box.show()
self._center_in_panel.show()
def _setup_color(self):
label_color = Gtk.Label(label=_('Click to change your color:'))
label_color.modify_fg(Gtk.StateType.NORMAL,
style.COLOR_SELECTION_GREY.get_gdk_color())
self._group.add_widget(label_color)
self._color_label.pack_start(label_color, False, True, 0)
label_color.show()
for picker_index in sorted(self._pickers.keys()):
if picker_index == _CURRENT_COLOR:
left_separator = Gtk.SeparatorToolItem()
left_separator.show()
self._color_box.pack_start(left_separator, False, True, 0)
picker = self._pickers[picker_index]
picker.show()
self._color_box.pack_start(picker, False, True, 0)
if picker_index == _CURRENT_COLOR:
right_separator = Gtk.SeparatorToolItem()
right_separator.show()
self._color_box.pack_start(right_separator, False, True, 0)
label_color_error = Gtk.Label()
self._group.add_widget(label_color_error)
self._color_alert_box.pack_start(label_color_error, False, True, 0)
label_color_error.show()
self._color_alert = InlineAlert()
self._color_alert_box.pack_start(self._color_alert, True, True, 0)
if 'color' in self.restart_alerts:
self._color_alert.props.msg = self.restart_msg
self._color_alert.show()
self._center_in_panel = Gtk.Alignment.new(0.5, 0, 0, 0)
self._center_in_panel.add(self._color_box)
#.........这里部分代码省略.........
示例12: Power
# 需要导入模块: from jarabe.controlpanel.inlinealert import InlineAlert [as 别名]
# 或者: from jarabe.controlpanel.inlinealert.InlineAlert import show [as 别名]
class Power(SectionView):
def __init__(self, model, alerts):
SectionView.__init__(self)
self._model = model
self.restart_alerts = alerts
self._automatic_pm_valid = True
self._automatic_pm_change_handler = None
self.set_border_width(style.DEFAULT_SPACING * 2)
self.set_spacing(style.DEFAULT_SPACING)
group = Gtk.SizeGroup(Gtk.SizeGroupMode.HORIZONTAL)
self._automatic_pm_alert_box = Gtk.HBox(spacing=style.DEFAULT_SPACING)
separator_pm = Gtk.HSeparator()
self.pack_start(separator_pm, False, True, 0)
separator_pm.show()
label_pm = Gtk.Label(label=_('Power management'))
label_pm.set_alignment(0, 0)
self.pack_start(label_pm, False, True, 0)
label_pm.show()
box_pm = Gtk.VBox()
box_pm.set_border_width(style.DEFAULT_SPACING * 2)
box_pm.set_spacing(style.DEFAULT_SPACING)
box_automatic_pm = Gtk.HBox(spacing=style.DEFAULT_SPACING)
label_automatic_pm = Gtk.Label(
label=_('Automatic power management (increases battery life)'))
label_automatic_pm.set_alignment(0, 0.5)
self._automatic_button = Gtk.CheckButton()
self._automatic_button.set_alignment(0, 0)
box_automatic_pm.pack_start(self._automatic_button, False, True, 0)
box_automatic_pm.pack_start(label_automatic_pm, False, True, 0)
self._automatic_button.show()
label_automatic_pm.show()
group.add_widget(label_automatic_pm)
box_pm.pack_start(box_automatic_pm, False, True, 0)
box_automatic_pm.show()
self._automatic_pm_alert = InlineAlert()
label_automatic_pm_error = Gtk.Label()
group.add_widget(label_automatic_pm_error)
self._automatic_pm_alert_box.pack_start(label_automatic_pm_error,
expand=False, fill=True,
padding=0)
label_automatic_pm_error.show()
self._automatic_pm_alert_box.pack_start(self._automatic_pm_alert,
expand=False, fill=True,
padding=0)
box_pm.pack_end(self._automatic_pm_alert_box, False, True, 0)
self._automatic_pm_alert_box.show()
if 'automatic_pm' in self.restart_alerts:
self._automatic_pm_alert.props.msg = self.restart_msg
self._automatic_pm_alert.show()
self.pack_start(box_pm, False, True, 0)
box_pm.show()
self.setup()
def setup(self):
try:
automatic_state = self._model.get_automatic_pm()
except Exception as detail:
self._automatic_pm_alert.props.msg = detail
self._automatic_pm_alert.show()
else:
self._automatic_button.set_active(automatic_state)
self._automatic_pm_valid = True
self.needs_restart = False
self._automatic_pm_change_handler = self._automatic_button.connect(
'toggled', self.__automatic_pm_toggled_cb)
def undo(self):
self._automatic_button.disconnect(self._automatic_pm_change_handler)
self._model.undo()
self._automatic_pm_alert.hide()
def _validate(self):
if self._automatic_pm_valid:
self.props.is_valid = True
else:
self.props.is_valid = False
def __automatic_pm_toggled_cb(self, widget, data=None):
state = widget.get_active()
try:
self._model.set_automatic_pm(state)
except Exception as detail:
print(detail)
self._automatic_pm_alert.props.msg = detail
else:
self._automatic_pm_valid = True
self._validate()
return False
示例13: Language
# 需要导入模块: from jarabe.controlpanel.inlinealert import InlineAlert [as 别名]
# 或者: from jarabe.controlpanel.inlinealert.InlineAlert import show [as 别名]
class Language(SectionView):
def __init__(self, model, alerts):
SectionView.__init__(self)
self._model = model
self.restart_alerts = alerts
self._lang_sid = 0
self._selected_lang_count = 0
self._labels = []
self._stores = []
self._comboboxes = []
self._add_remove_boxes = []
self._changed = False
self._cursor_change_handler = None
self._available_locales = self._model.read_all_languages()
self._selected_locales = self._model.get_languages()
self.set_border_width(style.DEFAULT_SPACING * 2)
self.set_spacing(style.DEFAULT_SPACING)
explanation = gettext.gettext('Add languages in the order you prefer.'
' If a translation is not available,'
' the next in the list will be used.')
self._text = gtk.Label(explanation)
self._text.set_width_chars(100)
self._text.set_line_wrap(True)
self._text.set_alignment(0, 0)
self.pack_start(self._text, False)
self._text.show()
scrolled = gtk.ScrolledWindow()
scrolled.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
scrolled.show()
self.pack_start(scrolled, expand=True)
self._table = gtk.Table(rows=1, columns=3, homogeneous=False)
self._table.set_border_width(style.DEFAULT_SPACING * 2)
self._table.show()
scrolled.add_with_viewport(self._table)
self._lang_alert_box = gtk.HBox(spacing=style.DEFAULT_SPACING)
self.pack_start(self._lang_alert_box, False)
self._lang_alert = InlineAlert()
self._lang_alert_box.pack_start(self._lang_alert)
if 'lang' in self.restart_alerts:
self._lang_alert.props.msg = self.restart_msg
self._lang_alert.show()
self._lang_alert_box.show()
self.setup()
def _add_row(self, locale_code=None):
"""Adds a row to the table"""
self._selected_lang_count += 1
self._table.resize(self._selected_lang_count, 3)
label = gtk.Label(str=str(self._selected_lang_count))
label.modify_fg(gtk.STATE_NORMAL,
style.COLOR_SELECTION_GREY.get_gdk_color())
self._labels.append(label)
self._attach_to_table(label, 0, 1, padding=1)
label.show()
store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
for language, country, code in self._available_locales:
description = '%s (%s)' % (_translate_language(language), \
_translate_country(country))
store.append([code, description])
combobox = gtk.ComboBox(model=store)
cell = gtk.CellRendererText()
combobox.pack_start(cell)
combobox.add_attribute(cell, 'text', 1)
if locale_code:
for row in store:
lang = locale_code.split('.')[0]
lang_column = row[0].split('.')[0]
if lang in lang_column:
combobox.set_active_iter(row.iter)
break
else:
combobox.set_active(1)
combobox.connect('changed', self.__combobox_changed_cb)
self._stores.append(store)
self._comboboxes.append(combobox)
self._attach_to_table(combobox, 1, 2, yoptions=gtk.SHRINK)
add_remove_box = self._create_add_remove_box()
self._add_remove_boxes.append(add_remove_box)
self._attach_to_table(add_remove_box, 2, 3)
add_remove_box.show_all()
#.........这里部分代码省略.........