{"id":155465,"date":"2012-10-20T21:43:05","date_gmt":"2012-10-20T17:43:05","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=155465"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=155465","title":{"rendered":"<span class=\"post_title\">\u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u043e\u0437\u0434\u0430\u0442\u044c Unity Lens \u0434\u043b\u044f Ubuntu (\u043f\u0435\u0440\u0435\u0432\u043e\u0434)<\/span>"},"content":{"rendered":"<div class=\"content html_format\">\n<h3>\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f<\/h3>\n<p>  \u0418\u0442\u0430\u043a, \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043b\u0438\u043d\u0437\u044b, \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f:<\/p>\n<p>  * <b>Ubuntu 12.04 LTS<\/b> \u2013 <a href=\"http:\/\/releases.ubuntu.com\/12.04\/\">\u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c Ubuntu<\/a> \u203a<br \/>  * <b>Quickly<\/b> \u2013 <a href=\"http:\/\/apt.ubuntu.com\/p\/quickly\">\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0439 quickly<\/a> \u203a<br \/>  * \u0448\u0430\u0431\u043b\u043e\u043d <b>Quickly Lens<\/b> \u2013 <a href=\"http:\/\/apt.ubuntu.com\/p\/quickly-unity-lens-template\">\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d Quickly Lens<\/a> \u203a<\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043b\u0438\u043d\u0437\u044b<\/h3>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043b\u0438\u043d\u0437\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0449\u0435\u0442 \u0441\u0440\u0435\u0434\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 \u0412\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u0438. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043b\u0438\u043d\u0437\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0448\u0430\u0433\u0430 \u2014 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430. <a name=\"habracut\"><\/a>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0436\u043c\u0438\u0442\u0435 Ctrl+Alt+T \u0438 \u0432 \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0435\u043c\u0441\u044f \u043e\u043a\u043d\u0435 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430 \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code class=\"bash\">quickly create unity-lens wikipedia cd wikipedia<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"http:\/\/ubuntuone.com\/0cnPeaXsNj1BdgUYJwUirl\" alt=\"image\"\/><br \/>  \u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c!<\/p>\n<pre><code class=\"bash\">quickly edit<\/code><\/pre>\n<p>  \u042d\u0442\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043e\u0442\u043a\u0440\u043e\u0435\u0442 \u0442\u0440\u0438 \u0444\u0430\u0439\u043b\u0430 \u0432 \u0432\u0430\u0448\u0435\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e <b>__init__.py<\/b><\/p>\n<p>  \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e, \u044d\u0442\u043e Meta class. \u0417\u0434\u0435\u0441\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043d\u0430\u0448\u0435\u0439 \u043b\u0438\u043d\u0437\u044b. \u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435:  <\/p>\n<pre><code class=\"python\">\u00a0\u00a0\u00a0\u00a0class Meta: \u00a0\u00a0\u00a0\u00a0\tname = 'Wikipedia' \u00a0\u00a0\u00a0\u00a0\tdescription = 'Wikipedia Lens' \u00a0\u00a0\u00a0\u00a0\tsearch_hint = 'Search Wikipedia' \u00a0\u00a0\u00a0\u00a0\ticon = 'wikipedia.svg' \u00a0\u00a0\u00a0\u00a0\tsearch_on_blank=True  <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u043b\u0438\u043d\u0437\u0443, \u0437\u0434\u0435\u0441\u044c \u0432\u0441\u0451 \u043c\u043e\u0436\u043d\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439. <\/p>\n<p>  \u041b\u0438\u043d\u0437\u0435 \u043d\u0443\u0436\u043d\u044b \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0434\u043b\u044f \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432. \u0414\u043b\u044f \u0412\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u0438 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u043d\u0430 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u043d\u0430\u0440\u0435\u0447\u0451\u043c \u00abArticles\u00bb<br \/>  \u041f\u043e\u0441\u043b\u0435 Meta class \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u043a\u043e\u0434\u0430:  <\/p>\n<pre><code class=\"python\">\u00a0\u00a0\u00a0\u00a0\texample_category = ListViewCategory(&quot;Examples&quot;, 'help') <\/code><\/pre>\n<p>  \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0451 \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u043d\u0443\u0436\u0434.<br \/>  * \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043c\u044b \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u0438\u043c\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u043d\u0430 articles_category<br \/>  * \u0417\u0430\u0442\u0435\u043c, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u044b\u0431\u043e\u0440 \u043c\u0435\u0436\u0434\u0443 ListView \u0438 IconView \u0434\u043b\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438. \u041c\u044b \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c: ListView<br \/>  * \u041d\u0430\u043c \u0442\u0430\u043a\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0434\u0430\u0442\u044c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c\u043e\u0435 \u0438\u043c\u044f \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0439 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438. \u0412\u0441\u0451 \u043f\u0440\u043e\u0441\u0442\u043e: Articles<br \/>  * \u0418 \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0438\u043a\u043e\u043d\u043a\u0443 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0439 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0438 \u043c\u044b \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u0435\u0451 \u0438\u0437 \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e: dialog-information-symbolic<br \/>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u0447\u043a\u0430:  <\/p>\n<pre><code class=\"python\">\u00a0\u00a0\u00a0\u00a0\tarticles_category = ListViewCategory(&quot;Articles&quot;, &quot;dialog-information-symbolic&quot;) <\/code><\/pre>\n<p>  \u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044f\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043b\u0438\u043d\u0437\u044b \u0433\u043e\u0442\u043e\u0432\u0430, \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0435\u043c \u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u043f\u043e\u0438\u0441\u043a\u0430.<br \/>  \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043a\u043e\u0434 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u043a\u0430\u043a \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u043b\u0438\u043d\u0437\u0443:  <\/p>\n<pre><code class=\"python\">\u00a0\u00a0\u00a0\u00a0def search(self, search, results): \u00a0\u00a0\u00a0\u00a0    # TODO: Add your search results \u00a0\u00a0\u00a0\u00a0    results.append('https:\/\/wiki.ubuntu.com\/Unity\/Lenses\/Singlet',     \u00a0\u00a0\u00a0\u00a0            'ubuntu-logo',     \u00a0\u00a0\u00a0\u00a0            self.example_category,     \u00a0\u00a0\u00a0\u00a0            &quot;text\/html&quot;,     \u00a0\u00a0\u00a0\u00a0            'Learn More',     \u00a0\u00a0\u00a0\u00a0            'Find out how to write your Unity Lens',     \u00a0\u00a0\u00a0\u00a0            'https:\/\/wiki.ubuntu.com\/Unity\/Lenses\/Singlet')     \u00a0\u00a0\u00a0\u00a0pass <\/code><\/pre>\n<p>  \u2026 \u043d\u043e \u0432\u0435\u0434\u044c \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u0432\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u044e\u2026<\/p>\n<h3>\u041f\u043e\u0438\u0441\u043a \u0432 \u0412\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u0438<\/h3>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043d\u043e\u0432\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0438\u0437\u0432\u0430\u043d\u0430 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u043f\u043e\u0438\u0441\u043a. \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u043c\u044b \u044d\u0442\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/p>\n<p>  \u041c\u044b \u043d\u0430\u0437\u043e\u0432\u0451\u043c \u043d\u0430\u0448\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e wikipedia_query. \u041e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u043f\u043e\u0438\u0441\u043a\u0430 \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043a\u0430\u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442. \u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u0435\u0449\u0451 \u0434\u0432\u0430 \u043c\u043e\u0434\u0443\u043b\u044f Python \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u043d\u0443\u0436\u0434: urllib2 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 HTTP \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u0441\u0435\u0442\u044c \u0438 simplejson \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0412\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u0438.<\/p>\n<p>  \u0412 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043c\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043d\u0443\u0436\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b import  <\/p>\n<pre><code class=\"python\">\u00a0\u00a0\u00a0\u00a0\timport urllib2 \u00a0\u00a0\u00a0\u00a0\timport simplejson <\/code><\/pre>\n<p>  \u0417\u0430\u0442\u0435\u043c, \u0432 \u043a\u043b\u0430\u0441\u0441 WikipediaLens(SingleScopeLens) class, \u043d\u0430\u0448 \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e wiki, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442 \u043d\u0430\u0448 \u043a\u043e\u0434:  <\/p>\n<pre><code class=\"python\">\u00a0\u00a0\u00a0\u00a0\twiki = &quot;http:\/\/en.wikipedia.org&quot; <\/code><\/pre>\n<p>  \u0418 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e  <\/p>\n<pre><code class=\"python\">\u00a0\u00a0\u00a0\u00a0\tdef wikipedia_query(self, search): <\/code><\/pre>\n<p>  \u0433\u0434\u0435 <b>search<\/b> \u2014 \u044d\u0442\u043e \u0441\u0442\u0440\u043e\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0432\u043e\u0434\u0438\u0442 \u0432 \u043e\u043a\u043d\u043e \u043f\u043e\u0438\u0441\u043a\u0430. \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0435\u0451 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0442\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0412\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u0438, \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u0435\u043b\u044b \u043d\u0430 \u00ab|\u00bb, \u0438\u043d\u0430\u0447\u0435 \u0412\u0438\u043a\u0430 \u043d\u0435 \u043f\u043e\u0439\u043c\u0451\u0442 \u043d\u0430\u0448 \u0437\u0430\u043f\u0440\u043e\u0441.  <\/p>\n<pre><code class=\"python\">\u00a0\u00a0\u00a0\u00a0\tsearch = search.replace(&quot; &quot;, &quot;|&quot;) <\/code><\/pre>\n<p>  \u041c\u044b \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043d\u0430\u0448 \u0437\u0430\u043f\u0440\u043e\u0441, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 API \u0412\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u0438.  <\/p>\n<pre><code class=\"python\">\u00a0\u00a0\u00a0\u00a0\turl = (&quot;%s\/w\/api.php?action=opensearch&limit=25&format=json&search=%s&quot; % (self.wiki, search))<\/code><\/pre>\n<p>  \u0418 \u043c\u044b \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e results, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 json, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c simplejson  <\/p>\n<pre><code class=\"python\">\u00a0\u00a0\u00a0\u00a0\tresults = simplejson.loads(urllib2.urlopen(url).read()) <\/code><\/pre>\n<p>  \u041c\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c:  <\/p>\n<pre><code class=\"python\">\u00a0\u00a0\u00a0\u00a0\tprint &quot;Searching Wikipedia for %s&quot; % (search) <\/code><\/pre>\n<p>  \u0418 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u043c \u0441\u0432\u043e\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u043d\u0430\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u0432\u044b\u0432\u043e\u0434\u043e\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e  <\/p>\n<pre><code class=\"python\">\u00a0\u00a0\u00a0\u00a0\treturn results[1] <\/code><\/pre>\n<p>  \u041d\u0430\u0448\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f wikipedia_query \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u043e\u0447\u0442\u0438 \u043a\u0430\u043a \u043d\u0430\u0434\u043e, \u043d\u0443\u0436\u043d\u043e \u0435\u0449\u0451 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c try \u0438 except \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043e\u043a (\u043e\u0448\u0438\u0431\u043a\u0438 \u0441\u0435\u0442\u0438, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0438 \u0442. \u043f.). \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0438 \u043f\u0443\u0441\u0442\u043e\u0439 \u0432\u044b\u0432\u043e\u0434.  <\/p>\n<pre><code class=\"python\">\u00a0\u00a0\u00a0\u00a0\tdef wikipedia_query(self,search): \u00a0\u00a0\u00a0\u00a0\t    try: \u00a0\u00a0\u00a0\u00a0\t        search = search.replace(&quot; &quot;, &quot;|&quot;) \u00a0\u00a0\u00a0\u00a0\t        url = (&quot;%s\/w\/api.php?action=opensearch&limit=25&format=json&search=%s&quot; % (self.wiki, search)) \u00a0\u00a0\u00a0\u00a0\t        results = simplejson.loads(urllib2.urlopen(url).read()) \u00a0\u00a0\u00a0\u00a0\t        print &quot;Searching Wikipedia&quot; \u00a0\u00a0\u00a0\u00a0\t        return results[1] \u00a0\u00a0\u00a0\u00a0\t    except (IOError, KeyError, urllib2.URLError, urllib2.HTTPError, simplejson.JSONDecodeError): \u00a0\u00a0\u00a0\u00a0\t        print &quot;Error : Unable to search Wikipedia&quot; \u00a0\u00a0\u00a0\u00a0\t        return [] <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0441\u0432\u0435\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432 \u0434\u0430\u0432\u043d\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u044e\u044e search  <\/p>\n<pre><code class=\"python\">\u00a0\u00a0\u00a0\u00a0\tdef search(self, search, results): \u00a0\u00a0\u00a0\u00a0\t    for article in self.wikipedia_query(search): \u00a0\u00a0\u00a0\u00a0\t        results.append(&quot;%s\/wiki\/%s&quot; % (self.wiki, article), \u00a0\u00a0\u00a0\u00a0\t                    &quot;http:\/\/upload.wikimedia.org\/wikipedia\/commons\/6\/63\/Wikipedia-logo.png&quot;, \u00a0\u00a0\u00a0\u00a0\t                    self.articles_category, \u00a0\u00a0\u00a0\u00a0\t                    &quot;text\/html&quot;, \u00a0\u00a0\u00a0\u00a0\t                    article, \u00a0\u00a0\u00a0\u00a0\t                    &quot;Wikipedia Article&quot;, \u00a0\u00a0\u00a0\u00a0\t                    &quot;%s\/wiki\/%s&quot; % (self.wiki, article)) \u00a0\u00a0\u00a0\u00a0\t    pass <\/code><\/pre>\n<p>  \u0420\u0430\u0431\u043e\u0442\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a: \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0432 <i>wikipedia_query<\/i>, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u0432\u0438\u043a\u0435\u043f\u0435\u0434\u0438\u044e, \u043e\u0442\u0432\u0435\u0442 \u0432 JSON \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 <i>wikipedia_query<\/i>, \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0432 <i>search<\/i> \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0432 \u043b\u0438\u043d\u0437\u0435. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 results.append \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u044b\u0432\u043e\u0434 \u0432 \u043b\u0438\u043d\u0437\u0435. \u041e\u043d \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0432 Unity \u043f\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0443:  <\/p>\n<pre><code class=\"python\">\u00a0\u00a0\u00a0\u00a0\tresults.append (url, \u00a0\u00a0\u00a0\u00a0\t            icon, \u00a0\u00a0\u00a0\u00a0\t            category, \u00a0\u00a0\u00a0\u00a0\t            mime-type, \u00a0\u00a0\u00a0\u00a0\t            text, \u00a0\u00a0\u00a0\u00a0\t            comment, \u00a0\u00a0\u00a0\u00a0\t            drag and drop url) <\/code><\/pre>\n<p>  <b>\u0412\u043e\u0442 \u0438 \u0432\u0441\u0451 \u0433\u043e\u0442\u043e\u0432\u043e!<\/b><\/p>\n<h3>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043b\u0438\u043d\u0437\u044b<\/h3>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0441\u0442\u0443\u043f\u0438\u043b \u0441\u0430\u043c\u044b\u0439 \u0434\u043e\u043b\u0433\u043e\u0436\u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u2014 \u043c\u044b \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0435\u043c \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u043b\u0438\u043d\u0437\u044b! <br \/>  \u0412\u0432\u043e\u0434\u0438\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435:<\/p>\n<pre><code class=\"bash\">sudo quickly install quickly run <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"http:\/\/ubuntuone.com\/5JQcKebRzvLKwDySc5jBHZ\" alt=\"image\"\/><\/p>\n<h4>\u0421\u0441\u044b\u043b\u043a\u0438<\/h4>\n<p>  * <a href=\"http:\/\/developer.ubuntu.com\/2012\/04\/how-to-create-a-wikipedia-unity-lens-for-ubuntu\/\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c<\/a><br \/>  * <a href=\"http:\/\/developer.ubuntu.com\/resources\/platform\/unity\/\">\u0423\u0437\u043d\u0430\u0439\u0442\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043e Unity \u0438 \u0441\u043e\u043f\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f\u0445<\/a> (\u043d\u0430 \u0430\u043d\u0433\u043b.)<br \/>  * <a href=\"http:\/\/developer.ubuntu.com\/resources\/technologies\/lenses-and-scopes\/\">\u0423\u0437\u043d\u0430\u0439\u0442\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043e \u043b\u0438\u043d\u0437\u0430\u0445 Unity<\/a> (\u043d\u0430 \u0430\u043d\u0433\u043b.)<br \/>  * <a href=\"http:\/\/developer.ubuntu.com\/resources\/platform\/api\/\">Unity API<\/a><br \/>  * <a href=\"http:\/\/www.mediawiki.org\/wiki\/API:Opensearch\">Wikipedia opensearch API<\/a><br \/>  * <a href=\"http:\/\/paste.ubuntu.com\/907519\/\">\u041b\u0438\u043d\u0437\u0430, \u0441\u0434\u0435\u043b\u0430\u043d\u043d\u0430\u0439 \u043f\u043e \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0440\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0443<\/a><br \/>  * <a href=\"http:\/\/skai-falkorr.blogspot.com\/2012\/04\/overview-lens-dash.html\">\u041f\u043e\u0434\u0431\u043e\u0440\u043a\u0430 \u043b\u0438\u043d\u0437 \u0434\u043b\u044f Dash<\/a>,<br \/>   \u00a0\u00a0\u00a0\u00a0 self.example_category,<br \/>   \u00a0\u00a0\u00a0\u00a0 \t\t\t \t\t\t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/155465\/\"> http:\/\/habrahabr.ru\/post\/155465\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">\n<h3>\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f<\/h3>\n<p>  \u0418\u0442\u0430\u043a, \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043b\u0438\u043d\u0437\u044b, \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f:<\/p>\n<p>  * <b>Ubuntu 12.04 LTS<\/b> \u2013 <a href=\"http:\/\/releases.ubuntu.com\/12.04\/\">\u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c Ubuntu<\/a> \u203a<br \/>  * <b>Quickly<\/b> \u2013 <a href=\"http:\/\/apt.ubuntu.com\/p\/quickly\">\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0439 quickly<\/a> \u203a<br \/>  * \u0448\u0430\u0431\u043b\u043e\u043d <b>Quickly Lens<\/b> \u2013 <a href=\"http:\/\/apt.ubuntu.com\/p\/quickly-unity-lens-template\">\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d Quickly Lens<\/a> \u203a<\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043b\u0438\u043d\u0437\u044b<\/h3>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043b\u0438\u043d\u0437\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0449\u0435\u0442 \u0441\u0440\u0435\u0434\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 \u0412\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u0438. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043b\u0438\u043d\u0437\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0448\u0430\u0433\u0430 \u2014 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430. <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-155465","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/155465","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=155465"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/155465\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=155465"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=155465"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=155465"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}