def send_mms(self, widget): """ sends the message (no shit?) """ hildon.hildon_gtk_window_set_progress_indicator(self.window, 1) self.force_ui_update() to = self.eNumber.get_text() if not self.cont.validate_phonenumber_email(to) or to == "": self.show_system_note(gettext.ldgettext('rtcom-messaging-ui', "messaging_fi_smsc_invalid_chars")) return attachment = self.attachmentFile hildon.hildon_banner_show_information(self.window, "", \ gettext.ldgettext('modest', "mcen_li_outbox_sending")) self.force_ui_update() if attachment == "" or attachment == None: attachment = None self.attachmentIsResized = False else: filetype = gnomevfs.get_mime_type(attachment) self.attachmentIsResized = False if self.config.get_img_resize_width() != 0 and filetype.startswith("image"): try: attachment = self.resize_img(attachment) except Exception, e: log.exception("resize failed: %s %s", type(e), e) errmsg = str(e.args) errstr = gettext.ldgettext('hildon-common-strings', "sfil_ni_operation_failed") self.show_system_note("%s\n%s" % (errstr, errmsg)) raise
def send_mms(self, to, subject, message, attachment, sender): try: sender = MMSSender(to, subject, message, attachment, sender, setupConn=True, controller=self) except: msg = "%s" % (gettext.ldgettext('hildon-common-strings', "sfil_ni_operation_failed")) return (-1, msg) try: (status, reason, output, parsed) = sender.sendMMS() if parsed == True and "Response-Status" in output: if output['Response-Status'] == "Ok": log.info("message seems to have sent AOK!") return (0, "OK") errstr = gettext.ldgettext('hildon-common-strings', "sfil_ni_operation_failed") message = str(status) + "_" + str(reason) reply = str(output) msg = "%s\nMMSC: %s\nBODY: %s" % (errstr, message, reply) return (-1, msg) except socket.error, exc: log.exception("sender failed due to connection error") errstr = gettext.ldgettext('hildon-common-strings', "sfil_ni_operation_failed") errhelp = _("Please check your settings.") msg = "%s\n%s\n%s" % (errstr, exc, errhelp) return (-1, msg)
def send_mms(self, widget): """ sends the message (no shit?) """ hildon.hildon_gtk_window_set_progress_indicator(self.window, 1) self.force_ui_update() to = self.eNumber.get_text() if not self.cont.validate_phonenumber_email(to) or to == "": self.show_system_note( gettext.ldgettext('rtcom-messaging-ui', "messaging_fi_smsc_invalid_chars")) return attachment = self.attachmentFile hildon.hildon_banner_show_information(self.window, "", \ gettext.ldgettext('modest', "mcen_li_outbox_sending")) self.force_ui_update() if attachment == "" or attachment == None: attachment = None self.attachmentIsResized = False else: filetype = gnomevfs.get_mime_type(attachment) self.attachmentIsResized = False if self.config.get_img_resize_width() != 0 and filetype.startswith( "image"): try: attachment = self.resize_img(attachment) except Exception, e: log.exception("resize failed: %s %s", type(e), e) errmsg = str(e.args) errstr = gettext.ldgettext('hildon-common-strings', "sfil_ni_operation_failed") self.show_system_note("%s\n%s" % (errstr, errmsg)) raise
def choose_your_destiny(self, src, attachments, current_text, current_count): current_text = current_text.replace('(', '').replace(')','') fcd = hildon.FileChooserDialog(self.window, action=gtk.FILE_CHOOSER_ACTION_SAVE) fcd.set_transient_for(self.window) if os.path.isdir("/home/user/MyDocs/"): fcd.set_current_folder("/home/user/MyDocs/") fcd.set_default_response(gtk.RESPONSE_OK) if current_count == 1: fn = current_text fcd.set_current_name(fn) fcd.set_title(gettext.ldgettext('hildon-fm', 'sfil_ti_save_file')) else: strng = 'sfil_va_number_of_objects_attachment' txt = gettext.ldngettext('hildon-fm',strng, strng, current_count) % current_count fcd.set_property('save-multiple', txt) fcd.set_title(gettext.ldgettext('hildon-fm', 'sfil_ti_save_objects_files')) ret = fcd.run() cur_folder = fcd.get_current_folder_uri() cur_uri = fcd.get_uri() fcd.destroy() if ret == gtk.RESPONSE_OK: dst = cur_uri.replace('file://', '') if current_count == 1: # dst is fullpath + fn here srcfn = "%s/%s" % (src, fn) self.copy_file(srcfn, dst) else: # dst is only fullpath here files = current_text.split(',') for fn in files: dstfn = "%s/%s" % (dst, fn) srcfn = "%s/%s" % (src, fn) self.copy_file(srcfn, dstfn)
def create_advanced_config(self, spawnedby): dialog = gtk.Dialog() dialog.set_title( gettext.ldgettext('osso-connectivity-ui', 'conn_set_iap_ti_adv')) allVBox = gtk.VBox() labelwidth = 20 inputs = [(gettext.ldgettext('osso-connectivity-ui', 'conn_set_iap_fi_adv_ip_ip'), 'ip'), \ (gettext.ldgettext('osso-connectivity-ui', 'conn_set_iap_fi_adv_ip_dns_prim'), 'pdns'), \ (gettext.ldgettext('osso-connectivity-ui', 'conn_set_iap_fi_adv_ip_dns_sec'), 'sdns')] entries = {} current = self.config.get_advanced_apn_settings() if not current: current = self.cont.get_apn_settings_automatically() self.config.set_advanced_apn_settings(current) log.info("Set Advanced APN settings: %s" % current) if current['ip'] == "" or not current['ip']: current = self.cont.get_apn_settings_automatically() self.config.set_advanced_apn_settings(current) log.info("Set Advanced 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 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) allVBox.show_all() dialog.vbox.add(allVBox) dialog.add_button(gtk.STOCK_SAVE, gtk.RESPONSE_APPLY) ret = dialog.run() settings = {} for val in entries: settings[val] = vars()[val].get_text() if ret == gtk.RESPONSE_APPLY: self.config.set_advanced_apn_settings(settings) log.info("Set Advanced APN settings: %s" % settings) banner = hildon.hildon_banner_show_information(self.parent, "", \ gettext.ldgettext('osso-connectivity-ui', "conn_ib_settings_saved")) dialog.destroy()
def __init__(self): controller.fMMS_controller.__init__(self) self.ui = True self.config_label = gettext.ldgettext('rtcom-messaging-ui', "messaging_me_main_settings") self.reset_label = _('Reset settings') self.about_label = gettext.ldgettext('hildon-libs', "ecdg_ti_aboutdialog_title")
def copy_file(self, src, dst): if not os.path.isfile(dst): log.info("copying %s -> %s" % (src, dst)) shutil.copy(src, dst) banner = hildon.hildon_banner_show_information(self.window, "", \ gettext.ldgettext('hildon-libs', "wdgt_bd_done")) else: log.info("copy failed: file exists (%s -> %s)" % (src, dst)) banner = hildon.hildon_banner_show_information(self.window, "", \ gettext.ldgettext('hildon-common-strings', "sfil_ni_operation_failed"))
def _incoming_sms_push(self, source, src_port, dst_port, wsp_header, wsp_payload): """ handle incoming push over sms """ log.info("Incoming SMS Push!") args = (source, src_port, dst_port, wsp_header, wsp_payload) if not os.path.isdir(self.config.get_imgdir()): os.makedirs(self.config.get_imgdir()) f = open(self._incoming, 'w') for arg in args: f.write(str(arg)) f.write('\n') f.close() log.info("SRC: %s:%s", source, src_port) log.info("DST: %s", dst_port) binarydata = [] # throw away the wsp_header! #for d in wsp_header: # data.append(int(d)) for d in wsp_payload: binarydata.append(int(d)) log.info("decoding...") (data, sndr, url, trans_id) = self.cont.decode_mms_from_push(binarydata) ch = ContactH.ContactHandler() sndr = ch.get_displayname_from_number(sndr) log.info("saving...") # Controller should save it pushid = self.cont.save_push_message(data) try: log.info("fetching mms...") path = self._get_mms_message(url, trans_id) except: log.info("failed to fetch - notifying push...") # Send a notify we got the SMS Push and parsed it A_OKEY! msgstr = "%s (%s)" % (gettext.ldgettext('rtcom-messaging-ui', "messaging_ti_new_mms"), "Push") self.notify_mms(sndr, msgstr) log.info("notified...") raise log.info("decoding mms... path: %s", path) message = self.cont.decode_binary_mms(path) log.info("storing mms...") self.cont.store_mms_message(pushid, message, transactionId=trans_id) log.info("notifying mms...") self.notify_mms(sndr, gettext.ldgettext('rtcom-messaging-ui', "messaging_ti_new_mms"), trans_id) log.info("done, returning!") return 0
def _createRepoStore(self): store = gtk.ListStore(gobject.TYPE_BOOLEAN, gobject.TYPE_STRING, gobject.TYPE_PYOBJECT) tl = self.xml.get_widget("repoList") tl.set_model(store) cbr = gtk.CellRendererToggle() col = gtk.TreeViewColumn('', cbr, active = 0) cbr.connect("toggled", self._repoToggled, store) tl.append_column(col) col = gtk.TreeViewColumn('Text', gtk.CellRendererText(), text = 1) col.set_clickable(False) tl.append_column(col) for (reponame, repo) in self.repos.repos.items(): store.append([repo.isEnabled(), gettext.ldgettext("comps", repo.name), repo]) store.set_sort_column_id(1, gtk.SORT_ASCENDING) store.set_sort_func(1, self.__sortRepos) return tl
def liststore_delete_clicked(self, widget): """ Shows a confirm dialog when Delete menu is clicked. Deletes the message if the user accepts the dialog. """ if self.curPath == None: return model = self.treeview.get_model().get_model() miter = model.get_iter(self.curPath) # the 4th value is the transactionid (start counting at 0) filename = model.get_value(miter, 3) confirmtxt = gettext.ldgettext('rtcom-messaging-ui', "messaging_fi_delete_1_sms") dialog = gtk.Dialog() dialog.set_transient_for(self.window) dialog.set_title(confirmtxt) dialog.add_button(gtk.STOCK_YES, 1) dialog.add_button(gtk.STOCK_NO, 0) label = gtk.Label(confirmtxt) dialog.vbox.add(label) dialog.show_all() ret = dialog.run() if ret == 1: log.info("Deleting %s", filename) self.delete_push_mms(filename) model.remove(miter) dialog.destroy() hildon.hildon_gtk_window_take_screenshot(self.window, False) hildon.hildon_gtk_window_take_screenshot(self.window, True) self.force_ui_update() return
def contact_chooser_dialog(self): capi = PyGObjectCPAI() c_chooser = self.osso_abook.osso_abook_contact_chooser_new(None, \ gettext.ldgettext('osso-addressbook', "addr_ti_dia_select_contacts")) chooser = capi.pygobject_new(c_chooser) chooser.run() chooser.hide() contacts = self.osso_abook.osso_abook_contact_chooser_get_selection( c_chooser) for i in self.glist(contacts): c_selector = self.osso_abook.osso_abook_contact_detail_selector_new_for_contact( c_chooser, i, 3) selector = capi.pygobject_new(c_selector) selector.run() selector.hide() c_field = self.osso_abook.osso_abook_contact_detail_selector_get_selected_field( c_selector) get_display_value = self.osso_abook.osso_abook_contact_field_get_display_value get_display_value.restype = ctypes.c_char_p finalval = self.osso_abook.osso_abook_contact_field_get_display_value( c_field) self.glib.g_list_free(contacts) return finalval self.glib.g_list_free(contacts)
def _refresh_task_list(self): store = gtk.ListStore(gobject.TYPE_BOOLEAN, gobject.TYPE_STRING, gobject.TYPE_PYOBJECT) tl = self.xml.get_widget("taskList") map(lambda col: tl.remove_column(col) , tl.get_columns()) tl.set_model(store) cbr = gtk.CellRendererToggle() cbr.set_radio(True) cbr.connect("toggled", self._taskToggled, store) col = gtk.TreeViewColumn('', cbr, active = 0) tl.append_column(col) col = gtk.TreeViewColumn('Text', gtk.CellRendererText(), text = 1) col.set_clickable(False) tl.append_column(col) anyEnabled = False for (txt, grps) in self.tasks: if not self.backend.groupListExists(grps): continue enabled = self.backend.groupListDefault(grps) trans_txt = gettext.ldgettext(self.anaconda.instClass.l10n_domain, txt) store.append([not anyEnabled and enabled, trans_txt, grps]) if enabled: anyEnabled = True return tl
def _createTaskStore(self): store = gtk.ListStore(gobject.TYPE_BOOLEAN, gobject.TYPE_STRING, gobject.TYPE_PYOBJECT) tl = self.xml.get_widget("taskList") tl.set_model(store) cbr = gtk.CellRendererToggle() cbr.set_radio(True) cbr.connect("toggled", self._taskToggled, store) col = gtk.TreeViewColumn('', cbr, active = 0) tl.append_column(col) col = gtk.TreeViewColumn('Text', gtk.CellRendererText(), text = 1) col.set_clickable(False) tl.append_column(col) anyEnabled = False for (txt, grps) in self.tasks: if not self.backend.groupListExists(grps): continue enabled = self.backend.groupListDefault(grps) store.append([not anyEnabled and enabled, gettext.ldgettext("comps", txt), grps]) if enabled: anyEnabled = True return tl
def _editRepo(self, *args): repo = None # If we were passed an extra argument, it's the repo store and we # are editing an existing repo as opposed to adding a new one. if len(args) > 1: (model, iter) = args[1].get_selection().get_selected() if iter: repo = model.get_value(iter, 2) else: return else: return if repo.needsNetwork() and not network.hasActiveNetDev(): if not self.anaconda.intf.enableNetwork(): return gtk.RESPONSE_CANCEL urlgrabber.grabber.reset_curl_obj() dialog = RepoEditor(self.anaconda, repo) dialog.createDialog() dialog.run() model.set_value(iter, 0, dialog.repo.isEnabled()) model.set_value(iter, 1, gettext.ldgettext("comps", dialog.repo.name)) model.set_value(iter, 2, dialog.repo)
def decode_mms_from_push(self, binarydata): """ decodes the given mms """ decoder = mms_pdu.MMSDecoder() wsplist = decoder.decodeCustom(binarydata) sndr, url, trans_id = None, None, None try: url = wsplist["Content-Location"] log.info("content-location: %s", url) trans_id = wsplist["Transaction-Id"] trans_id = str(trans_id) log.info("transid: %s", trans_id) except Exception, e: log.exception( "no content-location/transid in push; aborting: %s %s", type(e), e) bus = dbus.SystemBus() proxy = bus.get_object('org.freedesktop.Notifications', '/org/freedesktop/Notifications') interface = dbus.Interface( proxy, dbus_interface='org.freedesktop.Notifications') interface.SystemNoteInfoprint( gettext.ldgettext('modest', "mail_ni_ui_folder_get_msg_folder_error")) raise
def mms_menu_button_clicked(self, button, fname): """ actions for mms menu """ buttontext = button.get_label() if buttontext == self.headerstxt: ret = self.create_headers_dialog(fname) elif buttontext == self.replytxt: number = self.cont.get_replyuri_from_transid(fname) fMMSSenderUI.fMMS_SenderUI(spawner=self.window, tonumber=number).run() elif buttontext == self.replysmstxt: number = self.cont.get_replyuri_from_transid(fname) if "@" in number: note = osso.SystemNote(self.osso_c) note.system_note_dialog(gettext.ldgettext('rtcom-messaging-ui', "messaging_fi_smsc_invalid_chars") , 'notice') else: rpc = osso.Rpc(self.osso_c) nr = "sms:%s" % str(number) args = (nr, "") rpc.rpc_run('com.nokia.MessagingUI', '/com/nokia/MessagingUI', 'com.nokia.MessagingUI', 'messaging_ui_interface_start_sms', args, True, True) elif buttontext == self.forwardtxt: tbuffer = self.textview.get_buffer() msg = tbuffer.get_text(tbuffer.get_start_iter(), tbuffer.get_end_iter()) fn = self.attachment fMMSSenderUI.fMMS_SenderUI(spawner=self.window, withfile=fn, message=msg, forward=True) elif buttontext == self.deletetxt: self.delete_dialog(fname) elif buttontext == self.copytxt: clip = gtk.Clipboard(display=gtk.gdk.display_get_default(), selection="CLIPBOARD") tbuffer = self.textview.get_buffer() msg = tbuffer.get_text(tbuffer.get_start_iter(), tbuffer.get_end_iter()) clip.set_text(msg, -1) elif buttontext == self.saveattachments: self.save_attachments(fname)
def createDialog(self): if self.repo: self.nameEntry.set_text(gettext.ldgettext("comps", self.repo.name)) if self.repo.anacondaBaseURLs: url = self.repo.anacondaBaseURLs[0] else: url = '' self.typeComboBox.set_active(self._methodToIndex(url)) if not url or url.startswith("http") or url.startswith("ftp"): if self.repo.mirrorlist: self.baseurlEntry.set_text(self.repo.mirrorlist) self.mirrorlistCheckbox.set_active(True) else: self.baseurlEntry.set_text(url) self.mirrorlistCheckbox.set_active(False) if self.repo.proxy: self.proxyCheckbox.set_active(True) self.proxyTable.set_sensitive(True) self.proxyEntry.set_text(self.repo.proxy) self.usernameEntry.set_text(self.repo.proxy_username or '') self.passwordEntry.set_text(self.repo.proxy_password or '') else: self.proxyCheckbox.set_active(False) self.proxyTable.set_sensitive(False) elif url.startswith("nfs"): (opts, server, path) = iutil.parseNfsUrl(url) self.nfsServerEntry.set_text(server) self.nfsPathEntry.set_text(path) self.nfsOptionsEntry.set_text(opts) elif url.startswith("cdrom:"): pass elif url.startswith("hd:"): m = url[3:] if m.count(":") == 1: (device, path) = m.split(":") fstype = "auto" else: (device, fstype, path) = m.split(":") # find device in self.partitionComboBox and select it self.directoryChooser.set_current_folder("%s%s" % (self.anaconda.backend.ayum.isodir, path)) else: self.baseurlEntry.set_text(url) else: self.typeComboBox.set_active(0) self.proxyCheckbox.set_active(False) self.proxyTable.set_sensitive(False) gui.addFrame(self.dialog) lbl = self.dxml.get_widget("descLabel") txt = lbl.get_text() lbl.set_text(txt) self.dialog.show_all()
def delete_push_mms(self, fname): """ Deletes both the MMS and the PUSH message. """ try: self.cont.wipe_message(fname) except Exception, e: log.exception("failed to delete push mms") hildon.hildon_banner_show_information( self.window, "", gettext.ldgettext('hildon-common-strings', "sfil_ni_operation_failed"))
def mms_img_menu(self, data=None): """ long press on image creates this """ menu = gtk.Menu() menu.set_property("name", "hildon-context-sensitive-menu") openItem = gtk.MenuItem(gettext.ldgettext('hildon-fm', 'ckdg_ti_open_file')) menu.append(openItem) openItem.connect("activate", self.mms_img_clicked, data) openItem.show() menu.show_all() return menu
def delete_push_mms(self, fname): """ delete push & mms """ log.info("deleting message: %s", fname) try: self.cont.wipe_message(fname) #banner = hildon.hildon_banner_show_information(self.window, "", "Message deleted") self.force_ui_update() self.window.destroy() except Exception, e: log.exception("%s %s", type(e), e) banner = hildon.hildon_banner_show_information(self.window, "", \ gettext.ldgettext('hildon-common-strings', "sfil_ni_operation_failed"))
def liststore_mms_menu(self): """ Creates the context menu and shows it. """ menu = gtk.Menu() menu.set_property("name", "hildon-context-sensitive-menu") openItem = gtk.MenuItem( gettext.ldgettext('hildon-libs', "wdgt_bd_delete")) menu.append(openItem) openItem.connect("activate", self.liststore_delete_clicked) openItem.show() menu.show_all() return menu
def __get_mms_message(self, location, transaction): """ get the mms message from content-location """ # thanks benaranguren on talk.maemo.org for patch including x-wap-profile header log.info("getting file: %s", location) try: (proxyurl, proxyport) = self.config.get_proxy_from_apn() try: socket.setdefaulttimeout(20) notifyresp = self._send_notify_resp(transaction) log.info("notifyresp sent") except: log.exception("notify sending failed") # TODO: configurable time-out? timeout = 30 socket.setdefaulttimeout(timeout) if proxyurl == "" or proxyurl == None: log.info("connecting without proxy") else: proxyfull = "%s:%s" % (str(proxyurl), str(proxyport)) log.info("connecting with proxy %s", proxyfull) proxy = urllib2.ProxyHandler({"http": proxyfull}) opener = urllib2.build_opener(proxy) urllib2.install_opener(opener) headers = {'User-Agent' : self.config.get_useragent(), 'x-wap-profile' : 'http://mms.frals.se/n900.rdf'} log.info("trying url: %s", location) req = urllib2.Request(location, headers=headers) mmsdata = urllib2.urlopen(req) try: log.info("mmsc info: %s", mmsdata.info()) except: pass mmsdataall = mmsdata.read() dirname = self.cont.save_binary_mms(mmsdataall, transaction) log.info("fetched %s and wrote to file", location) except Exception, e: log.exception("fatal: %s %s", type(e), e) bus = dbus.SystemBus() proxy = bus.get_object('org.freedesktop.Notifications', '/org/freedesktop/Notifications') interface = dbus.Interface(proxy, dbus_interface='org.freedesktop.Notifications') interface.SystemNoteInfoprint(gettext.ldgettext('modest', "mail_ni_ui_folder_get_msg_folder_error")) raise
def load_entries (self, root): iter = self.tzStore.get_iter_first() for entry in self.zonetab.getEntries(): if entry.lat is not None and entry.long is not None: x, y = self.map2canvas(entry.lat, entry.long) marker = root.add(gnomecanvas.CanvasText, x=x, y=y, text=u'\u00B7', fill_color='yellow', anchor=gtk.ANCHOR_CENTER, weight=pango.WEIGHT_BOLD) self.markers[entry.tz] = marker if entry.tz == "America/New York": # In case the /etc/sysconfig/clock is messed up, use New # York as the default. self.fallbackEntry = entry iter = self.tzStore.insert_after(iter, [gettext.ldgettext("system-config-date", entry.tz), entry.tz, entry])
def get_default_widget_direction(): """ Function to get default widget direction (RTL/LTR) for the current language configuration. XXX: this should be provided by the Gtk itself (#1008821) :return: either Gtk.TextDirection.LTR or Gtk.TextDirection.RTL :rtype: GtkTextDirection """ # this is quite a hack, but it's exactly the same check Gtk uses internally xlated = gettext.ldgettext("gtk30", "default:LTR") if xlated == "default:LTR": return Gtk.TextDirection.LTR else: return Gtk.TextDirection.RTL
def continue_download_roaming(self): dialog = gtk.Dialog() dialog.set_title(gettext.ldgettext('osso-connectivity-ui', 'conn_fi_phone_network_data_roam')) #dialog.set_transient_for(self.window) label = gtk.Label(_("To retrieve the MMS your active connection you need to connect to the internet, proceed?")) label.set_line_wrap(True) dialog.vbox.add(label) dialog.add_button(gtk.STOCK_YES, 1) dialog.add_button(gtk.STOCK_NO, 0) dialog.vbox.show_all() ret = dialog.run() switch = False if ret == 1: switch = True dialog.destroy() while gtk.events_pending(): gtk.main_iteration(False) return switch
def config_menu_button_clicked(self, action): """ Checks if we should save the Configuration options. """ if action == 1: #self.config.set_phonenumber(self.number.get_text()) selectorlabel = self.imgwidth.get_selector().get_current_text() size = 0 for (label, val) in self.imgmodes: if label == selectorlabel: size = val self.config.set_img_resize_width(size) log.info("Set image width to %s" % size) self.config.set_connmode(self.connmode_option()) log.info("Set connection mode %s" % self.connmode_option()) self.config.set_roammode(self.roammode_option()) log.info("Set roaming mode %s" % self.roammode_option()) banner = hildon.hildon_banner_show_information(self.window, "", \ gettext.ldgettext('osso-connectivity-ui', "conn_ib_settings_saved")) return 0
def __call__(self, screen, anaconda): timezones = self.getTimezoneList() (default, asUtc) = anaconda.timezone.getTimezoneInfo() if not default: default = anaconda.instLanguage.getDefaultTimeZone() bb = ButtonBar(screen, [TEXT_OK_BUTTON, TEXT_BACK_BUTTON]) t = TextboxReflowed(30, _("In which time zone are you located?")) if not anaconda.ksdata and not anaconda.bootloader.has_windows: asUtc = True self.l = Listbox(5, scroll = 1, returnExit = 0) for tz in timezones: self.l.append(gettext.ldgettext("system-config-date", tz), tz) self.l.setCurrent(default.replace("_", " ")) self.c = Checkbox(_("System clock uses UTC"), isOn = asUtc) self.g = GridFormHelp(screen, _("Time Zone Selection"), "timezone", 1, 5) self.g.add(t, 0, 0) self.g.add(self.c, 0, 2, padding = (0, 1, 0, 1), anchorLeft = 1) self.g.add(self.l, 0, 3, padding = (0, 0, 0, 1)) self.g.add(bb, 0, 4, growx = 1) result = "" while True: result = self.g.run() rc = bb.buttonPressed (result) if rc == TEXT_BACK_CHECK: screen.popWindow() return INSTALL_BACK else: break screen.popWindow() anaconda.timezone.setTimezoneInfo(self.l.current().replace(" ", "_"), asUtc = self.c.selected()) return INSTALL_OK
def delete_dialog(self, filename): dialog = gtk.Dialog() confirmtxt = gettext.ldgettext('rtcom-messaging-ui', "messaging_fi_delete_1_sms") dialog.set_title(confirmtxt) dialog.add_button(gtk.STOCK_YES, 1) dialog.add_button(gtk.STOCK_NO, 0) label = gtk.Label(confirmtxt) dialog.vbox.add(label) dialog.show_all() ret = dialog.run() if ret == 1: hildon.hildon_gtk_window_set_progress_indicator(self.window, 1) self.force_ui_update() log.info("deleting %s", filename) if self.spawner: self.spawner.refreshlistview = True self.force_ui_update() self.delete_push_mms(filename) dialog.destroy()
def decode_mms_from_push(self, binarydata): """ decodes the given mms """ decoder = mms_pdu.MMSDecoder() wsplist = decoder.decodeCustom(binarydata) sndr, url, trans_id = None, None, None try: url = wsplist["Content-Location"] log.info("content-location: %s", url) trans_id = wsplist["Transaction-Id"] trans_id = str(trans_id) log.info("transid: %s", trans_id) except Exception, e: log.exception("no content-location/transid in push; aborting: %s %s", type(e), e) bus = dbus.SystemBus() proxy = bus.get_object('org.freedesktop.Notifications', '/org/freedesktop/Notifications') interface = dbus.Interface(proxy, dbus_interface='org.freedesktop.Notifications') interface.SystemNoteInfoprint(gettext.ldgettext('modest', "mail_ni_ui_folder_get_msg_folder_error")) raise
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
def getNext (self): # check if we already have an encrypted password from kickstart if self.rootPassword["isCrypted"] and self.pw.get_text() == "xxxxxxxx": return None pw = self.pw.get_text() confirm = self.confirm.get_text() if not pw or not confirm: self.intf.messageWindow(_("Error with Password"), _("You must enter your root password " "and confirm it by typing it a second " "time to continue."), custom_icon="error") self.passwordError() if pw != confirm: self.intf.messageWindow(_("Error with Password"), _("The passwords you entered were " "different. Please try again."), custom_icon="error") self.passwordError() if len(pw) < 6: self.intf.messageWindow(_("Error with Password"), _("The root password must be at least " "six characters long."), custom_icon="error") self.passwordError() try: cracklib.FascistCheck(pw) except ValueError, e: msg = gettext.ldgettext("cracklib", e) ret = self.intf.messageWindow(_("Weak Password"), _("You have provided a weak password: %s") % msg, type="custom", custom_icon="error", default=0, custom_buttons=[_("Cancel"), _("_Use Anyway")]) if ret == 0: self.passwordError()
def getNext(self): pw = self.pw.get_text() confirm = self.confirm.get_text() username = self.username.get_text().lower() fullname = self.fullname.get_text() if not pw or not confirm: self.intf.messageWindow(_("Error with Password"), _("You must enter your user password " "and confirm it by typing it a second " "time to continue."), custom_icon="error") self.passwordError() if pw != confirm: self.intf.messageWindow(_("Error with Password"), _("The passwords you entered were " "different. Please try again."), custom_icon="error") self.passwordError() if len(pw) < 6: self.intf.messageWindow(_("Error with Password"), _("User password must be at least " "six characters long."), custom_icon="error") self.passwordError() try: cracklib.FascistCheck(pw) except ValueError, e: msg = gettext.ldgettext("cracklib", e) ret = self.intf.messageWindow( _("Weak Password"), _("You have provided a weak password: %s") % msg, type="custom", custom_icon="error", custom_buttons=[_("Cancel"), _("Use Anyway")]) if ret == 0: self.passwordError()
def continue_download_roaming(self): dialog = gtk.Dialog() dialog.set_title( gettext.ldgettext('osso-connectivity-ui', 'conn_fi_phone_network_data_roam')) #dialog.set_transient_for(self.window) label = gtk.Label( "To retrieve the MMS your active connection will use data roaming, proceed?" ) label.set_line_wrap(True) dialog.vbox.add(label) dialog.add_button(gtk.STOCK_YES, 1) dialog.add_button(gtk.STOCK_NO, 0) dialog.vbox.show_all() ret = dialog.run() switch = False if ret == 1: switch = True dialog.destroy() while gtk.events_pending(): gtk.main_iteration(False) return switch
def getNext (self): pw = self.pw.get_text() confirm = self.confirm.get_text() username = self.username.get_text().lower() fullname = self.fullname.get_text() if not pw or not confirm: self.intf.messageWindow(_("Error with Password"), _("You must enter your user password " "and confirm it by typing it a second " "time to continue."), custom_icon="error") self.passwordError() if pw != confirm: self.intf.messageWindow(_("Error with Password"), _("The passwords you entered were " "different. Please try again."), custom_icon="error") self.passwordError() if len(pw) < 6: self.intf.messageWindow(_("Error with Password"), _("User password must be at least " "six characters long."), custom_icon="error") self.passwordError() try: cracklib.FascistCheck(pw) except ValueError, e: msg = gettext.ldgettext("cracklib", e) ret = self.intf.messageWindow(_("Weak Password"), _("You have provided a weak password: %s") % msg, type="custom", custom_icon="error", custom_buttons=[_("Cancel"), _("Use Anyway")]) if ret == 0: self.passwordError()
def show_switch_conn_dialog(self): """ Show confirmation dialog asking if we should disconnect """ self.refreshlistview = False dialog = gtk.Dialog() dialog.set_title( gettext.ldgettext('osso-connectivity-ui', 'conn_mngr_me_int_conn_change_iap')) dialog.set_transient_for(self.window) label = gtk.Label( _("To retrieve the MMS your active connection will need to change. Switch connection?" )) label.set_line_wrap(True) dialog.vbox.add(label) dialog.add_button(gtk.STOCK_YES, 1) dialog.add_button(gtk.STOCK_NO, 0) dialog.vbox.show_all() ret = dialog.run() switch = False if ret == 1: switch = True dialog.destroy() self.force_ui_update() return switch
def load_entries(self, root): iter = self.tzStore.get_iter_first() for entry in self.zonetab.getEntries(): if entry.lat is not None and entry.long is not None: x, y = self.map2canvas(entry.lat, entry.long) marker = root.add(gnomecanvas.CanvasText, x=x, y=y, text=u'\u00B7', fill_color='yellow', anchor=gtk.ANCHOR_CENTER, weight=pango.WEIGHT_BOLD) self.markers[entry.tz] = marker if entry.tz == "America/New York": # In case the /etc/sysconfig/clock is messed up, use New # York as the default. self.fallbackEntry = entry iter = self.tzStore.insert_after(iter, [ gettext.ldgettext("system-config-date", entry.tz), entry.tz, entry ])
def show_mms(self, treeview, path): """ Shows the message at the current selection in the treeview. """ self.treeview.set_sensitive(False) # Show loading indicator hildon.hildon_gtk_window_set_progress_indicator(self.window, 1) self.force_ui_update() log.info("showing mms: %s", path) model = treeview.get_model() miter = model.get_iter(path) # the 4th value is the transactionid (start counting at 0) transactionid = model.get_value(miter, 3) switch = False if not self.cont.is_fetched_push_by_transid( transactionid) and self.config.get_connmode( ) == fMMSconf.CONNMODE_ICDSWITCH: if not self.cont.get_current_connection_iap_id( ) == self.config.get_apn(): switch = self.show_switch_conn_dialog() if switch: self.cont.disconnect_current_connection() #if not self.cont.is_mms_read(transactionid) and not self.cont.get_direction_mms(transactionid) == fMMSController.MSG_DIRECTION_OUT: #self.refreshlistview = True self.import_viewer() try: fMMSViewer.fMMS_Viewer(transactionid, spawner=self) except Exception, e: log.exception("Failed to open viewer with transaction id: %s" % transactionid) hildon.hildon_banner_show_information( self.window, "", gettext.ldgettext('hildon-common-strings', "sfil_ni_operation_failed"))
# Red Hat, Inc. # # Red Hat Author(s): Dave Lehman <*****@*****.**> # import os from pyanaconda.anaconda_log import log_method_call from pyanaconda.flags import flags from parted import PARTITION_RAID from ..errors import * from ..devicelibs import mdraid from . import DeviceFormat, register_device_format import gettext _ = lambda x: gettext.ldgettext("anaconda", x) import logging log = logging.getLogger("storage") class MDRaidMember(DeviceFormat): """ An mdraid member disk. """ _type = "mdmember" _name = "software RAID" _udevTypes = ["linux_raid_member"] partedFlag = PARTITION_RAID _formattable = True # can be formatted _supported = True # is supported _linuxNative = True # for clearpart _packages = ["mdadm"] # required packages
# import hashlib import os import copy from PyQt5.QtCore import pyqtSignal from PyQt5.QtWidgets import QDialog, QFileDialog, QListWidgetItem, QMessageBox from PyQt5.QtGui import QPixmap from gui.ui.packagecollection import Ui_PackageCollectionDialog from gui.packages import PackagesDialog from gui.languages import LANGUAGES from repotools.packages import PackageCollection, PackageSet, random_id import gettext _ = lambda x:gettext.ldgettext("pardusman", x) class PackageCollectionDialog(QDialog, Ui_PackageCollectionDialog): def __init__(self, parent, repo, project=None, collection=None): QDialog.__init__(self, parent) self.setupUi(self) self.project = project self.parent = parent self.repo = repo self.repo_uri = os.path.join(repo.base_uri, repo.index_name) self.collection = None self.origCollection = None self.tmpCollection = None if collection: self.origCollection = collection
import sys import gtk import gettext _ = lambda x: gettext.ldgettext("rhsm", x) sys.path.append("/usr/share/rhsm") from subscription_manager.gui import autobind from subscription_manager.gui.firstboot_base import RhsmFirstbootModule class moduleClass(RhsmFirstbootModule): def __init__(self): RhsmFirstbootModule.__init__(self, _("Service Level"), _("Entitlement Registration"), 200.3, 109.12) self.screen = autobind.SelectSLAScreen(None, None) def apply(self, interface, testing=False): """ 'Next' button has been clicked - autobind controller will have already stored the selected sla """ return self._RESULT_SUCCESS def createScreen(self): """ Create a new instance of gtk.VBox, pulling in child widgets from the
# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # # Authors: # Jan Pazdziora jpazdziora at redhat dot com from up2date_client import rhnreg from up2date_client import rhnregGui, rhnserver from up2date_client import messageWindow import gtk import gettext _ = lambda x: gettext.ldgettext("rhn-client-tools", x) gtk.glade.bindtextdomain("rhn-client-tools") from firstboot.module import Module from firstboot.constants import * class moduleClass(Module): def __init__(self): Module.__init__(self) self.priority = 108.5 self.sidebarTitle = _("Red Hat Account") self.title = _("Red Hat Account") def needsNetwork(self): return True
from meh import MAIN_RESPONSE_DEBUG, MAIN_RESPONSE_SAVE, MAIN_RESPONSE_SHELL, MAIN_RESPONSE_QUIT from meh.ui import AbstractIntf, AbstractSaveExceptionWindow, AbstractMainExceptionWindow, AbstractMessageWindow import report import report.io.TextIO from report import LIBREPORT_WAIT, LIBREPORT_RUN_CLI import os import sys if sys.version_info.major == 3: raw_input_fn = input else: raw_input_fn = raw_input # pylint: disable=undefined-variable import gettext _ = lambda x: gettext.ldgettext("python-meh", x) class IOHandler(object): """ Class that provides methods for input and output. Its instance is expected to be passed to objects performing some I/O operations. """ def __init__(self, in_func=raw_input_fn, out_func=print): # pylint: disable=used-before-assignment """ Constructor for the IOhandler class. Arguments can be used to override default I/O functions with the custom ones. :param in_func: input function similar to standard raw_input
# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the # source code or documentation are not subject to the GNU General Public # License and may only be used or replicated with the express permission of # Red Hat, Inc. # # Red Hat Author(s): Vojtech Trefny <*****@*****.**> # #------------------------------------------------------------------------------# from gi.repository import Gtk import gettext #------------------------------------------------------------------------------# _ = lambda x: gettext.ldgettext("blivet-gui", x) #------------------------------------------------------------------------------# class ListPartitions(object): """ List of childs of selected device """ def __init__(self, blivet_gui): self.blivet_gui = blivet_gui self.kickstart_mode = self.blivet_gui.kickstart_mode self.partitions_list = Gtk.TreeStore(object, str, str, str, str, str, str, object)
sys.path.append('/usr/share/system-config-kdump/') from gtk import * import string import os import os.path import time import gtk import gobject import commands from firstboot.config import * from firstboot.constants import * from firstboot.functions import * from firstboot.module import * import gettext _ = lambda x: gettext.ldgettext("firstboot", x) N_ = lambda x: x class moduleClass(Module): def __init__(self): Module.__init__(self) self.priority = 100 self.sidebarTitle = N_("Kdump") self.title = N_("Kdump") self.reboot = False # runPriority determines the order in which this module runs in firstboot runPriority = 70 moduleName = _("Kdump") windowName = moduleName reboot = False