示例#1
0
    def run(self):
        self.frame = frame = JFrame('Frame4',
                                    size=(200, 200),
                                    layout=None,
                                    locationRelativeTo=None,
                                    defaultCloseOperation=JFrame.EXIT_ON_CLOSE)
        frame.addComponentListener(listener(self))
        self.width = JFormattedTextField(NumberFormat.getIntegerInstance(),
                                         columns=4)
        self.height = JFormattedTextField(NumberFormat.getIntegerInstance(),
                                          columns=4)
        self.x = JFormattedTextField(NumberFormat.getIntegerInstance(),
                                     columns=4)
        self.y = JFormattedTextField(NumberFormat.getIntegerInstance(),
                                     columns=4)
        items = [[JLabel('Width:'), 11, 7], [self.width, 50, 5],
                 [JLabel('Height:'), 7, 31], [self.height, 50, 30],
                 [JLabel('X:'), 35, 55], [self.x, 50, 53],
                 [JLabel('Y:'), 35, 79], [self.y, 50, 78]]
        for item in items:
            thing = frame.add(item[0])
            size = thing.getPreferredSize()
            thing.setBounds(item[1], item[2], size.width, size.height)

        frame.setVisible(1)
示例#2
0
    def __init__(self, menuHandles, manager, isDominant, systemPanel, isTemporal=False):
        self.systemPanel = systemPanel
        self.knownPops = 0
        self.ignoreChanges = True
        JPanel()
        self.menuHandles = menuHandles
        self.isDominant = isDominant
        self.isTemporal = isTemporal
        if isDominant:
            self.setLayout(GridLayout(8, 2))
        else:
            self.setLayout(GridLayout(5, 2))
        if isTemporal:
            self.add(JLabel("Ne"))
            ne = JFormattedTextField(NumberFormat.getNumberInstance(Locale.US))
            ne.addPropertyChangeListener(self)
            self.ne = ne
            self.add(ne)
        else:
            self.add(JLabel("Attempted Fst"))
            fst = JFormattedTextField(NumberFormat.getNumberInstance(Locale.US))
            fst.addPropertyChangeListener(self)
            self.fst = fst
            self.add(fst)
        self.add(JLabel("Expected total pops"))
        pops = JFormattedTextField(NumberFormat.getIntegerInstance(Locale.US))
        pops.addPropertyChangeListener(self)
        # self.pops = JComboBox(['1', '2', '4', '8', '12', '16'])
        self.pops = pops
        self.add(self.pops)
        if not isDominant and not isTemporal:
            self.add(JLabel("Mutation model"))
            self.mut = JComboBox(["Infinite Alleles", "Stepwise"])
            self.mut.addItemListener(self)
            self.add(self.mut)
        self.add(JLabel("Subsample size"))
        sampleSize = JFormattedTextField(NumberFormat.getIntegerInstance(Locale.US))
        sampleSize.addPropertyChangeListener(self)
        self.sampleSize = sampleSize
        self.add(self.sampleSize)
        if isDominant:
            self.add(JLabel("Theta"))
            theta = JFormattedTextField(NumberFormat.getNumberInstance(Locale.US))
            theta.addPropertyChangeListener(self)
            self.theta = theta
            self.add(theta)
            theta.setValue(0.1)

            self.add(JLabel("Beta-a"))
            beta1 = JFormattedTextField(NumberFormat.getNumberInstance(Locale.US))
            beta1.addPropertyChangeListener(self)
            self.beta1 = beta1
            self.add(beta1)
            beta1.setValue(0.25)

            self.add(JLabel("Beta-b"))
            beta2 = JFormattedTextField(NumberFormat.getNumberInstance(Locale.US))
            beta2.addPropertyChangeListener(self)
            self.beta2 = beta2
            self.add(beta2)
            beta2.setValue(0.25)

            self.add(JLabel("Critical frequency"))
            crit = JFormattedTextField(NumberFormat.getNumberInstance(Locale.US))
            crit.addPropertyChangeListener(self)
            self.crit = crit
            self.add(crit)
            crit.setValue(0.99)

        run = JButton("Run!")
        run.addActionListener(manager)
        run.setActionCommand("RunFDist")
        self.run = run
        self.add(run)
        cancel = JButton("Stop")
        cancel.addActionListener(manager)
        cancel.setActionCommand("CancelFDist")
        self.cancel = cancel
示例#3
0
    def __init__(self,
                 menuHandles,
                 manager,
                 isDominant,
                 systemPanel,
                 isTemporal=False):
        self.systemPanel = systemPanel
        self.knownPops = 0
        self.ignoreChanges = True
        JPanel()
        self.menuHandles = menuHandles
        self.isDominant = isDominant
        self.isTemporal = isTemporal
        if isDominant:
            self.setLayout(GridLayout(8, 2))
        else:
            self.setLayout(GridLayout(5, 2))
        if isTemporal:
            self.add(JLabel('Ne'))
            ne = JFormattedTextField(NumberFormat.getNumberInstance(Locale.US))
            ne.addPropertyChangeListener(self)
            self.ne = ne
            self.add(ne)
            self.add(JLabel('Expected total samples'))
        else:
            self.add(JLabel('Attempted Fst'))
            fst = JFormattedTextField(NumberFormat.getNumberInstance(
                Locale.US))
            fst.addPropertyChangeListener(self)
            self.fst = fst
            self.add(fst)
            self.add(JLabel('Expected total pops'))
        pops = JFormattedTextField(NumberFormat.getIntegerInstance(Locale.US))
        pops.addPropertyChangeListener(self)
        # self.pops = JComboBox(['1', '2', '4', '8', '12', '16'])
        self.pops = pops
        self.add(self.pops)
        if not isDominant and not isTemporal:
            self.add(JLabel('Mutation model'))
            self.mut = JComboBox(['Infinite Alleles', 'Stepwise'])
            self.mut.addItemListener(self)
            self.add(self.mut)
        else:
            self.mut = None
        self.add(JLabel('Subsample size'))
        sampleSize = JFormattedTextField(
            NumberFormat.getIntegerInstance(Locale.US))
        sampleSize.addPropertyChangeListener(self)
        self.sampleSize = sampleSize
        self.add(self.sampleSize)
        if isDominant:
            self.add(JLabel('Theta'))
            theta = JFormattedTextField(
                NumberFormat.getNumberInstance(Locale.US))
            theta.addPropertyChangeListener(self)
            self.theta = theta
            self.add(theta)
            theta.setValue(0.1)

            self.add(JLabel('Beta-a'))
            beta1 = JFormattedTextField(
                NumberFormat.getNumberInstance(Locale.US))
            beta1.addPropertyChangeListener(self)
            self.beta1 = beta1
            self.add(beta1)
            beta1.setValue(0.25)

            self.add(JLabel('Beta-b'))
            beta2 = JFormattedTextField(
                NumberFormat.getNumberInstance(Locale.US))
            beta2.addPropertyChangeListener(self)
            self.beta2 = beta2
            self.add(beta2)
            beta2.setValue(0.25)

            self.add(JLabel('Critical frequency'))
            crit = JFormattedTextField(
                NumberFormat.getNumberInstance(Locale.US))
            crit.addPropertyChangeListener(self)
            self.crit = crit
            self.add(crit)
            crit.setValue(0.99)

        run = JButton('Run!')
        run.addActionListener(manager)
        run.setActionCommand('RunFDist')
        self.run = run
        self.add(run)