def build_dlg(self): top = self.top frame = Frame(top, name = 'top') frame.pack(side = TOP, fill = BOTH, expand = 1) bitmap = pixmaps.load_image(self.bitmap) if type(bitmap) == StringType: label = Label(frame, bitmap = bitmap, name = 'bitmap') else: label = Label(frame, image = bitmap, name = 'bitmap') label.pack(side = LEFT, padx = 5, pady = 5) label = Label(frame, text = self.message, name = 'msg') label.pack(side = RIGHT, fill = BOTH, expand = 1, padx = 5, pady = 5) frame = Frame(top, name = 'bot') frame.pack(side = BOTTOM, fill = X, expand = 1) command = self.ok for i in range(len(self.buttons)): button = UpdatedButton(frame, text = self.buttons[i], command = command, args = i) button.grid(column = i, row = 0, sticky = 'ew', padx = 10) if i == self.default: if TkVersion >= 8.0: button['default'] = 'active' self.focus_widget = button else: if TkVersion >= 8.0: button['default'] = 'normal' if self.default is not None: top.bind('<Return>', self.invoke_default)
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()
def build_dlg(self): top = self.top frame = Frame(top, name='top') frame.pack(side=TOP, fill=BOTH, expand=1) bitmap = pixmaps.load_image(self.bitmap) if type(bitmap) == StringType: label = Label(frame, bitmap=bitmap, name='bitmap') else: label = Label(frame, image=bitmap, name='bitmap') label.pack(side=LEFT, padx=5, pady=5) label = Label(frame, text=self.message, name='msg') label.pack(side=RIGHT, fill=BOTH, expand=1, padx=5, pady=5) frame = Frame(top, name='bot') frame.pack(side=BOTTOM, fill=X, expand=1) command = self.ok for i in range(len(self.buttons)): button = UpdatedButton(frame, text=self.buttons[i], command=command, args=i) button.grid(column=i, row=0, sticky='ew', padx=10) if i == self.default: if TkVersion >= 8.0: button['default'] = 'active' self.focus_widget = button else: if TkVersion >= 8.0: button['default'] = 'normal' if self.default is not None: top.bind('<Return>', self.invoke_default)
def create_std_buttons(self, master, update_from=1): button_frame = Frame(master) button = Checkbutton(button_frame, text=_("Auto Update"), variable=self.var_auto_update) button.pack(side=TOP, expand=1, fill=X) if update_from: button = UpdatedButton(button_frame, text=_("Update From..."), command=self.update_from_object) button.pack(side=TOP, expand=1, fill=X) button = UpdatedButton(button_frame, text=_("Apply"), command=self.do_apply, sensitivecb=self.can_apply) button.pack(side=LEFT, expand=1, fill=X) self.Subscribe(SELECTION, button.Update) button = UpdatedButton(button_frame, text=_("Close"), command=self.close_dlg) button.pack(side=RIGHT, expand=1, fill=X) return button_frame
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
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)
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
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()
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))
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 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
def build_dlg(self): names = (('ContAngle', 'CloseNodes', 'OpenNodes'), ('ContSmooth', 'InsertNodes', 'DeleteNodes'), ('ContSymmetrical', 'SegmentsToLines', 'SegmentsToCurve')) top = self.top frame = Frame(top) frame.pack(side=TOP, expand=1, fill=BOTH) # XXX This dialog should have its own ObjectCommand objects cmds = self.main_window.canvas.commands.PolyBezierEditor for i in range(len(names)): for j in range(len(names[i])): button = CommandButton(frame, getattr(cmds, names[i][j]), highlightthickness=0) button.grid(column=j, row=i) frame = Frame(top) frame.pack(side=BOTTOM, expand=0, fill=X) button = UpdatedButton(frame, text=_("Close"), command=self.close_dlg) button.pack(anchor=CENTER)
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 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)
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)
def build_dlg(self): top = self.top framey = Frame(top) framey.pack(side=LEFT, expand=1, fill=Y, padx=2, pady=2) framex = Frame(top) framex.pack(side=TOP, expand=1, fill=X, padx=2, pady=2, anchor='n') x_pixmaps = [ pixmaps.AlignLeft, pixmaps.AlignCenterX, pixmaps.AlignRight ] y_pixmaps = [ pixmaps.AlignTop, pixmaps.AlignCenterY, pixmaps.AlignBottom ] self.var_x = IntVar(top) self.var_x.set(0) self.value_x = 0 self.var_y = IntVar(top) self.var_y.set(0) self.value_y = 0 for i in range(1, 4): button = make_button(framex, bitmap=x_pixmaps[i - 1], value=i, variable=self.var_x, command=self.set_x) button.pack(side=LEFT, padx=1, pady=1, ipadx=1, ipady=1) button = make_button(framey, bitmap=y_pixmaps[i - 1], value=i, variable=self.var_y, command=self.set_y) button.pack(side=TOP, padx=1, pady=1, ipadx=1, ipady=1) button_frame = Frame(top) button_frame.pack(expand=1, fill=BOTH) button_frame.rowconfigure(3, minsize=5) apply_button = UpdatedButton(button_frame, text=_("Apply"), command=self.apply, sensitivecb=self.can_apply) apply_button.grid( row=4, column=0, #columnspan= 2, sticky='ew') self.Subscribe(SELECTION, apply_button.Update) #button = UpdatedButton(button_frame, text = _("Reset"), # command = self.reset) #button.grid(column = 0, row = 4, sticky = 'ew') button = UpdatedButton(button_frame, text=_("Close"), command=self.close_dlg) button.grid(column=1, row=4, sticky='ew') self.var_reference = StringVar(top) self.var_reference.set('selection') radio = UpdatedRadiobutton(button_frame, value='selection', text=_("Relative To Selection"), variable=self.var_reference, command=apply_button.Update) radio.grid(row=0, column=0, columnspan=2, sticky='ew') radio = UpdatedRadiobutton(button_frame, value='lowermost', text=_("Relative To Lowermost"), variable=self.var_reference, command=apply_button.Update) radio.grid(row=1, column=0, columnspan=2, sticky='ew') radio = UpdatedRadiobutton(button_frame, value='page', text=_("Relative To Page"), variable=self.var_reference, command=apply_button.Update) radio.grid(row=2, column=0, columnspan=2, sticky='ew')
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)
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 = 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)
def build_dlg(self): top = self.top framey = Frame(top) framey.pack(side = LEFT, expand = 1, fill = Y, padx = 2, pady = 2) framex = Frame(top) framex.pack(side = TOP, expand = 1, fill = X, padx = 2, pady = 2, anchor = 'n') x_pixmaps = [pixmaps.AlignLeft, pixmaps.AlignCenterX, pixmaps.AlignRight] y_pixmaps = [pixmaps.AlignTop, pixmaps.AlignCenterY, pixmaps.AlignBottom] self.var_x = IntVar(top) self.var_x.set(0) self.value_x = 0 self.var_y = IntVar(top) self.var_y.set(0) self.value_y = 0 for i in range(1, 4): button = make_button(framex, bitmap = x_pixmaps[i - 1], value = i, variable = self.var_x, command = self.set_x) button.pack(side = LEFT, padx = 1, pady = 1, ipadx = 1, ipady = 1) button = make_button(framey, bitmap = y_pixmaps[i - 1], value = i, variable = self.var_y, command = self.set_y) button.pack(side = TOP, padx = 1, pady = 1, ipadx = 1, ipady = 1) button_frame = Frame(top) button_frame.pack(expand = 1, fill = BOTH) button_frame.rowconfigure(3, minsize = 5) apply_button = UpdatedButton(button_frame, text = _("Apply"), command = self.apply, sensitivecb = self.can_apply) apply_button.grid(row = 4, column = 0, #columnspan= 2, sticky = 'ew') self.Subscribe(SELECTION, apply_button.Update) #button = UpdatedButton(button_frame, text = _("Reset"), # command = self.reset) #button.grid(column = 0, row = 4, sticky = 'ew') button = UpdatedButton(button_frame, text = _("Close"), command = self.close_dlg) button.grid(column = 1, row = 4, sticky = 'ew') self.var_reference = StringVar(top) self.var_reference.set('selection') radio = UpdatedRadiobutton(button_frame, value = 'selection', text = _("Relative To Selection"), variable = self.var_reference, command = apply_button.Update) radio.grid(row = 0, column = 0, columnspan = 2, sticky = 'ew') radio = UpdatedRadiobutton(button_frame, value = 'lowermost', text = _("Relative To Lowermost"), variable = self.var_reference, command = apply_button.Update) radio.grid(row = 1, column = 0, columnspan = 2, sticky = 'ew') radio = UpdatedRadiobutton(button_frame, value = 'page', text = _("Relative To Page"), variable = self.var_reference, command = apply_button.Update) radio.grid(row = 2, column = 0, columnspan = 2, sticky = 'ew')
def build_dlg(self): top = self.top # The preview widget self.view = SketchView(top, self.document, width=200, height=200, background='white') self.view.pack(side=TOP, fill=BOTH, expand=1) # PostScript Options frame = Frame(top, name="options") frame.pack(side=TOP, fill=X) # EPS #self.var_create_eps = IntVar(top) #self.var_create_eps.set(1) #button = Checkbutton(frame, text = _("Create EPS file"), # variable = self.var_create_eps) #button.pack(side = LEFT, expand = 1, fill = X) # Rotate self.var_rotate = IntVar(top) self.var_rotate.set(0) button = Checkbutton(frame, text=_("Rotate ccw."), variable=self.var_rotate) button.pack(side=LEFT, expand=1, fill=X) # Embed fonts self.var_embfnt = IntVar(top) self.var_embfnt.set(0) button = Checkbutton(frame, text=_("Embed fonts"), variable=self.var_embfnt) button.pack(side=LEFT, expand=1, fill=X) # Print Command and Filename frame = Frame(top, name="command") frame.pack(side=TOP) self.print_dest = StringVar(top) button = Radiobutton(frame, text=_("Printer"), value='printer', variable=self.print_dest, anchor='w') button.grid(column=0, row=0, sticky='ew') label = Label(frame, text=_("Command"), anchor='e') label.grid(column=1, row=0, sticky='ew') self.print_command = StringVar(top) self.print_command.set('lpr') entry = MyEntry(frame, textvariable=self.print_command) entry.grid(column=2, row=0, sticky='ew') button = Radiobutton(frame, text=_("EPS"), value='file', variable=self.print_dest, anchor='w') button.grid(column=0, row=1, sticky='ew') label = Label(frame, text=_("Filename"), anchor='e') label.grid(column=1, row=1, sticky='ew') self.print_filename = StringVar(top) self.print_filename.set('') entry = MyEntry(frame, textvariable=self.print_filename) entry.grid(column=2, row=1, sticky='ew') button = UpdatedButton(frame, text=_("..."), command=self.get_filename) button.grid(column=3, row=1, sticky='ew') frame = Frame(top) frame.pack(side=TOP) button = UpdatedButton(frame, text=_("Print"), command=self.do_print) button.pack(side=LEFT) button = UpdatedButton(frame, text=_("Close"), command=self.close_dlg) button.pack(side=LEFT) # init vars self.print_dest.set(config.preferences.print_destination)
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)
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)
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)