예제 #1
0
    def build(self):
        self.changes_flag = False
        self.styles = self._get_styles()
        self.styles_combo = wal.Combolist(self,
                                          items=self.styles,
                                          onchange=self.on_style_change)
        self.pack(self.styles_combo, padding=2)
        self.pack((3, 3))

        self.families, self.faces_dict = libpango.get_fonts()

        self.families_combo = FontChoice(self, onchange=self.on_font_change)
        self.pack(self.families_combo, padding=2)
        self.pack((3, 3))

        self.faces = self.faces_dict['Sans']
        self.faces_combo = wal.Combolist(self,
                                         items=self.faces,
                                         onchange=self.apply_changes)
        self.faces_combo.set_active(0)
        self.pack(self.faces_combo, padding=2)
        self.pack((3, 3))

        self.size_combo = wal.FloatCombobox(self,
                                            12,
                                            digits=2,
                                            items=FONT_SIZES,
                                            onchange=self.apply_changes)
        self.pack(self.size_combo, padding=2)

        self.pack(wal.VLine(self), fill=True, padding_all=3)

        self.align = wal.HToggleKeeper(self,
                                       ALIGN_MODES,
                                       ALIGN_MODE_ICONS,
                                       ALIGN_MODE_NAMES,
                                       on_change=self.apply_changes,
                                       allow_none=False)
        self.align.set_mode(sk2const.TEXT_ALIGN_LEFT)
        self.pack(self.align, padding=2)

        self.pack(wal.VLine(self), fill=True, padding_all=3)

        self.ligature = wal.ImageToggleButton(self,
                                              False,
                                              icons.PD_LIGATURE,
                                              tooltip=_('Use ligatures'),
                                              onchange=self.apply_changes)
        self.pack(self.ligature, padding=2)
예제 #2
0
    def __init__(self, parent, app):
        self.app = app
        wal.LabeledPanel.__init__(self, parent, _('Distribute'))

        self.pack((5, 5))

        self.hdistrib = wal.HToggleKeeper(self, H_DISTRIBUTE_MODES,
                                          H_DISTRIBUTE_MODE_ICONS,
                                          H_DISTRIBUTE_MODE_NAMES,
                                          on_change=self.update,
                                          allow_none=True)
        self.pack(self.hdistrib)
        self.hdistrib.set_mode(DISTRIBUTE_HCENTER)

        self.vdistrib = wal.HToggleKeeper(self, V_DISTRIBUTE_MODES,
                                          V_DISTRIBUTE_MODE_ICONS,
                                          V_DISTRIBUTE_MODE_NAMES,
                                          on_change=self.update,
                                          allow_none=True)
        self.pack(self.vdistrib, padding_all=5)
        self.vdistrib.set_mode(DISTRIBUTE_VCENTER)

        self.apply_btn = wal.Button(self, _('Apply'), onclick=self.action)
        self.pack(self.apply_btn, padding_all=5, fill=True)
예제 #3
0
	def __init__(self, parent, cms, palette=None, onclick=None):
		self.cms = cms
		self.callback = onclick
		wal.VPanel.__init__(self, parent)
		options = wal.ExpandedPanel(self, _('Palette preview:'))
		changer = wal.HToggleKeeper(options, PREVIEW_MODES, MODE_ICON,
								MODE_NAME, on_change=self.set_mode)
		options.pack(changer)
		self.pack(options, fill=True)
		border = wal.VPanel(self, border=True)
		self.pack(border, expand=True, fill=True)
		self.win = ScrolledPalette(border, self.cms, onclick=self.select_color)
		border.pack(self.win, expand=True, fill=True)
		changer.set_mode(AUTO_MODE)
		if palette: self.draw_palette(palette)
예제 #4
0
파일: __init__.py 프로젝트: zcy330/sk1-wx
    def build_ui(self):
        self.icon = get_icon(PLUGIN_ICON)
        panel = wal.VPanel(self.panel)

        panel.pack(wal.Label(panel, _('Text position on path')), padding_all=5)

        hp = wal.HPanel(panel)
        hp.pack(wal.Label(hp, _('Base point:')))
        self.base_point = wal.FloatSpin(hp, value=50.0, range_val=(0.0, 100.0),
                                        step=1.0)
        hp.pack(self.base_point, padding=5)
        hp.pack(wal.Label(hp, '%'))

        panel.pack(hp, padding=5)

        self.align_keeper = wal.HToggleKeeper(panel, TEXT_ALIGNS,
                                              TEXT_ALIGN_ICONS,
                                              TEXT_ALIGN_TEXTS,
                                              on_change=self.update_bmp)
        panel.pack(self.align_keeper)
        self.align_keeper.set_mode(TEXT_ALIGNS[1])

        border = wal.VPanel(panel)
        color = wal.UI_COLORS['border'] if wal.IS_GTK else wal.GRAY
        border.set_bg(color)
        self.pic_panel = wal.VPanel(border)
        self.pic_panel.set_bg(wal.WHITE)
        self.bmp = get_bmp(self.pic_panel,
                           TEXT_ALIGN_PICS[TEXT_ALIGNS[1]])
        self.pic_panel.pack(self.bmp, padding_all=5)
        border.pack(self.pic_panel, padding_all=1)
        panel.pack(border, padding=10)

        self.other_side = wal.Checkbox(panel, _('Place on the other side'),
                                       onclick=self.update_bmp)
        panel.pack(self.other_side, padding=5)

        self.apply_btn = wal.Button(panel, _('Apply'), onclick=self.action)
        panel.pack(self.apply_btn, padding=5, fill=True)

        self.panel.pack(panel, fill=True, padding_all=5)
        self.panel.pack(wal.HLine(self.panel), fill=True)

        events.connect(events.DOC_CHANGED, self.update)
        events.connect(events.SELECTION_CHANGED, self.update)
        events.connect(events.DOC_MODIFIED, self.update)

        self.update()
예제 #5
0
    def build_ui(self):
        self.icon = get_icon(PLUGIN_ICON)
        panel = wal.VPanel(self.panel)
        self.transform_keeper = wal.HToggleKeeper(panel, TRANSFORM_MODES,
                                                  TRANSFORM_MODE_ICONS,
                                                  TRANSFORM_MODE_NAMES,
                                                  self.on_mode_change)
        panel.pack(self.transform_keeper)
        panel.pack(wal.HLine(panel), fill=True, padding=3)

        self.transform_panel = wal.VPanel(panel)

        self.transforms = {}
        for item in TRANSFORM_MODES:
            transf = TRANSFORM_CLASSES[item](self.transform_panel, self.app,
                                             self.on_reset)
            transf.hide()
            self.transforms[item] = transf

        panel.pack(self.transform_panel, fill=True)

        hpanel = wal.HPanel(panel)
        self.oi = OrientationIndicator(hpanel, onchange=self.on_orient_change)
        hpanel.pack(self.oi)
        hpanel.pack((10, 10))
        hpanel.pack(OriginIndicator(hpanel, self.app))

        panel.pack(hpanel, padding_all=10)

        self.apply_copy_btn = wal.Button(panel,
                                         _('Apply to copy'),
                                         onclick=self.action_copy)
        panel.pack(self.apply_copy_btn, fill=True)

        self.apply_btn = wal.Button(panel, _('Apply'), onclick=self.action)
        panel.pack(self.apply_btn, padding=3, fill=True)

        panel.pack(wal.HLine(panel), fill=True)

        self.panel.pack(panel, fill=True, expand=True, padding_all=5)

        events.connect(events.DOC_CHANGED, self.update)
        events.connect(events.SELECTION_CHANGED, self.update)
        events.connect(events.DOC_MODIFIED, self.update)
        self.update()
예제 #6
0
파일: fillctrls.py 프로젝트: Scrik/sk1-wx
    def build(self):
        self.panels = {}
        panel = wal.HPanel(self)
        self.solid_keeper = wal.HToggleKeeper(panel, SOLID_MODES,
                                              SOLID_MODE_ICONS,
                                              SOLID_MODE_NAMES,
                                              self.on_mode_change)
        panel.pack(self.solid_keeper)
        panel.pack(wal.HPanel(panel), fill=True, expand=True)
        self.rule_keeper = FillRuleKeeper(panel)
        panel.pack(self.rule_keeper)
        if not self.use_rule: self.rule_keeper.set_visible(False)
        self.pack(panel, fill=True, padding_all=5)
        self.pack(wal.HLine(self), fill=True)

        for item in SOLID_MODES:
            self.panels[item] = SOLID_MODE_CLASSES[item](self, self.app)
            self.panels[item].hide()
예제 #7
0
    def build(self):
        panel = wal.HPanel(self)
        self.pattern_clrs = wal.HToggleKeeper(panel, GRADIENT_CLR_MODES,
                                              GRADIENT_CLR_ICONS,
                                              GRADIENT_CLR_NAMES,
                                              self.on_clr_mode_change)
        panel.pack(self.pattern_clrs)
        panel.pack(wal.HPanel(panel), fill=True, expand=True)

        self.rule_keeper = FillRuleKeeper(panel)
        panel.pack(self.rule_keeper)
        self.pack(panel, fill=True, padding_all=5)
        self.pack(wal.HLine(self), fill=True)

        default_pattern_def = [
            sk2const.PATTERN_IMG, DEFAULT_PATTERN,
            deepcopy([sk2const.CMYK_BLACK, sk2const.CMYK_WHITE]),
            [] + sk2const.NORMAL_TRAFO
        ]
        self.pattern_editor = PatternEditor(self,
                                            self.dlg,
                                            self.cms,
                                            default_pattern_def,
                                            onchange=self.on_pattern_change)
        self.pack(self.pattern_editor, fill=True, expand=True, padding_all=5)

        self.pack(wal.HLine(self), fill=True)

        panel = wal.HPanel(self)
        self.refpanel = FillFillRefPanel(self,
                                         self.cms,
                                         self.orig_fill,
                                         deepcopy(self.orig_fill),
                                         on_orig=self.set_orig_fill)
        panel.pack(self.refpanel)

        panel.pack(wal.HPanel(panel), fill=True, expand=True)

        self.presets = PatternMiniPalette(panel,
                                          self.cms,
                                          onclick=self.on_presets_select)
        panel.pack(self.presets)
        self.pack(panel, fill=True, padding_all=5)
예제 #8
0
    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))
예제 #9
0
파일: docprops.py 프로젝트: Scrik/sk1-wx
    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 __init__(self, parent, cms, palette=None, onclick=None):
     self.cms = cms
     self.callback = onclick
     wal.VPanel.__init__(self, parent)
     if wal.IS_WX3:
         self.pack((172, 1))
     options = wal.ExpandedPanel(self, _('Palette preview:'))
     changer = wal.HToggleKeeper(options,
                                 PREVIEW_MODES,
                                 MODE_ICON,
                                 MODE_NAME,
                                 on_change=self.set_mode)
     options.pack(changer)
     self.pack(options, fill=True)
     border = wal.VPanel(self, border=True)
     if wal.IS_WX3:
         color = wal.GRAY
         if wal.IS_GTK:
             color = wal.UI_COLORS['pressed_border']
         border.set_bg(color)
     self.pack(border, expand=True, fill=True)
     self.win = ScrolledPalette(border, self.cms, onclick=self.select_color)
     if wal.IS_WX3:
         if wal.IS_GTK:
             inner_border = wal.VPanel(self)
             inner_border.pack(self.win, expand=True, fill=True)
             border.pack(inner_border,
                         expand=True,
                         fill=True,
                         padding_all=1)
         else:
             border.pack(self.win, expand=True, fill=True, padding_all=1)
     else:
         border.pack(self.win, expand=True, fill=True)
     changer.set_mode(AUTO_MODE)
     if palette:
         self.draw_palette(palette)
예제 #11
0
	def build_ui(self):
		self.icon = get_icon(PLUGIN_ICON)
		self.panel.pack((5, 5))
		self.shaping_keeper = wal.HToggleKeeper(self.panel, SHAPING_MODES,
							SHAPING_MODE_ICONS,
							SHAPING_MODE_NAMES, self.on_mode_change)
		self.panel.pack(self.shaping_keeper)
		self.panel.pack(wal.HLine(self.panel), fill=True, padding=3)

		self.shaping_panel = wal.VPanel(self.panel)

		self.panels = {}
		for item in SHAPING_MODES:
			panel = SHAPING_CLASSES[item](self.shaping_panel, self.app)
			panel.hide()
			self.panels[item] = panel

		self.panel.pack(self.shaping_panel, fill=True, padding_all=5)
		self.panel.pack(wal.HLine(self.panel), fill=True)

		events.connect(events.DOC_CHANGED, self.update)
		events.connect(events.SELECTION_CHANGED, self.update)
		events.connect(events.DOC_MODIFIED, self.update)
		self.update()
예제 #12
0
    def build(self):
        self.page_format = self.doc.methods.get_default_page_format()
        self.formats = [
            _('Custom'),
        ] + uc2const.PAGE_FORMAT_NAMES
        self.pack((5, 10))

        # ---
        hpanel = wal.HPanel(self)
        hpanel.pack((5, 5))
        label = wal.Label(hpanel, _('Default page:'))
        hpanel.pack(label)
        hpanel.pack((5, 5))
        self.page_combo = wal.Combolist(self,
                                        items=self.formats,
                                        onchange=self.page_combo_changed)
        index = 0
        state = True
        if self.page_format[0] in uc2const.PAGE_FORMAT_NAMES:
            index = self.formats.index(self.page_format[0])
            state = False
        self.page_combo.set_active(index)

        hpanel.pack(self.page_combo)

        hpanel.pack((15, 5))

        self.orient_keeper = wal.HToggleKeeper(self,
                                               ORIENTS,
                                               ORIENTS_ICONS,
                                               ORIENTS_NAMES,
                                               on_change=self.orient_changed)
        self.orient_keeper.set_mode(self.page_format[2])
        hpanel.pack(self.orient_keeper)

        self.pack(hpanel, fill=True)

        self.pack((5, 5))

        # ---
        w, h = self.page_format[1]
        hpanel = wal.HPanel(self)
        dx = label.get_size()[0] + 10
        hpanel.pack((dx, 5))

        self.page_width = UnitSpin(self.app,
                                   hpanel,
                                   w,
                                   onchange=self.page_spin_changed)
        hpanel.pack(self.page_width)
        hpanel.pack(get_bmp(self, icons.CTX_W_ON_H), padding=5)
        self.page_height = UnitSpin(self.app,
                                    hpanel,
                                    h,
                                    onchange=self.page_spin_changed)
        hpanel.pack(self.page_height)
        hpanel.pack(StaticUnitLabel(self.app, hpanel), padding=5)
        self.page_width.set_enable(state)
        self.page_height.set_enable(state)

        self.pack(hpanel, fill=True)
        self.pack(wal.HLine(self), padding_all=5, fill=True)

        # ---
        hpanel = wal.HPanel(self)
        hpanel.pack((5, 5))
        self.desktop_bg = self.doc.methods.get_desktop_bg()

        grid = wal.GridPanel(hpanel, 3, 3, 5, 5)
        grid.add_growable_col(2)

        grid.pack(wal.Label(hpanel, _('Desktop:')))
        self.desktop_color_btn = wal.ColorButton(hpanel, self.desktop_bg)
        grid.pack(self.desktop_color_btn)
        grid.pack(CBMiniPalette(grid,
                                onclick=self.desktop_color_btn.set_value))

        self.page_fill = self.doc.methods.get_page_fill()
        if self.page_fill[0] == FILL_SOLID:
            color1 = self.page_fill[1]
            color2 = [1.0, 1.0, 1.0]
        else:
            color1 = self.page_fill[1][0]
            color2 = self.page_fill[1][1]

        grid.pack(wal.Label(hpanel, _('Page:')))
        self.page_color1_btn = wal.ColorButton(hpanel, color1)
        grid.pack(self.page_color1_btn)
        grid.pack(CBMiniPalette(grid, onclick=self.page_color1_btn.set_value))

        grid.pack((5, 5))
        self.page_color2_btn = wal.ColorButton(hpanel, color2)
        grid.pack(self.page_color2_btn)
        self.colors2 = CBMiniPalette(grid,
                                     onclick=self.page_color2_btn.set_value)
        grid.pack(self.colors2)
        if not self.page_fill[0] == FILL_PATTERN:
            self.page_color2_btn.set_enable(False)
            self.colors2.set_enable(False)

        hpanel.pack(grid, fill=True)
        hpanel.pack((5, 5))
        self.pack(hpanel, fill=True)

        # ---
        vpanel = wal.VPanel(self)
        if wal.IS_MSW: vpanel.pack((5, 5))

        self.pattern_check = wal.Checkbox(vpanel,
                                          _('Use pattern for page fill'),
                                          self.page_fill[0] == FILL_PATTERN,
                                          onclick=self.pattern_check_changed)
        vpanel.pack(self.pattern_check, align_center=False)

        if wal.IS_MSW: vpanel.pack((5, 5))

        self.border_flag = self.doc.methods.get_page_border()
        self.border_check = wal.Checkbox(vpanel, _('Show page border'),
                                         self.border_flag)
        vpanel.pack(self.border_check, align_center=False)
        self.pack(vpanel, fill=True, padding_all=5)