def make_root(self): conversation = hippo.CanvasBox(spacing=0, background_color=COLOR_WHITE.get_int()) self.conversation = conversation entry = gtk.Entry() entry.modify_bg(gtk.STATE_INSENSITIVE, COLOR_WHITE.get_gdk_color()) entry.modify_base(gtk.STATE_INSENSITIVE, COLOR_WHITE.get_gdk_color()) entry.set_sensitive(False) entry.connect('activate', self.entry_activate_cb) self.entry = entry hbox = gtk.HBox() hbox.add(entry) sw = hippo.CanvasScrollbars() sw.set_policy(hippo.ORIENTATION_HORIZONTAL, hippo.SCROLLBAR_NEVER) sw.set_root(conversation) self.scrolled_window = sw vadj = self.scrolled_window.props.widget.get_vadjustment() vadj.connect('changed', self.rescroll) vadj.connect('value-changed', self.scroll_value_changed_cb) canvas = hippo.Canvas() canvas.set_root(sw) box = gtk.VBox(homogeneous=False) box.pack_start(hbox, expand=False) box.pack_start(canvas) return box
def __init__(self, cal, **kwargs): """ Constructor. """ CanvasTable.__init__(self, **kwargs) self.cal = cal self.range = kwargs.get('range') self.active_range = self.range self.selected = None # Create canvas items. self.scroll = hippo.CanvasScrollbars() self.hbox_top = hippo.CanvasBox( orientation=hippo.ORIENTATION_HORIZONTAL) self.vbox_top = hippo.CanvasBox() self.day_captions = CanvasTable() self.timeline = CanvasTimeline(self.cal) self.padding_left = hippo.CanvasBox() self.padding_right = hippo.CanvasBox() self.allday_view = CanvasHEventView(self.cal, yalign=hippo.ALIGNMENT_FILL) self.grid = CanvasGrid(self._new_cell) self.gridbox = hippo.CanvasBox( orientation=hippo.ORIENTATION_HORIZONTAL) self.vevent_views = {} self.hevent_views = {} self.allocs = {} self.allocs[self.padding_left] = (0, 0, 0, 0) self.allocs[self.padding_right] = (0, 0, 0, 0) self.vbox_top.append(self.day_captions) self.vbox_top.append(self.allday_view) self.day_captions.set_homogeneus_columns(True) self.hbox_top.append(self.padding_left) self.hbox_top.append(self.vbox_top, hippo.PACK_EXPAND) self.hbox_top.append(self.padding_right) self.gridbox.append(self.timeline) self.gridbox.append(self.grid, hippo.PACK_EXPAND) self.scroll.set_root(self.gridbox) self.add(self.hbox_top, 0, 1, 0, 1) self.add(self.scroll, 0, 1, 1, 2) self.set_row_expand(1, True) self.set_column_expand(0, True) self.allday_view.show_normal = False self.allday_view.connect('event-clicked', self.on_view_event_clicked) self.grid.connect('paint', self.on_grid_paint) self.grid.set_homogeneus_columns(True)
import hippo import gtk import gobject from sugar.graphics.icon import CanvasIcon from sugar.graphics.roundbox import CanvasRoundBox import common test = common.Test() canvas = hippo.Canvas() test.pack_start(canvas) canvas.show() scrollbars = hippo.CanvasScrollbars() canvas.set_root(scrollbars) box = hippo.CanvasBox(padding=10, spacing=10) scrollbars.set_root(box) def idle_cb(): global countdown for i in range(0, 100): entry = hippo.CanvasBox(border=2, border_color=0x000000ff, orientation=hippo.ORIENTATION_HORIZONTAL, padding=10, spacing=10)
def __init__(self): hippo.Canvas.__init__(self) self.messenger = None self.me = None self.quiet = False self._buddies = {} # buddies box self._buddies_list = hippo.CanvasBox( background_color = BUDDIES_COLOR.get_int(), box_width = BUDDIES_WIDTH, padding = ENTRY_YPAD, spacing = ENTRY_YPAD ) self._buddies_box = hippo.CanvasScrollbars() self._buddies_box.set_policy(hippo.ORIENTATION_HORIZONTAL, hippo.SCROLLBAR_NEVER) self._buddies_box.set_root(self._buddies_list) # chat entry self._chat = ChatBox() self.me, my_face_widget = self._new_face(self._chat.owner, ENTRY_COLOR) chat_post = gtk.TextView() chat_post.modify_bg(gtk.STATE_INSENSITIVE, style.COLOR_WHITE.get_gdk_color()) chat_post.modify_base(gtk.STATE_INSENSITIVE, style.COLOR_WHITE.get_gdk_color()) chat_post.connect('key-press-event', self._key_press_cb) chat_post.props.wrap_mode = gtk.WRAP_WORD_CHAR chat_post.set_size_request(-1, BUDDY_SIZE - ENTRY_YPAD * 2) chat_post_box = CanvasRoundBox( background_color = style.COLOR_WHITE.get_int(), padding_left = ENTRY_XPAD, padding_right = ENTRY_XPAD, padding_top = ENTRY_YPAD, padding_bottom = ENTRY_YPAD ) chat_post_box.props.border_color = ENTRY_COLOR.get_int() chat_post_box.append(hippo.CanvasWidget(widget=chat_post), hippo.PACK_EXPAND) chat_entry = CanvasRoundBox( background_color = ENTRY_COLOR.get_int(), padding_left = ENTRY_XPAD, padding_right = ENTRY_XPAD, padding_top = ENTRY_YPAD, padding_bottom = ENTRY_YPAD, spacing = ENTRY_YPAD ) chat_entry.props.orientation = hippo.ORIENTATION_HORIZONTAL chat_entry.props.border_color = style.COLOR_WHITE.get_int() chat_entry.append(my_face_widget) chat_entry.append(chat_post_box, hippo.PACK_EXPAND) chat_box = hippo.CanvasBox( orientation = hippo.ORIENTATION_VERTICAL, background_color = style.COLOR_WHITE.get_int(), ) chat_box.append(self._chat, hippo.PACK_EXPAND) chat_box.append(chat_entry) # desk self._desk = hippo.CanvasBox() self._desk.props.orientation = hippo.ORIENTATION_HORIZONTAL self._desk.append(chat_box, hippo.PACK_EXPAND) self.set_root(self._desk)