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

# Form implementation generated from reading ui file '/home/detlev/Development/Python/Eric/eric3_9/eric3/Preferences/ShortcutForm.ui'
#
# Created: Sa Dez 3 17:06:56 2005
#      by: The PyQt User Interface Compiler (pyuic) 3.15
#
# 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.shortcutsButtonGroup = QButtonGroup(self,"shortcutsButtonGroup")
        self.shortcutsButtonGroup.setColumnLayout(0,Qt.Vertical)
        self.shortcutsButtonGroup.layout().setSpacing(6)
        self.shortcutsButtonGroup.layout().setMargin(6)
        shortcutsButtonGroupLayout = QGridLayout(self.shortcutsButtonGroup.layout())
        shortcutsButtonGroupLayout.setAlignment(Qt.AlignTop)

        self.primaryButton = QRadioButton(self.shortcutsButtonGroup,"primaryButton")
        self.primaryButton.setFocusPolicy(QRadioButton.NoFocus)
        self.primaryButton.setChecked(1)

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

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

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

        self.keyLabel = QLabel(self.shortcutsButtonGroup,"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)

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

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

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

        self.alternateKeyLabel = QLabel(self.shortcutsButtonGroup,"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)

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

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

        shortcutsButtonGroupLayout.addWidget(self.alternateButton,1,0)
        ShortcutFormLayout.addWidget(self.shortcutsButtonGroup)

        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,117).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.shortcutsButtonGroup.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()
