Beispiel #1
0
	def build_dlg(self):
		root = self.top

		top = TFrame(root, borderwidth=5, style='FlatFrame')
		top.pack(side=TOP, expand=0, fill=BOTH)

		top2 = TFrame(top, style='FlatFrame')
		top2.pack(side=TOP, expand=0, fill=X)

		format_label = TLabel(top2, text=_('Style name:'), borderwidth=0)
		format_label.pack(side=LEFT, pady=3)

		self.entry_name = TEntrybox(top, command=self.ok, width=15)
		self.entry_name.pack(side=TOP, fill=X)

		top2 = TFrame(top, height=5, style='FlatFrame')
		top2.pack(side=TOP, expand=0, fill=X)

		prop_cont = TLabelframe(top, text=_('Style properties'), padding=10)
		prop_cont.pack(side=TOP, fill=X)

		properties = self.object.Properties()
		self.flags = {}
		for prop in property_names:
			type = property_types[prop]
			if type == FillProperty:
				state = self.object.has_fill and NORMAL or DISABLED
			elif type == LineProperty:
				state = self.object.has_line and NORMAL or DISABLED
			elif type == FontProperty:
				state = self.object.has_font and NORMAL or DISABLED
			else:
				# unknown property type!
				continue
			long, short = property_titles[prop]
			self.flags[prop] = var = IntVar(root)
			var.set(state == NORMAL)
			radio = TCheckbutton(prop_cont, text=long, state=state, variable=var)
			radio.pack(side=TOP, anchor=W)

		top2 = TFrame(top, height=3, style='FlatFrame')
		top2.pack(side=TOP, expand=0, fill=X)

		but_frame = Frame(top)
		but_frame.pack(side=TOP, fill=X)

		button = TButton(but_frame, text=_("Cancel"), command=self.cancel)
		button.pack(side=RIGHT, padx=5)
		button = TButton(but_frame, text=_("OK"), command=self.ok)
		button.pack(side=RIGHT, padx=5)

		root.resizable (width=0, height=0)

		self.entry_name.set_focus()
Beispiel #2
0
    def init(self, master):
        PluginPanel.init(self, master)
        top = self.panel

        grid_top = TFrame(top, borderwidth=2, style='FlatFrame')
        grid_top.pack(side=TOP, expand=1, fill=X)

        button_frame = self.create_std_buttons(top)
        button_frame.pack(side=BOTTOM, fill=BOTH, expand=1)
        # ===========================================================
        do_apply = self.do_apply

        label = TLabel(top,
                       text=" " + _("Grid origin") + " ",
                       style="FlatLabel")
        label.pack()
        frame = TLabelframe(top,
                            labelwidget=label,
                            style='Labelframe',
                            borderwidth=4)

        frame.pack(side=TOP, fill=X, pady=4, padx=2)

        f = TFrame(frame, style='FlatFrame')
        self.var_xorig = create_length_entry(top, f, do_apply)
        label = TLabel(f, text="X: ", anchor=E)
        label.pack(side=RIGHT, fill=X)
        f.pack(side=TOP, fill=X, pady=2)

        f = TFrame(frame, style='FlatFrame')
        self.var_yorig = create_length_entry(top, f, do_apply)
        label = TLabel(f, text="Y: ", anchor=E)
        label.pack(side=RIGHT, fill=X)
        f.pack(side=TOP, fill=X, pady=2)

        # ===========================================================

        label = TLabel(top, text=" " + _("Grid size") + " ", style="FlatLabel")
        label.pack()
        frame = TLabelframe(top,
                            labelwidget=label,
                            style='Labelframe',
                            borderwidth=4)
        frame.pack(side=TOP, fill=X, pady=4, padx=2)

        f = TFrame(frame, style='FlatFrame')
        self.var_xwidth = create_length_entry(top, f, do_apply)
        label = TLabel(f, text="ΔX: ", anchor=E)
        label.pack(side=RIGHT, fill=X)
        f.pack(side=TOP, fill=X, pady=2)

        f = TFrame(frame, style='FlatFrame')
        self.var_ywidth = create_length_entry(top, f, do_apply)
        label = TLabel(f, text="ΔY: ")
        label.pack(side=RIGHT, fill=X)
        f.pack(side=TOP, fill=X, pady=2)

        app.mw.docmanager.activedoc.Subscribe(GRID, self.init_from_doc)
        app.mw.Subscribe(DOCUMENT, self.init_from_doc)
        self.init_from_doc()
Beispiel #3
0
	def init(self, master):
		PluginPanel.init(self, master)
		top = self.panel

		grid_top = TFrame(top, borderwidth=2, style='FlatFrame')
		grid_top.pack(side=TOP, expand=1, fill=X)

		button_frame = self.create_std_buttons(top)
		button_frame.pack(side=BOTTOM, fill=BOTH, expand=1)
# ===========================================================
		do_apply = self.do_apply

		label = TLabel(top, text=" " + _("Grid origin") + " ", style="FlatLabel")
		label.pack()
		frame = TLabelframe(top, labelwidget=label, style='Labelframe', borderwidth=4)

		frame.pack(side=TOP, fill=X, pady=4, padx=2)

		f = TFrame(frame, style='FlatFrame')
		self.var_xorig = create_length_entry(top, f, do_apply)
		label = TLabel(f, text="X: ", anchor=E)
		label.pack(side=RIGHT, fill=X)
		f.pack(side=TOP, fill=X, pady=2)


		f = TFrame(frame, style='FlatFrame')
		self.var_yorig = create_length_entry(top, f, do_apply)
		label = TLabel(f, text="Y: ", anchor=E)
		label.pack(side=RIGHT, fill=X)
		f.pack(side=TOP, fill=X, pady=2)

# ===========================================================

		label = TLabel(top, text=" " + _("Grid size") + " ", style="FlatLabel")
		label.pack()
		frame = TLabelframe(top, labelwidget=label, style='Labelframe', borderwidth=4)
		frame.pack(side=TOP, fill=X, pady=4, padx=2)

		f = TFrame(frame, style='FlatFrame')
		self.var_xwidth = create_length_entry(top, f, do_apply)
		label = TLabel(f, text="ΔX: ", anchor=E)
		label.pack(side=RIGHT, fill=X)
		f.pack(side=TOP, fill=X, pady=2)


		f = TFrame(frame, style='FlatFrame')
		self.var_ywidth = create_length_entry(top, f, do_apply)
		label = TLabel(f, text="ΔY: ")
		label.pack(side=RIGHT, fill=X)
		f.pack(side=TOP, fill=X, pady=2)

		app.mw.docmanager.activedoc.Subscribe(GRID, self.init_from_doc)
		app.mw.Subscribe(DOCUMENT, self.init_from_doc)
		self.init_from_doc()
Beispiel #4
0
	def init(self, master):
		PluginPanel.init(self, master)

		self.width_priority=1
		
		root=self.mw.root
		self.var_width_number=DoubleVar(root)
		self.var_height_number=DoubleVar(root)

		var_width_unit = StringVar(root)
		var_height_unit = StringVar(root)
		
		unit = config.preferences.default_unit
		self.var_width = LengthVar(10, unit, self.var_width_number, var_width_unit)
		self.var_height = LengthVar(10, unit,self.var_height_number,var_height_unit)
		
		jump=config.preferences.default_unit_jump
		self.var_width.set(0)
		self.var_height.set(0)
		
		self.var_proportional = IntVar(root)
		self.var_proportional.set(0)
		
		self.var_basepoint = StringVar(root)
		self.var_basepoint.set('C')
		
		#---------------------------------------------------------
		top = TFrame(self.panel, style='FlatFrame')
		top.pack(side = TOP, fill=BOTH)
		#---------------------------------------------------------
		# Horisontal size
		size_frameH = TFrame(top, style='FlatFrame', borderwidth=3)
		size_frameH.pack(side = TOP, fill = BOTH)
		
		label = TLabel(size_frameH, style='FlatLabel', image='size_h')
		label.pack(side = LEFT, padx=5)
		self.entry_width = TSpinbox(size_frameH,  var=0, vartype=1, textvariable = self.var_width_number, 
									min = 0, max = 50000, step = jump, width = 10, command=self.apply_resize)
		self.entry_width.pack(side = LEFT)

		self.entry_width.down_button.bind('<ButtonRelease>', self.entry_width_chang)
		self.entry_width.down_button.bind('<KeyRelease>', self.entry_width_chang)
		self.entry_width.up_button.bind('<ButtonRelease>', self.entry_width_chang)
		self.entry_width.up_button.bind('<KeyRelease>', self.entry_width_chang)
		self.entry_width.entry.bind('<ButtonRelease>', self.entry_width_chang)
		self.entry_width.entry.bind('<KeyRelease>', self.entry_width_chang)
		self.entry_width.entry.bind('<FocusOut>', self.entry_width_chang)
		self.entry_width.entry.bind('<FocusIn>', self.entry_width_FocusIn)
		
		self.labelwunit = TLabel(size_frameH, style='FlatLabel', text = self.var_width.unit)
		self.labelwunit.pack(side = LEFT, padx=5)
		#---------------------------------------------------------
		# Vertical 
		
		size_frameV = TFrame(top, style='FlatFrame', borderwidth=3)
		size_frameV.pack(side = TOP, fill = BOTH)
		label = TLabel(size_frameV, style='FlatLabel', image='size_v')
		label.pack(side = LEFT, padx=5)
		
		self.entry_height = TSpinbox(size_frameV, var=0, vartype=1, textvariable = self.var_height_number, 
									min = 0, max = 50000, step = jump, width = 10, command=self.apply_resize)
		self.entry_height.pack(side = LEFT)
		
		self.entry_height.down_button.bind('<ButtonRelease>', self.entry_height_chang)
		self.entry_height.down_button.bind('<KeyRelease>', self.entry_height_chang)
		self.entry_height.up_button.bind('<ButtonRelease>', self.entry_height_chang)
		self.entry_height.up_button.bind('<KeyRelease>', self.entry_height_chang)
		self.entry_height.entry.bind('<ButtonRelease>', self.entry_height_chang)
		self.entry_height.entry.bind('<KeyRelease>', self.entry_height_chang)
		self.entry_height.entry.bind('<FocusOut>', self.entry_height_chang)
		self.entry_height.entry.bind('<FocusIn>', self.entry_height_FocusIn)
		
		self.labelhunit = TLabel(size_frameV, style='FlatLabel', text = self.var_height.unit)
		self.labelhunit.pack(side = LEFT, padx=5)
		
		#---------------------------------------------------------
		# Proportional chek
		
		self.proportional_check = TCheckbutton(top, text = _("Proportional"), variable = self.var_proportional, command = self.proportional)
		self.proportional_check.pack(side = TOP, anchor=W, padx=5,pady=5)
		
		#---------------------------------------------------------
		# Basepoint check
		label = TLabel(top, style='FlatLabel', text = _("Basepoint:"))
		label.pack(side = TOP, fill = BOTH, padx=5)
		basepoint_frame=TLabelframe(top, labelwidget=label, style='Labelframe', borderwidth=4)
		basepoint_frame.pack(side = TOP, fill=X, padx=5, pady=2)
		
		self.Basepoint = BasePointSelector(basepoint_frame, anchor=self.var_basepoint)
		self.Basepoint.pack(side = LEFT, fill = BOTH, padx=5)
		
		label = TLabel(basepoint_frame, style='FlatLabel', image = 'coordinate_sys')
		label.pack(side = LEFT, fill = BOTH, padx=10)
			
		#---------------------------------------------------------
		# Button frame 
		
		button_frame = TFrame(top, style='FlatFrame', borderwidth=5)
		button_frame.pack(side = BOTTOM, fill = BOTH)

		self.update_buttons = []
		self.button = UpdatedButton(top, text = _("Apply"),
								command = self.apply_resize)
		self.button.pack(in_ = button_frame, side = BOTTOM, expand = 1, fill = X, pady=3)

		self.button_copy = UpdatedButton(top, text = _("Apply to Copy"),
								command = self.apply_to_copy)
		self.button_copy.pack(in_ = button_frame, side = BOTTOM, expand = 1, fill = X)
		
		self.subscribe_receivers()
		self.Update()
Beispiel #5
0
    def init(self, master):
        PluginPanel.init(self, master)

        root = self.mw.root

        self.var_angle = DoubleVar(root)
        self.var_angle.set(0)

        self.var_width_number = DoubleVar(root)
        self.var_height_number = DoubleVar(root)

        self.var_width_base = DoubleVar(root)
        self.var_height_base = DoubleVar(root)

        self.cnt_x_absolute = None
        self.cnt_y_absolute = None

        var_width_unit = StringVar(root)
        var_height_unit = StringVar(root)

        unit = config.preferences.default_unit
        self.var_width = LengthVar(10, unit, self.var_width_number, var_width_unit)
        self.var_height = LengthVar(10, unit, self.var_height_number, var_height_unit)

        jump = config.preferences.default_unit_jump
        self.var_width.set(0)
        self.var_height.set(0)

        self.var_width_base.set(0)
        self.var_height_base.set(0)

        self.var_position = StringVar(root)
        self.var_position.set(ABSOLUTE)

        self.var_basepoint = StringVar(root)
        self.var_basepoint.set("C")

        # ---------------------------------------------------------
        top = TFrame(self.panel, style="FlatFrame")
        top.pack(side=TOP, fill=BOTH)
        # ---------------------------------------------------------

        angle_frame = TFrame(top, style="FlatFrame", borderwidth=3)
        angle_frame.pack(side=TOP, fill=BOTH)
        label = TLabel(angle_frame, style="FlatLabel", text=" " + _("Angle:") + " ")
        label.pack(side=LEFT, padx=5)

        self.entry_angle = TSpinbox(
            angle_frame,
            var=0,
            vartype=1,
            textvariable=self.var_angle,
            min=-360,
            max=360,
            step=5,
            width=6,
            command=self.apply_rotate,
        )
        self.entry_angle.pack(side=LEFT, anchor=E)
        label = TLabel(angle_frame, style="FlatLabel", text=_("deg"))
        label.pack(side=LEFT, padx=5)
        # ---------------------------------------------------------
        label = TLabel(top, style="FlatLabel", text=_("Center:"))
        label.pack(side=TOP, fill=BOTH, padx=5)

        # ---------------------------------------------------------
        # Horisontal
        size_frameH = TFrame(top, style="FlatFrame", borderwidth=3)
        size_frameH.pack(side=TOP, fill=BOTH)

        label = TLabel(size_frameH, style="FlatLabel", image="center_h")
        label.pack(side=LEFT, padx=5)
        self.entry_width = TSpinbox(
            size_frameH,
            var=0,
            vartype=1,
            textvariable=self.var_width_number,
            min=-50000,
            max=50000,
            step=jump,
            width=10,
            command=self.apply_rotate,
        )
        self.entry_width.pack(side=LEFT)

        self.labelwunit = TLabel(size_frameH, style="FlatLabel", text=self.var_width.unit)
        self.labelwunit.pack(side=LEFT, padx=5)
        # ---------------------------------------------------------
        # Vertical

        size_frameV = TFrame(top, style="FlatFrame", borderwidth=3)
        size_frameV.pack(side=TOP, fill=BOTH)
        label = TLabel(size_frameV, style="FlatLabel", image="center_v")
        label.pack(side=LEFT, padx=5)

        self.entry_height = TSpinbox(
            size_frameV,
            var=0,
            vartype=1,
            textvariable=self.var_height_number,
            min=-50000,
            max=50000,
            step=jump,
            width=10,
            command=self.apply_rotate,
        )
        self.entry_height.pack(side=LEFT)

        self.labelhunit = TLabel(size_frameV, style="FlatLabel", text=self.var_height.unit)
        self.labelhunit.pack(side=LEFT, padx=5)

        # ---------------------------------------------------------
        # position chek

        self.position_check = TCheckbutton(
            top,
            text=_("Absolute Center"),
            variable=self.var_position,
            onvalue=ABSOLUTE,
            offvalue=RELATIVE,
            command=self.position,
        )
        self.position_check.pack(side=TOP, anchor=W, padx=5, pady=5)

        # ---------------------------------------------------------
        # Basepoint check

        label = TLabel(top, style="FlatLabel", text=_("Basepoint:"))
        label.pack(side=TOP, fill=BOTH, padx=5)
        basepoint_frame = TLabelframe(top, labelwidget=label, style="Labelframe", borderwidth=4)
        basepoint_frame.pack(side=TOP, fill=X, padx=5, pady=2)

        self.Basepoint = BasePointSelector(basepoint_frame, anchor=self.var_basepoint, command=self.apply_basepoint)
        self.Basepoint.pack(side=LEFT, fill=BOTH, padx=5)

        label = TLabel(basepoint_frame, style="FlatLabel", image="coordinate_deg")
        label.pack(side=LEFT, fill=BOTH, padx=10)

        self.position_check.pack(side=TOP, anchor=W, padx=5, pady=5)

        # ---------------------------------------------------------
        # Button frame

        button_frame = TFrame(top, style="FlatFrame", borderwidth=5)
        button_frame.pack(side=BOTTOM, fill=BOTH)

        self.update_buttons = []
        self.button = UpdatedButton(top, text=_("Apply"), command=self.apply_rotate)
        self.button.pack(in_=button_frame, side=BOTTOM, expand=1, fill=X, pady=3)

        self.button_copy = UpdatedButton(top, text=_("Apply to Copy"), command=self.apply_to_copy)
        self.button_copy.pack(in_=button_frame, side=BOTTOM, expand=1, fill=X)

        self.init_from_doc()
        self.subscribe_receivers()
    def init(self, master):
        PluginPanel.init(self, master)
        top = self.panel

        top = TFrame(top, borderwidth=2, style='FlatFrame')
        top.pack(side=TOP, expand=1, fill=X)

        button_frame = TFrame(top, borderwidth=2, style='FlatFrame')
        button_frame.pack(side=BOTTOM, fill=BOTH, expand=1)

        button = TButton(button_frame, text=_('Apply'), command=self.replace)
        button.pack(side=TOP)

        #----------------------------------------------------------
        main_frame = TFrame(top, style='FlatFrame', borderwidth=3)
        main_frame.pack(side=TOP, fill=X)

        self.find_var = StringVar(top)
        self.find_var.set('')
        findField = TEntryExt(main_frame, textvariable=self.find_var)
        findField.pack(side=RIGHT)

        label = TLabel(main_frame, style='FlatLabel', text=_("Find:") + " ")
        label.pack(side=RIGHT, anchor=E)
        #---------------------------------------------------------
        main_frame = TFrame(top, style='FlatFrame', borderwidth=3)
        main_frame.pack(side=TOP, fill=X)

        self.replace_var = StringVar(top)
        self.replace_var.set('')
        replaceField = TEntryExt(main_frame, textvariable=self.replace_var)
        replaceField.pack(side=RIGHT)

        label = TLabel(main_frame,
                       style='FlatLabel',
                       text=_("Replace to:") + " ")
        label.pack(side=RIGHT, anchor=E)

        main_frame = TFrame(top, style='FlatFrame', borderwidth=3)
        main_frame.pack(side=TOP)
        #---------------------------------------------------------
        label = TLabel(top,
                       text=" " + _("Parameters") + " ",
                       style="FlatLabel")
        label.pack()

        parametersFrameLabel = TLabelframe(top,
                                           labelwidget=label,
                                           style='Labelframe',
                                           borderwidth=4)

        parametersFrameLabel.pack(side=TOP, fill=X, pady=4, padx=4)

        parametersFrame = TFrame(parametersFrameLabel, style='FlatFrame')

        self.var_case_sensitive = BooleanVar(top)
        self.var_case_sensitive.set(False)
        self.case_sensitive_check = TCheckbutton(
            parametersFrame,
            text=_("Case sensitive"),
            variable=self.var_case_sensitive)
        self.case_sensitive_check.pack(side=TOP, anchor=W, padx=5)

        self.var_whole_word = BooleanVar(top)
        self.var_whole_word.set(False)
        self.whole_word_check = TCheckbutton(parametersFrame,
                                             text=_("Whole word"),
                                             variable=self.var_whole_word)
        self.whole_word_check.pack(side=TOP, anchor=W, padx=5)

        self.var_regexp = BooleanVar(top)
        self.var_regexp.set(False)
        self.regexpCheck = TCheckbutton(parametersFrame,
                                        text=_("RegExp search"),
                                        variable=self.var_regexp,
                                        command=self.disable_enable_action)
        self.regexpCheck.pack(side=TOP, anchor=W, padx=5)

        parametersFrame.pack(side=TOP, fill=X, pady=2)
Beispiel #7
0
	def init(self, master):
		PluginPanel.init(self, master)
		root=self.mw.root
		self.var_reference = StringVar(root)
		self.var_reference.set(SELECT)
		
		#---------------------------------------------------------
		top = TFrame(self.panel, style='FlatFrame')
		top.pack(side = TOP, fill=BOTH)
		#---------------------------------------------------------
		label=TLabel(top, text=" "+_("Relative to")+" ", style="FlatLabel")
		label.pack(side = TOP, fill = BOTH, padx=5)
		rel_frame=TLabelframe(top, labelwidget=label, style='Labelframe', borderwidth=4)
		rel_frame.pack(side = TOP, fill=X, padx=5, pady=2)
		button_frame=TFrame(rel_frame, style='FlatFrame')
		button_frame.pack(side = TOP, fill = BOTH, padx=5)
		
		self.reference = TCombobox(button_frame, state='readonly', values=self.make_cs_list(), style='ComboNormal',width=14,
									 textvariable=self.var_reference, postcommand = self.set_cs)
		self.reference.pack(side = TOP)
		#---------------------------------------------------------
		label=TLabel(top, text=" "+_("Distribute type")+" ", style="FlatLabel")
		label.pack(side = TOP, fill = BOTH, padx=5)
		framec=TLabelframe(top, labelwidget=label, style='Labelframe', borderwidth=3)
		framec.pack(side = TOP, fill=X, padx=5, pady=2)
		
		
		framex = TFrame(framec, style='FlatFrame')
		framex.pack(side = TOP, expand = 0, padx = 5, pady = 5)
		
		framey = TFrame(framec, style='FlatFrame')
		framey.pack(side = TOP, expand = 0, padx = 5, pady = 5)


		x_pixmaps = ['doleft', 'docenterh', 'dospacingh', 'doright']
		y_pixmaps = ['dotop', 'docenterv', 'dospacingv', 'dobottom']
		x_tooltips = [_('Distribute left sides equidistantly'),
						_('Distribute centers equidistantly horizontally'),
						_('Make horizontal gaps between objects equal'),
						_('Distribute right sides equidistantly')]

		y_tooltips = [_('Distribute tops sides equidistantly'),
						_('Distribute centers equidistantly vertically'),
						_('Make vertical gaps between objects equal'),
						_('Distribute bottoms sides equidistantly')]

		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, 5):
			button = make_button(framex, image = x_pixmaps[i - 1], value = i, variable = self.var_x, command = self.apply_x)
			tooltips.AddDescription(button, x_tooltips[i - 1])
			button.pack(side = LEFT, padx = 3)
			button = make_button(framey, image = y_pixmaps[i - 1], value = i, variable = self.var_y, command = self.apply_y)
			tooltips.AddDescription(button, y_tooltips[i - 1])
			button.pack(side = LEFT, padx = 3)
		
		#---------------------------------------------------------
		# Auto Apply Check
		self.var_auto_apply = IntVar(top)
		self.var_auto_apply.set(0)
		
		self.auto_apply_check = TCheckbutton(top, text = _("Auto Apply"), variable = self.var_auto_apply, command = self.reset)
		self.auto_apply_check.pack(side = TOP, anchor=W, padx=5,pady=5)
		
		#---------------------------------------------------------
		# Button frame 
		
		self.button_frame = TFrame(top, style='FlatFrame', borderwidth=5)
		self.button_frame.pack(side = BOTTOM, fill = BOTH)
		
		self.update_buttons = []
		self.button_apply = TButton(self.button_frame, text = _("Apply"),
								command = self.apply_distribute)
		
		self.apply_button_show(1)

		self.init_from_doc()
		self.subscribe_receivers()
	def init(self, master):
		PluginPanel.init(self, master)
		self.top = self.panel
		root = self.top
		
		self.USER_SPECIFIC = _("<Custom Size>")
		
		top_root = TFrame(root, borderwidth=2, style='FlatFrame')
		top_root.pack(side = TOP, expand = 1, fill = X)
		
		top=TLabelframe(top_root, text='Page format')
		top.pack(side = TOP, fill=X, pady=2)

		
		var_width_number = DoubleVar(root)
		var_height_number = DoubleVar(root)
		var_width_unit = StringVar(root)
		var_height_unit = StringVar(root)
		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)


# ===========================================================
		format_frame = TFrame(top, borderwidth=0, style='FlatFrame')
		format_frame.pack(side = TOP, expand = 1, fill = X, pady = 4)

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

# =====================		
		size_frame = TFrame(top, borderwidth=0, style='FlatFrame')
		size_frame.pack(side = TOP, fill = X, expand = 1, padx = 4, pady = 4)		
		label = TLabel(size_frame, text ="H: ", style='FlatLabel')
		
		self.widthentry = TSpinbox(size_frame, textvariable = var_width_number, command = self.var_width.UpdateNumber,
								vartype=1, min = 5, max = 50000, step = 1, width = 7)
		self.widthentry.pack(side = RIGHT, anchor = E, padx = 5)
		label.pack(side = RIGHT, anchor = E)
		
		size_frame = TFrame(top, borderwidth=0, style='FlatFrame')
		size_frame.pack(side = TOP, fill = X, expand = 1, padx = 4, pady = 4)
		label = TLabel(size_frame, text = "V: ", style='FlatLabel')
			
		self.heightentry = TSpinbox(size_frame, textvariable =var_height_number, command = self.var_height.UpdateNumber,
		 						vartype=1, min = 5, max = 50000, step = 1, width = 7)
		self.heightentry.pack(side = RIGHT, anchor = E, padx = 5)
		label.pack(side = RIGHT, anchor = E)
		
		size_frame = TFrame(top, borderwidth=0, style='FlatFrame')
		size_frame.pack(side = TOP, fill = X, expand = 1, padx = 4, pady = 4)

		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, width = 3)
		optmenu.pack(side = RIGHT, padx = 5)

		label = TLabel(size_frame, text = "Units: ", style='FlatLabel')
		label.pack(side = RIGHT)
#---------------------------------------------------------------------------------------------------------------------
		middle=TLabelframe(top_root, text='Page orientation')
		middle.pack(side = TOP, fill=X, pady=2)
		
		self.label = TLabel(middle, image = 'portrait', style='FlatLabel')
		self.label.pack(side = LEFT, padx=4)

		orientation_frame = TFrame(middle, borderwidth=0, style='FlatFrame')
		orientation_frame.pack(side = LEFT, expand = 1, fill = X)
		
		self.var_orientation = IntVar(root)
		radio = UpdatedRadiobutton(orientation_frame, text = _("Portrait"),
									variable = self.var_orientation,
									value = Portrait,
									command = self.choose_orientation)
		radio.pack(side = TOP, anchor=W)
		
		radio = UpdatedRadiobutton(orientation_frame, text = _("Landscape"),
									variable = self.var_orientation,
									value = Landscape,
									command = self.choose_orientation)
		radio.pack(side = TOP, anchor=W)

#---------------------------------------------------------------------------------------------------------------------
		button_frame = TFrame(top_root, borderwidth=1, style='FlatFrame')
		button_frame.pack(side = BOTTOM, fill = BOTH, pady=2)
		button = UpdatedButton(button_frame, text = _("Apply"), command = self.apply_settings, width=15)
		button.pack(side = BOTTOM)
		
		app.mw.docmanager.activedoc.Subscribe(LAYOUT, self.init_from_doc)
		app.mw.Subscribe(DOCUMENT, self.init_from_doc)
    def init(self, master):
        PluginPanel.init(self, master)
        root = self.mw.root
        self.var_reference = StringVar(root)
        self.var_reference.set(SELECT)

        #---------------------------------------------------------
        top = TFrame(self.panel, style='FlatFrame')
        top.pack(side=TOP, fill=BOTH)
        #---------------------------------------------------------
        label = TLabel(top,
                       text=" " + _("Relative to") + " ",
                       style="FlatLabel")
        label.pack(side=TOP, fill=BOTH, padx=5)
        rel_frame = TLabelframe(top,
                                labelwidget=label,
                                style='Labelframe',
                                borderwidth=3)
        rel_frame.pack(side=TOP, fill=X, padx=5, pady=2)

        self.reference = TCombobox(rel_frame,
                                   state='readonly',
                                   values=self.make_cs_list(),
                                   style='ComboNormal',
                                   width=14,
                                   textvariable=self.var_reference,
                                   postcommand=self.set_cs)
        self.reference.pack(side=TOP)
        #---------------------------------------------------------

        label = TLabel(top,
                       text=" " + _("Alignment type") + " ",
                       style="FlatLabel")
        label.pack(side=TOP, fill=BOTH, padx=5)
        framec = TLabelframe(top,
                             labelwidget=label,
                             style='Labelframe',
                             borderwidth=3)
        framec.pack(side=TOP, fill=X, padx=5, pady=2)

        framex = TFrame(framec, style='FlatFrame')
        framex.pack(side=TOP, expand=0, padx=5, pady=5)

        framey = TFrame(framec, style='FlatFrame')
        framey.pack(side=TOP, expand=0, padx=5, pady=5)

        x_pixmaps = ['aoleft', 'aocenterh', 'aoright']
        y_pixmaps = ['aotop', 'aocenterv', 'aobottom']
        x_tooltips = [
            _('Align left sides'),
            _('Center on vertical axis'),
            _('Align right sides')
        ]

        y_tooltips = [
            _('Align tops'),
            _('Center on horizontal axis'),
            _('Align bottoms')
        ]

        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,
                                 image=x_pixmaps[i - 1],
                                 value=i,
                                 variable=self.var_x,
                                 command=self.apply_x)
            tooltips.AddDescription(button, x_tooltips[i - 1])
            button.pack(side=LEFT, padx=3)
            button = make_button(framey,
                                 image=y_pixmaps[i - 1],
                                 value=i,
                                 variable=self.var_y,
                                 command=self.apply_y)
            tooltips.AddDescription(button, y_tooltips[i - 1])
            button.pack(side=LEFT, padx=3)

        #---------------------------------------------------------
        # Auto Apply Check
        self.var_auto_apply = IntVar(top)
        self.var_auto_apply.set(0)

        self.auto_apply_check = TCheckbutton(top,
                                             text=_("Auto Apply"),
                                             variable=self.var_auto_apply,
                                             command=self.reset)
        self.auto_apply_check.pack(side=TOP, anchor=W, padx=5, pady=5)

        #---------------------------------------------------------
        # Button frame

        self.button_frame = TFrame(top, style='FlatFrame', borderwidth=5)
        self.button_frame.pack(side=BOTTOM, fill=BOTH)

        self.update_buttons = []
        self.button_apply = TButton(self.button_frame,
                                    text=_("Apply"),
                                    command=self.apply)

        self.apply_button_show(1)

        self.init_from_doc()
        self.subscribe_receivers()
Beispiel #10
0
    def init(self, master):
        PluginPanel.init(self, master)

        self.width_priority = 1

        root = self.mw.root

        self.var_angleX = DoubleVar(root)
        self.var_angleY = DoubleVar(root)

        jump = 5
        self.var_angleX.set(0)
        self.var_angleY.set(0)

        self.var_proportional = IntVar(root)
        self.var_proportional.set(0)

        self.var_basepoint = StringVar(root)
        self.var_basepoint.set('C')

        #---------------------------------------------------------
        top = TFrame(self.panel, style='FlatFrame')
        top.pack(side=TOP, fill=BOTH)
        #---------------------------------------------------------
        # Horisontal
        size_frameH = TFrame(top, style='FlatFrame', borderwidth=3)
        size_frameH.pack(side=TOP, fill=BOTH)

        label = TLabel(size_frameH, style='FlatLabel', image='skew_h')
        label.pack(side=LEFT, padx=5)
        self.entry_angleX = TSpinbox(size_frameH,
                                     var=0,
                                     vartype=1,
                                     textvariable=self.var_angleX,
                                     min=-75,
                                     max=75,
                                     step=jump,
                                     width=10,
                                     command=self.apply_skew)
        self.entry_angleX.pack(side=LEFT)

        self.labelwunit = TLabel(size_frameH, style='FlatLabel', text=_("deg"))
        self.labelwunit.pack(side=LEFT, padx=5)
        #---------------------------------------------------------
        # Vertical

        size_frameV = TFrame(top, style='FlatFrame', borderwidth=3)
        size_frameV.pack(side=TOP, fill=BOTH)
        label = TLabel(size_frameV, style='FlatLabel', image='skew_v')
        label.pack(side=LEFT, padx=5)

        self.entry_angleY = TSpinbox(size_frameV,
                                     var=0,
                                     vartype=1,
                                     textvariable=self.var_angleY,
                                     min=-75,
                                     max=75,
                                     step=jump,
                                     width=10,
                                     command=self.apply_skew)
        self.entry_angleY.pack(side=LEFT)

        self.labelhunit = TLabel(size_frameV, style='FlatLabel', text=_("deg"))
        self.labelhunit.pack(side=LEFT, padx=5)

        #---------------------------------------------------------
        # Basepoint check
        label = TLabel(top, style='FlatLabel', text=_("Basepoint:"))
        label.pack(side=TOP, fill=BOTH, padx=5)
        basepoint_frame = TLabelframe(top,
                                      labelwidget=label,
                                      style='Labelframe',
                                      borderwidth=4)
        basepoint_frame.pack(side=TOP, fill=X, padx=5, pady=2)

        self.Basepoint = BasePointSelector(basepoint_frame,
                                           anchor=self.var_basepoint)
        self.Basepoint.pack(side=LEFT, fill=BOTH, padx=5)

        label = TLabel(basepoint_frame,
                       style='FlatLabel',
                       image='coordinate_deg')
        label.pack(side=LEFT, fill=BOTH, padx=10)

        #---------------------------------------------------------
        # Button frame

        button_frame = TFrame(top, style='FlatFrame', borderwidth=5)
        button_frame.pack(side=BOTTOM, fill=BOTH)

        self.update_buttons = []
        self.button = UpdatedButton(top,
                                    text=_("Apply"),
                                    command=self.apply_skew)
        self.button.pack(in_=button_frame,
                         side=BOTTOM,
                         expand=1,
                         fill=X,
                         pady=3)

        self.button_copy = UpdatedButton(top,
                                         text=_("Apply to Copy"),
                                         command=self.apply_to_copy)
        self.button_copy.pack(in_=button_frame, side=BOTTOM, expand=1, fill=X)

        self.init_from_doc()
        self.subscribe_receivers()
Beispiel #11
0
    def init(self, master):
        PluginPanel.init(self, master)

        self.width_priority = 1

        root = self.mw.root

        self.var_angleX = DoubleVar(root)
        self.var_angleY = DoubleVar(root)

        jump = 5
        self.var_angleX.set(0)
        self.var_angleY.set(0)

        self.var_proportional = IntVar(root)
        self.var_proportional.set(0)

        self.var_basepoint = StringVar(root)
        self.var_basepoint.set("C")

        # ---------------------------------------------------------
        top = TFrame(self.panel, style="FlatFrame")
        top.pack(side=TOP, fill=BOTH)
        # ---------------------------------------------------------
        # Horisontal
        size_frameH = TFrame(top, style="FlatFrame", borderwidth=3)
        size_frameH.pack(side=TOP, fill=BOTH)

        label = TLabel(size_frameH, style="FlatLabel", image="skew_h")
        label.pack(side=LEFT, padx=5)
        self.entry_angleX = TSpinbox(
            size_frameH,
            var=0,
            vartype=1,
            textvariable=self.var_angleX,
            min=-75,
            max=75,
            step=jump,
            width=10,
            command=self.apply_skew,
        )
        self.entry_angleX.pack(side=LEFT)

        self.labelwunit = TLabel(size_frameH, style="FlatLabel", text=_("deg"))
        self.labelwunit.pack(side=LEFT, padx=5)
        # ---------------------------------------------------------
        # Vertical

        size_frameV = TFrame(top, style="FlatFrame", borderwidth=3)
        size_frameV.pack(side=TOP, fill=BOTH)
        label = TLabel(size_frameV, style="FlatLabel", image="skew_v")
        label.pack(side=LEFT, padx=5)

        self.entry_angleY = TSpinbox(
            size_frameV,
            var=0,
            vartype=1,
            textvariable=self.var_angleY,
            min=-75,
            max=75,
            step=jump,
            width=10,
            command=self.apply_skew,
        )
        self.entry_angleY.pack(side=LEFT)

        self.labelhunit = TLabel(size_frameV, style="FlatLabel", text=_("deg"))
        self.labelhunit.pack(side=LEFT, padx=5)

        # ---------------------------------------------------------
        # Basepoint check
        label = TLabel(top, style="FlatLabel", text=_("Basepoint:"))
        label.pack(side=TOP, fill=BOTH, padx=5)
        basepoint_frame = TLabelframe(top, labelwidget=label, style="Labelframe", borderwidth=4)
        basepoint_frame.pack(side=TOP, fill=X, padx=5, pady=2)

        self.Basepoint = BasePointSelector(basepoint_frame, anchor=self.var_basepoint)
        self.Basepoint.pack(side=LEFT, fill=BOTH, padx=5)

        label = TLabel(basepoint_frame, style="FlatLabel", image="coordinate_deg")
        label.pack(side=LEFT, fill=BOTH, padx=10)

        # ---------------------------------------------------------
        # Button frame

        button_frame = TFrame(top, style="FlatFrame", borderwidth=5)
        button_frame.pack(side=BOTTOM, fill=BOTH)

        self.update_buttons = []
        self.button = UpdatedButton(top, text=_("Apply"), command=self.apply_skew)
        self.button.pack(in_=button_frame, side=BOTTOM, expand=1, fill=X, pady=3)

        self.button_copy = UpdatedButton(top, text=_("Apply to Copy"), command=self.apply_to_copy)
        self.button_copy.pack(in_=button_frame, side=BOTTOM, expand=1, fill=X)

        self.init_from_doc()
        self.subscribe_receivers()
Beispiel #12
0
    def init(self, master):
        PluginPanel.init(self, master)

        root = self.mw.root

        self.var_angle = DoubleVar(root)
        self.var_angle.set(0)

        self.var_width_number = DoubleVar(root)
        self.var_height_number = DoubleVar(root)

        self.var_width_base = DoubleVar(root)
        self.var_height_base = DoubleVar(root)

        self.cnt_x_absolute = None
        self.cnt_y_absolute = None

        var_width_unit = StringVar(root)
        var_height_unit = StringVar(root)

        unit = config.preferences.default_unit
        self.var_width = LengthVar(10, unit, self.var_width_number,
                                   var_width_unit)
        self.var_height = LengthVar(10, unit, self.var_height_number,
                                    var_height_unit)

        jump = config.preferences.default_unit_jump
        self.var_width.set(0)
        self.var_height.set(0)

        self.var_width_base.set(0)
        self.var_height_base.set(0)

        self.var_position = StringVar(root)
        self.var_position.set(ABSOLUTE)

        self.var_basepoint = StringVar(root)
        self.var_basepoint.set('C')

        #---------------------------------------------------------
        top = TFrame(self.panel, style='FlatFrame')
        top.pack(side=TOP, fill=BOTH)
        #---------------------------------------------------------

        angle_frame = TFrame(top, style='FlatFrame', borderwidth=3)
        angle_frame.pack(side=TOP, fill=BOTH)
        label = TLabel(angle_frame,
                       style='FlatLabel',
                       text=" " + _("Angle:") + " ")
        label.pack(side=LEFT, padx=5)

        self.entry_angle = TSpinbox(angle_frame,
                                    var=0,
                                    vartype=1,
                                    textvariable=self.var_angle,
                                    min=-360,
                                    max=360,
                                    step=5,
                                    width=6,
                                    command=self.apply_rotate)
        self.entry_angle.pack(side=LEFT, anchor=E)
        label = TLabel(angle_frame, style='FlatLabel', text=_("deg"))
        label.pack(side=LEFT, padx=5)
        #---------------------------------------------------------
        label = TLabel(top, style='FlatLabel', text=_("Center:"))
        label.pack(side=TOP, fill=BOTH, padx=5)

        #---------------------------------------------------------
        # Horisontal
        size_frameH = TFrame(top, style='FlatFrame', borderwidth=3)
        size_frameH.pack(side=TOP, fill=BOTH)

        label = TLabel(size_frameH, style='FlatLabel', image='center_h')
        label.pack(side=LEFT, padx=5)
        self.entry_width = TSpinbox(size_frameH,
                                    var=0,
                                    vartype=1,
                                    textvariable=self.var_width_number,
                                    min=-50000,
                                    max=50000,
                                    step=jump,
                                    width=10,
                                    command=self.apply_rotate)
        self.entry_width.pack(side=LEFT)

        self.labelwunit = TLabel(size_frameH,
                                 style='FlatLabel',
                                 text=self.var_width.unit)
        self.labelwunit.pack(side=LEFT, padx=5)
        #---------------------------------------------------------
        # Vertical

        size_frameV = TFrame(top, style='FlatFrame', borderwidth=3)
        size_frameV.pack(side=TOP, fill=BOTH)
        label = TLabel(size_frameV, style='FlatLabel', image='center_v')
        label.pack(side=LEFT, padx=5)

        self.entry_height = TSpinbox(size_frameV,
                                     var=0,
                                     vartype=1,
                                     textvariable=self.var_height_number,
                                     min=-50000,
                                     max=50000,
                                     step=jump,
                                     width=10,
                                     command=self.apply_rotate)
        self.entry_height.pack(side=LEFT)

        self.labelhunit = TLabel(size_frameV,
                                 style='FlatLabel',
                                 text=self.var_height.unit)
        self.labelhunit.pack(side=LEFT, padx=5)

        #---------------------------------------------------------
        # position chek

        self.position_check = TCheckbutton(top,
                                           text=_("Absolute Center"),
                                           variable=self.var_position,
                                           onvalue=ABSOLUTE,
                                           offvalue=RELATIVE,
                                           command=self.position)
        self.position_check.pack(side=TOP, anchor=W, padx=5, pady=5)

        #---------------------------------------------------------
        # Basepoint check

        label = TLabel(top, style='FlatLabel', text=_("Basepoint:"))
        label.pack(side=TOP, fill=BOTH, padx=5)
        basepoint_frame = TLabelframe(top,
                                      labelwidget=label,
                                      style='Labelframe',
                                      borderwidth=4)
        basepoint_frame.pack(side=TOP, fill=X, padx=5, pady=2)

        self.Basepoint = BasePointSelector(basepoint_frame,
                                           anchor=self.var_basepoint,
                                           command=self.apply_basepoint)
        self.Basepoint.pack(side=LEFT, fill=BOTH, padx=5)

        label = TLabel(basepoint_frame,
                       style='FlatLabel',
                       image='coordinate_deg')
        label.pack(side=LEFT, fill=BOTH, padx=10)

        self.position_check.pack(side=TOP, anchor=W, padx=5, pady=5)

        #---------------------------------------------------------
        # Button frame

        button_frame = TFrame(top, style='FlatFrame', borderwidth=5)
        button_frame.pack(side=BOTTOM, fill=BOTH)

        self.update_buttons = []
        self.button = UpdatedButton(top,
                                    text=_("Apply"),
                                    command=self.apply_rotate)
        self.button.pack(in_=button_frame,
                         side=BOTTOM,
                         expand=1,
                         fill=X,
                         pady=3)

        self.button_copy = UpdatedButton(top,
                                         text=_("Apply to Copy"),
                                         command=self.apply_to_copy)
        self.button_copy.pack(in_=button_frame, side=BOTTOM, expand=1, fill=X)

        self.init_from_doc()
        self.subscribe_receivers()
Beispiel #13
0
	def init(self, master):
		PluginPanel.init(self, master)
		
		root=self.mw.root
		
		top = TFrame(self.panel, style='FlatFrame', borderwidth=5)
		top.pack(side = TOP, fill=BOTH)

		########### APPLY BUTTON ################################################
		button = UpdatedButton(top, text = _("Apply"),
								command = self.apply_properties,
								sensitivecb = self.is_correct_selection)
		button.pack(side = BOTTOM, expand = 1, fill = X)
		self.Subscribe(SELECTION, button.Update)

		########### COLOR BUTTON ################################################		
		
		color_frame = TFrame(top, style='FlatFrame', borderwidth=3)
		color_frame.pack(side = TOP)
		
		label = TLabel(color_frame, style='FlatLabel', text=_('Color:'))
		label.pack(side = LEFT, padx=5)
		
		self.color_button = TColorButton(color_frame, command=self.show_outline_color)
		self.color_button.pack(side = LEFT, padx=5)
		self.color_button.set_color((255,0,0))
		
		########### LINE WIDTH ##################################################

		self.var_width_number=DoubleVar(root)
		
		self.var_width_base=DoubleVar(root)

		var_width_unit = StringVar(root)
		
		unit = config.preferences.default_unit
		
		self.var_width = LengthVar(10, unit, self.var_width_number, var_width_unit)
		
		line_width_frame = TFrame(top, style='FlatFrame', borderwidth=3)
		line_width_frame.pack(side = TOP, fill = BOTH)

		self.labelwunit = TLabel(line_width_frame, style='FlatLabel', text = self.var_width.unit)
		self.labelwunit.pack(side = RIGHT, padx=5)
		
		self.entry_width = TSpinbox(line_width_frame,  var=0, vartype=1, textvariable = self.var_width_number, 
									min = 0, max = 50000, step = .1, width = 8, command=self.update_pattern)
		self.entry_width.pack(side = RIGHT)
		
		label = TLabel(line_width_frame, style='FlatLabel', text=_('Line width:'))
		label.pack(side = RIGHT, padx=5)		
		########### LINE STYLE #################################################		
		style_frame = TFrame(top, style='FlatFrame', borderwidth=5)
		style_frame.pack(side = TOP, fill=X)
		
		for item in range(1,12):
			self.dashlist.append("dash%d"%(item))
		
		self.style_button = TOptionMenu(style_frame, self.dashlist, command = self.set_dash, 
									entry_type = 'image', style='TComboSmall')
		self.style_button.pack(side = RIGHT, fill=X)
		
		label = TLabel(style_frame, style='FlatLabel', text=_('Style:'))
		label.pack(side = RIGHT, padx=5)

		########################################################################		
		selection_frame = TFrame(top, style='FlatFrame', borderwidth=1)
		selection_frame.pack(side = TOP)
			
		########### CORNERS #####################################################	
		
		label=TLabel(selection_frame, text=" "+_("Corners:")+" ", style="FlatLabel")
		label.pack()
		
		corners_frame=TLabelframe(selection_frame, labelwidget=label, style='Labelframe', borderwidth=8)

		corners_frame.pack(side = LEFT, fill=Y, pady=1, padx=1)
		
		self.var_corner = IntVar(root)
		radio = UpdatedRadiobutton(corners_frame, image = "join_miter",
									variable = self.var_corner,
									value = const.JoinMiter,
									command = self.update_pattern)
		radio.pack(side = TOP, anchor=W, pady=2)
		
		radio = UpdatedRadiobutton(corners_frame, image = "join_round",
									variable = self.var_corner,
									value = const.JoinRound,
									command = self.update_pattern)
		radio.pack(side = TOP, anchor=W, pady=2)
		
		radio = UpdatedRadiobutton(corners_frame, image = "join_bevel",
									variable = self.var_corner,
									value = const.JoinBevel,
									command = self.update_pattern)
		radio.pack(side = TOP, anchor=W, pady=2)

		
		########### LINE CAPS ###################################################
		
		label=TLabel(selection_frame, text=" "+_("Line caps:")+" ", style="FlatLabel")
		label.pack()
		
		caps_frame=TLabelframe(selection_frame, labelwidget=label, style='Labelframe', borderwidth=8)

		caps_frame.pack(side = RIGHT, fill=Y, pady=1, padx=1)
		
		self.var_caps = IntVar(root)
		radio = UpdatedRadiobutton(caps_frame, image = "cap_butt",
									variable = self.var_caps,
									value = const.CapButt,
									command = self.update_pattern)
		radio.pack(side = TOP, anchor=W, pady=2)
		
		radio = UpdatedRadiobutton(caps_frame, image = "cap_round",
									variable = self.var_caps,
									value = const.CapRound,
									command = self.update_pattern)
		radio.pack(side = TOP, anchor=W, pady=2)
		
		radio = UpdatedRadiobutton(caps_frame, image = "cap_projecting",
									variable = self.var_caps,
									value = const.CapProjecting,
									command = self.update_pattern)
		radio.pack(side = TOP, anchor=W, pady=2)
		self.var_caps.set(0)
		
		############ BOTTOM BUTTONS #############################################
		
		button_frame = TFrame(top, style='FlatFrame', borderwidth=1)
		button_frame.pack(side = BOTTOM, fill=X, pady=5)
		
		button = TButton(button_frame, style='TSmallbutton', text=' ', image='small_colorpicker', command = self.copy_from)
		button.pack(side = LEFT)
		tooltips.AddDescription(button, _("Copy From..."))
		
		button = TButton(button_frame, style='TSmallbutton', text=' ', image='restore_color', command = self.restore_properties)
		button.pack(side = LEFT, padx=5)
		tooltips.AddDescription(button, _("Restore properties"))
		
		self.var_autoupdate = IntVar(top)
		self.var_autoupdate.set(1)
		
		self.autoupdate_check = TCheckbutton(button_frame, text = _("Auto Update"), variable = self.var_autoupdate, 
											command=self.init_from_doc)
		self.autoupdate_check.pack(side = RIGHT, anchor=W, padx=10)
		#######################################################################
		
		
		self.set_default_style()

		self.init_from_doc()
		self.subscribe_receivers()
    def init(self, master):
        PluginPanel.init(self, master)

        root = self.mw.root

        top = TFrame(self.panel, style='FlatFrame', borderwidth=5)
        top.pack(side=TOP, fill=BOTH)

        ########### APPLY BUTTON ################################################
        button = UpdatedButton(top,
                               text=_("Apply"),
                               command=self.apply_properties,
                               sensitivecb=self.is_correct_selection)
        button.pack(side=BOTTOM, expand=1, fill=X)
        self.Subscribe(SELECTION, button.Update)

        ########### COLOR BUTTON ################################################

        color_frame = TFrame(top, style='FlatFrame', borderwidth=3)
        color_frame.pack(side=TOP)

        label = TLabel(color_frame, style='FlatLabel', text=_('Color:'))
        label.pack(side=LEFT, padx=5)

        self.color_button = TColorButton(color_frame,
                                         command=self.show_outline_color)
        self.color_button.pack(side=LEFT, padx=5)
        self.color_button.set_color((255, 0, 0))

        ########### LINE WIDTH ##################################################

        self.var_width_number = DoubleVar(root)

        self.var_width_base = DoubleVar(root)

        var_width_unit = StringVar(root)

        unit = config.preferences.default_unit

        self.var_width = LengthVar(10, unit, self.var_width_number,
                                   var_width_unit)

        line_width_frame = TFrame(top, style='FlatFrame', borderwidth=3)
        line_width_frame.pack(side=TOP, fill=BOTH)

        self.labelwunit = TLabel(line_width_frame,
                                 style='FlatLabel',
                                 text=self.var_width.unit)
        self.labelwunit.pack(side=RIGHT, padx=5)

        self.entry_width = TSpinbox(line_width_frame,
                                    var=0,
                                    vartype=1,
                                    textvariable=self.var_width_number,
                                    min=0,
                                    max=50000,
                                    step=.1,
                                    width=8,
                                    command=self.update_pattern)
        self.entry_width.pack(side=RIGHT)

        label = TLabel(line_width_frame,
                       style='FlatLabel',
                       text=_('Line width:'))
        label.pack(side=RIGHT, padx=5)
        ########### LINE STYLE #################################################
        style_frame = TFrame(top, style='FlatFrame', borderwidth=5)
        style_frame.pack(side=TOP, fill=X)

        for item in range(1, 12):
            self.dashlist.append("dash%d" % (item))

        self.style_button = TOptionMenu(style_frame,
                                        self.dashlist,
                                        command=self.set_dash,
                                        entry_type='image',
                                        style='TComboSmall')
        self.style_button.pack(side=RIGHT, fill=X)

        label = TLabel(style_frame, style='FlatLabel', text=_('Style:'))
        label.pack(side=RIGHT, padx=5)

        ########################################################################
        selection_frame = TFrame(top, style='FlatFrame', borderwidth=1)
        selection_frame.pack(side=TOP)

        ########### CORNERS #####################################################

        label = TLabel(selection_frame,
                       text=" " + _("Corners:") + " ",
                       style="FlatLabel")
        label.pack()

        corners_frame = TLabelframe(selection_frame,
                                    labelwidget=label,
                                    style='Labelframe',
                                    borderwidth=8)

        corners_frame.pack(side=LEFT, fill=Y, pady=1, padx=1)

        self.var_corner = IntVar(root)
        radio = UpdatedRadiobutton(corners_frame,
                                   image="join_miter",
                                   variable=self.var_corner,
                                   value=const.JoinMiter,
                                   command=self.update_pattern)
        radio.pack(side=TOP, anchor=W, pady=2)

        radio = UpdatedRadiobutton(corners_frame,
                                   image="join_round",
                                   variable=self.var_corner,
                                   value=const.JoinRound,
                                   command=self.update_pattern)
        radio.pack(side=TOP, anchor=W, pady=2)

        radio = UpdatedRadiobutton(corners_frame,
                                   image="join_bevel",
                                   variable=self.var_corner,
                                   value=const.JoinBevel,
                                   command=self.update_pattern)
        radio.pack(side=TOP, anchor=W, pady=2)

        ########### LINE CAPS ###################################################

        label = TLabel(selection_frame,
                       text=" " + _("Line caps:") + " ",
                       style="FlatLabel")
        label.pack()

        caps_frame = TLabelframe(selection_frame,
                                 labelwidget=label,
                                 style='Labelframe',
                                 borderwidth=8)

        caps_frame.pack(side=RIGHT, fill=Y, pady=1, padx=1)

        self.var_caps = IntVar(root)
        radio = UpdatedRadiobutton(caps_frame,
                                   image="cap_butt",
                                   variable=self.var_caps,
                                   value=const.CapButt,
                                   command=self.update_pattern)
        radio.pack(side=TOP, anchor=W, pady=2)

        radio = UpdatedRadiobutton(caps_frame,
                                   image="cap_round",
                                   variable=self.var_caps,
                                   value=const.CapRound,
                                   command=self.update_pattern)
        radio.pack(side=TOP, anchor=W, pady=2)

        radio = UpdatedRadiobutton(caps_frame,
                                   image="cap_projecting",
                                   variable=self.var_caps,
                                   value=const.CapProjecting,
                                   command=self.update_pattern)
        radio.pack(side=TOP, anchor=W, pady=2)
        self.var_caps.set(0)

        ############ BOTTOM BUTTONS #############################################

        button_frame = TFrame(top, style='FlatFrame', borderwidth=1)
        button_frame.pack(side=BOTTOM, fill=X, pady=5)

        button = TButton(button_frame,
                         style='TSmallbutton',
                         text=' ',
                         image='small_colorpicker',
                         command=self.copy_from)
        button.pack(side=LEFT)
        tooltips.AddDescription(button, _("Copy From..."))

        button = TButton(button_frame,
                         style='TSmallbutton',
                         text=' ',
                         image='restore_color',
                         command=self.restore_properties)
        button.pack(side=LEFT, padx=5)
        tooltips.AddDescription(button, _("Restore properties"))

        self.var_autoupdate = IntVar(top)
        self.var_autoupdate.set(1)

        self.autoupdate_check = TCheckbutton(button_frame,
                                             text=_("Auto Update"),
                                             variable=self.var_autoupdate,
                                             command=self.init_from_doc)
        self.autoupdate_check.pack(side=RIGHT, anchor=W, padx=10)
        #######################################################################

        self.set_default_style()

        self.init_from_doc()
        self.subscribe_receivers()
Beispiel #15
0
	def init(self, master):
		PluginPanel.init(self, master)
		top = self.panel

		top = TFrame(top, borderwidth=2, style='FlatFrame')
		top.pack(side = TOP, expand = 1, fill = X)

		button_frame = TFrame(top, borderwidth=2, style='FlatFrame')
		button_frame.pack(side = BOTTOM, fill = BOTH, expand = 1)
		
		button=TButton(button_frame,text=_('Apply'), command=self.replace)
		button.pack(side = TOP)
		
		#----------------------------------------------------------
		main_frame = TFrame(top, style='FlatFrame', borderwidth=3)
		main_frame.pack(side = TOP, fill=X)

		self.find_var = StringVar(top);
		self.find_var.set('')
		findField = TEntryExt(main_frame, textvariable=self.find_var)
		findField.pack(side = RIGHT)
			   
		label = TLabel(main_frame, style='FlatLabel', text = _("Find:")+" ")
		label.pack(side = RIGHT, anchor = E)
		#---------------------------------------------------------
		main_frame = TFrame(top, style='FlatFrame', borderwidth=3)
		main_frame.pack(side = TOP, fill=X)


		self.replace_var = StringVar(top);
		self.replace_var.set('')
		replaceField = TEntryExt(main_frame, textvariable=self.replace_var)
		replaceField.pack(side = RIGHT)
		
		label = TLabel(main_frame, style='FlatLabel', text = _("Replace to:")+" ")
		label.pack(side = RIGHT, anchor = E)
		
		main_frame = TFrame(top, style='FlatFrame', borderwidth=3)
		main_frame.pack(side = TOP)
		#---------------------------------------------------------
		label=TLabel(top, text=" "+_("Parameters")+" ", style="FlatLabel")
		label.pack()
		
		parametersFrameLabel=TLabelframe(top, labelwidget=label, style='Labelframe', borderwidth=4)

		parametersFrameLabel.pack(side = TOP, fill=X, pady=4, padx=4)
		
		parametersFrame = TFrame(parametersFrameLabel, style='FlatFrame')  
		
		self.var_case_sensitive = BooleanVar(top)
		self.var_case_sensitive.set(False)
		self.case_sensitive_check = TCheckbutton(parametersFrame, text = _("Case sensitive"), variable = self.var_case_sensitive)
		self.case_sensitive_check.pack(side = TOP, anchor=W, padx=5)
	   
		self.var_whole_word = BooleanVar(top)
		self.var_whole_word.set(False)
		self.whole_word_check = TCheckbutton(parametersFrame, text = _("Whole word"), variable = self.var_whole_word)
		self.whole_word_check.pack(side = TOP, anchor=W, padx=5)
		
		self.var_regexp = BooleanVar(top)
		self.var_regexp.set(False)
		self.regexpCheck = TCheckbutton(parametersFrame, text = _("RegExp search"), variable = self.var_regexp, command=self.disable_enable_action)
		self.regexpCheck.pack(side = TOP, anchor=W, padx=5)
		
		parametersFrame.pack(side=TOP, fill=X, pady=2)