diff options
author | Rafael Ortiz <rafael@activitycentral.com> | 2011-05-31 21:45:00 (GMT) |
---|---|---|
committer | Rafael Ortiz <rafael@activitycentral.com> | 2011-05-31 21:45:00 (GMT) |
commit | 12c914e83842e94714021fbfca569ae9848af682 (patch) | |
tree | c3c602f63f8acceaa42a4cf873f3282e4ded4145 /ircactivity.py | |
parent | 31bfb9367090583a477eaa3164db9ad7ae0d34ea (diff) |
new toolbars compatibility.
Diffstat (limited to 'ircactivity.py')
-rw-r--r-- | ircactivity.py | 62 |
1 files changed, 52 insertions, 10 deletions
diff --git a/ircactivity.py b/ircactivity.py index a11358c..e1d7d05 100644 --- a/ircactivity.py +++ b/ircactivity.py @@ -54,18 +54,60 @@ class IRCActivity(activity.Activity): self.set_canvas(widget) # TOOLBAR - toolbox = activity.ActivityToolbox(self) - - # Remove the Share button, since this activity isn't shareable - toolbar = toolbox.get_activity_toolbar() - toolbar.remove(toolbar.share) - - self.set_toolbox(toolbox) - self.show_all() + OLD_TOOLBAR = False + + try: + from sugar.graphics.toolbarbox import ToolbarBox, ToolbarButton + from sugar.activity.widgets import ActivityToolbarButton, StopButton, \ + ShareButton, KeepButton, TitleEntry, ActivityButton + + except ImportError: + OLD_TOOLBAR = True + + if OLD_TOOLBAR: + from sugar.activity.activity import Activity, ActivityToolbox + toolbox = activity.ActivityToolbox(self) + + # Remove the Share button, since this activity isn't shareable + toolbar = toolbox.get_activity_toolbar() + toolbar.remove(toolbar.share) + + self.set_toolbox(toolbox) + self.show_all() + else: + toolbar_box = ToolbarBox() + self.activity_button = ActivityButton(self) + toolbar_box.toolbar.insert(self.activity_button, 0) + self.activity_button.show() + + title_entry = TitleEntry(self) + toolbar_box.toolbar.insert(title_entry, -1) + title_entry.show() + + # share_button = ShareButton(self) not sharable activity. + # toolbar_box.toolbar.insert(share_button, -1) + # share_button.show() + + keep_button = KeepButton(self) + toolbar_box.toolbar.insert(keep_button, -1) + keep_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 __visibility_notify_event_cb(self, window, event): - self.is_visible = event.state != gtk.gdk.VISIBILITY_FULLY_OBSCURED - #Configuracion por defecto + self.is_visible = event.state != gtk.gdk.VISIBILITY_FULLY_OBSCURED + #Configuracion por defecto def default_config(self): self.client.join_server('us.freenode.net') |