예제 #1
0
파일: view.py 프로젝트: axitkhurana/sugar
    def __init__(self, model, alerts):
        SectionView.__init__(self)

        self._model = UpdateModel()
        self._model.connect('progress', self.__progress_cb)

        self.set_spacing(style.DEFAULT_SPACING)
        self.set_border_width(style.DEFAULT_SPACING * 2)

        self._top_label = Gtk.Label()
        self._top_label.set_line_wrap(True)
        self._top_label.set_justify(Gtk.Justification.LEFT)
        self._top_label.props.xalign = 0
        self.pack_start(self._top_label, False, True, 0)
        self._top_label.show()

        separator = Gtk.HSeparator()
        self.pack_start(separator, False, True, 0)
        separator.show()

        bottom_label = Gtk.Label()
        bottom_label.set_line_wrap(True)
        bottom_label.set_justify(Gtk.Justification.LEFT)
        bottom_label.props.xalign = 0
        bottom_label.set_markup(
            _('Software updates correct errors, eliminate security '
              'vulnerabilities, and provide new features.'))
        self.pack_start(bottom_label, False, True, 0)
        bottom_label.show()

        self._update_box = None
        self._progress_pane = None

        self._refresh()
예제 #2
0
파일: view.py 프로젝트: ajaygarg84/sugar
    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()
예제 #3
0
파일: view.py 프로젝트: ceibal-tatu/sugar
    def __init__(self, model, alerts):
        SectionView.__init__(self)

        self._model = UpdateModel()
        self._model.connect('progress', self.__progress_cb)

        self.set_spacing(style.DEFAULT_SPACING)
        self.set_border_width(style.DEFAULT_SPACING * 2)

        self._top_label = Gtk.Label()
        self._top_label.set_line_wrap(True)
        self._top_label.set_justify(Gtk.Justification.LEFT)
        self._top_label.props.xalign = 0
        self.pack_start(self._top_label, False, True, 0)
        self._top_label.show()

        separator = Gtk.HSeparator()
        self.pack_start(separator, False, True, 0)
        separator.show()

        bottom_label = Gtk.Label()
        bottom_label.set_line_wrap(True)
        bottom_label.set_justify(Gtk.Justification.LEFT)
        bottom_label.props.xalign = 0
        bottom_label.set_markup(
                _('Software updates correct errors, eliminate security ' \
                  'vulnerabilities, and provide new features.'))
        self.pack_start(bottom_label, False, True, 0)
        bottom_label.show()

        self._update_box = None
        self._progress_pane = None

        self._refresh()
예제 #4
0
파일: view.py 프로젝트: upman/sugar
    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()
예제 #5
0
파일: view.py 프로젝트: bossjones/sugar
    def __init__(self, model, alerts=None):
        SectionView.__init__(self)
        self.needs_restart = False

        # add the initial panel
        self.set_canvas(SelectBackupRestorePanel(self))
        self.grab_focus()
        self.show_all()
        self.manager = BackupManager()
예제 #6
0
파일: view.py 프로젝트: AxEofBone7/sugar
    def __init__(self, model, alerts=None):
        SectionView.__init__(self)
        self.needs_restart = False

        # add the initial panel
        self.set_canvas(SelectBackupRestorePanel(self))
        self.grab_focus()
        self.show_all()
        self.manager = BackupManager()
예제 #7
0
    def __init__(self, modelwrapper, alerts):
        SectionView.__init__(self)
        get_control_panel()._section_toolbar.cancel_button.hide()

        bundleregistry.get_registry().disable_directory_monitoring()

        self._in_sugar = (modelwrapper is not None)
        self.set_spacing(style.DEFAULT_SPACING)
        self.set_border_width(style.DEFAULT_SPACING * 2)

        # top labels.
        self.top_label = Gtk.Label()
        self.top_label.set_line_wrap(True)
        self.top_label.set_justify(Gtk.Justification.LEFT)
        self.top_label.set_property('xalign', 0)
        self.top_label.set_markup('<big>%s</big>' %
                                  _('Checking for updates...'))
        bottom_label = Gtk.Label()
        bottom_label.set_line_wrap(True)  # doesn't really work right =(
        bottom_label.set_justify(Gtk.Justification.LEFT)
        bottom_label.set_property('xalign', 0)
        bottom_label.set_markup(
            _('Software updates correct errors, eliminate security vulnerabilities, and provide new features.'
              ))
        vbox2 = Gtk.VBox()
        vbox2.pack_start(self.top_label, False, True, 0)
        vbox2.pack_start(Gtk.HSeparator(), False, False, 0)
        vbox2.pack_start(bottom_label, True, True, 0)
        self.pack_start(vbox2, False, True, 0)

        # activity/group pane ####
        self.activity_list = model.UpdateList()
        self.activity_pane = ActivityPane(self)
        self.pack_start(self.activity_pane, True, True, 0)

        # progress pane ###########
        self.progress_pane = ProgressPane(self)
        self.pack_start(self.progress_pane, True, False, 0)

        # special little extension to progress pane.
        self.expander = Gtk.Expander(label=_('Modify activity groups'))

        def expander_cb(expander, param_):
            if expander.get_expanded():
                self.activity_pane.switch()
                self.activity_pane.expander.set_expanded(True)
                expander.set_expanded(False)

        self.expander.connect("notify::expanded", expander_cb)
        self.pack_end(self.expander, False, True, 0)

        # show our work!
        self.show_all()
        # and start refreshing.
        self.refresh_cb(None, None)
예제 #8
0
    def __init__(self, model, alerts=None):
        SectionView.__init__(self)

        self._model = model
        self.restart_alerts = alerts
        self._timeout_sid = 0

        self.set_border_width(style.DEFAULT_SPACING)
        self.set_spacing(style.DEFAULT_SPACING)
        self._group = Gtk.SizeGroup(Gtk.SizeGroupMode.HORIZONTAL)

        explanation = _('You will need to provide the following information'
                        ' to set up a mobile broadband connection to a'
                        ' cellular (3G) network.')
        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()

        self._username_entry = EntryWithLabel(_('Username:'******'changed', self.__entry_changed_cb)
        self._group.add_widget(self._username_entry.label)
        self.pack_start(self._username_entry, False, True, 0)
        self._username_entry.show()

        self._password_entry = EntryWithLabel(_('Password:'******'changed', self.__entry_changed_cb)
        self._group.add_widget(self._password_entry.label)
        self.pack_start(self._password_entry, False, True, 0)
        self._password_entry.show()

        self._number_entry = EntryWithLabel(_('Number:'))
        self._number_entry.entry.connect('changed', self.__entry_changed_cb)
        self._group.add_widget(self._number_entry.label)
        self.pack_start(self._number_entry, False, True, 0)
        self._number_entry.show()

        self._apn_entry = EntryWithLabel(_('Access Point Name (APN):'))
        self._apn_entry.entry.connect('changed', self.__entry_changed_cb)
        self._group.add_widget(self._apn_entry.label)
        self.pack_start(self._apn_entry, False, True, 0)
        self._apn_entry.show()

        self._pin_entry = EntryWithLabel(_('Personal Identity Number (PIN):'))
        self._pin_entry.entry.connect('changed', self.__entry_changed_cb)
        self._group.add_widget(self._pin_entry.label)
        self.pack_start(self._pin_entry, False, True, 0)
        self._pin_entry.show()

        self.setup()
예제 #9
0
    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()
예제 #10
0
파일: view.py 프로젝트: ceibal-tatu/sugar
    def __init__(self, model, alerts=None):
        SectionView.__init__(self)

        self._model = model
        self.restart_alerts = alerts
        self._timeout_sid = 0

        self.set_border_width(style.DEFAULT_SPACING)
        self.set_spacing(style.DEFAULT_SPACING)
        self._group = Gtk.SizeGroup(Gtk.SizeGroupMode.HORIZONTAL)

        explanation = _('You will need to provide the following information'
                        ' to set up a mobile broadband connection to a'
                        ' cellular (3G) network.')
        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()

        self._username_entry = EntryWithLabel(_('Username:'******'changed', self.__entry_changed_cb)
        self._group.add_widget(self._username_entry.label)
        self.pack_start(self._username_entry, False, True, 0)
        self._username_entry.show()

        self._password_entry = EntryWithLabel(_('Password:'******'changed', self.__entry_changed_cb)
        self._group.add_widget(self._password_entry.label)
        self.pack_start(self._password_entry, False, True, 0)
        self._password_entry.show()

        self._number_entry = EntryWithLabel(_('Number:'))
        self._number_entry.entry.connect('changed', self.__entry_changed_cb)
        self._group.add_widget(self._number_entry.label)
        self.pack_start(self._number_entry, False, True, 0)
        self._number_entry.show()

        self._apn_entry = EntryWithLabel(_('Access Point Name (APN):'))
        self._apn_entry.entry.connect('changed', self.__entry_changed_cb)
        self._group.add_widget(self._apn_entry.label)
        self.pack_start(self._apn_entry, False, True, 0)
        self._apn_entry.show()

        self._pin_entry = EntryWithLabel(_('Personal Identity Number (PIN):'))
        self._pin_entry.entry.connect('changed', self.__entry_changed_cb)
        self._group.add_widget(self._pin_entry.label)
        self.pack_start(self._pin_entry, False, True, 0)
        self._pin_entry.show()

        self.setup()
예제 #11
0
파일: view.py 프로젝트: upman/sugar
    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()
예제 #12
0
파일: view.py 프로젝트: callkalpa/sugar
    def __init__(self, model, alerts):
        SectionView.__init__(self)

        self._model = model
        self.restart_alerts = alerts

        services = get_webaccount_services()
        if len(services) == 0:
            label = Gtk.Label()
            label.set_markup(
                '<span size="x-large" weight="bold">' +
                glib.markup_escape_text(
                    _('No web services are installed.\n'
                      'Please visit %s for more details.' %
                      'http://wiki.sugarlabs.org/go/WebServices')) +
                '</span>')
            label.show()
            self.add(label)
            return

        vbox = Gtk.VBox()
        hbox = Gtk.HBox(style.DEFAULT_SPACING)

        self._service_config_box = Gtk.VBox()

        for service in services:
            icon = CanvasIcon(icon_name=service.get_icon_name())
            icon.connect('button_press_event',
                         service.config_service_cb,
                         self._service_config_box)
            icon.show()
            hbox.pack_start(icon, False, False, 0)

        hbox.show()
        vbox.pack_start(hbox, False, False, 0)

        scrolled = Gtk.ScrolledWindow()
        vbox.pack_start(scrolled, True, True, 0)

        self.add(vbox)
        scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        scrolled.show()

        workspace = Gtk.VBox()
        scrolled.add_with_viewport(workspace)
        workspace.show()

        workspace.add(self._service_config_box)
        workspace.show_all()
        vbox.show()
예제 #13
0
    def __init__(self, modelwrapper, alerts):
        SectionView.__init__(self)
        get_control_panel()._section_toolbar.cancel_button.hide()

        bundleregistry.get_registry().disable_directory_monitoring()

        self._in_sugar = (modelwrapper is not None)
        self.set_spacing(style.DEFAULT_SPACING)
        self.set_border_width(style.DEFAULT_SPACING * 2)

        # top labels.
        self.top_label = Gtk.Label()
        self.top_label.set_line_wrap(True)
        self.top_label.set_justify(Gtk.Justification.LEFT)
        self.top_label.set_property('xalign',0)
        self.top_label.set_markup('<big>%s</big>'%_('Checking for updates...'))
        bottom_label = Gtk.Label()
        bottom_label.set_line_wrap(True) # doesn't really work right =(
        bottom_label.set_justify(Gtk.Justification.LEFT)
        bottom_label.set_property('xalign', 0)
        bottom_label.set_markup(_('Software updates correct errors, eliminate security vulnerabilities, and provide new features.'))
        vbox2 = Gtk.VBox()
        vbox2.pack_start(self.top_label, False, True, 0)
        vbox2.pack_start(Gtk.HSeparator(), False, False, 0)
        vbox2.pack_start(bottom_label, True, True, 0)
        self.pack_start(vbox2, False, True, 0)

        # activity/group pane ####
        self.activity_list = model.UpdateList()
        self.activity_pane = ActivityPane(self)
        self.pack_start(self.activity_pane, True, True, 0)

        # progress pane ###########
        self.progress_pane = ProgressPane(self)
        self.pack_start(self.progress_pane, True, False, 0)

        # special little extension to progress pane.
        self.expander = Gtk.Expander(label=_('Modify activity groups'))
        def expander_cb(expander, param_):
            if expander.get_expanded():
                self.activity_pane.switch()
                self.activity_pane.expander.set_expanded(True)
                expander.set_expanded(False)
        self.expander.connect("notify::expanded", expander_cb)
        self.pack_end(self.expander, False, True, 0)

        # show our work!
        self.show_all()
        # and start refreshing.
        self.refresh_cb(None, None)
예제 #14
0
    def __init__(self, model, alerts):
        SectionView.__init__(self)

        self._model = model
        self._corner_delay_sid = 0
        self._corner_delay_change_handler = None
        self._edge_delay_sid = 0
        self._edge_delay_change_handler = None
        self._trigger_size_sid = 0
        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)

        label = Gtk.Label(label=_('Activation Delay'))
        label.set_alignment(0, 0)
        self.pack_start(label, False, True, 0)

        box = Gtk.VBox()
        box.set_border_width(style.DEFAULT_SPACING * 2)
        box.set_spacing(style.DEFAULT_SPACING)

        box.pack_start(self._setup_corner(), False, True, 0)
        box.pack_start(self._setup_edge(), False, True, 0)

        self.pack_start(box, False, True, 0)

        separator = Gtk.HSeparator()
        self.pack_start(separator, False, True, 0)

        label = Gtk.Label(label=_('Activation Area'))
        label.set_alignment(0, 0)
        self.pack_start(label, False, True, 0)

        box = Gtk.VBox()
        box.set_border_width(style.DEFAULT_SPACING * 2)
        box.set_spacing(style.DEFAULT_SPACING)

        box.pack_start(self._setup_trigger(), False, True, 0)

        self.pack_start(box, False, True, 0)
        self.show_all()

        self.setup()
예제 #15
0
    def __init__(self, model, alerts):
        SectionView.__init__(self)

        self._model = model
        self._corner_delay_sid = 0
        self._corner_delay_change_handler = None
        self._edge_delay_sid = 0
        self._edge_delay_change_handler = None
        self._trigger_size_sid = 0
        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)

        label = Gtk.Label(label=_("Activation Delay"))
        label.set_alignment(0, 0)
        self.pack_start(label, False, True, 0)

        box = Gtk.VBox()
        box.set_border_width(style.DEFAULT_SPACING * 2)
        box.set_spacing(style.DEFAULT_SPACING)

        box.pack_start(self._setup_corner(), False, True, 0)
        box.pack_start(self._setup_edge(), False, True, 0)

        self.pack_start(box, False, True, 0)

        separator = Gtk.HSeparator()
        self.pack_start(separator, False, True, 0)

        label = Gtk.Label(label=_("Activation Area"))
        label.set_alignment(0, 0)
        self.pack_start(label, False, True, 0)

        box = Gtk.VBox()
        box.set_border_width(style.DEFAULT_SPACING * 2)
        box.set_spacing(style.DEFAULT_SPACING)

        box.pack_start(self._setup_trigger(), False, True, 0)

        self.pack_start(box, False, True, 0)
        self.show_all()

        self.setup()
예제 #16
0
파일: view.py 프로젝트: Akirato/sugar
    def __init__(self, model, alerts):
        SectionView.__init__(self)

        self._model = updater.get_instance()
        self._id_progresss = self._model.connect('progress',
                                                 self.__progress_cb)
        self._id_updates = self._model.connect('updates-available',
                                               self.__updates_available_cb)
        self._id_error = self._model.connect('error',
                                             self.__error_cb)
        self._id_finished = self._model.connect('finished',
                                                self.__finished_cb)

        self.set_spacing(style.DEFAULT_SPACING)
        self.set_border_width(style.DEFAULT_SPACING * 2)

        self._top_label = Gtk.Label()
        self._top_label.set_line_wrap(True)
        self._top_label.set_justify(Gtk.Justification.LEFT)
        self._top_label.props.xalign = 0
        self.pack_start(self._top_label, False, True, 0)
        self._top_label.show()

        separator = Gtk.HSeparator()
        self.pack_start(separator, False, True, 0)
        separator.show()

        self._bottom_label = Gtk.Label()
        self._bottom_label.set_line_wrap(True)
        self._bottom_label.set_justify(Gtk.Justification.LEFT)
        self._bottom_label.props.xalign = 0
        self._bottom_label.set_markup(
            _('Software updates correct errors, eliminate security '
              'vulnerabilities, and provide new features.'))
        self.pack_start(self._bottom_label, False, True, 0)
        self._bottom_label.show()

        self._update_box = None
        self._progress_pane = None

        state = self._model.get_state()
        if state in (updater.STATE_IDLE, updater.STATE_CHECKED):
            self._refresh()
        elif state in (updater.STATE_CHECKING, updater.STATE_DOWNLOADING,
                       updater.STATE_UPDATING):
            self._switch_to_progress_pane()
            self._progress_pane.set_message(_('Update in progress...'))
        self.connect('destroy', self.__destroy_cb)
예제 #17
0
파일: view.py 프로젝트: rcunning01/sugar
    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()
예제 #18
0
파일: view.py 프로젝트: vish-321/sugar
    def __init__(self, model, alerts):
        SectionView.__init__(self)

        self._model = updater.get_instance()
        self._id_progresss = self._model.connect('progress',
                                                 self.__progress_cb)
        self._id_updates = self._model.connect('updates-available',
                                               self.__updates_available_cb)
        self._id_error = self._model.connect('error',
                                             self.__error_cb)
        self._id_finished = self._model.connect('finished',
                                                self.__finished_cb)

        self.set_spacing(style.DEFAULT_SPACING)
        self.set_border_width(style.DEFAULT_SPACING * 2)

        self._top_label = Gtk.Label()
        self._top_label.set_line_wrap(True)
        self._top_label.set_justify(Gtk.Justification.LEFT)
        self._top_label.props.xalign = 0
        self.pack_start(self._top_label, False, True, 0)
        self._top_label.show()

        separator = Gtk.HSeparator()
        self.pack_start(separator, False, True, 0)
        separator.show()

        self._bottom_label = Gtk.Label()
        self._bottom_label.set_line_wrap(True)
        self._bottom_label.set_justify(Gtk.Justification.LEFT)
        self._bottom_label.props.xalign = 0
        self._bottom_label.set_markup(
            _('Software updates correct errors, eliminate security '
              'vulnerabilities, and provide new features.'))
        self.pack_start(self._bottom_label, False, True, 0)
        self._bottom_label.show()

        self._update_box = None
        self._progress_pane = None

        state = self._model.get_state()
        if state in (updater.STATE_IDLE, updater.STATE_CHECKED):
            self._refresh()
        elif state in (updater.STATE_CHECKING, updater.STATE_DOWNLOADING,
                       updater.STATE_UPDATING):
            self._switch_to_progress_pane()
            self._progress_pane.set_message(_('Update in progress...'))
        self.connect('destroy', self.__destroy_cb)
예제 #19
0
    def __init__(self, model, alerts):
        SectionView.__init__(self)

        self._model = model
        self.restart_alerts = alerts

        services = get_webaccount_services()
        if len(services) == 0:
            label = Gtk.Label()
            label.set_markup(
                '<span size="x-large" weight="bold">' +
                GLib.markup_escape_text(
                    _('No web services are installed.\n'
                      'Please visit %s for more details.' %
                      'http://wiki.sugarlabs.org/go/WebServices')) + '</span>')
            label.show()
            self.add(label)
            return

        vbox = Gtk.VBox()
        hbox = Gtk.HBox(style.DEFAULT_SPACING)

        self._service_config_box = Gtk.VBox()

        for service in services:
            icon = CanvasIcon(icon_name=service.get_icon_name())
            icon.connect('button_press_event', service.config_service_cb,
                         self._service_config_box)
            icon.show()
            hbox.pack_start(icon, False, False, 0)

        hbox.show()
        vbox.pack_start(hbox, False, False, 0)

        scrolled = Gtk.ScrolledWindow()
        vbox.pack_start(scrolled, True, True, 0)

        self.add(vbox)
        scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        scrolled.show()

        workspace = Gtk.VBox()
        scrolled.add_with_viewport(workspace)
        workspace.show()

        workspace.add(self._service_config_box)
        workspace.show_all()
        vbox.show()
예제 #20
0
파일: view.py 프로젝트: svineet/sugar
    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.Grid()
        self._color_label.set_row_spacing(style.DEFAULT_SPACING)
        self._color_label.set_column_spacing(style.DEFAULT_SPACING)

        self._color_box = Gtk.Grid()
        self._color_box.set_row_spacing(style.DEFAULT_SPACING)
        self._color_box.set_column_spacing(style.DEFAULT_SPACING)

        self._color_alert_box = Gtk.Grid()
        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.Grid()
        self._nick_box.set_row_spacing(style.DEFAULT_SPACING)
        self._nick_box.set_column_spacing(style.DEFAULT_SPACING)

        self._nick_alert_box = Gtk.Grid()

        self._nick_entry = None
        self._nick_alert = None
        self._setup_nick()
        self.setup()
예제 #21
0
    def __init__(self, model, alerts):
        SectionView.__init__(self)

        self._model = model

        self._kmodel = None
        self._selected_kmodel = None

        self._klayouts = []
        self._selected_klayouts = []

        self._group_switch_option = None
        self._selected_group_switch_option = None

        self.set_border_width(style.DEFAULT_SPACING * 2)
        self.set_spacing(style.DEFAULT_SPACING)

        self._layout_table = Gtk.Table(rows=4, columns=2, homogeneous=False)

        _build_ISO_639_dictionary()

        self._keyboard_manager = model.KeyboardManager(
            GdkX11.x11_get_default_xdisplay())

        self._layout_combo_list = []
        self._layout_addremovebox_list = []

        scrollwindow = Gtk.ScrolledWindow()
        scrollwindow.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        self.pack_start(scrollwindow, True, True, 0)
        scrollwindow.show()

        self._vbox = Gtk.VBox()
        scrollwindow.add_with_viewport(self._vbox)

        self.__kmodel_sid = None
        self.__layout_sid = None
        self.__group_switch_sid = None

        self._setup_kmodel()
        self._setup_layouts()
        self._setup_group_switch_option()

        self._vbox.show()
예제 #22
0
파일: view.py 프로젝트: upman/sugar
    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.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.pack_start(self._box_sliders, False, True, 0)
        self._box_sliders.show()

        self.setup()
예제 #23
0
    def __init__(self, model, alerts):
        SectionView.__init__(self)

        self.set_spacing(style.DEFAULT_SPACING)
        self.set_border_width(style.DEFAULT_SPACING * 2)

        self._top_label = Gtk.Label()
        self._top_label.set_line_wrap(True)
        self._top_label.set_justify(Gtk.Justification.LEFT)
        self._top_label.props.xalign = 0
        self._top_label.set_markup('<big>%s</big>' % _('Cleaning...'))
        self.pack_start(self._top_label, False, True, 0)
        self._top_label.show()

        separator = Gtk.HSeparator()
        self.pack_start(separator, False, True, 0)
        separator.show()

        self._bottom_label = Gtk.Label()
        self._bottom_label.set_line_wrap(True)
        self._bottom_label.set_justify(Gtk.Justification.LEFT)
        self._bottom_label.props.xalign = 0
        self._bottom_label.set_markup(
            _('Software updates correct errors, eliminate security '
              'vulnerabilities, and provide new features.'))
        self.pack_start(self._bottom_label, False, True, 0)
        self._bottom_label.show()

        self._update_box = None
        self._progress_pane = None
        self._set_toolbar_cancellable(False)

        self._model = model.SystemUpdaterModel()
        self._model.connect('progress', self.__progress_cb)
        self._model.connect('progress-detail', self.__detail_cb)
        self._model.connect('finished', self.__finished_cb)
        self._model.connect('cancellable', self.__cancellable_cb)
        self._model.connect('size', self.__size_cb)

        GLib.idle_add(self._model.clean)
예제 #24
0
    def __init__(self, model, alerts):
        SectionView.__init__(self)

        self._model = model

        self._kmodel = None
        self._selected_kmodel = None

        self._klayouts = []
        self._selected_klayouts = []

        self._group_switch_option = None
        self._selected_group_switch_option = None

        self.set_border_width(style.DEFAULT_SPACING * 2)
        self.set_spacing(style.DEFAULT_SPACING)

        self._layout_table = gtk.Table(rows=4, columns=2, homogeneous=False)

        self._keyboard_manager = model.KeyboardManager(self.get_display())
        self._layout_combo_list = []
        self._layout_addremovebox_list = []

        scrollwindow = gtk.ScrolledWindow()
        scrollwindow.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        self.pack_start(scrollwindow, expand=True)
        scrollwindow.show()

        self._vbox = gtk.VBox()
        scrollwindow.add_with_viewport(self._vbox)

        self.__kmodel_sid = None
        self.__layout_sid = None
        self.__group_switch_sid = None

        self._setup_kmodel()
        self._setup_layouts()
        self._setup_group_switch_option()

        self._vbox.show()
예제 #25
0
파일: view.py 프로젝트: Anubhav-J/sugar
    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._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)
예제 #26
0
파일: view.py 프로젝트: Akirato/sugar
    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)
예제 #27
0
파일: view.py 프로젝트: davidmason/glycogen
    def __init__(self, model, alerts):
        SectionView.__init__(self)

        logging.debug('GLYCOGEN: init GlycogenLauncher')

        self.model = model

        self.set_border_width(style.DEFAULT_SPACING * 2)
        self.set_spacing(style.DEFAULT_SPACING)
        self._group = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)

        separator = gtk.HSeparator()
        self.pack_start(separator, expand=False)
        separator.show()

        label_activation = gtk.Label('Ready to activate Glycogen?')
        label_activation.set_alignment(0, 0)
        self.pack_start(label_activation, expand=False)
        label_activation.show()

        self.box_buttons = gtk.VBox()
        self.box_buttons.set_border_width(style.DEFAULT_SPACING * 2)
        self.box_buttons.set_spacing(style.DEFAULT_SPACING)

        self.button_add_pathway_view = gtk.Button('Add pathway view')
        self.button_add_pathway_view.connect('clicked',
                                             self._add_pathway_button_cb, None)
        self.button_add_pathway_view.show()

        #        self.button_show_pathway_view = gtk.Button('Show it!')
        #        self.button_show_pathway_view.connect('clicked', self._show_pathway_button_cb, None)
        #        self.button_show_pathway_view.set_sensitive(False)
        #        self.button_show_pathway_view.show()

        self.box_buttons.pack_start(self.button_add_pathway_view, expand=False)
        #        self.box_buttons.pack_start(self.button_show_pathway_view, expand=False)

        self.pack_start(self.box_buttons, expand=False)
        self.box_buttons.show()
예제 #28
0
파일: view.py 프로젝트: davidmason/glycogen
    def __init__(self, model, alerts):
        SectionView.__init__(self)
        
        logging.debug('GLYCOGEN: init GlycogenLauncher')
        
        self.model = model

        self.set_border_width(style.DEFAULT_SPACING * 2)
        self.set_spacing(style.DEFAULT_SPACING)
        self._group = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)

        separator = gtk.HSeparator()
        self.pack_start(separator, expand=False)
        separator.show()

        label_activation = gtk.Label('Ready to activate Glycogen?')
        label_activation.set_alignment(0, 0)
        self.pack_start(label_activation, expand=False)
        label_activation.show()
        
        self.box_buttons = gtk.VBox()
        self.box_buttons.set_border_width(style.DEFAULT_SPACING * 2)
        self.box_buttons.set_spacing(style.DEFAULT_SPACING)
        
        self.button_add_pathway_view = gtk.Button('Add pathway view')
        self.button_add_pathway_view.connect('clicked', self._add_pathway_button_cb, None)
        self.button_add_pathway_view.show()
        
#        self.button_show_pathway_view = gtk.Button('Show it!')
#        self.button_show_pathway_view.connect('clicked', self._show_pathway_button_cb, None)
#        self.button_show_pathway_view.set_sensitive(False)
#        self.button_show_pathway_view.show()      
        
        self.box_buttons.pack_start(self.button_add_pathway_view, expand=False)
#        self.box_buttons.pack_start(self.button_show_pathway_view, expand=False)
        
        self.pack_start(self.box_buttons, expand=False)
        self.box_buttons.show()
예제 #29
0
파일: view.py 프로젝트: AxEofBone7/sugar
    def __init__(self, model, alerts=None):
        SectionView.__init__(self)

        self._model = model

        self.set_border_width(style.DEFAULT_SPACING * 2)
        self.set_spacing(style.DEFAULT_SPACING)

        self._group = Gtk.SizeGroup(Gtk.SizeGroupMode.HORIZONTAL)

        scrollwindow = Gtk.ScrolledWindow()
        scrollwindow.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        self.pack_start(scrollwindow, True, True, 0)
        scrollwindow.show()

        self._vbox = Gtk.VBox()
        scrollwindow.add_with_viewport(self._vbox)
        self._vbox.show()

        self._setup_identity()

        self._setup_software()
        self._setup_copyright()
예제 #30
0
    def __init__(self, model, alerts=None):
        SectionView.__init__(self)

        self._model = model

        self.set_border_width(style.DEFAULT_SPACING * 2)
        self.set_spacing(style.DEFAULT_SPACING)

        self._group = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)

        scrollwindow = gtk.ScrolledWindow()
        scrollwindow.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        self.pack_start(scrollwindow, expand=True)
        scrollwindow.show()

        self._vbox = gtk.VBox()
        scrollwindow.add_with_viewport(self._vbox)
        self._vbox.show()

        self._setup_identity()

        self._setup_software()
        self._setup_copyright()
예제 #31
0
    def __init__(self, model, alerts=None):
        SectionView.__init__(self)

        self._model = model

        self.set_border_width(style.DEFAULT_SPACING * 2)
        self.set_spacing(style.DEFAULT_SPACING)

        self._group = Gtk.SizeGroup(Gtk.SizeGroupMode.HORIZONTAL)

        scrollwindow = Gtk.ScrolledWindow()
        scrollwindow.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        self.pack_start(scrollwindow, True, True, 0)
        scrollwindow.show()

        self._vbox = Gtk.VBox()
        scrollwindow.add_with_viewport(self._vbox)
        self._vbox.show()

        self._setup_identity()

        self._setup_software()
        self._setup_copyright()
예제 #32
0
    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()
예제 #33
0
파일: view.py 프로젝트: worldinmyfist/sugar
    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)
        workspace.pack_start(label_mesh, False, True, 0)
        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."))
        server_info.set_alignment(0, 0)
        server_info.set_line_wrap(True)
        box_mesh.pack_start(server_info, False, True, 0)
        server_info.show()

        box_server = Gtk.HBox(spacing=style.DEFAULT_SPACING)
        label_server = Gtk.Label(label=_('Server:'))
        label_server.set_alignment(1, 0.5)
        label_server.modify_fg(Gtk.StateType.NORMAL,
                               style.COLOR_SELECTION_GREY.get_gdk_color())
        box_server.pack_start(label_server, False, True, 0)
        group.add_widget(label_server)
        label_server.show()
        self._entry = Gtk.Entry()
        self._entry.set_alignment(0)
        self._entry.set_size_request(int(Gdk.Screen.width() / 3), -1)
        box_server.pack_start(self._entry, False, True, 0)
        self._entry.show()
        box_mesh.pack_start(box_server, False, True, 0)
        box_server.show()

        social_help_info = Gtk.Label(
            _('Social Help is a forum that lets you connect with developers'
              ' and discuss Sugar Activities.  Changing servers means'
              ' discussions will happen in a different place with'
              ' different people.'))
        social_help_info.set_alignment(0, 0)
        social_help_info.set_line_wrap(True)
        box_mesh.pack_start(social_help_info, False, True, 0)
        social_help_info.show()

        social_help_box = Gtk.HBox(spacing=style.DEFAULT_SPACING)
        social_help_label = Gtk.Label(label=_('Social Help Server:'))
        social_help_label.set_alignment(1, 0.5)
        social_help_label.modify_fg(Gtk.StateType.NORMAL,
                                    style.COLOR_SELECTION_GREY.get_gdk_color())
        social_help_box.pack_start(social_help_label, False, True, 0)
        group.add_widget(social_help_label)
        social_help_label.show()

        self._social_help_entry = Gtk.Entry()
        self._social_help_entry.set_alignment(0)
        self._social_help_entry.set_size_request(int(Gdk.Screen.width() / 3),
                                                 -1)
        social_help_box.pack_start(self._social_help_entry, False, True, 0)
        self._social_help_entry.show()
        box_mesh.pack_start(social_help_box, False, True, 0)
        social_help_box.show()

        workspace.pack_start(box_mesh, False, True, 0)
        box_mesh.show()

        separator_proxy = Gtk.HSeparator()
        workspace.pack_start(separator_proxy, False, False, 0)
        separator_proxy.show()

        self._add_proxy_section(workspace)

        self.setup()
예제 #34
0
파일: view.py 프로젝트: puneetgkaur/sugar
    def __init__(self, model, alerts):
        SectionView.__init__(self)

        self._model = model
        self.restart_alerts = alerts

        services = get_webaccount_services()

        grid = Gtk.Grid()

        if len(services) == 0:
            grid.set_row_spacing(style.DEFAULT_SPACING)

            icon = Icon(
                pixel_size=style.LARGE_ICON_SIZE,
                icon_name="module-webaccount",
                stroke_color=style.COLOR_BUTTON_GREY.get_svg(),
                fill_color=style.COLOR_TRANSPARENT.get_svg(),
            )

            grid.attach(icon, 0, 0, 1, 1)
            icon.show()

            label = Gtk.Label()
            label.set_justify(Gtk.Justification.CENTER)
            label.set_markup(
                '<span foreground="%s" size="large">%s</span>'
                % (
                    style.COLOR_BUTTON_GREY.get_html(),
                    GLib.markup_escape_text(
                        _(
                            "No web services are installed.\n"
                            "Please visit %s for more details." % "http://wiki.sugarlabs.org/go/WebServices"
                        )
                    ),
                )
            )
            label.show()
            grid.attach(label, 0, 1, 1, 1)

            alignment = Gtk.Alignment.new(0.5, 0.5, 0.1, 0.1)
            alignment.add(grid)
            grid.show()

            self.add(alignment)
            alignment.show()
            return

        grid.set_row_spacing(style.DEFAULT_SPACING * 4)
        grid.set_column_spacing(style.DEFAULT_SPACING * 4)
        grid.set_border_width(style.DEFAULT_SPACING * 2)
        grid.set_column_homogeneous(True)

        width = Gdk.Screen.width() - 2 * style.GRID_CELL_SIZE
        nx = int(width / (style.GRID_CELL_SIZE + style.DEFAULT_SPACING * 4))

        self._service_config_box = Gtk.VBox()

        x = 0
        y = 0
        for service in services:
            service_grid = Gtk.Grid()
            background_box = Gtk.EventBox()
            background_box.modify_bg(Gtk.StateType.NORMAL, style.COLOR_WHITE.get_gdk_color())
            icon = CanvasIcon(icon_name=service.get_icon_name())
            background_box.add(icon)
            icon.show()

            service_grid.attach(background_box, x, y, 1, 1)
            background_box.show()

            background_box.connect("button_press_event", service.config_service_cb, self._service_config_box)

            label = Gtk.Label()
            label.set_justify(Gtk.Justification.CENTER)
            name = get_service_name(service)
            label.set_markup(name)
            service_grid.attach(label, x, y + 1, 1, 1)
            label.show()

            grid.attach(service_grid, x, y, 1, 1)
            service_grid.show()

            x += 1
            if x == nx:
                x = 0
                y += 1

        alignment = Gtk.Alignment.new(0.5, 0, 0, 0)
        alignment.add(grid)
        grid.show()

        vbox = Gtk.VBox()
        vbox.pack_start(alignment, False, False, 0)
        alignment.show()

        scrolled = Gtk.ScrolledWindow()
        vbox.pack_start(scrolled, True, True, 0)

        self.add(vbox)
        scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        scrolled.show()

        workspace = Gtk.VBox()
        scrolled.add_with_viewport(workspace)
        workspace.show()

        workspace.add(self._service_config_box)
        workspace.show_all()
        vbox.show()
예제 #35
0
파일: view.py 프로젝트: junzy/sugar
    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)
        workspace.pack_start(label_mesh, False, True, 0)
        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."))
        server_info.set_alignment(0, 0)
        server_info.set_line_wrap(True)
        box_mesh.pack_start(server_info, False, True, 0)
        server_info.show()

        box_server = Gtk.HBox(spacing=style.DEFAULT_SPACING)
        label_server = Gtk.Label(label=_('Server:'))
        label_server.set_alignment(1, 0.5)
        label_server.modify_fg(Gtk.StateType.NORMAL,
                               style.COLOR_SELECTION_GREY.get_gdk_color())
        box_server.pack_start(label_server, False, True, 0)
        group.add_widget(label_server)
        label_server.show()
        self._entry = Gtk.Entry()
        self._entry.set_alignment(0)
        self._entry.set_size_request(int(Gdk.Screen.width() / 3), -1)
        box_server.pack_start(self._entry, False, True, 0)
        self._entry.show()
        box_mesh.pack_start(box_server, False, True, 0)
        box_server.show()

        social_help_info = Gtk.Label(
            _('Social Help is a forum that lets you connect with developers'
              ' and discuss Sugar Activities.  Changing servers means'
              ' discussions will happen in a different place with'
              ' different people.'))
        social_help_info.set_alignment(0, 0)
        social_help_info.set_line_wrap(True)
        box_mesh.pack_start(social_help_info, False, True, 0)
        social_help_info.show()

        social_help_box = Gtk.HBox(spacing=style.DEFAULT_SPACING)
        social_help_label = Gtk.Label(label=_('Social Help Server:'))
        social_help_label.set_alignment(1, 0.5)
        social_help_label.modify_fg(Gtk.StateType.NORMAL,
                                    style.COLOR_SELECTION_GREY.get_gdk_color())
        social_help_box.pack_start(social_help_label, False, True, 0)
        group.add_widget(social_help_label)
        social_help_label.show()

        self._social_help_entry = Gtk.Entry()
        self._social_help_entry.set_alignment(0)
        self._social_help_entry.set_size_request(
            int(Gdk.Screen.width() / 3), -1)
        social_help_box.pack_start(self._social_help_entry, False, True, 0)
        self._social_help_entry.show()
        box_mesh.pack_start(social_help_box, False, True, 0)
        social_help_box.show()

        workspace.pack_start(box_mesh, False, True, 0)
        box_mesh.show()

        separator_proxy = Gtk.HSeparator()
        workspace.pack_start(separator_proxy, False, False, 0)
        separator_proxy.show()

        self._add_proxy_section(workspace)

        self.setup()
예제 #36
0
    def __init__(self, model, alerts):
        SectionView.__init__(self)
        self._model = model
        self._switch_button_handler = None
        self._undo_button_handler = None
        self._fix_unknown_button_handler = None
        self._restart_button_handler = None

        self.set_border_width(style.DEFAULT_SPACING * 2)
        self.set_spacing(style.DEFAULT_SPACING)

        self._active_desktop_label = gtk.Label()
        self.pack_start(self._active_desktop_label, False)

        self._sugar_desc_label = gtk.Label(
            _("Sugar is the graphical user interface that you are looking at. "
              "It is a learning environment designed for children."))
        self._sugar_desc_label.set_size_request(gtk.gdk.screen_width() / 2, -1)
        self._sugar_desc_label.set_line_wrap(True)
        self.pack_start(self._sugar_desc_label, False)

        self._gnome_opt_label = gtk.Label(
            _("As an alternative to Sugar, you can switch to the GNOME "
              "desktop environment by clicking the button below."))
        self._gnome_opt_label.set_line_wrap(True)
        self._gnome_opt_label.set_size_request(gtk.gdk.screen_width() / 2, -1)
        self.pack_start(self._gnome_opt_label, False)

        self._restart_label = gtk.Label(
            _("Restart your computer to complete the change to the GNOME "
              "desktop environment."))
        self._restart_label.set_line_wrap(True)
        self._restart_label.set_size_request(gtk.gdk.screen_width() / 2, -1)
        self.pack_start(self._restart_label, False)

        self._undo_return_label = gtk.Label()
        self._undo_return_label.set_markup(
            _("Remember, you can return to Sugar later by clicking on the "
              "<b>Switch to Sugar</b> icon on the GNOME desktop. Or, click "
              "the <b>Cancel changes</b> button below if you would like to "
              "continue using Sugar as your desktop environment."))
        self._undo_return_label.set_line_wrap(True)
        self._undo_return_label.set_size_request(gtk.gdk.screen_width() / 2, -1)
        self.pack_start(self._undo_return_label, False)


        self._switch_align = gtk.Alignment(xalign=0.5, yalign=0.5)
        self.pack_start(self._switch_align)

        self._switch_button = gtk.Button(_("Switch to GNOME"))
        self._switch_button.set_image(Icon(icon_name="module-switch-desktop"))
        self._switch_align.add(self._switch_button)


        self._undo_align = gtk.Alignment(xalign=0.5, yalign=0.5)
        self.pack_start(self._undo_align)

        hbox = gtk.HButtonBox()
        hbox.set_layout(gtk.BUTTONBOX_END)
        hbox.set_spacing(style.DEFAULT_SPACING)
        self._undo_align.add(hbox)

        self._undo_button = gtk.Button(_("Cancel changes"))
        self._undo_button.set_image(Icon(icon_name="dialog-cancel"))
        hbox.add(self._undo_button)

        self._restart_button = gtk.Button(_("Restart now"))
        self._restart_button.set_image(Icon(icon_name="system-restart"))
        hbox.add(self._restart_button)

        self._unknown_align = gtk.Alignment(xalign=0.5, yalign=0.5)
        self.pack_start(self._unknown_align)

        self._fix_unknown_button = gtk.Button(_("Set Sugar as active desktop"))
        self._fix_unknown_button.set_image(Icon(icon_name="computer-xo"))
        self._unknown_align.add(self._fix_unknown_button)

        self._return_label = gtk.Label()
        self._return_label.set_markup(
            _("You can return to Sugar later, by clicking on the <b>Switch "
              "to Sugar</b> icon on the GNOME desktop. This is also available "
              "from the GNOME <b>Applications</b> menu."))
        self._return_label.set_line_wrap(True)
        self._return_label.set_size_request(gtk.gdk.screen_width() / 2, -1)
        self.pack_start(self._return_label, False)

        self._img_table = gtk.Table(rows=2, columns=2)
        self.pack_start(self._img_table, False);

        img_path = os.path.join(config.ext_path, 'cpsection', 'switchdesktop')

        img = gtk.image_new_from_file(os.path.join(img_path, 'sugar.png'));
        self._img_table.attach(img, 0, 1, 0, 1)
        label = gtk.Label("Sugar")
        self._img_table.attach(label, 0, 1, 1, 2)

        img = gtk.image_new_from_file(os.path.join(img_path, 'gnome.png'));
        self._img_table.attach(img, 1, 2, 0, 1)
        label = gtk.Label("GNOME")
        self._img_table.attach(label, 1, 2, 1, 2)

        self.setup()
        self._update()
예제 #37
0
파일: view.py 프로젝트: ChristoferR/sugar
    def __init__(self, model, alerts=None):
        SectionView.__init__(self)

        self._model = model
        self._images_loaded = False

        self.connect('realize', self.__realize_cb)

        self.set_border_width(style.DEFAULT_SPACING * 2)
        self.set_spacing(style.DEFAULT_SPACING)

        label_box = Gtk.Box()
        label_bg = Gtk.Label(label=_('Select a background:'))
        label_bg.modify_fg(Gtk.StateType.NORMAL,
                           style.COLOR_SELECTION_GREY.get_gdk_color())
        label_bg.show()
        label_box.pack_start(label_bg, False, True, 0)
        label_box.show()
        self.pack_start(label_box, False, True, 1)

        clear_button = Gtk.Button()
        clear_button.set_label(_('Clear background'))
        clear_button.connect('clicked', self._clear_clicked_cb)
        clear_button.show()
        self.pack_end(clear_button, False, True, 0)

        scrolled_window = Gtk.ScrolledWindow()
        scrolled_window.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
        scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC,
                                   Gtk.PolicyType.AUTOMATIC)
        self.pack_start(scrolled_window, True, True, 0)
        scrolled_window.show()

        self._store = Gtk.ListStore(GdkPixbuf.Pixbuf, str)

        self._icon_view = Gtk.IconView.new_with_model(self._store)
        self._icon_view.set_selection_mode(Gtk.SelectionMode.SINGLE)
        self._icon_view.connect('selection-changed', self._background_selected)
        self._icon_view.set_pixbuf_column(0)
        self._icon_view.grab_focus()
        scrolled_window.add(self._icon_view)
        self._icon_view.show()

        alpha = self._model.get_background_alpha_level()

        alpha_box = Gtk.HBox()
        alpha_buttons = []
        for i in ['000', '020', '040', '060', '080']:
            if len(alpha_buttons) > 0:
                alpha_buttons.append(RadioToolButton(group=alpha_buttons[0]))
            else:
                alpha_buttons.append(RadioToolButton(group=None))
            alpha_buttons[-1].set_icon_name('network-wireless-' + i)
            button_alpha_level = 1.0 - float(i) / 100.
            alpha_buttons[-1].connect('clicked', self._set_alpha_cb,
                                      button_alpha_level)
            alpha_box.pack_start(alpha_buttons[-1], False, True, 0)
            alpha_buttons[-1].show()
            if alpha < button_alpha_level + 0.1:
                alpha_buttons[-1].set_active(True)

        alpha_alignment = Gtk.Alignment()
        alpha_alignment.set(0.5, 0, 0, 0)
        alpha_alignment.add(alpha_box)
        alpha_box.show()
        self.pack_start(alpha_alignment, False, False, 0)
        alpha_alignment.show()

        self._paths_list = []

        file_paths = []
        for directory in self._model.BACKGROUNDS_DIRS:
            if directory is not None and os.path.exists(directory):
                for root, dirs, files in os.walk(directory):
                    for file_ in files:
                        file_paths.append(os.path.join(root, file_))

        self._append_to_store(file_paths)
        self.setup()
예제 #38
0
    def __init__(self, model, alerts):
        SectionView.__init__(self)
        self._model = model
        self._switch_button_handler = None
        self._undo_button_handler = None
        self._fix_unknown_button_handler = None

        self.set_border_width(style.DEFAULT_SPACING * 2)
        self.set_spacing(style.DEFAULT_SPACING)

        self._active_desktop_label = Gtk.Label()
        self.pack_start(self._active_desktop_label, False, False, 0)

        self._sugar_desc_label = Gtk.Label(label=
            _("Sugar is the graphical user interface that you are looking at. "
              "It is a learning environment designed for children."))
        self._sugar_desc_label.set_line_wrap(True)
        self._sugar_desc_label.set_justify(Gtk.Justification.FILL)
        self.pack_start(self._sugar_desc_label, False, False, 0)

        self._gnome_opt_label = Gtk.Label(label=
            _("As an alternative to Sugar, you can switch to the GNOME "
              "desktop environment by clicking the button below."))
        self._gnome_opt_label.set_line_wrap(True)
        self._gnome_opt_label.set_justify(Gtk.Justification.FILL)
        self.pack_start(self._gnome_opt_label, False, False, 0)

        label_text = _("Restart your computer to complete the change to the "
            "GNOME desktop environment.\n\n"
            "Remember, you can return to Sugar later by opening the GNOME "
            "Applications menu and clicking <b>Switch to Sugar</b> under the "
            "<b>System Tools</b> sub-menu. Or, click the <b>Cancel "
            "changes</b> button below if you would like to continue using "
            "Sugar as your desktop environment.")


        self._switch_align = Gtk.Alignment.new(0.5, 0.5, 0, 0)
        self.pack_start(self._switch_align, True, True, 0)

        self._switch_button = Gtk.Button(_("Switch to GNOME"))
        self._switch_button.set_image(Icon(icon_name="module-switch-desktop"))
        self._switch_align.add(self._switch_button)
        self._switch_button.show()


        self._undo_align = Gtk.Alignment.new(0.5, 0.5, 0, 0)
        self.pack_start(self._undo_align, True, True, 0)

        hbox = Gtk.HButtonBox()
        hbox.set_layout(Gtk.ButtonBoxStyle.END)
        hbox.set_spacing(style.DEFAULT_SPACING)
        self._undo_align.add(hbox)
        hbox.show()

        self._undo_button = Gtk.Button(_("Cancel changes"))
        self._undo_button.set_image(Icon(icon_name="dialog-cancel"))
        hbox.add(self._undo_button)
        self._undo_button.show()

        self._unknown_align = Gtk.Alignment.new(0.5, 0.5, 0, 0)
        self.pack_start(self._unknown_align, True, True, 0)

        self._fix_unknown_button = Gtk.Button(_("Set Sugar as active desktop"))
        self._fix_unknown_button.set_image(Icon(icon_name="computer-xo"))
        self._unknown_align.add(self._fix_unknown_button)
        self._fix_unknown_button.show()

        self._return_label = Gtk.Label()
        self._return_label.set_markup(
            _("You can return to Sugar later, by clicking on the <b>Switch "
              "to Sugar</b> icon on the GNOME desktop. This is also available "
              "from the GNOME <b>Applications</b> menu."))
        self._return_label.set_line_wrap(True)
        self._return_label.set_justify(Gtk.Justification.FILL)
        self.pack_start(self._return_label, False, False, 0)

        self._img_table = Gtk.Table(rows=2, columns=2)
        self.pack_start(self._img_table, False, False, 0)

        img_path = os.path.join(config.ext_path, 'cpsection', 'switchdesktop')

        img = Gtk.Image.new_from_file(os.path.join(img_path, 'sugar.png'))
        self._img_table.attach(img, 0, 1, 0, 1)
        label = Gtk.Label(label="Sugar")
        self._img_table.attach(label, 0, 1, 1, 2)

        img = Gtk.Image.new_from_file(os.path.join(img_path, 'gnome.png'))
        self._img_table.attach(img, 1, 2, 0, 1)
        label = Gtk.Label(label="GNOME")
        self._img_table.attach(label, 1, 2, 1, 2)

        self.setup()
        self._update()
예제 #39
0
    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."))
        server_info.set_alignment(0, 0)
        server_info.set_line_wrap(True)
        box_mesh.pack_start(server_info, expand=False)
        server_info.show()

        box_server = gtk.HBox(spacing=style.DEFAULT_SPACING)
        label_server = gtk.Label(_('Server:'))
        label_server.set_alignment(1, 0.5)
        label_server.modify_fg(gtk.STATE_NORMAL,
                               style.COLOR_SELECTION_GREY.get_gdk_color())
        box_server.pack_start(label_server, expand=False)
        group.add_widget(label_server)
        label_server.show()
        self._entry = gtk.Entry()
        self._entry.set_alignment(0)
        self._entry.modify_bg(gtk.STATE_INSENSITIVE,
                        style.COLOR_WHITE.get_gdk_color())
        self._entry.modify_base(gtk.STATE_INSENSITIVE,
                          style.COLOR_WHITE.get_gdk_color())
        self._entry.set_size_request(int(gtk.gdk.screen_width() / 3), -1)
        box_server.pack_start(self._entry, expand=False)
        self._entry.show()
        box_mesh.pack_start(box_server, expand=False)
        box_server.show()

        self._jabber_alert = InlineAlert()
        label_jabber_error = gtk.Label()
        group.add_widget(label_jabber_error)
        self._jabber_alert_box.pack_start(label_jabber_error, expand=False)
        label_jabber_error.show()
        self._jabber_alert_box.pack_start(self._jabber_alert, expand=False)
        box_mesh.pack_end(self._jabber_alert_box, expand=False)
        self._jabber_alert_box.show()
        if 'jabber' in self.restart_alerts:
            self._jabber_alert.props.msg = self.restart_msg
            self._jabber_alert.show()

        workspace.pack_start(box_mesh, expand=False)
        box_mesh.show()

        scrolled = gtk.ScrolledWindow()
        scrolled.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        scrolled.add_with_viewport(workspace)
        scrolled.show()
        self.add(scrolled)

        self.setup()
예제 #40
0
    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.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=_('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, 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()

        history_info = Gtk.Label(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, False, True, 0)

        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, False, True,
                                     0)
        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, False, True, 0)
        box_clear_history.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)
        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."))
        server_info.set_alignment(0, 0)
        server_info.set_line_wrap(True)
        box_mesh.pack_start(server_info, False, True, 0)
        server_info.show()

        box_server = Gtk.HBox(spacing=style.DEFAULT_SPACING)
        label_server = Gtk.Label(label=_('Server:'))
        label_server.set_alignment(1, 0.5)
        label_server.modify_fg(Gtk.StateType.NORMAL,
                               style.COLOR_SELECTION_GREY.get_gdk_color())
        box_server.pack_start(label_server, False, True, 0)
        group.add_widget(label_server)
        label_server.show()
        self._entry = Gtk.Entry()
        self._entry.set_alignment(0)
        self._entry.set_size_request(int(Gdk.Screen.width() / 3), -1)
        box_server.pack_start(self._entry, False, True, 0)
        self._entry.show()
        box_mesh.pack_start(box_server, False, True, 0)
        box_server.show()

        self._jabber_alert = InlineAlert()
        label_jabber_error = Gtk.Label()
        group.add_widget(label_jabber_error)
        self._jabber_alert_box.pack_start(label_jabber_error, False, True, 0)
        label_jabber_error.show()
        self._jabber_alert_box.pack_start(self._jabber_alert, False, True, 0)
        box_mesh.pack_end(self._jabber_alert_box, False, True, 0)
        self._jabber_alert_box.show()
        if 'jabber' in self.restart_alerts:
            self._jabber_alert.props.msg = self.restart_msg
            self._jabber_alert.show()

        workspace.pack_start(box_mesh, False, True, 0)
        box_mesh.show()

        self.setup()
예제 #41
0
파일: view.py 프로젝트: puneetgkaur/sugar
    def __init__(self, model, alerts=None):
        SectionView.__init__(self)

        self._model = model
        self._images_loaded = False

        self.connect('realize', self.__realize_cb)
        self.connect('unrealize', self.__unrealize_cb)

        self.set_border_width(style.DEFAULT_SPACING * 2)
        self.set_spacing(style.DEFAULT_SPACING)

        label_box = Gtk.Box()
        label_bg = Gtk.Label(label=_('Select a background:'))
        label_bg.modify_fg(Gtk.StateType.NORMAL,
                           style.COLOR_SELECTION_GREY.get_gdk_color())
        label_bg.show()
        label_box.pack_start(label_bg, False, True, 0)
        label_box.show()
        self.pack_start(label_box, False, True, 1)

        clear_button = Gtk.Button()
        clear_button.set_label(_('Clear background'))
        clear_button.connect('clicked', self._clear_clicked_cb)
        clear_button.show()
        self.pack_end(clear_button, False, True, 0)

        scrolled_window = Gtk.ScrolledWindow()
        scrolled_window.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
        scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC,
                                   Gtk.PolicyType.AUTOMATIC)
        self.pack_start(scrolled_window, True, True, 0)
        scrolled_window.show()

        self._store = Gtk.ListStore(GdkPixbuf.Pixbuf, str)

        self._icon_view = Gtk.IconView.new_with_model(self._store)
        self._icon_view.set_selection_mode(Gtk.SelectionMode.SINGLE)
        self._icon_view.connect('selection-changed', self._background_selected)
        self._icon_view.set_pixbuf_column(0)
        self._icon_view.grab_focus()
        scrolled_window.add(self._icon_view)
        self._icon_view.show()

        alpha = self._model.get_background_alpha_level()

        alpha_box = Gtk.HBox()
        alpha_buttons = []
        for i in ['000', '020', '040', '060', '080']:
            if len(alpha_buttons) > 0:
                alpha_buttons.append(RadioToolButton(group=alpha_buttons[0]))
            else:
                alpha_buttons.append(RadioToolButton(group=None))
            alpha_buttons[-1].set_icon_name('network-wireless-' + i)
            button_alpha_level = 1.0 - float(i) / 100.
            alpha_buttons[-1].connect('clicked', self._set_alpha_cb,
                                      button_alpha_level)
            alpha_box.pack_start(alpha_buttons[-1], False, True, 0)
            alpha_buttons[-1].show()
            if alpha < button_alpha_level + 0.1:
                alpha_buttons[-1].set_active(True)

        alpha_alignment = Gtk.Alignment()
        alpha_alignment.set(0.5, 0, 0, 0)
        alpha_alignment.add(alpha_box)
        alpha_box.show()
        self.pack_start(alpha_alignment, False, False, 0)
        alpha_alignment.show()

        self._paths_list = []

        file_paths = []
        for directory in self._model.BACKGROUNDS_DIRS:
            if directory is not None and os.path.exists(directory):
                for root, dirs, files in os.walk(directory):
                    for file_ in files:
                        file_paths.append(os.path.join(root, file_))

        self._append_to_store(file_paths)
        self.setup()
예제 #42
0
파일: view.py 프로젝트: ceibal-tatu/sugar
    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()
예제 #43
0
    def __init__(self, model, alerts):
        SectionView.__init__(self)

        self._model = model
        self.restart_alerts = alerts

        services = get_webaccount_services()

        grid = Gtk.Grid()

        if len(services) == 0:
            grid.set_row_spacing(style.DEFAULT_SPACING)

            icon = Icon(pixel_size=style.LARGE_ICON_SIZE,
                        icon_name='module-webaccount',
                        stroke_color=style.COLOR_BUTTON_GREY.get_svg(),
                        fill_color=style.COLOR_TRANSPARENT.get_svg())

            grid.attach(icon, 0, 0, 1, 1)
            icon.show()

            label = Gtk.Label()
            label.set_justify(Gtk.Justification.CENTER)
            label.set_markup(
                '<span foreground="%s" size="large">%s</span>'
                % (style.COLOR_BUTTON_GREY.get_html(),
                   GLib.markup_escape_text(
                       _('No web services are installed.\n'
                         'Please visit %s for more details.' %
                         'http://wiki.sugarlabs.org/go/WebServices'))))
            label.show()
            grid.attach(label, 0, 1, 1, 1)

            alignment = Gtk.Alignment.new(0.5, 0.5, 0.1, 0.1)
            alignment.add(grid)
            grid.show()

            self.add(alignment)
            alignment.show()
            return

        grid.set_row_spacing(style.DEFAULT_SPACING * 4)
        grid.set_column_spacing(style.DEFAULT_SPACING * 4)
        grid.set_border_width(style.DEFAULT_SPACING * 2)
        grid.set_column_homogeneous(True)

        width = Gdk.Screen.width() - 2 * style.GRID_CELL_SIZE
        nx = int(width / (style.GRID_CELL_SIZE + style.DEFAULT_SPACING * 4))

        self._service_config_box = Gtk.VBox()

        x = 0
        y = 0
        for service in services:
            service_grid = Gtk.Grid()
            icon = CanvasIcon(icon_name=service.get_icon_name())
            icon.show()
            service_grid.attach(icon, x, y, 1, 1)

            icon.connect('activate', service.config_service_cb, None,
                         self._service_config_box)

            label = Gtk.Label()
            label.set_justify(Gtk.Justification.CENTER)
            name = get_service_name(service)
            label.set_markup(name)
            service_grid.attach(label, x, y + 1, 1, 1)
            label.show()

            grid.attach(service_grid, x, y, 1, 1)
            service_grid.show()

            x += 1
            if x == nx:
                x = 0
                y += 1

        alignment = Gtk.Alignment.new(0.5, 0, 0, 0)
        alignment.add(grid)
        grid.show()

        vbox = Gtk.VBox()
        vbox.pack_start(alignment, False, False, 0)
        alignment.show()

        scrolled = Gtk.ScrolledWindow()
        vbox.pack_start(scrolled, True, True, 0)

        self.add(vbox)
        scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        scrolled.show()

        workspace = Gtk.VBox()
        scrolled.add_with_viewport(workspace)
        workspace.show()

        workspace.add(self._service_config_box)
        workspace.show_all()
        vbox.show()
예제 #44
0
파일: view.py 프로젝트: AbrahmAB/sugar
    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()
예제 #45
0
    def __init__(self, model):
        SectionView.__init__(self)

        self._model = model

        self.set_border_width(style.DEFAULT_SPACING * 2)
        self.set_spacing(style.DEFAULT_SPACING)
        self._group = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)

        scrollwindow = gtk.ScrolledWindow()
        scrollwindow.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        self.pack_start(scrollwindow, expand=True)
        scrollwindow.show()

        self._vbox = gtk.VBox()
        scrollwindow.add_with_viewport(self._vbox)
        self._vbox.show()
        self.add(scrollwindow)

        self._smolt_submit_profile_handler = None
        self._smolt_delete_profile_handler = None

        label_smolt = gtk.Label(_('Hardware Profile'))
        label_smolt.set_alignment(0, 0)
        self._vbox.pack_start(label_smolt, expand=False)
        label_smolt.show()
        box_smolt = gtk.VBox()
        box_smolt.set_border_width(style.DEFAULT_SPACING * 2)
        box_smolt.set_spacing(style.DEFAULT_SPACING)

        smolt_info = gtk.Label(_("We invite you to create a hardware profile for your computer. "
                                 "Doing so helps software developers to diagnose possible problems. "
                                 "You can submit and then delete your profile by pressing the buttons below. "))
        smolt_info.set_alignment(0, 0)
        smolt_info.set_line_wrap(True)
        smolt_info.show()
        box_smolt.pack_start(smolt_info, expand=False)

        box_submit_profile = gtk.HBox(spacing=style.DEFAULT_SPACING)
        self._submit_profile_button = gtk.Button()
        self._submit_profile_button.set_label(_('Submit Profile'))
        box_submit_profile.pack_start(self._submit_profile_button, expand=False)
        self._submit_profile_button.show()
        box_smolt.pack_start(box_submit_profile, expand=False)
        box_submit_profile.show()

        if os.path.exists(os.getenv("HOME") + '/.smolt/uuiddb.cfg'):
            box_delete_profile = gtk.HBox(spacing=style.DEFAULT_SPACING)
            self._delete_profile_button = gtk.Button()
            self._delete_profile_button.set_label(_('Delete Profile'))
            box_delete_profile.pack_start(self._delete_profile_button, expand=False)
            self._delete_profile_button.show()
            box_smolt.pack_start(box_delete_profile, expand=False)
            box_delete_profile.show()

        box_profile = gtk.HBox(spacing=style.DEFAULT_SPACING)
        label_profile = gtk.Label(_('Profile:'))
        label_profile.set_alignment(1, 0)
        label_profile.modify_fg(gtk.STATE_NORMAL, 
                              style.COLOR_SELECTION_GREY.get_gdk_color())
        box_profile.pack_start(label_profile, expand=False)
        self._group.add_widget(label_profile)
        label_profile.show()
        label_profile_url = gtk.Label(self._model.get_profile_url())
        label_profile_url.set_alignment(0, 0)
        box_profile.pack_start(label_profile_url, expand=False)
        label_profile_url.show()
        box_smolt.pack_start(box_profile, expand=False)
        box_profile.show()

        self._vbox.pack_start(box_smolt, expand=False)
        box_smolt.show()

        self._setup_submit()
        self._setup_policy()

        if os.path.exists(os.getenv("HOME") + '/.smolt/uuiddb.cfg'):
            self._setup_delete()
예제 #46
0
파일: view.py 프로젝트: upman/sugar
    def __init__(self, model, alerts=None):
        SectionView.__init__(self)

        self._model = model
        self.restart_alerts = alerts
        self._timeout_sid = 0

        self.set_border_width(style.DEFAULT_SPACING)
        self.set_spacing(style.DEFAULT_SPACING)

        self._label_grp = Gtk.SizeGroup(Gtk.SizeGroupMode.HORIZONTAL)
        self._combo_grp = Gtk.SizeGroup(Gtk.SizeGroupMode.HORIZONTAL)

        scrolled_win = Gtk.ScrolledWindow()
        scrolled_win.set_policy(Gtk.PolicyType.AUTOMATIC,
                                Gtk.PolicyType.AUTOMATIC)
        self.add(scrolled_win)
        scrolled_win.show()

        main_box = Gtk.VBox(spacing=style.DEFAULT_SPACING)
        main_box.set_border_width(style.DEFAULT_SPACING)
        scrolled_win.add_with_viewport(main_box)
        main_box.show()

        explanation = _('You will need to provide the following information'
                        ' to set up a mobile broadband connection to a'
                        ' cellular (3G) network.')
        self._text = Gtk.Label(label=explanation)
        self._text.set_line_wrap(True)
        self._text.set_alignment(0, 0)
        main_box.pack_start(self._text, True, False, 0)
        self._text.show()

        self._upper_box = Gtk.VBox(spacing=style.DEFAULT_SPACING)
        self._upper_box.set_border_width(style.DEFAULT_SPACING)
        main_box.pack_start(self._upper_box, True, False, 0)
        self._upper_box.show()

        country_store = Gtk.ListStore(str, object)
        country_store.append([])

        provider_store = Gtk.ListStore(str, object)
        provider_store.append([])

        plan_store = Gtk.ListStore(str, object)
        plan_store.append([])

        self._country_combo = self._add_combo(country_store, _('Country:'))
        self.provider_combo = self._add_combo(provider_store, _('Provider:'))
        self.plan_combo = self._add_combo(plan_store, _('Plan:'))

        separator = Gtk.HSeparator()
        main_box.pack_start(separator, True, False, 0)
        separator.show()

        try:
            self.service_providers = self._model.ServiceProviders()
        except ServiceProvidersError:
            self.service_providers = None
        else:
            countries = self.service_providers.get_countries()
            providers = self.service_providers.get_providers()
            plans = self.service_providers.get_plans()

            current_country = self.service_providers.get_country()
            current_provider = self.service_providers.get_provider()
            current_plan = self.service_providers.get_plan()

            country_store = _create_providers_list_store(countries)
            provider_store = _create_providers_list_store(providers)
            plan_store = _create_providers_list_store(plans)

            self._country_combo.set_model(country_store)
            self._country_combo.set_active(current_country.idx)

            self.provider_combo.set_model(provider_store)
            self.provider_combo.set_active(current_provider.idx)

            self.plan_combo.set_model(plan_store)
            self.plan_combo.set_active(current_plan.idx)

            self._country_combo.connect("changed", self._country_selected_cb)
            self.provider_combo.connect("changed", self._provider_selected_cb)
            self.plan_combo.connect("changed", self._plan_selected_cb)

        lower_box = Gtk.VBox(spacing=style.DEFAULT_SPACING)
        lower_box.set_border_width(style.DEFAULT_SPACING)
        main_box.pack_start(lower_box, True, False, 0)
        lower_box.show()

        self._username_entry = EntryWithLabel(_('Username:'******'changed', self.__entry_changed_cb)
        self._label_grp.add_widget(self._username_entry.label)
        self._combo_grp.add_widget(self._username_entry.entry)
        lower_box.pack_start(self._username_entry, False, True, 0)
        self._username_entry.show()

        self._password_entry = EntryWithLabel(_('Password:'******'changed', self.__entry_changed_cb)
        self._label_grp.add_widget(self._password_entry.label)
        self._combo_grp.add_widget(self._password_entry.entry)
        lower_box.pack_start(self._password_entry, False, True, 0)
        self._password_entry.show()

        self._number_entry = EntryWithLabel(_('Number:'))
        self._number_entry.entry.connect('changed', self.__entry_changed_cb)
        self._label_grp.add_widget(self._number_entry.label)
        self._combo_grp.add_widget(self._number_entry.entry)
        lower_box.pack_start(self._number_entry, False, True, 0)
        self._number_entry.show()

        self._apn_entry = EntryWithLabel(_('Access Point Name (APN):'))
        self._apn_entry.entry.connect('changed', self.__entry_changed_cb)
        self._label_grp.add_widget(self._apn_entry.label)
        self._combo_grp.add_widget(self._apn_entry.entry)
        lower_box.pack_start(self._apn_entry, False, True, 0)
        self._apn_entry.show()

        self._pin_entry = EntryWithLabel(_('Personal Identity Number (PIN):'))
        self._pin_entry.entry.connect('changed', self.__entry_changed_cb)
        self._label_grp.add_widget(self._pin_entry.label)
        self._combo_grp.add_widget(self._pin_entry.entry)
        lower_box.pack_start(self._pin_entry, False, True, 0)
        self._pin_entry.show()

        self.setup()