Пример #1
0
class EditSymbolAttr(JPanel):
    def __init__(self, sattr):
	self.attr = sattr
	self.cbox = JColorChooser(self.attr.color)
	self.sz_field = JTextField(str(self.attr.size))
	szpanel = JPanel()
	szpanel.add(self.sz_field)
	szpanel.setBorder(BorderFactory.createTitledBorder("symbol size (integer)"))
	self.filled_box = JCheckBox("Filled ?:",self.attr.filled)
	self.shape_cbox = JComboBox(SymbolProps.sym_shape_map.keys())
	self.shape_cbox.setSelectedItem(self.attr.shape)
	self.shape_cbox.setBorder(BorderFactory.createTitledBorder("Shape"))
	panel1 = JPanel()
	panel1.setLayout(BorderLayout())
	panel1.add(szpanel,BorderLayout.NORTH)
	panel2 = JPanel()
	panel2.setLayout(GridLayout(1,2))
	panel2.add(self.shape_cbox)
	panel2.add(self.filled_box)
	panel1.add(panel2,BorderLayout.SOUTH)
	self.setLayout(BorderLayout())
	self.add(self.cbox,BorderLayout.CENTER)
	self.add(panel1,BorderLayout.SOUTH)
    def setAttribute(self,sattr):
	self.attr = sattr
	self.cbox.color = self.attr.color
	self.sz_field.text = str(self.attr.size)
	self.shape_cbox.setSelectedItem(self.attr.shape)
    def update(self):
	self.attr.color = self.cbox.getColor()
	self.attr.size = string.atoi(self.sz_field.getText())
	self.attr.filled = self.filled_box.isSelected()
	self.attr.shape = self.shape_cbox.getSelectedItem()
	self.attr.sym = self.attr.createSymbol()
Пример #2
0
class EditCurveAttr(JPanel):
    def __init__(self, cattr):
        self.attr = cattr
        self.cbox = JColorChooser(self.attr.color)
        self.sym_panel = EditSymbolAttr(cattr.sym_prop)
        self.thickness_field = JTextField(str(cattr.thickness), 2)
        self.draw_symbol_box = JCheckBox("Draw Symbol?", cattr.draw_symbol)
        self.dps_field = JTextField(str(self.attr.data_per_symbol), 2)
        self.dash_box = JComboBox(CurveProps.DASH_TYPES.keys())
        self.dash_box.setSelectedItem(self.attr.dash_type)
        self.dash_box.setBorder(
            BorderFactory.createTitledBorder("Dash type: (Only JDK2 & Slow!)"))
        tpanelx = JPanel()
        tpanelx.add(self.thickness_field)
        tpanelx.setBorder(
            BorderFactory.createTitledBorder("curve thickness (integer)"))
        tpanely = JPanel()
        tpanely.add(self.dps_field)
        tpanely.setBorder(
            BorderFactory.createTitledBorder("data per symbol(integer)"))
        tpanel = JPanel()
        tpanel.setLayout(GridLayout(2, 2))
        tpanel.add(self.draw_symbol_box)
        tpanel.add(tpanelx)
        tpanel.add(tpanely)
        tpanel.add(self.dash_box)
        panel1 = JPanel()
        panel1.setLayout(BorderLayout())
        panel1.add(self.cbox, BorderLayout.CENTER)
        panel1.add(tpanel, BorderLayout.SOUTH)
        panel2 = JPanel()
        panel2.setLayout(BorderLayout())
        panel2.add(self.sym_panel, BorderLayout.CENTER)
        tp1 = JTabbedPane()
        tp1.addTab("Curve Attributes", panel1)
        tp1.addTab("Symbol Attributes", panel2)
        tp1.setSelectedComponent(panel1)
        self.setLayout(BorderLayout())
        self.add(tp1, BorderLayout.CENTER)

    def setAttribute(self, cattr):
        self.attr = cattr
        self.cbox.color = self.attr.color
        self.sym_panel.setAttribute(cattr.sym_prop)
        self.thickness_field.text = str(cattr.thickness)
        self.dps_field.text = str(cattr.data_per_symbol)
        self.draw_symbol_box.setSelected(cattr.draw_symbol)
        self.dash_box.setSelectedItem(cattr.dash_type)

    def update(self):
        self.attr.color = self.cbox.getColor()
        self.attr.thickness = string.atoi(self.thickness_field.text)
        self.attr.data_per_symbol = string.atoi(self.dps_field.text)
        self.attr.draw_symbol = self.draw_symbol_box.isSelected()
        self.attr.dash_type = self.dash_box.getSelectedItem()
        #print 'Updating Self.draw_symbol',self.draw_symbol,self.attr
        self.sym_panel.update()
Пример #3
0
class EditCurveAttr(JPanel):
    def __init__(self, cattr):
	self.attr = cattr
	self.cbox = JColorChooser(self.attr.color)
	self.sym_panel = EditSymbolAttr(cattr.sym_prop)
	self.thickness_field = JTextField(str(cattr.thickness),2)
	self.draw_symbol_box = JCheckBox("Draw Symbol?",cattr.draw_symbol)
	self.dps_field = JTextField(str(self.attr.data_per_symbol),2)
	self.dash_box = JComboBox(CurveProps.DASH_TYPES.keys())
	self.dash_box.setSelectedItem(self.attr.dash_type)
	self.dash_box.setBorder(BorderFactory.createTitledBorder("Dash type: (Only JDK2 & Slow!)"))
	tpanelx = JPanel()
	tpanelx.add(self.thickness_field)
	tpanelx.setBorder(BorderFactory.createTitledBorder("curve thickness (integer)"))
	tpanely = JPanel()
	tpanely.add(self.dps_field)
	tpanely.setBorder(BorderFactory.createTitledBorder("data per symbol(integer)"))
	tpanel = JPanel();tpanel.setLayout(GridLayout(2,2));
	tpanel.add(self.draw_symbol_box); tpanel.add(tpanelx);
	tpanel.add(tpanely); tpanel.add(self.dash_box);
	panel1 = JPanel()
	panel1.setLayout(BorderLayout())
	panel1.add(self.cbox,BorderLayout.CENTER)
	panel1.add(tpanel, BorderLayout.SOUTH)
	panel2 = JPanel()
	panel2.setLayout(BorderLayout())
	panel2.add(self.sym_panel,BorderLayout.CENTER)
	tp1 = JTabbedPane()
	tp1.addTab("Curve Attributes",panel1)
	tp1.addTab("Symbol Attributes",panel2)
	tp1.setSelectedComponent(panel1)
	self.setLayout(BorderLayout())
	self.add(tp1,BorderLayout.CENTER)
    def setAttribute(self,cattr):
	self.attr = cattr
	self.cbox.color = self.attr.color
	self.sym_panel.setAttribute(cattr.sym_prop)
	self.thickness_field.text = str(cattr.thickness)
	self.dps_field.text = str(cattr.data_per_symbol)
	self.draw_symbol_box.setSelected(cattr.draw_symbol)
	self.dash_box.setSelectedItem(cattr.dash_type)
    def update(self):
	self.attr.color = self.cbox.getColor()
	self.attr.thickness = string.atoi(self.thickness_field.text)
	self.attr.data_per_symbol = string.atoi(self.dps_field.text)
	self.attr.draw_symbol = self.draw_symbol_box.isSelected()
	self.attr.dash_type = self.dash_box.getSelectedItem()
	#print 'Updating Self.draw_symbol',self.draw_symbol,self.attr
	self.sym_panel.update()
Пример #4
0
class EditSymbolAttr(JPanel):
    def __init__(self, sattr):
        self.attr = sattr
        self.cbox = JColorChooser(self.attr.color)
        self.sz_field = JTextField(str(self.attr.size))
        szpanel = JPanel()
        szpanel.add(self.sz_field)
        szpanel.setBorder(
            BorderFactory.createTitledBorder("symbol size (integer)"))
        self.filled_box = JCheckBox("Filled ?:", self.attr.filled)
        self.shape_cbox = JComboBox(SymbolProps.sym_shape_map.keys())
        self.shape_cbox.setSelectedItem(self.attr.shape)
        self.shape_cbox.setBorder(BorderFactory.createTitledBorder("Shape"))
        panel1 = JPanel()
        panel1.setLayout(BorderLayout())
        panel1.add(szpanel, BorderLayout.NORTH)
        panel2 = JPanel()
        panel2.setLayout(GridLayout(1, 2))
        panel2.add(self.shape_cbox)
        panel2.add(self.filled_box)
        panel1.add(panel2, BorderLayout.SOUTH)
        self.setLayout(BorderLayout())
        self.add(self.cbox, BorderLayout.CENTER)
        self.add(panel1, BorderLayout.SOUTH)

    def setAttribute(self, sattr):
        self.attr = sattr
        self.cbox.color = self.attr.color
        self.sz_field.text = str(self.attr.size)
        self.shape_cbox.setSelectedItem(self.attr.shape)

    def update(self):
        self.attr.color = self.cbox.getColor()
        self.attr.size = string.atoi(self.sz_field.getText())
        self.attr.filled = self.filled_box.isSelected()
        self.attr.shape = self.shape_cbox.getSelectedItem()
        self.attr.sym = self.attr.createSymbol()