def _setup_toolbars(self): ''' Setup the toolbars.. ''' tools_toolbar = Gtk.Toolbar() numbers_toolbar = Gtk.Toolbar() toolbox = ToolbarBox() self.activity_toolbar_button = ActivityToolbarButton(self) toolbox.toolbar.insert(self.activity_toolbar_button, 0) self.activity_toolbar_button.show() self.numbers_toolbar_button = ToolbarButton( page=numbers_toolbar, icon_name='number-tools') if MODE == 'number': numbers_toolbar.show() toolbox.toolbar.insert(self.numbers_toolbar_button, -1) self.numbers_toolbar_button.show() self.tools_toolbar_button = ToolbarButton( page=tools_toolbar, icon_name='view-source') self.button_pattern = button_factory( 'new-pattern-game', toolbox.toolbar, self._select_game_cb, cb_arg='pattern', tooltip=_('New game')) self._set_extras(toolbox.toolbar) self._sep.append(separator_factory(toolbox.toolbar, True, False)) stop_button = StopButton(self) stop_button.props.accelerator = '<Ctrl>q' toolbox.toolbar.insert(stop_button, -1) stop_button.show() button_factory('score-copy', self.activity_toolbar_button, self._write_scores_to_clipboard, tooltip=_('Export scores to clipboard')) self.set_toolbar_box(toolbox) toolbox.show() if MODE == 'word': self.words_tool_button = button_factory( 'word-tools', tools_toolbar, self._edit_words_cb, tooltip=_('Edit word lists.')) self.import_button = button_factory( 'image-tools', tools_toolbar, self.image_import_cb, tooltip=_('Import custom cards')) self.button_custom = button_factory( 'new-custom-game', tools_toolbar, self._select_game_cb, cb_arg='custom', tooltip=_('New custom game')) self.button_custom.set_sensitive(False) if MODE == 'number': self._setup_number_buttons(numbers_toolbar)
def add_page(self, ebook_reader_tab_instance): # Add the "content" for the section. tab_name = ebook_reader_tab_instance.get_tab_label() tab_widget = ebook_reader_tab_instance.get_widget_to_attach_notebook_tab( ) tab_toolbar = ebook_reader_tab_instance.get_tab_toolbar() if tab_toolbar is not None: tab_widget.pack_start(tab_toolbar, False, False, 0) tab_widget.reorder_child(tab_toolbar, 0) self._tab_toolbars_list.append(tab_toolbar) self.notebook.add_page(tab_name, tab_widget) # Add the "(secondary) toolbar" for the section. icon_name = \ ebook_reader_tab_instance.get_tab_toolbar_icon_name() toolbar_button = ToolbarButton(page=None, icon_name=icon_name + '-select') self._toolbar_buttons_list.append(toolbar_button) toolbar_button.connect('clicked', self.load_corresponding_page, ebook_reader_tab_instance.get_pagenum()) ebook_reader_tab_instance.show() toolbar_button.set_tooltip(tab_name) self._toolbar_box._toolbar.insert(toolbar_button, -1) toolbar_button.show() self._toolbar_box.show_all()
def __init__(self): Gtk.Toolbar.__init__(self) self.button = ToolbarButton(page=self, icon_name="toolbar-view") self.buttons = { CelestialBodyType.MERCURY: None, CelestialBodyType.VENUS: None, CelestialBodyType.EARTH: None, CelestialBodyType.MARS: None, CelestialBodyType.JUPITER: None, CelestialBodyType.SATURN: None, CelestialBodyType.URANUS: None, CelestialBodyType.NEPTUNE: None } self.orbits_button = ToggleToolButton("show-orbits") self.orbits_button.set_tooltip(_("Show planets orbits")) self.orbits_button.set_active(True) self.orbits_button.connect("toggled", self._show_orbits_cb) self.insert(self.orbits_button, -1) self.insert(make_separator(False), -1) for planet in self.buttons: button = ToggleToolButton(get_icon_name(planet)) button.set_tooltip(get_body_name(planet)) button.set_active(True) button.connect("toggled", self._show_planet_cb, planet) self.insert(button, -1) self.buttons[planet] = button self.show_all()
def __init__(self, handle): print "running activity init", handle activity.Activity.__init__(self, handle) print "activity running" self.set_title('Teach Teacher') toolbarbox = ToolbarBox() self.set_toolbar_box(toolbarbox) toolbar = Gtk.Toolbar() button = ActivityToolbarButton(self) toolbarbox.toolbar.insert(button, -1) self.goBack = ToolButton('go-left') self.goBack.set_tooltip("Go Back") self.goBack.connect('clicked', self.back_clicked) toolbar.insert(self.goBack, -1) self.home = ToolButton('go-home') self.home.set_tooltip("Home") self.home.connect('clicked', self.home_clicked) toolbar.insert(self.home, -1) self.xois = ToolButton('computer-xo') self.xois.set_tooltip("T's XO") self.xois.connect('clicked', self.xois_clicked) # toolbar.insert(self.xois, -1) # self.xois.show() self.guide = ToolButton('go-next') self.guide.set_tooltip("T's Guide") self.guide.connect('clicked', self.guide_clicked) # toolbar.insert(self.guide, -1) # self.guide.show() toolbarbox.toolbar.insert(ToolbarButton(page=toolbar, icon_name='toolbar-edit'), -1) separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) toolbarbox.toolbar.insert(separator, -1) stop_button = StopButton(self) toolbarbox.toolbar.insert(stop_button, -1) scroll = Gtk.ScrolledWindow() self.set_canvas(scroll) self.webview = WebView() self.webview.load_uri('http://147.47.120.20/~tsquare/menu.php') scroll.add(self.webview) toolbar.show_all() toolbarbox.show_all() toolbarbox.toolbar.show_all() self.show_all() print "AT END OF THE CLASS"
def build_toolbar(self): toolbar_box = ToolbarBox() view_toolbar = ViewToolbar() view_toolbar.connect('go-fullscreen', self.view_toolbar_go_fullscreen_cb) view_toolbar.show() view_toolbar_button = ToolbarButton(page=view_toolbar, icon_name='toolbar-view') toolbar_box.toolbar.insert(view_toolbar_button, -1) view_toolbar_button.show() separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) toolbar_box.toolbar.insert(separator, -1) separator.show() stop_button = StopButton(self) stop_button.props.accelerator = '<Ctrl><Shift>Q' toolbar_box.toolbar.insert(stop_button, -1) stop_button.show() self.set_toolbar_box(toolbar_box) toolbar_box.show()
def __init__(self): Gtk.Toolbar.__init__(self) self.button = ToolbarButton(page=self, icon_name="media-playback-stop") self.playing = True self.speed = None self.stop_play = ToolButton("media-playback-stop") self.stop_play.set_tooltip(_("Stop")) self.stop_play.connect("clicked", self._stop_play) self.insert(self.stop_play, -1) self.slow_button = RadioToolButton(group=None, icon_name="slow-walk-milton-raposo") self.slow_button.set_tooltip(_("Run slow")) self.slow_button.connect("clicked", self._speed_changed_cb, Speed.SLOW) self.insert(self.slow_button, -1) self.normal_button = RadioToolButton(group=self.slow_button, icon_name="walking") self.normal_button.set_tooltip(_("Run Normal")) self.normal_button.connect("clicked", self._speed_changed_cb, Speed.NORMAL) self.insert(self.normal_button, -1) self.fast_button = RadioToolButton(group=self.slow_button, icon_name="running") self.fast_button.set_tooltip(_("Run fast")) self.fast_button.connect("clicked", self._speed_changed_cb, Speed.FAST) self.insert(self.fast_button, -1) self.slow_button.set_active(True) self.show_all()
def setup_toolbar(self): '''Setup the top toolbar. Groupthink needs some work here.''' toolbox = ToolbarBox() activity_button = ActivityToolbarButton(self) toolbox.toolbar.insert(activity_button, 0) activity_button.show() self.set_toolbar_box(toolbox) toolbox.show() toolbar = toolbox.toolbar self.edit_toolbar = EditToolbar() edit_toolbar_button = ToolbarButton(page=self.edit_toolbar, icon_name='toolbar-edit') self.edit_toolbar.show() toolbar.insert(edit_toolbar_button, -1) edit_toolbar_button.show() self.edit_toolbar.undo.connect('clicked', self.undobutton_cb) self.edit_toolbar.redo.connect('clicked', self.redobutton_cb) self.edit_toolbar.copy.connect('clicked', self.copybutton_cb) self.edit_toolbar.paste.connect('clicked', self.pastebutton_cb) separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) toolbar.insert(separator, -1) separator.show() stop_button = StopButton(self) stop_button.props.accelerator = '<Ctrl>q' toolbox.toolbar.insert(stop_button, -1) stop_button.show()
def _setup_toolbars(self): custom_toolbar = Gtk.Toolbar() toolbox = ToolbarBox() self._toolbar = toolbox.toolbar self._activity_button = ActivityToolbarButton(self) self._activity_button.connect('clicked', self._update_graphics) self._toolbar.insert(self._activity_button, 0) self._activity_button.show() self._custom_toolbar_button = ToolbarButton(label=_('Custom'), page=custom_toolbar, icon_name='view-source') self._custom_toolbar_button.connect('clicked', self._update_graphics) custom_toolbar.show() self._toolbar.insert(self._custom_toolbar_button, -1) self._custom_toolbar_button.show() self._load_standard_buttons(self._toolbar) self._separator = Gtk.SeparatorToolItem() self._separator.props.draw = False self._separator.set_expand(True) self._toolbar.insert(self._separator, -1) self._separator.show() stop_button = StopButton(self) stop_button.props.accelerator = _('<Ctrl>Q') self._toolbar.insert(stop_button, -1) stop_button.show() self.set_toolbar_box(toolbox) toolbox.show() self._load_custom_buttons(custom_toolbar)
def add_view(self, widget): if len(self._view_icons) >= 5: for x in self.activity._alerts: self.activity.remove_alert(x) alert = NotifyAlert(10) alert.props.title = _('Limit reached') alert.props.msg = _('You have reached the maximum limit of ' 'favorites views, please delete some before ' 'continuing.') self.activity.add_alert(alert) alert.connect('response', lambda x, y: self.activity.remove_alert(x)) return current = len(self._view_buttons) + 1 label = _('Favorites view %d') % current button = ToolbarButton(label=label, icon_name='view-radial') page = FavoritePage(button, self, 'view-radial', 'emblem-favorite', label) button.set_page(page) self._view_icons[button] = 'view-radial' self._favorite_icons[button] = 'emblem-favorite' self._view_buttons[button] = button self._favorite_names[button] = label self.insert(button, -1) self.save_to_gsettings() self.show_all()
def __init__(self): Gtk.Toolbar.__init__(self) self.button = ToolbarButton(page=self, icon_name="info") self.button_simulation = RadioToolButton(icon_name="solar-system", group=None) self.button_simulation.set_tooltip(_("Show solar system")) self.button_simulation.connect("toggled", self._show_simulation_cb) self.insert(self.button_simulation, -1) self.button_info = RadioToolButton(icon_name="info", group=self.button_simulation) self.button_info.set_tooltip(_("Show information")) self.button_info.connect("toggled", self._show_info_cb) self.insert(self.button_info, -1) self.insert(make_separator(False), -1) self.back_button = ToolButton("go-previous-paired") self.back_button.set_tooltip(_("Go back")) self.back_button.set_sensitive(False) self.back_button.connect("clicked", self._go_back_cb) self.insert(self.back_button, -1) self.forward_button = ToolButton("go-next-paired") self.forward_button.set_tooltip(_("Go forward")) self.forward_button.set_sensitive(False) self.forward_button.connect("clicked", self._go_forward_cb) self.insert(self.forward_button, -1) self.show_all()
def __init__(self, handle): activity.Activity.__init__(self, handle) self.props.max_participants = 1 self._web_view = WebKit.WebView() toolbox = ToolbarBox() self.set_toolbar_box(toolbox) toolbox.show() toolbar = toolbox.toolbar toolbar.show() activity_button = ActivityButton(self) toolbar.insert(activity_button, -1) viewtoolbar = ViewToolbar(self) viewtoolbar_button = ToolbarButton( page=viewtoolbar, icon_name='toolbar-view') toolbar.insert(viewtoolbar_button, -1) toolbar.show_all() self._back = ToolButton('go-previous-paired') self._back.set_tooltip(_('Back')) self._back.props.sensitive = False self._back.connect('clicked', self._go_back_cb) toolbar.insert(self._back, -1) self._back.show() self._forward = ToolButton('go-next-paired') self._forward.set_tooltip(_('Forward')) self._forward.props.sensitive = False self._forward.connect('clicked', self._go_forward_cb) toolbar.insert(self._forward, -1) self._forward.show() home = ToolButton('go-home') home.set_tooltip(_('Home')) home.connect('clicked', self._go_home_cb) toolbar.insert(home, -1) home.show() separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) toolbar.insert(separator, -1) stopbtn = StopButton(self) toolbar.insert(stopbtn, -1) toolbar.show_all() self._web_view.connect('load-finished', self.update_navigation_buttons) self.set_canvas(self._web_view) self._web_view.show() self._web_view.load_uri(HOME)
def createPercussionToolbar(self, toolbar_box): self.beats_pm_button = IntensitySelector(list(range(2, 13)), 4, imagefile('beat3.svg')) self.tempo_button = \ IntensitySelector(list(range(PLAYER_TEMPO_LOWER, PLAYER_TEMPO_UPPER + 1, PLAYER_TEMPO_STEP)), PLAYER_TEMPO, imagefile('tempo5.png')) self.complexity_button = IntensitySelector(xfrange(0, 1, 0.1), self.regularity, imagefile('complex6.svg')) self._play_percussion_btn = ToolButton( icon_name='media-playback-start') self._play_percussion_btn.set_property('can-default', True) self._play_percussion_btn.show() self._play_percussion_btn.connect('clicked', self.handlePlayButton) beats_toolbar = ToolbarBox() beats_toolbar.toolbar.insert(self._play_percussion_btn, -1) self._what_drum_widget = Gtk.ToolItem() self._what_drum_search_button = FilterToolItem( _('Select Drum'), 'view-type', _('Jazz / Rock Kit'), self._what_drum_widget) self._what_drum_search_button.set_widget_icon( file_name=imagefile("drum1kit.svg")) self._what_drum_widget.show() beats_toolbar.toolbar.insert(self._what_drum_search_button, -1) self._what_drum_search_button.show() self._what_drum_search_button.set_is_important(True) beats_toolbar.toolbar.insert(Gtk.SeparatorToolItem(), -1) beats_toolbar.toolbar.insert(self.complexity_button, -1) beats_toolbar.toolbar.insert(self.beats_pm_button, -1) beats_toolbar.toolbar.insert(self.tempo_button, -1) beats_toolbar_button = ToolbarButton(icon_name='toolbar-drums', page=beats_toolbar) beats_toolbar_button.show() toolbar_box.toolbar.insert(beats_toolbar_button, 1) self.beats_pm_button.set_tooltip(_("Beats per bar")) self.beats_pm_button.show() self.beats_pm_button.connect('changed', self.beatSliderChange, True) self.tempo_button.connect('changed', self.tempoSliderChange, True) self.complexity_button.connect('changed', self.handleComplexityChange, True) self.complexity_button.set_tooltip(_("Beat complexity")) self.tempo_button.show() self.tempo_button.set_tooltip(_('Tempo')) self.complexity_button.show()
def build_birth_toolbar(self, toolbox): birth_bar = Gtk.Toolbar() item1 = Gtk.ToolItem() self.label_birth = Gtk.Label() self.label_birth.set_text(_('Birth:') + ' ' + _('Day') + ' ') item1.add(self.label_birth) birth_bar.insert(item1, -1) item2 = Gtk.ToolItem() self.day_birth_spin = Gtk.SpinButton() self.day_birth_spin.set_range(1, 31) self.day_birth_spin.set_increments(1, 5) self.day_birth_spin.props.value = 10 self.day_birth_spin.connect('notify::value', self.day_birth_change) item2.add(self.day_birth_spin) birth_bar.insert(item2, -1) item3 = Gtk.ToolItem() self.label_birth_month = Gtk.Label() self.label_birth_month.set_text(' ' + _('Month') + ' ') item3.add(self.label_birth_month) birth_bar.insert(item3, -1) item4 = Gtk.ToolItem() self.month_birth_spin = Gtk.SpinButton() self.month_birth_spin.set_range(1, 12) self.month_birth_spin.set_increments(1, 4) self.month_birth_spin.props.value = 2 self.month_birth_spin.connect('notify::value', self.month_birth_change) item4.add(self.month_birth_spin) birth_bar.insert(item4, -1) item5 = Gtk.ToolItem() self.label_birth_year = Gtk.Label() self.label_birth_year.set_text(' ' + _('Year') + ' ') item5.add(self.label_birth_year) birth_bar.insert(item5, -1) item6 = Gtk.ToolItem() self.year_birth_spin = Gtk.SpinButton() self.year_birth_spin.set_range(1900, self._now.year) self.year_birth_spin.set_increments(1, 10) self.year_birth_spin.props.value = 1990 self.year_birth_spin.connect('notify::value', self.year_birth_change) item6.add(self.year_birth_spin) birth_bar.insert(item6, -1) birth_bar.show_all() birth_button = ToolbarButton(label=_('Birth'), page=birth_bar, icon_name='write-date') toolbox.toolbar.insert(birth_button, -1) birth_button.show()
def build_today_toolbar(self, toolbox): today_bar = Gtk.Toolbar() item1 = Gtk.ToolItem() self.label_today = Gtk.Label() self.label_today.set_text(_('Today:') + ' ' + _('Day') + ' ') item1.add(self.label_today) today_bar.insert(item1, -1) item2 = Gtk.ToolItem() self.day_today_spin = Gtk.SpinButton() self.day_today_spin.set_range(1, 31) self.day_today_spin.set_increments(1, 5) self.day_today_spin.props.value = self._today[0] self.day_today_spin.connect('notify::value', self.day_today_change) item2.add(self.day_today_spin) today_bar.insert(item2, -1) item3 = Gtk.ToolItem() self.label_today_month = Gtk.Label() self.label_today_month.set_text(' ' + _('Month') + ' ') item3.add(self.label_today_month) today_bar.insert(item3, -1) item4 = Gtk.ToolItem() self.month_today_spin = Gtk.SpinButton() self.month_today_spin.set_range(1, 12) self.month_today_spin.set_increments(1, 4) self.month_today_spin.props.value = self._today[1] self.month_today_spin.connect('notify::value', self.month_today_change) item4.add(self.month_today_spin) today_bar.insert(item4, -1) item5 = Gtk.ToolItem() self.label_today_year = Gtk.Label() self.label_today_year.set_text(' ' + _('Year') + ' ') item5.add(self.label_today_year) today_bar.insert(item5, -1) item6 = Gtk.ToolItem() self.year_today_spin = Gtk.SpinButton() self.year_today_spin.set_range(1900, self._now.year + 1) self.year_today_spin.set_increments(1, 10) self.year_today_spin.props.value = self._today[2] self.year_today_spin.connect('notify::value', self.year_today_change) item6.add(self.year_today_spin) today_bar.insert(item6, -1) today_bar.show_all() today_button = ToolbarButton(label=_('Today'), page=today_bar, icon_name='write-time') toolbox.toolbar.insert(today_button, -1) today_button.show()
def make_toolbar(self): # toolbar with the new toolbar redesign toolbar_box = ToolbarBox() activity_button = ActivityToolbarButton(self) toolbar_box.toolbar.insert(activity_button, 0) activity_button.show() toolbarview = Gtk.Toolbar() langtoolbar_button = ToolbarButton(label=_('View'), page=toolbarview, icon_name='settings') langtoolbar_button.show() toolbar_box.toolbar.insert(langtoolbar_button, -1) tool = ToolButton('en') tool.set_tooltip(_('English')) tool.connect('clicked', self.language_en) tool.show() toolbarview.insert(tool, -1) tool = ToolButton('es') tool.set_tooltip(_('Spanish')) tool.connect('clicked', self.language_es) tool.show() toolbarview.insert(tool, -1) tool = ToolButton('fr') tool.set_tooltip(_('French')) tool.connect('clicked', self.language_fr) tool.show() toolbarview.insert(tool, -1) tool = ToolButton('remote') tool.set_tooltip(_('Server settings')) tool.connect('clicked', self.settings) tool.show() toolbarview.insert(tool, -1) toolbarview.show() favorite_button = ToolButton(self.favorite_status) favorite_button.set_tooltip('Filter on favorite') favorite_button.connect('clicked', self.favorite) toolbar_box.toolbar.insert(favorite_button, -1) favorite_button.show() self.favorite_button = favorite_button separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) toolbar_box.toolbar.insert(separator, -1) separator.show() stop_button = StopButton(self) toolbar_box.toolbar.insert(stop_button, -1) stop_button.show() self.set_toolbar_box(toolbar_box) toolbar_box.show()
def build_toolbar(self): toolbar_box = ToolbarBox() activity_button = ActivityToolbarButton(self) toolbar_box.toolbar.insert(activity_button, 0) activity_button.show() edit_toolbar = self._create_edit_toolbar() edit_toolbar_button = ToolbarButton(page=edit_toolbar, icon_name='toolbar-edit') edit_toolbar.show() toolbar_box.toolbar.insert(edit_toolbar_button, -1) edit_toolbar_button.show() view_toolbar = self._create_view_toolbar() view_toolbar_button = ToolbarButton(page=view_toolbar, icon_name='toolbar-view') view_toolbar.show() toolbar_box.toolbar.insert(view_toolbar_button, -1) view_toolbar_button.show() self._delete_tab_toolbar = None self._previous_tab_toolbar = None self._next_tab_toolbar = None helpbutton = self._create_help_button() toolbar_box.toolbar.insert(helpbutton, -1) helpbutton.show_all() separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) toolbar_box.toolbar.insert(separator, -1) separator.show() stop_button = StopButton(self) stop_button.props.accelerator = '<Ctrl><Shift>Q' toolbar_box.toolbar.insert(stop_button, -1) stop_button.show() self.set_toolbar_box(toolbar_box) toolbar_box.show()
def build_resolution_toolbar(self, toolbox): resolution_bar = Gtk.Toolbar() item1 = Gtk.ToolItem() label1 = Gtk.Label() label1.set_text(' ' + _('Show size') + ' ') item1.add(label1) resolution_bar.insert(item1, -1) item2 = Gtk.ToolItem() x_size_spin = Gtk.SpinButton() x_size_spin.set_range(160, 1200) x_size_spin.set_increments(1, 10) x_size_spin.props.value = int(self.show_size[0]) x_size_spin.connect('notify::value', self.x_size_spin_change) item2.add(x_size_spin) resolution_bar.insert(item2, -1) item3 = Gtk.ToolItem() label3 = Gtk.Label() label3.set_text(' X ') item3.add(label3) resolution_bar.insert(item3, -1) item4 = Gtk.ToolItem() y_size_spin = Gtk.SpinButton() y_size_spin.set_range(120, 900) y_size_spin.set_increments(1, 10) y_size_spin.props.value = int(self.show_size[1]) y_size_spin.connect('notify::value', self.y_size_spin_change) item4.add(y_size_spin) resolution_bar.insert(item4, -1) separator1 = Gtk.SeparatorToolItem() separator1.props.draw = True resolution_bar.insert(separator1, -1) item5 = Gtk.ToolItem() label5 = Gtk.Label() label5.set_text(' ' + _('Show grid')) item5.add(label5) resolution_bar.insert(item5, -1) grid = ToolButton('grid-icon') grid.connect('clicked', self.grid_click) resolution_bar.insert(grid, -1) resolution_bar.show_all() resolution_button = ToolbarButton(label=_('Resolution'), page=resolution_bar, icon_name='camera') toolbox.toolbar.insert(resolution_button, -1) resolution_button.show()
def build_toolbar(self): toolbar_box = ToolbarBox() activity_button = ActivityToolbarButton(self) toolbar_box.toolbar.insert(activity_button, 0) activity_button.show() viewtoolbar = ViewToolbar(self) viewbutton = ToolbarButton(page=viewtoolbar, icon_name='toolbar-view') toolbar_box.toolbar.insert(viewbutton, -1) viewbutton.show() separator = Gtk.SeparatorToolItem() toolbar_box.toolbar.insert(separator, -1) separator.show() # lets reuse the code below navtoolbar = Toolbar(self.web_view, self) toolitem = Gtk.ToolItem() navtoolbar._home.reparent(toolitem) toolbar_box.toolbar.insert(toolitem, -1) navtoolbar._home.show() toolitem.show() toolitem = Gtk.ToolItem() navtoolbar._back.reparent(toolitem) toolbar_box.toolbar.insert(toolitem, -1) navtoolbar._back.show() toolitem.show() toolitem = Gtk.ToolItem() navtoolbar._forward.reparent(toolitem) toolbar_box.toolbar.insert(toolitem, -1) navtoolbar._forward.show() toolitem.show() # we do not have collaboration features # make the share option insensitive self.max_participants = 1 separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) toolbar_box.toolbar.insert(separator, -1) separator.show() stop_button = StopButton(self) toolbar_box.toolbar.insert(stop_button, -1) stop_button.show() self.set_toolbar_box(toolbar_box) toolbar_box.show()
def make_toolbar(self): # toolbar with the new toolbar redesign toolbar_box = ToolbarBox() activity_button = ActivityToolbarButton(self) toolbar_box.toolbar.insert(activity_button, 0) activity_button.show() self.toolbarview = Gtk.Toolbar() langtoolbar_button = ToolbarButton( label=_('Filter'), page=self.toolbarview, icon_name='filter') langtoolbar_button.show() toolbar_box.toolbar.insert(langtoolbar_button, -1) self.toolbarview.show() box_search_item = Gtk.ToolItem() self.search_entry = Gtk.Entry() self.search_entry.connect('changed', self.text_filter) self.search_entry.set_size_request(300, -1) box_search_item.add(self.search_entry) self.search_entry.show() box_search_item.show() toolbar_box.toolbar.insert(box_search_item, -1) favorite_button = ToolButton(self.favorite_status) favorite_button.set_tooltip('Filter on favorite') favorite_button.connect('clicked', self.favorite) toolbar_box.toolbar.insert(favorite_button, -1) favorite_button.show() self.favorite_button = favorite_button library_button = ToolButton('library') library_button.set_tooltip('Show libraries') library_button.connect('clicked', self.library_clicked) toolbar_box.toolbar.insert(library_button, -1) library_button.show() separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) toolbar_box.toolbar.insert(separator, -1) separator.show() stop_button = StopButton(self) toolbar_box.toolbar.insert(stop_button, -1) stop_button.show() self.set_toolbar_box(toolbar_box) toolbar_box.show()
def __init__(self, handle): if not hasattr(self, 'confvars'): self.confvars = read_conf_from_info(get_bundle_path()) logging.error("Starting server database: %s port: %s" % (self.confvars['path'], self.confvars['port'])) os.chdir(os.environ['SUGAR_BUNDLE_PATH']) self.confvars['ip'] = '0.0.0.0' server.run_server(self.confvars) handle.uri = 'http://%s:%s%s' % ( self.confvars['ip'], self.confvars['port'], self.confvars['home_page']) webactivity.WebActivity.__init__(self, handle) if USE_GTK2: # Use xpcom to set a RAM cache limit. (Trac #7081.) from xpcom import components from xpcom.components import interfaces cls = components.classes['@mozilla.org/preferences-service;1'] pref_service = cls.getService(interfaces.nsIPrefService) branch = pref_service.getBranch("browser.cache.memory.") branch.setIntPref("capacity", "5000") # Use xpcom to turn off "offline mode" detection, which disables # access to localhost for no good reason. (Trac #6250.) ios_class = components.classes["@mozilla.org/network/io-service;1"] io_service = ios_class.getService(interfaces.nsIIOService2) io_service.manageOfflineStatus = False self.searchtoolbar = SearchToolbar(self) search_toolbar_button = ToolbarButton() search_toolbar_button.set_page(self.searchtoolbar) search_toolbar_button.props.icon_name = 'search-wiki' search_toolbar_button.props.label = _('Search') self.get_toolbar_box().toolbar.insert(search_toolbar_button, 1) search_toolbar_button.show() # Hide add-tabs button if hasattr(self._primary_toolbar, '_add_tab'): self._primary_toolbar._add_tab.hide() self.searchtoolbar.show()
def setup_toolbar(self): activity_button = ActivityToolbarButton(self) self.toolbar.insert(activity_button, -1) self.toolbar.insert(Gtk.SeparatorToolItem(), -1) edit_toolbar = EditToolbar() self.toolbar.insert( ToolbarButton( page=edit_toolbar, icon_name="toolbar-edit"), -1) edit_toolbar.insert(Gtk.SeparatorToolItem(), -1) self.button_bold = ToggleToolButton("format-text-bold") self.button_bold.set_tooltip(_("Bold")) self.button_bold.props.accelerator = "<Ctrl>B" self.button_bold.connect( "toggled", lambda button: self.edit.toggle_bold()) edit_toolbar.insert(self.button_bold, -1) self.button_italic = ToggleToolButton("format-text-italic") self.button_italic.set_tooltip(_("Italic")) self.button_italic.props.accelerator = "<Ctrl>I" self.button_italic.connect( "toggled", lambda button: self.edit.toggle_italic()) edit_toolbar.insert(self.button_italic, -1) self.button_underline = ToggleToolButton("format-text-underline") self.button_underline.set_tooltip(_("Underline")) self.button_underline.props.accelerator = "<Ctrl>U" self.button_underline.connect( "toggled", lambda button: self.edit.toggle_underline()) edit_toolbar.insert(self.button_underline, -1) separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) self.toolbar.insert(separator, -1) stop_button = StopButton(self) self.toolbar.insert(stop_button, -1) self.toolbarbox.show_all() edit_toolbar.show_all()
def build_size_toolbar(self, toolbox): size_bar = Gtk.Toolbar() #Horizontal item1 = Gtk.ToolItem() label1 = Gtk.Label() label1.set_text(' %s ' % _('H')) item1.add(label1) size_bar.insert(item1, -1) item2 = Gtk.ToolItem() self.h_spin = Gtk.SpinButton() self.h_spin.set_range(2, 30) self.h_spin.set_increments(1, 2) self.h_spin.props.value = self.game_size[0] self.h_spin.connect('notify::value', self.h_spin_change) item2.add(self.h_spin) size_bar.insert(item2, -1) #Vertical item3 = Gtk.ToolItem() label2 = Gtk.Label() label2.set_text(' %s ' % _('V')) item3.add(label2) size_bar.insert(item3, -1) item4 = Gtk.ToolItem() self.v_spin = Gtk.SpinButton() self.v_spin.set_range(2, 20) self.v_spin.set_increments(1, 2) self.v_spin.props.value = self.game_size[1] self.v_spin.connect('notify::value', self.v_spin_change) item4.add(self.v_spin) size_bar.insert(item4, -1) size_bar.show_all() size_button = ToolbarButton(label=_('Board size'), page=size_bar, icon_name='preferences-system') toolbox.toolbar.insert(size_button, -1) size_button.show()
def __init__(self, handle): activity.Activity.__init__(self, handle, create_jobject=False) #following are essential for interface to Help self.help_x11 = None self.handle = handle self.help = Help(self) self.toolbarbox = ToolbarBox() self.toolbarbox.show_all() toolbar = Gtk.Toolbar() toolbar.insert(ToolbarButton(page=toolbar, icon_name='help-about'), -1) toolbar.show() label = Gtk.Button('Help Template') label.show() self.set_canvas(label) self.set_toolbar_box(self.toolbarbox)
def _insert_stop_play_button(self, toolbar): self.stop_play_toolbar = ToolbarButton() st_toolbar = self.stop_play_toolbar st_toolbar.props.page = Gtk.Toolbar() st_toolbar.props.icon_name = 'media-playback-stop' self.stop_play_state = True self.stop_play = ToolButton('media-playback-stop') self.stop_play.set_tooltip(_('Stop')) self.stop_play.set_accelerator(_('<ctrl>space')) self.stop_play.connect('clicked', self.stop_play_cb) self._insert_item(st_toolbar, self.stop_play) self.stop_play.show() slowest_button = RadioToolButton(group=None) slowest_button.set_icon_name('slow-walk-milton-raposo') slowest_button.set_tooltip(_('Run slower')) slowest_button.connect('clicked', self._set_fps_cb, SLOWEST_FPS) self._insert_item(st_toolbar, slowest_button) slowest_button.show() slow_button = RadioToolButton(group=slowest_button) slow_button.set_icon_name('walking') slow_button.set_tooltip(_('Run slow')) slow_button.connect('clicked', self._set_fps_cb, SLOW_FPS) self._insert_item(st_toolbar, slow_button) slow_button.show() fast_button = RadioToolButton(group=slowest_button) fast_button.set_icon_name('running') fast_button.set_tooltip('Run fast') fast_button.connect('clicked', self._set_fps_cb, FAST_FPS) self._insert_item(st_toolbar, fast_button) fast_button.show() fast_button.set_active(True) toolbar.insert(self.stop_play_toolbar, -1) self.stop_play_toolbar.show_all()
def load_views(self): settings = Gio.Settings(_DESKTOP_CONF_DIR) data = settings.get_value('homeviews').unpack() current = 0 for view in data: if 'view-label' in view: label = view['view-label'] else: label = _('Favorites view %d') % (current + 1) view_icon = view['view-icon'] favorite_icon = view['favorite-icon'] button = ToolbarButton(label=label, icon_name=view_icon) page = FavoritePage(button, self, view_icon, favorite_icon, label) button.set_page(page) self.insert(button, -1) self._view_icons[button] = view_icon self._favorite_icons[button] = favorite_icon self._view_buttons[button] = button self._favorite_names[button] = label current += 1
def __init__(self, tabbed_view, act): ToolbarBase.__init__(self) self._url_toolbar = UrlToolbar() self._activity = act self._tabbed_view = self._canvas = tabbed_view self._loading = False toolbar = self.toolbar activity_button = ActivityToolbarButton(self._activity) toolbar.insert(activity_button, 0) separator = Gtk.SeparatorToolItem() save_as_pdf = ToolButton('save-as-pdf') save_as_pdf.set_tooltip(_('Save page as pdf')) save_as_pdf.connect('clicked', self.save_as_pdf) activity_button.props.page.insert(separator, -1) activity_button.props.page.insert(save_as_pdf, -1) separator.show() save_as_pdf.show() self._go_home = ToolButton('go-home') self._go_home.set_tooltip(_('Home page')) self._go_home.connect('clicked', self._go_home_cb) # add a menu to save the home page menu_box = PaletteMenuBox() self._go_home.props.palette.set_content(menu_box) menu_item = PaletteMenuItem() menu_item.set_label(_('Select as initial page')) menu_item.connect('activate', self._set_home_cb) menu_box.append_item(menu_item) self._reset_home_menu = PaletteMenuItem() self._reset_home_menu.set_label(_('Reset initial page')) self._reset_home_menu.connect('activate', self._reset_home_cb) menu_box.append_item(self._reset_home_menu) if os.path.isfile(LIBRARY_PATH): library_menu = PaletteMenuItem() library_menu.set_label(_('Library')) library_menu.connect('activate', self._go_library_cb) menu_box.append_item(library_menu) menu_box.show_all() # verify if the home page is configured client = GConf.Client.get_default() self._reset_home_menu.set_visible( client.get_string(HOME_PAGE_GCONF_KEY) is not None) toolbar.insert(self._go_home, -1) self._go_home.show() self.entry = WebEntry() self.entry.set_icon_from_name(iconentry.ICON_ENTRY_SECONDARY, 'entry-stop') self.entry.connect('icon-press', self._stop_and_reload_cb) self.entry.connect('activate', self._entry_activate_cb) self.entry.connect('focus-in-event', self.__focus_in_event_cb) self.entry.connect('focus-out-event', self.__focus_out_event_cb) self.entry.connect('key-press-event', self.__key_press_event_cb) self.entry.connect('changed', self.__changed_cb) self._entry_item = Gtk.ToolItem() self._entry_item.set_expand(True) self._entry_item.add(self.entry) self.entry.show() toolbar.insert(self._entry_item, -1) self._entry_item.show() self._back = ToolButton('go-previous-paired') self._back.set_tooltip(_('Back')) self._back.props.sensitive = False self._back.connect('clicked', self._go_back_cb) toolbar.insert(self._back, -1) self._back.show() palette = self._back.get_palette() self._back_box_menu = Gtk.VBox() self._back_box_menu.show() palette.set_content(self._back_box_menu) # FIXME, this is a hack, should be done in the theme: palette._content.set_border_width(1) self._forward = ToolButton('go-next-paired') self._forward.set_tooltip(_('Forward')) self._forward.props.sensitive = False self._forward.connect('clicked', self._go_forward_cb) toolbar.insert(self._forward, -1) self._forward.show() palette = self._forward.get_palette() self._forward_box_menu = Gtk.VBox() self._forward_box_menu.show() palette.set_content(self._forward_box_menu) # FIXME, this is a hack, should be done in the theme: palette._content.set_border_width(1) # Downloads ProgressIcon self._download_icon = ProgressToolButton('emblem-downloads', style.STANDARD_ICON_SIZE, 'vertical') self._download_icon.set_tooltip(_('Downloads')) self._download_icon.props.sensitive = False down_id = GObject.timeout_add(500, self.__download_running_cb) toolbar.insert(self._download_icon, -1) self._download_icon.show() self._link_add = ToolButton('emblem-favorite') self._link_add.set_tooltip(_('Bookmark')) self._link_add.connect('clicked', self._link_add_clicked_cb) toolbar.insert(self._link_add, -1) self._link_add.show() self._toolbar_separator = Gtk.SeparatorToolItem() self._toolbar_separator.props.draw = False self._toolbar_separator.set_expand(True) # Adds an options-toolbar button to the main-toolbar self._options_toolbar = OptionsToolbar(self._activity) self._options_toolbar_button = ToolbarButton( page=self._options_toolbar, icon_name='options') toolbar.insert(self._options_toolbar_button, -1) stop_button = StopButton(self._activity) toolbar.insert(stop_button, -1) self._progress_listener = None self._browser = None self._loading_changed_hid = None self._progress_changed_hid = None self._session_history_changed_hid = None self._uri_changed_hid = None self._security_status_changed_hid = None if tabbed_view.get_n_pages(): self._connect_to_browser(tabbed_view.props.current_browser) tabbed_view.connect_after('switch-page', self.__switch_page_cb) tabbed_view.connect_after('page-added', self.__page_added_cb) Gdk.Screen.get_default().connect('size-changed', self.__screen_size_changed_cb) self._configure_toolbar()
def _setup_toolbars(self): ''' Setup the toolbars. ''' self._toolbox = ToolbarBox() self.activity_button = ActivityToolbarButton(self) self.activity_button.connect('clicked', self._resize_canvas) self._toolbox.toolbar.insert(self.activity_button, 0) self.activity_button.show() self.set_toolbar_box(self._toolbox) self._toolbox.show() self.toolbar = self._toolbox.toolbar view_toolbar = Gtk.Toolbar() self.view_toolbar_button = ToolbarButton(page=view_toolbar, label=_('View'), icon_name='toolbar-view') self.view_toolbar_button.connect('clicked', self._resize_canvas) self._toolbox.toolbar.insert(self.view_toolbar_button, 1) view_toolbar.show() self.view_toolbar_button.show() button = ToolButton('view-fullscreen') button.set_tooltip(_('Fullscreen')) button.props.accelerator = '<Alt>Return' view_toolbar.insert(button, -1) button.show() button.connect('clicked', self._fullscreen_cb) edit_toolbar = Gtk.Toolbar() self.edit_toolbar_button = ToolbarButton(page=edit_toolbar, label=_('Edit'), icon_name='toolbar-edit') self.edit_toolbar_button.connect('clicked', self._resize_canvas) self._toolbox.toolbar.insert(self.edit_toolbar_button, 1) edit_toolbar.show() self.edit_toolbar_button.show() self._copy_button = ToolButton('edit-copy') self._copy_button.set_tooltip(_('Copy')) self._copy_button.props.accelerator = '<Ctrl>C' edit_toolbar.insert(self._copy_button, -1) self._copy_button.show() self._copy_button.connect('clicked', self._copy_cb) self._copy_button.set_sensitive(False) self._paste_button = ToolButton('edit-paste') self._paste_button.set_tooltip(_('Paste')) self._paste_button.props.accelerator = '<Ctrl>V' edit_toolbar.insert(self._paste_button, -1) self._paste_button.show() self._paste_button.connect('clicked', self._paste_cb) self._paste_button.set_sensitive(False) button = ToolButton('list-add') button.set_tooltip(_('Add Item')) button.props.accelerator = '<Ctrl>+' self._toolbox.toolbar.insert(button, -1) button.show() button.connect('clicked', self.__add_item_cb) self._date_button = RadioToolButton('date-sort', group=None) self._date_button.set_tooltip(_('Sort by Date')) self._date_button.connect('clicked', self._date_button_cb) self._toolbox.toolbar.insert(self._date_button, -1) self._date_button.show() self._title_button = RadioToolButton('title-sort', group=self._date_button) self._title_button.set_tooltip(_('Sort by Title')) self._title_button.connect('clicked', self._title_button_cb) self._toolbox.toolbar.insert(self._title_button, -1) self._title_button.show() self._stars_button = RadioToolButton('stars-sort', group=self._date_button) self._stars_button.set_tooltip(_('Sort by Favourite')) self._stars_button.connect('clicked', self._stars_button_cb) self._toolbox.toolbar.insert(self._stars_button, -1) self._stars_button.show() # setup the search options self._search_entry = iconentry.IconEntry() self._search_entry.set_icon_from_name(iconentry.ICON_ENTRY_PRIMARY, 'system-search') self._search_entry.connect('activate', self._search_entry_activated_cb) self._search_entry.connect('changed', self._search_entry_changed_cb) self._search_entry.add_clear_button() tool_item = Gtk.ToolItem() tool_item.set_expand(True) tool_item.add(self._search_entry) self._search_entry.show() self._toolbox.toolbar.insert(tool_item, -1) tool_item.show() self._search_button = ToolButton('dialog-ok') self._search_button.set_tooltip(_('Search by Tags')) self._search_button.connect('clicked', self._search_button_cb) self._toolbox.toolbar.insert(self._search_button, -1) self._search_button.show() separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) self._toolbox.toolbar.insert(separator, -1) separator.show() stop_button = StopButton(self) stop_button.props.accelerator = '<Ctrl>q' self._toolbox.toolbar.insert(stop_button, -1) stop_button.show()
def __init__(self, handle): # Initialize the parent Activity.__init__(self, handle) logger.debug('Initiating PlayGo') self.size = DEFAULT_SIZE self.komi = DEFAULT_KOMI # Set the activity toolbarbox toolbarbox = ToolbarBox() self.set_toolbar_box(toolbarbox) toolbarbox.toolbar.insert(ActivityToolbarButton(self), -1) toolbarbox.toolbar.insert(Gtk.SeparatorToolItem(), -1) self.gameToolbar = GameToolbar(self) self.gameToolbar.connect('game-restart', self.restart_game) self.gameToolbar.connect('game-board-size', self.board_size_change) self.gameToolbar.connect('ai-activated', self.ai_activated_cb) self.gameToolbar.connect('ai-deactivated', self.ai_deactivated_cb) toolbarbox.toolbar.insert( ToolbarButton(page=self.gameToolbar, icon_name='txt'), -1) separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) toolbarbox.toolbar.insert(separator, -1) toolbarbox.toolbar.insert(StopButton(self), -1) toolbarbox.show_all() toolbarbox.toolbar.show_all() self.gameToolbar.show_all() # Initialize the game self.game = GoGame(self.size) self.CurrentColor = 'B' self.PlayerColor = 'B' self.pass_count = 0 self.ai_activated = False self.set_up_ui() if not handle.object_id: self.infopanel.show(_('Welcome to PlayGo!')) else: self.show_score() self.lastX = -1 self.lastY = -1 # Set keypad actions self._key_actions = { 'KP_Up': 'move_up', 'KP_Right': 'move_right', 'KP_Down': 'move_down', 'KP_Left': 'move_left', 'KP_Home': 'place_stone', 'KP_Next': 'undo', 'KP_End': 'pass' } # Set up collaboration self.collaboration = CollaborationWrapper(self, self.buddy_joined, self.buddy_left, self.Play, self.game.undostack, self.bootstrap) self.connect('shared', self.collaboration._shared_cb) if self.get_shared_activity(): # We are joining the activity self.connect('joined', self.collaboration._joined_cb) if self.get_shared(): # We've already joined self.collaboration._joined_cb()
def __init__(self, handle): super(VteActivity, self).__init__(handle) toolbarbox = ToolbarBox() self.set_toolbar_box(toolbarbox) toolbar = toolbarbox.toolbar activitybutton = ActivityToolbarButton(self) toolbar.insert(activitybutton, -1) toolbar.insert(Gtk.SeparatorToolItem(), -1) # add 'copy' icon from standard toolbar. edittoolbar = EditToolbar() edittoolbar.copy.set_tooltip(_('Copy selected text to clipboard')) edittoolbar.copy.connect('clicked', self._on_copy_clicked_cb) edittoolbar.paste.connect('clicked', self._on_paste_clicked_cb) # as long as nothing is selected, copy needs to be insensitive. edittoolbar.copy.set_sensitive(False) edittoolbar.show() self._copy_button = edittoolbar.copy editbutton = ToolbarButton(page=edittoolbar, icon_name='toolbar-edit') toolbar.insert(editbutton, -1) separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) toolbar.insert(separator, -1) stopbutton = StopButton(self) toolbar.insert(stopbutton, -1) # creates vte widget self._vte = Vte.Terminal() self._vte.set_size(30, 5) self._vte.set_size_request(200, 300) font = 'Monospace 10' self._vte.set_font(Pango.FontDescription(font)) self._vte.drag_dest_set( Gtk.DestDefaults.ALL, [Gtk.TargetEntry.new("text/plain", 0, TARGET_TYPE_TEXT)], Gdk.DragAction.COPY) foreground = Gdk.Color.parse('#000000')[1] background = Gdk.Color.parse('#E7E7E7')[1] try: self._vte.set_colors(foreground, background, []) except TypeError: self._vte.set_colors(Gdk.RGBA.from_color(foreground), Gdk.RGBA.from_color(background), []) self._vte.connect('selection-changed', self._on_selection_changed_cb) self._vte.connect('drag_data_received', self._on_drop_cb) # ...and its scrollbar vtebox = Gtk.HBox() vtebox.pack_start(self._vte, True, True, 0) self.set_canvas(vtebox) vtesb = Gtk.VScrollbar.new(self._vte.get_vadjustment()) vtebox.pack_start(vtesb, False, False, 0) self.show_all() # hide the buttons we don't use. edittoolbar.undo.hide() edittoolbar.redo.hide() # now start subprocess. self._vte.connect('child-exited', self.on_child_exit) self._vte.grab_focus() bundle_path = activity.get_bundle_path() # the 'sleep 1' works around a bug with the command dying before # the vte widget manages to snarf the last bits of its output argv = [ "/bin/sh", "-c", "python %s; sleep 1" % os.path.join(bundle_path, "app.py") ] args = (Vte.PtyFlags.DEFAULT, bundle_path, argv, ["PYTHONPATH=%s/library" % bundle_path ], GLib.SpawnFlags.DO_NOT_REAP_CHILD, None, None) if hasattr(self._vte, 'fork_command_full'): self._vte.fork_command_full(*args) else: self._vte.spawn_sync(*args)
def __init__(self, handle): activity.Activity.__init__(self, handle) _logger.debug('Starting the web activity') session = WebKit.get_default_session() session.set_property('accept-language-auto', True) session.set_property('ssl-use-system-ca-file', True) session.set_property('ssl-strict', False) # By default, cookies are not stored persistently, we have to # add a cookie jar so that they get saved to disk. We use one # with a SQlite database: cookie_jar = SoupGNOME.CookieJarSqlite(filename=_cookies_db_path, read_only=False) session.add_feature(cookie_jar) _seed_xs_cookie(cookie_jar) # FIXME # downloadmanager.remove_old_parts() self._force_close = False self._tabbed_view = TabbedView() self._tabbed_view.connect('focus-url-entry', self._on_focus_url_entry) self._tabbed_view.connect('switch-page', self.__switch_page_cb) self._tray = HTray() self.set_tray(self._tray, Gtk.PositionType.BOTTOM) self._primary_toolbar = PrimaryToolbar(self._tabbed_view, self) self._edit_toolbar = EditToolbar(self) self._view_toolbar = ViewToolbar(self) self._primary_toolbar.connect('add-link', self._link_add_button_cb) self._primary_toolbar.connect('go-home', self._go_home_button_cb) self._primary_toolbar.connect('go-library', self._go_library_button_cb) self._primary_toolbar.connect('set-home', self._set_home_button_cb) self._primary_toolbar.connect('reset-home', self._reset_home_button_cb) self._edit_toolbar_button = ToolbarButton( page=self._edit_toolbar, icon_name='toolbar-edit') self._primary_toolbar.toolbar.insert( self._edit_toolbar_button, 1) view_toolbar_button = ToolbarButton( page=self._view_toolbar, icon_name='toolbar-view') self._primary_toolbar.toolbar.insert( view_toolbar_button, 2) self._primary_toolbar.show_all() self.set_toolbar_box(self._primary_toolbar) self.set_canvas(self._tabbed_view) self._tabbed_view.show() self.model = Model() self.model.connect('add_link', self._add_link_model_cb) self.connect('key-press-event', self._key_press_cb) if handle.uri: self._tabbed_view.current_browser.load_uri(handle.uri) elif not self._jobject.file_path: # TODO: we need this hack until we extend the activity API for # opening URIs and default docs. self._tabbed_view.load_homepage() self.messenger = None self.connect('shared', self._shared_cb) # Get the Presence Service self.pservice = presenceservice.get_instance() try: name, path = self.pservice.get_preferred_connection() self.tp_conn_name = name self.tp_conn_path = path self.conn = telepathy.client.Connection(name, path) except TypeError: _logger.debug('Offline') self.initiating = None if self.get_shared_activity() is not None: _logger.debug('shared: %s', self.get_shared()) # We are joining the activity _logger.debug('Joined activity') self.connect('joined', self._joined_cb) if self.get_shared(): # We've already joined self._joined_cb() else: _logger.debug('Created activity') # README: this is a workaround to remove old temp file # http://bugs.sugarlabs.org/ticket/3973 self._cleanup_temp_files()