Beispiel #1
0
def google_accounts_win(widget, data):
    global liststore
    global acct_tree

    win = hildon.Dialog()
    win.set_title("Manage Google Accounts")
    vbox = gtk.VBox(False, 0)

    liststore = gtk.ListStore(int, str)
    acct_tree = hildon.GtkTreeView(gtk.HILDON_UI_MODE_EDIT, liststore)

    read_accounts_list()

    cell = gtk.CellRendererText()
    col = gtk.TreeViewColumn()
    col.pack_start(cell, True)
    col.set_attributes(cell, text=1)
    acct_tree.append_column(col)

    pannableArea = hildon.PannableArea()
    pannableArea.add(acct_tree)
    pannableArea.set_size_request_policy(hildon.SIZE_REQUEST_CHILDREN)
    vbox.pack_start(pannableArea, True, True, 0)

    bbox = gtk.HButtonBox()
    bbox.set_layout(gtk.BUTTONBOX_SPREAD)

    newBtn = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH | \
      gtk.HILDON_SIZE_FINGER_HEIGHT, \
      hildon.BUTTON_ARRANGEMENT_VERTICAL)
    newBtn.set_text("Add Account", "")
    newBtn.connect("clicked", add_google_acct, win)
    bbox.pack_start(newBtn, False, False, 0)

    editBtn = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH | \
      gtk.HILDON_SIZE_FINGER_HEIGHT, \
      hildon.BUTTON_ARRANGEMENT_VERTICAL)
    editBtn.set_text("Edit Account", "")
    editBtn.connect("clicked", edit_google_acct, win)
    bbox.pack_start(editBtn, False, False, 0)

    delBtn = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH | \
      gtk.HILDON_SIZE_FINGER_HEIGHT, \
      hildon.BUTTON_ARRANGEMENT_VERTICAL)
    delBtn.set_text("Remove Account", "")
    delBtn.connect("clicked", del_google_acct, win)
    bbox.pack_start(delBtn, False, False, 0)

    doneBtn = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH | \
      gtk.HILDON_SIZE_FINGER_HEIGHT, \
      hildon.BUTTON_ARRANGEMENT_VERTICAL)
    doneBtn.set_text("Done", "")
    doneBtn.connect("clicked", lambda w, d: d.destroy(), win)
    bbox.pack_start(doneBtn, False, False, 20)

    vbox.pack_end(bbox, False, True, 0)
    win.vbox.add(vbox)
    win.connect("delete-event", lambda w, d: w.destroy())
    win.show_all()
    win.run()
Beispiel #2
0
    def _on_show_tools(self, caller, data=None):
        dialog = gtk.Dialog("Tools", self.window,
                            gtk.DIALOG_DESTROY_WITH_PARENT,
                            (gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
        #dialog.set_size_request(800, 480)

        list = dialog.vbox

        button = hildon.Button(gtk.HILDON_SIZE_FINGER_HEIGHT,
                               hildon.BUTTON_ARRANGEMENT_VERTICAL)
        button.set_label("Coordinate Projection")
        button.connect("clicked", self._show_tool_heading, None)
        button.connect("clicked", lambda caller: dialog.hide())
        list.pack_start(button)

        button = hildon.Button(gtk.HILDON_SIZE_FINGER_HEIGHT,
                               hildon.BUTTON_ARRANGEMENT_VERTICAL)
        button.set_label("ROT13")
        button.connect("clicked", self._show_tool_rot13, None)
        button.connect("clicked", lambda caller: dialog.hide())
        list.pack_start(button)

        button = hildon.Button(gtk.HILDON_SIZE_FINGER_HEIGHT,
                               hildon.BUTTON_ARRANGEMENT_VERTICAL)
        button.set_label("Roman Numbers")
        button.connect("clicked", self._show_tool_romans, None)
        button.connect("clicked", lambda caller: dialog.hide())
        list.pack_start(button)

        dialog.show_all()
        dialog.run()
        dialog.hide()
Beispiel #3
0
    def create_ui_downloaded(self):
        play_button = hildon.Button(self.BUTTON_HEIGHT,
                                    hildon.BUTTON_ARRANGEMENT_HORIZONTAL)
        shownotes_button = hildon.Button(self.BUTTON_HEIGHT,
                                         hildon.BUTTON_ARRANGEMENT_VERTICAL)
        delete_button = hildon.Button(self.BUTTON_HEIGHT,
                                      hildon.BUTTON_ARRANGEMENT_VERTICAL)
        keep_button = hildon.CheckButton(gtk.HILDON_SIZE_FINGER_HEIGHT
                                         | gtk.HILDON_SIZE_AUTO_WIDTH)
        keep_button.set_label(_('Keep episode'))
        keep_button.connect('toggled', self.on_keep_toggled)

        self.action_play.set_property('label', _('Play'))
        self.radio_action_mark_new.set_property('label', _('Unplayed'))
        self.radio_action_mark_old.set_property('label', _('Played'))

        self.action_play.connect_proxy(play_button)
        self.action_shownotes.connect_proxy(shownotes_button)
        self.action_delete.connect_proxy(delete_button)

        if self.episode.total_time > 0:
            play_button.set_title(self.action_play.props.label)

        keep_button.set_active(self.episode.is_locked)
        self.new_keep_value = self.episode.is_locked

        self.action_delete.set_sensitive(not self.new_keep_value)

        table = gtk.Table(2, 2, True)
        table.attach(play_button, 0, 1, 0, 1)
        table.attach(shownotes_button, 1, 2, 0, 1)
        table.attach(delete_button, 0, 1, 1, 2)
        table.attach(keep_button, 1, 2, 1, 2)
        return table
Beispiel #4
0
 def test_constructor(self):
     self.assertRaises(TypeError, hildon.Button)
     b = hildon.Button(gtk.HILDON_SIZE_AUTO,
                       hildon.BUTTON_ARRANGEMENT_VERTICAL)
     self.assertTrue(type(b) is hildon.Button)
     b = hildon.Button(gtk.HILDON_SIZE_AUTO,
                       hildon.BUTTON_ARRANGEMENT_VERTICAL, "title")
     self.assertTrue(type(b) is hildon.Button)
     b = hildon.Button(gtk.HILDON_SIZE_AUTO,
                       hildon.BUTTON_ARRANGEMENT_VERTICAL, "title", "value")
     self.assertTrue(type(b) is hildon.Button)
Beispiel #5
0
 def _get_search_button(self):
     button1 = hildon.Button(gtk.HILDON_SIZE_AUTO,
                             hildon.BUTTON_ARRANGEMENT_VERTICAL)
     button1.set_title("Search Geocaches")
     button1.set_value("in local database")
     button1.connect("clicked", self._on_show_search, None)
     return button1
Beispiel #6
0
def display(win):
    global text_area

    dialog = gtk.Dialog()
    dialog.set_title("Log")

    text_area = hildon.TextView()
    text_area.set_editable(False)
    text_area.set_cursor_visible(False)

    pannableArea = hildon.PannableArea()
    pannableArea.add(text_area)
    pannableArea.set_property("mov-mode", hildon.MOVEMENT_MODE_BOTH)
    pannableArea.set_size_request_policy(hildon.SIZE_REQUEST_CHILDREN)
    # WTF?
    pannableArea.set_size_request(300, 300)

    dialog.vbox.pack_start(pannableArea, True, True, 10)

    close_btn = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH | \
      gtk.HILDON_SIZE_FINGER_HEIGHT, \
      hildon.BUTTON_ARRANGEMENT_VERTICAL)
    close_btn.connect("clicked", lambda w, d: d.destroy(), dialog)
    close_btn.set_text("Close", "")

    dialog.vbox.add(close_btn)

    dialog.connect("delete-event", lambda w, d: w.destroy())
    display_ring_buffer()
    dialog.show_all()
    dialog.run()
Beispiel #7
0
 def _get_search_place_button(self):
     button = hildon.Button(gtk.HILDON_SIZE_FINGER_HEIGHT,
                            hildon.BUTTON_ARRANGEMENT_VERTICAL)
     button.set_title("Search Place")
     button.set_value('requires internet')
     button.connect('clicked', self._on_show_search_place)
     return button
Beispiel #8
0
def configure(widget, win):
    window = hildon.StackableWindow()
    window.set_title(settings.app_name + " - Settings")

    conn = sqlite3.connect(settings.db_path)
    c = conn.execute("select value from config where name=?", ('user',))
    user = c.fetchone()
    conn.close()

    label = gtk.Label("Username")
    entry = hildon.Entry(gtk.HILDON_SIZE_AUTO)
    entry.set_max_length(64)
    if user is not None:
        entry.set_text(user[0])

    save_button = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH |
                                gtk.HILDON_SIZE_FINGER_HEIGHT,
                                hildon.BUTTON_ARRANGEMENT_HORIZONTAL)
    save_button.set_text("Save new settings", "")
    save_button.connect("clicked", save_settings, window, win, entry)

    uname_box = gtk.HBox(False, 0)
    uname_box.pack_start(label, False, False, 20)
    uname_box.pack_start(entry, True, True, 10)

    save_box = gtk.HBox(False, 0)
    save_box.pack_start(save_button, True, False, 0)

    vbox = gtk.VBox(False, 0)
    vbox.pack_start(uname_box, False, False, 20)
    vbox.pack_start(save_box, False, False, 0)

    window.add(vbox)
    window.show_all()
Beispiel #9
0
 def _get_about_button(self):
     button = hildon.Button(gtk.HILDON_SIZE_AUTO,
                            hildon.BUTTON_ARRANGEMENT_VERTICAL)
     button.set_title("About AGTL")
     button.set_value("and online update")
     button.connect("clicked", self._on_show_about, None)
     return button
Beispiel #10
0
 def _get_download_map_button(self):
     button = hildon.Button(gtk.HILDON_SIZE_AUTO,
                            hildon.BUTTON_ARRANGEMENT_VERTICAL)
     button.set_title("Download Map")
     button.set_value("for offline use")
     button.connect("clicked", self._on_show_download_map, None)
     return button
Beispiel #11
0
def create_remote_selector(win):
	global remote_sources
	global google_new_btn
	global google_item_picker
	global remote_selector

	remote_selector = hildon.TouchSelector()

	remote_sources = gtk.ListStore(str, str)
	renderer = gtk.CellRendererText()
	column = remote_selector.append_column(remote_sources, renderer, text=1)
	column.set_property("text-column", 1)

	google_item_picker = hildon.PickerButton(gtk.HILDON_SIZE_AUTO | \
			gtk.HILDON_SIZE_FINGER_HEIGHT, \
			hildon.BUTTON_ARRANGEMENT_VERTICAL)
	google_item_picker.set_title("Remote Source")
	google_item_picker.set_selector(remote_selector)
	google_item_picker.set_sensitive(False)

	google_new_btn = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH | \
			gtk.HILDON_SIZE_FINGER_HEIGHT, \
			hildon.BUTTON_ARRANGEMENT_HORIZONTAL)
	google_new_btn.set_label("New...")
	google_new_btn.connect("clicked", new_remote_source, "hint")
	google_new_btn.set_sensitive(False)

	hbox = gtk.HBox()
	hbox.pack_start(google_item_picker)
	hbox.pack_start(google_new_btn, False, False, 30)

	return hbox
Beispiel #12
0
def create_local_selector(win):
	global local_source_list
	global local_selector

	local_selector = hildon.TouchSelector()
	local_source_list = gtk.ListStore(int, str)

	renderer = gtk.CellRendererText()
	column = local_selector.append_column(local_source_list, renderer, text=1)
	column.set_property("text-column", 1)

	picker = hildon.PickerButton(gtk.HILDON_SIZE_AUTO | \
			gtk.HILDON_SIZE_FINGER_HEIGHT, 
			hildon.BUTTON_ARRANGEMENT_VERTICAL)
	picker.set_title("Local Source")
	picker.set_selector(local_selector)

	new_btn = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH | \
			gtk.HILDON_SIZE_FINGER_HEIGHT, \
			hildon.BUTTON_ARRANGEMENT_HORIZONTAL)
	new_btn.set_label("New...")
	new_btn.connect("clicked", new_local_source, "hint")

	hbox = gtk.HBox()
	hbox.pack_start(picker)
	hbox.pack_start(new_btn, False, False, 30)

	return hbox
Beispiel #13
0
def create_settings_buttons(win):
    global google_accts_btn

    google_accts_btn = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH | \
     gtk.HILDON_SIZE_FINGER_HEIGHT, \
     hildon.BUTTON_ARRANGEMENT_VERTICAL)
    google_accts_btn.connect("clicked", google_accounts_win, win)
    update_gaccts_button()
Beispiel #14
0
 def Button(self, label=""):
     """return hildon button"""
     import gtk
     import hildon
     #    b = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT, hildon.BUTTON_ARRANGEMENT_VERTICAL)
     b = hildon.Button(gtk.HILDON_SIZE_FINGER_HEIGHT,
                       hildon.BUTTON_ARRANGEMENT_VERTICAL)
     b.set_title(label)
     return b
Beispiel #15
0
    def create_ui_not_downloaded(self):
        download_button = hildon.Button(self.BUTTON_HEIGHT,
                                        hildon.BUTTON_ARRANGEMENT_HORIZONTAL)
        shownotes_button = hildon.Button(self.BUTTON_HEIGHT,
                                         hildon.BUTTON_ARRANGEMENT_VERTICAL)
        play_button = hildon.Button(self.BUTTON_HEIGHT,
                                    hildon.BUTTON_ARRANGEMENT_HORIZONTAL)
        mark_new_button = hildon.GtkRadioButton(gtk.HILDON_SIZE_FINGER_HEIGHT
                                                | gtk.HILDON_SIZE_AUTO_WIDTH)
        mark_old_button = hildon.GtkRadioButton(
            gtk.HILDON_SIZE_FINGER_HEIGHT | gtk.HILDON_SIZE_AUTO_WIDTH,
            mark_new_button)

        marknew_actions = gtk.HBox(homogeneous=True)
        for button in (mark_new_button, mark_old_button):
            button.set_mode(False)
            marknew_actions.add(button)

        self.action_play.set_property('label', _('Stream'))
        self.radio_action_mark_new.set_property('label', _('New episode'))
        self.radio_action_mark_old.set_property('label', _('Old episode'))

        self.action_download.connect_proxy(download_button)
        self.action_shownotes.connect_proxy(shownotes_button)
        self.action_play.connect_proxy(play_button)
        self.radio_action_mark_new.connect_proxy(mark_new_button)
        self.radio_action_mark_old.connect_proxy(mark_old_button)

        if self.episode.length > 0:
            download_button.set_title(self.action_download.props.label)
            download_button.set_value(self.episode.get_filesize_string())

        if self.episode.total_time > 0:
            play_button.set_title(self.action_play.props.label)

        mark_new_button.set_active(not self.episode.is_played)
        mark_old_button.set_active(self.episode.is_played)

        table = gtk.Table(2, 2, True)
        table.attach(download_button, 0, 1, 0, 1)
        table.attach(shownotes_button, 1, 2, 0, 1)
        table.attach(play_button, 0, 1, 1, 2)
        table.attach(marknew_actions, 1, 2, 1, 2)
        return table
Beispiel #16
0
    def plugin_init(self):
        #self.update_fieldnotes_display()
        self.core.connect('fieldnotes-changed', self._on_fieldnotes_changed)
        logger.info("Using Fieldnotes plugin")

        button = hildon.Button(gtk.HILDON_SIZE_FINGER_HEIGHT,
                               hildon.BUTTON_ARRANGEMENT_VERTICAL)
        button.set_title("Upload Logs/Fieldnotes")
        button.set_value("You have not created any logs/fieldnotes.")
        button.connect("clicked", self._on_upload_fieldnotes, None)
        self.button_fieldnotes = button
Beispiel #17
0
    def create_ui_downloading(self):
        pause_button = hildon.Button(self.BUTTON_HEIGHT,
                                     hildon.BUTTON_ARRANGEMENT_VERTICAL)
        shownotes_button = hildon.Button(self.BUTTON_HEIGHT,
                                         hildon.BUTTON_ARRANGEMENT_VERTICAL)
        cancel_button = hildon.Button(self.BUTTON_HEIGHT,
                                      hildon.BUTTON_ARRANGEMENT_VERTICAL)
        downloads_button = hildon.Button(self.BUTTON_HEIGHT,
                                         hildon.BUTTON_ARRANGEMENT_VERTICAL)

        self.action_pause_resume.connect_proxy(pause_button)
        self.action_shownotes.connect_proxy(shownotes_button)
        self.action_cancel.connect_proxy(cancel_button)
        self.action_open_downloads.connect_proxy(downloads_button)

        table = gtk.Table(2, 2, True)
        table.attach(pause_button, 0, 1, 0, 1)
        table.attach(shownotes_button, 1, 2, 0, 1)
        table.attach(cancel_button, 0, 1, 1, 2)
        table.attach(downloads_button, 1, 2, 1, 2)
        return table
Beispiel #18
0
    def create_mark_as_read_button(self):
        button = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH |
                               gtk.HILDON_SIZE_FINGER_HEIGHT,
                               hildon.BUTTON_ARRANGEMENT_VERTICAL)
        button.set_text("", "Mark all as read so far")
        button.connect("clicked", self.mark_all_as_read)

        image = gtk.image_new_from_stock(gtk.STOCK_APPLY, gtk.ICON_SIZE_BUTTON)
        button.set_image(image)
        button.set_image_position(gtk.POS_RIGHT)

        return button
Beispiel #19
0
 def create_secondary_toolbar(self):
     self.stb_add = gtk.ToolItem()
     self.stb_addbutton = hildon.Button(
         gtk.HILDON_SIZE_AUTO, hildon.BUTTON_ARRANGEMENT_HORIZONTAL,
         None, "Add record")
     image = gtk.image_new_from_stock(gtk.STOCK_ADD,
                                      gtk.ICON_SIZE_BUTTON)
     self.stb_addbutton.set_image(image)
     self.stb_add.add(self.stb_addbutton)
     self.stb_addbutton.connect("clicked", callbacks.newrecord, self,
                                True)
     FuelpadAbstractWindow.create_secondary_toolbar(self)
Beispiel #20
0
        def create_mainwin_menu(self, vbox):

            self.main_menu = hildon.AppMenu()

            self.mm_item_new = hildon.Button(
                gtk.HILDON_SIZE_AUTO, hildon.BUTTON_ARRANGEMENT_VERTICAL,
                "Add record", None)
            self.main_menu.append(self.mm_item_new)

            self.mm_item_edit = hildon.Button(
                gtk.HILDON_SIZE_AUTO, hildon.BUTTON_ARRANGEMENT_VERTICAL,
                "Edit record", None)
            self.main_menu.append(self.mm_item_edit)

            self.mm_item_delete = hildon.Button(
                gtk.HILDON_SIZE_AUTO, hildon.BUTTON_ARRANGEMENT_VERTICAL,
                "Delete record", None)
            self.main_menu.append(self.mm_item_delete)

            self.mm_item_settings = hildon.Button(
                gtk.HILDON_SIZE_AUTO, hildon.BUTTON_ARRANGEMENT_VERTICAL,
                "Settings", None)
            self.main_menu.append(self.mm_item_settings)

            self.mm_item_about = hildon.Button(
                gtk.HILDON_SIZE_AUTO, hildon.BUTTON_ARRANGEMENT_VERTICAL,
                "About ...", None)
            self.main_menu.append(self.mm_item_about)

            self.mm_item_new.connect("clicked", callbacks.newrecord, self)
            self.mm_item_edit.connect("clicked", callbacks.editrecord, self)
            self.mm_item_settings.connect("clicked", callbacks.settings, self)
            self.mm_item_delete.connect("clicked", callbacks.deleterecord,
                                        self)
            self.mm_item_about.connect("clicked", callbacks.about, self)

            self.set_app_menu(self.main_menu)

            FuelpadAbstractWindow.create_mainwin_menu(self, vbox)
Beispiel #21
0
def create_ui(win):

	vbox = gtk.VBox()
	pannableArea = hildon.PannableArea()

	vbox.pack_start(create_type_selector())
	vbox.pack_start(create_source_selector())
	vbox.pack_start(create_account_selector())
	vbox.pack_start(create_local_selector(win))
	vbox.pack_start(create_remote_selector(win))
	vbox.pack_start(create_enable_button())
	vbox.pack_start(create_direction_selector())

	pannableArea.set_size_request_policy(hildon.SIZE_REQUEST_CHILDREN)
	pannableArea.add_with_viewport(vbox)

	win.vbox.pack_start(pannableArea)

	bbox = gtk.HButtonBox()
	bbox.set_layout(gtk.BUTTONBOX_SPREAD)

	addBtn = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH | \
			gtk.HILDON_SIZE_FINGER_HEIGHT, \
			hildon.BUTTON_ARRANGEMENT_VERTICAL)
	addBtn.set_text("Save profile", "")

	addBtn.connect("clicked", add_profile, win)
	bbox.pack_end(addBtn, False, False, 0)

	cancelBtn = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH | \
			gtk.HILDON_SIZE_FINGER_HEIGHT, \
			hildon.BUTTON_ARRANGEMENT_VERTICAL)
	cancelBtn.set_text("Cancel", "")
	cancelBtn.connect("clicked", lambda d,w: w.destroy(), win)
	bbox.pack_start(cancelBtn, False, False, 0)
	
	win.vbox.pack_end(bbox, False, False, 0)
Beispiel #22
0
 def __init__(self):
     # hildon has one program instance per app, so get instance
     self.p = hildon.Program.get_instance()
     # set name of application: this shows in titlebar
     gtk.set_application_name("Maemo GStreamer VideoTest")
     # stackable window in case we want more windows in future in app
     self.w = hildon.StackableWindow()
     box = gtk.VBox()
     self.video_widget = VideoWidget()
     # video widget we want to expand to size
     box.pack_start(self.video_widget, True, True, 0)
     # a button finger height to play/pause 
     self.button = hildon.Button(gtk.HILDON_SIZE_FINGER_HEIGHT,
         hildon.BUTTON_ARRANGEMENT_VERTICAL, title="Pause")
     self.button.connect_after("clicked", self.on_button_clicked)
     # don't want button to expand or fill, just stay finger height
     box.pack_start(self.button, False, False, 0)
     self.w.add(box)
     self.w.connect("delete-event", gtk.main_quit)
     self.p.add_window(self.w)
     self.w.show_all()
     self.start_streaming()
Beispiel #23
0
 def _get_write_fieldnote_button(self):
     button = hildon.Button(gtk.HILDON_SIZE_FINGER_HEIGHT,
                            hildon.BUTTON_ARRANGEMENT_VERTICAL)
     button.set_label("Write Log/Fieldnote")
     button.connect("clicked", self._on_show_log_fieldnote_dialog, None)
     return button
Beispiel #24
0
 def create_button(self, name, value=None):
     '''
     goodies to create a button for this view
     '''
     return hildon.Button(gtk.HILDON_SIZE_THUMB_HEIGHT,
                          hildon.BUTTON_ARRANGEMENT_HORIZONTAL, name, value)
Beispiel #25
0
    def __init__(self, weboob):
        self.touch_selector_entry_filled = False
        self.refresh_in_progress = False
        self.connected = False
        self.weboob = weboob
        try:
            self.connection = conic.Connection()
            self.connection.connect("connection-event", self.connect_event)
            self.connection.set_property("automatic-connection-events", True)
            self.connection.request_connection(conic.CONNECT_FLAG_NONE)
        except NotImplementedError:
            pass

        horizontal_box = gtk.HBox()
        self.main_window = toolkit.Window()
        try:
            self.refresh_button = toolkit.Button(
                gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT,
                hildon.BUTTON_ARRANGEMENT_HORIZONTAL, "Actualiser")
            self.retour_button = hildon.Button(
                gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT,
                hildon.BUTTON_ARRANGEMENT_HORIZONTAL, "Retour")
            self.combo_source = hildon.TouchSelectorEntry(text=True)
            self.combo_dest = hildon.TouchSelectorEntry(text=True)
            self.picker_button_source = hildon.PickerButton(
                gtk.HILDON_SIZE_AUTO, hildon.BUTTON_ARRANGEMENT_VERTICAL)

            self.picker_button_dest = hildon.PickerButton(
                gtk.HILDON_SIZE_AUTO, hildon.BUTTON_ARRANGEMENT_VERTICAL)
            self.picker_button_source.set_sensitive(False)
            self.picker_button_dest.set_sensitive(False)

            self.picker_button_source.set_title("Gare de Depart")
            self.picker_button_dest.set_title("Gare d'arrivee")

            self.picker_button_source.set_selector(self.combo_source)
            self.picker_button_dest.set_selector(self.combo_dest)
            horizontal_box.pack_start(self.picker_button_source)
            horizontal_box.pack_start(self.picker_button_dest)

        except AttributeError:
            self.refresh_button = gtk.Button("Actualiser")
            self.retour_button = gtk.Button("Retour")
            self.combo_source = gtk.combo_box_entry_new_text()
            self.combo_dest = gtk.combo_box_entry_new_text()
            horizontal_box.pack_start(self.combo_source)
            horizontal_box.pack_start(self.combo_dest)

        self.main_window.set_title("Horaires des Prochains Trains")
        self.main_window.connect("destroy", self.on_main_window_destroy)

        self.refresh_button.connect("clicked", self.on_refresh_button_clicked)

        self.retour_button.set_sensitive(False)
        self.retour_button.connect("clicked", self.on_retour_button_clicked)

        self.treestore = gtk.TreeStore(str, str, str, str, str)
        treeview = gtk.TreeView(self.treestore)

        treeview.append_column(
            gtk.TreeViewColumn('Train', gtk.CellRendererText(), text=0))

        treeview.append_column(
            gtk.TreeViewColumn('Horaire', gtk.CellRendererText(), text=1))

        treeview.append_column(
            gtk.TreeViewColumn('Destination', gtk.CellRendererText(), text=2))
        treeview.append_column(
            gtk.TreeViewColumn('Voie', gtk.CellRendererText(), text=3))
        treeview.append_column(
            gtk.TreeViewColumn('Information', gtk.CellRendererText(), text=4))

        vertical_box = gtk.VBox()
        vertical_box.pack_start(horizontal_box)
        horizontal_box.pack_start(self.retour_button)
        vertical_box.pack_start(treeview)
        vertical_box.pack_start(self.refresh_button)

        self.main_window.add(vertical_box)
        self.main_window.show_all()
        self.fill_touch_selector_entry()

        if toolkit != gtk:
            self.picker_button_source.connect("value-changed",
                                              self.check_station_input,
                                              self.picker_button_source)
            self.picker_button_dest.connect("value-changed",
                                            self.check_station_input,
                                            self.picker_button_dest)
Beispiel #26
0
    def __init__(self,
                 spawner=None,
                 tonumber=None,
                 withfile=None,
                 subject=None,
                 message=None,
                 forward=None):
        hildon.Program.__init__(self)
        program = hildon.Program.get_instance()

        self.ch = ContactH.ContactHandler()
        self.cont = fMMSController.fMMS_controllerGTK()
        self.config = self.cont.config
        self.subject = subject
        self.osso_c = osso.Context("fMMS", "1.0", False)

        self.window = hildon.StackableWindow()
        self.window.set_title(
            gettext.ldgettext('rtcom-messaging-ui', "messaging_ti_new_mms"))
        if subject:
            try:
                self.window.set_title(subject)
            except:
                pass
        program.add_window(self.window)

        self.window.connect("delete_event", self.quit)
        self.attachmentFile = ""

        draftfile = False
        # got spawner and not a forward and not a reply
        if spawner != None and forward == None and tonumber == None:
            self.spawner = spawner
            (tonumber, message, tmpfn) = self.cont.get_draft()
            if tmpfn != "" and tmpfn != "None" and os.path.isfile(tmpfn):
                withfile = tmpfn
                self.attachmentFile = tmpfn
                draftfile = True
        # forwarding/replying message
        elif spawner != None and (forward or tonumber != None):
            self.spawner = spawner
        else:
            self.spawner = self.window
        allBox = gtk.VBox()
        """ Begin top section """
        topHBox1 = gtk.HBox()

        bTo = hildon.Button(gtk.HILDON_SIZE_FINGER_HEIGHT, hildon.BUTTON_ARRANGEMENT_HORIZONTAL, \
               gettext.ldgettext('rtcom-messaging-ui', "messaging_fi_new_sms_to"))
        bTo.connect('clicked', self.open_contacts_dialog)
        bTo.set_size_request(128, gtk.HILDON_SIZE_FINGER_HEIGHT)
        self.eNumber = hildon.Entry(gtk.HILDON_SIZE_FINGER_HEIGHT)
        if tonumber != None:
            self.eNumber.set_text(tonumber)

        self.bSend = hildon.Button(gtk.HILDON_SIZE_FINGER_HEIGHT,
                                   hildon.BUTTON_ARRANGEMENT_HORIZONTAL)
        self.bSend.connect('clicked', self.send_mms_clicked)
        icon_theme = gtk.icon_theme_get_default()
        sendPixbuf = icon_theme.load_icon("email_message_send", 48, 0)
        sendImage = gtk.Image()
        sendImage.set_from_pixbuf(sendPixbuf)
        #sendImage.set_alignment(1, 0.5)
        self.bSend.set_image(sendImage)
        self.bSend.set_size_request(128, gtk.HILDON_SIZE_FINGER_HEIGHT)

        topHBox1.pack_start(bTo, False, True, 0)
        topHBox1.pack_start(self.eNumber, True, True, 5)
        topHBox1.pack_start(self.bSend, False, True, 0)
        """ Begin midsection """
        pan = hildon.PannableArea()
        pan.set_property("mov-mode", hildon.MOVEMENT_MODE_BOTH)
        midBox = gtk.VBox()
        centerBox = gtk.HBox()
        self.imageBox = gtk.EventBox()
        self.imageBox.set_size_request(400, 200)

        self.imageBoxContent = gtk.Fixed()
        border = gtk.Image()
        border.set_from_file("/opt/fmms/dotted_border.png")
        addimglabel = gtk.Label(
            gettext.ldgettext('modest', "mcen_me_editor_attach_inlineimage"))
        addimglabel.set_justify(gtk.JUSTIFY_CENTER)
        addimglabel.set_size_request(300, 50)

        self.imageBoxContent.put(border, 0, 0)
        self.imageBoxContent.put(addimglabel, 50, 100)

        self.imageBox.add(self.imageBoxContent)
        self.imageBox.connect('button-press-event', self.open_file_dialog)

        centerBox.pack_start(self.imageBox, True, False, 0)

        self.tvMessage = hildon.TextView()
        self.tvMessage.set_property("name", "hildon-fullscreen-textview")
        self.tvMessage.set_wrap_mode(gtk.WRAP_WORD_CHAR)
        self.tvMessage.set_justification(gtk.JUSTIFY_LEFT)
        if message != None and message != '':
            tb = gtk.TextBuffer()
            tb.set_text(message)
            self.tvMessage.set_buffer(tb)

        midBox.pack_start(centerBox)
        midBox.pack_start(self.tvMessage)

        pan.add_with_viewport(midBox)

        # Copy the file to our tempdir in case sharing service removes it
        if withfile and not draftfile:
            filename = os.path.basename(withfile)
            dst = "%s/%s" % (self.config.get_imgdir(), filename)
            log.info("Copying file to: %s" % dst)
            copy(withfile, dst)
            self.attachmentFile = dst
            self.fromSharingService = True
            self.fromSharingFile = dst
        if withfile or draftfile:
            try:
                self.set_thumbnail(self.attachmentFile)
            except:
                log.exception("wtf: %s" % self.attachmentFile)
        """ Show it all! """
        allBox.pack_start(topHBox1, False, False)
        allBox.pack_start(pan, True, True)
        #allBox.pack_start(self.botHBox, False, False)

        align = gtk.Alignment(1, 1, 1, 1)
        align.set_padding(2, 2, 10, 10)
        align.add(allBox)

        self.window.add(align)
        self.window.show_all()

        self.menu = self.cont.create_menu(self.window)
        self.window.set_app_menu(self.menu)

        self.add_window(self.window)

        # so appearently throwing an exception here
        # makes osso-abook always load the contacts...
        self.this_doesnt_exist()
Beispiel #27
0
 def _get_tools_button(self):
     button1 = hildon.Button(gtk.HILDON_SIZE_AUTO,
                             hildon.BUTTON_ARRANGEMENT_VERTICAL)
     button1.set_title("Tools")
     button1.connect("clicked", self._on_show_tools)
     return button1
Beispiel #28
0
    def _display_results(self, caches, truncated):
        sortfuncs = [
            ('Dist', lambda x, y: cmp(x.prox, y.prox)),
            ('Name', lambda x, y: cmp(x.title, y.title)),
            ('Diff',
             lambda x, y: cmp(x.difficulty
                              if x.difficulty > 0 else 100, y.difficulty
                              if y.difficulty > 0 else 100)),
            ('Terr', lambda x, y: cmp(x.terrain
                                      if x.terrain > 0 else 100, y.terrain
                                      if y.terrain > 0 else 100)),
            ('Size', lambda x, y: cmp(x.size if x.size > 0 else 100, y.size
                                      if y.size > 0 else 100)),
            ('Type', lambda x, y: cmp(x.type, y.type)),
        ]

        if self.gps_data != None and self.gps_data.position != None:
            for c in caches:
                c.prox = c.distance_to(self.gps_data.position)
        else:
            for c in caches:
                c.prox = None

        win = hildon.StackableWindow()
        win.set_title("Search results")
        ls = gtk.ListStore(str, str, str, str, object)

        tv = hildon.TouchSelector()
        col1 = tv.append_column(ls, gtk.CellRendererText())

        c1cr = gtk.CellRendererText()
        c1cr.ellipsize = pango.ELLIPSIZE_MIDDLE
        c2cr = gtk.CellRendererText()
        c3cr = gtk.CellRendererText()
        c4cr = gtk.CellRendererText()

        col1.pack_start(c1cr, True)
        col1.pack_end(c2cr, False)
        col1.pack_start(c3cr, False)
        col1.pack_end(c4cr, False)

        col1.set_attributes(c1cr, text=0)
        col1.set_attributes(c2cr, text=1)
        col1.set_attributes(c3cr, text=2)
        col1.set_attributes(c4cr, text=3)

        def select_cache(widget, data, more):
            self.show_cache(self._get_selected(tv)[4])

        tv.connect("changed", select_cache, None)

        def on_change_sort(widget, sortfunc):
            tv.handler_block_by_func(select_cache)
            ls.clear()
            caches.sort(cmp=sortfunc)
            for c in caches:
                ls.append([
                    self.shorten_name(c.title, 40), " " + c.get_size_string(),
                    ' D%s T%s' % (c.get_difficulty(), c.get_terrain()),
                    " " + geo.Coordinate.format_distance(c.prox), c
                ])
            tv.handler_unblock_by_func(select_cache)

        menu = hildon.AppMenu()
        button = None
        for name, function in sortfuncs:
            button = hildon.GtkRadioButton(gtk.HILDON_SIZE_AUTO, button)
            button.set_label(name)
            button.connect("clicked", on_change_sort, function)
            menu.add_filter(button)
            button.set_mode(False)

        def download_geocaches(widget):
            self.core.download_cache_details_list(caches)

        button = hildon.Button(gtk.HILDON_SIZE_AUTO,
                               hildon.BUTTON_ARRANGEMENT_VERTICAL)
        button.set_title("Download Details")
        button.set_value("for all Geocaches")
        button.connect("clicked", download_geocaches)
        menu.append(button)

        menu.show_all()
        win.set_app_menu(menu)
        win.add(tv)

        on_change_sort(None, sortfuncs[0][1])

        win.show_all()
        if truncated:
            hildon.hildon_banner_show_information_with_markup(
                win, "hu", "Showing only the first %d results." % len(caches))

        win.connect('delete_event', self.hide_search_view)
Beispiel #29
0
    def show_add_podcast_picker(cls, parent, toplist_url, opml_url, \
            add_urls_callback, subscribe_to_url_callback, \
            my_gpodder_callback, show_text_edit_dialog):
        dialog = gtk.Dialog(_('Select a source'), parent)
        pannable_area = hildon.PannableArea()
        pannable_area.set_size_request_policy(hildon.SIZE_REQUEST_CHILDREN)
        dialog.vbox.pack_start(pannable_area, expand=True)
        vbox = gtk.VBox(spacing=1)
        pannable_area.add_with_viewport(vbox)

        def load_opml_from_url(url):
            if url is not None:
                o = cls(parent, add_urls_callback=add_urls_callback)
                o.download_opml_file(url)

        def choice_enter_feed_url(widget):
            dialog.destroy()
            subscribe_to_url_callback()

        def choice_load_opml_from_url(widget):
            dialog.destroy()
            url = show_text_edit_dialog(_('Load OPML file from the web'), \
                    _('URL:'), is_url=True, affirmative_text=_('Load'))
            load_opml_from_url(url)

        def choice_search_mygpo(widget):
            dialog.destroy()
            search_term = show_text_edit_dialog(\
                    _('Search on gpodder.net'), \
                    _('Search for:'), affirmative_text=_('Search'))
            if search_term is not None:
                url = 'http://gpodder.net/search.opml?q=%s' % (
                    urllib.quote(search_term), )
                load_opml_from_url(url)

        def choice_load_opml_from_file(widget):
            dialog.destroy()
            dlg = gobject.new(hildon.FileChooserDialog, \
                    action=gtk.FILE_CHOOSER_ACTION_OPEN)
            dlg.set_title(_('Open OPML file'))
            dlg.show_all()
            dlg.run()
            filename = dlg.get_filename()
            dlg.hide()
            if filename is not None:
                load_opml_from_url(filename)

        def choice_load_examples(widget):
            dialog.destroy()
            load_opml_from_url(opml_url)

        def choice_load_toplist(widget):
            dialog.destroy()
            load_opml_from_url(toplist_url)

        def choice_search_youtube(widget):
            dialog.destroy()
            search_term = show_text_edit_dialog(\
                    _('Search YouTube user channels'), \
                    _('Search for:'), affirmative_text=_('Search'))
            if search_term is not None:
                url = 'youtube://%s' % (search_term, )
                load_opml_from_url(url)

        def choice_mygpodder(widget):
            dialog.destroy()
            my_gpodder_callback()

        choices = (
            (_('Podcast feed/website URL'), choice_enter_feed_url),
            (_('OPML file from the web'), choice_load_opml_from_url),
            (_('Search on gpodder.net'), choice_search_mygpo),
            (_('Open OPML file'), choice_load_opml_from_file),
            (_('Example podcasts'), choice_load_examples),
            (_('Podcast Top 50'), choice_load_toplist),
            (_('Search YouTube users'), choice_search_youtube),
            (_('Download from gpodder.net'), choice_mygpodder),
        )

        for caption, handler in choices:
            button = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH | \
                    gtk.HILDON_SIZE_FINGER_HEIGHT, \
                    hildon.BUTTON_ARRANGEMENT_VERTICAL)
            button.set_text(caption, '')
            button.connect('clicked', handler)
            vbox.pack_start(button)

        dialog.show_all()
Beispiel #30
0
    def _show_tool_heading(self, caller, data=None):
        RESULT_WPT, RESULT_TARGET = range(2)
        dialog = gtk.Dialog("Coordinate Projection", self.window,
                            gtk.DIALOG_DESTROY_WITH_PARENT,
                            ("as target", RESULT_TARGET))
        if self.current_cache != None:
            dialog.add_button("add waypoint", RESULT_WPT)
        #dialog.set_size_request(800, 480)

        def select_origin(widget, data=None):
            start = self._get_best_coordinate(
            ) if origin[0] == None else origin[0]
            new = self._show_target_input_list(start, show_current=True)
            if new != None:
                origin[0] = new
                text = new.get_latlon()
                button.set_value(text)
                recalc(None)

        button = hildon.Button(gtk.HILDON_SIZE_FINGER_HEIGHT,
                               hildon.BUTTON_ARRANGEMENT_VERTICAL)
        button.set_title("Select Origin")
        button.set_value("current Target")
        button.connect("clicked", select_origin, None)
        dialog.vbox.pack_start(button)

        origin = [self.core.current_target]

        direction = hildon.Entry(gtk.HILDON_SIZE_AUTO)
        direction.set_property("hildon-input-mode",
                               gtk.HILDON_GTK_INPUT_MODE_NUMERIC)

        dialog.vbox.pack_start(
            hildon.Caption(None, "Heading in Degrees", direction, None, 0))

        distance = hildon.Entry(gtk.HILDON_SIZE_AUTO)
        distance.set_property("hildon-input-mode",
                              gtk.HILDON_GTK_INPUT_MODE_NUMERIC)
        dialog.vbox.pack_start(
            hildon.Caption(None, "Distance in Meters", distance, None, 0))

        result = gtk.Label()
        dialog.vbox.pack_start(
            hildon.Caption(None, "Resulting Point", result, None, 0))

        resulting_coordinate = [None]

        def recalc(widget):
            try:
                res = origin[0].transform(-float(direction.get_text()),
                                          float(distance.get_text()))
                text = res.get_latlon()
            except Exception:
                res = None
                text = 'enter values...'
            resulting_coordinate[0] = res
            result.set_text(text)

        direction.connect('changed', recalc)
        distance.connect('changed', recalc)

        dialog.show_all()
        res = dialog.run()
        dialog.hide()
        if res == RESULT_WPT:
            if resulting_coordinate[0] == None:
                return
            distance = resulting_coordinate[0].format_distance(
                float(distance.get_text()))
            heading = int(direction.get_text())
            name = "hdg %s, %d deg from %s" % (distance, heading,
                                               origin[0].get_latlon())
            self.current_cache.get_user_coordinates(None)
            self.current_cache.set_user_coordinate(
                geocaching.GeocacheCoordinate.USER_TYPE_COORDINATE,
                (resulting_coordinate[0].lat, resulting_coordinate[0].lon),
                name)
            self.core.save_cache_attribute(self.current_cache,
                                           'user_coordinates')
            self._on_cache_changed(None, self.current_cache)

        elif res == RESULT_TARGET:
            if resulting_coordinate[0] == None:
                return
            self.set_target(resulting_coordinate[0])