| 1 | #! /usr/bin/env python |
|---|
| 2 | |
|---|
| 3 | # rpminstall |
|---|
| 4 | # Copyright (C) Yasumichi Akahoshi 2011 <yasumichi@vinelinux.org> |
|---|
| 5 | # |
|---|
| 6 | # pygtk-rpminstall is free software: you can redistribute it and/or modify it |
|---|
| 7 | # under the terms of the GNU General Public License as published by the |
|---|
| 8 | # Free Software Foundation, either version 3 of the License, or |
|---|
| 9 | # (at your option) any later version. |
|---|
| 10 | # |
|---|
| 11 | # pygtk-rpminstall is distributed in the hope that it will be useful, but |
|---|
| 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|---|
| 14 | # See the GNU General Public License for more details. |
|---|
| 15 | # |
|---|
| 16 | # You should have received a copy of the GNU General Public License along |
|---|
| 17 | # with this program. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 18 | |
|---|
| 19 | from gi.repository import Gtk |
|---|
| 20 | import os |
|---|
| 21 | import locale |
|---|
| 22 | import gettext |
|---|
| 23 | |
|---|
| 24 | locale.setlocale(locale.LC_ALL, '') |
|---|
| 25 | gettext.bindtextdomain("rpminstall") |
|---|
| 26 | gettext.textdomain("rpminstall") |
|---|
| 27 | gettext.install('rpminstall', unicode=True) |
|---|
| 28 | |
|---|
| 29 | # Import from src first so that we can run directly from the source tree for |
|---|
| 30 | # development. |
|---|
| 31 | try: |
|---|
| 32 | from src import rpminstall |
|---|
| 33 | except ImportError, e: |
|---|
| 34 | from rpminstall import rpminstall |
|---|
| 35 | |
|---|
| 36 | if os.geteuid() != 0: |
|---|
| 37 | dialog = Gtk.MessageDialog(None, 0, Gtk.MessageType.ERROR, |
|---|
| 38 | Gtk.ButtonsType.CANCEL, _("Please perform by root authority. ")) |
|---|
| 39 | dialog.run() |
|---|
| 40 | exit() |
|---|
| 41 | |
|---|
| 42 | app = rpminstall.GUI() |
|---|
| 43 | Gtk.main() |
|---|
| 44 | |
|---|