예제 #1
0
	def combo_changed(self, *args):
		items = plt_data.keys()
		items.sort()
		index = self.combo.get_active()
		if index == -1:
			index = items.index('Generic plotter')
			self.combo.set_active(index)
		value = items[index]
		self.plt_name.set_text(value)
		self.height_spin.set_point_value(plt_data[value][0])
		self.width_spin.set_point_value(plt_data[value][1])
		self.radiobut1.set_active(True)
		self.data_frame.set_sensitive(False)
예제 #2
0
 def combo_changed(self, *args):
     items = plt_data.keys()
     items.sort()
     index = self.combo.get_active()
     if index == -1:
         index = items.index('Generic plotter')
         self.combo.set_active(index)
     value = items[index]
     self.plt_name.set_text(value)
     self.height_spin.set_point_value(plt_data[value][0])
     self.width_spin.set_point_value(plt_data[value][1])
     self.radiobut1.set_active(True)
     self.data_frame.set_sensitive(False)
예제 #3
0
	def __init__(self, app):

		gtk.VBox.__init__(self)
		self.app = app
		self.caption_label = gtk.Label(self.caption)

		spacer = gtk.VBox()
		self.add(spacer)
		self.set_border_width(15)
		self.set_size_request(385, 220)

		tab = gtk.Table(3, 2, False)
		tab.set_row_spacings(10)
		tab.set_col_spacings(10)
		spacer.add(tab)


		#---------------------------

		label = gtk.Label(_('Plotter model:'))
		label.set_alignment(0, 0.5)
		tab.attach(label, 0, 1, 0, 1, gtk.FILL | gtk.EXPAND, gtk.SHRINK)

		self.combo = gtk.combo_box_new_text()
		self.combo.connect('changed', self.combo_changed)

		items = plt_data.keys()
		items.sort()
		for item in items:
			self.combo.append_text(item)

		tab.attach(self.combo, 1, 2, 0, 1, gtk.SHRINK, gtk.SHRINK)

		#---------------------------

		self.radiobut1 = gtk.RadioButton(None, _("Predefined model"))
		tab.attach(self.radiobut1, 0, 1, 1, 2, gtk.SHRINK, gtk.SHRINK)
		self.radiobut1.connect("toggled", self.radio_changed)

		self.radiobut2 = gtk.RadioButton(self.radiobut1, _("Custom model"))
		tab.attach(self.radiobut2, 1, 2, 1, 2, gtk.SHRINK, gtk.SHRINK)
		self.radiobut2.connect("toggled", self.radio_changed)

		#---------------------------

		self.data_frame = gtk.Frame(_('Plotter data'))
		tab.attach(self.data_frame, 0, 2, 2, 3, gtk.FILL | gtk.EXPAND, gtk.SHRINK)


		data_tab = gtk.Table(3, 3, False)
		data_tab.set_border_width(15)
		data_tab.set_row_spacings(10)
		data_tab.set_col_spacings(10)
		self.data_frame.add(data_tab)

		#===========================

		label = gtk.Label(_('Plotter model:'))
		label.set_alignment(1, 0.5)
		data_tab.attach(label, 0, 1, 0, 1, gtk.FILL , gtk.SHRINK)

		self.plt_name = gtk.Entry()
		self.plt_name.set_text(config.plotter_name)
		data_tab.attach(self.plt_name, 1, 3, 0, 1, gtk.FILL | gtk.EXPAND, gtk.SHRINK)

		#===========================

		label = gtk.Label(_('Cutting width:'))
		label.set_alignment(1, 0.5)
		data_tab.attach(label, 0, 1, 1, 2, gtk.FILL , gtk.SHRINK)

		self.height_spin = UnitSpin(self.user_changes)
		self.height_spin.set_point_value(config.plotter_page_height)
		data_tab.attach(self.height_spin, 1, 2, 1, 2, gtk.SHRINK, gtk.SHRINK)

		unit_label = UnitLabel()
		unit_label.set_alignment(0, 0.5)
		data_tab.attach(unit_label, 2, 3, 1, 2, gtk.FILL | gtk.EXPAND, gtk.SHRINK)

		#===========================		
		label = gtk.Label(_('Cutting length:'))
		label.set_alignment(1, 0.5)

		data_tab.attach(label, 0, 1, 2, 3, gtk.FILL , gtk.SHRINK)

		self.width_spin = UnitSpin(self.user_changes)
		self.width_spin.set_point_value(config.plotter_page_width)
		data_tab.attach(self.width_spin, 1, 2, 2, 3, gtk.SHRINK, gtk.SHRINK)

		unit_label = UnitLabel()
		unit_label.set_alignment(0, 0.5)
		data_tab.attach(unit_label, 2, 3, 2, 3, gtk.FILL | gtk.EXPAND, gtk.SHRINK)

		#===========================

		if config.plotter_name in items and \
		round(plt_data[config.plotter_name][0], 6) == round(config.plotter_page_height, 6) and \
		round(plt_data[config.plotter_name][1], 6) == round(config.plotter_page_width, 6):
			self.combo.set_active(items.index(config.plotter_name))
			self.radiobut1.set_active(True)
			self.data_frame.set_sensitive(False)
		else:
			self.radiobut2.set_active(True)
예제 #4
0
    def __init__(self, app):

        gtk.VBox.__init__(self)
        self.app = app
        self.caption_label = gtk.Label(self.caption)

        spacer = gtk.VBox()
        self.add(spacer)
        self.set_border_width(15)
        self.set_size_request(385, 220)

        tab = gtk.Table(3, 2, False)
        tab.set_row_spacings(10)
        tab.set_col_spacings(10)
        spacer.add(tab)

        #---------------------------

        label = gtk.Label(_('Plotter model:'))
        label.set_alignment(0, 0.5)
        tab.attach(label, 0, 1, 0, 1, gtk.FILL | gtk.EXPAND, gtk.SHRINK)

        self.combo = gtk.combo_box_new_text()
        self.combo.connect('changed', self.combo_changed)

        items = plt_data.keys()
        items.sort()
        for item in items:
            self.combo.append_text(item)

        tab.attach(self.combo, 1, 2, 0, 1, gtk.SHRINK, gtk.SHRINK)

        #---------------------------

        self.radiobut1 = gtk.RadioButton(None, _("Predefined model"))
        tab.attach(self.radiobut1, 0, 1, 1, 2, gtk.SHRINK, gtk.SHRINK)
        self.radiobut1.connect("toggled", self.radio_changed)

        self.radiobut2 = gtk.RadioButton(self.radiobut1, _("Custom model"))
        tab.attach(self.radiobut2, 1, 2, 1, 2, gtk.SHRINK, gtk.SHRINK)
        self.radiobut2.connect("toggled", self.radio_changed)

        #---------------------------

        self.data_frame = gtk.Frame(_('Plotter data'))
        tab.attach(self.data_frame, 0, 2, 2, 3, gtk.FILL | gtk.EXPAND,
                   gtk.SHRINK)

        data_tab = gtk.Table(3, 3, False)
        data_tab.set_border_width(15)
        data_tab.set_row_spacings(10)
        data_tab.set_col_spacings(10)
        self.data_frame.add(data_tab)

        #===========================

        label = gtk.Label(_('Plotter model:'))
        label.set_alignment(1, 0.5)
        data_tab.attach(label, 0, 1, 0, 1, gtk.FILL, gtk.SHRINK)

        self.plt_name = gtk.Entry()
        self.plt_name.set_text(config.plotter_name)
        data_tab.attach(self.plt_name, 1, 3, 0, 1, gtk.FILL | gtk.EXPAND,
                        gtk.SHRINK)

        #===========================

        label = gtk.Label(_('Cutting width:'))
        label.set_alignment(1, 0.5)
        data_tab.attach(label, 0, 1, 1, 2, gtk.FILL, gtk.SHRINK)

        self.height_spin = UnitSpin(self.user_changes)
        self.height_spin.set_point_value(config.plotter_page_height)
        data_tab.attach(self.height_spin, 1, 2, 1, 2, gtk.SHRINK, gtk.SHRINK)

        unit_label = UnitLabel()
        unit_label.set_alignment(0, 0.5)
        data_tab.attach(unit_label, 2, 3, 1, 2, gtk.FILL | gtk.EXPAND,
                        gtk.SHRINK)

        #===========================
        label = gtk.Label(_('Cutting length:'))
        label.set_alignment(1, 0.5)

        data_tab.attach(label, 0, 1, 2, 3, gtk.FILL, gtk.SHRINK)

        self.width_spin = UnitSpin(self.user_changes)
        self.width_spin.set_point_value(config.plotter_page_width)
        data_tab.attach(self.width_spin, 1, 2, 2, 3, gtk.SHRINK, gtk.SHRINK)

        unit_label = UnitLabel()
        unit_label.set_alignment(0, 0.5)
        data_tab.attach(unit_label, 2, 3, 2, 3, gtk.FILL | gtk.EXPAND,
                        gtk.SHRINK)

        #===========================

        if config.plotter_name in items and \
        round(plt_data[config.plotter_name][0], 6) == round(config.plotter_page_height, 6) and \
        round(plt_data[config.plotter_name][1], 6) == round(config.plotter_page_width, 6):
            self.combo.set_active(items.index(config.plotter_name))
            self.radiobut1.set_active(True)
            self.data_frame.set_sensitive(False)
        else:
            self.radiobut2.set_active(True)