Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
    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)
Exemplo n.º 3
0
    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')
Exemplo n.º 4
0
    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')