# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file '/home/detlev/Development/Python/Eric/eric3_6/eric3/Preferences/ShortcutForm.ui'
#
# Created: Do Dez 30 14:12:43 2004
#      by: The PyQt User Interface Compiler (pyuic) snapshot-20041229
#
# WARNING! All changes made in this file will be lost!


import sys
from qt import *


class ShortcutForm(QDialog):
    def __init__(self,parent = None,name = None,modal = 0,fl = 0):
        QDialog.__init__(self,parent,name,modal,fl)

        if not name:
            self.setName("ShortcutForm")


        ShortcutFormLayout = QVBoxLayout(self,6,6,"ShortcutFormLayout")

        self.buttonGroup1 = QButtonGroup(self,"buttonGroup1")
        self.buttonGroup1.setColumnLayout(0,Qt.Vertical)
        self.buttonGroup1.layout().setSpacing(6)
        self.buttonGroup1.layout().setMargin(6)
        buttonGroup1Layout = QGridLayout(self.buttonGroup1.layout())
        buttonGroup1Layout.setAlignment(Qt.AlignTop)

        self.primaryButton = QRadioButton(self.buttonGroup1,"primaryButton")
        self.primaryButton.setChecked(1)

        buttonGroup1Layout.addWidget(self.primaryButton,0,0)

        self.primaryClearButton = QPushButton(self.buttonGroup1,"primaryClearButton")
        self.primaryClearButton.setFocusPolicy(QPushButton.NoFocus)

        buttonGroup1Layout.addWidget(self.primaryClearButton,0,1)

        self.keyLabel = QLabel(self.buttonGroup1,"keyLabel")
        self.keyLabel.setSizePolicy(QSizePolicy(QSizePolicy.Expanding,QSizePolicy.Preferred,0,0,self.keyLabel.sizePolicy().hasHeightForWidth()))
        self.keyLabel.setFrameShape(QLabel.Panel)
        self.keyLabel.setFrameShadow(QLabel.Sunken)

        buttonGroup1Layout.addWidget(self.keyLabel,0,2)

        self.alternateClearButton = QPushButton(self.buttonGroup1,"alternateClearButton")
        self.alternateClearButton.setEnabled(0)
        self.alternateClearButton.setFocusPolicy(QPushButton.NoFocus)

        buttonGroup1Layout.addWidget(self.alternateClearButton,1,1)

        self.alternateKeyLabel = QLabel(self.buttonGroup1,"alternateKeyLabel")
        self.alternateKeyLabel.setSizePolicy(QSizePolicy(QSizePolicy.Expanding,QSizePolicy.Preferred,0,0,self.alternateKeyLabel.sizePolicy().hasHeightForWidth()))
        self.alternateKeyLabel.setFrameShape(QLabel.Panel)
        self.alternateKeyLabel.setFrameShadow(QLabel.Sunken)

        buttonGroup1Layout.addWidget(self.alternateKeyLabel,1,2)

        self.alternateButton = QRadioButton(self.buttonGroup1,"alternateButton")

        buttonGroup1Layout.addWidget(self.alternateButton,1,0)
        ShortcutFormLayout.addWidget(self.buttonGroup1)

        layout1 = QHBoxLayout(None,0,6,"layout1")
        spacer1 = QSpacerItem(40,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
        layout1.addItem(spacer1)

        self.okButton = QPushButton(self,"okButton")
        self.okButton.setFocusPolicy(QPushButton.NoFocus)
        self.okButton.setDefault(1)
        layout1.addWidget(self.okButton)

        self.cancelButton = QPushButton(self,"cancelButton")
        self.cancelButton.setFocusPolicy(QPushButton.NoFocus)
        layout1.addWidget(self.cancelButton)
        spacer2 = QSpacerItem(40,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
        layout1.addItem(spacer2)
        ShortcutFormLayout.addLayout(layout1)

        self.languageChange()

        self.resize(QSize(539,116).expandedTo(self.minimumSizeHint()))
        self.clearWState(Qt.WState_Polished)

        self.connect(self.okButton,SIGNAL("clicked()"),self.handleOk)
        self.connect(self.cancelButton,SIGNAL("clicked()"),self.reject)
        self.connect(self.primaryClearButton,SIGNAL("clicked()"),self.handleClear)
        self.connect(self.alternateClearButton,SIGNAL("clicked()"),self.handleClear)
        self.connect(self.primaryButton,SIGNAL("toggled(bool)"),self.primaryClearButton.setEnabled)
        self.connect(self.alternateButton,SIGNAL("toggled(bool)"),self.alternateClearButton.setEnabled)
        self.connect(self.primaryButton,SIGNAL("clicked()"),self.handleTypeChanged)
        self.connect(self.alternateButton,SIGNAL("clicked()"),self.handleTypeChanged)


    def languageChange(self):
        self.setCaption(self.__tr("Edit Shortcut"))
        QWhatsThis.add(self,self.__tr("Press your shortcut keys and select OK"))
        self.buttonGroup1.setTitle(QString.null)
        self.primaryButton.setText(self.__tr("Primary Shortcut:"))
        QToolTip.add(self.primaryButton,self.__tr("Select to change the primary keyboard shortcut"))
        self.primaryClearButton.setText(self.__tr("Clear"))
        QToolTip.add(self.primaryClearButton,self.__tr("Press to clear the key sequence buffer."))
        self.keyLabel.setText(QString.null)
        QToolTip.add(self.keyLabel,QString.null)
        self.alternateClearButton.setText(self.__tr("Clear"))
        QToolTip.add(self.alternateClearButton,self.__tr("Press to clear the key sequence buffer."))
        self.alternateKeyLabel.setText(QString.null)
        QToolTip.add(self.alternateKeyLabel,QString.null)
        self.alternateButton.setText(self.__tr("Alternative Shortcut:"))
        QToolTip.add(self.alternateButton,self.__tr("Select to change the alternative keyboard shortcut"))
        self.okButton.setText(self.__tr("OK"))
        self.cancelButton.setText(self.__tr("Cancel"))


    def handleOk(self):
        print "ShortcutForm.handleOk(): Not implemented yet"

    def handleClear(self):
        print "ShortcutForm.handleClear(): Not implemented yet"

    def handleTypeChanged(self):
        print "ShortcutForm.handleTypeChanged(): Not implemented yet"

    def __tr(self,s,c = None):
        return qApp.translate("ShortcutForm",s,c)

if __name__ == "__main__":
    a = QApplication(sys.argv)
    QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
    w = ShortcutForm()
    a.setMainWidget(w)
    w.show()
    a.exec_loop()
