Permalink
Browse files

Added entrydialog

  • Loading branch information...
1 parent a663f4d commit 6d4be56abfe50b2d4d44f180c4c0b5b903825d66 @clefebvre clefebvre committed Jul 30, 2012
View
@@ -1,3 +1,9 @@
+mint-common (1.0.8) maya; urgency=low
+
+ * Added entrydialog
+
+ -- Clement Lefebvre <root@linuxmint.com> Mon, 30 Jul 2012 14:28:05 +0100
+
mint-common (1.0.7) maya; urgency=low
* Added env_check
View
@@ -1 +1 @@
-mint-common_1.0.4_all.deb admin optional
+mint-common_1.0.7_all.deb admin optional
@@ -12,3 +12,4 @@ dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
+dh_builddeb
@@ -1,9 +1,9 @@
Package: mint-common
-Version: 1.0.4
+Version: 1.0.7
Architecture: all
Maintainer: Clement Lefebvre <root@linuxmint.com>
-Installed-Size: 228
-Depends: python (>= 2.4), python (<< 3), python-gtk2, python-glade2
+Installed-Size: 204
+Depends: python (>= 2.4), python (<< 3), python-gtk2, python-glade2, mint-translations
Section: admin
Priority: optional
Description: Common scripts and resources for Linux Mint
@@ -1,9 +1,10 @@
-14e93a561cfdbc0c2576b527451472b9 usr/share/linuxmint/logo.png
-4b9391f4ae00a41e11cde702e4b50219 usr/share/doc/mint-common/copyright
-2a0109ea5b74c4045985f7cf0208ce02 usr/share/doc/mint-common/changelog.gz
-db5b8f0b0629e5b63729d2af63b2b4b0 usr/lib/linuxmint/common/launch_browser_as.py
6579cdb663d995cc709a375d1430ab55 usr/lib/linuxmint/common/configobj.py
-d306e1092c44de75effba043d07a5280 usr/lib/linuxmint/common/version.py
a36d13c488bf58fee488c2684cdbf362 usr/lib/linuxmint/common/configobj.pyc
+13d0b7f534709f14e309e21ef6a38ce8 usr/lib/linuxmint/common/env_check.sh
2b6bfacbd27ac90e4a88dee9a64405c2 usr/lib/linuxmint/common/launch_browser.sh
-fe952b0de7343c9717f033b756f45800 usr/lib/linuxmint/common/mint-which-launcher.py
+db5b8f0b0629e5b63729d2af63b2b4b0 usr/lib/linuxmint/common/launch_browser_as.py
+0c6889ee6fd3bc83255fcdd4a931d48c usr/lib/linuxmint/common/mint-which-launcher.py
+d306e1092c44de75effba043d07a5280 usr/lib/linuxmint/common/version.py
+5fb00afbff612b7005aac663f430951e usr/share/doc/mint-common/changelog.gz
+4b9391f4ae00a41e11cde702e4b50219 usr/share/doc/mint-common/copyright
+14e93a561cfdbc0c2576b527451472b9 usr/share/linuxmint/logo.png
@@ -1,20 +1,13 @@
#!/usr/bin/python
import os
-import sys
import gettext
gettext.install("mint-common", "/usr/share/linuxmint/locale")
-launcher = "gksu --message \"<b>" + _("Please enter your password") + "</b>\""
-if os.path.exists("/etc/linuxmint/info"):
- sys.path.append('/usr/lib/linuxmint/common')
- from configobj import ConfigObj
- config = ConfigObj("/etc/linuxmint/info")
- if (config['DESKTOP'] == "KDE"):
- launcher = "kdesudo -i /usr/share/linuxmint/logo.png -d --comment \"<b>" + _("Please enter your password") + "</b>\""
+if os.path.exists("/usr/bin/gksu"):
+ launcher = "gksu --message \"<b>" + _("Please enter your password") + "</b>\""
+elif os.path.exists("/usr/bin/kdesudo"):
+ launcher = "kdesudo -i /usr/share/linuxmint/logo.png -d --comment \"<b>" + _("Please enter your password") + "</b>\""
print launcher
-
-
-
Binary file not shown.
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+import gtk, sys
+
+def responseToDialog(entry, dialog, response):
+ dialog.response(response)
+
+def showEntryDialog(primary_label="", label_name="", secondary_text="", title=""):
+ #base this on a message dialog
+ dialog = gtk.MessageDialog(
+ None,
+ gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
+ gtk.MESSAGE_QUESTION,
+ gtk.BUTTONS_OK,
+ None)
+ dialog.set_markup(primary_label)
+ dialog.set_title(title)
+ #create the text input field
+ entry = gtk.Entry()
+ #allow the user to press enter to do ok
+ entry.connect("activate", responseToDialog, dialog, gtk.RESPONSE_OK)
+ #create a horizontal box to pack the entry and a label
+ hbox = gtk.HBox()
+ hbox.pack_start(gtk.Label(label_name), False, 5, 5)
+ hbox.pack_end(entry)
+ #some secondary text
+ dialog.format_secondary_markup(secondary_text)
+ #add it and show it
+ dialog.vbox.pack_end(hbox, True, True, 0)
+ dialog.show_all()
+ #go go go
+ dialog.run()
+ text = entry.get_text()
+ dialog.destroy()
+ return text
+
+if __name__ == '__main__':
+ if (len(sys.argv) == 5):
+ print "%s" % showEntryDialog(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])
+ else:
+ print "%s" % showEntryDialog("<b>Primary</b>", "label:", "<i>secondary</i>", "title")

0 comments on commit 6d4be56

Please sign in to comment.