def build(self): self.pack((5, 5)) hpanel = wal.HPanel(self) hpanel.pack(wal.Label(hpanel, _('Document units') + ':')) names = [] for item in unit_names: names.append(unit_full_names[item]) self.units_combo = wal.Combolist(hpanel, items=names) self.units = self.doc.methods.get_doc_units() self.units_combo.set_active(unit_names.index(self.units)) hpanel.pack(self.units_combo, padding=5) self.pack(hpanel) data = [[_('Unit'), _('Value in points')]] for item in uc2const.unit_names: name = uc2const.unit_full_names[item] value = _('%s points') % str(uc2const.unit_dict[item]) data.append([name, value]) slist = wal.ReportList(self, data) self.pack(slist, expand=True, fill=True, padding_all=5) self.origin = self.doc.methods.get_doc_origin() self.pack(wal.Label(self, _('Document origin:')), padding_all=5) self.origin_keeper = wal.HToggleKeeper(self, ORIGINS, ORIGIN_ICONS, ORIGIN_NAMES) self.origin_keeper.set_mode(self.origin) self.pack(self.origin_keeper) self.pack((5, 5))
def build(self): self.pack(wal.ClickableImage(self, rc.IMG_CTX_UNITS, tooltip=_('Units')), padding=3) names = [] for item in unit_names: names.append(unit_full_names[item]) self.combo = wal.ComboBoxEntry(self, names, cmd=self.combo_changed) self.combo.set_active(unit_names.index(config.default_unit)) self.pack(self.combo, padding=2)
def build(self): label = gtk.Label(_('Units:')) self.pack_start(label, False, False, 3) self.combo = gtk.combo_box_new_text() self.pack_start(self.combo, False, False, 0) for item in unit_names: self.combo.append_text(unit_full_names[item]) self.combo.set_active(unit_names.index(config.default_unit)) self.combo.connect('changed', self.combo_changed) events.connect(events.NO_DOCS, self.set_state) events.connect(events.DOC_CHANGED, self.set_state) events.connect(events.CONFIG_MODIFIED, self.config_changed)
def build(self): self.pack((5, 5)) hpanel = wal.HPanel(self) vp = wal.LabeledPanel(hpanel, text=_('Document units')) names = [] for item in unit_names: names.append(unit_full_names[item]) self.units_combo = wal.Combolist(vp, items=names) self.units = self.doc.methods.get_doc_units() self.units_combo.set_active(unit_names.index(self.units)) vp.pack(self.units_combo, padding_all=15, fill=True) hpanel.pack(vp, expand=True, fill=True) hpanel.pack((10, 10)) vp = wal.LabeledPanel(hpanel, text=_('Document origin')) self.origin = self.doc.methods.get_doc_origin() self.origin_keeper = wal.HToggleKeeper(vp, ORIGINS, ORIGIN_ICONS, ORIGIN_NAMES) self.origin_keeper.set_mode(self.origin) vp.pack(self.origin_keeper, padding_all=5) hpanel.pack(vp, fill=True) self.pack(hpanel, fill=True, padding_all=5) data = [[_('Unit'), _('Value in points')]] for item in uc2const.unit_names: name = uc2const.unit_full_names[item] value = _('%s points') % str(uc2const.unit_dict[item]) data.append([name, value]) vp = wal.VPanel(self) vp.set_bg(wal.UI_COLORS['border']) slist = wal.ReportList(vp, data) vp.pack(slist, expand=True, fill=True, padding_all=1) self.pack(vp, expand=True, fill=True, padding_all=5) self.pack((5, 5))
def build(self): self.pack((5, 5)) hpanel = wal.HPanel(self) hpanel.pack(wal.Label(hpanel, _('Document units') + ':')) names = [] for item in unit_names: names.append(unit_full_names[item]) self.units_combo = wal.Combolist(hpanel, items=names) self.units = self.doc.methods.get_doc_units() self.units_combo.set_active(unit_names.index(self.units)) hpanel.pack(self.units_combo, padding=5) self.pack(hpanel, padding_all=5) self.pack((5, 5)) self.origin = self.doc.methods.get_doc_origin() self.pack(wal.Label(self, _('Document origin:')), padding_all=5) self.origin_keeper = wal.HToggleKeeper(self, ORIGINS, ORIGIN_ICONS, ORIGIN_NAMES) self.origin_keeper.set_mode(self.origin) self.pack(self.origin_keeper)
def combo_changed(self, *args): if not config.default_unit == unit_names[self.combo.get_active()]: config.default_unit = unit_names[self.combo.get_active()] self.combo.set_active(unit_names.index(config.default_unit))
def update(self, *args): if self.insp.is_doc(): model = self.app.current_doc.model if not model.doc_units == unit_names[self.combo.get_active()]: self.units = model.doc_units self.combo.set_active(unit_names.index(self.units))
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(500, 200) tab = gtk.Table(8, 2, False) tab.set_row_spacings(10) tab.set_col_spacings(10) spacer.pack_start(tab) #--------------------------- label = gtk.Label(_('Application units:')) 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() for item in unit_names: self.combo.append_text(unit_full_names[item]) self.combo.set_active(unit_names.index(config.default_unit)) tab.attach(self.combo, 1, 2, 0, 1, gtk.SHRINK, gtk.SHRINK) #--------------------------- hline = gtk.HSeparator() tab.attach(hline, 0, 2, 1, 2, gtk.FILL | gtk.EXPAND, gtk.SHRINK) #--------------------------- label = gtk.Label(_('Curves flattening tolerance:')) label.set_alignment(0, 0.5) tab.attach(label, 0, 1, 2, 3, gtk.FILL | gtk.EXPAND, gtk.SHRINK) self.tolerance_adj = gtk.Adjustment(config.tolerance, 0.01, 10.0, 0.01, 1.0, 0.0) spinner = gtk.SpinButton(self.tolerance_adj, 0.1, 2) spinner.set_numeric(True) tab.attach(spinner, 1, 2, 2, 3, gtk.FILL, gtk.SHRINK) markup = _('Flattening tolerance affects on curve flattening quality.\n\ Lower value means better cutting quality and slower cutting speed.\n\ Default flattening tolerance value is 0,5') label = gtk.Label() label.set_markup(markup) label.set_alignment(0, 0.5) label.set_sensitive(False) tab.attach(label, 0, 2, 3, 4, gtk.FILL | gtk.EXPAND, gtk.SHRINK) #--------------------------- hline = gtk.HSeparator() tab.attach(hline, 0, 2, 4, 5, gtk.FILL | gtk.EXPAND, gtk.SHRINK) #--------------------------- self.new_doc = gtk.CheckButton(label=_('Create new document on start')) self.new_doc.set_active(config.new_doc_on_start) tab.attach(self.new_doc, 0, 2, 5, 6, gtk.FILL | gtk.EXPAND, gtk.SHRINK) #--------------------------- self.backup_check = gtk.CheckButton(label=_('Make backup when save')) self.backup_check.set_active(config.make_backup) tab.attach(self.backup_check, 0, 2, 6, 7, gtk.FILL | gtk.EXPAND, gtk.SHRINK) #--------------------------- self.release_check = gtk.CheckButton(label=_('Allow release check')) self.release_check.set_active(config.allow_release_check) tab.attach(self.release_check, 0, 2, 7, 8, gtk.FILL | gtk.EXPAND, gtk.SHRINK)