Пример #1
0
class Organ(KeyboardPart):
    @staticmethod
    def title(_=__builtin__._):
        return _("Organ")
    
    @staticmethod
    def short(_=__builtin__._):
        return _("abbreviation for Organ", "Org.")
    
    midiInstrument = 'church organ'

    def createWidgets(self, layout):
        super(Organ, self).createWidgets(layout)
        grid = layout.itemAt(layout.count() - 1).layout()
        self.pedalVoices = QSpinBox(minimum=0, maximum=4, value=1)
        self.pedalVoicesLabel = QLabel()
        self.pedalVoicesLabel.setBuddy(self.pedalVoices)
        grid.addWidget(self.pedalVoicesLabel, 2, 0)
        grid.addWidget(self.pedalVoices)
        
    def translateWidgets(self):
        super(Organ, self).translateWidgets()
        self.pedalVoicesLabel.setText(_("Pedal:"))
        self.pedalVoices.setToolTip(_(
            "Set to 0 to disable the pedal altogether."))
    
    def build(self, data, builder):
        super(Organ, self).build(data, builder)
        if self.pedalVoices.value():
            data.nodes.append(self.buildStaff(data, builder,
                'pedal', -1, self.pedalVoices.value(), clef="bass"))
    def __init__(self, broker, parent=None):
        super(BrokerWidget, self).__init__(parent)

        self.broker = broker

        self.dataTable = TableView()
        self.dataTable.setModel(self.broker.dataModel)
        self.dataTable.horizontalHeader().setResizeMode(QHeaderView.Stretch)
        #self.dataTable.resizeColumnsToContents()
        dataLabel = QLabel('Price Data')
        dataLabel.setBuddy(self.dataTable)

        dataLayout = QVBoxLayout()

        dataLayout.addWidget(dataLabel)
        dataLayout.addWidget(self.dataTable)

        addButton = QPushButton("&Add Symbol")
        saveDataButton = QPushButton("&Save Data")
        #deleteButton = QPushButton("&Delete")

        buttonLayout = QVBoxLayout()
        buttonLayout.addWidget(addButton)
        buttonLayout.addWidget(saveDataButton)
        buttonLayout.addStretch()

        layout = QHBoxLayout()
        layout.addLayout(dataLayout)
        layout.addLayout(buttonLayout)
        self.setLayout(layout)

        self.connect(addButton, SIGNAL('clicked()'), self.addSubscription)
        self.connect(saveDataButton, SIGNAL('clicked()'), self.saveData)
Пример #3
0
    def __init__(self, parent=None):
        super(Options, self).__init__(parent)
        self.setWindowIcon(QIcon('res/opciones4.png'))
        self.setWindowTitle('Opciones')

        self.options = load_data()['options']

        self.chk_mask = QCheckBox(u'Máscara por defecto.')
        self.line_mask = LineEdit(u'máscara', ['required', 'ms'])
        self.line_mask.focusInEvent = lambda _: self.block_focus_event()

        if self.options[0]:
            self.chk_mask.setChecked(True)
            self.line_mask.setText(self.options[1])

        self.chk_dns = QCheckBox('Servidor dns por defecto.')
        self.line_dns = LineEdit('Servidor dns', ['required', 'ip'])
        self.line_dns.focusInEvent = lambda _: self.block_focus_event()
        self.line_mask.setCursor(QCursor(Qt.ForbiddenCursor))

        if self.options[2]:
            self.chk_dns.setChecked(True)
            self.line_dns.setText(self.options[3])

        self.status(self.chk_mask.isChecked(), self.line_mask)
        self.status(self.chk_dns.isChecked(), self.line_dns)

        lbl = QLabel('Cantidad de Configuraciones permitidas.')
        spin = QSpinBox()
        spin.setRange(1, 8)
        spin.setValue(self.options[4])
        spin.setMaximumWidth(50)
        lbl.setBuddy(spin)

        btn_ok = QPushButton('OK')
        btn_ok.setMaximumWidth(200)
        btn_ok.setObjectName('btn_ok')

        btn_cancel = QPushButton('Cancel')
        btn_cancel.setMaximumWidth(200)
        btn_cancel.setObjectName('btn_cancel')

        layout = QGridLayout()
        layout.addWidget(self.chk_mask, 0, 0, 1, 3)
        layout.addWidget(self.line_mask, 1, 0, 1, 3)
        layout.addWidget(self.chk_dns, 2, 0, 1, 3)
        layout.addWidget(self.line_dns, 3, 0, 1, 3)
        layout.addWidget(lbl, 4, 0)
        layout.addWidget(spin, 4, 1)
        layout.addWidget(QLabel(''), 5, 0)
        layout.addWidget(btn_cancel, 6, 1)
        layout.addWidget(btn_ok, 6, 2)
        self.setLayout(layout)

        self.connect(self.chk_mask, SIGNAL('clicked(bool)'), self.set_disable_mask)
        self.connect(self.chk_dns, SIGNAL('clicked(bool)'), self.set_disable_dns)
        self.connect(btn_ok, SIGNAL('clicked()'), self.save_and_exit)
        self.connect(btn_ok, SIGNAL('returnPressed()'), self.save_and_exit)
        self.connect(spin, SIGNAL('valueChanged(int)'), self.spin_value)
        self.connect(btn_cancel, SIGNAL("clicked()"), self.reject)
Пример #4
0
class MainWidget(QWidget):
    def __init__(self, parent):
        super(MainWidget, self).__init__(parent)
        
        self.dataDirLineEdit = QLineEdit()
        self.dataLabel = QLabel(self.tr("Data Directory:"))
        self.dataLabel.setBuddy(self.dataDirLineEdit)
        self.dataBrowseButton = QPushButton(self.tr("&Browse..."))
        self.connect(self.dataBrowseButton, SIGNAL('clicked()'), parent.browseClicked)
             
        self.closeButton = QPushButton(self.tr("Close"))
        self.connect(self.closeButton, SIGNAL('clicked()'), parent.onClose)
        
        self.trainButton = QPushButton(self.tr("&Train"))
        self.connect(self.trainButton, SIGNAL('clicked()'), parent.trainClicked)
        
        self.textBrowser = QTextBrowser()
                
        self.dataLayout = QHBoxLayout()
        self.dataLayout.addWidget(self.dataLabel)
        self.dataLayout.addWidget(self.dataDirLineEdit)
        self.dataLayout.addWidget(self.dataBrowseButton)
        
        self.buttonLayout = QHBoxLayout()
        self.buttonLayout.addWidget(self.closeButton)
        self.buttonLayout.addWidget(self.trainButton)
        
        self.mainLayout = QVBoxLayout()
        self.mainLayout.addLayout(self.dataLayout)
        self.mainLayout.addWidget(self.textBrowser)
        self.mainLayout.addLayout(self.buttonLayout)
        
        self.setLayout(self.mainLayout)    
Пример #5
0
class Organ(KeyboardPart):
    @staticmethod
    def title(_=_base.translate):
        return _("Organ")
    
    @staticmethod
    def short(_=_base.translate):
        return _("abbreviation for Organ", "Org.")
    
    midiInstrument = 'church organ'

    def createWidgets(self, layout):
        super(Organ, self).createWidgets(layout)
        grid = layout.itemAt(layout.count() - 1).layout()
        self.pedalVoices = QSpinBox(minimum=0, maximum=4, value=1)
        self.pedalVoicesLabel = QLabel()
        self.pedalVoicesLabel.setBuddy(self.pedalVoices)
        grid.addWidget(self.pedalVoicesLabel, 2, 0)
        grid.addWidget(self.pedalVoices)
        
    def translateWidgets(self):
        super(Organ, self).translateWidgets()
        self.pedalVoicesLabel.setText(_("Pedal:"))
        self.pedalVoices.setToolTip(_(
            "Set to 0 to disable the pedal altogether."))
    
    def build(self, data, builder):
        super(Organ, self).build(data, builder)
        if self.pedalVoices.value():
            data.nodes.append(self.buildStaff(data, builder,
                'pedal', -1, self.pedalVoices.value(), clef="bass"))
Пример #6
0
class LabelledSlider(QWidget):
    '''
    This class holds QSlider, budded to QLabel
    This is used only to simplify GUI creation 
    '''
    def __init__(self, labelText=QString(), orientation=Qt.Horizontal,
                 topLeftTuple=LEFT, parent=None):
        super(LabelledSlider, self).__init__(parent)
        
        self.labelText = labelText
        self.slider = QSlider(orientation)
        self.valueChanged = self.slider.valueChanged
        self.label = QLabel(self.labelText + ' ' + str(self.slider.value()))
        self.label.setBuddy(self.slider)
        self.slider.valueChanged.connect(self.sliderMove)
        layout = QBoxLayout(QBoxLayout.LeftToRight
                if topLeftTuple == LEFT else QBoxLayout.TopToBottom)
        layout.addWidget(self.label)
        layout.addWidget(self.slider)
        self.setLayout(layout)
        # Creating links to functions
        self.value = self.slider.value
        self.setValue = self.slider.setValue
        self.setMaximum = self.slider.setMaximum
        self.setMinimum = self.slider.setMinimum
        self.setText = self.label.setText
        self.text = self.label.text
    
    def sliderMove(self, value):
        self.label.setText(self.labelText + ' ' + str(value))
Пример #7
0
    def __init__(self, parent=None):
        super(NewNotebookDlg, self).__init__(parent)
        self.setWindowTitle('Add Notebook - mikidown')
        tipLabel = QLabel('Choose a name and folder for your notebook.' +
                          '\nThe folder can be an existing notebook folder.')
        self.nameEditor = QLineEdit()
        self.nameEditor.setText('Notes')
        nameLabel = QLabel('Name:')
        nameLabel.setBuddy(self.nameEditor)
        self.pathEditor = QLineEdit()
        # self.pathEditor.setText('~/mikidown')
        self.pathEditor.setText(
            os.path.expanduser('~').replace(os.sep, '/') + '/mikinotes')
        pathLabel = QLabel('Path:')
        pathLabel.setBuddy(self.pathEditor)
        browse = QPushButton('Browse')
        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                     | QDialogButtonBox.Cancel)

        grid = QGridLayout()
        grid.setRowMinimumHeight(1, 10)
        grid.setRowMinimumHeight(4, 10)
        grid.addWidget(tipLabel, 0, 0, 1, 4)
        grid.addWidget(nameLabel, 2, 0)
        grid.addWidget(self.nameEditor, 2, 1, 1, 4)
        grid.addWidget(pathLabel, 3, 0)
        grid.addWidget(self.pathEditor, 3, 1, 1, 4)
        grid.addWidget(browse, 3, 5)
        grid.addWidget(buttonBox, 5, 4, 1, 2)
        self.setLayout(grid)

        browse.clicked.connect(self.browse)
        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)
Пример #8
0
    def __init__(self, parent):
        KDialog.__init__(self, parent)
        self.setButtons(KDialog.ButtonCode(KDialog.Ok | KDialog.Cancel | KDialog.Help | KDialog.User1))
        self.setCaption(i18n("LilyPond"))
        self.setHelp("settings-paths-lilypond")
        self.setButtonText(KDialog.User1, i18n("Download..."))
        self.setButtonIcon(KDialog.User1, KIcon("download"))
        self.setButtonToolTip(KDialog.User1, i18n("Download new binary LilyPond releases."))
        self.user1Clicked.connect(self.downloadLilyPond)
        layout = QGridLayout(self.mainWidget())

        l = QLabel(i18n("LilyPond Command:"))
        self.lilypond = KUrlRequester()
        l.setBuddy(self.lilypond)
        self.lilypond.lineEdit().setToolTip(i18n("Name or full path of the LilyPond program."))
        self.lilypond.fileDialog().setCaption(i18n("LilyPond Command"))
        layout.addWidget(l, 0, 0, 1, 2)
        layout.addWidget(self.lilypond, 1, 0, 1, 2)

        self.commands = {}
        row = 2
        for name, description in LilyPondInfo.commandNames():
            l = QLabel(description)
            e = self.commands[name] = QLineEdit()
            l.setBuddy(e)
            layout.addWidget(l, row, 0, Qt.AlignRight)
            layout.addWidget(e, row, 1)
            row += 1
        self.default = QCheckBox(i18n("Set as default"))
        layout.addWidget(self.default, row, 1)
        self.auto = QCheckBox(i18n("Include in automatic version selection"))
        layout.addWidget(self.auto, row + 1, 1)
Пример #9
0
class ImportParametersPage(QWizardPage):
    def __init__(self, parent=None):
        super(ImportParametersPage, self).__init__(parent)

        self.setTitle(self.tr("Parametry importu"))

        self.dirLabel = QLabel(QApplication.translate("ImportParametersPage", 'Adresář s daty RÚIAN', None, QApplication.UnicodeUTF8))
        self.setDir = QLineEdit(config['importParameters']['dataRUIANDir'])
        self.dirLabel.setBuddy(self.setDir)
        self.setDir.textChanged[str].connect(self.updateDir)

        self.suffixLabel = QLabel(QApplication.translate("CreateDBStructurePage", 'Přípona souboru', None, QApplication.UnicodeUTF8))
        self.suffix = QLineEdit(config['importParameters']['suffix'])
        self.suffixLabel.setBuddy(self.suffix)
        self.suffix.textChanged[str].connect(self.updateSuffix)

        self.openButton1 = QPushButton()
        self.curDir = os.path.dirname(__file__)
        self.pictureName = os.path.join(self.curDir, 'img\\dir.png')
        self.openButton1.setIcon(QIcon(self.pictureName))

        self.walkDir = QCheckBox(QApplication.translate("ImportParametersPage", 'Včetně podadresářů', None, QApplication.UnicodeUTF8))

        if config['importParameters']['subDirs'] == 'True':
            self.walkDir.setCheckState(Qt.Checked)
        else:
            self.walkDir.setCheckState(Qt.Unchecked)

        self.walkDir.stateChanged[int].connect(self.updateSubDirs)

        grid = QGridLayout()
        grid.addWidget(self.dirLabel, 0, 0)
        grid.addWidget(self.setDir, 0, 1)
        grid.addWidget(self.openButton1, 0, 2)
        grid.addWidget(self.suffixLabel, 1, 0)
        grid.addWidget(self.suffix, 1, 1)
        grid.addWidget(self.walkDir, 2, 1)

        self.setLayout(grid)
        self.connect(self.openButton1, SIGNAL("clicked()"), self.setPath1)

    def updateDir(self, value):
        config['importParameters']['dataRUIANDir'] = str(value)

    def updateSuffix(self, value):
        config['importParameters']['suffix'] = str(value)

    def updateSubDirs(self, value):
        if value == 2:
            config['importParameters']['subDirs'] = 'True'
        else:
            config['importParameters']['subDirs'] = 'False'

    def setPath1(self):
        dirDialog = QFileDialog.getExistingDirectory(self, QApplication.translate("CreateDBStructurePage", 'Výběr adrešáře', None, QApplication.UnicodeUTF8))
        if not dirDialog.isNull():
            self.setDir.setText(dirDialog)

    def nextId(self):
        return LicenseWizard.PageImportDB
Пример #10
0
    def __init__(self, page):
        super(HelperApps, self).__init__(i18n("Helper applications"), page)

        layout = QGridLayout(self)
        self.commands = []
        for name, default, title, lineedit, tooltip in (
            (
                "pdf viewer",
                "",
                i18n("PDF Viewer:"),
                ExecArgsLineEdit,
                i18n("PDF Viewer") + " " + i18n("(leave empty for operating system default)"),
            ),
            (
                "midi player",
                "",
                i18n("MIDI Player:"),
                ExecArgsLineEdit,
                i18n("MIDI Player") + " " + i18n("(leave empty for operating system default)"),
            ),
        ):
            label = QLabel(title)
            widget = lineedit()
            widget.textEdited.connect(page.changed)
            label.setBuddy(widget)
            label.setToolTip(tooltip)
            widget.setToolTip(tooltip)
            row = layout.rowCount()
            layout.addWidget(label, row, 0)
            layout.addWidget(widget, row, 1)
            self.commands.append((widget, name, default))
Пример #11
0
    def __init__(self, width, height, parent=None):
        super(ResizeDlg, self).__init__(parent)

        widthLabel = QLabel("&Width:")
        self.widthSpinBox = QSpinBox()
        widthLabel.setBuddy(self.widthSpinBox)
        self.widthSpinBox.setAlignment(Qt.AlignRight|Qt.AlignVCenter)
        self.widthSpinBox.setRange(4, width * 4)
        self.widthSpinBox.setValue(width)
        heightLabel = QLabel("&Height:")
        self.heightSpinBox = QSpinBox()
        heightLabel.setBuddy(self.heightSpinBox)
        self.heightSpinBox.setAlignment(Qt.AlignRight|
                                        Qt.AlignVCenter)
        self.heightSpinBox.setRange(4, height * 4)
        self.heightSpinBox.setValue(height)

        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok|
                                     QDialogButtonBox.Cancel)

        layout = QGridLayout()
        layout.addWidget(widthLabel, 0, 0)
        layout.addWidget(self.widthSpinBox, 0, 1)
        layout.addWidget(heightLabel, 1, 0)
        layout.addWidget(self.heightSpinBox, 1, 1)
        layout.addWidget(buttonBox, 2, 0, 1, 2)
        self.setLayout(layout)

        self.connect(buttonBox, SIGNAL("accepted()"), self.accept)
        self.connect(buttonBox, SIGNAL("rejected()"), self.reject)

        self.setWindowTitle("Image Changer - Resize")
Пример #12
0
        def __init__(self, parent=None, filters="", encodings=[]):
            QWidget.__init__(self, parent)
            self.filters = filters
            self.layerLineEdit = QLineEdit()
            self.browseToolButton = QToolButton()
            self.browseToolButton.setAutoRaise(True)
            self.browseToolButton.setIcon(QIcon(":document-open"))
            layerLabel = QLabel("&Dataset:")
            layerLabel.setBuddy(self.layerLineEdit)

            self.encodingComboBox = QComboBox()
            self.encodingComboBox.addItems(encodings)
            encodingLabel = QLabel("&Encoding:")
            encodingLabel.setBuddy(self.encodingComboBox)

            hbox = QHBoxLayout()
            hbox.addWidget(layerLabel)
            hbox.addWidget(self.layerLineEdit)
            hbox.addWidget(self.browseToolButton)
            vbox = QVBoxLayout()
            vbox.addLayout(hbox)
            hbox = QHBoxLayout()
            hbox.addWidget(encodingLabel)
            hbox.addWidget(self.encodingComboBox)
            vbox.addLayout(hbox)
            self.setLayout(vbox)
            self.encodingComboBox.setCurrentIndex(self.encodingComboBox.findText("System"))

            self.connect(self.browseToolButton,
                SIGNAL("clicked()"), self.browseToFile)
            self.connect(self.encodingComboBox,
                SIGNAL("currentIndexChanged(QString)"), self.changeEncoding)
Пример #13
0
 def __init__(self, manager):
     super(EditorDialog, self).__init__(manager.mainwin)
     self.mainwin = manager.mainwin
     self.sm = manager
     self.setButtons(KDialog.ButtonCode(
         KDialog.Help | KDialog.Ok | KDialog.Cancel))
     self.setFaceType(KPageDialog.List)
     self.setHelp("sessions")
     
     # First page with name and auto-save option
     page = QWidget(self)
     item = self.firstPage = self.addPage(page, i18n("Session"))
     item.setHeader(i18n("Properties of this session"))
     item.setIcon(KIcon("configure"))
     
     layout = QGridLayout(page)
     
     l = QLabel(i18n("Name:"))
     self.name = QLineEdit()
     l.setBuddy(self.name)
     layout.addWidget(l, 0, 0)
     layout.addWidget(self.name, 0, 1)
     
     self.autosave = QCheckBox(i18n(
         "Always save the list of documents in this session"))
     layout.addWidget(self.autosave, 1, 1)
     
     l = QLabel(i18n("Base directory:"))
     self.basedir = KUrlRequester()
     self.basedir.setMode(KFile.Mode(
         KFile.Directory | KFile.ExistingOnly | KFile.LocalOnly))
     l.setBuddy(self.basedir)
     layout.addWidget(l, 2, 0)
     layout.addWidget(self.basedir, 2, 1)
Пример #14
0
 def __init__(self, id, logscale=False, style=True):
     QGroupBox.__init__(self)
     self.setTitle("Control Axes")
     self.setToolTip("<p>Control if/how axes are drawn</p>")
     self.xAxisCheckBox = QCheckBox("Show X axis")
     self.xAxisCheckBox.setChecked(True)
     self.yAxisCheckBox = QCheckBox("Show Y axis")
     self.yAxisCheckBox.setChecked(True)
     self.id = id
     hbox = HBoxLayout()
     hbox.addWidget(self.xAxisCheckBox)
     hbox.addWidget(self.yAxisCheckBox)
     vbox = VBoxLayout()
     vbox.addLayout(hbox)
     if logscale:
         self.xLogCheckBox = QCheckBox("Logarithmic X axis")
         self.yLogCheckBox = QCheckBox("Logarithmic Y axis")
         hbox = HBoxLayout()
         hbox.addWidget(self.xLogCheckBox)
         hbox.addWidget(self.yLogCheckBox)
         vbox.addLayout(hbox)
     if style:
         self.directionComboBox = QComboBox()
         self.directionComboBox.addItems(["Parallel to axis",
                                          "Horizontal",
                                          "Perpendicualr to axis",
                                          "Vertical"])
         directionLabel = QLabel("Axis label style:")
         directionLabel.setBuddy(self.directionComboBox)
         hbox = HBoxLayout()
         hbox.addWidget(directionLabel)
         hbox.addWidget(self.directionComboBox)
         vbox.addLayout(hbox)
     self.setLayout(vbox)
Пример #15
0
    def __init__(self, path, parent=None):
        super(LineEditDialog, self).__init__(parent)
        self.path = path

        # newPage/newSubpage
        if parent.objectName() in ["mikiWindow", "notesTree"]:
            editorLabel = QLabel(self.tr("Page Name:"))
            self.extNames = [".md", ".markdown", ".mkd"]
        # Copy Image to notesEdit
        elif parent.objectName() == "notesEdit":
            editorLabel = QLabel(self.tr("File Name:"))
            self.extNames = ["", ".jpg"]
        else:
            return

        self.editor = QLineEdit()
        editorLabel.setBuddy(self.editor)
        self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                          | QDialogButtonBox.Cancel)
        self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
        layout = QGridLayout()
        layout.addWidget(editorLabel, 0, 0)
        layout.addWidget(self.editor, 0, 1)
        layout.addWidget(self.buttonBox, 1, 1)
        self.setLayout(layout)

        self.editor.textEdited.connect(self.updateUi)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)
Пример #16
0
    def __init__(self, parent = None):
        super(AddWordsDialog, self).__init__(parent)

        label = QLabel("How many words do you want to add?")
        self.spinBox = QSpinBox()
        self.spinBox.setMinimum(1)
        self.spinBox.setMaximum(50)
        label.setBuddy(self.spinBox)
        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
        HLayout = QHBoxLayout()
        HLayout.addWidget(label)
        HLayout.addWidget(self.spinBox)
        HLayout2 = QHBoxLayout()
        HLayout2.addWidget(buttonBox)
        VLayout = QVBoxLayout()
        VLayout.addLayout(HLayout)
        VLayout.addLayout(HLayout2)

        self.setLayout(VLayout)
        self.spinBox.setFocus()
        self.setWindowTitle("Add Words")

        self.connect(buttonBox, SIGNAL("accepted()"),
                    self.accept)
        self.connect(buttonBox, SIGNAL("rejected()"),
                    self.reject)
Пример #17
0
    def __init__(self, width, height, parent=None):
        super(ResizeDlg, self).__init__(parent)

        widthLabel = QLabel("&Width:")
        self.widthSpinBox = QSpinBox()
        widthLabel.setBuddy(self.widthSpinBox)
        self.widthSpinBox.setAlignment(Qt.AlignRight|Qt.AlignVCenter)
        self.widthSpinBox.setRange(4, width * 4)
        self.widthSpinBox.setValue(width)
        heightLabel = QLabel("&Height:")
        self.heightSpinBox = QSpinBox()
        heightLabel.setBuddy(self.heightSpinBox)
        self.heightSpinBox.setAlignment(Qt.AlignRight|
                                        Qt.AlignVCenter)
        self.heightSpinBox.setRange(4, height * 4)
        self.heightSpinBox.setValue(height)

        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok|
                                     QDialogButtonBox.Cancel)

        layout = QGridLayout()
        layout.addWidget(widthLabel, 0, 0)
        layout.addWidget(self.widthSpinBox, 0, 1)
        layout.addWidget(heightLabel, 1, 0)
        layout.addWidget(self.heightSpinBox, 1, 1)
        layout.addWidget(buttonBox, 2, 0, 1, 2)
        self.setLayout(layout)

        self.connect(buttonBox, SIGNAL("accepted()"), self.accept)
        self.connect(buttonBox, SIGNAL("rejected()"), self.reject)

        self.setWindowTitle("Image Changer - Resize")
Пример #18
0
    def __init__(self, parent=None):
        super(NewNotebookDlg, self).__init__(parent)
        self.setWindowTitle('Add Notebook - mikidown')
        tipLabel = QLabel('Choose a name and folder for your notebook.' +
                          '\nThe folder can be an existing notebook folder.')
        self.nameEditor = QLineEdit()
        self.nameEditor.setText('Notes')
        nameLabel = QLabel('Name:')
        nameLabel.setBuddy(self.nameEditor)
        self.pathEditor = QLineEdit()
        # self.pathEditor.setText('~/mikidown')
        self.pathEditor.setText(os.environ['HOME']+'/mikinotes')
        pathLabel = QLabel('Path:')
        pathLabel.setBuddy(self.pathEditor)
        browse = QPushButton('Browse')
        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok |
                                     QDialogButtonBox.Cancel)

        grid = QGridLayout()
        grid.setRowMinimumHeight(1, 10)
        grid.setRowMinimumHeight(4, 10)
        grid.addWidget(tipLabel, 0, 0, 1, 4)
        grid.addWidget(nameLabel, 2, 0)
        grid.addWidget(self.nameEditor, 2, 1, 1, 4)
        grid.addWidget(pathLabel, 3, 0)
        grid.addWidget(self.pathEditor, 3, 1, 1, 4)
        grid.addWidget(browse, 3, 5)
        grid.addWidget(buttonBox, 5, 4, 1, 2)
        self.setLayout(grid)

        browse.clicked.connect(self.browse)
        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)
Пример #19
0
    def __init__(self, parent = None):
        QWidget.__init__(self, parent)

        def hbox(*widgets):
            box = QHBoxLayout()
            [box.addWidget(z) for z in widgets]
            box.addStretch()
            return box

        vbox = QVBoxLayout()

        startlabel = QLabel(translate('Autonumbering Wizard', "&Start: "))
        self._start = QSpinBox()
        startlabel.setBuddy(self._start)
        self._start.setValue(1)
        self._start.setMaximum(65536)

        vbox.addLayout(hbox(startlabel, self._start))

        label = QLabel(translate('Autonumbering Wizard', 'Max length after padding with zeroes: '))
        self._padlength = QSpinBox()
        label.setBuddy(self._padlength)
        self._padlength.setValue(1)
        self._padlength.setMaximum(65535)
        self._padlength.setMinimum(1)
        vbox.addLayout(hbox(label, self._padlength))

        self._restart_numbering = QCheckBox(translate('Autonumbering Wizard', "&Restart numbering at each directory."))

        vbox.addWidget(self._restart_numbering)
        vbox.addStretch()

        self.setLayout(vbox)
Пример #20
0
class Login(QDialog):
    def __init__(self, parent=None):
        QDialog.__init__(self)
        self.parent = parent
        self.resize(270, 160)
        self.verticalLayout = QVBoxLayout(self)
        self.label_username = QLabel(self)
        self.verticalLayout.addWidget(self.label_username)
        self.username = QLineEdit(self)
        self.verticalLayout.addWidget(self.username)
        self.label_password = QLabel(self)
        self.verticalLayout.addWidget(self.label_password)
        self.password = QLineEdit(self)
        self.password.setEchoMode(QLineEdit.Password)
        self.verticalLayout.addWidget(self.password)
        self.save_password = QCheckBox(self)
        self.verticalLayout.addWidget(self.save_password)
        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel
                                          | QDialogButtonBox.Ok)
        self.verticalLayout.addWidget(self.buttonBox)
        self.label_username.setBuddy(self.username)
        self.label_password.setBuddy(self.password)
        self.setWindowIcon(get_icon(MAIL_IMAGE))
        self.setWindowTitle("Gmail Login")
        self.label_username.setText("Username")
        self.label_password.setText("Password")
        self.save_password.setText("Save password")
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)
Пример #21
0
class Login(QDialog):
    def __init__(self, parent=None):
        QDialog.__init__(self)
        self.parent = parent
        self.resize(270, 160)
        self.verticalLayout = QVBoxLayout(self)
        self.label_username = QLabel(self)
        self.verticalLayout.addWidget(self.label_username)
        self.username = QLineEdit(self)
        self.verticalLayout.addWidget(self.username)
        self.label_password = QLabel(self)
        self.verticalLayout.addWidget(self.label_password)
        self.password = QLineEdit(self)
        self.password.setEchoMode(QLineEdit.Password)
        self.verticalLayout.addWidget(self.password)
        self.save_password = QCheckBox(self)
        self.verticalLayout.addWidget(self.save_password)
        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(
                QDialogButtonBox.Cancel|QDialogButtonBox.Ok)
        self.verticalLayout.addWidget(self.buttonBox)
        self.label_username.setBuddy(self.username)
        self.label_password.setBuddy(self.password)
        self.setWindowIcon(get_icon(MAIL_IMAGE))
        self.setWindowTitle("Gmail Login")
        self.label_username.setText("Username")
        self.label_password.setText("Password")
        self.save_password.setText("Save password")
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)
Пример #22
0
    def __init__(self, path, parent=None):
        super(LineEditDialog, self).__init__(parent)
        self.path = path

        # newPage/newSubpage
        if parent.objectName() in ["mikiWindow", "notesTree"]:
            editorLabel = QLabel("Page Name:")
            self.extNames = [".md", ".markdown", ".mkd"]
        # Copy Image to notesEdit
        elif parent.objectName() == "notesEdit":
            editorLabel = QLabel("File Name:")
            self.extNames = ["", ".jpg"]
        else:
            return

        self.editor = QLineEdit()
        editorLabel.setBuddy(self.editor)
        self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok |
                                          QDialogButtonBox.Cancel)
        self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
        layout = QGridLayout()
        layout.addWidget(editorLabel, 0, 0)
        layout.addWidget(self.editor, 0, 1)
        layout.addWidget(self.buttonBox, 1, 1)
        self.setLayout(layout)

        self.editor.textEdited.connect(self.updateUi)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)
 def __init__(self,broker,parent = None ):
     super(BrokerWidget,self).__init__(parent)
     
     self.broker = broker
     
     self.dataTable = TableView()
     self.dataTable.setModel(self.broker.dataModel)
     self.dataTable.horizontalHeader().setResizeMode(QHeaderView.Stretch)
     #self.dataTable.resizeColumnsToContents()
     dataLabel = QLabel('Price Data')
     dataLabel.setBuddy(self.dataTable)
     
     dataLayout = QVBoxLayout()
     
     dataLayout.addWidget(dataLabel)
     dataLayout.addWidget(self.dataTable)
     
     
     addButton = QPushButton("&Add Symbol")
     saveDataButton = QPushButton("&Save Data")
     #deleteButton = QPushButton("&Delete")
     
     buttonLayout = QVBoxLayout()
     buttonLayout.addWidget(addButton)
     buttonLayout.addWidget(saveDataButton)
     buttonLayout.addStretch()
     
     layout = QHBoxLayout()
     layout.addLayout(dataLayout)
     layout.addLayout(buttonLayout)
     self.setLayout(layout)
     
     self.connect(addButton,SIGNAL('clicked()'),self.addSubscription)
     self.connect(saveDataButton,SIGNAL('clicked()'),self.saveData)
Пример #24
0
 def __init__(self, dialog):
     StaffBase.__init__(self, dialog)
     l = QLabel(i18n("Systems per page:"))
     l.setBuddy(self.systems)
     self.layout().addWidget(l, 0, 1, Qt.AlignRight)
     self.layout().addWidget(self.systems, 0, 2)
     self.clefs = QCheckBox(i18n("Clefs"))
     self.layout().addWidget(self.clefs, 1, 2)
Пример #25
0
class PianoStaffPart(Part):
    """Base class for parts creating a piano staff."""
    def createWidgets(self, layout):
        self.label = QLabel(wordWrap=True)
        self.upperVoicesLabel = QLabel()
        self.lowerVoicesLabel = QLabel()
        self.upperVoices = QSpinBox(minimum=1, maximum=4, value=1)
        self.lowerVoices = QSpinBox(minimum=1, maximum=4, value=1)
        
        self.upperVoicesLabel.setBuddy(self.upperVoices)
        self.lowerVoicesLabel.setBuddy(self.lowerVoices)
        
        layout.addWidget(self.label)
        grid = QGridLayout()
        grid.addWidget(self.upperVoicesLabel, 0, 0)
        grid.addWidget(self.upperVoices, 0, 1)
        grid.addWidget(self.lowerVoicesLabel, 1, 0)
        grid.addWidget(self.lowerVoices, 1, 1)
        layout.addLayout(grid)
    
    def translateWidgets(self):
        self.label.setText('{0} <i>({1})</i>'.format(
            _("Adjust how many separate voices you want on each staff."),
            _("This is primarily useful when you write polyphonic music "
              "like a fuge.")))
        self.upperVoicesLabel.setText(_("Right hand:"))
        self.lowerVoicesLabel.setText(_("Left hand:"))
    
    def buildStaff(self, data, builder, name, octave, numVoices=1, node=None, clef=None):
        """Build a staff with the given number of voices and name."""
        staff = ly.dom.Staff(name, parent=node)
        builder.setMidiInstrument(staff, self.midiInstrument)
        c = ly.dom.Seqr(staff)
        if clef:
            ly.dom.Clef(clef, c)
        if numVoices == 1:
            a = data.assignMusic(name, octave)
            ly.dom.Identifier(a.name, c)
        else:
            c = ly.dom.Sim(c)
            for i in range(1, numVoices):
                a = data.assignMusic(name + ly.util.int2text(i), octave)
                ly.dom.Identifier(a.name, c)
                ly.dom.VoiceSeparator(c)
            a = data.assignMusic(name + ly.util.int2text(numVoices), octave)
            ly.dom.Identifier(a.name, c)
        return staff

    def build(self, data, builder):
        """ Setup structure for a 2-staff PianoStaff. """
        p = ly.dom.PianoStaff()
        builder.setInstrumentNamesFromPart(p, self, data)
        s = ly.dom.Sim(p)
        # add two staves, with a respective number of voices.
        self.buildStaff(data, builder, 'right', 1, self.upperVoices.value(), s)
        self.buildStaff(data, builder, 'left', 0, self.lowerVoices.value(), s, "bass")
        data.nodes.append(p)
Пример #26
0
class StaffGroup(_base.Container):
    @staticmethod
    def title(_=_base.translate):
        return _("Staff Group")

    def accepts(self):
        return (StaffGroup, _base.Part)

    def createWidgets(self, layout):
        self.systemStartLabel = QLabel()
        self.systemStart = QComboBox()
        self.systemStartLabel.setBuddy(self.systemStart)
        self.systemStart.setModel(
            listmodel.ListModel(
                (
                    # L10N: Brace like a piano staff
                    (lambda: _("Brace"), 'system_start_brace'),
                    # L10N: Bracket like a choir staff
                    (lambda: _("Bracket"), 'system_start_bracket'),
                    # L10N: Square bracket like a sub-group
                    (lambda: _("Square"), 'system_start_square'),
                ),
                self.systemStart,
                display=listmodel.translate_index(0),
                icon=lambda item: symbols.icon(item[1])))
        self.systemStart.setIconSize(QSize(64, 64))
        self.connectBarLines = QCheckBox(checked=True)

        box = QHBoxLayout()
        box.addWidget(self.systemStartLabel)
        box.addWidget(self.systemStart)
        layout.addLayout(box)
        layout.addWidget(self.connectBarLines)

    def translateWidgets(self):
        self.systemStartLabel.setText(_("Type:"))
        self.connectBarLines.setText(_("Connect Barlines"))
        self.connectBarLines.setToolTip(
            _("If checked, barlines are connected between the staves."))
        self.systemStart.model().update()

    def build(self, data, builder):
        s = self.systemStart.currentIndex()
        b = self.connectBarLines.isChecked()
        if s == 0:
            node = ly.dom.GrandStaff()
            if not b:
                ly.dom.Line("\\remove Span_bar_engraver", node.getWith())
        else:
            node = ly.dom.StaffGroup() if b else ly.dom.ChoirStaff()
            if s == 2:
                node.getWith()['systemStartDelimiter'] = ly.dom.Scheme(
                    "'SystemStartSquare")
        data.nodes.append(node)
        data.music = ly.dom.Simr(node)
Пример #27
0
class Score(_base.Group, scoreproperties.ScoreProperties):
    @staticmethod
    def title(_=_base.translate):
        return _("Score")

    def createWidgets(self, layout):
        self.pieceLabel = QLabel()
        self.piece = QLineEdit()
        self.pieceLabel.setBuddy(self.piece)
        self.opusLabel = QLabel()
        self.opus = QLineEdit()
        self.opusLabel.setBuddy(self.opus)
        self.scoreProps = QGroupBox(checkable=True, checked=False)
        scoreproperties.ScoreProperties.createWidgets(self)

        grid = QGridLayout()
        grid.addWidget(self.pieceLabel, 0, 0)
        grid.addWidget(self.piece, 0, 1)
        grid.addWidget(self.opusLabel, 1, 0)
        grid.addWidget(self.opus, 1, 1)
        layout.addLayout(grid)
        layout.addWidget(self.scoreProps)
        layout = QVBoxLayout()
        self.scoreProps.setLayout(layout)
        scoreproperties.ScoreProperties.layoutWidgets(self, layout)

        scorewiz = self.scoreProps.window()
        self.setPitchLanguage(scorewiz.pitchLanguage())
        scorewiz.pitchLanguageChanged.connect(self.setPitchLanguage)

    def translateWidgets(self):
        self.pieceLabel.setText(_("Piece:"))
        self.opusLabel.setText(_("Opus:"))
        self.scoreProps.setTitle(_("Properties"))
        scoreproperties.ScoreProperties.translateWidgets(self)

    def accepts(self):
        return (StaffGroup, _base.Part)

    def makeNode(self, node):
        score = ly.dom.Score(node)
        h = ly.dom.Header()
        piece = self.piece.text().strip()
        opus = self.opus.text().strip()
        if piece:
            h['piece'] = ly.dom.QuotedString(piece)
        if opus:
            h['opus'] = ly.dom.QuotedString(opus)
        if len(h):
            score.append(h)
        return score

    def globalSection(self, builder):
        if self.scoreProps.isChecked():
            return scoreproperties.ScoreProperties.globalSection(self, builder)
Пример #28
0
class Score(_base.Group, scoreproperties.ScoreProperties):
    @staticmethod
    def title(_=_base.translate):
        return _("Score")

    def createWidgets(self, layout):
        self.pieceLabel = QLabel()
        self.piece = QLineEdit()
        self.pieceLabel.setBuddy(self.piece)
        self.opusLabel = QLabel()
        self.opus = QLineEdit()
        self.opusLabel.setBuddy(self.opus)
        self.scoreProps = QGroupBox(checkable=True, checked=False)
        scoreproperties.ScoreProperties.createWidgets(self)
        
        grid = QGridLayout()
        grid.addWidget(self.pieceLabel, 0 ,0)
        grid.addWidget(self.piece, 0, 1)
        grid.addWidget(self.opusLabel, 1, 0)
        grid.addWidget(self.opus, 1, 1)
        layout.addLayout(grid)
        layout.addWidget(self.scoreProps)
        layout = QVBoxLayout()
        self.scoreProps.setLayout(layout)
        scoreproperties.ScoreProperties.layoutWidgets(self, layout)
        
        scorewiz = self.scoreProps.window()
        self.setPitchLanguage(scorewiz.pitchLanguage())
        scorewiz.pitchLanguageChanged.connect(self.setPitchLanguage)
        
    def translateWidgets(self):
        self.pieceLabel.setText(_("Piece:"))
        self.opusLabel.setText(_("Opus:"))
        self.scoreProps.setTitle(_("Properties"))
        scoreproperties.ScoreProperties.translateWidgets(self)
        
    def accepts(self):
        return (StaffGroup, _base.Part)

    def makeNode(self, node):
        score = ly.dom.Score(node)
        h = ly.dom.Header()
        piece = self.piece.text().strip()
        opus = self.opus.text().strip()
        if piece:
            h['piece'] = ly.dom.QuotedString(piece)
        if opus:
            h['opus'] = ly.dom.QuotedString(opus)
        if len(h):
            score.append(h)
        return score
    
    def globalSection(self, builder):
        if self.scoreProps.isChecked():
            return scoreproperties.ScoreProperties.globalSection(self, builder)
Пример #29
0
 def __init__(self, dialog):
     StaffBase.__init__(self, dialog)
     l = QLabel(i18n("Staves per page:"))
     l.setBuddy(self.systems)
     self.layout().addWidget(l, 0, 1, Qt.AlignRight)
     self.layout().addWidget(self.systems, 0, 2)
     self.clef = ClefSelector(noclef=True, tab=True)
     l = QLabel(i18n("Clef:"))
     l.setBuddy(self.clef)
     self.layout().addWidget(l, 1, 1, Qt.AlignRight)
     self.layout().addWidget(self.clef, 1, 2)
Пример #30
0
class LabelledTextEdit(QWidget):
    def __init__(self, labelText=QString(), position=LEFT, parent=None):
        super(LabelledTextEdit, self).__init__(parent)
        self.label = QLabel(labelText)
        self.textEdit = QTextEdit()
        self.label.setBuddy(self.textEdit)
        layout = QBoxLayout(QBoxLayout.LeftToRight if position ==
                            LEFT else QBoxLayout.TopToBottom)
        layout.addWidget(self.label)
        layout.addWidget(self.textEdit)
        self.setLayout(layout)
Пример #31
0
 def __init__(self, dialog):
     QWidget.__init__(self, dialog)
     SymbolManager.__init__(self)
     self.setDefaultSymbolSize(40)
     self.dialog = dialog
     self.setLayout(QGridLayout())
     self.tree = QTreeWidget()
     self.stack = QStackedWidget()
     StackFader(self.stack)
     self.systems = QSpinBox()
     newStaves = QVBoxLayout()
     operations = QHBoxLayout()
     self.layout().addLayout(newStaves, 0, 0)
     self.layout().addWidget(self.tree, 0, 1)
     self.layout().addWidget(self.stack, 0, 2, 1, 2)
     self.layout().addWidget(self.systems, 1, 3)
     self.systems.setRange(1, 64)
     l = QLabel(i18n("Systems per page:"))
     l.setBuddy(self.systems)
     self.layout().addWidget(l, 1, 2, Qt.AlignRight)
     self.layout().addLayout(operations, 1, 1)
     
     operations.setSpacing(0)
     operations.setContentsMargins(0, 0, 0, 0)
     removeButton = KPushButton(KStandardGuiItem.remove())
     removeButton.clicked.connect(self.removeSelectedItems)
     operations.addWidget(removeButton)
     upButton = QToolButton()
     upButton.clicked.connect(self.moveSelectedItemsUp)
     upButton.setIcon(KIcon("go-up"))
     operations.addWidget(upButton)
     downButton = QToolButton()
     downButton.clicked.connect(self.moveSelectedItemsDown)
     downButton.setIcon(KIcon("go-down"))
     operations.addWidget(downButton)
     newStaves.setSpacing(0)
     newStaves.setContentsMargins(0, 0, 0, 0)
     
     self.tree.setIconSize(QSize(32, 32))
     self.tree.setDragDropMode(QTreeWidget.InternalMove)
     self.tree.headerItem().setHidden(True)
     self.tree.itemSelectionChanged.connect(self.slotSelectionChanged)
     
     for staffType in (
         BracketItem,
         BraceItem,
         StaffItem,
         ):
         b = QPushButton(staffType.name())
         b.clicked.connect((lambda t: lambda: self.createItem(t))(staffType))
         b.setIconSize(QSize(40, 40))
         self.addSymbol(b, staffType.symbol())
         newStaves.addWidget(b)
Пример #32
0
 def __init__(self, id, text):
     QWidget.__init__(self)
     self.widget = QLineEdit()
     self.widget.setToolTip(text)
     self.widget.setReadOnly(True)
     label = QLabel(text)
     label.setBuddy(self.widget)
     vbox = VBoxLayout()
     vbox.addWidget(label)
     vbox.addWidget(self.widget)
     self.setLayout(vbox)
     self.id = id
Пример #33
0
 def __init__(self, parent=None):
     super(ShortcutEditDialog, self).__init__(parent)
     self.setMinimumWidth(400)
     # create gui
     
     layout = QVBoxLayout()
     layout.setSpacing(10)
     self.setLayout(layout)
     
     top = QHBoxLayout()
     top.setSpacing(4)
     p = self.toppixmap = QLabel()
     l = self.toplabel = QLabel()
     l.setWordWrap(True)
     top.addWidget(p)
     top.addWidget(l, 1)
     layout.addLayout(top)
     
     grid = QGridLayout()
     grid.setSpacing(4)
     grid.setColumnStretch(1, 2)
     layout.addLayout(grid)
     
     self.buttonDefault = QRadioButton(self)
     self.buttonNone = QRadioButton(self)
     self.buttonCustom = QRadioButton(self)
     grid.addWidget(self.buttonDefault, 0, 0, 1, 2)
     grid.addWidget(self.buttonNone, 1, 0, 1, 2)
     grid.addWidget(self.buttonCustom, 2, 0, 1, 2)
     
     self.keybuttons = []
     self.keylabels = []
     for num in range(4):
         l = QLabel(self)
         l.setStyleSheet("margin-left: 2em;")
         l.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
         b = KeySequenceWidget(self)
         b.keySequenceChanged.connect(self.slotKeySequenceChanged)
         l.setBuddy(b)
         self.keylabels.append(l)
         self.keybuttons.append(b)
         grid.addWidget(l, num+3, 0)
         grid.addWidget(b, num+3, 1)
     
     layout.addWidget(Separator(self))
     
     b = QDialogButtonBox(self)
     b.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
     layout.addWidget(b)
     b.accepted.connect(self.accept)
     b.rejected.connect(self.reject)
     app.translateUI(self)
Пример #34
0
 def __init__(self, id, text, sep=","):
     QWidget.__init__(self)
     self.widget = QListWidget()
     self.widget.setToolTip(text)
     self.widget.setSelectionMode(QAbstractItemView.ExtendedSelection)
     label = QLabel(text)
     label.setBuddy(self.widget)
     vbox = VBoxLayout()
     vbox.addWidget(label)
     vbox.addWidget(self.widget)
     self.setLayout(vbox)
     self.id = id
     self.sep = sep
Пример #35
0
    def redrawEditFrameContent():
        item = treeview.selectedItems()[0]

        for i in reversed(list(range(layout2.count()))):
            layout2.itemAt(i).widget().close()
        editframecontent = EditableForm(treeview.itemGetEditable(item),
                                        editframe)
        textlabel = QLabel(("Edit attributes for %s" %
                            (treeview.itemGetEditable(item).getName())))
        textlabel.setAlignment(Qt.AlignCenter)
        textlabel.setBuddy(editframecontent)
        layout2.addWidget(textlabel, 0, 0)
        layout2.addWidget(editframecontent, 1, 0)
Пример #36
0
class LabelledTextEdit(QWidget):

    def __init__(self, labelText=QString(), position=LEFT,
                 parent=None):
        super(LabelledTextEdit, self).__init__(parent)
        self.label = QLabel(labelText)
        self.textEdit = QTextEdit()
        self.label.setBuddy(self.textEdit)
        layout = QBoxLayout(QBoxLayout.LeftToRight
                if position == LEFT else QBoxLayout.TopToBottom)
        layout.addWidget(self.label)
        layout.addWidget(self.textEdit)
        self.setLayout(layout)
Пример #37
0
class StaffGroup(_base.Container):
    @staticmethod
    def title(_=_base.translate):
        return _("Staff Group")

    def accepts(self):
        return (StaffGroup, _base.Part)

    def createWidgets(self, layout):
        self.systemStartLabel = QLabel()
        self.systemStart = QComboBox()
        self.systemStartLabel.setBuddy(self.systemStart)
        self.systemStart.setModel(listmodel.ListModel((
            # L10N: Brace like a piano staff
            (lambda: _("Brace"), 'system_start_brace'),
            # L10N: Bracket like a choir staff
            (lambda: _("Bracket"), 'system_start_bracket'),
            # L10N: Square bracket like a sub-group
            (lambda: _("Square"), 'system_start_square'),
            ), self.systemStart, display=listmodel.translate_index(0),
            icon=lambda item: symbols.icon(item[1])))
        self.systemStart.setIconSize(QSize(64, 64))
        self.connectBarLines = QCheckBox(checked=True)
        
        box = QHBoxLayout()
        box.addWidget(self.systemStartLabel)
        box.addWidget(self.systemStart)
        layout.addLayout(box)
        layout.addWidget(self.connectBarLines)
    
    def translateWidgets(self):
        self.systemStartLabel.setText(_("Type:"))
        self.connectBarLines.setText(_("Connect Barlines"))
        self.connectBarLines.setToolTip(_("If checked, barlines are connected between the staves."))
        self.systemStart.model().update()
    
    def build(self, data, builder):
        s = self.systemStart.currentIndex()
        b = self.connectBarLines.isChecked()
        if s == 0:
            node = ly.dom.GrandStaff()
            if not b:
                ly.dom.Line("\\remove Span_bar_engraver", node.getWith())
        else:
            node = ly.dom.StaffGroup() if b else ly.dom.ChoirStaff()
            if s == 2:
                node.getWith()['systemStartDelimiter'] = ly.dom.Scheme("'SystemStartSquare")
        data.nodes.append(node)
        data.music = ly.dom.Simr(node)
Пример #38
0
class LabelledTextEdit(QWidget):
    '''
    This class holds QTextEdit, budded to QLabel
    This is used only to simplify GUI creation 
    '''
    def __init__(self, labelText=QString(), topLeftTuple=LEFT, parent=None):
        super(LabelledTextEdit, self).__init__(parent)
        self.label = QLabel(labelText)
        self.textEdit = QTextEdit()
        self.label.setBuddy(self.textEdit)
        layout = QBoxLayout(QBoxLayout.LeftToRight
                if topLeftTuple == LEFT else QBoxLayout.TopToBottom)
        layout.addWidget(self.label)
        layout.addWidget(self.textEdit)
        self.setLayout(layout)
Пример #39
0
 def __init__(self, game):
     """selection for this player, tiles are the still available tiles"""
     QDialog.__init__(self, None)
     self.setWindowTitle(m18n("Penalty") + ' - Kajongg')
     self.game = game
     grid = QGridLayout(self)
     lblOffense = QLabel(m18n('Offense:'))
     crimes = list([x for x in game.ruleset.penaltyRules if not ('absolute' in x.options and game.winner)])
     self.cbCrime = ListComboBox(crimes)
     lblOffense.setBuddy(self.cbCrime)
     grid.addWidget(lblOffense, 0, 0)
     grid.addWidget(self.cbCrime, 0, 1, 1, 4)
     lblPenalty = QLabel(m18n('Total Penalty'))
     self.spPenalty = PenaltyBox(2)
     self.spPenalty.setRange(0, 9999)
     lblPenalty.setBuddy(self.spPenalty)
     self.lblUnits = QLabel(m18n('points'))
     grid.addWidget(lblPenalty, 1, 0)
     grid.addWidget(self.spPenalty, 1, 1)
     grid.addWidget(self.lblUnits, 1, 2)
     self.payers = []
     self.payees = []
     # a penalty can never involve the winner, neither as payer nor as payee
     for idx in range(3):
         self.payers.append(ListComboBox(game.losers()))
         self.payees.append(ListComboBox(game.losers()))
     for idx, payer in enumerate(self.payers):
         grid.addWidget(payer, 3+idx, 0)
         payer.lblPayment = QLabel()
         grid.addWidget(payer.lblPayment, 3+idx, 1)
     for idx, payee in enumerate(self.payees):
         grid.addWidget(payee, 3+idx, 3)
         payee.lblPayment = QLabel()
         grid.addWidget(payee.lblPayment, 3+idx, 4)
     grid.addWidget(QLabel(''), 6, 0)
     grid.setRowStretch(6, 10)
     for player in self.payers + self.payees:
         player.currentIndexChanged.connect(self.playerChanged)
     self.spPenalty.valueChanged.connect(self.penaltyChanged)
     self.cbCrime.currentIndexChanged.connect(self.crimeChanged)
     buttonBox = KDialogButtonBox(self)
     grid.addWidget(buttonBox, 7, 0, 1, 5)
     buttonBox.setStandardButtons(QDialogButtonBox.Cancel)
     buttonBox.rejected.connect(self.reject)
     self.btnExecute = buttonBox.addButton(m18n("&Execute"), QDialogButtonBox.AcceptRole,
         self, SLOT("accept()"))
     self.crimeChanged()
     StateSaver(self)
Пример #40
0
class ResizeDlg(QDialog):

    def __init__(self, width, height, parent=None):
        super(ResizeDlg, self).__init__(parent)
        self.create_widgets(width, height)
        self.layout_widgets()
        self.create_connections()


    def create_widgets(self, width, height):
        self.widthLabel = QLabel("&Width:")
        self.widthSpinBox = QSpinBox()
        self.widthLabel.setBuddy(self.widthSpinBox)
        self.widthSpinBox.setAlignment(Qt.AlignRight|Qt.AlignVCenter)
        self.widthSpinBox.setRange(4, width * 4)
        self.widthSpinBox.setValue(width)
        self.heightLabel = QLabel("&Height:")
        self.heightSpinBox = QSpinBox()
        self.heightLabel.setBuddy(self.heightSpinBox)
        self.heightSpinBox.setAlignment(Qt.AlignRight|
                                        Qt.AlignVCenter)
        self.heightSpinBox.setRange(4, height * 4)
        self.heightSpinBox.setValue(height)

        self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok|
                                          QDialogButtonBox.Cancel)


    def layout_widgets(self):
        layout = QGridLayout()
        layout.addWidget(self.widthLabel, 0, 0)
        layout.addWidget(self.widthSpinBox, 0, 1)
        layout.addWidget(self.heightLabel, 1, 0)
        layout.addWidget(self.heightSpinBox, 1, 1)
        layout.addWidget(self.buttonBox, 2, 0, 1, 2)
        self.setLayout(layout)


    def create_connections(self):
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)

        self.setWindowTitle("Image Changer - Resize")


    def result(self):
        return self.widthSpinBox.value(), self.heightSpinBox.value()
Пример #41
0
 def createWidget(self):
     w = QWidget()
     w.setLayout(QGridLayout())
     self.clef = ClefSelector(noclef=True, tab=True)
     l = QLabel(i18n("Clef:"))
     l.setBuddy(self.clef)
     w.layout().addWidget(l, 0, 0, Qt.AlignRight)
     w.layout().addWidget(self.clef, 0, 1)
     self.clef.currentIndexChanged.connect(self.clefChanged)
     self.spaceBelow = QSpinBox()
     self.spaceBelow.setRange(0, 25)
     self.spaceBelow.setValue(5)
     w.layout().addWidget(self.spaceBelow, 2, 1)
     l = QLabel(i18n("Space below:"))
     l.setBuddy(self.spaceBelow)
     w.layout().addWidget(l, 2, 0, Qt.AlignRight)
     return w
Пример #42
0
    def __init__(self, parent):
        super(HeaderWidget, self).__init__(parent)

        layout = QHBoxLayout()
        self.setLayout(layout)

        # The html view with the score layout example
        t = self.htmlView = QTextBrowser()
        t.setOpenLinks(False)
        t.setOpenExternalLinks(False)
        t.setSearchPaths(__path__)
        t.setTextInteractionFlags(Qt.LinksAccessibleByMouse)
        t.setFocusPolicy(Qt.NoFocus)

        # ensure that the full HTML example page is displayed
        t.setContentsMargins(2, 2, 2, 2)
        t.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        t.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        t.setMinimumSize(QSize(350, 350))
        layout.addWidget(t)

        t.anchorClicked.connect(self.slotAnchorClicked)

        grid = QGridLayout()
        layout.addLayout(grid)

        grid.setVerticalSpacing(1)
        grid.setColumnMinimumWidth(1, 200)

        self.labels = {}
        self.edits = {}
        for row, (name, desc) in enumerate(headers()):
            l = QLabel()
            e = QLineEdit()
            l.setBuddy(e)
            grid.addWidget(l, row, 0)
            grid.addWidget(e, row, 1)
            self.labels[name] = l
            self.edits[name] = e
            completionmodel.complete(e, "scorewiz/completion/header/" + name)
            e.completer().setCaseSensitivity(Qt.CaseInsensitive)

        app.settingsChanged.connect(self.readSettings)
        self.readSettings()
        app.translateUI(self)
Пример #43
0
 def setupUi(self):
     """layout the window"""
     self.setContentsMargins(0, 0, 0, 0)
     vlayout = QVBoxLayout(self)
     vlayout.setContentsMargins(0, 0, 0, 0)
     sliderLayout = QHBoxLayout()
     self.kcfg_showShadows = QCheckBox(m18n('Show tile shadows'), self)
     self.kcfg_showShadows.setObjectName('kcfg_showShadows')
     self.kcfg_rearrangeMelds = QCheckBox(
         m18n('Rearrange undisclosed tiles to melds'), self)
     self.kcfg_rearrangeMelds.setObjectName('kcfg_rearrangeMelds')
     self.kcfg_showOnlyPossibleActions = QCheckBox(
         m18n('Show only possible actions'))
     self.kcfg_showOnlyPossibleActions.setObjectName(
         'kcfg_showOnlyPossibleActions')
     self.kcfg_propose = QCheckBox(m18n('Propose what to do'))
     self.kcfg_propose.setObjectName('kcfg_propose')
     self.kcfg_animationSpeed = QSlider(self)
     self.kcfg_animationSpeed.setObjectName('kcfg_animationSpeed')
     self.kcfg_animationSpeed.setOrientation(Qt.Horizontal)
     self.kcfg_animationSpeed.setSingleStep(1)
     lblSpeed = QLabel(m18n('Animation speed:'))
     lblSpeed.setBuddy(self.kcfg_animationSpeed)
     sliderLayout.addWidget(lblSpeed)
     sliderLayout.addWidget(self.kcfg_animationSpeed)
     self.kcfg_useSounds = QCheckBox(m18n('Use sounds if available'), self)
     self.kcfg_useSounds.setObjectName('kcfg_useSounds')
     self.kcfg_uploadVoice = QCheckBox(m18n('Let others hear my voice'),
                                       self)
     self.kcfg_uploadVoice.setObjectName('kcfg_uploadVoice')
     pol = QSizePolicy()
     pol.setHorizontalPolicy(QSizePolicy.Expanding)
     pol.setVerticalPolicy(QSizePolicy.Expanding)
     spacerItem = QSpacerItem(20, 20, QSizePolicy.Minimum,
                              QSizePolicy.Expanding)
     vlayout.addWidget(self.kcfg_showShadows)
     vlayout.addWidget(self.kcfg_rearrangeMelds)
     vlayout.addWidget(self.kcfg_showOnlyPossibleActions)
     vlayout.addWidget(self.kcfg_propose)
     vlayout.addWidget(self.kcfg_useSounds)
     vlayout.addWidget(self.kcfg_uploadVoice)
     vlayout.addLayout(sliderLayout)
     vlayout.addItem(spacerItem)
     self.setSizePolicy(pol)
     self.retranslateUi()
Пример #44
0
class ResizeDlg(QDialog):

    def __init__(self, width, height, parent=None):
        super(ResizeDlg, self).__init__(parent)
        self.create_widgets(width, height)
        self.layout_widgets()
        self.create_connections()
        self.setWindowTitle(self.tr("Image Changer - Resize"))


    def create_widgets(self, width, height):
        self.widthLabel = QLabel(self.tr("&Width:"))
        self.widthSpinBox = QSpinBox()
        self.widthLabel.setBuddy(self.widthSpinBox)
        self.widthSpinBox.setAlignment(Qt.AlignRight|Qt.AlignVCenter)
        self.widthSpinBox.setRange(4, width * 4)
        self.widthSpinBox.setValue(width)
        self.heightLabel = QLabel(self.tr("&Height:"))
        self.heightSpinBox = QSpinBox()
        self.heightLabel.setBuddy(self.heightSpinBox)
        self.heightSpinBox.setAlignment(Qt.AlignRight|Qt.AlignVCenter)
        self.heightSpinBox.setRange(4, height * 4)
        self.heightSpinBox.setValue(height)

        self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok|
                                          QDialogButtonBox.Cancel)


    def layout_widgets(self):
        layout = QGridLayout()
        layout.addWidget(self.widthLabel, 0, 0)
        layout.addWidget(self.widthSpinBox, 0, 1)
        layout.addWidget(self.heightLabel, 1, 0)
        layout.addWidget(self.heightSpinBox, 1, 1)
        layout.addWidget(self.buttonBox, 2, 0, 1, 2)
        self.setLayout(layout)


    def create_connections(self):
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)


    def result(self):
        return self.widthSpinBox.value(), self.heightSpinBox.value()
Пример #45
0
    def __init__(self, parent=None):
        super(ClassPropertiesDlg, self).__init__(parent)
        idlabel = QLabel("&ID(Digits)")
        self.idLineEditBox = QLineEdit(self)
        self.idLineEditBox.setValidator(QIntValidator())
        idlabel.setBuddy(self.idLineEditBox)

        namelabel = QLabel("&Name")
        self.nameLineEditBox = QLineEdit(self)
        namelabel.setBuddy(self.nameLineEditBox)

        descriptionlabel = QLabel("&Description")
        self.descriptionLineEditBox = QTextEdit(self)
        descriptionlabel.setBuddy(self.descriptionLineEditBox)

        self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                          | QDialogButtonBox.Cancel)

        layout = QGridLayout()
        layout.addWidget(idlabel, 0, 0)
        layout.addWidget(self.idLineEditBox, 0, 1)
        layout.addWidget(namelabel, 1, 0)
        layout.addWidget(self.nameLineEditBox, 1, 1, 1, 3)
        layout.addWidget(descriptionlabel, 2, 0, 1, 4)
        layout.addWidget(self.descriptionLineEditBox, 3, 0, 3, 4)
        layout.addWidget(self.buttonBox)

        self.setLayout(layout)

        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)
        self.setWindowTitle("Class Properties")
Пример #46
0
    def redrawEditFrameContent(self):

        if self.treewidget.getSelectedEditable() is not None:
            editable = self.treewidget.getSelectedEditable()
            editframecontent = EditableForm(editable, self.editframe)
            textlabel = QLabel(
                ("<b>Edit attributes for %s</b>" % (editable.getName())))
        else:
            editframecontent = QLabel(
                ("Select an element first to modify its properties"))
            textlabel = QLabel(("<b>No element selected</b>"))

        self.clearLayout(self.editframelayout)
        textlabel.setMaximumHeight(20)
        textlabel.setMinimumHeight(20)
        textlabel.setAlignment(Qt.AlignCenter)
        textlabel.setBuddy(editframecontent)
        self.editframelayout.addWidget(textlabel)
        self.editframelayout.addWidget(editframecontent)
        self.connect(editframecontent, SIGNAL(EditableForm.USERINPUT_SIGNAL),
                     self.updateItem)
        self.emit(SIGNAL(self.ITEMEVENT))
Пример #47
0
    def __init__(self, parent=None):
        super(PltTypeDlg, self).__init__(parent)

        pltLabel = QLabel("&Select plot type:")
        self.pltComboBox = QComboBox()
        pltLabel.setBuddy(self.pltComboBox)
        self.pltComboBox.addItems(["", "Dark", "Illuminated"])

        pltbuttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                        | QDialogButtonBox.Cancel)
        pltbuttonBox.button(QDialogButtonBox.Ok).setDefault(True)

        layout = QGridLayout()
        layout.addWidget(pltLabel, 0, 0)
        layout.addWidget(self.pltComboBox, 0, 1)
        layout.addWidget(pltbuttonBox, 1, 0, 1, 2)

        self.connect(pltbuttonBox, SIGNAL("accepted()"), self,
                     SLOT("accept()"))
        self.connect(pltbuttonBox, SIGNAL("rejected()"), self,
                     SLOT("reject()"))

        self.setWindowTitle("I-V proc - Plot type")
Пример #48
0
class RenameDialog(QDialog):
    def __init__(self, parent=None):
        super().__init__(parent)

        self.newNameLabel = QLabel("New _Name")
        self.newNameLineEdit = QLineEdit()
        self.newNameLabel.setBuddy(self.newNameLineEdit)
        self.okButton = QPushButton("O&K")
        self.cancelButton = QPushButton("&Cancel")
        self.cancelButton.setDefault(True)

        self.newNameLineEdit.setText(applicationDirectory)
        self.newNameLineEdit.selectAll()

        layout = QVBoxLayout(self)
        layout.addWidget(self.newNameLabel)
        layout.addWidget(self.newNameLineEdit)

        miniLayout = QHBoxLayout()
        miniLayout.addWidget(self.okButton)
        miniLayout.addWidget(self.cancelButton)

        layout.addLayout(miniLayout)

        self.setLayout(layout)

        self.cancelButton.clicked.connect(self.reject)
        self.okButton.clicked.connect(self.accept)

    def getNewName(self):
        return self.newNameLineEdit.text()

    def accept(self):
        if self.newNameLineEdit.text() == "":
            self.okButton.setEnabled(False)
            self.newNameLineEdit.setFocus()
        super().accept()
Пример #49
0
    def __init__(self, editable, parent=None):
        """
        Constructor
        """

        super(EditableForm, self).__init__(parent)
        layout = EditableFormLayout()

        self.error = None
        self.editable = editable
        try:
            self.editable.checkAttributes()
        except EditableAttributeError as e:
            self.error = e

        self.key2Container = {}

        for key, val in sorted(editable.attributesToDict().items()):
            label = QLabel(key, parent=self)

            if self.isErrorKey(key):
                label.setStyleSheet(self.ERRORSTYLE.format("QLabel"))
                helptext = self.error.getMessage()
            else:
                helptext = editable.getAttrDocumentation(key)

            valwidgetContainer = self.valToWidgetContainer(key, val)
            self.key2Container[key] = valwidgetContainer
            if helptext is not None:
                for w in (valwidgetContainer.getWidget(), label):
                    w.setToolTip(helptext)
                    w.setStatusTip(helptext)

            label.setBuddy(valwidgetContainer.getWidget())
            layout.addRow(label, valwidgetContainer.getWidget())

        self.setLayout(layout)
Пример #50
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        def hbox(*widgets):
            box = QHBoxLayout()
            [box.addWidget(z) for z in widgets]
            box.addStretch()
            return box

        vbox = QVBoxLayout()

        startlabel = QLabel(translate('Autonumbering Wizard', "&Start: "))
        self._start = QSpinBox()
        startlabel.setBuddy(self._start)
        self._start.setValue(1)
        self._start.setMaximum(65536)

        vbox.addLayout(hbox(startlabel, self._start))

        label = QLabel(
            translate('Autonumbering Wizard',
                      'Max length after padding with zeroes: '))
        self._padlength = QSpinBox()
        label.setBuddy(self._padlength)
        self._padlength.setValue(1)
        self._padlength.setMaximum(65535)
        self._padlength.setMinimum(1)
        vbox.addLayout(hbox(label, self._padlength))

        self._restart_numbering = QCheckBox(
            translate('Autonumbering Wizard',
                      "&Restart numbering at each directory."))

        vbox.addWidget(self._restart_numbering)
        vbox.addStretch()

        self.setLayout(vbox)
Пример #51
0
    def __init__(self, format, parent=None):
        super(NumberFormatDlg, self).__init__(parent)
        self.setAttribute(Qt.WA_DeleteOnClose)

        punctuationRe = QRegExp(r"[ ,;:.]")

        thousandsLabel = QLabel("&Thousands separator")
        self.thousandsEdit = QLineEdit(format["thousandsseparator"])
        thousandsLabel.setBuddy(self.thousandsEdit)
        self.thousandsEdit.setMaxLength(1)
        self.thousandsEdit.setValidator(QRegExpValidator(punctuationRe, self))

        decimalMarkerLabel = QLabel("Decimal &marker")
        self.decimalMarkerEdit = QLineEdit(format["decimalmarker"])
        decimalMarkerLabel.setBuddy(self.decimalMarkerEdit)
        self.decimalMarkerEdit.setMaxLength(1)
        self.decimalMarkerEdit.setValidator(
            QRegExpValidator(punctuationRe, self))
        self.decimalMarkerEdit.setInputMask("X")

        decimalPlacesLabel = QLabel("&Decimal places")
        self.decimalPlacesSpinBox = QSpinBox()
        decimalPlacesLabel.setBuddy(self.decimalPlacesSpinBox)
        self.decimalPlacesSpinBox.setRange(0, 6)
        self.decimalPlacesSpinBox.setValue(format["decimalplaces"])

        self.redNegativesCheckBox = QCheckBox("&Red negative numbers")
        self.redNegativesCheckBox.setChecked(format["rednegatives"])

        buttonBox = QDialogButtonBox(QDialogButtonBox.Apply
                                     | QDialogButtonBox.Close)

        self.format = format

        grid = QGridLayout()
        grid.addWidget(thousandsLabel, 0, 0)
        grid.addWidget(self.thousandsEdit, 0, 1)
        grid.addWidget(decimalMarkerLabel, 1, 0)
        grid.addWidget(self.decimalMarkerEdit, 1, 1)
        grid.addWidget(decimalPlacesLabel, 2, 0)
        grid.addWidget(self.decimalPlacesSpinBox, 2, 1)
        grid.addWidget(self.redNegativesCheckBox, 3, 0, 1, 2)
        grid.addWidget(buttonBox, 4, 0, 1, 2)
        self.setLayout(grid)

        self.connect(buttonBox.button(QDialogButtonBox.Apply),
                     SIGNAL("clicked()"), self.apply)
        self.connect(buttonBox, SIGNAL("rejected()"), self, SLOT("reject()"))
        self.setWindowTitle("Set Number Format (Modeless)")
Пример #52
0
    def __init__(self, format, callback, parent=None):
        super(NumberFormatDlg, self).__init__(parent)

        punctuationRe = QRegExp(r"[ ,;:.]")
        thousandsLabel = QLabel("&Thousands separator")
        self.thousandsEdit = QLineEdit(format["thousandsseparator"])
        thousandsLabel.setBuddy(self.thousandsEdit)
        self.thousandsEdit.setMaxLength(1)
        self.thousandsEdit.setValidator(QRegExpValidator(
                punctuationRe, self))
        decimalMarkerLabel = QLabel("Decimal &marker")
        self.decimalMarkerEdit = QLineEdit(format["decimalmarker"])
        decimalMarkerLabel.setBuddy(self.decimalMarkerEdit)
        self.decimalMarkerEdit.setMaxLength(1)
        self.decimalMarkerEdit.setValidator(QRegExpValidator(
                punctuationRe, self))
        self.decimalMarkerEdit.setInputMask("X")
        decimalPlacesLabel = QLabel("&Decimal places")
        self.decimalPlacesSpinBox = QSpinBox()
        decimalPlacesLabel.setBuddy(self.decimalPlacesSpinBox)
        self.decimalPlacesSpinBox.setRange(0, 6)
        self.decimalPlacesSpinBox.setValue(format["decimalplaces"])
        self.redNegativesCheckBox = QCheckBox("&Red negative numbers")
        self.redNegativesCheckBox.setChecked(format["rednegatives"])

        self.format = format
        self.callback = callback

        grid = QGridLayout()
        grid.addWidget(thousandsLabel, 0, 0)
        grid.addWidget(self.thousandsEdit, 0, 1)
        grid.addWidget(decimalMarkerLabel, 1, 0)
        grid.addWidget(self.decimalMarkerEdit, 1, 1)
        grid.addWidget(decimalPlacesLabel, 2, 0)
        grid.addWidget(self.decimalPlacesSpinBox, 2, 1)
        grid.addWidget(self.redNegativesCheckBox, 3, 0, 1, 2)
        self.setLayout(grid)

        self.connect(self.thousandsEdit,
                SIGNAL("textEdited(QString)"), self.checkAndFix)
        self.connect(self.decimalMarkerEdit,
                SIGNAL("textEdited(QString)"), self.checkAndFix)
        self.connect(self.decimalPlacesSpinBox,
                SIGNAL("valueChanged(int)"), self.apply)
        self.connect(self.redNegativesCheckBox,
                SIGNAL("toggled(bool)"), self.apply)
        self.setWindowTitle("Set Number Format (`Live')")
Пример #53
0
    def __init__(self, parent=None):
        super(NewTaskDialog, self).__init__(parent)
        # task name
        nameLabel = QLabel(self.tr("Name:"))
        self.name = QLineEdit()
        nameLabel.setBuddy(self.name)
        # priority
        priorityLabel = QLabel(self.tr("Priority:"))
        self.priority = QComboBox()
        priorityLabel.setBuddy(self.priority)

        dateLabel = QLabel(self.tr("Deadline:"))
        self.deadline = QDateEdit()
        dateLabel.setBuddy(self.deadline)

        self.deadline.setCalendarPopup(True)
        self.deadline.calendarWidget().setFirstDayOfWeek(Qt.Monday)
        self.deadline.setDate(QDate(date.today()))

        createButton = QPushButton(self.tr("Save"))
        cancelButton = QPushButton(self.tr("Cancel"))

        buttonLayout = QHBoxLayout()
        buttonLayout.addStretch()
        buttonLayout.addWidget(createButton)
        buttonLayout.addWidget(cancelButton)

        layout = QGridLayout()
        layout.addWidget(nameLabel, 0, 0)
        layout.addWidget(self.name, 0, 1)

        layout.addWidget(priorityLabel, 1, 0)
        layout.addWidget(self.priority, 1, 1)

        layout.addWidget(dateLabel, 2, 0)
        layout.addWidget(self.deadline, 2, 1)
        layout.addLayout(buttonLayout, 3, 0, 3, 2)
        self.setLayout(layout)

        self.connect(self.deadline, SIGNAL("dateChanged(const QDate&)"), self, SLOT("changed()"))
        self.connect(createButton, SIGNAL("clicked()"), self, SLOT("accept()"))
        self.connect(cancelButton, SIGNAL("clicked()"), self, SLOT("reject()"))
        self.setWindowTitle(self.tr("Task"))
        self.resize(350, 120)
        self.setMinimumSize(QSize(250, 120))
        self.setMaximumSize(QSize(450, 120))
Пример #54
0
    def __init__(self, format, parent=None):
        super(NumberFormatDlg, self).__init__(parent)

        thousandsLabel = QLabel("&Thousands separator")
        self.thousandsEdit = QLineEdit(format["thousandsseparator"])
        thousandsLabel.setBuddy(self.thousandsEdit)
        decimalMarkerLabel = QLabel("Decimal &marker")
        self.decimalMarkerEdit = QLineEdit(format["decimalmarker"])
        decimalMarkerLabel.setBuddy(self.decimalMarkerEdit)
        decimalPlacesLabel = QLabel("&Decimal places")
        self.decimalPlacesSpinBox = QSpinBox()
        decimalPlacesLabel.setBuddy(self.decimalPlacesSpinBox)
        self.decimalPlacesSpinBox.setRange(0, 6)
        self.decimalPlacesSpinBox.setValue(format["decimalplaces"])
        self.redNegativesCheckBox = QCheckBox("&Red negative numbers")
        self.redNegativesCheckBox.setChecked(format["rednegatives"])

        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok|
                                     QDialogButtonBox.Cancel)

        self.format = format.copy()

        grid = QGridLayout()
        grid.addWidget(thousandsLabel, 0, 0)
        grid.addWidget(self.thousandsEdit, 0, 1)
        grid.addWidget(decimalMarkerLabel, 1, 0)
        grid.addWidget(self.decimalMarkerEdit, 1, 1)
        grid.addWidget(decimalPlacesLabel, 2, 0)
        grid.addWidget(self.decimalPlacesSpinBox, 2, 1)
        grid.addWidget(self.redNegativesCheckBox, 3, 0, 1, 2)
        grid.addWidget(buttonBox, 4, 0, 1, 2)
        self.setLayout(grid)

        self.connect(buttonBox, SIGNAL("accepted()"),
                     self, SLOT("accept()"))
        self.connect(buttonBox, SIGNAL("rejected()"),
                     self, SLOT("reject()"))
        self.setWindowTitle("Set Number Format (Modal)")
class FindDialog(QDialog):
    def __init__(self, parent=None):
        super(
            FindDialog,
            self,
        ).__init__(parent)
        self.label = QLabel(str("Find &what:"))
        self.lineEdit = QLineEdit()
        self.label.setBuddy(self.lineEdit)

        self.caseCheckBox = QCheckBox(str("Match &case"))
        self.backwardCheckBox = QCheckBox(str("Search &backward"))

        self.findButton = QPushButton(str("&Find"))
        self.findButton.setDefault(True)
        self.findButton.setEnabled(False)

        closeButton = QPushButton(str("Close"))

        #--------------------------------------------------------
        # 1. 连接的槽 必须 指定  @pyqtSlot(QString)
        self.connect(self.lineEdit, SIGNAL("textChanged(QString)"), self,
                     SLOT("enableFindButton(QString)"))
        # 2. 不必指定 @pyqtSlot(QString)
        # self.connect(self.lineEdit, SIGNAL("textChanged(QString)"),
        #               self.enableFindButton)
        #---------------------------------------------------------

        self.connect(self.findButton, SIGNAL("clicked()"), self,
                     SLOT("findClicked()"))
        self.connect(closeButton, SIGNAL("clicked()"), self, SLOT("close()"))

        #------------- 布局 -------------------------
        topLeftLayout = QHBoxLayout()
        topLeftLayout.addWidget(self.label)
        topLeftLayout.addWidget(self.lineEdit)

        leftLayout = QVBoxLayout()
        leftLayout.addLayout(topLeftLayout)
        leftLayout.addWidget(self.caseCheckBox)
        leftLayout.addWidget(self.backwardCheckBox)

        rightLayout = QVBoxLayout()
        rightLayout.addWidget(self.findButton)
        rightLayout.addWidget(closeButton)
        rightLayout.addStretch()  # 添加 分割 符号

        mainLayout = QHBoxLayout()
        mainLayout.addLayout(leftLayout)
        mainLayout.addLayout(rightLayout)
        self.setLayout(mainLayout)
        #-------------------------------

        self.setWindowTitle(str("Find"))
        # 设置 固定 高度
        # sizeHint().height() 返回一个 窗口 "理想"的尺寸
        self.setFixedHeight(self.sizeHint().height())

    @pyqtSlot()
    def findClicked(self):
        text = self.lineEdit.text()
        cs = None
        if self.caseCheckBox.isChecked():
            print "case"
            cs = Qt.CaseSensitive
        else:
            print ""
            cs = Qt.CaseInsensitive

        if self.backwardCheckBox.isChecked():
            pass
            # self.emit findPrevious(text, cs)
        else:
            pass
            # self.emit findNext(text, cs)

    @pyqtSlot(QString)
    def enableFindButton(self, text):
        print type(text), ":", len(text)
        print(text)
        t = QString(text)
        self.findButton.setEnabled(not t.isEmpty())
Пример #56
0
class RecordingWidget(QWidget):
    """Widget containing main recording UI for Freeseer"""
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        icon = QIcon()
        icon.addPixmap(QPixmap(":/freeseer/logo.png"), QIcon.Normal, QIcon.Off)
        self.setWindowIcon(icon)
        self.resize(400, 400)

        self.mainLayout = QVBoxLayout()
        self.setLayout(self.mainLayout)

        boldFont = QFont()
        boldFont.setBold(True)

        # Control bar
        self.controlRow = QHBoxLayout()
        self.mainLayout.addLayout(self.controlRow)

        self.standbyIcon = QIcon.fromTheme("system-shutdown")
        recordFallbackIcon = QIcon(":/multimedia/record.png")
        self.recordIcon = QIcon.fromTheme("media-record", recordFallbackIcon)
        stopFallbackIcon = QIcon(":/multimedia/stop.png")
        self.stopIcon = QIcon.fromTheme("media-playback-stop",
                                        stopFallbackIcon)
        self.pauseIcon = QIcon.fromTheme("media-playback-pause")
        self.resumeIcon = QIcon.fromTheme("media-playback-start")
        self.headphoneIcon = QIcon()
        self.headphoneIcon.addPixmap(QPixmap(":/multimedia/headphones.png"),
                                     QIcon.Normal, QIcon.Off)

        self.standbyPushButton = QPushButton("Standby")
        self.standbyPushButton.setToolTip("Standby")
        self.standbyPushButton.setMinimumSize(QSize(0, 40))
        self.standbyPushButton.setSizePolicy(QSizePolicy.Minimum,
                                             QSizePolicy.Fixed)
        self.standbyPushButton.setIcon(self.standbyIcon)
        self.standbyPushButton.setCheckable(True)
        self.standbyPushButton.setObjectName("standbyButton")
        self.controlRow.addWidget(self.standbyPushButton)

        self.autoRecordPushButton = QPushButton("Auto Record")
        self.autoRecordPushButton.setToolTip("Automated Recording")
        self.autoRecordPushButton.setMinimumSize(QSize(40, 40))
        self.autoRecordPushButton.setMaximumSize(QSize(120, 40))
        self.autoRecordPushButton.setCheckable(True)
        self.autoRecordPushButton.setObjectName("autoRecordButton")
        self.controlRow.addWidget(self.autoRecordPushButton)

        self.recordPushButton = QPushButton("Record")
        self.recordPushButton.setToolTip("Record")
        self.recordPushButton.setMinimumSize(QSize(0, 40))
        self.recordPushButton.setSizePolicy(QSizePolicy.Minimum,
                                            QSizePolicy.Fixed)
        self.recordPushButton.setIcon(self.recordIcon)
        self.recordPushButton.setHidden(True)
        self.recordPushButton.setEnabled(False)
        self.recordPushButton.setCheckable(True)
        self.recordPushButton.setObjectName("recordButton")
        self.controlRow.addWidget(self.recordPushButton)
        self.connect(self.recordPushButton, SIGNAL("toggled(bool)"),
                     self.setRecordIcon)

        self.pauseToolButton = QToolButton()
        self.pauseToolButton.setText("Pause")
        self.pauseToolButton.setToolTip("Pause")
        self.pauseToolButton.setIcon(self.pauseIcon)
        self.pauseToolButton.setMinimumSize(QSize(40, 40))
        self.pauseToolButton.setSizePolicy(QSizePolicy.Maximum,
                                           QSizePolicy.Fixed)
        self.pauseToolButton.setHidden(True)
        self.pauseToolButton.setEnabled(False)
        self.pauseToolButton.setCheckable(True)
        self.controlRow.addWidget(self.pauseToolButton)
        self.connect(self.pauseToolButton, SIGNAL("toggled(bool)"),
                     self.setPauseIcon)

        playbackIcon = QIcon.fromTheme("video-x-generic")
        self.playPushButton = QPushButton()
        self.playPushButton.setText("Play Video")
        self.playPushButton.setToolTip("Play last recorded Video")
        self.playPushButton.setIcon(playbackIcon)
        self.playPushButton.setMinimumSize(QSize(40, 40))
        self.playPushButton.setMaximumSize(QSize(120, 40))
        self.playPushButton.setHidden(True)
        self.playPushButton.setEnabled(False)
        self.playPushButton.setCheckable(True)
        self.controlRow.addWidget(self.playPushButton)

        # Filter bar
        self.filterBarLayout = QVBoxLayout()
        self.mainLayout.addLayout(self.filterBarLayout)

        self.filterBarLayoutRow_1 = QHBoxLayout()
        self.filterBarLayout.addLayout(self.filterBarLayoutRow_1)
        self.eventLabel = QLabel("Event")
        self.eventLabel.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
        self.eventComboBox = QComboBox()
        self.eventLabel.setBuddy(self.eventComboBox)
        self.roomLabel = QLabel("Room")
        self.roomLabel.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
        self.roomComboBox = QComboBox()
        self.roomLabel.setBuddy(self.roomComboBox)
        self.dateLabel = QLabel("Date")
        self.dateLabel.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
        self.dateComboBox = QComboBox()
        self.dateLabel.setBuddy(self.dateComboBox)
        self.filterBarLayoutRow_1.addWidget(self.eventLabel)
        self.filterBarLayoutRow_1.addWidget(self.eventComboBox)
        self.filterBarLayoutRow_1.addWidget(self.roomLabel)
        self.filterBarLayoutRow_1.addWidget(self.roomComboBox)
        self.filterBarLayoutRow_1.addWidget(self.dateLabel)
        self.filterBarLayoutRow_1.addWidget(self.dateComboBox)

        self.filterBarLayoutRow_2 = QHBoxLayout()
        self.filterBarLayout.addLayout(self.filterBarLayoutRow_2)
        self.talkLabel = QLabel("Talk ")
        self.talkLabel.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
        self.talkComboBox = QComboBox()
        self.talkComboBox.setFont(boldFont)
        self.talkComboBox.setSizePolicy(QSizePolicy.Minimum,
                                        QSizePolicy.Maximum)
        self.talkComboBox.setSizeAdjustPolicy(
            QComboBox.AdjustToMinimumContentsLength)
        self.filterBarLayoutRow_2.addWidget(self.talkLabel)
        self.filterBarLayoutRow_2.addWidget(self.talkComboBox)

        # Preview Layout
        self.previewLayout = QHBoxLayout()
        self.mainLayout.addLayout(self.previewLayout)

        self.previewWidget = QWidget()
        self.audioSlider = QSlider()
        self.audioSlider.setSizePolicy(QSizePolicy.Fixed,
                                       QSizePolicy.Expanding)
        self.audioSlider.setEnabled(False)
        self.previewLayout.addWidget(self.previewWidget)
        self.previewLayout.addWidget(self.audioSlider)

        self.statusLabel = QLabel()
        self.mainLayout.addWidget(self.statusLabel)

        # Audio Feedback Checkbox
        self.audioFeedbackCheckbox = QCheckBox()
        self.audioFeedbackCheckbox.setLayoutDirection(Qt.RightToLeft)
        self.audioFeedbackCheckbox.setIcon(self.headphoneIcon)
        self.audioFeedbackCheckbox.setToolTip("Enable Audio Feedback")
        self.mainLayout.addWidget(self.audioFeedbackCheckbox)

    def setRecordIcon(self, state):
        if state:
            self.recordPushButton.setIcon(self.stopIcon)
        else:
            self.recordPushButton.setIcon(self.recordIcon)

    def setPauseIcon(self, state):
        if state:
            self.pauseToolButton.setIcon(self.resumeIcon)
        else:
            self.pauseToolButton.setIcon(self.pauseIcon)
Пример #57
0
    def __init__(self, parent=None, conflictCallback=None, *cbArgs):
        """conflictCallback is a optional method called when a shortcut is changed.
        
        cbArgs is optional arguments of the conflictCallback method.
        it should return the name of the potential conflict or a null value """

        super(ShortcutEditDialog, self).__init__(parent)
        self.conflictCallback = conflictCallback
        self.cbArgs = cbArgs
        self.setMinimumWidth(400)
        # create gui

        layout = QVBoxLayout()
        layout.setSpacing(10)
        self.setLayout(layout)

        top = QHBoxLayout()
        top.setSpacing(4)
        p = self.toppixmap = QLabel()
        l = self.toplabel = QLabel()
        top.addWidget(p)
        top.addWidget(l, 1)
        layout.addLayout(top)
        grid = QGridLayout()
        grid.setSpacing(4)
        grid.setColumnStretch(1, 2)
        layout.addLayout(grid)

        self.buttonDefault = QRadioButton(
            self, toggled=self.slotButtonDefaultToggled)
        self.buttonNone = QRadioButton(self)
        self.lconflictDefault = QLabel('test')
        self.lconflictDefault.setStyleSheet("color : red;")
        self.lconflictDefault.setVisible(False)
        self.buttonCustom = QRadioButton(self)
        grid.addWidget(self.buttonDefault, 0, 0, 1, 2)
        grid.addWidget(self.lconflictDefault, 1, 0, 1, 2)
        grid.addWidget(self.buttonNone, 2, 0, 1, 2)
        grid.addWidget(self.buttonCustom, 3, 0, 1, 2)

        self.keybuttons = []
        self.keylabels = []
        self.conflictlabels = []
        for num in range(4):
            l = QLabel(self)
            l.setStyleSheet("margin-left: 2em;")
            l.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
            b = KeySequenceWidget(self, num)
            b.keySequenceChanged.connect(self.slotKeySequenceChanged)
            l.setBuddy(b)
            self.keylabels.append(l)
            self.keybuttons.append(b)
            grid.addWidget(l, num + 4 + num, 0)
            grid.addWidget(b, num + 4 + num, 1)
            lconflict = QLabel()
            lconflict.setStyleSheet("color : red;")
            self.conflictlabels.append(lconflict)
            lconflict.setVisible(False)
            grid.addWidget(lconflict, num + 5 + num, 0, 1, 2, Qt.AlignHCenter)

        layout.addWidget(Separator(self))

        b = QDialogButtonBox(self)
        b.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        layout.addWidget(b)
        b.accepted.connect(self.accept)
        b.rejected.connect(self.reject)
        app.translateUI(self)
Пример #58
0
    def __init__(self, parent=None):
        super(ContactDlg, self).__init__(parent)

        forenameLabel = QLabel("&Forename:")
        self.forenameEdit = QLineEdit()
        forenameLabel.setBuddy(self.forenameEdit)
        surnameLabel = QLabel("&Surname:")
        self.surnameEdit = QLineEdit()
        surnameLabel.setBuddy(self.surnameEdit)
        categoryLabel = QLabel("&Category:")
        self.categoryComboBox = QComboBox()
        categoryLabel.setBuddy(self.categoryComboBox)
        self.categoryComboBox.addItems(["Business", "Domestic", "Personal"])
        companyLabel = QLabel("C&ompany:")
        self.companyEdit = QLineEdit()
        companyLabel.setBuddy(self.companyEdit)
        addressLabel = QLabel("A&ddress:")
        self.addressEdit = QLineEdit()
        addressLabel.setBuddy(self.addressEdit)
        phoneLabel = QLabel("&Phone:")
        self.phoneEdit = QLineEdit()
        phoneLabel.setBuddy(self.phoneEdit)
        mobileLabel = QLabel("&Mobile:")
        self.mobileEdit = QLineEdit()
        mobileLabel.setBuddy(self.mobileEdit)
        faxLabel = QLabel("Fa&x:")
        self.faxEdit = QLineEdit()
        faxLabel.setBuddy(self.faxEdit)
        emailLabel = QLabel("&Email:")
        self.emailEdit = QLineEdit()
        emailLabel.setBuddy(self.emailEdit)
        self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                          | QDialogButtonBox.Cancel)
        addButton = self.buttonBox.button(QDialogButtonBox.Ok)
        addButton.setText("&Add")
        addButton.setEnabled(False)

        grid = QGridLayout()
        grid.addWidget(forenameLabel, 0, 0)
        grid.addWidget(self.forenameEdit, 0, 1)
        grid.addWidget(surnameLabel, 0, 2)
        grid.addWidget(self.surnameEdit, 0, 3)
        grid.addWidget(categoryLabel, 1, 0)
        grid.addWidget(self.categoryComboBox, 1, 1)
        grid.addWidget(companyLabel, 1, 2)
        grid.addWidget(self.companyEdit, 1, 3)
        grid.addWidget(addressLabel, 2, 0)
        grid.addWidget(self.addressEdit, 2, 1, 1, 3)
        grid.addWidget(phoneLabel, 3, 0)
        grid.addWidget(self.phoneEdit, 3, 1)
        grid.addWidget(mobileLabel, 3, 2)
        grid.addWidget(self.mobileEdit, 3, 3)
        grid.addWidget(faxLabel, 4, 0)
        grid.addWidget(self.faxEdit, 4, 1)
        grid.addWidget(emailLabel, 4, 2)
        grid.addWidget(self.emailEdit, 4, 3)
        layout = QVBoxLayout()
        layout.addLayout(grid)
        layout.addWidget(self.buttonBox)
        self.setLayout(layout)

        self.lineedits = (self.forenameEdit, self.surnameEdit,
                          self.companyEdit, self.phoneEdit, self.emailEdit)
        for lineEdit in self.lineedits:
            lineEdit.setProperty("mandatory", QVariant(True))
            self.connect(lineEdit, SIGNAL("textEdited(QString)"),
                         self.updateUi)
        self.connect(self.categoryComboBox, SIGNAL("activated(int)"),
                     self.updateUi)

        self.connect(self.buttonBox, SIGNAL("accepted()"), self.accept)
        self.connect(self.buttonBox, SIGNAL("rejected()"), self.reject)

        self.setStyleSheet(ContactDlg.StyleSheet)
        self.setWindowTitle("Add Contact")
Пример #59
0
class ParametersDialog(QDialog):
    def __init__(self, parent=None):
        super(ParametersDialog, self).__init__(parent)

        self.limitImagesCheckBox = QCheckBox(self.tr("&Limit number of images"))
        self.limitLineEdit = QLineEdit()
        self.connect(self.limitImagesCheckBox, SIGNAL('clicked()'), self.limitClicked)
        self.limitLineEdit.setText("100")
        self.limitLineEdit.setValidator(QIntValidator())
        self.limitLineEdit.setEnabled(False)
        
        self.useDefaultCheckBox = QCheckBox(self.tr("Use &default parameters"))
        self.useDefaultCheckBox.setChecked(True)
        self.connect(self.useDefaultCheckBox, SIGNAL('clicked()'), self.defaultClicked)
        
        self.layerSizesLabel = QLabel(self.tr("Layer &sizes (-1 for input data size):"))
        self.layerSizesLineEdit = QLineEdit()
        self.layerSizesLineEdit.setText("-1, -1, -1, -1")
        self.layerSizesLineEdit.setEnabled(False)                
        self.layerSizesLabel.setBuddy(self.layerSizesLineEdit)
 
        self.layerTypesLabel = QLabel(self.tr("Layer &types (sigmoid or gaussian):"))
        self.layerTypesLineEdit = QLineEdit()
        self.layerTypesLineEdit.setText("sigmoid, sigmoid, sigmoid, sigmoid")
        self.layerTypesLineEdit.setEnabled(False)
        self.layerTypesLabel.setBuddy(self.layerTypesLineEdit)
        
        self.pretrainIterLabel = QLabel(self.tr("Pretraining &iterations for each layer:"))
        self.pretrainIterLineEdit = QLineEdit()
        self.pretrainIterLineEdit.setText("225, 75, 75")
        self.pretrainIterLineEdit.setEnabled(False)
        self.pretrainIterLabel.setBuddy(self.pretrainIterLineEdit)
        
        self.pretrainLRLabel = QLabel(self.tr("Pretraining &learning rate:"))
        self.pretrainLRLineEdit = QLineEdit()
        self.pretrainLRLineEdit.setText("0.0025")
        self.pretrainLRLineEdit.setValidator(QDoubleValidator())
        self.pretrainLRLineEdit.setEnabled(False)
        self.pretrainLRLabel.setBuddy(self.pretrainLRLineEdit)
        
        self.backpropIterLabel = QLabel(self.tr("&Backprop iterations:"))  
        self.backpropIterLineEdit = QLineEdit()
        self.backpropIterLineEdit.setText("30")
        self.backpropIterLineEdit.setValidator(QIntValidator())
        self.backpropIterLineEdit.setEnabled(False)
        self.backpropIterLabel.setBuddy(self.backpropIterLineEdit)
        
        self.buttonBox = QDialogButtonBox(QDialogButtonBox.Cancel | QDialogButtonBox.Ok)
        self.connect(self.buttonBox, SIGNAL('accepted()'), self.accept)
        self.connect(self.buttonBox, SIGNAL('rejected()'), self.reject)
        
        self.limitLayout = QHBoxLayout()
        self.limitLayout.addWidget(self.limitImagesCheckBox)
        self.limitLayout.addWidget(self.limitLineEdit)
        
        self.layerSizesLayout = QHBoxLayout()
        self.layerSizesLayout.addWidget(self.layerSizesLabel)
        self.layerSizesLayout.addWidget(self.layerSizesLineEdit)
        
        self.layerTypesLayout = QHBoxLayout()
        self.layerTypesLayout.addWidget(self.layerTypesLabel)
        self.layerTypesLayout.addWidget(self.layerTypesLineEdit)
        
        self.pretrainIterLayout = QHBoxLayout()
        self.pretrainIterLayout.addWidget(self.pretrainIterLabel)
        self.pretrainIterLayout.addWidget(self.pretrainIterLineEdit)
        
        self.pretrainLRLayout = QHBoxLayout()
        self.pretrainLRLayout.addWidget(self.pretrainLRLabel)
        self.pretrainLRLayout.addWidget(self.pretrainLRLineEdit)
        
        self.backpropIterLayout = QHBoxLayout()
        self.backpropIterLayout.addWidget(self.backpropIterLabel)
        self.backpropIterLayout.addWidget(self.backpropIterLineEdit)
        
        self.mainLayout = QVBoxLayout()
        self.mainLayout.addLayout(self.limitLayout)
        self.mainLayout.addWidget(self.useDefaultCheckBox)
        self.mainLayout.addLayout(self.layerSizesLayout)
        self.mainLayout.addLayout(self.layerTypesLayout)
        self.mainLayout.addLayout(self.pretrainIterLayout)
        self.mainLayout.addLayout(self.pretrainLRLayout)
        self.mainLayout.addLayout(self.backpropIterLayout)
        self.mainLayout.addWidget(self.buttonBox)

        self.setLayout(self.mainLayout)
        self.setWindowTitle(self.tr("Set training parameters"))
        self.setFixedHeight(self.sizeHint().height())
        
    def getValues(self):
        limit = self.limitImagesCheckBox.isChecked()
        limit_num = int(self.limitLineEdit.text())
        if self.useDefaultCheckBox.isChecked():
            layer_sizes = [-1,-1,-1,-1]
            layer_types = ['sigmoid', 'sigmoid', 'sigmoid', 'sigmoid']
            pretrain_iter = [225,75,75]
            pretrain_lr = 0.0025
            backprop_iter = 30
        else:
            layer_sizes = [int(x) for x in (self.layerSizesLineEdit.text()).split(',')]
            layer_types = [str(x) for x in (self.layerTypesLineEdit.text()).split(',')]
            pretrain_iter = [int(x) for x in (self.pretrainIterLineEdit.text()).split(',')]
            pretrain_lr = float(self.pretrainLRLineEdit.text())
            backprop_iter = int(self.backpropIterLineEdit.text())
        return [layer_sizes, layer_types, pretrain_iter, pretrain_lr, backprop_iter, limit, limit_num]

    def limitClicked(self):
        self.limitLineEdit.setEnabled(self.limitImagesCheckBox.isChecked())    
        
    def defaultClicked(self):
        self.layerSizesLineEdit.setEnabled(not self.useDefaultCheckBox.isChecked())
        self.layerTypesLineEdit.setEnabled(not self.useDefaultCheckBox.isChecked())
        self.pretrainIterLineEdit.setEnabled(not self.useDefaultCheckBox.isChecked())
        self.pretrainLRLineEdit.setEnabled(not self.useDefaultCheckBox.isChecked())
        self.backpropIterLineEdit.setEnabled(not self.useDefaultCheckBox.isChecked())