コード例 #1
0
ファイル: newfeed.py プロジェクト: cool-RR/Miro
def run_dialog():
    """Creates and launches the New Feed dialog.  This dialog waits for
    the user to press "Create Feed" or "Cancel".

    Returns a tuple of the (url, section).
    """
    text = app.widgetapp.get_clipboard_text()
    if text and feed.validate_feed_url(text):
        text = feed.normalize_feed_url(text)
    else:
        text = ""

    title = _('Add Feed')
    description = _('Enter the URL of the feed to add')

    while 1:
        text, section = _run_dialog(title, description, initial_text=text)
        if text == None:
            return (None, None)

        normalized_url = feed.normalize_feed_url(text)
        if feed.validate_feed_url(normalized_url):
            return (normalized_url, section)

        title = _('Add Feed - Invalid URL')
        description = _('The address you entered is not a valid url.\nPlease check the URL and try again.\n\nEnter the URL of the feed to add')
コード例 #2
0
ファイル: newfeed.py プロジェクト: CodeforEvolution/miro
def run_dialog():
    """Creates and launches the New Feed dialog.  This dialog waits for
    the user to press "Create Podcast" or "Cancel".

    Returns the URL, or None.
    """
    text = app.widgetapp.get_clipboard_text()
    if text and feed.validate_feed_url(text):
        text = feed.normalize_feed_url(text)
    else:
        text = ""

    title = _('Add Podcast')
    description = _('Enter the URL of the podcast to add')

    while 1:
        text = _run_dialog(title, description, initial_text=text)
        if text == None:
            return None

        normalized_url = feed.normalize_feed_url(text)
        if feed.validate_feed_url(normalized_url):
            return normalized_url

        title = _('Add Podcast - Invalid URL')
        description = _(
            'The address you entered is not a valid url.  '
            'Please check the URL and try again.'
            '\n\n'
            'Enter the URL of the podcast to add')
コード例 #3
0
def run_dialog():
    """Creates and launches the New Feed dialog.  This dialog waits for
    the user to press "Create Podcast" or "Cancel".

    Returns the URL, or None.
    """
    text = app.widgetapp.get_clipboard_text()
    if text and feed.validate_feed_url(text):
        text = feed.normalize_feed_url(text)
    else:
        text = ""

    title = _('Add Podcast')
    description = _('Enter the URL of the podcast to add')

    while 1:
        text = _run_dialog(title, description, initial_text=text)
        if text == None:
            return None

        normalized_url = feed.normalize_feed_url(text)
        if feed.validate_feed_url(normalized_url):
            return normalized_url

        title = _('Add Podcast - Invalid URL')
        description = _('The address you entered is not a valid url.  '
                        'Please check the URL and try again.'
                        '\n\n'
                        'Enter the URL of the podcast to add')
コード例 #4
0
ファイル: feedtest.py プロジェクト: cool-RR/Miro
 def test_garbage(self):
     for i, o in [(u"http:foo.bar.com", u"http://foo.bar.com/"),
                  (u"https:foo.bar.com", u"https://foo.bar.com/"),
                  (u"feed:foo.bar.com", u"http://foo.bar.com/"),
                  (u"http:/foo.bar.com", u"http://foo.bar.com/"),
                  (u"https:/foo.bar.com", u"https://foo.bar.com/"),
                  (u"feed:/foo.bar.com", u"http://foo.bar.com/"),
                  (u"http:///foo.bar.com", u"http://foo.bar.com/"),
                  (u"https:///foo.bar.com", u"https://foo.bar.com/"),
                  (u"feed:///foo.bar.com", u"http://foo.bar.com/"),
                  (u"foo.bar.com", u"http://foo.bar.com/"),
                  (u"http://foo.bar.com:80", u"http://foo.bar.com:80/"),
                  ]:
         self.assertEquals(normalize_feed_url(i), o)
コード例 #5
0
def ask_for_feed_subscribe(url):
    url = feed.normalize_feed_url(url)
    title = _("Subscribe to Podcast")
    text = _(
        "This link appears to be a podcast.  Do you want to add it to "
        "your subscriptions?\n"
        "\n"
        "%(url)s",
        {"url": url}
    )
    choices = (dialogs.BUTTON_SUBSCRIBE, dialogs.BUTTON_CANCEL)
    ret = dialogs.show_choice_dialog(title, text, choices)
    if ret == dialogs.BUTTON_SUBSCRIBE:
        messages.NewFeed(url).send_to_backend()
コード例 #6
0
ファイル: feedtest.py プロジェクト: zjmmjzzjm/miro
 def test_garbage(self):
     for i, o in [
         (u"http:foo.bar.com", u"http://foo.bar.com/"),
         (u"https:foo.bar.com", u"https://foo.bar.com/"),
         (u"feed:foo.bar.com", u"http://foo.bar.com/"),
         (u"http:/foo.bar.com", u"http://foo.bar.com/"),
         (u"https:/foo.bar.com", u"https://foo.bar.com/"),
         (u"feed:/foo.bar.com", u"http://foo.bar.com/"),
         (u"http:///foo.bar.com", u"http://foo.bar.com/"),
         (u"https:///foo.bar.com", u"https://foo.bar.com/"),
         (u"feed:///foo.bar.com", u"http://foo.bar.com/"),
         (u"foo.bar.com", u"http://foo.bar.com/"),
         (u"http://foo.bar.com:80", u"http://foo.bar.com:80/"),
     ]:
         self.assertEquals(normalize_feed_url(i), o)
コード例 #7
0
ファイル: tabcontroller.py プロジェクト: kmshi/miro
 def _on_add_source(self, *args):
     url = self.source_entry.get_text()
     url = feed.normalize_feed_url(url)
     if url:
         messages.NewGuide(url).send_to_backend()
         self.source_entry.set_text('')
コード例 #8
0
ファイル: feedtest.py プロジェクト: zjmmjzzjm/miro
 def test_easy(self):
     for i, o in [(u"http://foo.bar.com", u"http://foo.bar.com/"),
                  (u"https://foo.bar.com", u"https://foo.bar.com/"),
                  (u"feed://foo.bar.com", u"http://foo.bar.com/")]:
         self.assertEqual(normalize_feed_url(i), o)
コード例 #9
0
ファイル: feedtest.py プロジェクト: cool-RR/Miro
 def test_easy(self):
     for i, o in [(u"http://foo.bar.com", u"http://foo.bar.com/"),
                  (u"https://foo.bar.com", u"https://foo.bar.com/"),
                  (u"feed://foo.bar.com", u"http://foo.bar.com/")
                  ]:
         self.assertEqual(normalize_feed_url(i), o)
コード例 #10
0
 def _on_add_source(self, *args):
     url = self.source_entry.get_text()
     url = feed.normalize_feed_url(url)
     if url:
         messages.NewGuide(url).send_to_backend()
         self.source_entry.set_text('')