Exemplo n.º 1
0
    def build_toolbar(self):
        toolbar_box = ToolbarBox()
        self.set_toolbar_box(toolbar_box)
        toolbar_box.show()

        activity_button = ActivityButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        self.blocklist = []
        self.radioList = {}
        for c in tools.allTools:
            button = ToolButton(c.icon)
            button.set_tooltip(_(c.toolTip))
            button.connect('clicked', self.radioClicked)
            toolbar_box.toolbar.insert(button, -1)
            button.show()
            self.radioList[button] = c.name

        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.show_all()
Exemplo n.º 2
0
    def __init__(self,handle):

        activity.Activity.__init__(self,handle,False)

        self.set_title("Ceibal_Radio")

        barraprincipal = ToolbarBox(self)

        activity_button = ActivityButton(self)
        barraprincipal.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(self)
        barraprincipal.toolbar.insert(title_entry, -1)
        title_entry.show()
        
        separator = Gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        barraprincipal.toolbar.insert(separator, -1)
        separator.show()

        stop_button = StopButton(self)
        barraprincipal.toolbar.insert(stop_button, -1)
        stop_button.show()

        self.set_toolbar_box(barraprincipal)
        if not failure:
            vistareproductor = VistaReproductor()
            self.set_canvas(vistareproductor)
        else:
            error = Gtk.Label("Sorry, this activity doesn't work on this computer.")
            self.set_canvas(error)

        self.show_all()
Exemplo n.º 3
0
    def __init__(self, handle):
        activity.Activity.__init__(self, handle)

        self.max_participants = 1

        toolbar_box = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(self)
        toolbar_box.toolbar.insert(title_entry, -1)
        title_entry.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()

        self.signal = self.connect("draw", self.execute)
Exemplo n.º 4
0
    def __init__(self, handle):
        activity.Activity.__init__(self, handle)
        self.set_title("SocialCalc")
        self._logger = logging.getLogger("OnePageWiki-Activity")

        # The XOCom object helps us communicate with the browser
        # This uses web/index.html as the default page to load
        self.xocom = XOCom(
            self.control_sending_text
        )  # REMEMBER THAT I HAVE STILL TO SEND THE ARGUMENT IN THE XOCOM CLASS

        toolbox = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbox.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(self)
        toolbox.toolbar.insert(title_entry, -1)
        title_entry.show()

        separator = Gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        toolbox.toolbar.insert(separator, -1)
        separator.show()

        stop_button = ShareButton(self)
        toolbox.toolbar.insert(stop_button, -1)
        stop_button.show()
        self.set_toolbar_box(toolbox)
        toolbox.show()

        stop_button = StopButton(self)
        toolbox.toolbar.insert(stop_button, -1)
        stop_button.show()

        self.set_toolbar_box(toolbox)
        toolbox.show()
        ##self.xocom.send_to_browser_localize(['initlocalize'])

        self.set_canvas(self.xocom.create_webview())

        self.hellotube = None  # Shared session    #REQUIRED
        self.initiating = False

        self.pservice = presenceservice.get_instance()

        owner = self.pservice.get_owner()
        self.owner = owner

        self.connect("shared", self._shared_cb)
        self.connect("joined", self._joined_cb)

        self.filename = ""  # ADDED SPECIFICALLY TO CALL WRITE AND READ METHODS
        self.content = ""

        # calling to initialize strings in localization
        # should wait for init complete from browser
        GObject.timeout_add(4000, self.xocom.send_to_browser_localize, ["initlocalize"])
Exemplo n.º 5
0
    def __init__(self, handle):
        activity.Activity.__init__(self, handle)

        self.max_participants = 1

        toolbar_box = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(self)
        toolbar_box.toolbar.insert(title_entry, -1)
        title_entry.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()

        self.signal = self.connect("draw", self.execute)
Exemplo n.º 6
0
    def __make_toolbar(self):
        # toolbar with the new toolbar redesign
        toolbar_box = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(self)
        toolbar_box.toolbar.insert(title_entry, -1)
        title_entry.show()

        share_button = ShareButton(self)
        toolbar_box.toolbar.insert(share_button, -1)
        share_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()
Exemplo n.º 7
0
    def build_toolbar(self):
        toolbar_box = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(self)
        toolbar_box.toolbar.insert(title_entry, -1)
        title_entry.show()

        description_item = DescriptionItem(self)
        toolbar_box.toolbar.insert(description_item, -1)
        description_item.show()

        share_button = ShareButton(self)
        toolbar_box.toolbar.insert(share_button, -1)
        share_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()
Exemplo n.º 8
0
    def __init__(self, activity,**kwargs):
        super(BasicToolbar, self).__init__(**kwargs)
        
        
        activity_button = ActivityButton(activity)
        self.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(activity)
        self.toolbar.insert(title_entry, -1)
        title_entry.show()

        description_item = DescriptionItem(activity)
        self.toolbar.insert(description_item, -1)
        description_item.show()

        share_button = ShareButton(activity)
        self.toolbar.insert(share_button, -1)
        share_button.show()

        separator = Gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        self.toolbar.insert(separator, -1)
        separator.show()

        stop_button = StopButton(activity)
        self.toolbar.insert(stop_button, -1)
        stop_button.show()
Exemplo n.º 9
0
    def make_toolbar(self):
        # toolbar with the new toolbar redesign
        toolbar_box = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(self)
        toolbar_box.toolbar.insert(title_entry, -1)
        title_entry.show()

        description_item = DescriptionItem(self)
        toolbar_box.toolbar.insert(description_item, -1)
        description_item.show()

        share_button = ShareButton(self)
        toolbar_box.toolbar.insert(share_button, -1)
        share_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()
Exemplo n.º 10
0
    def __init__(self, handle):
        super(VteActivity, self).__init__(handle)
        toolbox = ToolbarBox()
        self.set_toolbar_box(toolbox)
        toolbox.show()

        self.max_participants = 1

        toolbar_box = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(self)
        toolbar_box.toolbar.insert(title_entry, -1)
        title_entry.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()

        # 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.connect('selection-changed', self._on_selection_changed_cb)
        self._vte.drag_dest_set(Gtk.DestDefaults.ALL, [], Gdk.DragAction.COPY)
        self._vte.connect('drag_data_received', self._on_drop_cb)
        # ...and its scrollbar
        vtebox = Gtk.HBox()
        vtebox.pack_start(self._vte, True, True, 0)
        vtesb = Gtk.VScrollbar()
        vtesb.show()
        vtebox.pack_start(vtesb, False, False, 0)
        self.set_canvas(vtebox)
        self.show_all()
        # 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
        self._pid = self._vte.spawn_sync(
            Vte.PtyFlags.DEFAULT, bundle_path,
            ['/bin/sh', '-c',
             'python %s/show.py; sleep 1' % bundle_path],
            ["PYTHONPATH=%s/library" % bundle_path],
            GLib.SpawnFlags.DO_NOT_REAP_CHILD, None, None)
Exemplo n.º 11
0
    def __init__(self, activity, **kwargs):
        super(BasicToolbar, self).__init__(**kwargs)

        activity_button = ActivityButton(activity)
        self.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(activity)
        self.toolbar.insert(title_entry, -1)
        title_entry.show()

        description_item = DescriptionItem(activity)
        self.toolbar.insert(description_item, -1)
        description_item.show()

        share_button = ShareButton(activity)
        self.toolbar.insert(share_button, -1)
        share_button.show()

        separator = Gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        self.toolbar.insert(separator, -1)
        separator.show()

        stop_button = StopButton(activity)
        self.toolbar.insert(stop_button, -1)
        stop_button.show()
Exemplo n.º 12
0
    def __init__(self, handle):
        activity.Activity.__init__(self, handle)
        self.set_title('SocialCalc')
        self._logger = logging.getLogger('OnePageWiki-Activity')

        # The XOCom object helps us communicate with the browser
        # This uses web/index.html as the default page to load
        self.xocom = XOCom(self.control_sending_text)                   #REMEMBER THAT I HAVE STILL TO SEND THE ARGUMENT IN THE XOCOM CLASS

        toolbox = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbox.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(self)
        toolbox.toolbar.insert(title_entry, -1)
        title_entry.show()
        
        separator = Gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        toolbox.toolbar.insert(separator, -1)
        separator.show()

        stop_button = ShareButton(self)
        toolbox.toolbar.insert(stop_button, -1)
        stop_button.show()
        self.set_toolbar_box(toolbox)
        toolbox.show()

        stop_button = StopButton(self)
        toolbox.toolbar.insert(stop_button, -1)
        stop_button.show()

        self.set_toolbar_box(toolbox)
        toolbox.show()
        ##self.xocom.send_to_browser_localize(['initlocalize'])

        self.set_canvas( self.xocom.create_webview() )

        self.hellotube = None  # Shared session    #REQUIRED
        self.initiating = False
        
        self.pservice = presenceservice.get_instance()
        
        owner = self.pservice.get_owner()
        self.owner = owner   
        
        self.connect('shared', self._shared_cb)
        self.connect('joined', self._joined_cb)
        
        self.filename=''       #ADDED SPECIFICALLY TO CALL WRITE AND READ METHODS
        self.content=''

        #calling to initialize strings in localization
        #should wait for init complete from browser
        GObject.timeout_add(4000, self.xocom.send_to_browser_localize,['initlocalize'])
Exemplo n.º 13
0
    def __init__(self, handle):
        """Set up the Astroangles activity."""
        activity.Activity.__init__(self, handle)

        # we do not have collaboration features
        # make the share option insensitive
        self.max_participants = 1

        # toolbar with the new toolbar redesign
        toolbar_box = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(self)
        toolbar_box.toolbar.insert(title_entry, -1)
        title_entry.show()

        description_item = DescriptionItem(self)
        toolbar_box.toolbar.insert(description_item, -1)
        description_item.show()

        share_button = ShareButton(self)
        toolbar_box.toolbar.insert(share_button, -1)
        share_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()

        self.game = AstroanglesGame(self)
        self.game.canvas = sugargame.canvas.PygameCanvas(
            self, main=self.game.run, modules=[pygame.display, pygame.font])

        w = Gdk.Screen.width()
        h = Gdk.Screen.height() - 2 * GRID_CELL_SIZE

        self.game.canvas.set_size_request(w, h)

        self._notebook = Gtk.Notebook(show_tabs=False)
        self._notebook.add(self.game.canvas)

        self.set_canvas(self.game.canvas)
        Gdk.Screen.get_default().connect('size-changed', self.__configure_cb)
        self.canvas = self._notebook

        self.show_all()
Exemplo n.º 14
0
    def __init__(self, handle):
        activity.Activity.__init__(self, handle)

        self.max_participants = 1

        toolbar_box = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(self)
        toolbar_box.toolbar.insert(title_entry, -1)
        title_entry.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()

        vt = Vte.Terminal()
        vt.connect("child-exited", self.exit)
        vt.spawn_sync(Vte.PtyFlags.DEFAULT, os.environ["HOME"], ["/bin/bash"],
                      [], GLib.SpawnFlags.DO_NOT_REAP_CHILD, None, None)
        if not os.path.exists(os.environ["SUGAR_ACTIVITIES_PATH"] +
                              "/Java.activity"):
            label = Gtk.Label("Please install Java activity")
            self.set_canvas(label)
            label.show()
            return
        self.set_canvas(vt)
        vt.show()

        vt.feed_child("cd $SUGAR_BUNDLE_PATH\n", -1)
        if platform.machine().startswith('arm'):
            vt.feed_child(
                "export JAVA_HOME=$SUGAR_ACTIVITIES_PATH/Java.activity/jre_arm\n",
                -1)
        else:
            if platform.architecture()[0] == '64bit':
                vt.feed_child(
                    "export JAVA_HOME=$SUGAR_ACTIVITIES_PATH/Java.activity/jre_64\n",
                    -1)
            else:
                vt.feed_child(
                    "export JAVA_HOME=$SUGAR_ACTIVITIES_PATH/Java.activity/jre_32\n",
                    -1)
        vt.feed_child("export PATH=$JAVA_HOME/bin:$PATH\n", -1)
        vt.feed_child("java -jar jclic.jar; exit\n", -1)
    def __init__(self, handle):

        activity.Activity.__init__(self, handle)
        # we do not have collaboration features
        # make the share option insensitive
        self.max_participants = 1

        # toolbar with the new toolbar redesign
        toolbar_box = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(self)
        toolbar_box.toolbar.insert(title_entry, -1)
        title_entry.show()

        description_item = DescriptionItem(self)
        toolbar_box.toolbar.insert(description_item, -1)
        description_item.show()

        share_button = ShareButton(self)
        toolbar_box.toolbar.insert(share_button, -1)
        share_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()

        # Main layout setup
        layout = Gtk.Grid()
        layout.set_halign(Gtk.Align.CENTER)
        layout.set_valign(Gtk.Align.CENTER)
        self.msg = Gtk.Label("This is a secret message!")
        self.sbutton = Gtk.Button("Show message")
        self.sbutton.connect("clicked", self._show)
        self.sbutton.set_sensitive(False)
        self.hbutton = Gtk.Button("Hide Message")
        self.hbutton.connect("clicked", self._hide)
        layout.attach(self.msg, 0, 0, 2, 1)
        layout.attach_next_to(self.sbutton, self.msg, Gtk.PositionType.BOTTOM,
                              1, 1)
        layout.attach_next_to(self.hbutton, self.sbutton,
                              Gtk.PositionType.RIGHT, 1, 1)
        self.set_canvas(layout)
        self.show_all()
Exemplo n.º 16
0
    def __init__(self, handle):
        """Set up the ToDo activity."""
        activity.Activity.__init__(self, handle)

        # we do not have collaboration features
        # make the share option insensitive
        self.max_participants = 1

        # toolbar with the new toolbar redesign
        toolbar_box = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(self)
        toolbar_box.toolbar.insert(title_entry, -1)
        title_entry.show()

        description_item = DescriptionItem(self)
        toolbar_box.toolbar.insert(description_item, -1)
        description_item.show()

        share_button = ShareButton(self)
        toolbar_box.toolbar.insert(share_button, -1)
        share_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()

        self.scrollabeWindow = Gtk.ScrolledWindow()

        self.vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.scrollabeWindow.add(self.vbox)
        self.todo = {}
        self.count = 0

        self.create()

        self.set_canvas(self.scrollabeWindow)
        self.scrollabeWindow.show_all()
Exemplo n.º 17
0
    def __init__(self, handle):
        activity.Activity.__init__(self, handle)

        self.max_participants = 1

        toolbar_box = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(self)
        toolbar_box.toolbar.insert(title_entry, -1)
        title_entry.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()
        
        vt = Vte.Terminal()
        vt.connect("child-exited", self.exit)
        vt.spawn_sync(Vte.PtyFlags.DEFAULT, os.environ["HOME"],
            ["/bin/bash"], [], GLib.SpawnFlags.DO_NOT_REAP_CHILD,
            None, None)
        if not os.path.exists(os.environ["SUGAR_ACTIVITIES_PATH"]+"/Java.activity"):
            label = Gtk.Label("Please install Java activity")
            self.set_canvas(label)
            label.show()
            return
        self.set_canvas(vt)
        vt.show()

        vt.feed_child("cd $SUGAR_BUNDLE_PATH\n", -1)
        if platform.machine().startswith('arm'):
                vt.feed_child("export JAVA_HOME=$SUGAR_ACTIVITIES_PATH/Java.activity/jre_arm\n", -1)
        else:
            if platform.architecture()[0] == '64bit':
                vt.feed_child("export JAVA_HOME=$SUGAR_ACTIVITIES_PATH/Java.activity/jre_64\n", -1)
            else:
                vt.feed_child("export JAVA_HOME=$SUGAR_ACTIVITIES_PATH/Java.activity/jre_32\n", -1)
        vt.feed_child("export PATH=$JAVA_HOME/bin:$PATH\n", -1)
        vt.feed_child("java -jar jclic.jar; exit\n", -1)
Exemplo n.º 18
0
    def __init__(self, handle):
        activity.Activity.__init__(self, handle)

        logging.debug('Starting the IRC Activity')
        self.set_title(_('IRC Activity'))

        self.add_events(Gdk.EventMask.VISIBILITY_NOTIFY_MASK)
        self.connect('visibility-notify-event',
                     self.__visibility_notify_event_cb)

        self.is_visible = False

        self.client = purk.Client(self)
        if handle.object_id is None:
            self.default_config()
        self.client.show()
        widget = self.client.get_widget()

        # CANVAS
        self.set_canvas(widget)

        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()

        connectionbtn = ToggleToolButton('connect')
        connectionbtn.set_active(True)
        connectionbtn.set_tooltip(_('Disconnect'))
        connectionbtn.connect('toggled', self._connection_cb)
        toolbar_box.toolbar.insert(connectionbtn, -1)
        connectionbtn.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()
Exemplo n.º 19
0
    def __init__(self, handle):
        activity.Activity.__init__(self, handle)

        self.max_participants = 1

        toolbar_box = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(self)
        toolbar_box.toolbar.insert(title_entry, -1)
        title_entry.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()
        
        vt = Vte.Terminal()
        vt.connect("child-exited", self.exit)
        vt.spawn_sync(Vte.PtyFlags.DEFAULT, os.environ["HOME"],
            ["/bin/bash"], [], GLib.SpawnFlags.DO_NOT_REAP_CHILD,
            None, None)

        label = Gtk.Label("Sorry, this activity can't run on this computer")

        if platform.machine().startswith('arm'):
            self.set_canvas(label)
            label.show()
        else:
            self.set_canvas(vt)
            vt.show()
            if platform.architecture()[0] == '64bit':
                vt.feed_child("export LD_LIBRARY_PATH=$SUGAR_BUNDLE_PATH/64bits:$LD_LIBRARY_PATH\n", -1)
                vt.feed_child("export LD_LIBRARY_PATH=$SUGAR_BUNDLE_PATH/64bits/shoes:$LD_LIBRARY_PATH\n", -1)
                vt.feed_child("cd $SUGAR_BUNDLE_PATH/64bits; shoes/shoes-bin h-ety-h.rb; exit\n", -1)
            else:
                vt.feed_child("export LD_LIBRARY_PATH=$SUGAR_BUNDLE_PATH/32bits:$LD_LIBRARY_PATH\n", -1)
                vt.feed_child("cd $SUGAR_BUNDLE_PATH/32bits; ./hacketyhack-bin; exit\n", -1)
Exemplo n.º 20
0
    def __init__(self, handle):
        activity.Activity.__init__(self, handle)

        # we do not have collaboration features
        # make the share option insensitive
        self.max_participants = 1

        # toolbar with the new toolbar redesign
        toolbar_box = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(self)
        toolbar_box.toolbar.insert(title_entry, -1)
        title_entry.show()

        share_button = ShareButton(self)
        toolbar_box.toolbar.insert(share_button, -1)
        share_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()
        self.scroll = Gtk.ScrolledWindow()
        self.scroll.set_policy(Gtk.PolicyType.AUTOMATIC,
                               Gtk.PolicyType.AUTOMATIC)
        # Uso un widget principal para los problemas de resolucion x2..
        self.widget_principal = Gtk.EventBox()
        self.crear_menu()
        self.scroll.add(self.widget_principal)
        self.maximize()
        # self.modify_bg(Gtk.StateType.NORMAL, Gdk.color_parse("light blue"))
        self.widget_principal.modify_bg(Gtk.StateType.NORMAL,
                                        Gdk.color_parse("white"))

        self.set_canvas(self.scroll)
        self.scroll.show_all()
Exemplo n.º 21
0
    def build_toolbar(self):
        toolbox = ToolbarBox()
        toolbar = toolbox.toolbar

        activity_button = ActivityButton(self)
        toolbar.insert(activity_button, -1)
        toolbar.insert(Gtk.SeparatorToolItem(), -1)

        self.stop_play = ToogleButton('media-playback-start')
        self.stop_play.set_tooltip(_("Turn on/off the camera"))
        self.stop_play.props.active = True

        self.copylink = ToolButton('text-uri-list')
        self.copylink.set_tooltip(_("Copy link to clipboard"))
        self.copylink.set_sensitive(False)

        toolbar.insert(self.stop_play, -1)
        toolbar.insert(self.copylink, -1)

        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.set_toolbar_box(toolbox)
Exemplo n.º 22
0
    def __init__(self, handle):
        activity.Activity.__init__(self, handle)

        self.max_participants = 1

        toolbar_box = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(self)
        toolbar_box.toolbar.insert(title_entry, -1)
        title_entry.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()

        vt = Vte.Terminal()
        vt.connect("child-exited", self.exit)
        vt.spawn_sync(Vte.PtyFlags.DEFAULT, os.environ["HOME"], ["/bin/bash"],
                      [], GLib.SpawnFlags.DO_NOT_REAP_CHILD, None, None)
        self.set_canvas(vt)
        vt.show()

        if platform.machine().startswith('arm'):
            vt.feed_child(
                "echo \"Sorry, this activity won't run on this computer\"; sleep 10; exit\n",
                -1)
        else:
            if platform.architecture()[0] == '64bit':
                vt.feed_child(
                    "echo \"Sorry, this activity won't run on this computer\"; sleep 10; exit\n",
                    -1)
            else:
                vt.feed_child(
                    "cd $SUGAR_BUNDLE_PATH/Files; ./doukutsu.bin; exit\n", -1)
Exemplo n.º 23
0
    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)
Exemplo n.º 24
0
    def __init__(self, handle):
        activity.Activity.__init__(self, handle)

        self.max_participants = 1

        toolbar_box = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(self)
        toolbar_box.toolbar.insert(title_entry, -1)
        title_entry.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()

        vt = Vte.Terminal()
        vt.connect("child-exited", self.exit)
        vt.spawn_sync(Vte.PtyFlags.DEFAULT, os.environ["HOME"], ["/bin/bash"],
                      [], GLib.SpawnFlags.DO_NOT_REAP_CHILD, None, None)
        self.set_canvas(vt)
        vt.show()

        if platform.machine().startswith('arm'):
            vt.feed_child("cd $SUGAR_BUNDLE_PATH/arm\n", -1)
        else:
            if platform.architecture()[0] == '64bit':
                vt.feed_child("cd $SUGAR_BUNDLE_PATH/64bits\n", -1)
            else:
                vt.feed_child("cd $SUGAR_BUNDLE_PATH/32bits\n", -1)
        vt.feed_child("export LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH\n",
                      -1)
        vt.feed_child("bin/xaos -fullscreen; exit\n", -1)
Exemplo n.º 25
0
    def __init__(self, handle):
        activity.Activity.__init__(self, handle)

        self.max_participants = 1

        toolbar_box = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(self)
        toolbar_box.toolbar.insert(title_entry, -1)
        title_entry.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()
        
        vt = Vte.Terminal()
        vt.connect("child-exited", self.exit)
        vt.spawn_sync(Vte.PtyFlags.DEFAULT, os.environ["HOME"],
            ["/bin/bash"], [], GLib.SpawnFlags.DO_NOT_REAP_CHILD,
            None, None)
        self.set_canvas(vt)
        vt.show()

        if platform.machine().startswith('arm'):
                vt.feed_child("cd $SUGAR_BUNDLE_PATH/arm\n", -1)
        else:
            if platform.architecture()[0] == '64bit':
                vt.feed_child("cd $SUGAR_BUNDLE_PATH/64bits\n", -1)
            else:
                vt.feed_child("cd $SUGAR_BUNDLE_PATH/32bits\n", -1)
        vt.feed_child("export LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH\n", -1)
        vt.feed_child("bin/xaos -fullscreen; exit\n", -1)
Exemplo n.º 26
0
    def __init__(self, handle):
        activity.Activity.__init__(self, handle)

        self.max_participants = 1

        toolbar_box = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(self)
        toolbar_box.toolbar.insert(title_entry, -1)
        title_entry.show()

        description_item = DescriptionItem(self)
        toolbar_box.toolbar.insert(description_item, -1)
        description_item.show()

        if self.max_participants > 1:
            share_button = ShareButton(self)
            toolbar_box.toolbar.insert(share_button, -1)
            share_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()

        canvas = Gtk.DrawingArea()
        self.block_party = BlockParty(
            self, canvas,
            font_face=style.FONT_FACE, font_size=style.FONT_SIZE * 2,
            gcs=style.GRID_CELL_SIZE)
        self.set_canvas(canvas)
        canvas.show()
Exemplo n.º 27
0
    def __init__(self, handle):
        """Set up the HelloWorld activity."""
        activity.Activity.__init__(self, handle)

        # we do not have collaboration features
        # make the share option insensitive
        self.max_participants = 1

        # toolbar with the new toolbar redesign
        toolbar_box = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(self)
        toolbar_box.toolbar.insert(title_entry, -1)
        title_entry.show()

        description_item = DescriptionItem(self)
        toolbar_box.toolbar.insert(description_item, -1)
        description_item.show()

        share_button = ShareButton(self)
        toolbar_box.toolbar.insert(share_button, -1)
        share_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()

        # label with the text, make the string translatable
        label = Gtk.Label(_("Hello World!"))
        self.set_canvas(label)
        label.show()
Exemplo n.º 28
0
    def __init__(self, handle):
        activity.Activity.__init__(self, handle)

        self.max_participants = 1

        toolbar_box = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(self)
        toolbar_box.toolbar.insert(title_entry, -1)
        title_entry.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()
        
        vt = Vte.Terminal()
        vt.connect("child-exited", self.exit)
        vt.spawn_sync(Vte.PtyFlags.DEFAULT, os.environ["HOME"],
            ["/bin/bash"], [], GLib.SpawnFlags.DO_NOT_REAP_CHILD,
            None, None)
        self.set_canvas(vt)
        vt.show()

        if platform.machine().startswith('arm'):
            vt.feed_child("echo \"Sorry, this activity won't run on this computer\"; sleep 10; exit\n", -1)
        else:
            if platform.architecture()[0] == '64bit':
                vt.feed_child("echo \"Sorry, this activity won't run on this computer\"; sleep 10; exit\n", -1)
            else:
                vt.feed_child("cd $SUGAR_BUNDLE_PATH/Files; ./doukutsu.bin; exit\n", -1)
Exemplo n.º 29
0
    def build_toolbar(self):

        toolbox = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbox.toolbar.insert(activity_button, -1)
        activity_button.show()

        separator = Gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        toolbox.toolbar.insert(separator, -1)

        stop_button = StopButton(self)
        stop_button.props.accelerator = _('<Ctrl>Q')
        toolbox.toolbar.insert(stop_button, -1)
        stop_button.show()

        self.set_toolbar_box(toolbox)
Exemplo n.º 30
0
    def __init__(self, handle):
        """Set up the HelloWorld activity."""
        activity.Activity.__init__(self, handle)

        # Change the following number to change max participants
        self.max_participants = 1

        toolbar_box = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(self)
        toolbar_box.toolbar.insert(title_entry, -1)
        title_entry.show()

        description_item = DescriptionItem(self)
        toolbar_box.toolbar.insert(description_item, -1)
        description_item.show()

        share_button = ShareButton(self)
        toolbar_box.toolbar.insert(share_button, -1)
        share_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()

        # Change the following text to change the message (Default: 'Hello World!'
        label = Gtk.Label(_("Hello World!"))
        self.set_canvas(label)
        label.show()
Exemplo n.º 31
0
    def __init__(self, handle):
        """Set up the HelloWorld activity."""
        activity.Activity.__init__(self, handle)

        # Change the following number to change max participants
        self.max_participants = 1

        toolbar_box = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(self)
        toolbar_box.toolbar.insert(title_entry, -1)
        title_entry.show()

        description_item = DescriptionItem(self)
        toolbar_box.toolbar.insert(description_item, -1)
        description_item.show()

        share_button = ShareButton(self)
        toolbar_box.toolbar.insert(share_button, -1)
        share_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()

        # Change the following text to change the message (Default: 'Hello World!'
        label = Gtk.Label(_("Hello World!"))
        self.set_canvas(label)
        label.show()
Exemplo n.º 32
0
    def __init__(self, handle):
        """Set up the activity."""
        activity.Activity.__init__(self, handle)

        # we do not have collaboration features
        # make the share option insensitive
        self.max_participants = 1

        # toolbar with the new toolbar redesign
        toolbar_box = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(self)
        toolbar_box.toolbar.insert(title_entry, -1)
        title_entry.show()

        description_item = DescriptionItem(self)
        toolbar_box.toolbar.insert(description_item, -1)
        description_item.show()

        share_button = ShareButton(self)
        toolbar_box.toolbar.insert(share_button, -1)
        share_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()

        self.display_menu()
Exemplo n.º 33
0
    def build_toolbar(self):

        self.max_participants = 1

        toolbar_box = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbar_box.toolbar.insert(activity_button, -1)
        activity_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()
Exemplo n.º 34
0
    def build_toolbar(self):

        self.max_participants = 1

        toolbar_box = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbar_box.toolbar.insert(activity_button, -1)
        activity_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()
Exemplo n.º 35
0
    def __init__(self, handle):
        activity.Activity.__init__(self, handle)
        self.max_participants = 1

        toolbar_box = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(self)
        toolbar_box.toolbar.insert(title_entry, -1)
        title_entry.show()

        description_item = DescriptionItem(self)
        toolbar_box.toolbar.insert(description_item, -1)
        description_item.show()

        share_button = ShareButton(self)
        toolbar_box.toolbar.insert(share_button, -1)
        share_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()

        # main view
        touch_area = TouchArea()
        self.set_canvas(touch_area)
        touch_area.show()
Exemplo n.º 36
0
    def __init__(self, sugar_handle):
        Activity.__init__(self, sugar_handle)

        # Create a Toolbar
        toolbar = Gtk.Toolbar()

        # Add toolbar to Sugar Activity Toolbar Space
        self.set_toolbar_box(toolbar)

        # Add Activity Button
        toolbar.insert(ActivityButton(self), -1)

        # Create & Add Separator
        separator = Gtk.SeparatorToolItem(draw=False)
        separator.set_expand(True)
        toolbar.insert(separator, -1)

        # Add Stop Button
        toolbar.insert(StopButton(self), -1)

        # Create Container
        grid = Gtk.Grid()

        # Add grid to Sugar Activity GtkWindow
        self.set_canvas(grid)

        # Create & Add Label
        label = Gtk.Label(label=_("Name: "))
        grid.attach(label, 0, 0, 1, 1)

        # Add Output Label
        output = Gtk.Label()
        grid.attach(output, 1, 1, 1, 1)

        # Create & Add Text Entry
        entry = Gtk.Entry()
        grid.attach(entry, 0, 1, 1, 1)

        # Empty output on keypress in entry
        entry.connect('key-release-event', self.emptyout, output)

        # Add a button
        button = Gtk.Button(label=_("Greet!"))
        grid.attach(button, 0, 2, 1, 1)

        # Tell the button to run a class method
        button.connect('clicked', self.greeter, entry, output)

        # Show all components (otherwise none will be displayed)
        self.show_all()
Exemplo n.º 37
0
    def build_toolbar(self, activity):
        # Prepare Primary Toolbar Container
        toolbar_box = ToolbarBox()

        # Create activity button
        toolbar_box.toolbar.insert(ActivityButton(activity), -1)

        # Video Toggle
        video_toggle_button = ToolButton()
        video_toggle_button.connect("clicked", self.toggle_video)
        toolbar_box.toolbar.insert(video_toggle_button, 1)
        self.toggle_video(video_toggle_button)

        # Audio Toggle
        audio_toggle_button = ToolButton()
        audio_toggle_button.connect("clicked", self.toggle_audio)
        toolbar_box.toolbar.insert(audio_toggle_button, 2)
        self.toggle_audio(audio_toggle_button)

        # Toggle Preview Display Button
        preview_toggle_button = ToolButton()
        preview_toggle_button.connect("clicked",
                                      self.toolbar_toggle_preview_visibility)
        toolbar_box.toolbar.insert(preview_toggle_button, 3)
        self.toolbar_toggle_preview_visibility(preview_toggle_button)

        # Forced Refresh
        reload_video = ToolButton("view-refresh")
        reload_video.set_tooltip_text(_("Reload Video"))
        reload_video.connect("clicked", self.force_redraw)
        toolbar_box.toolbar.insert(reload_video, -1)

        # Push stop button to far right
        separator = Gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        toolbar_box.toolbar.insert(separator, -1)

        # Create Share Button
        toolbar_box.toolbar.insert(ShareButton(activity), -1)

        # Create stop button
        toolbar_box.toolbar.insert(StopButton(activity), -1)

        # Add reference to toolbar items
        self.toolbar = toolbar_box.toolbar

        # Display all components & Return
        toolbar_box.show_all()
        return toolbar_box
Exemplo n.º 38
0
    def __init__(self, handle):
        activity.Activity.__init__(self, handle)

        logging.debug('Starting the IRC Activity')
        self.set_title(_('IRC Activity'))

        self.add_events(Gdk.EventMask.VISIBILITY_NOTIFY_MASK)
        self.connect('visibility-notify-event',
                     self.__visibility_notify_event_cb)

        self.is_visible = False

        self.client = purk.Client(self)
        if handle.object_id is None:
            self.default_config()
        self.client.show()
        widget = self.client.get_widget()

        # CANVAS
        self.set_canvas(widget)

        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()

        connectionbtn = ToggleToolButton('connect')
        connectionbtn.set_active(True)
        connectionbtn.set_tooltip(_('Disconnect'))
        connectionbtn.connect('toggled', self._connection_cb)
        toolbar_box.toolbar.insert(connectionbtn, -1)
        connectionbtn.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()
Exemplo n.º 39
0
    def setup_toolbar(self):
        toolbar_box = ToolbarBox()
        activity_button = ActivityButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        # Test Button
        video_toggle_button = ToolButton()
        video_toggle_button.connect("clicked", self.test_toggle)
        video_toggle_button.set_icon_name('activity-start')
        video_toggle_button.set_tooltip_text('Toggle Video Size')
        toolbar_box.toolbar.insert(video_toggle_button, 1)
        video_toggle_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()
Exemplo n.º 40
0
    def __init__(self, handle):
        "The entry point to the Activity"
        activity.Activity.__init__(self, handle)
        self._timeout = None

        self.accelerometer = False
        try:
            open(ACCELEROMETER_DEVICE).close()
            self.accelerometer = True
        except:
            pass

        if not self.accelerometer and not self.shared_activity:
            return self._incompatible()

        self.buddies = {}

        canvas = MyCanvas(self)
        self.set_canvas(canvas)
        canvas.show()

        toolbar_box = ToolbarBox()
        self.set_toolbar_box(toolbar_box)

        toolbar_box.toolbar.insert(ActivityButton(self), 0)
        toolbar_box.toolbar.insert(TitleEntry(self), -1)
        toolbar_box.toolbar.insert(DescriptionItem(self), -1)
        toolbar_box.toolbar.insert(ShareButton(self), -1)

        separator = Gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        toolbar_box.toolbar.insert(separator, -1)
        toolbar_box.toolbar.insert(StopButton(self), -1)
        toolbar_box.show_all()

        self._udp = Udp()
        self.hosts = {}

        self._collab = CollabWrapper(self)
        self._collab.message.connect(self.__message_cb)
        self._collab.buddy_joined.connect(self.__buddy_joined_cb)
        self._collab.buddy_left.connect(self.__buddy_left_cb)
        self._collab.setup()

        self._fuse = 1
        self._timeout = GLib.timeout_add(100, self._timeout_cb, canvas)
Exemplo n.º 41
0
    def build_toolbar(self):
        toolbox = ToolbarBox()
        toolbar = toolbox.toolbar

        activity_button = ActivityButton(self)
        toolbar.insert(activity_button, -1)

        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.set_toolbar_box(toolbox)
Exemplo n.º 42
0
    def build_toolbar(self):
        toolbox = ToolbarBox()
        toolbar = toolbox.toolbar

        activity_button = ActivityButton(self)
        toolbar.insert(activity_button, -1)
        toolbar.insert(Gtk.SeparatorToolItem(), -1)

        home = ToolButton('gtk-home')
        toolbar.insert(home, -1)
        home.connect('clicked', self.__set_home)

        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.set_toolbar_box(toolbox)
Exemplo n.º 43
0
    def __init__(self, handle):
        """Set up the HelloWorld activity."""
        activity.Activity.__init__(self, handle)

        # we do not have collaboration features
        # make the share option insensitive
        self.max_participants = 1

        # toolbar with the new toolbar redesign
        toolbar_box = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(self)
        toolbar_box.toolbar.insert(title_entry, -1)
        title_entry.show()

        description_item = DescriptionItem(self)
        toolbar_box.toolbar.insert(description_item, -1)
        description_item.show()

        share_button = ShareButton(self)
        toolbar_box.toolbar.insert(share_button, -1)
        share_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()

        #set background color
        self.override_background_color(Gtk.StateType.NORMAL, Gdk.RGBA(1.0,1.0,0.0,1.0))
        #set up screen
        fix = Gtk.Fixed()
        fix.set_size_request(1000,750)
        self.lang = Gtk.Label('Language')
        fix.put(self.lang, 100,0)
        self.activity = Gtk.Label('Activity')
        fix.put(self.activity, 500, 0)
        self.fix = fix
        
        #initialize listview
        #display list of languages as listview
        items  = path('/usr/share/locale').dirs()
        locales = []
        for item in items:
            locales.append(item.namebase)
        locales.sort()
        self.languages = Listview('Language', locales, self.lang_cb)

        #get directories from /usr/share/locale
        vbox = self.languages.vbox
        self.fix.put(vbox, 100, 200)
        self.set_canvas(self.fix)
        self.fix.show_all()
Exemplo n.º 44
0
class IRCActivity(activity.Activity):

    def __init__(self, handle):
        activity.Activity.__init__(self, handle)

        logging.debug('Starting the IRC Activity')
        self.set_title(_('IRC Activity'))

        self.add_events(Gdk.EventMask.VISIBILITY_NOTIFY_MASK)
        self.connect('visibility-notify-event',
                     self.__visibility_notify_event_cb)

        self.is_visible = False

        self.client = purk.Client()
        if handle.object_id is None:
            self.default_config()
        self.client.show()
        widget = self.client.get_widget()

        # CANVAS
        self.set_canvas(widget)

        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()

        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 != Gdk.VisibilityState.FULLY_OBSCURED

    def default_config(self):
        if os.path.exists(ETC_CONFIG_PATH):
            self.read_defaults_from_config(ETC_CONFIG_PATH)
        elif os.path.exists(DEFAULT_CONFIG_PATH):
            self.read_defaults_from_config(DEFAULT_CONFIG_PATH)
        else:
            self.client.join_server('us.freenode.net')
            self.client.add_channel('#sugar')
            self.client.add_channel_other('#sugar-es')

    def read_defaults_from_config(self, config_file):
        logging.debug('Reading configuration from file %s' % config_file)
        fp = open(config_file)
        config = ConfigParser.ConfigParser()
        config.readfp(fp)
        fp.close()

        if config.has_section('Config'):
            if config.has_option('Config', 'Nick'):
                nick = config.get('Config', 'Nick').strip()
                self.client.run_command('NICK %s' % (nick))
            if config.has_option('Config', 'Server'):
                server = config.get('Config', 'Server').strip()
                self.client.join_server(server)
            if config.has_option('Config', 'Channels'):
                channels = config.get('Config', 'Channels').split(',')
                for channel in channels:
                    self.client.add_channel(channel.strip())
                    self.client.add_channel_other(channel.strip())

    def read_file(self, file_path):
        if self.metadata['mime_type'] != 'text/plain':
            return

        fd = open(file_path, 'r')
        text = fd.read()
        data = json.loads(text)
        fd.close()

        self.client.run_command('NICK %s' % (data['nick']))

        self.client.join_server(data['server'])
        for chan in data['channels']:
            self.client.add_channel(chan)
            self.client.add_channel_other(chan)
        self.client.core.window.network.requested_joins = set()
        for winid in data['scrollback'].keys():
            if winid in data['channels']:
                win = purk.windows.new(purk.windows.ChannelWindow,
                                       self.client.core.window.network,
                                       winid, self.client.core)
            else:
                win = purk.windows.new(purk.windows.QueryWindow,
                                       self.client.core.window.network,
                                       winid, self.client.core)
            win.output.get_buffer().set_text(data['scrollback'][winid])
            if winid == data['current-window']:
                self.client.core.window.network.requested_joins = set([winid])

    def write_file(self, file_path):
        if not self.metadata['mime_type']:
            self.metadata['mime_type'] = 'text/plain'

        data = {}
        data['nick'] = self.client.core.window.network.me
        data['server'] = self.client.core.window.network.server
        data['username'] = self.client.core.window.network.server
        data['fullname'] = self.client.core.window.network.fullname
        data['password'] = self.client.core.window.network.password
        data['current-window'] = self.client.core.manager.get_active().id
        data['channels'] = []
        data['scrollback'] = {}

        for i in range(self.client.core.manager.tabs.get_n_pages()):
            win = self.client.core.manager.tabs.get_nth_page(i)
            if win.id == "status":
                continue
            if win.is_channel():
                data['channels'].append(win.id)
            buf = win.output.get_buffer()
            data['scrollback'][
                win.id] = buf.get_text(
                buf.get_start_iter(),
                buf.get_end_iter(),
                True)

        fd = open(file_path, 'w')
        text = json.dumps(data)
        fd.write(text)
        fd.close()
Exemplo n.º 45
0
    def __init__(self, handle):
        if os.path.exists('/tmp/1'):
            os.remove('/tmp/1')
            """Set up the HelloWorld activity."""
            activity.Activity.__init__(self, handle)

        if os.path.exists('/tmp/2'):
            os.remove('/tmp/2')
            # we do not have collaboration features
            # make the share option insensitive
            self.max_participants = 1

            # toolbar with the new toolbar redesign
            toolbar_box = ToolbarBox()

            activity_button = ActivityButton(self)
            toolbar_box.toolbar.insert(activity_button, 0)
            activity_button.show()

            title_entry = TitleEntry(self)
            #toolbar_box.toolbar.insert(title_entry, -1)
            toolbar_box.toolbar.insert(title_entry, -1)
            title_entry.show()

            share_button = ShareButton(self)
            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()
            self.container_vbox = Gtk.VBox()
            self.container_vbox.show()
            self.set_canvas(self.container_vbox)

        if os.path.exists('/tmp/3'):
            os.remove('/tmp/3')   
            self.label = Gtk.Label(_("Hello World!"))
            self.container_vbox.add(self.label)
            self.label.set_angle(self.angle)
            self.label.show()    

        if os.path.exists('/tmp/4'):
            os.remove('/tmp/4')      
            self.button = Gtk.Button("Rotate")
            self.container_vbox.add(self.button)
            self.button.connect('clicked', self.hello, None)
            self.button.show()
Exemplo n.º 46
0
	def __init__(self,handle):
		activity.Activity.__init__(self,handle,True)
		self.basePath=activity.get_bundle_path()
	
		scroll=Gtk.ScrolledWindow();
		scroll.set_policy(Gtk.PolicyType.NEVER,Gtk.PolicyType.NEVER);
		
		#get container
		self.canvasHolder=TabbedCanvas()
		self.canvasHolder.basePath=self.basePath
	
		#add tabControl to scrolled window
		scroll.add_with_viewport(self.canvasHolder)
		self.set_canvas(scroll)

		#add toolbox
		toolbox= ToolbarBox(self)
		activity_button=ActivityButton(self);
		toolbox.toolbar.insert(activity_button,0)
		activity_button.show()
		
		separator = Gtk.SeparatorToolItem()
		separator.show()
		toolbox.toolbar.insert(separator, 1)

		#new file button
		new_file = ToolButton('list-add')
		new_file.set_tooltip(_('New File'))
		new_file.props.accelerator=('<ctrl><shift>n')
		new_file.connect('clicked', self.newFile)
		toolbox.toolbar.insert(new_file,2)
		new_file.show()		
		
		#close file button
		close_file=ToolButton('list-remove')
		close_file.set_tooltip(_('Close File'))
		close_file.props.accelerator=('<ctrl><shift>x')
		close_file.connect('clicked',self.closeFile)
		toolbox.toolbar.insert(close_file,3)
		
		#delete button						
		delete_file=ToolButton('dialog-cancel')
		delete_file.set_tooltip('Delete File')
		delete_file.props.accelerator=('del')		
		delete_file.connect('clicked',self.deleteFile)
		toolbox.toolbar.insert(delete_file,4)
	
		separator = Gtk.SeparatorToolItem()
		separator.show()
		toolbox.toolbar.insert(separator, 5)

		#save file button
		saveBtnImage = Gtk.Image()
	        saveBtnImage.set_from_file("%s/icons/oopsy_save_as.svg" % os.getcwd())		
		save_file=ToolButton('gtk-save')
		save_file.set_icon_widget(saveBtnImage)
		save_file.set_tooltip(_('Save File'))
		save_file.props.accelerator=('<ctrl>s')
		save_file.connect('clicked',self.saveFile,self.basePath)
		toolbox.toolbar.insert(save_file,6)		
		
		#compile button
		compile_button=ToolButton('view-source')		
		compile_button.set_tooltip(_('Compile'))
		compile_button.props.accelerator=('<ctrl>F6')
		compile_button.connect('clicked',self.compileFile,self.basePath)
		toolbox.toolbar.insert(compile_button,7)
			
		#run button		
		gobutton = ToolButton('media-playback-start')
		gobutton.props.accelerator = ('<ctrl>F5')
		#gobutton.set_icon_widget(goicon_bw)
		gobutton.set_tooltip(_("Run!"))
		gobutton.connect('clicked',self.executeFile,self.basePath)
		toolbox.toolbar.insert(gobutton,8)

			
	
		separator = Gtk.SeparatorToolItem()
		separator.props.draw = False
	        separator.set_expand(True)
		separator.show()
		toolbox.toolbar.insert(separator, 9)

		#stop button
		stop_button=StopButton(self)
		toolbox.toolbar.insert(stop_button,10)
		stop_button.show()
	
		self.set_toolbar_box(toolbox)

		act_path = activity.get_bundle_path()	
		print "BUNDLE_PAth:",act_path

		self.loadExplorer(self.basePath)
		self.show_all()
Exemplo n.º 47
0
class IRCActivity(activity.Activity):

    def __init__(self, handle):
        activity.Activity.__init__(self, handle)

        logging.debug('Starting the IRC Activity')
        self.set_title(_('IRC Activity'))

        self.add_events(Gdk.EventMask.VISIBILITY_NOTIFY_MASK)
        self.connect('visibility-notify-event',
                     self.__visibility_notify_event_cb)

        self.is_visible = False

        self.client = purk.Client(self)
        if handle.object_id is None:
            self.default_config()
        self.client.show()
        widget = self.client.get_widget()

        # CANVAS
        self.set_canvas(widget)

        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()

        connectionbtn = ToggleToolButton('connect')
        connectionbtn.set_active(True)
        connectionbtn.set_tooltip(_('Disconnect'))
        connectionbtn.connect('toggled', self._connection_cb)
        toolbar_box.toolbar.insert(connectionbtn, -1)
        connectionbtn.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 _get_data(self):
        data = {}
        data['nick'] = self.client.core.window.network.me
        data['server'] = self.client.core.window.network.server
        data['username'] = self.client.core.window.network.server
        data['fullname'] = self.client.core.window.network.fullname
        data['password'] = self.client.core.window.network.password
        data['current-window'] = self.client.core.manager.get_active().id
        data['channels'] = []
        data['scrollback'] = {}

        for i in range(self.client.core.manager.tabs.get_n_pages()):
            win = self.client.core.manager.tabs.get_nth_page(i)
            if win.id == "status":
                continue
            if win.is_channel():
                data['channels'].append(win.id)
            buf = win.output.get_buffer()
            data['scrollback'][win.id] = buf.get_text(buf.get_start_iter(),
                                                      buf.get_end_iter(), True)

        return data

    def _connection_cb(self, widget):
        connected = widget.get_active()
        if connected:
            widget.set_tooltip(_('Disconnect'))
            widget.set_icon_name('connect')
            self._load_data(self.data)
        else:
            widget.set_tooltip(_('Connect'))
            widget.set_icon_name('disconnect')
            self.client.run_command('quit Leaving...')
            self.data = self._get_data()

    def __visibility_notify_event_cb(self, window, event):
        self.is_visible = event.state != Gdk.VisibilityState.FULLY_OBSCURED

        # Configuracion por defecto

    def default_config(self):
        if os.path.exists(ETC_CONFIG_PATH):
            self.read_defaults_from_config(ETC_CONFIG_PATH)
        elif os.path.exists(DEFAULT_CONFIG_PATH):
            data = self.read_defaults_from_config(DEFAULT_CONFIG_PATH)
            if not "server" in data:
                self.client.join_server('irc.freenode.net')
            if not "channels" in data:
                self.i18n_channels()
        else:
            self.client.join_server('irc.freenode.net')
            self.i18n_channels()

    def i18n_channels(self):
        locale = os.environ["LANG"]
        channels = ["#sugar"]
        if locale:
            locale = locale.split("_")[0]
            if locale != "en":
                channel = "#sugar-%s" % locale
                channels.append(channel)

        for channel in channels:
            if channel in I18N_CHANNELS:
                self.client.add_channel(channel)

    def read_defaults_from_config(self, config_file):
        logging.debug('Reading configuration from file %s' % config_file)
        fp = open(config_file)
        config = ConfigParser.ConfigParser()
        try:
            config.readfp(fp)
            fp.close()
        except Exception as error:
            logging.debug('Reading configuration, error: %s' % error)
            fp.close()
            return {"server": None, "channels": None}

        DATA = {"server": None, "chanels": None}
        if config.has_section('Config'):
            if config.has_option('Config', 'Nick'):
                nick = config.get('Config', 'Nick').strip()
                self.client.run_command('NICK %s' % (nick))
            if config.has_option('Config', 'Server'):
                server = config.get('Config', 'Server').strip()
                self.client.join_server(server)
                DATA["server"] = server
            if config.has_option('Config', 'Channels'):
                channels = config.get('Config', 'Channels').split(',')
                DATA["channels"] = channels
                for channel in channels:
                    self.client.add_channel(channel.strip())
                    self.client.add_channel_other(channel.strip())

        return DATA

    def read_file(self, file_path):
        if self.metadata['mime_type'] != 'text/plain':
            return

        fd = open(file_path, 'r')
        text = fd.read()
        data = json.loads(text)
        fd.close()
        self._load_data(data)

    def _load_data(self, data):
        self.client.run_command('NICK %s' % (data['nick']))

        self.client.join_server(data['server'])
        for chan in data['channels']:
            self.client.add_channel(chan)
            self.client.add_channel_other(chan)
        self.client.core.window.network.requested_joins = set()
        for winid in data['scrollback'].keys():
            if winid in data['channels']:
                win = purk.windows.new(purk.windows.ChannelWindow,
                                       self.client.core.window.network,
                                       winid, self.client.core)
            else:
                win = purk.windows.new(purk.windows.QueryWindow,
                                       self.client.core.window.network,
                                       winid, self.client.core)
            win.output.get_buffer().set_text(data['scrollback'][winid])
            if winid == data['current-window']:
                self.client.core.window.network.requested_joins = set([winid])

    def write_file(self, file_path):
        if not self.metadata['mime_type']:
            self.metadata['mime_type'] = 'text/plain'

        data = self._get_data()
        fd = open(file_path, 'w')
        text = json.dumps(data)
        fd.write(text)
        fd.close()
Exemplo n.º 48
0
    def __init__(self, handle):
        super(VteActivity, self).__init__(handle)
        toolbox = ToolbarBox()
        self.set_toolbar_box(toolbox)
        toolbox.show()

        self.max_participants = 1

        toolbar_box = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(self)
        toolbar_box.toolbar.insert(title_entry, -1)
        title_entry.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()

        # 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.connect('selection-changed', self._on_selection_changed_cb)
        self._vte.drag_dest_set(Gtk.DestDefaults.ALL,
                                [],
                                Gdk.DragAction.COPY)
        self._vte.connect('drag_data_received', self._on_drop_cb)
        # ...and its scrollbar
        vtebox = Gtk.HBox()
        vtebox.pack_start(self._vte, True, True, 0)
        vtesb = Gtk.VScrollbar()
        vtesb.show()
        vtebox.pack_start(vtesb, False, False, 0)
        self.set_canvas(vtebox)
        self.show_all()
        # 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
        self._pid = self._vte.spawn_sync(
            Vte.PtyFlags.DEFAULT, bundle_path,
            ['/bin/sh', '-c', 'python %s/show.py; sleep 1' % bundle_path],
            ["PYTHONPATH=%s/library" % bundle_path],
            GLib.SpawnFlags.DO_NOT_REAP_CHILD, None, None)
Exemplo n.º 49
0
class Chat(activity.Activity):

    def __init__(self, handle):
        pservice = presenceservice.get_instance()
        self.owner = pservice.get_owner()

        self._ebook_mode_detector = EbookModeDetector()

        self.chatbox = ChatBox(
            self.owner, self._ebook_mode_detector.get_ebook_mode())
        self.chatbox.connect('open-on-journal', self.__open_on_journal)

        super(Chat, self).__init__(handle)

        self._entry = None
        self._has_alert = False
        self._has_osk = False

        self._setup_canvas()

        self._entry.grab_focus()

        toolbar_box = ToolbarBox()
        self.set_toolbar_box(toolbar_box)

        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()

        description_item = DescriptionItem(self)
        toolbar_box.toolbar.insert(description_item, -1)
        description_item.show()

        self._share_button = ShareButton(self)
        toolbar_box.toolbar.insert(self._share_button, -1)
        self._share_button.show()

        separator = Gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        toolbar_box.toolbar.insert(separator, -1)

        toolbar_box.toolbar.insert(StopButton(self), -1)
        toolbar_box.show_all()

        # Chat is room or one to one:
        self._chat_is_room = False
        self.text_channel = None

        if _HAS_SOUND:
            self.element = Gst.ElementFactory.make('playbin', 'Player')

        if self.shared_activity:
            # we are joining the activity following an invite
            self._entry.props.placeholder_text = \
                _('Please wait for a connection before starting to chat.')
            self.connect('joined', self._joined_cb)
            if self.get_shared():
                # we have already joined
                self._joined_cb(self)
        elif handle.uri:
            # XMPP non-sugar3 incoming chat, not sharable
            self._share_button.props.visible = False
            self._one_to_one_connection(handle.uri)
        else:
            # we are creating the activity
            if not self.metadata or self.metadata.get(
                    'share-scope', activity.SCOPE_PRIVATE) == \
                    activity.SCOPE_PRIVATE:
                # if we are in private session
                self._alert(_('Off-line'), _('Share, or invite someone.'))
            else:
                # resume of shared activity from journal object without invite
                self._entry.props.placeholder_text = \
                    _('Please wait for a connection before starting to chat.')
            self.connect('shared', self._shared_cb)

    def _fixed_resize_cb(self, widget=None, rect=None):
        ''' If a toolbar opens or closes, we need to resize the vbox
        holding out scrolling window. '''
        if self._has_alert:
            dy = style.GRID_CELL_SIZE
        else:
            dy = 0
        if self._has_osk:
            if Gdk.Screen.width() > Gdk.Screen.height():
                dy += OSK_HEIGHT[0]
            else:
                dy += OSK_HEIGHT[1]

        self.chatbox.set_size_request(self._chat_width,
                                      self._chat_height - dy)
        self._fixed.move(self._entry_grid, style.GRID_CELL_SIZE,
                         self._chat_height - dy)

        self.chatbox.resize_conversation(dy)

    def _setup_canvas(self):
        ''' Create a canvas '''
        self._fixed = Gtk.Fixed()
        self._fixed.set_size_request(
            Gdk.Screen.width(), Gdk.Screen.height() - style.GRID_CELL_SIZE)
        self._fixed.connect('size-allocate', self._fixed_resize_cb)
        self.set_canvas(self._fixed)
        self._fixed.show()

        self._entry_widgets = self._make_entry_widgets()
        self._fixed.put(self.chatbox, 0, 0)
        self.chatbox.show()

        self._fixed.put(self._entry_grid, style.GRID_CELL_SIZE,
                        self._chat_height)
        self._entry_grid.show()

        Gdk.Screen.get_default().connect('size-changed', self._configure_cb)

    def _configure_cb(self, event):
        self._fixed.set_size_request(
            Gdk.Screen.width(), Gdk.Screen.height() - style.GRID_CELL_SIZE)
        if self._ebook_mode_detector.get_ebook_mode():
            self._entry_height = int(style.GRID_CELL_SIZE * 1.5)
        else:
            self._entry_height = style.GRID_CELL_SIZE
        entry_width = Gdk.Screen.width() - \
            2 * (self._entry_height + style.GRID_CELL_SIZE)
        self._entry.set_size_request(entry_width, self._entry_height)
        self._entry_grid.set_size_request(
            Gdk.Screen.width() - 2 * style.GRID_CELL_SIZE,
            self._entry_height)

        self._chat_height = Gdk.Screen.height() - self._entry_height - \
            style.GRID_CELL_SIZE
        self._chat_width = Gdk.Screen.width()
        self.chatbox.set_size_request(self._chat_width, self._chat_height)
        self.chatbox.resize_all()

        width = int(Gdk.Screen.width() - 2 * style.GRID_CELL_SIZE)
        if self._ebook_mode_detector.get_ebook_mode():
            height = int(Gdk.Screen.height() - 8 * style.GRID_CELL_SIZE)
        else:
            height = int(Gdk.Screen.height() - 5 * style.GRID_CELL_SIZE)
        self._smiley_table.set_size_request(width, height)
        self._smiley_toolbar.set_size_request(width, -1)
        self._smiley_window.set_size_request(width, -1)

        self._fixed_resize_cb()

    def _create_smiley_table(self, width):
        pixel_size = (style.STANDARD_ICON_SIZE + style.LARGE_ICON_SIZE) / 2
        spacing = style.DEFAULT_SPACING
        button_size = pixel_size + spacing
        smilies_columns = int(width / button_size)
        pad = (width - smilies_columns * button_size) / 2

        table = Gtk.Grid()
        table.set_row_spacing(spacing)
        table.set_column_spacing(spacing)
        table.set_border_width(pad)

        queue = []

        def _create_smiley_icon_idle_cb():
            try:
                x, y, path, code = queue.pop()
            except IndexError:
                self.unbusy()
                return False
            pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(path,
                                                            pixel_size,
                                                            pixel_size)
            image = Gtk.Image.new_from_pixbuf(pixbuf)
            box = Gtk.EventBox()
            box.add(image)
            box.connect('button-press-event', self._add_smiley_to_entry, code)
            table.attach(box, x, y, 1, 1)
            box.show_all()
            return True

        x = 0
        y = 0
        smilies.init()
        for i in range(len(smilies.THEME)):
            path, hint, codes = smilies.THEME[i]
            queue.append([x, y, path, codes[0]])

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

        queue.reverse()
        GLib.idle_add(_create_smiley_icon_idle_cb)
        return table

    def _add_smiley_to_entry(self, icon, event, text):
        pos = self._entry.props.cursor_position
        self._entry.insert_text(text, pos)
        self._entry.grab_focus()
        self._entry.set_position(pos + len(text))
        self._hide_smiley_window()

    def _shared_cb(self, sender):
        self._setup()

    def _one_to_one_connection(self, tp_channel):
        '''Handle a private invite from a non-sugar3 XMPP client.'''
        if self.shared_activity or self.text_channel:
            return
        bus_name, connection, channel = json.loads(tp_channel)
        logger.debug('GOT XMPP: %s %s %s', bus_name, connection, channel)
        conn = TelepathyGLib.Connection.new(
            TelepathyGLib.DBusDaemon.dup(), bus_name, connection)
        self._one_to_one_connection_ready_cb(
            TelepathyGLib.DBusDaemon.dup(), bus_name, channel, conn)

    def _one_to_one_connection_ready_cb(self, bus_name, channel, conn):
        '''Callback for Connection for one to one connection'''
        text_channel = TelepathyGLib.Channel(conn, channel)
        self.text_channel = TextChannelWrapper(text_channel, conn)
        self.text_channel.set_received_callback(self._received_cb)
        self.text_channel.handle_pending_messages()
        self.text_channel.set_closed_callback(
            self._one_to_one_connection_closed_cb)
        self._chat_is_room = False
        self._alert(_('On-line'), _('Private Chat'))

        # XXX How do we detect the sender going offline?
        self._entry.set_sensitive(True)
        self._entry.props.placeholder_text = None
        self._entry.grab_focus()

    def _one_to_one_connection_closed_cb(self):
        '''Callback for when the text channel closes.'''
        self._alert(_('Off-line'), _('left the chat'))

    def _setup(self):
        self.text_channel = TextChannelWrapper(
            self.shared_activity.telepathy_text_chan,
            self.shared_activity.telepathy_conn)
        self.text_channel.set_received_callback(self._received_cb)
        self._alert(_('On-line'), _('Connected'))
        self.shared_activity.connect('buddy-joined', self._buddy_joined_cb)
        self.shared_activity.connect('buddy-left', self._buddy_left_cb)
        self._chat_is_room = True
        self._entry.set_sensitive(True)
        self._entry.props.placeholder_text = None
        self._entry.grab_focus()

    def _joined_cb(self, sender):
        '''Joined a shared activity.'''
        if not self.shared_activity:
            return
        logger.debug('Joined a shared chat')
        for buddy in self.shared_activity.get_joined_buddies():
            self._buddy_already_exists(buddy)
        self._setup()

    def _received_cb(self, buddy, text):
        '''Show message that was received.'''
        if buddy:
            if type(buddy) is dict:
                nick = buddy['nick']
            else:
                nick = buddy.props.nick
        else:
            nick = '???'
        logger.debug('Received message from %s: %s', nick, text)
        self.chatbox.add_text(buddy, text)

        if self.owner.props.nick in text:
            self.play_sound('said_nick')

        '''
        vscroll = self.chatbox.get_vadjustment()
        if vscroll.get_property('value') != vscroll.get_property('upper'):
            self._alert(_('New message'), _('New message from %s' % nick))
        '''
        if not self.has_focus:
            self.notify_user(_('Message from %s') % buddy, text)

    def _alert(self, title, text=None):
        alert = NotifyAlert(timeout=5)
        alert.props.title = title
        alert.props.msg = text
        self.add_alert(alert)
        alert.connect('response', self._alert_cancel_cb)
        alert.show()
        self._has_alert = True
        self._fixed_resize_cb()

    def _alert_cancel_cb(self, alert, response_id):
        self.remove_alert(alert)
        self._has_alert = False
        self._fixed_resize_cb()

    def __open_on_journal(self, widget, url):
        '''Ask the journal to display a URL'''
        logger.debug('Create journal entry for URL: %s', url)
        jobject = datastore.create()
        metadata = {
            'title': '%s: %s' % (_('URL from Chat'), url),
            'title_set_by_user': '******',
            'icon-color': profile.get_color().to_string(),
            'mime_type': 'text/uri-list',
        }
        for k, v in metadata.items():
            jobject.metadata[k] = v
        file_path = os.path.join(get_activity_root(), 'instance',
                                 '%i_' % time.time())
        open(file_path, 'w').write(url + '\r\n')
        os.chmod(file_path, 0755)
        jobject.set_file_path(file_path)
        datastore.write(jobject)
        show_object_in_journal(jobject.object_id)
        jobject.destroy()
        os.unlink(file_path)

    def _buddy_joined_cb(self, sender, buddy):
        '''Show a buddy who joined'''
        if buddy == self.owner:
            return
        self.chatbox.add_text(
            buddy, _('%s joined the chat') % buddy.props.nick,
            status_message=True)

        self.play_sound('login')

    def _buddy_left_cb(self, sender, buddy):
        '''Show a buddy who joined'''
        if buddy == self.owner:
            return
        self.chatbox.add_text(
            buddy, _('%s left the chat') % buddy.props.nick,
            status_message=True)

        self.play_sound('logout')

    def _buddy_already_exists(self, buddy):
        '''Show a buddy already in the chat.'''
        if buddy == self.owner:
            return
        self.chatbox.add_text(
            buddy, _('%s is here') % buddy.props.nick,
            status_message=True)

    def can_close(self):
        '''Perform cleanup before closing.
        Close text channel of a one to one XMPP chat.
        '''
        if self._chat_is_room is False:
            if self.text_channel is not None:
                self.text_channel.close()
        return True

    def _make_entry_widgets(self):
        '''We need to create a button for the smiley, a text entry, and a
        send button.

        All of this, along with the chatbox, goes into a grid.

        ---------------------------------------
        | chat box                            |
        | smiley button | entry | send button |
        ---------------------------------------
        '''
        if self._ebook_mode_detector.get_ebook_mode():
            self._entry_height = int(style.GRID_CELL_SIZE * 1.5)
        else:
            self._entry_height = style.GRID_CELL_SIZE
        entry_width = Gdk.Screen.width() - \
            2 * (self._entry_height + style.GRID_CELL_SIZE)
        self._chat_height = Gdk.Screen.height() - self._entry_height - \
            style.GRID_CELL_SIZE
        self._chat_width = Gdk.Screen.width()

        self.chatbox.set_size_request(self._chat_width, self._chat_height)

        self._entry_grid = Gtk.Grid()
        self._entry_grid.set_size_request(
            Gdk.Screen.width() - 2 * style.GRID_CELL_SIZE,
            self._entry_height)

        smiley_button = EventIcon(icon_name='smilies',
                                  pixel_size=self._entry_height)
        smiley_button.connect('button-press-event', self._smiley_button_cb)
        self._entry_grid.attach(smiley_button, 0, 0, 1, 1)
        smiley_button.show()

        self._entry = Gtk.Entry()
        self._entry.set_size_request(entry_width, self._entry_height)
        self._entry.modify_bg(Gtk.StateType.INSENSITIVE,
                              style.COLOR_WHITE.get_gdk_color())
        self._entry.modify_base(Gtk.StateType.INSENSITIVE,
                                style.COLOR_WHITE.get_gdk_color())

        self._entry.set_sensitive(False)
        self._entry.props.placeholder_text = \
            _('You must be connected to a friend before starting to chat.')
        self._entry.connect('focus-in-event', self._entry_focus_in_cb)
        self._entry.connect('focus-out-event', self._entry_focus_out_cb)
        self._entry.connect('activate', self._entry_activate_cb)
        self._entry.connect('key-press-event', self._entry_key_press_cb)
        self._entry_grid.attach(self._entry, 1, 0, 1, 1)
        self._entry.show()

        send_button = EventIcon(icon_name='send',
                                pixel_size=self._entry_height)
        send_button.connect('button-press-event', self._send_button_cb)
        self._entry_grid.attach(send_button, 2, 0, 1, 1)
        send_button.show()

    def _get_icon_pixbuf(self, name):
        icon_theme = Gtk.IconTheme.get_default()
        icon_info = icon_theme.lookup_icon(
            name, style.LARGE_ICON_SIZE, 0)
        pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(
            icon_info.get_filename(), style.LARGE_ICON_SIZE,
            style.LARGE_ICON_SIZE)
        del icon_info
        return pixbuf

    def _entry_focus_in_cb(self, entry, event):
        self._hide_smiley_window()

        if self._ebook_mode_detector.get_ebook_mode():
            self._has_osk = True
            self._fixed_resize_cb()

    def _entry_focus_out_cb(self, entry, event):
        if self._ebook_mode_detector.get_ebook_mode():
            self._has_osk = False
            self._fixed_resize_cb()

    def _entry_key_press_cb(self, widget, event):
        '''Check for scrolling keys.

        Check if the user pressed Page Up, Page Down, Home or End and
        scroll the window according the pressed key.
        '''
        vadj = self.chatbox.get_vadjustment()
        if event.keyval == Gdk.KEY_Page_Down:
            value = vadj.get_value() + vadj.page_size
            if value > vadj.upper - vadj.page_size:
                value = vadj.upper - vadj.page_size
            vadj.set_value(value)
        elif event.keyval == Gdk.KEY_Page_Up:
            vadj.set_value(vadj.get_value() - vadj.page_size)
        elif event.keyval == Gdk.KEY_Home and \
                event.get_state() & Gdk.ModifierType.CONTROL_MASK:
            vadj.set_value(vadj.lower)
        elif event.keyval == Gdk.KEY_End and \
                event.get_state() & Gdk.ModifierType.CONTROL_MASK:
            vadj.set_value(vadj.upper - vadj.page_size)

    def _smiley_button_cb(self, widget, event):
        self._show_smiley_window()

    def _send_button_cb(self, widget, event):
        self._entry_activate_cb(self._entry)

    def _entry_activate_cb(self, entry):
        self.chatbox._scroll_auto = True

        text = entry.props.text
        if text:
            logger.debug('Adding text to chatbox: %s: %s' % (self.owner, text))
            self.chatbox.add_text(self.owner, text)
            entry.props.text = ''
            if self.text_channel:
                logger.debug('sending to text_channel: %s' % (text))
                self.text_channel.send(text)
            else:
                logger.debug('Tried to send message but text channel '
                             'not connected.')

    def write_file(self, file_path):
        '''Store chat log in Journal.

        Handling the Journal is provided by Activity - we only need
        to define this method.
        '''
        logger.debug('write_file: writing %s' % file_path)
        self.chatbox.add_log_timestamp()
        f = open(file_path, 'w')
        try:
            f.write(self.chatbox.get_log())
        finally:
            f.close()
        self.metadata['mime_type'] = 'text/plain'

    def read_file(self, file_path):
        '''Load a chat log from the Journal.
        Handling the Journal is provided by Activity - we only need
        to define this method.
        '''
        logger.debug('read_file: reading %s' % file_path)
        log = open(file_path).readlines()
        last_line_was_timestamp = False
        for line in log:
            if line.endswith('\t\t\n'):
                if last_line_was_timestamp is False:
                    timestamp = line.strip().split('\t')[0]
                    self.chatbox.add_separator(timestamp)
                    last_line_was_timestamp = True
            else:
                timestamp, nick, color, status, text = line.strip().split('\t')
                status_message = bool(int(status))
                self.chatbox.add_text({'nick': nick, 'color': color},
                                      text, status_message)
                last_line_was_timestamp = False

    def play_sound(self, event):
        if _HAS_SOUND:
            SOUNDS_PATH = os.path.join(get_bundle_path(), 'sounds')
            SOUNDS = {'said_nick': os.path.join(SOUNDS_PATH, 'alert.wav'),
                      'login': os.path.join(SOUNDS_PATH, 'login.wav'),
                      'logout': os.path.join(SOUNDS_PATH, 'logout.wav')}

            self.element.set_state(Gst.State.NULL)
            self.element.set_property('uri', 'file://%s' % SOUNDS[event])
            self.element.set_state(Gst.State.PLAYING)

    def _create_smiley_window(self):
        grid = Gtk.Grid()
        width = int(Gdk.Screen.width() - 2 * style.GRID_CELL_SIZE)

        self._smiley_toolbar = SmileyToolbar(self)
        height = style.GRID_CELL_SIZE
        self._smiley_toolbar.set_size_request(width, height)
        grid.attach(self._smiley_toolbar, 0, 0, 1, 1)
        self._smiley_toolbar.show()

        self._smiley_table = Gtk.ScrolledWindow()
        self._smiley_table.set_policy(Gtk.PolicyType.NEVER,
                                      Gtk.PolicyType.AUTOMATIC)
        self._smiley_table.modify_bg(
            Gtk.StateType.NORMAL, style.COLOR_BLACK.get_gdk_color())
        if self._ebook_mode_detector.get_ebook_mode():
            height = int(Gdk.Screen.height() - 8 * style.GRID_CELL_SIZE)
        else:
            height = int(Gdk.Screen.height() - 4 * style.GRID_CELL_SIZE)
        self._smiley_table.set_size_request(width, height)

        table = self._create_smiley_table(width)
        self._smiley_table.add_with_viewport(table)
        table.show_all()

        grid.attach(self._smiley_table, 0, 1, 1, 1)
        self._smiley_table.show()

        self._smiley_window = Gtk.ScrolledWindow()
        self._smiley_window.set_policy(Gtk.PolicyType.NEVER,
                                       Gtk.PolicyType.NEVER)
        self._smiley_window.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
        self._smiley_window.set_size_request(width, -1)

        self._smiley_window.add_with_viewport(grid)

        def _key_press_event_cb(widget, event):
            if event.keyval == Gdk.KEY_Escape:
                self._hide_smiley_window()
                return True
            return False
        self.connect('key-press-event', _key_press_event_cb)

        grid.show()

        self._fixed.put(self._smiley_window, style.GRID_CELL_SIZE, 0)

    def _show_smiley_window(self):
        if not hasattr(self, '_smiley_window'):
            self.busy()
            self._create_smiley_window()
        self._smiley_window.show()

    def _hide_smiley_window(self):
        if hasattr(self, '_smiley_window'):
            self._smiley_window.hide()
Exemplo n.º 50
0
    def __init__(self, handle):
        pservice = presenceservice.get_instance()
        self.owner = pservice.get_owner()

        self._ebook_mode_detector = EbookModeDetector()

        self.chatbox = ChatBox(
            self.owner, self._ebook_mode_detector.get_ebook_mode())
        self.chatbox.connect('open-on-journal', self.__open_on_journal)

        super(Chat, self).__init__(handle)

        self._entry = None
        self._has_alert = False
        self._has_osk = False

        self._setup_canvas()

        self._entry.grab_focus()

        toolbar_box = ToolbarBox()
        self.set_toolbar_box(toolbar_box)

        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()

        description_item = DescriptionItem(self)
        toolbar_box.toolbar.insert(description_item, -1)
        description_item.show()

        self._share_button = ShareButton(self)
        toolbar_box.toolbar.insert(self._share_button, -1)
        self._share_button.show()

        separator = Gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        toolbar_box.toolbar.insert(separator, -1)

        toolbar_box.toolbar.insert(StopButton(self), -1)
        toolbar_box.show_all()

        # Chat is room or one to one:
        self._chat_is_room = False
        self.text_channel = None

        if _HAS_SOUND:
            self.element = Gst.ElementFactory.make('playbin', 'Player')

        if self.shared_activity:
            # we are joining the activity following an invite
            self._entry.props.placeholder_text = \
                _('Please wait for a connection before starting to chat.')
            self.connect('joined', self._joined_cb)
            if self.get_shared():
                # we have already joined
                self._joined_cb(self)
        elif handle.uri:
            # XMPP non-sugar3 incoming chat, not sharable
            self._share_button.props.visible = False
            self._one_to_one_connection(handle.uri)
        else:
            # we are creating the activity
            if not self.metadata or self.metadata.get(
                    'share-scope', activity.SCOPE_PRIVATE) == \
                    activity.SCOPE_PRIVATE:
                # if we are in private session
                self._alert(_('Off-line'), _('Share, or invite someone.'))
            else:
                # resume of shared activity from journal object without invite
                self._entry.props.placeholder_text = \
                    _('Please wait for a connection before starting to chat.')
            self.connect('shared', self._shared_cb)