def open_url(self, url): # It looks like the maximum URL length is about 2k. I can't # seem to find the exact value if len(url) > 2047: url = url[:2047] try: webbrowser.get("windows-default").open_new(url) except: logging.warn("Error opening URL: %r\n%s", url, traceback.format_exc()) recommendURL = app.config.get(prefs.RECOMMEND_URL) if url.startswith(app.config.get(prefs.VIDEOBOMB_URL)): title = _('Error Bombing Item') elif url.startswith(recommendURL): title = _('Error Recommending Item') else: title = _("Error Opening Website") scheme, host, path, params, query, fragment = urlparse(url) shortURL = '%s:%s%s' % (scheme, host, path) msg = _( "There was an error opening %(url)s. Please try again in a few " "seconds", {"url": shortURL} ) dialogs.show_message(title, msg, dialogs.WARNING_MESSAGE)
def check_flash_install(): request_count = app.config.get(prefs.FLASH_REQUEST_COUNT) if _is_flash_installed() or request_count > 0: return title = _("Install Adobe Flash?") description = _( "For the best %(appname)s experience, we suggest you install Adobe Flash. Would you " "like to do this now?", {"appname": app.config.get(prefs.SHORT_APP_NAME)} ) ret = dialogs.show_choice_dialog(title, description, [dialogs.BUTTON_YES, dialogs.BUTTON_NOT_NOW, dialogs.BUTTON_NO]) if ret is None or ret == dialogs.BUTTON_NOT_NOW: return elif ret == dialogs.BUTTON_YES: app.widgetapp.open_url(FLASH_URL) title = _("Install Adobe Flash") description = _( "Your browser will load the web-site where you can download and install " "Adobe Flash.\n" "\n" "You should quit %(appname)s now and start it up again after Adobe Flash has " "been installed.", {"appname": app.config.get(prefs.SHORT_APP_NAME)} ) dialogs.show_message(title, description) else: app.config.set(prefs.FLASH_REQUEST_COUNT, 1)
def check_flash_install(): request_count = app.config.get(prefs.FLASH_REQUEST_COUNT) if _is_flash_installed() or request_count > 0: return title = _("Install Adobe Flash?") description = _( "For the best %(appname)s experience, we suggest you install Adobe Flash. Would you " "like to do this now?", {"appname": app.config.get(prefs.SHORT_APP_NAME)}) ret = dialogs.show_choice_dialog( title, description, [dialogs.BUTTON_YES, dialogs.BUTTON_NOT_NOW, dialogs.BUTTON_NO]) if ret is None or ret == dialogs.BUTTON_NOT_NOW: return elif ret == dialogs.BUTTON_YES: app.widgetapp.open_url(FLASH_URL) title = _("Install Adobe Flash") description = _( "Your browser will load the web-site where you can download and install " "Adobe Flash.\n" "\n" "You should quit %(appname)s now and start it up again after Adobe Flash has " "been installed.", {"appname": app.config.get(prefs.SHORT_APP_NAME)}) dialogs.show_message(title, description) else: app.config.set(prefs.FLASH_REQUEST_COUNT, 1)
def on_force_device_db_save_error(): selection_type, selected_tabs = app.tabs.selection if (selection_type != 'connect' or len(selected_tabs) != 1 or not isinstance(selected_tabs[0], messages.DeviceInfo)): dialogs.show_message("Usage", "You must have a device tab selected to " "force a device database error") return messages.ForceDeviceDBSaveError(selected_tabs[0]).send_to_backend()
def on_check_version(): title = _('Software Update') desc = _('You are running a copy of Miro downloaded from the Mac App ' 'store.\n\n' + 'To stay up to date with the latest version of Miro, please ' + 'visit the Mac App Store.' ) # Sigh, the import must be here. Doesn't like it when it's at the top. from miro.frontends.widgets import dialogs dialogs.show_message(title, desc)
def install_bonjour(): title = _("Install Bonjour") description = _( "%(appname)s has determined that your system may be " "missing the Bonjour components, a standard part of " "Mac OS X installations. Please review your Mac OS X installation.", {"appname": app.config.get(prefs.SHORT_APP_NAME)} ) dialogs.show_message(title, description) logging.debug('install bonjour clicked')
def install_bonjour(): title = _("Install Bonjour") description = _( "Your browser will load the web-site where you can download " "and install Bonjour.\n\n" "When the installation is finished, simply restart %(appname)s for " "the changes to take effect." ) dialogs.show_message(title, description) logging.debug('Taking to Bonjour download landing page') app.widgetapp.open_url(BONJOUR_URL)
def install_bonjour(startup=False): title = _("Install Bonjour") if not startup: description = _('For the best %(appname)s experience, we suggest you ' 'install Bonjour. Installing Bonjour will ' 'allow you share your media library with other ' '%(appname)s users on your network, as well as stream ' 'media from other %(appname)s users on your ' 'network.\n\n' '%(appname)s has determined that your system is most ' 'likely missing the Avahi mDNSResponder compatibility ' 'library. Please refer to your operating system ' 'documentation on how you can install this library.', {"appname": app.config.get(prefs.SHORT_APP_NAME)} ) else: description = _('For the best %(appname)s experience, we suggest you ' 'install Bonjour. Installing Bonjour will ' 'allow you share your media library with other ' '%(appname)s users on your network, as well as stream ' 'media from other %(appname)s users on your ' 'network.\n\n' '%(appname)s has determined that your system is most ' 'likely missing the Avahi mDNSResponder compatibility ' 'library. Please refer to your operating system ' 'documentation on how you can install this ' 'library.\n\n' 'Would you like %(appname)s to warn you on next ' 'startup?', {"appname": app.config.get(prefs.SHORT_APP_NAME)} ) if not startup: dialogs.show_message(title, description) else: # Buttons in this order because if the window is destroyed by the # "X" button it becomes -1 which is the last element of the list. ret = dialogs.show_choice_dialog(title, description, [dialogs.BUTTON_NO, dialogs.BUTTON_YES ]) if ret is None or ret == dialogs.BUTTON_YES: return else: app.config.set(prefs.BONJOUR_REQUEST_COUNT, 1)
def _on_button_clicked(self, button): d = dialogs.ask_for_directory(_("Choose Movies Directory"), initial_directory=app.config.get(prefs.MOVIES_DIRECTORY), transient_for=_pref_window) if d is not None: try: if not os.path.exists(d): os.makedirs(d) if not os.access(d, os.W_OK): raise IOError # Pretend we got an IOError. except (OSError, IOError): dialogs.show_message(_("Directory not valid"), _("Directory '%s' could not be created. " + "Please choose a directory you have " + "write access to."), dialogs.WARNING_MESSAGE) return logging.info("Created directory. It's valid.") self.path = d self.label.set_text(filename_to_unicode(d))
def install_bonjour(startup=False): title = _("Install Bonjour") if not startup: description = _( 'For the best %(appname)s experience, we suggest you ' 'install Bonjour. Installing Bonjour will ' 'allow you share your media library with other ' '%(appname)s users on your network, as well as stream ' 'media from other %(appname)s users on your ' 'network.\n\n' '%(appname)s has determined that your system is most ' 'likely missing the Avahi mDNSResponder compatibility ' 'library. Please refer to your operating system ' 'documentation on how you can install this library.', {"appname": app.config.get(prefs.SHORT_APP_NAME)}) else: description = _( 'For the best %(appname)s experience, we suggest you ' 'install Bonjour. Installing Bonjour will ' 'allow you share your media library with other ' '%(appname)s users on your network, as well as stream ' 'media from other %(appname)s users on your ' 'network.\n\n' '%(appname)s has determined that your system is most ' 'likely missing the Avahi mDNSResponder compatibility ' 'library. Please refer to your operating system ' 'documentation on how you can install this ' 'library.\n\n' 'Would you like %(appname)s to warn you on next ' 'startup?', {"appname": app.config.get(prefs.SHORT_APP_NAME)}) if not startup: dialogs.show_message(title, description) else: # Buttons in this order because if the window is destroyed by the # "X" button it becomes -1 which is the last element of the list. ret = dialogs.show_choice_dialog( title, description, [dialogs.BUTTON_NO, dialogs.BUTTON_YES]) if ret is None or ret == dialogs.BUTTON_YES: return else: app.config.set(prefs.BONJOUR_REQUEST_COUNT, 1)