/usr/share/pyshared/kedpm/frontends/gtk/app.py is in kedpm-gtk 1.0.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | # Copyright (C) 2003 Andrey Lebedev <andrey@micro.lt>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id: app.py,v 1.7 2004/01/04 17:07:16 kedder Exp $
''' Gtk Frontend Application class '''
import pygtk
pygtk.require("2.0");
import gtk
import sys
from os.path import expanduser
from kedpm.plugins.pdb_figaro import PDBFigaro
from kedpm.passdb import DatabaseNotExist
import globals
from wnd_main import MainWindow
from dialogs import NewDatabaseDialog, LoginDialog
from kedpm.frontends.frontend import Frontend
class Application(object, Frontend):
pdb = None
wnd_main = None
def openDatabase(self):
self.pdb = PDBFigaro(filename = expanduser(self.conf.options['fpm-database']))
dlg = LoginDialog(pdb = self.pdb)
password = dlg['password']
try:
res = dlg.run()
if res != gtk.RESPONSE_OK:
print "Good bye."
sys.exit(1)
except DatabaseNotExist:
dlg.destroyDialog()
newpass = self.createNewDatabase()
if newpass is None:
sys.exit(1)
self.pdb.open(newpass)
def createNewDatabase(self):
"""Create new password database and return password for created
database"""
dlg = NewDatabaseDialog()
newpass = dlg.run()
self.pdb.create(newpass, expanduser(self.conf.options['fpm-database']))
return newpass
def mainLoop(self):
globals.app = self # Make application instance available to all modules
self.wnd_main = MainWindow()
gtk.main()
def showMessage(self, message):
dialog = gtk.MessageDialog(None,
gtk.DIALOG_DESTROY_WITH_PARENT,
gtk.MESSAGE_INFO,
gtk.BUTTONS_CLOSE,
message);
dialog.run();
dialog.destroy();
def _run(self):
globals.app = self # Make application instance available to all modules
self.openDatabase()
self.wnd_main = MainWindow()
gtk.main()
#from dialogs import PasswordEditDialog
#d = PasswordEditDialog()
#d.run()
|