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)
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)
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)
def build_dlg(self): top = self.top button_frame = self.create_std_buttons(top) button_frame.grid(row=5, columnspan=2, sticky='ew') color_frame = Frame(top, relief=GROOVE, bd=2) color_frame.grid(row=0, columnspan=2, sticky='ew') label = Label(color_frame, text=_("Color")) label.pack(side=LEFT, expand=1, anchor=E) self.color_but = ColorButton(color_frame, width=3, height=1, command=self.set_line_color) self.color_but.SetColor(StandardColors.black) self.color_but.pack(side=LEFT, expand=1, anchor=W) self.var_color_none = IntVar(top) check = UpdatedCheckbutton(color_frame, text=_("None"), variable=self.var_color_none, command=self.do_apply) check.pack(side=LEFT, expand=1) width_frame = Frame(top, relief=GROOVE, bd=2) width_frame.grid(row=1, columnspan=2, sticky='ew') label = Label(width_frame, text=_("Width")) label.pack(side=LEFT, expand=1, anchor=E) self.var_width = create_length_entry(top, width_frame, self.set_line_width, scroll_pad=0) tkwin = self.main_window.canvas.tkwin gc, bitmap, dashlist = create_dash_images(self.top.tk, tkwin, StandardDashes()) self.opt_dash = MyOptionMenu2(top, dashlist, command=self.set_dash, entry_type='image', highlightthickness=0) self.opt_dash.grid(row=2, columnspan=2, sticky='ew', ipady=2) self.dash_gc = gc self.dash_bitmap = bitmap gc, bitmap, arrow1, arrow2 = create_arrow_images( self.top.tk, tkwin, StandardArrows()) self.opt_arrow1 = MyOptionMenu2(top, arrow1, command=self.set_arrow, args=1, entry_type='image', highlightthickness=0) self.opt_arrow1.grid(row=3, column=0, sticky='ew', ipady=2) self.opt_arrow2 = MyOptionMenu2(top, arrow2, command=self.set_arrow, args=2, entry_type='image', highlightthickness=0) self.opt_arrow2.grid(row=3, column=1, sticky='ew', ipady=2) self.arrow_gc = gc self.arrow_bitmap = bitmap self.opt_join = MyOptionMenu2(top, [(pixmaps.JoinMiter, JoinMiter), (pixmaps.JoinRound, JoinRound), (pixmaps.JoinBevel, JoinBevel)], command=self.set_line_join, entry_type='bitmap', highlightthickness=0) self.opt_join.grid(row=4, column=0, sticky='ew') self.opt_cap = MyOptionMenu2(top, [(pixmaps.CapButt, CapButt), (pixmaps.CapRound, CapRound), (pixmaps.CapProjecting, CapProjecting)], command=self.set_line_cap, entry_type='bitmap', highlightthickness=0) self.opt_cap.grid(row=4, column=1, sticky='ew') self.opt_cap.SetValue(None)
def build_dlg(self): top = self.top # a bit of a hack to accept drops... top.accept_drop = (DROP_COLOR,) top.DropAt = self.DropAt # the standard buttons (apply, cancel, update...) button_frame = self.create_std_buttons(top) button_frame.pack(side = BOTTOM, fill = X, expand = 0) # self.var_transform = IntVar(top) self.var_transform.set(1) button = UpdatedCheckbutton(top, text = _("Transform Pattern"), variable = self.var_transform, command = self.set_fill_transform) button.pack(side = BOTTOM, fill = X) # type frame type_frame = Frame(top) type_frame.pack(side = LEFT, fill = Y, expand = 0) # sample self.sample = InteractiveSample(top, width = 60, height = 60, background = 'white') self.sample.pack(side = TOP, fill = X, anchor = N) self.sample.SetPattern(EmptyPattern) self.sample.Subscribe(CENTER, self.center_changed) self.sample.Subscribe(DIRECTION, self.direction_changed) # pattern frames self.frames = [None, None, None, None, None] self.frames[0] = PatternFrame(top) self.frames[1] = SolidPatternFrame(top) self.frames[2] = GradientPatternFrame(top) self.frames[3] = HatchingPatternFrame(top) self.frames[4] = ImageTilePatternFrame(top, main_window = self.main_window) width = 0 for frame in self.frames: frame.Subscribe(CHANGED, self.pattern_changed, 1) frame.update() w = frame.winfo_reqwidth() if w > width: width = w self.sample.config(width = width) self.var_pattern_type = IntVar(top) types = ((0, pixmaps.fill_none), (1, pixmaps.fill_solid), (2, pixmaps.fill_gradient), (3, pixmaps.fill_hatch), (4, pixmaps.fill_tile)) for value, bitmap in types: button = make_button(type_frame, bitmap = bitmap, value = value, variable = self.var_pattern_type, command = self.choose_pattern) button.pack(side = TOP) # unknown self.frame_unknown = PatternFrame(top) self.active_frame = None
def build_dlg(self): top = self.top button_frame = self.create_std_buttons(top) button_frame.grid(row = 5, columnspan = 2, sticky = 'ew') color_frame = Frame(top, relief = GROOVE, bd = 2) color_frame.grid(row = 0, columnspan = 2, sticky = 'ew') label = Label(color_frame, text = _("Color")) label.pack(side = LEFT, expand = 1, anchor = E) self.color_but = ColorButton(color_frame, width = 3, height = 1, command = self.set_line_color) self.color_but.SetColor(StandardColors.black) self.color_but.pack(side = LEFT, expand = 1, anchor = W) self.var_color_none = IntVar(top) check = UpdatedCheckbutton(color_frame, text = _("None"), variable = self.var_color_none, command = self.do_apply) check.pack(side = LEFT, expand = 1) width_frame = Frame(top, relief = GROOVE, bd = 2) width_frame.grid(row = 1, columnspan = 2, sticky = 'ew') label = Label(width_frame, text = _("Width")) label.pack(side = LEFT, expand = 1, anchor = E) self.var_width = create_length_entry(top, width_frame, self.set_line_width, scroll_pad = 0) tkwin = self.main_window.canvas.tkwin gc, bitmap, dashlist = create_dash_images(self.top.tk, tkwin, StandardDashes()) self.opt_dash = MyOptionMenu2(top, dashlist, command = self.set_dash, entry_type = 'image', highlightthickness = 0) self.opt_dash.grid(row = 2, columnspan = 2, sticky = 'ew', ipady = 2) self.dash_gc = gc self.dash_bitmap = bitmap gc, bitmap, arrow1, arrow2 = create_arrow_images(self.top.tk, tkwin, StandardArrows()) self.opt_arrow1 = MyOptionMenu2(top, arrow1, command = self.set_arrow, args = 1, entry_type = 'image', highlightthickness = 0) self.opt_arrow1.grid(row = 3, column = 0, sticky = 'ew', ipady = 2) self.opt_arrow2 = MyOptionMenu2(top, arrow2, command = self.set_arrow, args = 2, entry_type = 'image', highlightthickness = 0) self.opt_arrow2.grid(row = 3, column = 1, sticky = 'ew', ipady = 2) self.arrow_gc = gc self.arrow_bitmap = bitmap self.opt_join = MyOptionMenu2(top, [(pixmaps.JoinMiter, JoinMiter), (pixmaps.JoinRound, JoinRound), (pixmaps.JoinBevel, JoinBevel)], command = self.set_line_join, entry_type = 'bitmap', highlightthickness = 0) self.opt_join.grid(row = 4, column = 0, sticky = 'ew') self.opt_cap = MyOptionMenu2(top, [(pixmaps.CapButt, CapButt), (pixmaps.CapRound, CapRound), (pixmaps.CapProjecting, CapProjecting)], command = self.set_line_cap, entry_type = 'bitmap', highlightthickness = 0) self.opt_cap.grid(row = 4, column = 1, sticky = 'ew') self.opt_cap.SetValue(None)
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)
def build_dlg(self): top = self.top # a bit of a hack to accept drops... top.accept_drop = (DROP_COLOR,) top.DropAt = self.DropAt # the standard buttons (apply, cancel, update...) button_frame = self.create_std_buttons(top) button_frame.pack(side = BOTTOM, fill = X, expand = 0) # self.var_transform = IntVar(top) self.var_transform.set(1) button = UpdatedCheckbutton(top, text = _("Transform Pattern"), variable = self.var_transform, command = self.set_fill_transform) button.pack(side = BOTTOM, fill = X) # type frame type_frame = Frame(top) type_frame.pack(side = LEFT, fill = Y, expand = 0) # sample self.sample = InteractiveSample(top, width = 60, height = 60, background = 'white') self.sample.pack(side = TOP, fill = X, anchor = N) self.sample.SetPattern(EmptyPattern) self.sample.Subscribe(CENTER, self.center_changed) self.sample.Subscribe(DIRECTION, self.direction_changed) # pattern frames self.frames = [None, None, None, None, None] self.frames[0] = PatternFrame(top) self.frames[1] = SolidPatternFrame(top) self.frames[2] = GradientPatternFrame(top) self.frames[3] = HatchingPatternFrame(top) self.frames[4] = ImageTilePatternFrame(top, main_window = self.main_window) width = 0 for frame in self.frames: frame.Subscribe(CHANGED, self.pattern_changed, 1) frame.update() w = frame.winfo_reqwidth() if w > width: width = w self.sample.config(width = width) self.var_pattern_type = IntVar(top) types = ((0, pixmaps.fill_none), (1, pixmaps.fill_solid), (2, pixmaps.fill_gradient), (3, pixmaps.fill_hatch), (4, pixmaps.fill_tile)) for value, bitmap in types: button = make_button(type_frame, bitmap = bitmap, value = value, variable = self.var_pattern_type, command = self.choose_pattern) button.pack(side = TOP) # unknown self.frame_unknown = PatternFrame(top) self.active_frame = None