def buildPostProcessorForm(self, theParams):
        """Build Post Processor Tab

        Args:
           * theParams - dictionary containing element of form
        Returns:
           not applicable
        """

        # create postprocessors tab
        myTab = QWidget()
        myFormLayout = QFormLayout(myTab)
        myFormLayout.setLabelAlignment(Qt.AlignLeft)
        self.tabWidget.addTab(myTab, self.tr('Postprocessors'))
        self.tabWidget.tabBar().setVisible(True)

        # create element for the tab
        myValues = {}
        for myLabel, myOptions in theParams.items():
            myInputValues = {}

            # NOTE (gigih) : 'params' is assumed as dictionary
            if 'params' in myOptions:
                myGroupBox = QGroupBox()
                myGroupBox.setCheckable(True)
                myGroupBox.setTitle(get_postprocessor_human_name(myLabel))

                # NOTE (gigih): is 'on' always exist??
                myGroupBox.setChecked(myOptions.get('on'))
                myInputValues['on'] = self.bind(myGroupBox, 'checked', bool)

                myLayout = QFormLayout(myGroupBox)
                myGroupBox.setLayout(myLayout)

                # create widget element from 'params'
                myInputValues['params'] = {}
                for myKey, myValue in myOptions['params'].items():
                    myHumanName = get_postprocessor_human_name(myKey)
                    myInputValues['params'][myKey] = self.buildWidget(
                        myLayout, myHumanName, myValue)

                myFormLayout.addRow(myGroupBox, None)

            elif 'on' in myOptions:
                myCheckBox = QCheckBox()
                myCheckBox.setText(get_postprocessor_human_name(myLabel))
                myCheckBox.setChecked(myOptions['on'])

                myInputValues['on'] = self.bind(myCheckBox, 'checked', bool)
                myFormLayout.addRow(myCheckBox, None)
            else:
                raise NotImplementedError('This case is not handled for now')

            myValues[myLabel] = myInputValues

        self.values['postprocessors'] = myValues
Beispiel #2
0
    def __init__(self, title, stream, parent, checked=False):
        super().__init__(title, 'video', stream, parent, checked)
        inner_layout = QFormLayout()
        inner_layout.addRow('Length:', QLabel(str(stream.length)))
        inner_layout.addRow('FPS:', QLabel(str(stream.fps)))
        inner_layout.addRow('Format:', QLabel(str(stream.format)))
        self.vcodec_combo = VideoCombo()
        inner_layout.addRow('Codec:', self.vcodec_combo)
        conf_layout = QHBoxLayout()
        self.bitrate_edit = BitrateLineEdit('1.5M')
        conf_layout.addWidget(self.bitrate_edit)
        btnconf = QPushButton('Configure')
        conf_layout.addWidget(btnconf)
        btnconf.clicked.connect(self.codec_dialog)
        inner_layout.addRow('Bitrate:', conf_layout)
        self.pass_spin = SpinBox(2)
        self.pass_spin.setRange(1, 2)
        inner_layout.addRow('Passes:', self.pass_spin)

        cslayout = QHBoxLayout()
        self.cropgroup = CodecGroup('Crop', 'crop', None, self, True)
        croplayout = QFormLayout()
        self.cropgroup.spnCropHoriz = SpinBox(0)
        croplayout.addRow('Horizontal:', self.cropgroup.spnCropHoriz)
        self.cropgroup.spnCropVertical = SpinBox(0)
        croplayout.addRow('Vertical:', self.cropgroup.spnCropVertical)
        self.cropgroup.spnCropWidth = SpinBox(stream.width)
        croplayout.addRow('Width:', self.cropgroup.spnCropWidth)
        self.cropgroup.spnCropHeight = SpinBox(stream.height)
        croplayout.addRow('Height:', self.cropgroup.spnCropHeight)
        if stream.length > timedelta():
            self.cropgroup.btnCropDetect = detbutton = QPushButton('Detect')
            detbutton.clicked.connect(self.on_cropdetect_clicked)
            croplayout.addRow(detbutton)

        self.cropgroup.setLayout(croplayout)
        cslayout.addWidget(self.cropgroup)

        self.scalegroup = CodecGroup('Scale', 'scale', None, self, True)
        scalelayout = QFormLayout()
        self.scalegroup.spnWidth = SpinBox(stream.width)
        scalelayout.addRow('Width:', self.scalegroup.spnWidth)
        self.scalegroup.spnHeight = SpinBox(stream.height)
        scalelayout.addRow('Height:', self.scalegroup.spnHeight)
        self.scalegroup.chkLAR = QCheckBox('Lock Aspect Ratio')
        self.scalegroup.chkLAR.stateChanged.connect(
            self.scalegroup.spnHeight.setDisabled)
        self.scalegroup.chkLAR.setChecked(True)
        scalelayout.addRow(self.scalegroup.chkLAR)

        self.scalegroup.setLayout(scalelayout)
        cslayout.addWidget(self.scalegroup)

        inner_layout.addRow(cslayout)
        self.setLayout(inner_layout)
    def build_post_processor_form(self, parameters):
        """Build Post Processor Tab.

        :param parameters: A Dictionary containing element of form
        :type parameters: dict
        """
        # create postprocessors tab
        tab = QWidget()
        form_layout = QFormLayout(tab)
        form_layout.setLabelAlignment(Qt.AlignLeft)
        self.tabWidget.addTab(tab, self.tr('Postprocessors'))
        self.tabWidget.tabBar().setVisible(True)

        # create element for the tab
        values = OrderedDict()
        for label, options in parameters.items():
            input_values = OrderedDict()

            # NOTE (gigih) : 'params' is assumed as dictionary
            if 'params' in options:
                group_box = QGroupBox()
                group_box.setCheckable(True)
                group_box.setTitle(get_postprocessor_human_name(label))

                # NOTE (gigih): is 'on' always exist??
                # (MB) should always be there
                group_box.setChecked(options.get('on'))
                input_values['on'] = self.bind(group_box, 'checked', bool)

                layout = QFormLayout(group_box)
                group_box.setLayout(layout)

                # create widget element from 'params'
                input_values['params'] = OrderedDict()
                for key, value in options['params'].items():
                    input_values['params'][key] = self.build_widget(
                        layout, key, value)

                form_layout.addRow(group_box, None)

            elif 'on' in options:
                checkbox = QCheckBox()
                checkbox.setText(get_postprocessor_human_name(label))
                checkbox.setChecked(options['on'])

                input_values['on'] = self.bind(checkbox, 'checked', bool)
                form_layout.addRow(checkbox, None)
            else:
                raise NotImplementedError('This case is not handled for now')

            values[label] = input_values

        self.values['postprocessors'] = values
    def __init__(self, parent=None):
        super(Form, self).__init__(parent)

        self.ql = QLabel("Enter Specification for Doctor:")
        self.le = QLineEdit()
        self.le.setObjectName("Specification")

        self.ql1 = QLabel("Enter city:")
        self.le1 = QLineEdit()
        self.le1.setObjectName("City")

        self.pb = QPushButton()
        self.pb.setObjectName("Create")
        self.pb.setText("CREATE")

        self.pb1 = QPushButton()
        self.pb1.setObjectName("Show")
        self.pb1.setText("SHOW")

        layout = QFormLayout()

        layout.addWidget(self.ql)
        layout.addWidget(self.le)

        layout.addWidget(self.ql1)
        layout.addWidget(self.le1)

        layout.addWidget(self.pb)
        layout.addWidget(self.pb1)

        self.setLayout(layout)
        self.connect(self.pb, SIGNAL("clicked()"), self.create_click)
        self.connect(self.pb1, SIGNAL("clicked()"), self.show_click)

        self.setWindowTitle("HOSPITAL MANAGEMENT SYSTEM")
    def __init__(self):
        SimulationConfigPanel.__init__(self, EnsembleSmoother( getQueueConfig( ) ))

        layout = QFormLayout()

        case_selector = CaseSelector()
        layout.addRow("Current case:", case_selector)

        run_path_label = QLabel("<b>%s</b>" % getRunPath())
        addHelpToWidget(run_path_label, "config/simulation/runpath")
        layout.addRow("Runpath:", run_path_label)

        number_of_realizations_label = QLabel("<b>%d</b>" % getRealizationCount())
        addHelpToWidget(number_of_realizations_label, "config/ensemble/num_realizations")
        layout.addRow(QLabel("Number of realizations:"), number_of_realizations_label)

        self._target_case_model = TargetCaseModel()
        self._target_case_field = StringBox(self._target_case_model, "config/simulation/target_case")
        self._target_case_field.setValidator(ProperNameArgument())
        layout.addRow("Target case:", self._target_case_field)

        self._analysis_module_selector = AnalysisModuleSelector(iterable=False, help_link="config/analysis/analysis_module")
        layout.addRow("Analysis Module:", self._analysis_module_selector)

        self._active_realizations_model = ActiveRealizationsModel()
        self._active_realizations_field = StringBox(self._active_realizations_model, "config/simulation/active_realizations")
        self._active_realizations_field.setValidator(RangeStringArgument(getRealizationCount()))
        layout.addRow("Active realizations", self._active_realizations_field)

        self._target_case_field.getValidationSupport().validationChanged.connect(self.simulationConfigurationChanged)
        self._active_realizations_field.getValidationSupport().validationChanged.connect(self.simulationConfigurationChanged)

        self.setLayout(layout)
Beispiel #6
0
 def __init__(self, config_filename=None):
     super(NewSessionPageInitial, self).__init__()
     self.setTitle(_('Directory and exam configuration'))
     self.setSubTitle(
         _('Select or create an empty directory in which you '
           'want to store the session '
           'and configure the exam from a file or manually.'))
     self.directory = widgets.OpenFileWidget(
         self,
         select_directory=True,
         title=_('Select or create an empty directory'),
         check_file_function=self._check_directory)
     self.config_file = widgets.OpenFileWidget(
         self,
         title=_('Select the exam configuration file'),
         name_filter=FileNameFilters.exam_config,
         check_file_function=self._check_exam_config_file)
     if config_filename is not None:
         self.config_file.set_text(config_filename)
     self.registerField('directory*', self.directory.filename_widget)
     if config_filename is None:
         self.registerField('config_file', self.config_file.filename_widget)
     self.combo = widgets.CustomComboBox(parent=self)
     self.combo.set_items([
         _('Configure the exam from an existing configuration file'),
         _('Configure the exam manually'),
     ])
     self.combo.setCurrentIndex(0)
     self.combo.currentIndexChanged.connect(self._update_combo)
     self.config_file_label = QLabel(_('Exam configuration file'))
     layout = QFormLayout(self)
     self.setLayout(layout)
     layout.addRow(_('Directory'), self.directory)
     layout.addRow(self.combo)
     layout.addRow(self.config_file_label, self.config_file)
Beispiel #7
0
 def __init__(self):
     super(NewSessionPageExamParams, self).__init__()
     self.setTitle(_('Configuration of exam params'))
     self.setSubTitle(_('Enter the configuration parameters of the exam'))
     layout = QFormLayout(self)
     self.setLayout(layout)
     self.paramNEIDs = widgets.InputInteger(initial_value=8)
     self.registerField("paramNEIDs", self.paramNEIDs)
     self.paramNAlts = widgets.InputInteger(initial_value=3)
     self.registerField("paramNAlts", self.paramNAlts)
     self.paramNCols = widgets.InputCustomPattern(
         fixed_size=250,
         regex=r'[1-9][0-9]?(\,[1-9][0-9]?)+',
         placeholder=_('num,num,...'))
     self.registerField("paramNCols", self.paramNCols)
     self.paramNPerm = widgets.InputInteger(min_value=1, initial_value=2)
     self.registerField("paramNPerm", self.paramNPerm)
     ## self.paramTPerm = widgets.CustomComboBox(parent=self)
     ## self.paramTPerm.set_items([
     ##     _('No (recommended)'),
     ##     _('Yes (experimental)'),
     ## ])
     ## self.paramTPerm.setCurrentIndex(0)
     ## self.registerField("paramTPerm", self.paramTPerm)
     layout.addRow(_('Number of digits of the student ID'), self.paramNEIDs)
     layout.addRow(_('Number of choices per question'), self.paramNAlts)
     layout.addRow(_('Number of questions per answer box'), self.paramNCols)
     layout.addRow(_('Number of models of the exam'), self.paramNPerm)
Beispiel #8
0
    def __init__(self, parent, old_ids):

        QDialog.__init__(self, parent)

        self.old_ids = old_ids

        main_lay = QVBoxLayout(self)

        self.fra_id = QFrame(self)
        fra_id_lay = QFormLayout(self.fra_id)
        self.lbl_id = QLabel('New ID:')
        self.txt_id = QLineEdit('')
        fra_id_lay.addRow(self.lbl_id, self.txt_id)

        self.lbl_desc = QLabel('Description:')
        self.txt_desc = QLineEdit('')
        fra_id_lay.addRow(self.lbl_desc, self.txt_desc)

        self.fra_buttons = QFrame()
        fra_buttons_lay = QHBoxLayout(self.fra_buttons)

        self.btn_ok = QPushButton('OK')
        self.btn_ok.clicked.connect(self.btn_ok_clicked)
        self.btn_cancel = QPushButton('Cancel')
        self.btn_cancel.clicked.connect(self.btn_cancel_clicked)
        fra_buttons_lay.addWidget(self.btn_ok)
        fra_buttons_lay.addWidget(self.btn_cancel)

        main_lay.addWidget(self.fra_id)
        main_lay.addWidget(self.fra_buttons)

        self.new_id = None
        self.description = None
Beispiel #9
0
    def __init__(self, recipe=None, parent=None):
        super(RecipeEditionDialog, self).__init__(parent)

        self.setWindowTitle('Recipe edition')

        self.name = QLineEdit()
        self.description = QPlainTextEdit()
        self.tags = QLineEdit()
        buttons = QDialogButtonBox(QDialogButtonBox.Ok
                                   | QDialogButtonBox.Cancel)
        buttons.accepted.connect(self.accept)
        buttons.rejected.connect(self.reject)

        l = QFormLayout(self)
        l.addRow('Name', self.name)
        l.addRow('Description', self.description)
        l.addRow('Tags', self.tags)
        l.addWidget(buttons)

        if recipe:
            self.recipe = recipe
            self.name.setText(recipe.name)
            self.description.setPlainText(recipe.description)
            self.tags.setText(';'.join(t.name for t in recipe.tags))
        else:
            self.recipe = Recipe('')

        self.accepted.connect(self.save_recipe)
Beispiel #10
0
    def createPlotRangePanel(self):
        frame = QFrame()
        #frame.setMaximumHeight(150)
        #frame.setFrameShape(QFrame.StyledPanel)
        #frame.setFrameShadow(QFrame.Plain)

        layout = QFormLayout()

        self.x_min = DisableableSpinner(self.plotView.setMinXLimit)
        self.x_max = DisableableSpinner(self.plotView.setMaxXLimit)

        layout.addRow("X min:", self.x_min)
        layout.addRow("X max:", self.x_max)

        self.y_min = DisableableSpinner(self.plotView.setMinYLimit)
        self.y_max = DisableableSpinner(self.plotView.setMaxYLimit)

        layout.addRow("Y min:", self.y_min)
        layout.addRow("Y max:", self.y_max)


        layout.addWidget(ert_gui.widgets.util.createSeparator())

        self.plot_compare_to_case = QtGui.QComboBox()
        self.plot_compare_to_case.setToolTip("Select case to compare members against.")


        self.connect(self.plot_compare_to_case, SIGNAL("currentIndexChanged(QString)"), self.select_case)
        layout.addRow("Case:", self.plot_compare_to_case)

        frame.setLayout(layout)
        return frame
Beispiel #11
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        layout = QFormLayout()
        self.setLayout(layout)

        self.desktopLabel = QLabel("Record Desktop")
        self.desktopButton = QRadioButton()
        layout.addRow(self.desktopLabel, self.desktopButton)

        # Record Area of Desktop
        areaGroup = QHBoxLayout()
        self.areaLabel = QLabel("Record Region")
        self.areaButton = QRadioButton()
        self.setAreaButton = QPushButton("Select Region")
        areaGroup.addWidget(self.areaButton)
        areaGroup.addWidget(self.setAreaButton)
        layout.addRow(self.areaLabel, areaGroup)

        self.regionLabel = QLabel("")
        self.regionLabel.setStyleSheet(
            "QLabel { background-color: #ADADAD; border: 1px solid gray }")
        layout.addRow(QLabel(""), self.regionLabel)

        # Select screen to record
        self.screenLabel = QLabel("Screen")
        self.screenSpinBox = QSpinBox()
        layout.addRow(self.screenLabel, self.screenSpinBox)
Beispiel #12
0
    def createArgument(self, arg):
        warg = QWidget()
        vlayout = QVBoxLayout()
        vlayout.setSpacing(5)
        vlayout.setMargin(0)
        winfo = QWidget()
        infolayout = QFormLayout()
        infolayout.setMargin(0)
        requirement = arg.requirementType()
        # Generate argument's widget
        warguments = self.getWidgetFromType(arg)

        if arg.requirementType() in (Argument.Optional, Argument.Empty):
            checkBox = checkBoxWidget(self, winfo, warguments,
                                      self.labActivate.text())
            vlayout.addWidget(checkBox, 0)

        tedit = QTextEdit(str(arg.description()))
        tedit.setReadOnly(True)
        infolayout.addRow(tedit)
        winfo.setLayout(infolayout)
        vlayout.addWidget(winfo, 1)
        if warguments:
            vlayout.addWidget(warguments, 2)
            self.valueArgs[arg.name()] = warguments
        else:
            self.valueArgs[arg.name()] = winfo
        warg.setLayout(vlayout)
        self.stackedargs.addWidget(warg)
        argitem = QListWidgetItem(str(arg.name()), self.listargs)
Beispiel #13
0
    def __init__(self, title="Title", description="Description", parent=None):
        QDialog.__init__(self, parent)

        self.__option_list = []
        """ :type: list of HelpedWidget """

        self.setModal(True)
        self.setWindowTitle(title)
        # self.setMinimumWidth(250)
        # self.setMinimumHeight(150)

        self.layout = QFormLayout()
        self.layout.setFieldGrowthPolicy(QFormLayout.ExpandingFieldsGrow)
        self.layout.setSizeConstraint(QLayout.SetFixedSize)

        label = QLabel(description)
        label.setAlignment(Qt.AlignHCenter)

        self.layout.addRow(self.createSpace(5))
        self.layout.addRow(label)
        self.layout.addRow(self.createSpace(10))

        self.ok_button = None

        self.setLayout(self.layout)
    def __init__(self, parent=None):
        super(GithubCredentialsWizardPage,
              self).__init__(parent,
                             title="Credentials",
                             subTitle="Enter your username/password or token")

        # Radio Buttons

        self.userPassRadioButton = QRadioButton()
        self.userPassRadioButton.toggled.connect(self.changeMode)
        self.userPassRadioButton.toggled.connect(self.completeChanged.emit)

        self.tokenRadioButton = QRadioButton()
        self.tokenRadioButton.toggled.connect(self.changeMode)
        self.tokenRadioButton.toggled.connect(self.completeChanged.emit)

        #  LineEdits

        # usernameEdit
        self.usernameEdit = QLineEdit(textChanged=self.completeChanged.emit)
        # Username may only contain alphanumeric characters or dash
        # and cannot begin with a dash
        self.usernameEdit.setValidator(
            QRegExpValidator(QRegExp('[A-Za-z\d]+[A-Za-z\d-]+')))

        # passwordEdit
        self.passwordEdit = QLineEdit(textChanged=self.completeChanged.emit)
        self.passwordEdit.setValidator(QRegExpValidator(QRegExp('.+')))
        self.passwordEdit.setEchoMode(QLineEdit.Password)

        # tokenEdit
        self.tokenEdit = QLineEdit(textChanged=self.completeChanged.emit)
        # token may only contain alphanumeric characters
        self.tokenEdit.setValidator(QRegExpValidator(QRegExp('[A-Za-z\d]+')))
        self.tokenEdit.setEchoMode(QLineEdit.Password)

        # Form

        form = QFormLayout()
        form.addRow("<b>username/password</b>", self.userPassRadioButton)
        form.addRow("username: "******"password: "******"<b>token</b>", self.tokenRadioButton)
        form.addRow("token: ", self.tokenEdit)

        # Layout

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

        # Fields

        self.registerField("username", self.usernameEdit)
        self.registerField("password", self.passwordEdit)
        self.registerField("token", self.tokenEdit)

        self.userPassRadioButton.toggle()

        self.require_2fa = False
Beispiel #15
0
    def office_group_box(self):
        self.organGroupBoxBtt = QGroupBox(
            self.tr("Configuration des localités"))

        self.office_box = QComboBox()
        self.office_box.currentIndexChanged.connect(self.change_select_office)

        self.office_list = get_offices()
        self.region_box = QComboBox()
        self.region_label = FLabel()
        self.cercle_label = FLabel()
        self.phone_field = IntLineEdit()
        self.phone_field.setInputMask('## ## ## ##')
        self.bp = LineEdit()
        self.adress_org = QTextEdit()
        self.email_org = LineEdit()

        for index, value in enumerate(self.office_list):
            self.office_box.addItem("{}".format(office_name(value)), value)

        formbox = QFormLayout()
        formbox.addRow(FormLabel(u"Nom service :"), self.office_box)
        formbox.addRow(FormLabel(u"Région"), self.region_label)
        formbox.addRow(FormLabel(u"Cercle"), self.cercle_label)
        formbox.addRow(FormLabel(u"Tel :"), self.phone_field)
        formbox.addRow(FormLabel(u"B.P :"), self.bp)
        formbox.addRow(FormLabel(u"E-mail :"), self.email_org)
        formbox.addRow(FormLabel(u"Adresse complete :"), self.adress_org)
        butt = Button_save(u"Enregistrer")
        butt.clicked.connect(self.save_edit)
        formbox.addRow("", butt)

        self.organGroupBoxBtt.setLayout(formbox)
Beispiel #16
0
    def setupUi(self):
        f = QFormLayout(self)
        self.username = QLineEdit(self)
        self.password = QLineEdit(self)
        self.password.setEchoMode(QLineEdit.Password)
        self.host = QLineEdit(self)
        self.dirName = QLineEdit(self)
        self.checkDir = QPushButton("set directory to upload", self)
        self.mail = QLineEdit()
        self.mail.setToolTip(
            "if you enter your email now, metms will be able to get the result on the cluster, if empty you will have to do by yourself"
        )
        self.queue = QComboBox(self)
        self.queue.setToolTip(
            "Each queues correspond to a series of nodes of the same power workq<longq<bigmemq"
        )
        self.queue.addItems(self.queueItems)
        self.interactiveSession = QCheckBox("start an interactive session")
        f.addRow("username:"******"password:"******"hostname:", self.host)
        f.addRow("email:", self.mail)
        f.addRow(self.checkDir, self.dirName)
        f.addRow("select a queue:", self.queue)
        f.addRow("", self.interactiveSession)

        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setStandardButtons(QDialogButtonBox.Ok
                                          | QDialogButtonBox.Cancel)
        f.addRow("", self.buttonBox)
Beispiel #17
0
    def __init__(self, ideaType=None, parent=None):
        super().__init__("Bonuses", parent=parent)

        self.ideaType = ideaType

        layout = QFormLayout()

        self.bonuses = []

        if ideaType == "traditions":
            self.nBonuses = 2
        elif ideaType == "ambitions":
            self.nBonuses = 1
        else:
            self.nBonuses = 3

        for i in range(self.nBonuses):
            allowNone = (ideaType is None) and i > 0
            if allowNone:
                initialIndex = 0
            else:
                initialIndex = i + 1
            ideaBonus = IdeaBonus(initialIndex=initialIndex,
                                  allowNone=allowNone)
            ideaBonus.costChanged.connect(self.handleCostChanged)
            self.bonuses.append(ideaBonus)
            layout.addRow(QLabel("Bonus %d:" % (i + 1, )), self.bonuses[i])

        self.setLayout(layout)

        self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)

        self.setToolTip(
            "Total cost for each idea should not be negative or too large. Taking duplicates of some bonuses will result in penalty cards."
        )
Beispiel #18
0
 def __init__(self, title, stream, parent, checked=False):
     super().__init__(title, 'subtitle', stream, parent, checked)
     inner_layout = QFormLayout()
     inner_layout.addRow('Language:', QLabel(stream.language))
     self.scodec_combo = SubtitleCombo()
     inner_layout.addRow('Codec:', self.scodec_combo)
     self.setLayout(inner_layout)
    def __init__(self, edge, line_name, proc_ev):
        super(Dialog_edge, self).__init__()

        # Entry window name
        self.setWindowTitle("Line {}-{}".format(line_name[0], line_name[1]))

        # Entry forms
        self.entry_susceptance = QLineEdit()
        self.entry_susceptance.setText(str(edge["susceptance"]))
        self.entry_susceptance.setValidator(QDoubleValidator(0.01, 10, 2))

        self.entry_status = QCheckBox()
        self.entry_status.setChecked(edge["status"])

        self.layout = QFormLayout()
        self.layout.addRow("Susceptance", self.entry_susceptance)
        self.layout.addRow("Connected", self.entry_status)

        # Entry window set button
        self.button = QPushButton()
        self.button.setText("Set")
        self.button.clicked.connect(partial(self.button_click, edge))
        self.layout.addWidget(self.button)

        # Set entry window layout
        self.setLayout(self.layout)

        self.proc_ev = proc_ev
        self.show()
Beispiel #20
0
    def process_node(self, node, widget):
        # Set the value widget
        value = None
        if node.flags & node.SECTION:
            value = QWidget()
            value.setLayout(QFormLayout())
            for sub in node.value.itervalues():
                self.process_node(sub, value)
        elif isinstance(node.value, list):
            value = QLabel('<br />'.join(unicode(s) for s in node.value))
            value.setWordWrap(True)
        elif isinstance(node.value, tuple):
            value = QLabel(', '.join(unicode(s) for s in node.value))
            value.setWordWrap(True)
        elif isinstance(node.value, (basestring,int,long,float)):
            value = QLabel(unicode(node.value))
        else:
            logging.warning('Not supported value: %r' % node.value)
            return

        if isinstance(value, QLabel):
            value.setTextInteractionFlags(Qt.TextSelectableByMouse|Qt.TextSelectableByKeyboard|Qt.LinksAccessibleByMouse)

        # Insert the value widget into the parent widget, depending
        # of its type.
        if isinstance(widget, QTabWidget):
            widget.addTab(value, node.label)
        elif isinstance(widget.layout(), QFormLayout):
            label = QLabel(u'<b>%s:</b> ' % node.label)
            widget.layout().addRow(label, value)
        elif isinstance(widget.layout(), QVBoxLayout):
            widget.layout().addWidget(QLabel(u'<h3>%s</h3>' % node.label))
            widget.layout().addWidget(value)
        else:
            logging.warning('Not supported widget: %r' % widget)
    def __init__(self):
        SimulationConfigPanel.__init__(self, EnsembleExperiment())

        layout = QFormLayout()

        case_model = CaseSelectorModel()
        case_selector = ComboChoice(case_model, "Current case", "init/current_case_selection")
        layout.addRow(case_selector.getLabel(), case_selector)

        runpath_model = RunPathModel()
        runpath_label = ActiveLabel(runpath_model, "Runpath", "config/simulation/runpath")
        layout.addRow(runpath_label.getLabel(), runpath_label)


        number_of_realizations_model = EnsembleSizeModel()
        number_of_realizations_label = ActiveLabel(number_of_realizations_model, "Number of realizations", "config/ensemble/num_realizations")
        layout.addRow(number_of_realizations_label.getLabel(), number_of_realizations_label)

        active_realizations_model = ActiveRealizationsModel()
        self.active_realizations_field = StringBox(active_realizations_model, "Active realizations", "config/simulation/active_realizations")
        self.active_realizations_field.setValidator(RangeStringArgument(number_of_realizations_model.getValue()))
        layout.addRow(self.active_realizations_field.getLabel(), self.active_realizations_field)

        self.active_realizations_field.validationChanged.connect(self.simulationConfigurationChanged)


        self.setLayout(layout)
Beispiel #22
0
    def addToLayout(self, layout):
        filler = QLabel(self)
        label = QLabel(self)
        label.setText("Changes take affect only after restart.")
        layout.addWidget(label)

        formLayout = QFormLayout()
        formLayout.setAlignment(Qt.AlignTop)
        layout.addLayout(formLayout)

        self.nmeaButton = QRadioButton("nmea", self)
        formLayout.addRow(self.nmeaButton, filler)
        self.nmeaButton.setChecked(self.useNmea)

        label = QLabel(self)
        label.setText("GPS Device:")

        self.deviceText = QLineEdit(self)
        formLayout.addRow(label, self.deviceText)
        self.deviceText.setToolTip('NMEA GPS device path.')
        if self.device != None:
            self.deviceText.setText(self.device)

        self.gpsdButton = QRadioButton("gpsd", self)
        formLayout.addRow(self.gpsdButton, filler)
        self.gpsdButton.setChecked(self.useGpsd)
Beispiel #23
0
def buildfromauto(formconfig, base):
    widgetsconfig = formconfig['widgets']

    outlayout = QFormLayout()
    outlayout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow)
    outwidget = base
    outwidget.setLayout(outlayout)
    for config in widgetsconfig:
        widgettype = config['widget']
        field = config['field']
        name = config.get('name', field)
        if not field:
            utils.warning("Field can't be null for {}".format(name))
            utils.warning("Skipping widget")
            continue
        label = QLabel(name)
        label.setObjectName(field + "_label")
        widget = roam.editorwidgets.core.createwidget(widgettype, parent=base)
        widget.setObjectName(field)
        layoutwidget = QWidget()
        layoutwidget.setLayout(QBoxLayout(QBoxLayout.LeftToRight))
        layoutwidget.layout().addWidget(widget)
        if config.get('rememberlastvalue', False):
            savebutton = QToolButton()
            savebutton.setObjectName('{}_save'.format(field))
            layoutwidget.layout().addWidget(savebutton)

        outlayout.addRow(label, layoutwidget)

    outlayout.addItem(QSpacerItem(10, 10))
    installflickcharm(outwidget)
    return outwidget
Beispiel #24
0
    def __init__(self, fro, to, parent=None):
        super(PlanningWidget, self).__init__(parent)
        self.fro = fro
        self.to = to

        # Create widget
        widget = QWidget()
        self.boxLayout = QHBoxLayout()
        self.columns = []
        self.widgets = {}
        for index in xrange(MAX_INDEX):
            formLayout = QFormLayout()
            self.columns.append(formLayout)
            self.boxLayout.addLayout(formLayout)
            for date in daterange(fro, to):
                self._add_widget_for_date(date, index)

        widget.setLayout(self.boxLayout)
        self.setWidgetResizable(True)
        self.setWidget(widget)

        # Populate widgets
        for meal in self._meals_in_range():
            self.widgets[(meal.date, meal.index)]\
                .refreshWithRecipes(meal.recipes)
Beispiel #25
0
 def _initialize(self):
     ## self.paramTPerm = self.field("paramTPerm")
     self.tabs.clear()
     self.total_answers = 0
     self.radioGroups = {}
     filas = int(self.paramNPerm.toString())
     for x in range(filas):
         mygroupbox = QScrollArea()
         mygroupbox.setWidget(QWidget())
         mygroupbox.setWidgetResizable(True)
         myform = QHBoxLayout(mygroupbox.widget())
         cols = self.paramNCols.toString().split(',')
         ansID = 0
         radioGroupList = {}
         for col in cols:
             mygroupboxCol = QGroupBox()
             myformCol = QFormLayout()
             mygroupboxCol.setLayout(myformCol)
             for y in range(int(col)):
                 ansID += 1
                 radioGroupList[ansID] = QButtonGroup()
                 layoutRow = QHBoxLayout()
                 for j in range(int(self.paramNAlts.toString())):
                     myradio = QRadioButton(chr(97 + j).upper())
                     layoutRow.addWidget(myradio)
                     radioGroupList[ansID].addButton(myradio)
                 self.total_answers += 1
                 myformCol.addRow(str(ansID), layoutRow)
             myform.addWidget(mygroupboxCol)
         self.radioGroups[chr(97 + x).upper()] = radioGroupList
         self.tabs.addTab(mygroupbox, _('Model ') + chr(97 + x).upper())
    def __init__(self, parent=None):
        super(Form, self).__init__(parent)

        did_file = open("loggedin.txt")
        did = did_file.readline()
        print(did)
        if did[-1] == '\n':
            did = did[:-1]
        now = datetime.datetime.now()
        command = "SELECT * FROM Appointment WHERE doc_ID=\"" + did + "\";"
        print(command)
        cur.execute(command)
        res = cur.fetchall()
        rep = 'Patient ID          Doctor ID          Hospital ID      Appointment DateTime        Token Number\n'
        for row in res:
            print(row)
            rep = rep + str(row[0]).upper() + "      "
            rep = rep + str(row[1]).upper() + "      "
            rep = rep + str(row[2]).upper() + "             "
            rep = rep + str(row[3]).upper() + "               "
            rep = rep + str(row[4]).upper()
            rep += "\n"
        self.ql = QLabel(rep)
        layout = QFormLayout()

        layout.addWidget(self.ql)
        self.setLayout(layout)
        self.setWindowTitle("HOSPITAL MANAGEMENT SYSTEM")
Beispiel #27
0
 def make_layout():
     if newstyle:
         return QVBoxLayout()
     else:
         layout = QFormLayout()
         layout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow)
         return layout
    def __init__(self):
        SimulationConfigPanel.__init__(self, EnsembleExperiment)

        layout = QFormLayout()

        case_selector = CaseSelector()
        layout.addRow("Current case:", case_selector)

        run_path_label = QLabel("<b>%s</b>" % getRunPath())
        addHelpToWidget(run_path_label, "config/simulation/runpath")
        layout.addRow("Runpath:", run_path_label)

        number_of_realizations_label = QLabel("<b>%d</b>" %
                                              getRealizationCount())
        addHelpToWidget(number_of_realizations_label,
                        "config/ensemble/num_realizations")
        layout.addRow(QLabel("Number of realizations:"),
                      number_of_realizations_label)

        self._active_realizations_model = ActiveRealizationsModel()
        self._active_realizations_field = StringBox(
            self._active_realizations_model,
            "config/simulation/active_realizations")
        self._active_realizations_field.setValidator(
            RangeStringArgument(getRealizationCount()))
        layout.addRow("Active realizations", self._active_realizations_field)

        self._active_realizations_field.getValidationSupport(
        ).validationChanged.connect(self.simulationConfigurationChanged)

        self.setLayout(layout)
Beispiel #29
0
    def __init__(self, parent):
        super(ManualInstallWidget, self).__init__()
        self._parent = parent
        vbox = QVBoxLayout(self)
        form = QFormLayout()
        self._txtName = QLineEdit()
        self._txtVersion = QLineEdit()
        form.addRow(self.tr("Plugin Name:"), self._txtName)
        form.addRow(self.tr("Plugin Version:"), self._txtVersion)
        vbox.addLayout(form)
        hPath = QHBoxLayout()
        self._txtFilePath = QLineEdit()
        self._btnFilePath = QPushButton(QIcon(":img/open"), '')
        hPath.addWidget(QLabel(self.tr("Plugin File:")))
        hPath.addWidget(self._txtFilePath)
        hPath.addWidget(self._btnFilePath)
        vbox.addLayout(hPath)
        vbox.addSpacerItem(
            QSpacerItem(0, 1, QSizePolicy.Expanding, QSizePolicy.Expanding))

        hbox = QHBoxLayout()
        hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding))
        self._btnInstall = QPushButton(self.tr("Install"))
        hbox.addWidget(self._btnInstall)
        vbox.addLayout(hbox)

        #Signals
        self.connect(self._btnFilePath, SIGNAL("clicked()"),
                     self._load_plugin_path)
        self.connect(self._btnInstall, SIGNAL("clicked()"),
                     self.install_plugin)
Beispiel #30
0
 def setupUi(self):
     """create all Ui elements but do not fill them"""
     buttonBox = KDialogButtonBox(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.
     buttonBox.button(QDialogButtonBox.Ok).setFocus(True)
     buttonBox.accepted.connect(self.accept)
     buttonBox.rejected.connect(self.reject)
     vbox = QVBoxLayout(self)
     self.grid = QFormLayout()
     self.cbServer = QComboBox()
     self.cbServer.setEditable(True)
     self.grid.addRow(m18n('Game server:'), self.cbServer)
     self.cbUser = QComboBox()
     self.cbUser.setEditable(True)
     self.grid.addRow(m18n('Username:'******'Password:'******'kajongg', 'Ruleset:'), self.cbRuleset)
     vbox.addLayout(self.grid)
     vbox.addWidget(buttonBox)
     pol = QSizePolicy()
     pol.setHorizontalPolicy(QSizePolicy.Expanding)
     self.cbUser.setSizePolicy(pol)