def showInfo(self): import gtk import hildon win = hildon.StackableWindow() win.set_title("Info") """enlarge the tabs in the notebook vertically to be more finger friendly""" enlargeTabs = 15 versionString = info.getVersionString() if versionString is None: versionString = "unknown version" notebook = gtk.Notebook() # shortcuts need to be pannable pann = hildon.PannableArea() pann.add_with_viewport(info.getShortcutsContent()) # add shortcuts tab notebook.append_page(pann, self._getLabel("Shortcuts", enlargeTabs)) # add stats tab notebook.append_page(info.getStatsContent(self.mieru), self._getLabel("Stats", enlargeTabs)) # add about tab notebook.append_page(info.getAboutContent(versionString), self._getLabel("About", enlargeTabs)) # add the notebook to the new stackable window win.add(notebook) # show it win.show_all() # start on first page notebook.set_current_page(0)
def create_mainwin_widgets(self): self.datascrollwin = hildon.PannableArea() self.datascrollwin.set_property("mov-mode", hildon.MOVEMENT_MODE_BOTH) FuelpadAbstractWindow.create_mainwin_widgets(self)
def __init__(self, controller): super(MainWindow, self).__init__() self.controller = controller # TODO: replace this with a signal self.controller.coherence_started_cb = self._coherence_started self.set_title("Mirabeau") self.set_app_menu(self._create_menu()) self.connect('delete-event', self._exit_cb) self.devices_view = DevicesView() self.devices_view.connect('row-activated', self._row_activated_cb) area = hildon.PannableArea() area.add(self.devices_view) area.show_all() self.add(area) self.status_changed_cb(CONNECTION_STATUS_DISCONNECTED, "") self.controller.load_config() self.controller.start_coherence() if self.controller.first_run: # first run, a wizard might fit better here, probably. text = _("""\ Welcome to Mirabeau! It is currently bound to your local network, if you want to browse remote MediaServers please edit the Settings. A valid GTalk/Jabber account is needed.""") note = hildon.hildon_note_new_information(self, text) response = note.run() note.destroy()
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()
def save_attachments(self, filename): src = self.cont.get_filepath_for_mms_transid(filename) attachments = self.cont.get_mms_attachments(filename) selector = hildon.TouchSelector(text=True) for fn in attachments: selector.append_text(fn) selector.set_column_selection_mode(hildon.TOUCH_SELECTOR_SELECTION_MODE_MULTIPLE) selector.unselect_all(0) pan = hildon.PannableArea() pan.set_property("mov-mode", hildon.MOVEMENT_MODE_VERT) pan.add_with_viewport(selector) pan.set_size_request_policy(hildon.SIZE_REQUEST_CHILDREN) diag = gtk.Dialog() diag.set_title(self.saveattachments) diag.set_transient_for(self.window) diag.vbox.add(pan) diag.set_size_request(-1, 320) diag.add_button(gtk.STOCK_SAVE, gtk.RESPONSE_APPLY) diag.show_all() ret = diag.run() selection = selector.get_current_text() sel_count = len(selector.get_selected_rows(0)) diag.destroy() if ret == gtk.RESPONSE_APPLY and sel_count > 0: self.choose_your_destiny(src, attachments, selection, sel_count)
def __init__(self, title="Maegen"): hildon.StackableWindow.__init__(self) self.program = hildon.Program.get_instance() self.set_title(title) container = gtk.VBox() self.centerview = gtk.VBox() self.init_center_view(self.centerview) pannable_area = hildon.PannableArea() pannable_area.set_property('mov_mode', hildon.MOVEMENT_MODE_BOTH) pannable_area.add_with_viewport(self.centerview) self.bottomButtons = gtk.HBox(homogeneous=True) self.init_bottom_button(self.bottomButtons) bottomAlign = gtk.Alignment(0.5, 0, 0, 0) bottomAlign.add(self.bottomButtons) container.pack_start(pannable_area) container.pack_start(bottomAlign, expand=False) self.add(container)
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()
def create_headers_dialog(self, fname): """ show headers in a dialog """ dialog = gtk.Dialog() dialog.set_title(self.headerstxt) dialogVBox = gtk.VBox() pan = hildon.PannableArea() pan.set_property("size-request-policy", hildon.SIZE_REQUEST_CHILDREN) allVBox = gtk.VBox() headerlist = self.cont.get_mms_headers(fname) for line in headerlist: hbox = gtk.HBox() titel = gtk.Label(line) titel.set_alignment(0, 0) titel.set_width_chars(18) label = gtk.Label(headerlist[line]) label.set_line_wrap(True) label.set_alignment(0, 0) hbox.pack_start(titel, False, False, 0) hbox.pack_start(label, False, False, 0) allVBox.pack_start(hbox) allVBox.show_all() pan.add_with_viewport(allVBox) dialog.vbox.add(pan) dialog.vbox.show_all() ret = dialog.run() dialog.destroy() return ret
def showOptions(self): import gtk import hildon win = hildon.StackableWindow() win.set_title("Options") padding = 5 vbox = gtk.VBox(False, padding) # page fitting pLabel = gtk.Label("Page") fitPickerButton = self._getFittingPickerButton("Page fitting") vbox.pack_start(pLabel, False, False, padding * 2) vbox.pack_start(fitPickerButton, False, False, 0) # GUI rotation rLabel = gtk.Label("GUI Rotation") rPickerButton = self._getRotationPickerButton("Rotation mode") vbox.pack_start(rLabel, False, False, padding * 2) vbox.pack_start(rPickerButton, False, False, 0) # kinetic scrolling ksLabel = gtk.Label("Scrolling") ksButton = self.CheckButton("Kinetic scrolling") ksButton.set_active(self.mieru.get('kineticScrolling', True)) ksButton.connect('toggled', self._toggleOptionCB, 'kineticScrolling', False) self.mieru.watch('kineticScrolling', self._updateKSCB, ksButton) vbox.pack_start(ksLabel, False, False, padding * 2) vbox.pack_start(ksButton, False, False, 0) # history hLabel = gtk.Label("History") removeItemPB = self._getRIFHPickerButton() clearHistoryButton = self.Button("Erase history") warning = "Are you sure that you want to completely erase history ?" clearHistoryButton.connect('clicked', self.areYouSureButtonCB, warning, (self._clearHistory, [])) vbox.pack_start(hLabel, False, False, padding * 2) vbox.pack_start(removeItemPB, False, False, 0) vbox.pack_start(clearHistoryButton, False, False, 0) # debug debugLabel = gtk.Label("Debug") debug1Button = self.CheckButton("Print page loading info") debug1Button.set_active(self.mieru.get('debugPageLoading', False)) debug1Button.connect('toggled', self._toggleOptionCB, 'debugPageLoading', False) vbox.pack_start(debugLabel, False, False, padding * 2) vbox.pack_start(debug1Button, False, False, 0) # as options are too long, add a pannable area pan = hildon.PannableArea() pan.add_with_viewport(vbox) win.add(pan) win.show_all()
def create_fingerscroll(): if mokoui is not None: scroll = mokoui.FingerScroll() else: scroll = hildon.PannableArea() # The following call looks ugly, but see Gnome bug 591085 gtk.Buildable.set_name(scroll, gtk.Buildable.get_name(widget)) return scroll
def __init__(self, coherence, device): super(MediaServerBrowser, self).__init__() self.set_title(device.get_friendly_name()) browse_view = MediaServerBrowseView(self, coherence, device) #browse_view.show() area = hildon.PannableArea() area.add(browse_view) area.show_all() self.add(area)
def on_licence_clicked_event(self, widget, data): dialog = gtk.Dialog() dialog.set_transient_for(self) dialog.set_title("Copyright information") dialog.add_button("Ok", gtk.RESPONSE_OK) gpl = hildon.TextView() gpl_licence = """ Maegen is a genealogical application for N900. Use it on the go to store genealogical data including individuals and relational informations. Maegen can be used to browse collected data on the device but the main goal is its capabilitie to export the database in a GEDCOM file which can be imported into any desktop genealocial application. Copyright (C) 2011 Thierry Bressure This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/> """ buffer = gtk.TextBuffer() buffer.set_text(gpl_licence) gpl.set_buffer(buffer) gpl.set_property('editable', False) pannable_area = hildon.PannableArea() pannable_area.set_property('mov_mode', hildon.MOVEMENT_MODE_BOTH) pannable_area.set_property('size-request-policy', hildon.SIZE_REQUEST_CHILDREN) pannable_area.add_with_viewport(gpl) dialog.vbox.add(pannable_area) dialog.show_all() dialog.run() dialog.destroy()
def main(): Setup() logging.basicConfig(filename=os.path.expanduser(settings.log_file), filemode='w', format=settings.log_format, level=logging.getLevelName(settings.log_level)) gtk.set_application_name(settings.app_name) program = hildon.Program.get_instance() win = hildon.StackableWindow() win.set_title(settings.app_name) win.connect("destroy", gtk.main_quit, None) hildon.hildon_gtk_window_set_progress_indicator(win, 1) win.show_all() pannable_area = hildon.PannableArea() conn = sqlite3.connect(settings.db_path) c = conn.execute("select value from config where name=?", ('user',)) user = c.fetchone() conn.close() if user is None: message = "No user set up in database." logging.error("%s" % message) message += " Please go to Settings and enter a username." info = hildon.hildon_note_new_information(win, message) response = gtk.Dialog.run(info) if response == gtk.RESPONSE_DELETE_EVENT: info.destroy() try: if user is not None: user = user[0] logging.info("Loading notices for %s" % user) nf = NoticeFetcher(user) nf.fetch() except Exception, e: message = "Problem loading notices. Is the network down?" logging.error("%s | %s" % (message, e)) hildon.hildon_banner_show_information(pannable_area, '', message)
def __init__(self, fname, standalone=False, spawner=None): self.cont = fMMSController.fMMS_controllerGTK() self.ch = ContactH.ContactHandler() self.standalone = standalone self.config = self.cont.config self._mmsdir = self.config.get_mmsdir() self._pushdir = self.config.get_pushdir() self._outdir = self.config.get_outdir() self.osso_c = osso.Context("se.frals.fmms_ui", self.config.get_version(), False) self.spawner = spawner self.window = hildon.StackableWindow() self.window.set_title("MMS") self.window.connect("delete_event", self.quit) vbox = gtk.VBox() pan = hildon.PannableArea() pan.set_property("mov-mode", hildon.MOVEMENT_MODE_BOTH) self._direction = self.cont.get_direction_mms(fname) self._parse_mms(fname, vbox) pan.add_with_viewport(vbox) align = gtk.Alignment(1, 1, 1, 1) align.set_padding(2, 2, 10, 10) align.add(pan) self.window.add(align) if not self.cont.is_mms_read(fname) and self._direction == fMMSController.MSG_DIRECTION_IN: self.cont.mark_mms_read(fname) if self.spawner: self.spawner.refreshlistview = True mms_menu = self.create_mms_menu(fname) self.window.set_app_menu(mms_menu) self.window.show_all()
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)
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()
def _on_show_about(self, widget, data): (RESPONSE_UPDATE, RESPONSE_HOMEPAGE, RESPONSE_OPTIMIZE) = range(3) dialog = gtk.Dialog("About AGTL", self.window, gtk.DIALOG_DESTROY_WITH_PARENT, ('Update', RESPONSE_UPDATE, 'Website', RESPONSE_HOMEPAGE, 'Optimize', RESPONSE_OPTIMIZE)) dialog.set_size_request(800, 800) notebook = gtk.Notebook() dialog.vbox.pack_start(notebook) page = gtk.VBox() notebook.append_page(page, gtk.Label('About')) copyright = '''Copyright (C) in most parts 2012 Daniel Fett This program is free software: you can redistribute it and/or modify \ it under the terms of the GNU General Public License as published by \ the Free Software Foundation, either version 3 of the License, or \ (at your option) any later version. This program is distributed in the hope that it will be useful, \ but WITHOUT ANY WARRANTY; without even the implied warranty of \ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \ GNU General Public License for more details. You should have received a copy of the GNU General Public License \ along with this program. If not, see http://www.gnu.org/licenses/. \ Author: Daniel Fett [email protected]''' additional = '''Neither the author nor the software is affiliated with or endorsed by any geocaching website.''' text = "%s\n\n%s\n\n" % (copyright, additional) l = gtk.Label('') import core l.set_markup("<b><u>AGTL version %s</u></b>" % core.VERSION) l.set_alignment(0, 0) page.pack_start(l, False) l = gtk.Label() l.set_line_wrap(True) l.set_alignment(0, 0) #l.set_size_request(self.window.size_request()[0] - 10, -1) l.set_markup(text) p = hildon.PannableArea() p.set_property('mov-mode', hildon.MOVEMENT_MODE_BOTH) p.add_with_viewport(l) page.pack_start(p) page = gtk.VBox() notebook.append_page(page, gtk.Label('Update')) l = gtk.Label('') import cachedownloader l.set_markup( "Website parser version %d (from %s)\n\nIf you're having trouble downloading geocaches or uploading fieldnotes, try clicking 'update' to fetch the latest website parser.\n\nAlso check the regular maemo updates from time to time." % (cachedownloader.VERSION, cachedownloader.VERSION_DATE)) l.set_alignment(0, 0) l.set_line_wrap(True) page.pack_start(l, False) page = gtk.VBox() notebook.append_page(page, gtk.Label('Files')) sizes = self.core.get_file_sizes() l = gtk.Label('') l.set_markup( "Database Size: %s\nImage Folder Size: %s\n\nClick 'optimize' to purge found geocaches and their images. Be aware that this includes your notes and calculation values for those geocaches." % (self.core.format_file_size( sizes['sqlite']), self.core.format_file_size(sizes['images']))) l.set_alignment(0, 0) l.set_line_wrap(True) page.pack_start(l, False) dialog.show_all() result = dialog.run() if result == RESPONSE_HOMEPAGE: dialog.hide() self._open_browser(None, 'https://www.danielfett.de/') return elif result == RESPONSE_UPDATE: dialog.hide() self._try_parser_update() self._on_show_about(None, None) elif result == RESPONSE_OPTIMIZE: hildon.hildon_gtk_window_set_progress_indicator(dialog, 1) self.core.optimize_data() hildon.hildon_gtk_window_set_progress_indicator(dialog, 0) dialog.hide() self._on_show_about(None, None)
def _on_show_search(self, widget, data): name = hildon.Entry(gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT) name.set_placeholder("search for name...") name_hbox = hildon.Caption(None, "Name", name, None, hildon.CAPTION_OPTIONAL) sel_dist_type = hildon.TouchSelector(text=True) sel_dist_type.append_text('anywhere') sel_dist_type.append_text('around my position') sel_dist_type.append_text('around the current map center') pick_dist_type = hildon.PickerButton( gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT, hildon.BUTTON_ARRANGEMENT_HORIZONTAL) pick_dist_type.set_selector(sel_dist_type) pick_dist_type.set_title("Search") sel_dist_type.select_iter(0, sel_dist_type.get_model(0).get_iter(1), False) list_dist_radius = (1, 5, 10, 20, 50, 100, 200) sel_dist_radius = hildon.TouchSelector(text=True) for x in list_dist_radius: sel_dist_radius.append_text('%d km' % x) pick_dist_radius = hildon.PickerButton( gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT, hildon.BUTTON_ARRANGEMENT_HORIZONTAL) pick_dist_radius.set_selector(sel_dist_radius) pick_dist_radius.set_title("Radius") pick_dist_type.connect( 'value-changed', lambda caller: pick_dist_radius.set_sensitive( sel_dist_type.get_selected_rows(0)[0][0] != 0)) sel_dist_radius.select_iter(0, sel_dist_radius.get_model(0).get_iter(1), False) sel_size = hildon.TouchSelector(text=True) sel_size.append_text('micro') sel_size.append_text('small') sel_size.append_text('regular') sel_size.append_text('huge') sel_size.append_text('other') sel_size.set_column_selection_mode( hildon.TOUCH_SELECTOR_SELECTION_MODE_MULTIPLE) pick_size = hildon.PickerButton( gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT, hildon.BUTTON_ARRANGEMENT_HORIZONTAL) pick_size.set_selector(sel_size) pick_size.set_title("Select Size(s)") for i in xrange(5): sel_size.select_iter(0, sel_size.get_model(0).get_iter(i), False) sel_type = hildon.TouchSelector(text=True) sel_type.append_text('traditional') sel_type.append_text('multi-stage') sel_type.append_text('virtual') sel_type.append_text('earth') sel_type.append_text('event') sel_type.append_text('mystery') sel_type.append_text('all') sel_type.set_column_selection_mode( hildon.TOUCH_SELECTOR_SELECTION_MODE_MULTIPLE) pick_type = hildon.PickerButton( gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT, hildon.BUTTON_ARRANGEMENT_HORIZONTAL) pick_type.set_selector(sel_type) pick_type.set_title("Select Type(s)") sel_type.unselect_all(0) sel_type.select_iter(0, sel_type.get_model(0).get_iter(6), False) sel_status = hildon.TouchSelector(text=True) sel_status.append_text('any') sel_status.append_text("Geocaches I haven't found") sel_status.append_text("Geocaches I have found") sel_status.append_text("Marked Geocaches") sel_status.append_text("Marked Geocaches I haven't found") pick_status = hildon.PickerButton( gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT, hildon.BUTTON_ARRANGEMENT_HORIZONTAL) pick_status.set_selector(sel_status) pick_status.set_title("Select Status") sel_status.unselect_all(0) sel_status.select_iter(0, sel_status.get_model(0).get_iter(0), False) sel_diff = hildon.TouchSelector(text=True) sel_diff.append_text('1..2.5') sel_diff.append_text('3..4') sel_diff.append_text('4.5..5') sel_diff.set_column_selection_mode( hildon.TOUCH_SELECTOR_SELECTION_MODE_MULTIPLE) pick_diff = hildon.PickerButton( gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT, hildon.BUTTON_ARRANGEMENT_HORIZONTAL) pick_diff.set_selector(sel_diff) pick_diff.set_title("Select Difficulty") for i in xrange(3): sel_diff.select_iter(0, sel_diff.get_model(0).get_iter(i), False) sel_terr = hildon.TouchSelector(text=True) sel_terr.append_text('1..2.5') sel_terr.append_text('3..4') sel_terr.append_text('4.5..5') sel_terr.set_column_selection_mode( hildon.TOUCH_SELECTOR_SELECTION_MODE_MULTIPLE) pick_terr = hildon.PickerButton( gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT, hildon.BUTTON_ARRANGEMENT_HORIZONTAL) pick_terr.set_selector(sel_terr) pick_terr.set_title("Select Terrain") for i in xrange(3): sel_terr.select_iter(0, sel_terr.get_model(0).get_iter(i), False) RESPONSE_SHOW_LIST, RESPONSE_RESET, RESPONSE_LAST_RESULTS = range(3) dialog = gtk.Dialog("Search", self.window, gtk.DIALOG_DESTROY_WITH_PARENT, ("OK", RESPONSE_SHOW_LIST)) dialog.add_button("Filter Map", gtk.RESPONSE_ACCEPT) if self.map_filter_active: dialog.add_button("Reset Filter", RESPONSE_RESET) if self.old_search_window != None: dialog.add_button("Last Results", RESPONSE_LAST_RESULTS) dialog.set_size_request(800, 800) pan = hildon.PannableArea() options = gtk.VBox() pan.add_with_viewport(options) dialog.vbox.pack_start(pan) options.pack_start(gtk.Label("Search Geocaches")) options.pack_start(name_hbox) options.pack_start(pick_dist_type) options.pack_start(pick_dist_radius) options.pack_start(pick_type) options.pack_start(pick_status) options.pack_start(gtk.Label("Details...")) w = gtk.Label( "If you select something here, only geocaches for which details were downloaded will be shown in the result." ) w.set_line_wrap(True) w.set_alignment(0, 0.5) options.pack_start(w) options.pack_start(pick_size) options.pack_start(pick_diff) options.pack_start(pick_terr) while True: dialog.show_all() response = dialog.run() dialog.hide() if response == RESPONSE_RESET: self.core.reset_filter() self.map_filter_active = False self.show_success("Showing all geocaches.") return elif response == RESPONSE_LAST_RESULTS: if self.old_search_window == None: return hildon.WindowStack.get_default().push_1(self.old_search_window) return name_search = name.get_text().strip().lower() sizes = [x + 1 for x, in sel_size.get_selected_rows(0)] if sizes == [1, 2, 3, 4, 5]: sizes = None typelist = [ geocaching.GeocacheCoordinate.TYPE_REGULAR, geocaching.GeocacheCoordinate.TYPE_MULTI, geocaching.GeocacheCoordinate.TYPE_VIRTUAL, geocaching.GeocacheCoordinate.TYPE_EARTH, geocaching.GeocacheCoordinate.TYPE_EVENT, geocaching.GeocacheCoordinate.TYPE_MYSTERY, geocaching.GeocacheCoordinate.TYPE_UNKNOWN ] types = [typelist[x] for x, in sel_type.get_selected_rows(0)] if geocaching.GeocacheCoordinate.TYPE_UNKNOWN in types: types = None # found, marked statuslist = [ (None, None), (False, None), (True, None), (None, True), (False, True), ] found, marked = statuslist[sel_status.get_selected_rows(0)[0][0]] numberlist = [[1, 1.5, 2, 2.5], [3, 3.5, 4], [4.5, 5]] difficulties = [] count = 0 for x, in sel_diff.get_selected_rows(0): difficulties += numberlist[x] count += 1 if count == len(numberlist): difficulties = None terrains = [] count = 0 for x, in sel_terr.get_selected_rows(0): terrains += numberlist[x] count += 1 if count == len(numberlist): terrains = None center = None dist_type = sel_dist_type.get_selected_rows(0)[0][0] if dist_type == 1: try: center = self.gps_last_good_fix.position except AttributeError: logger.debug("No current Fix.") pass elif dist_type == 2: center = self.map.get_center() if center != None: radius = list_dist_radius[sel_dist_radius.get_selected_rows(0) [0][0]] sqrt_2 = 1.41421356 c1 = center.transform(-45, radius * 1000 * sqrt_2) c2 = center.transform(-45 + 180, radius * 1000 * sqrt_2) location = (c1, c2) else: location = None if response == RESPONSE_SHOW_LIST: points, truncated = self.core.get_points_filter( found=found, name_search=name_search, size=sizes, terrain=terrains, diff=difficulties, ctype=types, marked=marked, location=location) if len(points) > 0: self._display_results(points, truncated) break else: self.show_error( "Search returned no geocaches. Please remember that search works only within the downloaded geocaches." ) elif response == gtk.RESPONSE_ACCEPT: self.core.set_filter(found=found, name_search=name_search, size=sizes, terrain=terrains, diff=difficulties, ctype=types, marked=marked) self.show_success( "Filter for map activated, ignoring distance restrictions." ) self.map_filter_active = True break else: break
def __init__(self, main): self.main = main dialog = gtk.Dialog(_("Settings"), self.main.main_window, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT) if platform.FREMANTLE: # Maemo 5 has an implicit "close" button (tap outside of dialog), # but doesn't have instant-apply semantics, so add "Save" button dialog.add_button(gtk.STOCK_SAVE, gtk.RESPONSE_APPLY) else: # GNOME's UI has instant-apply semantics -> add only Close button dialog.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE) # List of (action, checkbutton) pairs to update when "Save" is clicked actions_to_update = [] # Group for radio buttons radio_button_group = [] if platform.FREMANTLE: # Maemo 5: Create static connections, remember for updates def check_button_factory(action): b = hildon.CheckButton(gtk.HILDON_SIZE_FINGER_HEIGHT) b.set_label(action.props.label) b.set_active(action.get_active()) actions_to_update.append((action, b)) return b def radio_button_factory(action): b = hildon.GtkRadioButton(gtk.HILDON_SIZE_FINGER_HEIGHT) b.set_mode(False) if not radio_button_group: radio_button_group.append(b) else: b.set_group(radio_button_group[0]) b.set_label(action.props.label) b.set_active(action.get_active()) actions_to_update.append((action, b)) return b else: # GNOME/Desktop: Instant-apply by connecting check buttons def check_button_factory(action): b = gtk.CheckButton() action.connect_proxy(b) return b def radio_button_factory(action): #global radio_button_group b = gtk.RadioButton() if not radio_button_group: radio_button_group.append(b) else: b.set_group(radio_button_group[0]) action.connect_proxy(b) b.set_active(action.get_active()) return b vb = gtk.VBox() if platform.FREMANTLE: # On Maemo 5, the content could become bigger than the # available screen space -> allow for vertical scrolling pa = hildon.PannableArea() pa.set_size_request_policy(hildon.SIZE_REQUEST_CHILDREN) pa.add_with_viewport(vb) dialog.vbox.add(pa) else: dialog.vbox.add(vb) vb.pack_start(gtk.Frame(_('Main window'))) vb.pack_start(check_button_factory(self.main.action_scrolling_labels)) vb.pack_start(check_button_factory(self.main.action_lock_progress)) vb.pack_start(check_button_factory( self.main.action_dual_action_button)) vb.pack_start(check_button_factory(self.main.action_resume_all)) vb.pack_start(check_button_factory(self.main.action_play_on_headset)) vb.pack_start(gtk.Label('')) # Used as a spacer vb.pack_start(gtk.Frame(_('Playback'))) vb.pack_start(check_button_factory(self.main.action_stay_at_end)) vb.pack_start(check_button_factory(self.main.action_seek_back)) vb.pack_start(gtk.Label('')) # Used as a spacer vb.pack_start(gtk.Frame(_('Play mode'))) hb = gtk.HBox(homogeneous=True) vb.pack_start(hb) for action in (self.main.action_play_mode_all, self.main.action_play_mode_single, self.main.action_play_mode_random, self.main.action_play_mode_repeat): hb.pack_start(radio_button_factory(action)) dialog.show_all() response = dialog.run() if response == gtk.RESPONSE_APPLY: # On Maemo 5, if the user picked "Save" we need # to copy the state of the buttons into our actions for action, button in actions_to_update: action.set_active(button.get_active()) dialog.destroy()
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()
def unrelayout(): self._in_relayout = False return False gobject.idle_add(unrelayout) gobject.type_register(TagCloud) if __name__ == '__main__': l = TagCloud(tags) try: import hildon w = hildon.StackableWindow() sw = hildon.PannableArea() except: w = gtk.Window() w.set_default_size(600, 300) sw = gtk.ScrolledWindow() sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) w.set_title('Tag cloud Demo') w.add(sw) sw.add(l) def on_tag_selected(cloud, tag): print 'tag selected:', tag l.connect('selected', on_tag_selected)
def build_text_area(text): buffer = gtk.TextBuffer() tag = buffer.create_tag("bold", weight=pango.WEIGHT_BOLD) tag = buffer.create_tag("underline", underline=pango.UNDERLINE_SINGLE) tag = buffer.create_tag("wordwrap", wrap_mode=gtk.WRAP_WORD, wrap_mode_set=True) tag = buffer.create_tag("indent", left_margin=20, left_margin_set=True) # Split into paragraphs. paragraphs = re.split("(?:\n[ ]*){1,}\n", text) # Split lists into paragraphs. q = [] for p in paragraphs: match = re.match("^[ ]+([0-9]+)[.][ ]", p) if match: # The start of the paragraph has the form " 1. " start = int(match.group(1)) t = re.split("[ ]*\n[ ]+[0-9]+[.][ ]", p) if len(t) == 1: q.append(p) else: q.append(t[0]) for i in range(1, len(t)): q.append(" " + str(start + i) + ". " + t[i]) else: q.append(p) paragraphs = q for p in paragraphs: tags = ["wordwrap"] if p[0] == ' ': tags.append("indent") # Replace \n's with spaces p = p.replace("\n", " ") # Compress multiple spaces to a single space. p = re.sub(" +", " ", p) # Remove any leading spaces. p = re.sub("^ ", "", p) if re.match("^[0-9A-Z ]{5,60}:?[ ]*$", p): tags.append("bold") tags.append("underline") iter = buffer.get_iter_at_offset(-1) buffer.insert_with_tags_by_name(iter, p, *tags) buffer.insert(iter, "\n\n") textview = hildon.TextView() textview.set_editable(False) textview.set_cursor_visible(False) textview.set_buffer(buffer) textview.show() pannable = hildon.PannableArea() pannable.set_size_request(800, 500) pannable.add(textview) pannable.show() return pannable
def __init__(self): """ Initializes the GUI, creating all widgets. """ self.cont = fMMSController.fMMS_controllerGTK() self.config = self.cont.config self.ch = ContactH.ContactHandler() self.osso_c = osso.Context("se.frals.fmms", self.config.get_version(), False) self.osso_rpc = osso.Rpc(self.osso_c) self.osso_rpc.set_rpc_callback("se.frals.fmms", "/se/frals/fmms", "se.frals.fmms", self.cb_open_fmms, self.osso_c) self.refreshlistview = True self.viewerimported = False self.senderimported = False self._screenwidth = 800 self.avatarlist = {} self.namelist = {} self.nrlist = {} hildon.Program.__init__(self) program = hildon.Program.get_instance() self.window = hildon.StackableWindow() hildon.hildon_gtk_window_set_portrait_flags( self.window, hildon.PORTRAIT_MODE_SUPPORT) gtk.set_application_name("fMMS") self.window.set_title("fMMS") program.add_window(self.window) self.window.connect("delete_event", self.quit) self.pan = hildon.PannableArea() self.pan.set_property("mov-mode", hildon.MOVEMENT_MODE_VERT) # wonder how much memory this is wasting self.iconcell = gtk.CellRendererPixbuf() self.photocell = gtk.CellRendererPixbuf() self.textcell = gtk.CellRendererText() self.photocell.set_property('xalign', 1.0) self.textcell.set_property('mode', gtk.CELL_RENDERER_MODE_INERT) self.textcell.set_property('xalign', 0.0) self.liststore = gtk.ListStore(gtk.gdk.Pixbuf, str, gtk.gdk.Pixbuf, str, str, str) self.treeview = hildon.GtkTreeView(gtk.HILDON_UI_MODE_NORMAL) self.treeview.set_property("fixed-height-mode", True) self.treeview.set_model(self.liststore) # create ui self._create_ui() self.treeview.tap_and_hold_setup(self.liststore_mms_menu()) self.treeview.tap_and_hold_setup(None) self.tapsignal = self.treeview.connect('hildon-row-tapped', self.show_mms) self.treeview.connect('button-press-event', self.cb_button_press) mmsBox = gtk.HBox() icon_theme = gtk.icon_theme_get_default() envelopePixbuf = icon_theme.load_icon("general_sms_button", 48, 0) envelopeImage = gtk.Image() envelopeImage.set_from_pixbuf(envelopePixbuf) envelopeImage.set_alignment(1, 0.5) mmsLabel = gtk.Label( gettext.ldgettext('rtcom-messaging-ui', "messaging_ti_new_mms")) mmsLabel.set_alignment(0, 0.5) mmsBox.pack_start(envelopeImage, True, True, 0) mmsBox.pack_start(mmsLabel, True, True, 0) newMsgButton = hildon.Button(gtk.HILDON_SIZE_FINGER_HEIGHT, hildon.BUTTON_ARRANGEMENT_HORIZONTAL) newMsgButton.add(mmsBox) newMsgButton.connect('clicked', self.new_mms_button_clicked) """ gets the newMsgButton on top of the treeview """ actionbox = self.treeview.get_action_area_box() self.treeview.set_action_area_visible(True) actionbox.add(newMsgButton) self.pan.add(self.treeview) self.livefilter = hildon.LiveSearch() modelfilter = self.liststore.filter_new() modelfilter.set_visible_func(self.cb_filter_row) self.treeview.set_model(modelfilter) self.livefilter.set_filter(modelfilter) self.livefilter.widget_hook(self.window, self.treeview) contBox = gtk.VBox() contBox.pack_start(self.pan, True, True, 0) contBox.pack_start(self.livefilter, False, False, 0) align = gtk.Alignment(1, 1, 1, 1) align.set_padding(2, 2, 10, 10) align.add(contBox) self.window.add(align) menu = self.cont.create_menu(self.window) self.window.set_app_menu(menu) self.window.connect('focus-in-event', self.cb_on_focus) self.window.connect('configure-event', self._onOrientationChange) self.window.show_all() self.add_window(self.window)
def __init__(self, parent): dialog = gtk.Dialog() dialog.set_transient_for(parent) dialog.set_title( gettext.ldgettext('osso-connectivity-ui', "conn_fi_placeholder_iap_settings")) self.parent = parent self.cont = fMMSController.fMMS_controller() self.config = self.cont.config pan = hildon.PannableArea() pan.set_property("mov-mode", hildon.MOVEMENT_MODE_VERT) allVBox = gtk.VBox() labelwidth = 20 gettext.ldgettext('osso-connectivity-ui', "conn_set_iap_fi_username") inputs = [(gettext.ldgettext('osso-connectivity-ui', "conn_set_iap_fi_accessp_name"), 'apn') , \ ('MMSC', 'mmsc'), \ (gettext.ldgettext('osso-connectivity-ui', "conn_set_iap_fi_username"), 'user'), \ (gettext.ldgettext('osso-connectivity-ui', "conn_set_iap_fi_password"), 'pass'), \ (gettext.ldgettext('osso-connectivity-ui', "conn_set_iap_fi_adv_proxies_http"), 'proxy'), \ (gettext.ldgettext('osso-connectivity-ui', "conn_set_iap_fi_adv_proxies_port"), 'proxyport')] entries = {} current = self.config.get_apn_settings() log.info("Current APN settings: %s" % current) if not current: current = self.cont.get_apn_settings_automatically() self.config.set_apn_settings(current) log.info("Set APN settings: %s" % current) if not current['apn'] or current['mmsc'] == "": current = self.cont.get_apn_settings_automatically() if current: self.config.set_apn_settings(current) log.info("Set APN settings: %s" % current) for labelname in inputs: (labelname, var) = labelname box = gtk.HBox() label = gtk.Label(labelname) label.set_width_chars(labelwidth) label.set_alignment(0, 0.5) #vars()[var] = gtk.Entry() vars()[var] = hildon.Entry(gtk.HILDON_SIZE_FINGER_HEIGHT) if var == "proxyport": vars()[var].set_property('hildon-input-mode', gtk.HILDON_GTK_INPUT_MODE_NUMERIC) if current: if current.get(var, None): vars()[var].set_text(str(current[var])) entries[var] = vars()[var] box.pack_start(label, False, True, 0) box.pack_start(vars()[var], True, True, 0) allVBox.pack_start(box, False, False, 2) pan.add_with_viewport(allVBox) pan.set_size_request_policy(hildon.SIZE_REQUEST_CHILDREN) dialog.vbox.add(pan) dialog.show_all() dialog.add_button( gettext.ldgettext('osso-connectivity-ui', "conn_set_iap_bd_advanced"), 999) dialog.add_button(gtk.STOCK_SAVE, gtk.RESPONSE_APPLY) while 1: ret = dialog.run() settings = {} for val in entries: settings[val] = vars()[val].get_text() if ret == 999: self.create_advanced_config(dialog) if ret == gtk.RESPONSE_APPLY: # We can hardcode the checks here since # the fields have to exist here if settings['apn'] == "": banner = hildon.hildon_banner_show_information( parent, "", "Invalid APN.") elif settings['mmsc'] == "": banner = hildon.hildon_banner_show_information( parent, "", "Invalid MMSC.") else: settings['proxy'] = self.cont.convert_to_real_ip( settings['proxy']) settings['mmsc'] = self.cont.clean_url(settings['mmsc']) self.config.set_apn_settings(settings) log.info("Set APN settings: %s" % settings) banner = hildon.hildon_banner_show_information(parent, "", \ gettext.ldgettext('osso-connectivity-ui', "conn_ib_settings_saved")) break elif ret == -4: break dialog.destroy()