{"id":1577,"date":"2012-12-31T18:27:14","date_gmt":"2012-12-31T14:27:14","guid":{"rendered":"http:\/\/nayarweb.com\/blog\/?p=1577"},"modified":"2012-12-31T18:27:17","modified_gmt":"2012-12-31T14:27:17","slug":"writing-my-first-krunner-plugin-ft-mysql-connection","status":"publish","type":"post","link":"https:\/\/nayarweb.com\/blog\/2012\/writing-my-first-krunner-plugin-ft-mysql-connection\/","title":{"rendered":"Writing my First KRunner Plugin ft. MySQL Connection"},"content":{"rendered":"<p>Finally managed to make a KRunner plugin linking my Web Tech 2 project&#8217;s database. It allows the user to search the database from anywhere.<\/p>\n<p><a href=\"https:\/\/nayarweb.com\/blog\/2012\/writing-my-first-krunner-plugin-ft-mysql-connection\/snapshot358\/\" rel=\"attachment wp-att-1579\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-1579\" alt=\"Quick Recipe KRunner\" src=\"https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2012\/12\/snapshot358-300x77.png\" width=\"300\" height=\"77\" srcset=\"https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2012\/12\/snapshot358-300x77.png 300w, https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2012\/12\/snapshot358.png 538w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>It is really easy to do it. I followed this guide from KDE website: <a href=\"http:\/\/techbase.kde.org\/Development\/Tutorials\/Plasma\/PythonRunner\" target=\"_blank\">http:\/\/techbase.kde.org\/Development\/Tutorials\/Plasma\/PythonRunner<\/a><\/p>\n<p>To make it access the database, you need to import the Python\/MySQL connector<\/p>\n<p style=\"padding-left: 30px;\">import mysql.connector<\/p>\n<p>We write the codes to query the database and send the results to KRunner. q contains the text the user input.<\/p>\n<p><a href=\"https:\/\/nayarweb.com\/blog\/2012\/writing-my-first-krunner-plugin-ft-mysql-connection\/snapshot359\/\" rel=\"attachment wp-att-1580\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-1580\" alt=\"Writing KRunner plugin with MySQL query\" src=\"https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2012\/12\/snapshot359-300x140.png\" width=\"300\" height=\"140\" srcset=\"https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2012\/12\/snapshot359-300x140.png 300w, https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2012\/12\/snapshot359.png 682w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\nWhen its done, we compile it and install it:<\/p>\n<p style=\"padding-left: 30px;\">plasmapkg &#8211;type runner &#8211;install .\/<\/p>\n<p>It&#8217;s done \ud83d\ude42<\/p>\n<p>Here&#8217;s the source code: <a href=\"https:\/\/nayarweb.com\/blog\/2012\/writing-my-first-krunner-plugin-ft-mysql-connection\/qr_runner\/\" rel=\"attachment wp-att-1582\">qr_runner<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Finally managed to make a KRunner plugin linking my Web Tech 2 project&#8217;s database. It allows the user to search the database from anywhere. It is really easy to do it. I followed this guide from KDE website: http:\/\/techbase.kde.org\/Development\/Tutorials\/Plasma\/PythonRunner To make it access the database, you need to import the Python\/MySQL connector import mysql.connector We &hellip; <a href=\"https:\/\/nayarweb.com\/blog\/2012\/writing-my-first-krunner-plugin-ft-mysql-connection\/\" class=\"continue-reading\">Continue reading <span class=\"screen-reader-text\">Writing my First KRunner Plugin ft. MySQL Connection<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[152,55,57,61],"class_list":["post-1577","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-coding","tag-kde","tag-kubuntu","tag-linux"],"_links":{"self":[{"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/posts\/1577","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/comments?post=1577"}],"version-history":[{"count":5,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/posts\/1577\/revisions"}],"predecessor-version":[{"id":1585,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/posts\/1577\/revisions\/1585"}],"wp:attachment":[{"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/media?parent=1577"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/categories?post=1577"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/tags?post=1577"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}