Exemplo n.º 1
0
    def build_dlg(self):
        top = self.top

        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)
        module_list = UpdatedListbox(list_frame, name="list")
        module_list.pack(expand=1, fill=BOTH)
        module_list.Subscribe(COMMAND, self.do_reload)
        sb_vert["command"] = (module_list, "yview")
        module_list["yscrollcommand"] = (sb_vert, "set")
        self.module_list = module_list

        frame = Frame(top)
        frame.pack(side=BOTTOM, fill=X)
        for text, cmd in [
            ("Reload Module", self.do_reload),
            ("Update List", self.update_list),
            ("Close", self.close_dlg),
        ]:
            button = UpdatedButton(frame, text=text, command=cmd)
            button.pack(side=TOP, fill=X, expand=1)

        self.update_list()
Exemplo n.º 2
0
    def create_std_buttons(self, master):
	frame = Frame(master)

	button = UpdatedButton(frame, text = _("Apply"),
			       command = self.do_apply,
			       sensitivecb = self.can_apply)
	button.pack(side = LEFT, expand = 1, fill = X)
	button = UpdatedButton(frame, text = _("Close"),
			       command = self.close_dlg)
	button.pack(side = RIGHT, expand = 1, fill = X)

	return frame
Exemplo n.º 3
0
    def create_std_buttons(self, master):
        frame = Frame(master)

        button = UpdatedButton(frame,
                               text=_("Apply"),
                               command=self.do_apply,
                               sensitivecb=self.can_apply)
        button.pack(side=LEFT, expand=1, fill=X)
        button = UpdatedButton(frame, text=_("Close"), command=self.close_dlg)
        button.pack(side=RIGHT, expand=1, fill=X)

        return frame
Exemplo n.º 4
0
    def build_dlg(self):
	top = self.top

	frame = Frame(top)
	frame.pack(side = BOTTOM, fill = X)
	button = UpdatedButton(frame, bitmap = pixmaps.LayerNew, name = 'new',
			       command = self.new_layer)
	button.pack(side = LEFT, fill = BOTH, expand = 1)
	button = UpdatedButton(frame, bitmap = pixmaps.LayerUp, name = 'up',
			       command = self.layer_up)
	button.pack(side = LEFT, fill = BOTH, expand = 1)
	button = UpdatedButton(frame, bitmap = pixmaps.LayerDown,
			       name = 'down', command = self.layer_down)
	button.pack(side = LEFT, fill = BOTH, expand = 1)
	button = UpdatedButton(frame, text = _("Close"), name = 'close',
			       command = self.close_dlg)
	button.pack(side = LEFT, fill = BOTH, expand = 1)

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

	sb_vert = Scrollbar(list_frame, takefocus = 0)
	sb_vert.pack(side = RIGHT, fill = Y)

	self.canvas = canvas = Canvas(list_frame)
	canvas.pack(expand = 1, fill = BOTH)

	self.frame = frame = Frame(canvas, name = 'list')
	canvas.create_window(0, 0, window = frame, anchor = NW)
	sb_vert['command'] = (canvas, 'yview')
	canvas['yscrollcommand'] = (sb_vert, 'set')

	self.active_var = IntVar(top)
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 __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.º 7
0
    def __init__(self, master, main_window, **kw):
	apply(PatternFrame.__init__, (self, master), kw)
	self.main_window = main_window
	button = UpdatedButton(self, text = _("Load Image..."),
			       command = self.load_image)
	button.pack(side = TOP, fill = X)
	button = UpdatedButton(self, text = _("Pick Image..."),
			       command = self.pick_image)
	button.pack(side = TOP, fill = X)

	file = os.path.join(config.std_res_dir, config.preferences.pattern)
	try:
	    file = open(file)
	    tile = load_image(file)
	except:
	    warn_tb(INTERNAL, "Cannot load %s", file)
	    return
	self.SetPattern(ImageTilePattern(tile))
Exemplo n.º 8
0
    def __init__(self, master, main_window, **kw):
        apply(PatternFrame.__init__, (self, master), kw)
        self.main_window = main_window
        button = UpdatedButton(self, text = _("Load Image..."),
                               command = self.load_image)
        button.pack(side = TOP, fill = X)
        button = UpdatedButton(self, text = _("Pick Image..."),
                               command = self.pick_image)
        button.pack(side = TOP, fill = X)

        file = os.path.join(config.std_res_dir, config.preferences.pattern)
        try:
            file = open(file)
            tile = load_image(file)
        except:
            warn_tb(INTERNAL, "Cannot load %s", file)
            return
        self.SetPattern(ImageTilePattern(tile))
Exemplo n.º 9
0
    def build_dlg(self):
        top = self.top

        self.view = SketchView(top,
                               self.document,
                               width=200,
                               height=200,
                               background='white')
        self.view.pack(side=LEFT, fill=BOTH, expand=1)

        self.opt_format = MyOptionMenu2(top, bitmap_types)
        self.opt_format.pack(side=TOP)

        frame = Frame(top)
        frame.pack(side=TOP, expand=1, fill=X)
        label = Label(frame, text='Resolution')
        label.pack(side=LEFT)
        entry = MyEntry(frame, width=4)
        entry.pack(side=LEFT)
        label = Label(frame, text='dpi')
        label.pack(side=LEFT)

        frame = Frame(top)
        frame.pack(side=TOP, expand=1, fill=X)
        label = Label(frame, text='Size')
        label.pack(side=LEFT)
        entry = MyEntry(frame, width=4)
        entry.pack(side=LEFT)
        label = Label(frame, text='x')
        label.pack(side=LEFT)
        entry = MyEntry(frame, width=4)
        entry.pack(side=LEFT)
        label = Label(frame, text='pixel')
        label.pack(side=LEFT)

        check = UpdatedCheckbutton(top, text='antialiasing')
        check.pack(side=TOP)

        frame = Frame(top)
        frame.pack(side=TOP)
        button = UpdatedButton(frame, text='Export')
        button.pack(side=LEFT)
        button = UpdatedButton(frame, text='Close', command=self.close_dlg)
        button.pack(side=LEFT)
Exemplo n.º 10
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.º 11
0
    def build_dlg(self):
	top = self.top

	self.view = SketchView(top, self.document, width = 200, height = 200,
			       background = 'white')
	self.view.pack(side = LEFT, fill = BOTH, expand = 1)

	self.opt_format = MyOptionMenu2(top, bitmap_types)
	self.opt_format.pack(side = TOP)

	frame = Frame(top)
	frame.pack(side = TOP, expand = 1, fill = X)
	label = Label(frame, text = 'Resolution')
	label.pack(side = LEFT)
	entry = MyEntry(frame, width = 4)
	entry.pack(side = LEFT)
	label = Label(frame, text = 'dpi')
	label.pack(side = LEFT)

	frame = Frame(top)
	frame.pack(side = TOP, expand = 1, fill = X)
	label = Label(frame, text = 'Size')
	label.pack(side = LEFT)
	entry = MyEntry(frame, width = 4)
	entry.pack(side = LEFT)
	label = Label(frame, text = 'x')
	label.pack(side = LEFT)
	entry = MyEntry(frame, width = 4)
	entry.pack(side = LEFT)
	label = Label(frame, text = 'pixel')
	label.pack(side = LEFT)

	check = UpdatedCheckbutton(top, text = 'antialiasing')
	check.pack(side = TOP)

	frame = Frame(top)
	frame.pack(side =TOP)
	button = UpdatedButton(frame, text = 'Export')
	button.pack(side = LEFT)
	button = UpdatedButton(frame, text = 'Close', command = self.close_dlg)
	button.pack(side = LEFT)
Exemplo n.º 12
0
    def build_dlg(self):
	top = self.top

	button = UpdatedButton(top, text = _("Close"), name = 'close',
				       command = self.close_dlg)
	button.pack(side = BOTTOM, expand = 0, fill = X)
	button = UpdatedButton(top, text = _("Apply"),
			       command = self.apply_style,
			       sensitivecb = self.can_apply)
	button.pack(side = BOTTOM, expand = 0, fill = X)
	self.Subscribe(SELECTION, button.Update)

	button = UpdatedButton(top, text = _("Delete"),
			       command = self.remove_style,
			       sensitivecb = self.can_remove)
	button.pack(side = BOTTOM, expand = 0, fill = X)

	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)
	styles = UpdatedListbox(list_frame, name = 'list')
	styles.pack(expand = 1, fill = BOTH)
	styles.Subscribe(COMMAND, self.apply_style)
	sb_vert['command'] = (styles, 'yview')
	styles['yscrollcommand'] = (sb_vert, 'set')
	self.styles = styles
Exemplo n.º 13
0
    def build_dlg(self):
        top = self.top

        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)
        module_list = UpdatedListbox(list_frame, name='list')
        module_list.pack(expand=1, fill=BOTH)
        module_list.Subscribe(COMMAND, self.do_reload)
        sb_vert['command'] = (module_list, 'yview')
        module_list['yscrollcommand'] = (sb_vert, 'set')
        self.module_list = module_list

        frame = Frame(top)
        frame.pack(side=BOTTOM, fill=X)
        for text, cmd in [('Reload Module', self.do_reload),
                          ('Update List', self.update_list),
                          ('Close', self.close_dlg)]:
            button = UpdatedButton(frame, text=text, command=cmd)
            button.pack(side=TOP, fill=X, expand=1)

        self.update_list()
Exemplo n.º 14
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.º 15
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.º 16
0
    def build_dlg(self):
        top = self.top

        frame = Frame(top)
        frame.pack(side=BOTTOM, fill=X)
        button = UpdatedButton(frame,
                               bitmap=pixmaps.LayerNew,
                               name='new',
                               command=self.new_layer)
        button.pack(side=LEFT, fill=BOTH, expand=1)
        button = UpdatedButton(frame,
                               bitmap=pixmaps.LayerUp,
                               name='up',
                               command=self.layer_up)
        button.pack(side=LEFT, fill=BOTH, expand=1)
        button = UpdatedButton(frame,
                               bitmap=pixmaps.LayerDown,
                               name='down',
                               command=self.layer_down)
        button.pack(side=LEFT, fill=BOTH, expand=1)
        button = UpdatedButton(frame,
                               text=_("Close"),
                               name='close',
                               command=self.close_dlg)
        button.pack(side=LEFT, fill=BOTH, expand=1)

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

        sb_vert = Scrollbar(list_frame, takefocus=0)
        sb_vert.pack(side=RIGHT, fill=Y)

        self.canvas = canvas = Canvas(list_frame)
        canvas.pack(expand=1, fill=BOTH)

        self.frame = frame = Frame(canvas, name='list')
        canvas.create_window(0, 0, window=frame, anchor=NW)
        sb_vert['command'] = (canvas, 'yview')
        canvas['yscrollcommand'] = (sb_vert, 'set')

        self.active_var = IntVar(top)
Exemplo n.º 17
0
    def build_dlg(self):
        top = self.top

        #
        #	Undo
        #

        undo_frame = self.make_frame()
        label = Label(undo_frame, text=_("# Undo Levels:"), anchor=E)
        label.pack(side=LEFT, expand=1, fill=X)

        self.var_undo = IntVar(top)
        self.undo_entry = Entry(undo_frame,
                                textvariable=self.var_undo,
                                width=4)
        self.undo_entry.pack(side=LEFT)
        self.var_unlimited = IntVar(top)
        check = UpdatedCheckbutton(undo_frame,
                                   text=_("unlimited"),
                                   variable=self.var_unlimited,
                                   command=self.unlimited_undo)
        check.pack(side=RIGHT, expand=1, anchor=W)
        limit = preferences.undo_limit
        if limit == None:
            self.var_undo.set(10)
            self.var_unlimited.set(1)
        else:
            if limit < 0:
                limit = 0
            self.var_undo.set(limit)
            self.var_unlimited.set(0)

        #
        #	Duplication
        #

        off_frame = self.make_frame()
        var_off_x_number = DoubleVar(top)
        var_off_y_number = DoubleVar(top)
        var_off_x_unit = StringVar(top)
        var_off_y_unit = StringVar(top)
        x, y = preferences.duplicate_offset
        unit = config.preferences.default_unit
        self.var_off_x = LengthVar(x, unit, var_off_x_number, var_off_x_unit)
        self.var_off_y = LengthVar(y, unit, var_off_y_number, var_off_y_unit)
        label = Label(off_frame, text=_("Duplication Offset"))
        label.pack(side=TOP, anchor=W)
        label = Label(off_frame, text=_("Hor."))
        label.pack(side=LEFT, expand=1, anchor=E)
        entry = MyEntry(off_frame,
                        textvariable=var_off_x_number,
                        width=6,
                        command=self.var_off_x.UpdateNumber)
        entry.pack(side=LEFT, fill=X, anchor=E)
        label = Label(off_frame, text=_("Vert."))
        label.pack(side=LEFT, anchor=E)
        entry = MyEntry(off_frame,
                        textvariable=var_off_y_number,
                        width=6,
                        command=self.var_off_y.UpdateNumber)
        entry.pack(side=LEFT, fill=X, anchor=E)

        def CallBoth(arg, x=self.var_off_x, y=self.var_off_y):
            x.UpdateUnit(arg)
            y.UpdateUnit(arg)

        optmenu = create_unit_menu(off_frame,
                                   CallBoth,
                                   variable=var_off_x_unit,
                                   indicatoron=0,
                                   width=3)
        optmenu.pack(side=LEFT, expand=1, anchor=W)

        #
        #       Default Unit
        #

        self.default_unit = config.preferences.default_unit
        frame = self.make_frame()
        label = Label(frame, text=_("Default Unit"))
        label.pack(side=LEFT, expand=1)
        menu = create_unit_menu(frame,
                                self.set_unit,
                                indicatoron=0,
                                width=3,
                                text=self.default_unit)
        menu.pack(side=RIGHT, expand=1)

        #
        #	Gradient Patterns
        #

        #self.var_steps = IntVar(top)
        #self.var_steps.set(preferences.gradient_steps)
        #frame = self.make_frame()
        #label = Label(frame, text = 'Gradient Steps')

        #
        #	Standard Buttons (OK, Cancel)
        #

        but_frame = Frame(top)
        but_frame.pack(side=BOTTOM, fill=BOTH, expand=1, padx=4, pady=4)
        button = UpdatedButton(but_frame, text=_("OK"), command=self.ok)
        button.pack(side=LEFT, expand=1)
        button = UpdatedButton(but_frame,
                               text=_("Cancel"),
                               command=self.close_dlg)
        button.pack(side=RIGHT, expand=1)
Exemplo n.º 18
0
    def build_dlg(self):
        top = self.top

        format_frame = Frame(top)
        format_frame.pack(side = TOP, expand = 1, fill = X,
                          padx = 4, pady = 4)
        format_label = Label(format_frame, text = _("Paper format:"))
        format_label.pack(side = LEFT, expand = 1, fill = X)

        format_names = map(lambda t: t[0], PapersizesList)
        format_names.append(USER_SPECIFIC)
        self.var_format_name = StringVar(top)
        format_menu = MyOptionMenu(format_frame, format_names,
                                   variable = self.var_format_name,
                                   command = self.choose_format)
        format_menu.configure(width = max(map(len, format_names)))
        format_menu.pack(side = RIGHT, expand = 1, fill = X)

        orientation_frame = Frame(top)
        orientation_frame.pack(side = TOP, expand = 1, fill = X)
        self.var_orientation = IntVar(top)
        radio = UpdatedRadiobutton(orientation_frame, text = _("Portrait"),
                                   variable = self.var_orientation,
                                   value = Portrait,
                                   command = self.choose_orientation)
        radio.pack(side = LEFT, expand = 1, fill = X)
        radio = UpdatedRadiobutton(orientation_frame, text = _("Landscape"),
                                   variable = self.var_orientation,
                                   value = Landscape,
                                   command = self.choose_orientation)
        radio.pack(side = RIGHT, expand = 1, fill = X)

        size_frame = Frame(top)
        size_frame.pack(side = TOP, fill = X, expand = 1, padx = 4, pady = 4)
        var_width_number = DoubleVar(top)
        var_height_number = DoubleVar(top)
        var_width_unit = StringVar(top)
        var_height_unit = StringVar(top)
        unit = config.preferences.default_unit
        self.var_width = LengthVar(10, unit, var_width_number, var_width_unit)
        self.var_height = LengthVar(10, unit,var_height_number,var_height_unit)
        label = Label(size_frame, text = _("Page size:"))
        label.pack(side = TOP, anchor = W)
        label = Label(size_frame, text = _("Width"))
        label.pack(side = LEFT, anchor = E)
        self.widthentry = MyEntry(size_frame, textvariable = var_width_number,
                                  command = self.var_width.UpdateNumber,
                                  width = 6)
        self.widthentry.pack(side = LEFT, expand = 1, fill = X, anchor = E)
        label = Label(size_frame, text = _("Height"))
        label.pack(side = LEFT, anchor = E)
        self.heightentry = MyEntry(size_frame, textvariable =var_height_number,
                                   command = self.var_height.UpdateNumber,
                                   width = 6)
        self.heightentry.pack(side = LEFT, expand = 1, fill = X, anchor = E)

        def CallBoth(arg, x = self.var_width, y = self.var_height):
            x.UpdateUnit(arg)
            y.UpdateUnit(arg)

        optmenu = create_unit_menu(size_frame, CallBoth,
                                   variable = var_width_unit,
                                   indicatoron = 0, width = 3)
        optmenu.pack(side = LEFT, expand = 1, fill = X, anchor = W)



        button_frame = Frame(top)
        button_frame.pack(side = BOTTOM, fill = BOTH, expand = 1,
                          padx = 4, pady = 4)
        button = UpdatedButton(button_frame, text = _("Apply"),
                               command = self.apply_settings)
        button.pack(side = LEFT, expand = 1)
        button = UpdatedButton(button_frame, text = _("Close"),
                               command = self.close_dlg)
        button.pack(side = RIGHT, expand = 1)
Exemplo n.º 19
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.º 20
0
    def build_dlg(self):
	top = self.top

	#
	#	Undo
	#

	undo_frame = self.make_frame()
	label = Label(undo_frame, text = _("# Undo Levels:"), anchor = E)
	label.pack(side = LEFT, expand = 1, fill = X)

	self.var_undo = IntVar(top)
	self.undo_entry = Entry(undo_frame, textvariable = self.var_undo,
				width = 4)
	self.undo_entry.pack(side = LEFT)
	self.var_unlimited = IntVar(top)
	check = UpdatedCheckbutton(undo_frame,
				   text = _("unlimited"),
				   variable = self.var_unlimited,
				   command = self.unlimited_undo)
	check.pack(side = RIGHT, expand = 1, anchor = W)
	limit = preferences.undo_limit
	if limit == None:
	    self.var_undo.set(10)
	    self.var_unlimited.set(1)
	else:
	    if limit < 0:
		limit = 0
	    self.var_undo.set(limit)
	    self.var_unlimited.set(0)


	#
	#	Duplication
	#

	off_frame = self.make_frame()
	var_off_x_number = DoubleVar(top)
	var_off_y_number = DoubleVar(top)
	var_off_x_unit = StringVar(top)
	var_off_y_unit = StringVar(top)
	x, y = preferences.duplicate_offset
        unit = config.preferences.default_unit
	self.var_off_x = LengthVar(x, unit, var_off_x_number, var_off_x_unit)
	self.var_off_y = LengthVar(y, unit, var_off_y_number, var_off_y_unit)
	label = Label(off_frame, text = _("Duplication Offset"))
	label.pack(side = TOP, anchor = W)
	label = Label(off_frame, text = _("Hor."))
	label.pack(side = LEFT, expand = 1, anchor = E)
	entry = MyEntry(off_frame, textvariable = var_off_x_number,
			width = 6, command = self.var_off_x.UpdateNumber)
	entry.pack(side = LEFT, fill = X, anchor = E)
	label = Label(off_frame, text = _("Vert."))
	label.pack(side = LEFT, anchor = E)
	entry = MyEntry(off_frame, textvariable = var_off_y_number,
			width = 6, command = self.var_off_y.UpdateNumber)
	entry.pack(side = LEFT, fill = X, anchor = E)

	def CallBoth(arg, x = self.var_off_x, y = self.var_off_y):
	    x.UpdateUnit(arg)
	    y.UpdateUnit(arg)

	optmenu = create_unit_menu(off_frame, CallBoth,
				   variable = var_off_x_unit,
				   indicatoron = 0, width = 3)
	optmenu.pack(side = LEFT, expand = 1, anchor = W)

        #
        #       Default Unit
        #

        self.default_unit = config.preferences.default_unit
        frame = self.make_frame()
        label = Label(frame, text = _("Default Unit"))
        label.pack(side = LEFT, expand = 1)
        menu = create_unit_menu(frame, self.set_unit, indicatoron = 0,
                                width = 3, text = self.default_unit)
        menu.pack(side = RIGHT, expand = 1)


	#
	#	Gradient Patterns
	#

	#self.var_steps = IntVar(top)
	#self.var_steps.set(preferences.gradient_steps)
	#frame = self.make_frame()
	#label = Label(frame, text = 'Gradient Steps')


	#
	#	Standard Buttons (OK, Cancel)
	#

	but_frame = Frame(top)
	but_frame.pack(side = BOTTOM, fill = BOTH, expand = 1,
		       padx = 4, pady = 4)
	button = UpdatedButton(but_frame, text = _("OK"), command = self.ok)
	button.pack(side = LEFT, expand = 1)
	button = UpdatedButton(but_frame, text = _("Cancel"),
			       command = self.close_dlg)
	button.pack(side = RIGHT, expand = 1)
Exemplo n.º 21
0
    def build_dlg(self):
	top = self.top

	format_frame = Frame(top)
	format_frame.pack(side = TOP, expand = 1, fill = X,
			  padx = 4, pady = 4)
	format_label = Label(format_frame, text = _("Paper format:"))
	format_label.pack(side = LEFT, expand = 1, fill = X)

	format_names = map(lambda t: t[0], PapersizesList)
	format_names.append(USER_SPECIFIC)
	self.var_format_name = StringVar(top)
	format_menu = MyOptionMenu(format_frame, format_names,
				   variable = self.var_format_name,
				   command = self.choose_format)
	format_menu.configure(width = max(map(len, format_names)))
	format_menu.pack(side = RIGHT, expand = 1, fill = X)

	orientation_frame = Frame(top)
	orientation_frame.pack(side = TOP, expand = 1, fill = X)
	self.var_orientation = IntVar(top)
	radio = UpdatedRadiobutton(orientation_frame, text = _("Portrait"),
				   variable = self.var_orientation,
				   value = Portrait,
				   command = self.choose_orientation)
	radio.pack(side = LEFT, expand = 1, fill = X)
	radio = UpdatedRadiobutton(orientation_frame, text = _("Landscape"),
				   variable = self.var_orientation,
				   value = Landscape,
				   command = self.choose_orientation)
	radio.pack(side = RIGHT, expand = 1, fill = X)

	size_frame = Frame(top)
	size_frame.pack(side = TOP, fill = X, expand = 1, padx = 4, pady = 4)
	var_width_number = DoubleVar(top)
	var_height_number = DoubleVar(top)
	var_width_unit = StringVar(top)
	var_height_unit = StringVar(top)
        unit = config.preferences.default_unit
	self.var_width = LengthVar(10, unit, var_width_number, var_width_unit)
	self.var_height = LengthVar(10, unit,var_height_number,var_height_unit)
	label = Label(size_frame, text = _("Page size:"))
	label.pack(side = TOP, anchor = W)
	label = Label(size_frame, text = _("Width"))
	label.pack(side = LEFT, anchor = E)
	self.widthentry = MyEntry(size_frame, textvariable = var_width_number,
				  command = self.var_width.UpdateNumber,
				  width = 6)
	self.widthentry.pack(side = LEFT, expand = 1, fill = X, anchor = E)
	label = Label(size_frame, text = _("Height"))
	label.pack(side = LEFT, anchor = E)
	self.heightentry = MyEntry(size_frame, textvariable =var_height_number,
				   command = self.var_height.UpdateNumber,
				   width = 6)
	self.heightentry.pack(side = LEFT, expand = 1, fill = X, anchor = E)

	def CallBoth(arg, x = self.var_width, y = self.var_height):
	    x.UpdateUnit(arg)
	    y.UpdateUnit(arg)

	optmenu = create_unit_menu(size_frame, CallBoth,
				   variable = var_width_unit,
				   indicatoron = 0, width = 3)
	optmenu.pack(side = LEFT, expand = 1, fill = X, anchor = W)



	button_frame = Frame(top)
	button_frame.pack(side = BOTTOM, fill = BOTH, expand = 1,
			  padx = 4, pady = 4)
	button = UpdatedButton(button_frame, text = _("Apply"),
			       command = self.apply_settings)
	button.pack(side = LEFT, expand = 1)
	button = UpdatedButton(button_frame, text = _("Close"),
			       command = self.close_dlg)
	button.pack(side = RIGHT, expand = 1)