예제 #1
0
파일: login.py 프로젝트: zero804/kajongg
    def __init__(self, url, username, password):
        KDialog.__init__(self)
        decorateWindow(self, i18n('Create User Account'))
        self.setButtons(KDialog.ButtonCode(KDialog.Ok | KDialog.Cancel))
        vbox = QVBoxLayout()
        grid = QFormLayout()
        self.lbServer = QLabel()
        self.lbServer.setText(url)
        grid.addRow(i18n('Game server:'), self.lbServer)
        self.lbUser = QLabel()
        grid.addRow(i18n('Username:'******'Password:'******'Repeat password:'), self.edPassword2)
        vbox.addLayout(grid)
        widget = QWidget(self)
        widget.setLayout(vbox)
        self.setMainWidget(widget)
        pol = QSizePolicy()
        pol.setHorizontalPolicy(QSizePolicy.Expanding)
        self.lbUser.setSizePolicy(pol)

        self.edPassword.textChanged.connect(self.passwordChanged)
        self.edPassword2.textChanged.connect(self.passwordChanged)
        StateSaver(self)
        self.username = username
        self.password = password
        self.passwordChanged()
        self.edPassword2.setFocus()
예제 #2
0
파일: login.py 프로젝트: zero804/kajongg
 def setupUi(self):
     """create all Ui elements but do not fill them"""
     self.buttonBox = KDialogButtonBox(self)
     self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel
                                       | QDialogButtonBox.Ok)
     # Ubuntu 11.10 unity is a bit strange - without this, it sets focus on
     # the cancel button (which it shows on the left). I found no obvious
     # way to use setDefault and setAutoDefault for fixing this.
     self.buttonBox.button(QDialogButtonBox.Ok).setFocus(True)
     self.buttonBox.accepted.connect(self.accept)
     self.buttonBox.rejected.connect(self.reject)
     vbox = QVBoxLayout(self)
     self.grid = QFormLayout()
     self.cbServer = QComboBox()
     self.cbServer.setEditable(True)
     self.grid.addRow(i18n('Game server:'), self.cbServer)
     self.cbUser = QComboBox()
     self.cbUser.setEditable(True)
     self.grid.addRow(i18n('Username:'******'Password:'******'kajongg', 'Ruleset:'), self.cbRuleset)
     vbox.addLayout(self.grid)
     vbox.addWidget(self.buttonBox)
     pol = QSizePolicy()
     pol.setHorizontalPolicy(QSizePolicy.Expanding)
     self.cbUser.setSizePolicy(pol)
     self.__port = None
예제 #3
0
    def __init__(self, phl_obj=None, parent=None):
        super(IndexSimplerParamTab, self).__init__()

        # self.param_widget_parent = parent.param_widget_parent
        # indexing_method_check = QCheckBox("indexing.method")

        hbox_method = QHBoxLayout()
        label_method_62 = QLabel("Indexing method")
        hbox_method.addWidget(label_method_62)
        box_method_62 = DefaultComboBox(
            "indexing.method",
            ["fft3d", "fft1d", "real_space_grid_search", "low_res_spot_match"])
        box_method_62.currentIndexChanged.connect(self.combobox_changed)

        hbox_method.addWidget(box_method_62)

        max_cell_label = QLabel("Max cell")
        max_cell_spn_bx = QDoubleSpinBox()
        max_cell_spn_bx.setSingleStep(5.0)
        max_cell_spn_bx.local_path = "indexing.max_cell"
        max_cell_spn_bx.setSpecialValueText("Auto")
        max_cell_spn_bx.editingFinished.connect(self.spnbox_finished)

        space_group_label = QLabel("Space group")
        space_group_line = QLineEdit()
        # Simple validator to allow only characters in H-M symbols
        regex = QRegExp("[ABCPIFR][0-9a-d\-/:nmHR]+")
        validatorHM = QRegExpValidator(regex)
        space_group_line.setValidator(validatorHM)
        space_group_line.local_path = "indexing.known_symmetry.space_group"
        space_group_line.editingFinished.connect(self.line_changed)

        unit_cell_label = QLabel("Unit cell")
        unit_cell_line = QLineEdit()
        regex = QRegExp("[0-9\., ]+")
        validatorUC = QRegExpValidator(regex)
        unit_cell_line.setValidator(validatorUC)
        unit_cell_line.local_path = "indexing.known_symmetry.unit_cell"
        unit_cell_line.editingFinished.connect(self.line_changed)

        localLayout = QVBoxLayout()

        localLayout.addLayout(hbox_method)

        qf = QFormLayout()
        qf.addRow(max_cell_label, max_cell_spn_bx)
        qf.addRow(space_group_label, space_group_line)
        qf.addRow(unit_cell_label, unit_cell_line)
        localLayout.addLayout(qf)

        self.inner_reset_btn = ResetButton()
        localLayout.addWidget(self.inner_reset_btn)
        localLayout.addStretch()

        self.setLayout(localLayout)

        self.lst_var_widg = _get_all_direct_layout_widget_children(localLayout)
예제 #4
0
 def setupInputFrame(self, parent=None):
   if not parent:
     parent = self.layout
   self.bgMultiVolumeSelector = slicer.qMRMLNodeComboBox()
   self.bgMultiVolumeSelector.nodeTypes = ['vtkMRMLMultiVolumeNode']
   self.bgMultiVolumeSelector.setMRMLScene(slicer.mrmlScene)
   self.bgMultiVolumeSelector.addEnabled = 0
   self._bgMultiVolumeSelectorLabel = QLabel('Input multivolume')
   inputFrameWidget = QWidget()
   self.inputFrameLayout = QFormLayout()
   inputFrameWidget.setLayout(self.inputFrameLayout)
   self.inputFrameLayout.addRow(self._bgMultiVolumeSelectorLabel, self.bgMultiVolumeSelector)
   parent.addWidget(inputFrameWidget)
예제 #5
0
  def setupInputFrame(self, parent=None):
    self.inputFrame = ctk.ctkCollapsibleButton()
    self.inputFrame.text = "Input"
    self.inputFrame.collapsed = 0
    inputFrameCollapsibleLayout = QFormLayout(self.inputFrame)
    qSlicerMultiVolumeExplorerSimplifiedModuleWidget.setupInputFrame(self, parent=inputFrameCollapsibleLayout)
    self.layout.addWidget(self.inputFrame)

    self.fgMultiVolumeSelector = slicer.qMRMLNodeComboBox()
    self.fgMultiVolumeSelector.nodeTypes = ['vtkMRMLMultiVolumeNode']
    self.fgMultiVolumeSelector.setMRMLScene(slicer.mrmlScene)
    self.fgMultiVolumeSelector.addEnabled = 0
    self.fgMultiVolumeSelector.noneEnabled = 1
    self.fgMultiVolumeSelector.toolTip = "Secondary multivolume will be used for the secondary \
      plot in interactive charting. As an example, this can be used to overlay the \
      curve obtained by fitting a model to the data"
    self.inputFrameLayout.addRow(QLabel('Input secondary multivolume'), self.fgMultiVolumeSelector)
    def setup(self):
        showPlusServerWidget = True
        if _platform == "linux" or _platform == "linux2" or _platform == "darwin":  #linux or linux or OS X
            message = "Attention: You are running Slicer on Linux or OS X. Do you have PlusServer installed on the current OS?"
            result = QMessageBox.question(slicer.util.mainWindow(),
                                          'ProstateTRUSNav', message,
                                          QMessageBox.Yes | QMessageBox.No)
            showPlusServerWidget = result == QMessageBox.Yes

        if _platform == "win32" or showPlusServerWidget:
            # Windows...
            plusServerCollapsibleButton = ctkCollapsibleButton()
            plusServerCollapsibleButton.text = "PlusServer"
            self.layout.addWidget(plusServerCollapsibleButton)
            self.configurationFileChooserButton = QPushButton(
                self.configurationFile)
            self.configurationFileChooserButton.connect(
                'clicked()', self.onConfigFileSelected)
            self.runPlusServerButton = QPushButton("Run PlusServer")
            self.runPlusServerButton.setCheckable(True)
            self.runPlusServerButton.connect('clicked()',
                                             self.onRunPlusServerButtonClicked)

            self.serverFormLayout = QFormLayout(plusServerCollapsibleButton)

            self.serverExecutableChooserButton = QPushButton(
                self.serverExecutable)
            self.serverExecutableChooserButton.connect(
                'clicked()', self.onServerExecutableSelected)

            hbox = QHBoxLayout()
            hbox.addWidget(self.serverExecutableChooserButton)
            self.serverFormLayout.addRow(hbox)

            hbox = QHBoxLayout()
            hbox.addWidget(self.configurationFileChooserButton)
            hbox.addWidget(self.runPlusServerButton)
            self.serverFormLayout.addRow(hbox)

        GuideletWidget.setup(self)

        # do specific setup here
        if _platform == "win32" or showPlusServerWidget:
            self.launchGuideletButton.setEnabled(False)
            self.checkExecutableAndArgument()
    def setupPlotSettingsFrame(self):
        self.plotSettingsFrame = ctk.ctkCollapsibleButton()
        self.plotSettingsFrame.text = "Plotting Settings"
        self.plotSettingsFrame.collapsed = 1
        plotSettingsFrameLayout = QFormLayout(self.plotSettingsFrame)
        self.layout.addWidget(self.plotSettingsFrame)

        # label map for probing
        self.labelMapSelector = slicer.qMRMLNodeComboBox()
        self.labelMapSelector.nodeTypes = ['vtkMRMLLabelMapVolumeNode']
        self.labelMapSelector.toolTip = 'Label map to be probed'
        self.labelMapSelector.setMRMLScene(slicer.mrmlScene)
        self.labelMapSelector.addEnabled = 0
        self.chartButton = QPushButton('Chart')
        self.chartButton.setEnabled(False)

        hbox = QHBoxLayout()
        hbox.addWidget(QLabel('Probed label volume'))
        hbox.addWidget(self.labelMapSelector)
        hbox.addWidget(self.chartButton)
        plotSettingsFrameLayout.addRow(hbox)

        self.iCharting = QCheckBox('Interactive charting')
        self.iCharting.setChecked(True)
        plotSettingsFrameLayout.addRow(self.iCharting)

        self.iChartingMode = QButtonGroup()
        self.iChartingIntensity = QRadioButton('Signal intensity')
        self.iChartingIntensityFixedAxes = QRadioButton(
            'Fixed range intensity')
        self.iChartingPercent = QRadioButton('Percentage change')
        self.iChartingIntensity.setChecked(1)
        self.iChartingMode.addButton(self.iChartingIntensity)
        self.iChartingMode.addButton(self.iChartingIntensityFixedAxes)
        self.iChartingMode.addButton(self.iChartingPercent)

        hbox = QHBoxLayout()
        self.plottingModeGroupBox = QGroupBox('Plotting mode:')
        plottingModeLayout = QVBoxLayout()
        self.plottingModeGroupBox.setLayout(plottingModeLayout)
        plottingModeLayout.addWidget(self.iChartingIntensity)
        plottingModeLayout.addWidget(self.iChartingIntensityFixedAxes)
        plottingModeLayout.addWidget(self.iChartingPercent)
        hbox.addWidget(self.plottingModeGroupBox)

        self.showLegendCheckBox = QCheckBox('Display legend')
        self.showLegendCheckBox.setChecked(0)
        self.xLogScaleCheckBox = QCheckBox('Use log scale for X axis')
        self.xLogScaleCheckBox.setChecked(0)
        self.yLogScaleCheckBox = QCheckBox('Use log scale for Y axis')
        self.yLogScaleCheckBox.setChecked(0)

        self.plotGeneralSettingsGroupBox = QGroupBox('General Plot options:')
        plotGeneralSettingsLayout = QVBoxLayout()
        self.plotGeneralSettingsGroupBox.setLayout(plotGeneralSettingsLayout)
        plotGeneralSettingsLayout.addWidget(self.showLegendCheckBox)
        plotGeneralSettingsLayout.addWidget(self.xLogScaleCheckBox)
        plotGeneralSettingsLayout.addWidget(self.yLogScaleCheckBox)
        hbox.addWidget(self.plotGeneralSettingsGroupBox)
        plotSettingsFrameLayout.addRow(hbox)

        self.nFramesBaselineCalculation = QSpinBox()
        self.nFramesBaselineCalculation.minimum = 1
        hbox = QHBoxLayout()
        hbox.addWidget(QLabel('Frame count(baseline calculation):'))
        hbox.addWidget(self.nFramesBaselineCalculation)
        plotSettingsFrameLayout.addRow(hbox)
    def setupPanel(self, parentWidget):
        logging.debug('ProstateTRUSNavUltrasound.setupPanel')

        self.connectorNode = self.guideletParent.connectorNode
        self.connectorNodeConnected = False

        collapsibleButton = ctkCollapsibleButton()
        collapsibleButton.setProperty('collapsedHeight', 20)
        setButtonStyle(collapsibleButton, 2.0)
        collapsibleButton.text = "Ultrasound"
        parentWidget.addWidget(collapsibleButton)

        ultrasoundLayout = QFormLayout(collapsibleButton)
        ultrasoundLayout.setContentsMargins(12, 4, 4, 4)
        ultrasoundLayout.setSpacing(4)

        self.connectDisconnectButton = QPushButton("Connect")
        self.connectDisconnectButton.setToolTip(
            "If clicked, connection OpenIGTLink")

        hbox = QHBoxLayout()
        hbox.addWidget(self.connectDisconnectButton)
        ultrasoundLayout.addRow(hbox)

        self.setupIcons()

        self.captureIDSelector = QComboBox()
        self.captureIDSelector.setToolTip("Pick capture device ID")
        self.captureIDSelector.setSizePolicy(QSizePolicy.Expanding,
                                             QSizePolicy.Expanding)

        self.volumeReconstructorIDSelector = QComboBox()
        self.volumeReconstructorIDSelector.setToolTip(
            "Pick volume reconstructor device ID")
        self.volumeReconstructorIDSelector.setSizePolicy(
            QSizePolicy.Expanding, QSizePolicy.Expanding)

        self.startStopRecordingButton = QPushButton("  Start Recording")
        self.startStopRecordingButton.setCheckable(True)
        self.startStopRecordingButton.setIcon(self.recordIcon)
        self.startStopRecordingButton.setEnabled(False)
        self.startStopRecordingButton.setToolTip("If clicked, start recording")
        self.startStopRecordingButton.setSizePolicy(QSizePolicy.Expanding,
                                                    QSizePolicy.Expanding)

        recordParametersControlsLayout = QGridLayout()

        self.filenameLabel = self.createLabel("Filename:", visible=False)
        recordParametersControlsLayout.addWidget(self.filenameLabel, 1, 0)

        # Offline Reconstruction
        self.offlineReconstructButton = QPushButton("  Offline Reconstruction")
        self.offlineReconstructButton.setCheckable(True)
        self.offlineReconstructButton.setIcon(self.recordIcon)
        self.offlineReconstructButton.setEnabled(False)
        self.offlineReconstructButton.setToolTip(
            "If clicked, reconstruct recorded volume")
        self.offlineReconstructButton.setSizePolicy(QSizePolicy.Expanding,
                                                    QSizePolicy.Expanding)

        self.offlineVolumeToReconstructSelector = QComboBox()
        self.offlineVolumeToReconstructSelector.setEditable(True)
        self.offlineVolumeToReconstructSelector.setToolTip(
            "Pick/set volume to reconstruct")
        self.offlineVolumeToReconstructSelector.visible = False

        hbox = QHBoxLayout()
        hbox.addWidget(self.startStopRecordingButton)
        hbox.addWidget(self.offlineReconstructButton)
        ultrasoundLayout.addRow(hbox)

        # Scout scan (record and low resolution reconstruction) and live reconstruction
        # Scout scan part

        self.startStopScoutScanButton = QPushButton(
            "  Scout scan\n  Start recording")
        self.startStopScoutScanButton.setCheckable(True)
        self.startStopScoutScanButton.setIcon(self.recordIcon)
        self.startStopScoutScanButton.setToolTip("If clicked, start recording")
        self.startStopScoutScanButton.setEnabled(False)
        self.startStopScoutScanButton.setSizePolicy(QSizePolicy.Expanding,
                                                    QSizePolicy.Expanding)

        self.startStopLiveReconstructionButton = QPushButton(
            "  Start live reconstruction")
        self.startStopLiveReconstructionButton.setCheckable(True)
        self.startStopLiveReconstructionButton.setIcon(self.recordIcon)
        self.startStopLiveReconstructionButton.setToolTip(
            "If clicked, start live reconstruction")
        self.startStopLiveReconstructionButton.setEnabled(False)
        self.startStopLiveReconstructionButton.setSizePolicy(
            QSizePolicy.Expanding, QSizePolicy.Expanding)

        self.displayRoiButton = QToolButton()
        self.displayRoiButton.setCheckable(True)
        self.displayRoiButton.setIcon(self.visibleOffIcon)
        self.displayRoiButton.setToolTip("If clicked, display ROI")

        hbox = QHBoxLayout()
        hbox.addWidget(self.startStopScoutScanButton)
        hbox.addWidget(self.startStopLiveReconstructionButton)
        # hbox.addWidget(self.displayRoiButton)
        ultrasoundLayout.addRow(hbox)

        self.snapshotTimer = QTimer()
        self.snapshotTimer.setSingleShot(True)

        self.onParameterSetSelected()

        return collapsibleButton