示例#1
0
class boardMonitor(JPanel):
    def __init__(self, crate, slot, parentCrate):
        JPanel.__init__(self)
        self.bag = GridBag(self)
        # vertical labels
        for y in range(len(self.board.spyShortNameList)):
            name = self.board.spyShortNameList[y]
            self.bag.add(JLabel(name), gridx=0, gridy=y)
        # spy monitors
        self.spyMonitorList = map(
            lambda x, parentCrate=parentCrate: spyMonitor(x, parentCrate),
            self.board.spyList)
        for i in range(self.board.spyNumber):
            self.bag.add(self.spyMonitorList[i], gridx=1, gridy=i)

# set borders - this line is copied by an online Swing tutorial...
        self.border = BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder("%s-%d" %
                                             (self.board.type, slot)),
            BorderFactory.createEmptyBorder(5, 5, 5, 5))

    def close(
            self):  # explicit call to destructor - workaround for jpython bug
        self.board.__del__()

    def update(self):
        if __debug__:
            print self.board.slot
        for spyMonitor in self.spyMonitorList:
            spyMonitor.update()
    def init(self):
	bag = GridBag(self)

	self.framedArea = FramedArea(self)
	bag.addRow(self.framedArea, weighty=1.0, fill='BOTH')

	self.label = awt.Label('Click within the framed area')
	bag.addRow(self.label, weightx=1.0, weighty=0.0, fill='HORIZONTAL')
示例#3
0
    def __init__(self, gl):
        self.commander = Commander(gl, self)
        self.frame = java.awt.Frame("LibVob commander")
        #self.frame = Frame("Gzz commander",
        #    windowClosing=lambda ev: self.frame.dispose())
        g = GridBag(self.frame)
        self.outputArea = java.awt.TextArea(
            "Welcome to LibVob commander\n" + "Using Jython " + sys.version +
            "\n>>>", 80, 50)
        self.outputArea.editable = 0
        self.inputArea = java.awt.TextField(80, actionPerformed=self.execute)
        self.execButton = java.awt.Button("Go", actionPerformed=self.execute)
        self.toggle = java.awt.Checkbox("Updateloop enabled",
                                        itemStateChanged=self.toggleUpd)

        g.add(self.outputArea,
              gridx=0,
              gridy=0,
              gridwidth=1,
              gridheight=10,
              fill="BOTH",
              weightx=100,
              weighty=100)

        g.add(self.inputArea,
              gridx=0,
              gridy="RELATIVE",
              gridwidth=1,
              gridheight=1,
              fill="HORIZONTAL",
              weightx=100,
              weighty=0)

        g.add(self.toggle,
              gridx=1,
              gridy=0,
              gridwidth=1,
              gridheight=1,
              fill="BOTH",
              weightx=0,
              weighty=0)

        g.add(self.execButton,
              gridx=1,
              gridy=10,
              gridwidth=1,
              gridheight=1,
              fill="BOTH",
              weightx=0,
              weighty=0)

        self.frame.setSize(600, 600)
        self.frame.setLocation(200, 200)
        self.frame.show()
示例#4
0
    def init(self):
        self.spanish = awt.List(4, 1)
        self.fillList(self.spanish, ["uno", "dos", "tres", "cuatro", "cinco", "seis", "siete"])
        self.italian = awt.List()
        self.fillList(self.italian, ["uno", "due", "tre", "quattro", "cinque", "sei", "sette"])

        self.output = awt.TextArea(10, 40, editable=0)

        bag = GridBag(self)
        bag.add(self.output, fill="BOTH", weightx=1.0, weighty=1.0, gridheight=2)

        bag.addRow(self.spanish, fill="VERTICAL")
        bag.addRow(self.italian, fill="VERTICAL")

        self.language = {self.spanish: "Spanish", self.italian: "Italian"}
示例#5
0
    def init(self):
	self.spanish = awt.List(4, 1)
	self.fillList(self.spanish, ['uno', 'dos', 'tres', 'cuatro', 
				     'cinco', 'seis', 'siete'])
	self.italian = awt.List()
	self.fillList(self.italian, ['uno', 'due', 'tre', 'quattro',
				     'cinque', 'sei', 'sette'])

	self.output = awt.TextArea(10, 40, editable=0)

	bag = GridBag(self)
	bag.add(self.output,
		fill='BOTH', weightx=1.0, weighty=1.0,
		gridheight=2)

	bag.addRow(self.spanish, fill='VERTICAL')
	bag.addRow(self.italian, fill='VERTICAL')

	self.language = {self.spanish:'Spanish', self.italian:'Italian'}
示例#6
0
    def __init__(self, crate, slot, parentCrate):
        JPanel.__init__(self)
        self.bag = GridBag(self)
        # vertical labels
        for y in range(len(self.board.spyShortNameList)):
            name = self.board.spyShortNameList[y]
            self.bag.add(JLabel(name), gridx=0, gridy=y)
        # spy monitors
        self.spyMonitorList = map(
            lambda x, parentCrate=parentCrate: spyMonitor(x, parentCrate),
            self.board.spyList)
        for i in range(self.board.spyNumber):
            self.bag.add(self.spyMonitorList[i], gridx=1, gridy=i)

# set borders - this line is copied by an online Swing tutorial...
        self.border = BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder("%s-%d" %
                                             (self.board.type, slot)),
            BorderFactory.createEmptyBorder(5, 5, 5, 5))
示例#7
0
    def __init__(self, title, units, controller):
        self.units = units
        self.controller = controller

        bag = GridBag(self, fill='HORIZONTAL')

        label = awt.Label(title, awt.Label.CENTER)
        bag.addRow(label)

        self.text = awt.TextField('0', 10, actionListener=self)
        bag.add(self.text, weightx=1.0)

        self.chooser = awt.Choice(itemListener=self)
        for name, multiplier in units:
            self.chooser.add(name)
        bag.addRow(self.chooser)

        self.slider = awt.Scrollbar(awt.Scrollbar.HORIZONTAL,
                                    maximum=self.max + 10,
                                    blockIncrement=self.block,
                                    adjustmentListener=self)
        bag.add(self.slider)
    def init(self):
        bag = GridBag(self)

        self.framedArea = FramedArea(self)
        bag.addRow(self.framedArea, weighty=1.0, fill='BOTH')

        self.label = awt.Label('Click within the framed area')
        bag.addRow(self.label, weightx=1.0, weighty=0.0, fill='HORIZONTAL')
示例#9
0
    def __init__(self, title, units, controller):
	self.units = units
	self.controller = controller

	bag = GridBag(self, fill='HORIZONTAL')

	label = awt.Label(title, awt.Label.CENTER)
	bag.addRow(label)

	self.text = awt.TextField('0', 10, actionListener=self)
	bag.add(self.text, weightx=1.0)

	self.chooser = awt.Choice(itemListener=self)
	for name, multiplier in units:
	    self.chooser.add(name)
	bag.addRow(self.chooser)

	self.slider = awt.Scrollbar(awt.Scrollbar.HORIZONTAL,
				    maximum=self.max+10,
				    blockIncrement=self.block,
				    adjustmentListener=self)
	bag.add(self.slider)
示例#10
0
    def init(self):
        self.spanish = awt.List(4, 1)
        self.fillList(
            self.spanish,
            ['uno', 'dos', 'tres', 'cuatro', 'cinco', 'seis', 'siete'])
        self.italian = awt.List()
        self.fillList(
            self.italian,
            ['uno', 'due', 'tre', 'quattro', 'cinque', 'sei', 'sette'])

        self.output = awt.TextArea(10, 40, editable=0)

        bag = GridBag(self)
        bag.add(self.output,
                fill='BOTH',
                weightx=1.0,
                weighty=1.0,
                gridheight=2)

        bag.addRow(self.spanish, fill='VERTICAL')
        bag.addRow(self.italian, fill='VERTICAL')

        self.language = {self.spanish: 'Spanish', self.italian: 'Italian'}
示例#11
0
    def do_layout(self, optionsPanel):
        bag = GridBag(self.frame.contentPane, fill='BOTH',
                      weightx=1.0, weighty=1.0)
        bag.add(swing.JLabel("Setup Code: ", RIGHT))
        bag.addRow(swing.JScrollPane(self.execentry), weighty=10.0)
        bag.add(swing.JLabel("Expression: ", RIGHT))
        bag.addRow(self.evalentry, weighty=2.0)
        bag.add(swing.JLabel("Output: ", RIGHT))
        bag.addRow(self.chart, weighty=20.0)
        bag.add(swing.JLabel("Options: ", RIGHT))
        bag.addRow(optionsPanel, weighty=2.0)
        self.update(None)  
        self.frame.visible = 1
        self.frame.size = self.frame.getPreferredSize()
 
        self.chooser = swing.JFileChooser()
        self.chooser.currentDirectory = java.io.File(os.getcwd())
示例#12
0
    def do_layout(self, optionsPanel):
        bag = GridBag(self.frame.contentPane,
                      fill='BOTH',
                      weightx=1.0,
                      weighty=1.0)
        bag.add(swing.JLabel("Setup Code: ", RIGHT))
        bag.addRow(swing.JScrollPane(self.execentry), weighty=10.0)
        bag.add(swing.JLabel("Expression: ", RIGHT))
        bag.addRow(self.evalentry, weighty=2.0)
        bag.add(swing.JLabel("Output: ", RIGHT))
        bag.addRow(self.chart, weighty=20.0)
        bag.add(swing.JLabel("Options: ", RIGHT))
        bag.addRow(optionsPanel, weighty=2.0)
        self.update(None)
        self.frame.visible = 1
        self.frame.size = self.frame.getPreferredSize()

        self.chooser = swing.JFileChooser()
        self.chooser.currentDirectory = java.io.File(os.getcwd())