Exemplo n.º 1
0
 def build_widgets(self, master, row, build_entry = 1):
     self.init_var()
     Parameter.build_widgets(self, master, row)
     if build_entry:
         entry = MyEntry(master, textvariable = self.var, justify = RIGHT,
                         width = 6, command = self.var_changed)
         entry.grid(row = row, column = 1, sticky = 'ew')
         min, max = self.range
         scroll = MiniScroller(master, variable = self.var,
                               min = min, max = max, step = 1)
         scroll.grid(row = row, column = 2, sticky = 'news')
Exemplo n.º 2
0
    def build_widgets(self, master, row, build_entry = 1):
	self.init_var()
	Parameter.build_widgets(self, master, row)
	if build_entry:
	    entry = MyEntry(master, textvariable = self.var, justify = RIGHT,
			    width = 6, command = self.var_changed)
	    entry.grid(row = row, column = 1, sticky = 'ew')
	    min, max = self.range
	    scroll = MiniScroller(master, variable = self.var,
				  min = min, max = max, step = 1)
	    scroll.grid(row = row, column = 2, sticky = 'news')
Exemplo n.º 3
0
    def build_dlg(self):
	top = self.top

	var_number = DoubleVar(top)
	var_unit = StringVar(top)
	self.var_pos = LengthVar(1.0, config.preferences.default_unit,
                                 var_number, var_unit, command = self.set_pos)
	pos_frame = Frame(top)
	pos_frame.pack(side = TOP, fill = X, expand = 0)
	self.var_label = StringVar(top)
	self.var_label.set('X:')
	label = Label(pos_frame, textvariable = self.var_label)
	label.pack(side = LEFT, expand = 1, anchor = E)
	entry = MyEntry(pos_frame, textvariable = var_number,
			justify = RIGHT, width = 4,
			command = self.var_pos.UpdateNumber)
	entry.pack(side = LEFT, expand = 1, fill = X, anchor = E)
	scroll = MiniScroller(pos_frame, variable = var_number,
			      min = 0, max = None, step = 1)
	scroll.pack(side = LEFT, fill = Y)
	optmenu = create_unit_menu(pos_frame, self.set_unit,
				   variable = var_unit,
				   indicatoron = 0, width = 3)
	optmenu.pack(side = LEFT, expand = 1, fill = X, anchor = W)

	list_frame = Frame(top)
	list_frame.pack(side = TOP, expand = 1, fill = BOTH)

	sb_vert = Scrollbar(list_frame, takefocus = 0)
	sb_vert.pack(side = RIGHT, fill = Y)
	guides = UpdatedListbox(list_frame, name = 'list')
	guides.pack(expand = 1, fill = BOTH)
	guides.Subscribe(SELECTION, self.select_guide)
	sb_vert['command'] = (guides, 'yview')
	guides['yscrollcommand'] = (sb_vert, 'set')
	self.guides = guides
	self.selected = None

	frame = Frame(top)
	frame.pack(side = BOTTOM, fill = X)
	button = UpdatedButton(frame, text = _("Add H"),
			       command = self.add_guide, args = 1)
	button.pack(side = LEFT)
	button = UpdatedButton(frame, text = _("Add V"),
			       command = self.add_guide, args = 0)
	button.pack(side = LEFT)
	button = UpdatedButton(frame, text = _("Delete"),
			       command = self.del_guide)
	button.pack(side = LEFT)
	button = UpdatedButton(frame, text = _("Close"),
			       command = self.close_dlg)
	button.pack(side = RIGHT)
Exemplo n.º 4
0
    def __init__(self, master=None, **kw):
	apply(PatternFrame.__init__, (self, master), kw)

	gradient = CreateSimpleGradient(StandardColors.white,
					StandardColors.black)
	frame = Frame(self)
	frame.pack(side = TOP, fill = X)
	self.var_gradient_type = IntVar(self)
	for value, bitmap in [(0, 'linear'), (1, 'conical'), (2, 'radial')]:
	    bitmap = getattr(pixmaps, 'gradient_' + bitmap)
	    button = make_button(frame, bitmap = bitmap, value = value,
				 variable = self.var_gradient_type,
				 command = self.choose_type)
	    button.pack(side = LEFT, fill = X, expand = 1)

	frame = Frame(self)
	frame.pack(side = TOP, expand = 1, fill = X)
	self.colors = [None, None]
	self.colors[0] = ColorButton(frame, height = 1,
				     color = gradient.StartColor(),
				     command = self.set_color, args = 0)
	self.colors[0].pack(side = LEFT, fill = X, expand = 1)
	self.colors[1] =  ColorButton(frame, height = 1,
				      color = gradient.EndColor(),
				      command = self.set_color, args = 1)
	self.colors[1].pack(side = LEFT, fill = X, expand = 1)

	self.var_border = DoubleVar(self)
	self.var_border.set(0.0)
	frame = Frame(self)
	frame.pack(side = TOP, fill = X, expand = 1)
	label = Label(frame, text = _("Border"))
	label.pack(side = LEFT, expand = 1, anchor = E)
	entry = MyEntry(frame, textvariable = self.var_border, width = 4,
			justify = RIGHT, command = self.set_border)
	entry.pack(side = LEFT, expand = 1, fill = X)
	scroll = MiniScroller(frame, variable = self.var_border,
			      min = 0.0, max = 100.0, step = 1.0,
			      command = self.set_border)
	scroll.pack(side = LEFT, fill = Y)

	button = UpdatedButton(self, text = _("Edit Gradient"),
			       command = self.edit_gradient)
	button.pack(side = TOP, fill = X)

	pattern = LinearGradient(gradient)
	self.SetPattern(pattern)
Exemplo n.º 5
0
    def __init__(self, master=None, **kw):
        apply(PatternFrame.__init__, (self, master), kw)

        gradient = CreateSimpleGradient(StandardColors.white,
                                        StandardColors.black)
        frame = Frame(self)
        frame.pack(side = TOP, fill = X)
        self.var_gradient_type = IntVar(self)
        for value, bitmap in [(0, 'linear'), (1, 'conical'), (2, 'radial')]:
            bitmap = getattr(pixmaps, 'gradient_' + bitmap)
            button = make_button(frame, bitmap = bitmap, value = value,
                                 variable = self.var_gradient_type,
                                 command = self.choose_type)
            button.pack(side = LEFT, fill = X, expand = 1)

        frame = Frame(self)
        frame.pack(side = TOP, expand = 1, fill = X)
        self.colors = [None, None]
        self.colors[0] = ColorButton(frame, height = 1,
                                     color = gradient.StartColor(),
                                     command = self.set_color, args = 0)
        self.colors[0].pack(side = LEFT, fill = X, expand = 1)
        self.colors[1] =  ColorButton(frame, height = 1,
                                      color = gradient.EndColor(),
                                      command = self.set_color, args = 1)
        self.colors[1].pack(side = LEFT, fill = X, expand = 1)

        self.var_border = DoubleVar(self)
        self.var_border.set(0.0)
        frame = Frame(self)
        frame.pack(side = TOP, fill = X, expand = 1)
        label = Label(frame, text = _("Border"))
        label.pack(side = LEFT, expand = 1, anchor = E)
        entry = MyEntry(frame, textvariable = self.var_border, width = 4,
                        justify = RIGHT, command = self.set_border)
        entry.pack(side = LEFT, expand = 1, fill = X)
        scroll = MiniScroller(frame, variable = self.var_border,
                              min = 0.0, max = 100.0, step = 1.0,
                              command = self.set_border)
        scroll.pack(side = LEFT, fill = Y)

        button = UpdatedButton(self, text = _("Edit Gradient"),
                               command = self.edit_gradient)
        button.pack(side = TOP, fill = X)

        pattern = LinearGradient(gradient)
        self.SetPattern(pattern)
Exemplo n.º 6
0
    def build_dlg(self):
        top = self.top

        button_frame = Frame(top)
        button_frame.pack(side = BOTTOM, fill = BOTH, expand = 1)

        self.update_buttons = []
        button = UpdatedButton(top, text = _("Apply"),
                               command = self.apply_blend,
                               sensitivecb = self.doc_can_blend)
        button.pack(in_ = button_frame, side = LEFT, expand = 1, fill = X)
        self.Subscribe(SELECTION, button.Update)

        button = UpdatedButton(top, text = _("Close"),
                               command = self.close_dlg)
        button.pack(in_ = button_frame, side = RIGHT, expand = 1, fill = X)

        steps_frame = Frame(top, relief = GROOVE, bd = 2)
        steps_frame.pack(side = TOP, fill = X, expand = 1)
        label = Label(steps_frame, text = _("Steps"))
        label.pack(side = LEFT, anchor = E)
        self.var_steps = IntVar(top)
        self.var_steps.set(config.preferences.blend_panel_default_steps)
        self.entry = MyEntry(steps_frame, name = 'steps',
                             textvariable = self.var_steps,
                             command = self.apply_blend)
        self.entry.pack(side = LEFT, expand = 1, fill = X, anchor = E)
        scroll = MiniScroller(steps_frame, variable = self.var_steps,
                              min = 2, max = None, step = 1)
        scroll.pack(side = LEFT, fill = Y)

        button = UpdatedButton(top, text = _("Select Start"),
                               sensitivecb = self.can_select,
                               command = self.select_control,
                               args = SelectStart)
        button.pack(side = BOTTOM, fill = X, expand = 1)
        self.Subscribe(SELECTION, button.Update)

        button = UpdatedButton(top, text = _("Select End"),
                               sensitivecb = self.can_select,
                               command = self.select_control,
                               args = SelectEnd)
        button.pack(side = BOTTOM, fill = X, expand = 1)
        self.Subscribe(SELECTION, button.Update)
Exemplo n.º 7
0
    def build_dlg(self):
	top = self.top

	button_frame = Frame(top)
	button_frame.pack(side = BOTTOM, fill = BOTH, expand = 1)

	self.update_buttons = []
	button = UpdatedButton(top, text = _("Apply"),
			       command = self.apply_blend,
			       sensitivecb = self.doc_can_blend)
	button.pack(in_ = button_frame, side = LEFT, expand = 1, fill = X)
	self.Subscribe(SELECTION, button.Update)

	button = UpdatedButton(top, text = _("Close"),
			       command = self.close_dlg)
	button.pack(in_ = button_frame, side = RIGHT, expand = 1, fill = X)

	steps_frame = Frame(top, relief = GROOVE, bd = 2)
	steps_frame.pack(side = TOP, fill = X, expand = 1)
	label = Label(steps_frame, text = _("Steps"))
	label.pack(side = LEFT, anchor = E)
	self.var_steps = IntVar(top)
	self.var_steps.set(config.preferences.blend_panel_default_steps)
	self.entry = MyEntry(steps_frame, name = 'steps',
                             textvariable = self.var_steps,
			     command = self.apply_blend)
	self.entry.pack(side = LEFT, expand = 1, fill = X, anchor = E)
	scroll = MiniScroller(steps_frame, variable = self.var_steps,
			      min = 2, max = None, step = 1)
	scroll.pack(side = LEFT, fill = Y)

	button = UpdatedButton(top, text = _("Select Start"),
			       sensitivecb = self.can_select,
			       command = self.select_control,
			       args = SelectStart)
	button.pack(side = BOTTOM, fill = X, expand = 1)
	self.Subscribe(SELECTION, button.Update)

	button = UpdatedButton(top, text = _("Select End"),
			       sensitivecb = self.can_select,
			       command = self.select_control,
			       args = SelectEnd)
	button.pack(side = BOTTOM, fill = X, expand = 1)
	self.Subscribe(SELECTION, button.Update)
Exemplo n.º 8
0
    def __init__(self, master=None, **kw):
	apply(PatternFrame.__init__, (self, master), kw)

	frame = Frame(self)
	frame.pack(side = TOP, fill = X, expand = 1)
	self.colors = [None, None]
	self.colors[0] = ColorButton(frame, height = 1,
				     command = self.set_color, args = 0)
	self.colors[0].pack(side = LEFT, fill = X, expand = 1)
	self.colors[1] = ColorButton(frame, height = 1,
				     command = self.set_color, args = 1)
	self.colors[1].pack(side = LEFT, fill = X, expand = 1)

	var_spacing_number = DoubleVar(self)
	var_unit = StringVar(self)
	self.var_spacing = LengthVar(1.0, config.preferences.default_unit,
                                     var_spacing_number, var_unit,
                                     command = self.set_spacing)
	width_frame = Frame(self)
	width_frame.pack(side = TOP, fill = X, expand = 1)
	#label = Label(width_frame, text = 'Spacing')
	#label.pack(side = LEFT, expand = 1, anchor = E)
	entry = MyEntry(width_frame, textvariable = var_spacing_number,
			justify = RIGHT, width = 6,
			command = self.var_spacing.UpdateNumber)
	entry.pack(side = LEFT, expand = 1, fill = X)
	scroll = MiniScroller(width_frame, variable = var_spacing_number,
			      min = 0.0, max = None, step = 1.0,
			      command = self.var_spacing.UpdateNumber)
	scroll.pack(side = LEFT, fill = Y)
	optmenu = create_unit_menu(width_frame, self.var_spacing.UpdateUnit,
				   variable = var_unit,
				   indicatoron = 0, width = 3)
	optmenu.pack(side = LEFT, expand = 1, fill = X, anchor = W)

	self.SetPattern(HatchingPattern(StandardColors.red))
Exemplo n.º 9
0
    def __init__(self, master=None, **kw):
        apply(PatternFrame.__init__, (self, master), kw)

        frame = Frame(self)
        frame.pack(side = TOP, fill = X, expand = 1)
        self.colors = [None, None]
        self.colors[0] = ColorButton(frame, height = 1,
                                     command = self.set_color, args = 0)
        self.colors[0].pack(side = LEFT, fill = X, expand = 1)
        self.colors[1] = ColorButton(frame, height = 1,
                                     command = self.set_color, args = 1)
        self.colors[1].pack(side = LEFT, fill = X, expand = 1)

        var_spacing_number = DoubleVar(self)
        var_unit = StringVar(self)
        self.var_spacing = LengthVar(1.0, config.preferences.default_unit,
                                     var_spacing_number, var_unit,
                                     command = self.set_spacing)
        width_frame = Frame(self)
        width_frame.pack(side = TOP, fill = X, expand = 1)
        #label = Label(width_frame, text = 'Spacing')
        #label.pack(side = LEFT, expand = 1, anchor = E)
        entry = MyEntry(width_frame, textvariable = var_spacing_number,
                        justify = RIGHT, width = 6,
                        command = self.var_spacing.UpdateNumber)
        entry.pack(side = LEFT, expand = 1, fill = X)
        scroll = MiniScroller(width_frame, variable = var_spacing_number,
                              min = 0.0, max = None, step = 1.0,
                              command = self.var_spacing.UpdateNumber)
        scroll.pack(side = LEFT, fill = Y)
        optmenu = create_unit_menu(width_frame, self.var_spacing.UpdateUnit,
                                   variable = var_unit,
                                   indicatoron = 0, width = 3)
        optmenu.pack(side = LEFT, expand = 1, fill = X, anchor = W)

        self.SetPattern(HatchingPattern(StandardColors.red))
Exemplo n.º 10
0
def create_length_widgets(top, master, command, default_unit=None):
    var_number = DoubleVar(top)
    var_unit = StringVar(top)
    if default_unit is None:
        default_unit = config.preferences.default_unit
    var_length = LengthVar(1.0,
                           default_unit,
                           var_number,
                           var_unit,
                           command=command)
    entry = MyEntry(master,
                    textvariable=var_number,
                    justify=RIGHT,
                    width=6,
                    command=var_length.UpdateNumber)
    scroll = MiniScroller(master, variable=var_number, min=0, max=None, step=1)
    optmenu = create_unit_menu(master,
                               var_length.UpdateUnit,
                               variable=var_unit,
                               indicatoron=0,
                               width=3)
    return var_length, entry, scroll, optmenu
Exemplo n.º 11
0
    def build_dlg(self):
        top = self.top

        buttons = self.create_std_buttons(top)
        buttons.grid(row=3, column=4, columnspan=2, sticky="news")

        self.sample = FontPreview(top)
        self.sample.grid(column=0, row=3, columnspan=4, sticky="news")
        # XXX: the background color of the sample text should be
        # configurable

        label = Label(top, text=_("Font Family:"), anchor=W)
        label.grid(column=0, row=0, columnspan=2, sticky="ew")
        sb_vert = Scrollbar(top, takefocus=0)
        sb_vert.grid(column=1, row=1, rowspan=2, sticky="news")
        family_list = UpdatedListbox(top, name='families', height=8)
        family_list.grid(column=0, row=1, rowspan=2, sticky="news")
        family_list.Subscribe(SELECTION, self.family_selected)
        sb_vert['command'] = (family_list, 'yview')
        family_list['yscrollcommand'] = (sb_vert, 'set')
        self.family_list = family_list

        label = Label(top, text=_("Font Style:"), anchor=W)
        label.grid(column=2, row=0, sticky="ew")
        sb_vert = Scrollbar(top, takefocus=0)
        sb_vert.grid(column=3, row=1, rowspan=2, sticky="news")
        self.font_attr_list = UpdatedListbox(top,
                                             name='weights',
                                             height=4,
                                             width=15)
        self.font_attr_list.grid(column=2, row=1, rowspan=2, sticky="news")
        self.font_attr_list.Subscribe(SELECTION, self.attr_selected)
        sb_vert['command'] = (self.font_attr_list, 'yview')
        self.font_attr_list['yscrollcommand'] = (sb_vert, 'set')

        label = Label(top, text=_("Size:"), anchor=W)
        label.grid(column=4, row=0, columnspan=2, sticky="ew")

        frame = Frame(top)
        frame.grid(column=4, row=1, columnspan=2, sticky='ew')
        self.var_size = DoubleVar(top)
        scroll = MiniScroller(frame,
                              variable=self.var_size,
                              min=0.0,
                              max=None,
                              step=1)
        scroll.pack(side=RIGHT, fill=Y)
        self.size_entry = MyEntry(frame,
                                  textvariable=self.var_size,
                                  width=4,
                                  command=self.apply_size,
                                  justify=RIGHT)
        self.size_entry.pack(side=LEFT, expand=1, fill=BOTH)

        sb_vert = Scrollbar(top, takefocus=0)
        sb_vert.grid(column=5, row=2, sticky="news")
        self.size_list = UpdatedListbox(top, name='sizes', width=4, height=5)
        self.size_list.grid(column=4, row=2, sticky="news")
        self.size_list.Subscribe(SELECTION, self.size_selected)
        self.size_list.SetList(std_sizes)
        sb_vert['command'] = (self.size_list, 'yview')
        self.size_list['yscrollcommand'] = (sb_vert, 'set')

        top.columnconfigure(0, weight=1000)
        top.columnconfigure(4, weight=1)
        top.rowconfigure(2, weight=1)
Exemplo n.º 12
0
    def build_dlg(self):
        top = self.top

        var_number = DoubleVar(top)
        var_unit = StringVar(top)
        self.var_pos = LengthVar(1.0,
                                 config.preferences.default_unit,
                                 var_number,
                                 var_unit,
                                 command=self.set_pos)
        pos_frame = Frame(top)
        pos_frame.pack(side=TOP, fill=X, expand=0)
        self.var_label = StringVar(top)
        self.var_label.set('X:')
        label = Label(pos_frame, textvariable=self.var_label)
        label.pack(side=LEFT, expand=1, anchor=E)
        entry = MyEntry(pos_frame,
                        textvariable=var_number,
                        justify=RIGHT,
                        width=4,
                        command=self.var_pos.UpdateNumber)
        entry.pack(side=LEFT, expand=1, fill=X, anchor=E)
        scroll = MiniScroller(pos_frame,
                              variable=var_number,
                              min=0,
                              max=None,
                              step=1)
        scroll.pack(side=LEFT, fill=Y)
        optmenu = create_unit_menu(pos_frame,
                                   self.set_unit,
                                   variable=var_unit,
                                   indicatoron=0,
                                   width=3)
        optmenu.pack(side=LEFT, expand=1, fill=X, anchor=W)

        list_frame = Frame(top)
        list_frame.pack(side=TOP, expand=1, fill=BOTH)

        sb_vert = Scrollbar(list_frame, takefocus=0)
        sb_vert.pack(side=RIGHT, fill=Y)
        guides = UpdatedListbox(list_frame, name='list')
        guides.pack(expand=1, fill=BOTH)
        guides.Subscribe(SELECTION, self.select_guide)
        sb_vert['command'] = (guides, 'yview')
        guides['yscrollcommand'] = (sb_vert, 'set')
        self.guides = guides
        self.selected = None

        frame = Frame(top)
        frame.pack(side=BOTTOM, fill=X)
        button = UpdatedButton(frame,
                               text=_("Add H"),
                               command=self.add_guide,
                               args=1)
        button.pack(side=LEFT)
        button = UpdatedButton(frame,
                               text=_("Add V"),
                               command=self.add_guide,
                               args=0)
        button.pack(side=LEFT)
        button = UpdatedButton(frame, text=_("Delete"), command=self.del_guide)
        button.pack(side=LEFT)
        button = UpdatedButton(frame, text=_("Close"), command=self.close_dlg)
        button.pack(side=RIGHT)
Exemplo n.º 13
0
    def build_dlg(self):
	top = self.top

	buttons = self.create_std_buttons(top)
	buttons.grid(row = 3, column = 4, columnspan = 2, sticky = "news")

	self.sample_text = StringVar(top)
	self.sample_text.set(config.preferences.sample_text)
	self.sample = Entry(top, textvariable = self.sample_text,
			    relief = FLAT, bg = top['bg'],
			    width = len(config.preferences.sample_text))
	self.sample.grid(column = 0, row = 3, columnspan = 4, sticky = "news")
	# XXX: the background color of the sample text should be
	# configurable

	label = Label(top, text = _("Font Family:"), anchor = W)
	label.grid(column = 0, row = 0, columnspan = 2, sticky = "ew")
	sb_vert = Scrollbar(top, takefocus = 0)
	sb_vert.grid(column = 1, row = 1, rowspan = 2, sticky = "news")
	family_list = UpdatedListbox(top, name = 'families', height = 8)
	family_list.grid(column = 0, row = 1, rowspan = 2, sticky = "news")
	family_list.Subscribe(SELECTION, self.family_selected)
	sb_vert['command'] = (family_list, 'yview')
	family_list['yscrollcommand'] = (sb_vert, 'set')
	self.family_list = family_list

	label = Label(top, text = _("Font Style:"), anchor = W)
	label.grid(column = 2, row = 0, sticky = "ew")
	sb_vert = Scrollbar(top, takefocus = 0)
	sb_vert.grid(column = 3, row = 1, rowspan = 2, sticky = "news")
	self.font_attr_list = UpdatedListbox(top, name = 'weights', height = 4,
					     width = 15)
	self.font_attr_list.grid(column = 2, row = 1, rowspan = 2,
				 sticky = "news")
	self.font_attr_list.Subscribe(SELECTION, self.attr_selected)
	sb_vert['command'] = (self.font_attr_list, 'yview')
	self.font_attr_list['yscrollcommand'] = (sb_vert, 'set')

	label = Label(top, text = _("Size:"), anchor = W)
	label.grid(column = 4, row = 0, columnspan = 2, sticky = "ew")

	frame = Frame(top)
	frame.grid(column = 4, row = 1, columnspan = 2, sticky = 'ew')
	self.var_size = DoubleVar(top)
	scroll = MiniScroller(frame, variable = self.var_size,
			      min = 0.0, max = None, step = 1)
	scroll.pack(side = RIGHT, fill = Y)
	self.size_entry = MyEntry(frame, textvariable = self.var_size,
				  width = 4, command = self.apply_size,
				  justify = RIGHT)
	self.size_entry.pack(side = LEFT, expand = 1, fill = BOTH)

	sb_vert = Scrollbar(top, takefocus = 0)
	sb_vert.grid(column = 5, row = 2, sticky = "news")
	self.size_list = UpdatedListbox(top, name = 'sizes', width = 4,
					height = 5)
	self.size_list.grid(column = 4, row = 2, sticky = "news")
	self.size_list.Subscribe(SELECTION, self.size_selected)
	self.size_list.SetList(std_sizes)
	sb_vert['command'] = (self.size_list, 'yview')
	self.size_list['yscrollcommand'] = (sb_vert, 'set')

	top.columnconfigure(0, weight = 1000)
	top.columnconfigure(4, weight = 1)
	top.rowconfigure(2, weight = 1)