"""
     CCP4ManageDbGui.py: CCP4 GUI Project
     Copyright (C) 2014 STFC

     This library is free software: you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public License
     version 3, modified in accordance with the provisions of the 
     license to address the requirements of UK law.
 
     You should have received a copy of the modified GNU Lesser General 
     Public License along with this library.  If not, copies may be 
     downloaded from http://www.ccp4.ac.uk/ccp4license.php
 
     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 Lesser General Public License for more details.
"""

"""
     Liz Potterton Sep 2014 - Tools to manage database
"""

from PyQt4 import QtGui,QtCore

  
class CChallengeUnknownUser(QtGui.QDialog):
  def __init__(self,parent=None,currentUserName='UNKNOWN'):
    QtGui.QDialog.__init__(self,parent=None)
    self.setModal(True)
    self.setWindowTitle('Unknown user')
    layout = QtGui.QVBoxLayout()
    self.setLayout(layout)
    self.layout().addWidget(QtGui.QLabel('Your username '+currentUserName+' is unknown to the database',self))
    line = QtGui.QHBoxLayout()
    self.layout().addLayout(line)
    line.addWidget(QtGui.QLabel('Enter the name of the database owner',self))
    self.userNameWidget = QtGui.QLineEdit(self)
    line.addWidget(self.userNameWidget)
    self.resetName = QtGui.QCheckBox('Reset name of database owner to your username',self)
    self.layout().addWidget(self.resetName)

    box = QtGui.QDialogButtonBox(self)
    but = box.addButton(QtGui.QDialogButtonBox.Apply)
    self.connect(but,QtCore.SIGNAL('clicked()'),self.accept)
    but = box.addButton(QtGui.QDialogButtonBox.Cancel)
    self.connect(but,QtCore.SIGNAL('clicked()'),self.reject)
    self.layout().addWidget(box)

    self.raise_()

  def getOwner(self):
    return self.userNameWidget.text().__str__()

  def getReset(self):
    return self.resetName.isChecked()
    
  
class CDbManagerDialog(QtGui.QDialog):

  def __init__(self,parent=None):
    QtGui.QDialog.__init__(self,parent)
    self.setWindowTitle('Database manager')
    layout = QtGui.QVBoxLayout()
    self.setLayout(layout)

    
  
