Exemple #1
0
    def create_widgets(self, frame, idx, set_active_layer, rename,
		       set_layer_state, set_color, context_menu):
	self.index.SetValue(idx)
	idx = (self.index,)
	self.button = UpdatedRadiobutton(frame, anchor = W, value = idx,
					 width = 10,
					 variable = self.active_var,
					 command = set_active_layer)
	self.button.bind('<ButtonPress-3>', context_menu)
	self.button.bind('<ButtonPress-2>', rename)
	self.button.bind('<Double-Button-1>', rename)
	self.var_visible = IntVar(frame)
	self.visible = UpdatedCheckbutton(frame, variable = self.var_visible,
					  indicatoron = 0, selectcolor = '',
					  command = set_layer_state,
					  args = idx)
	self.var_printable = IntVar(frame)
	self.printable = UpdatedCheckbutton(frame,
					    variable = self.var_printable,
					    indicatoron = 0, selectcolor = '',
					    command = set_layer_state,
					    args = idx)
	self.var_locked = IntVar(frame)
	self.locked = UpdatedCheckbutton(frame, variable = self.var_locked,
					 indicatoron = 0, selectcolor = '',
					 command = set_layer_state, args = idx)
	self.var_outlined = IntVar(frame)
	self.outlined = UpdatedCheckbutton(frame, variable = self.var_outlined,
					   indicatoron = 0, selectcolor = '',
					   command = set_layer_state,
					   args = idx)
	self.color = ColorButton(frame, command = set_color, args = idx,
				 width = 2,
				 dialog_master =
				 frame.master.master.master.master)
Exemple #2
0
 def create_widgets(self, frame, idx, set_active_layer, rename,
                    set_layer_state, set_color, context_menu):
     self.index.SetValue(idx)
     idx = (self.index, )
     self.button = UpdatedRadiobutton(frame,
                                      anchor=W,
                                      value=idx,
                                      width=10,
                                      variable=self.active_var,
                                      command=set_active_layer)
     self.button.bind('<ButtonPress-3>', context_menu)
     self.button.bind('<ButtonPress-2>', rename)
     self.button.bind('<Double-Button-1>', rename)
     self.var_visible = IntVar(frame)
     self.visible = UpdatedCheckbutton(frame,
                                       variable=self.var_visible,
                                       indicatoron=0,
                                       selectcolor='',
                                       command=set_layer_state,
                                       args=idx)
     self.var_printable = IntVar(frame)
     self.printable = UpdatedCheckbutton(frame,
                                         variable=self.var_printable,
                                         indicatoron=0,
                                         selectcolor='',
                                         command=set_layer_state,
                                         args=idx)
     self.var_locked = IntVar(frame)
     self.locked = UpdatedCheckbutton(frame,
                                      variable=self.var_locked,
                                      indicatoron=0,
                                      selectcolor='',
                                      command=set_layer_state,
                                      args=idx)
     self.var_outlined = IntVar(frame)
     self.outlined = UpdatedCheckbutton(frame,
                                        variable=self.var_outlined,
                                        indicatoron=0,
                                        selectcolor='',
                                        command=set_layer_state,
                                        args=idx)
     self.color = ColorButton(
         frame,
         command=set_color,
         args=idx,
         width=2,
         dialog_master=frame.master.master.master.master)
Exemple #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')
Exemple #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')
Exemple #5
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)
Exemple #6
0
class LayerInfo:

    def __init__(self, frame, idx, info, active_var, rename, set_active_layer,
		 set_layer_state, set_color, context_menu):
	self.index = MutableNumber()
	self.active_var = active_var
	self.create_widgets(frame, idx, set_active_layer, rename,
			    set_layer_state, set_color, context_menu)
	if info:
	    self.SetInfo(info)

    def create_widgets(self, frame, idx, set_active_layer, rename,
		       set_layer_state, set_color, context_menu):
	self.index.SetValue(idx)
	idx = (self.index,)
	self.button = UpdatedRadiobutton(frame, anchor = W, value = idx,
					 width = 10,
					 variable = self.active_var,
					 command = set_active_layer)
	self.button.bind('<ButtonPress-3>', context_menu)
	self.button.bind('<ButtonPress-2>', rename)
	self.button.bind('<Double-Button-1>', rename)
	self.var_visible = IntVar(frame)
	self.visible = UpdatedCheckbutton(frame, variable = self.var_visible,
					  indicatoron = 0, selectcolor = '',
					  command = set_layer_state,
					  args = idx)
	self.var_printable = IntVar(frame)
	self.printable = UpdatedCheckbutton(frame,
					    variable = self.var_printable,
					    indicatoron = 0, selectcolor = '',
					    command = set_layer_state,
					    args = idx)
	self.var_locked = IntVar(frame)
	self.locked = UpdatedCheckbutton(frame, variable = self.var_locked,
					 indicatoron = 0, selectcolor = '',
					 command = set_layer_state, args = idx)
	self.var_outlined = IntVar(frame)
	self.outlined = UpdatedCheckbutton(frame, variable = self.var_outlined,
					   indicatoron = 0, selectcolor = '',
					   command = set_layer_state,
					   args = idx)
	self.color = ColorButton(frame, command = set_color, args = idx,
				 width = 2,
				 dialog_master =
				 frame.master.master.master.master)

    def SetInfo(self, idx, info):
	self.index.SetValue(idx)
	p = pixmaps
	#name, visible, printable, locked, outlined, color = info
	self.button['text'] = info.Name()

        visible = info.Visible()
	self.var_visible.set(visible)
	self.visible['bitmap'] = visible and p.MiniEyeOpen or p.MiniEyeClosed

        printable = info.Printable()
	self.var_printable.set(printable)
	self.printable['bitmap']= printable and p.MiniPrintOn or p.MiniPrintOff

        locked = info.Locked()
	self.var_locked.set(locked)
	self.locked['bitmap'] = locked and p.MiniLockClosed or p.MiniLockOpen

        outlined = info.Outlined()
	self.var_outlined.set(outlined)
	bm = outlined and p.MiniOutlineOn or p.MiniOutlineOff
	self.outlined['bitmap'] = bm

	self.color.SetColor(info.OutlineColor())

        if info.is_GridLayer:
            self.locked['state'] = self.outlined['state'] \
                                   = self.printable['state'] = DISABLED
        else:
            self.locked['state'] = NORMAL
            if info.is_GuideLayer:
                self.printable['state'] = self.outlined['state'] = DISABLED
            else:
                self.printable['state'] = self.outlined['state'] = NORMAL

    def PlaceWidgets(self, idx):
	self.button.grid(row = idx, column = 0, sticky = 'NEWS')
	self.visible.grid(row = idx, column = 1, sticky = 'NEWS')
	self.printable.grid(row = idx, column = 2, sticky = 'NEWS')
	self.locked.grid(row = idx, column = 3, sticky = 'NEWS')
	self.outlined.grid(row = idx, column = 4, sticky = 'NEWS')
	self.color.grid(row = idx, column = 5, sticky = 'NEWS')

    def State(self):
	return (self.var_visible.get(),
		self.var_printable.get(),
		self.var_locked.get(),
		self.var_outlined.get())

    def Color(self):
	return self.color.Color()

    def Destroy(self):
	self.button.destroy()
	self.visible.destroy()
	self.printable.destroy()
	self.locked.destroy()
	self.outlined.destroy()
	self.color.destroy()
Exemple #7
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)
Exemple #8
0
class LayerInfo:
    def __init__(self, frame, idx, info, active_var, rename, set_active_layer,
                 set_layer_state, set_color, context_menu):
        self.index = MutableNumber()
        self.active_var = active_var
        self.create_widgets(frame, idx, set_active_layer, rename,
                            set_layer_state, set_color, context_menu)
        if info:
            self.SetInfo(info)

    def create_widgets(self, frame, idx, set_active_layer, rename,
                       set_layer_state, set_color, context_menu):
        self.index.SetValue(idx)
        idx = (self.index, )
        self.button = UpdatedRadiobutton(frame,
                                         anchor=W,
                                         value=idx,
                                         width=10,
                                         variable=self.active_var,
                                         command=set_active_layer)
        self.button.bind('<ButtonPress-3>', context_menu)
        self.button.bind('<ButtonPress-2>', rename)
        self.button.bind('<Double-Button-1>', rename)
        self.var_visible = IntVar(frame)
        self.visible = UpdatedCheckbutton(frame,
                                          variable=self.var_visible,
                                          indicatoron=0,
                                          selectcolor='',
                                          command=set_layer_state,
                                          args=idx)
        self.var_printable = IntVar(frame)
        self.printable = UpdatedCheckbutton(frame,
                                            variable=self.var_printable,
                                            indicatoron=0,
                                            selectcolor='',
                                            command=set_layer_state,
                                            args=idx)
        self.var_locked = IntVar(frame)
        self.locked = UpdatedCheckbutton(frame,
                                         variable=self.var_locked,
                                         indicatoron=0,
                                         selectcolor='',
                                         command=set_layer_state,
                                         args=idx)
        self.var_outlined = IntVar(frame)
        self.outlined = UpdatedCheckbutton(frame,
                                           variable=self.var_outlined,
                                           indicatoron=0,
                                           selectcolor='',
                                           command=set_layer_state,
                                           args=idx)
        self.color = ColorButton(
            frame,
            command=set_color,
            args=idx,
            width=2,
            dialog_master=frame.master.master.master.master)

    def SetInfo(self, idx, info):
        self.index.SetValue(idx)
        p = pixmaps
        #name, visible, printable, locked, outlined, color = info
        self.button['text'] = info.Name()

        visible = info.Visible()
        self.var_visible.set(visible)
        self.visible['bitmap'] = visible and p.MiniEyeOpen or p.MiniEyeClosed

        printable = info.Printable()
        self.var_printable.set(printable)
        self.printable[
            'bitmap'] = printable and p.MiniPrintOn or p.MiniPrintOff

        locked = info.Locked()
        self.var_locked.set(locked)
        self.locked['bitmap'] = locked and p.MiniLockClosed or p.MiniLockOpen

        outlined = info.Outlined()
        self.var_outlined.set(outlined)
        bm = outlined and p.MiniOutlineOn or p.MiniOutlineOff
        self.outlined['bitmap'] = bm

        self.color.SetColor(info.OutlineColor())

        if info.is_GridLayer:
            self.locked['state'] = self.outlined['state'] \
                = self.printable['state'] = DISABLED
        else:
            self.locked['state'] = NORMAL
            if info.is_GuideLayer:
                self.printable['state'] = self.outlined['state'] = DISABLED
            else:
                self.printable['state'] = self.outlined['state'] = NORMAL

    def PlaceWidgets(self, idx):
        self.button.grid(row=idx, column=0, sticky='NEWS')
        self.visible.grid(row=idx, column=1, sticky='NEWS')
        self.printable.grid(row=idx, column=2, sticky='NEWS')
        self.locked.grid(row=idx, column=3, sticky='NEWS')
        self.outlined.grid(row=idx, column=4, sticky='NEWS')
        self.color.grid(row=idx, column=5, sticky='NEWS')

    def State(self):
        return (self.var_visible.get(), self.var_printable.get(),
                self.var_locked.get(), self.var_outlined.get())

    def Color(self):
        return self.color.Color()

    def Destroy(self):
        self.button.destroy()
        self.visible.destroy()
        self.printable.destroy()
        self.locked.destroy()
        self.outlined.destroy()
        self.color.destroy()