Example #1
0
    def _create_menu(self):
        menu = hildon.AppMenu()

        self.settings_button = hildon.GtkButton(gtk.HILDON_SIZE_FINGER_HEIGHT)
        self.settings_button.set_label(_("Settings"))
        self.settings_button.connect('clicked', self.open_settings)
        self.settings_button.show()
        menu.append(self.settings_button)

        self.status_button = hildon.GtkButton(gtk.HILDON_SIZE_FINGER_HEIGHT)
        self.status_button.set_label("status")
        self.status_button.connect('clicked', self.update_status)
        self.status_button.show()
        menu.append(self.status_button)

        self.chatroom_button = hildon.GtkButton(gtk.HILDON_SIZE_FINGER_HEIGHT)
        self.chatroom_button.set_label(_("Chatroom"))
        #menu.append(self.chatroom)

        self.spread_button = hildon.GtkButton(gtk.HILDON_SIZE_FINGER_HEIGHT)
        self.spread_button.set_label(_("Invite friends"))
        self.spread_button.connect('clicked', self.invite_friends)
        menu.append(self.spread_button)

        menu.show_all()
        return menu
Example #2
0
 def make_button(self, icon, callback=None, sensitive=True):
     icon = resource_filename('mirabeau',
                              os.path.join('data', 'icons', icon))
     icon = gtk.gdk.pixbuf_new_from_file(icon)
     button = hildon.GtkButton(gtk.HILDON_SIZE_FINGER_HEIGHT)
     image = gtk.Image()
     image.set_from_pixbuf(icon)
     button.set_image(image)
     button.connect("clicked", lambda x: callback())
     button.set_sensitive(sensitive)
     return button
Example #3
0
    def __init__(self, coherence, room_name, conf_server):
        super(InviteFriendsWindow, self).__init__()
        self.coherence = coherence
        self.set_title(_("Spread the word!"))
        self.contact_handles = []
        vbox = gtk.VBox()

        # To
        to_box = gtk.HBox()
        to_button = hildon.GtkButton(gtk.HILDON_SIZE_AUTO_WIDTH
                                     | gtk.HILDON_SIZE_FINGER_HEIGHT)
        to_button.set_label(_("To:"))
        to_button.connect("clicked", self._select_contacts)
        to_box.pack_start(to_button, expand=False)
        self.to_entry = hildon.Entry(gtk.HILDON_SIZE_AUTO)
        self.to_entry.set_sensitive(False)
        to_box.pack_start(self.to_entry)
        vbox.pack_start(to_box, expand=False)

        # Message
        template = _("""\
Hi! Join me in the tubes of the interwebs! It is all explained there:
%(howto_url)s. I am in the %(room_name)s of the server %(conf_server)s.
        """)
        howto_url = "http://coherence.beebits.net/wiki/MirabeauHowTo"
        self.text_view = hildon.TextView()
        buf = gtk.TextBuffer()
        buf.set_text(template % locals())
        self.text_view.set_wrap_mode(gtk.WRAP_WORD)
        self.text_view.set_buffer(buf)
        vbox.pack_start(self.text_view)

        # Send
        send_button = hildon.GtkButton(gtk.HILDON_SIZE_FINGER_HEIGHT)
        send_button.set_label(_("Send"))
        send_button.connect("clicked", self._send_message)
        vbox.pack_start(send_button, expand=False)

        self.add(vbox)
        vbox.show_all()
Example #4
0
    def create_menu(self, parent=None):
        """ Creates the application menu. """
        menu = hildon.AppMenu()

        config = hildon.GtkButton(gtk.HILDON_SIZE_AUTO)
        config.set_label(self.config_label)
        config.connect('clicked', self.menu_button_clicked, parent)

        reset = hildon.GtkButton(gtk.HILDON_SIZE_AUTO)
        reset.set_label(self.reset_label)
        reset.connect('clicked', self.menu_button_clicked, parent)

        about = hildon.GtkButton(gtk.HILDON_SIZE_AUTO)
        about.set_label(self.about_label)
        about.connect('clicked', self.menu_button_clicked, parent)

        menu.append(config)
        menu.append(reset)
        menu.append(about)

        menu.show_all()

        return menu
Example #5
0
	def create_mms_menu(self, fname):
		""" create app menu for mms viewing window """
		menu = hildon.AppMenu()
		
		self.headerstxt = _("Headers")
		headers = hildon.GtkButton(gtk.HILDON_SIZE_AUTO)
		headers.set_label(self.headerstxt)
		headers.connect('clicked', self.mms_menu_button_clicked, fname)
		
		self.replytxt = gettext.ldgettext('skype-ui', 'skype_ti_incoming_call_options')
		reply = hildon.GtkButton(gtk.HILDON_SIZE_AUTO)
		reply.set_label(self.replytxt)
		reply.connect('clicked', self.mms_menu_button_clicked, fname)
		
		self.replysmstxt = "%s (%s)" % (gettext.ldgettext('skype-ui', 'skype_ti_incoming_call_options'), "SMS")
		replysms = hildon.GtkButton(gtk.HILDON_SIZE_AUTO)
		replysms.set_label(self.replysmstxt)
		replysms.connect('clicked', self.mms_menu_button_clicked, fname)
		
		self.forwardtxt = gettext.ldgettext('rtcom-messaging-ui', 'messaging_fi_forward')
		forward = hildon.GtkButton(gtk.HILDON_SIZE_AUTO)
		forward.set_label(self.forwardtxt)
		forward.connect('clicked', self.mms_menu_button_clicked, fname)
		
		self.copytxt = "%s" % gettext.ldgettext('rtcom-messaging-ui', 'messaging_fi_copy')
		copyb = hildon.GtkButton(gtk.HILDON_SIZE_AUTO)
		copyb.set_label(self.copytxt)
		copyb.connect('clicked', self.mms_menu_button_clicked, fname)
		
		self.deletetxt = gettext.ldgettext('hildon-libs', 'wdgt_bd_delete')
		delete = hildon.GtkButton(gtk.HILDON_SIZE_AUTO)
		delete.set_label(self.deletetxt)
		delete.connect('clicked', self.mms_menu_button_clicked, fname)
		
		self.saveattachments = gettext.ldgettext('modest', 'mcen_me_viewer_save_attachments')
		saveattach = hildon.GtkButton(gtk.HILDON_SIZE_AUTO)
		saveattach.set_label(self.saveattachments)
		saveattach.connect('clicked', self.mms_menu_button_clicked, fname)
		
		menu.append(reply)
		menu.append(replysms)
		menu.append(saveattach)
		menu.append(copyb)
		menu.append(forward)
		menu.append(headers)
		menu.append(delete)
		menu.show_all()
		
		return menu		
Example #6
0
    def set_menu_item(self, name, label, visible, cb):

        if (not name in self.__menu_items):
            if (platforms.MAEMO5):
                item = hildon.GtkButton(gtk.HILDON_SIZE_AUTO)
                item.set_label(label)
            else:
                item = gtk.MenuItem(label)
            self.__menu_items[name] = item
            self.__menu.append(item)
            if (platforms.MAEMO5):
                item.connect("clicked", lambda src, cb: cb(), cb)
            else:
                item.connect("activate", lambda src, cb: cb(), cb)

        else:
            item = self.__menu_items[name]

        if (visible):
            item.show()
        else:
            item.hide()
Example #7
0
	def open_settings(self):
		def set_lang(widget, langs):
			sel = [None]
			def selection_changed(selector, seltype):
				__import__("sentences.sentences_"+selector.get_current_text())
				saera_processing.sent = sys.modules["sentences.sentences_"+selector.get_current_text()]
				stack = hildon.WindowStack.get_default()
				stack.pop_1()
			lwin = hildon.StackableWindow()
			selector = hildon.TouchSelector(text = True)
			selector.connect("changed", selection_changed)
			for i in langs:
				selector.append_text(i)
			selector.set_column_selection_mode(hildon.TOUCH_SELECTOR_SELECTION_MODE_SINGLE)
			lwin.add(selector)
			lwin.show_all()
		try:
			win = hildon.StackableWindow()
		except NameError:
			win = gtk.Window()
			win.set_modal(True)
			win.set_transient_for(self.win)
		win.set_title("Settings")
		vbox = gtk.VBox()
		win.add(vbox)
		langs = [i.split("_")[1].split(".")[0] for i in os.listdir('sentences') if (i.endswith('.py') and not 'init' in i)]
		try:
			langbut = hildon.GtkButton(gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT)
			langbut.set_label("Language")
			langbut.connect("clicked", set_lang, langs)
			vbox.pack_start(langbut, True, False, 0)
		except NameError:
			cbox = gtk.combo_box_new_text()
			for i in langs:
				cbox.append_text(i)
			vbox.pack_start(cbox, True, False, 0)
		win.show_all()
 def test_constructor(self):
     t = hildon.GtkButton(gtk.HILDON_SIZE_AUTO)
     self.assertTrue(type(t) is hildon.GtkButton)
     self.assertRaises(TypeError, hildon.GtkButton)
Example #9
0
    def __init__(self, coherence, device):
        super(MediaRendererWindow, self).__init__()
        self.coherence = coherence
        self.device = device
        self.set_title(device.get_friendly_name())

        vbox = gtk.VBox(homogeneous=False, spacing=10)
        vbox.set_border_width(5)

        hbox = gtk.HBox(homogeneous=False)
        self.album_art_image = gtk.Image()
        icon = '/usr/share/icons/hicolor/295x295/hildon/mediaplayer_default_album.png'
        self.blank_icon = gtk.gdk.pixbuf_new_from_file(icon)
        self.album_art_image.set_from_pixbuf(self.blank_icon)
        hbox.pack_start(self.album_art_image)  #,False,False,2)

        #icon_loader = gtk.gdk.PixbufLoader()
        #icon_loader.write(urllib.urlopen(str(res.data)).read())
        #icon_loader.close()

        rightbox = gtk.VBox(homogeneous=False, spacing=10)

        textbox = gtk.VBox(homogeneous=False, spacing=10)
        self.title_text = gtk.Label("<b>title</b>")
        self.title_text.set_use_markup(True)
        textbox.pack_start(self.title_text, False, False, 2)
        self.album_text = gtk.Label("album")
        self.album_text.set_use_markup(True)
        textbox.pack_start(self.album_text, False, False, 2)
        self.artist_text = gtk.Label("artist")
        self.artist_text.set_use_markup(True)
        textbox.pack_start(self.artist_text, False, False, 2)
        rightbox.pack_start(textbox, False, False, 2)

        seekbox = gtk.HBox(homogeneous=False, spacing=10)
        self.position_min_text = gtk.Label("0:00")
        self.position_min_text.set_use_markup(True)
        seekbox.pack_start(self.position_min_text, False, False, 2)
        adjustment = gtk.Adjustment(value=0,
                                    lower=0,
                                    upper=240,
                                    step_incr=1,
                                    page_incr=20)
        self.position_scale = gtk.HScale(adjustment=adjustment)
        self.position_scale.set_draw_value(False)
        self.position_scale.set_sensitive(False)
        self.position_scale.connect("format-value", self.format_position)
        self.position_scale.connect('change-value', self.position_changed)
        seekbox.pack_start(self.position_scale, True, True, 2)
        self.position_max_text = gtk.Label("0:00")
        self.position_max_text.set_use_markup(True)
        seekbox.pack_end(self.position_max_text, False, False, 2)
        rightbox.pack_start(seekbox, False, False, 2)

        hbox.pack_start(rightbox)

        vbox.pack_start(hbox, False, False, 2)

        self.prev_button = self.make_button('media-skip-backward.png',
                                            self.skip_backward,
                                            sensitive=False)
        self.seek_backward_button = self.make_button(
            'media-seek-backward.png',
            callback=self.seek_backward,
            sensitive=False)
        self.stop_button = self.make_button('media-playback-stop.png',
                                            callback=self.stop,
                                            sensitive=False)
        self.start_button = self.make_button('media-playback-start.png',
                                             callback=self.play_or_pause,
                                             sensitive=False)
        self.seek_forward_button = self.make_button('media-seek-forward.png',
                                                    callback=self.seek_forward,
                                                    sensitive=False)
        self.next_button = self.make_button('media-skip-forward.png',
                                            self.skip_forward,
                                            sensitive=False)
        buttonbox2 = gtk.HBox(homogeneous=True, spacing=30)
        buttonbox2.pack_start(self.prev_button, False, False, 2)
        buttonbox2.pack_start(self.seek_backward_button, False, False, 2)
        buttonbox2.pack_start(self.stop_button, False, False, 2)
        buttonbox2.pack_start(self.start_button, False, False, 2)
        buttonbox2.pack_start(self.seek_forward_button, False, False, 2)
        buttonbox2.pack_start(self.next_button, False, False, 2)

        buttonbox = gtk.HBox(homogeneous=False, spacing=10)
        self.buttons_alignment = gtk.Alignment(0.25, 0.25, 0.25, 0.25)
        self.buttons_alignment.add(buttonbox2)
        buttonbox.pack_start(self.buttons_alignment, False, False, 2)

        hbox = gtk.HBox(homogeneous=False, spacing=10)
        #hbox.set_size_request(240,-1)
        adjustment = gtk.Adjustment(value=0,
                                    lower=0,
                                    upper=100,
                                    step_incr=1,
                                    page_incr=20)  #, page_size=20)
        self.volume_scale = gtk.HScale(adjustment=adjustment)
        self.volume_scale.set_size_request(700, -1)
        self.volume_scale.set_draw_value(False)
        self.volume_scale.connect('change-value', self.volume_changed)
        #hbox.pack_start(self.volume_scale,False,False,2)
        button = hildon.GtkButton(gtk.HILDON_SIZE_FINGER_HEIGHT)
        self.volume_image = gtk.Image()
        icon = resource_filename(
            'mirabeau', os.path.join('data', 'icons', 'audio-volume-low.png'))
        self.volume_low_icon = gtk.gdk.pixbuf_new_from_file(icon)
        self.volume_image.set_from_pixbuf(self.volume_low_icon)
        button.set_image(self.volume_image)
        #button.connect("clicked", self.mute)
        button.connect("clicked", self.volume_toggle)

        self.volume_alignment = gtk.Alignment(0.25, 0.25, 1, 0.25)
        self.volume_alignment.add(self.volume_scale)

        icon = resource_filename(
            'mirabeau', os.path.join('data', 'icons',
                                     'audio-volume-medium.png'))
        self.volume_medium_icon = gtk.gdk.pixbuf_new_from_file(icon)
        icon = resource_filename(
            'mirabeau', os.path.join('data', 'icons', 'audio-volume-high.png'))
        self.volume_high_icon = gtk.gdk.pixbuf_new_from_file(icon)
        icon = resource_filename(
            'mirabeau', os.path.join('data', 'icons',
                                     'audio-volume-muted.png'))
        self.volume_muted_icon = gtk.gdk.pixbuf_new_from_file(icon)
        hbox.pack_end(button, False, False, 2)

        buttonbox.pack_end(hbox, False, False, 2)
        vbox.pack_end(buttonbox, False, False, 2)
        #vbox.pack_start(self.buttons_alignment,False,False,2)

        self.pause_button_image = gtk.Image()
        icon = resource_filename(
            'mirabeau',
            os.path.join('data', 'icons', 'media-playback-pause.png'))
        icon = gtk.gdk.pixbuf_new_from_file(icon)
        self.pause_button_image.set_from_pixbuf(icon)
        self.start_button_image = self.start_button.get_image()

        self.status_bar = gtk.Statusbar()
        context_id = self.status_bar.get_context_id("Statusbar")
        #vbox.pack_end(self.status_bar,False,False,2)

        self.add(vbox)
        self.vbox = vbox
        self.buttonbox = buttonbox

        self.seeking = False

        self.position_loop = task.LoopingCall(self.get_position)

        service = self.device.get_service_by_type('RenderingControl')
        service.subscribe_for_variable('Volume',
                                       callback=self.state_variable_change)
        service.subscribe_for_variable('Mute',
                                       callback=self.state_variable_change)

        service = self.device.get_service_by_type('AVTransport')
        if service != None:
            service.subscribe_for_variable('AVTransportURI',
                                           callback=self.state_variable_change)
            service.subscribe_for_variable('CurrentTrackMetaData',
                                           callback=self.state_variable_change)
            service.subscribe_for_variable('TransportState',
                                           callback=self.state_variable_change)
            service.subscribe_for_variable('CurrentTransportActions',
                                           callback=self.state_variable_change)

            service.subscribe_for_variable('AbsTime',
                                           callback=self.state_variable_change)
            service.subscribe_for_variable('TrackDuration',
                                           callback=self.state_variable_change)

        self.get_position()
        self.connect("delete-event", self.clean)