예제 #1
0
파일: general.py 프로젝트: kindlychung/sk1
	def build(self):
		text = _('sK1 generates PDF file as a printing output. So as a printing target you can use any application \
which accepts PDF file on input: evince, kprinter, acroread etc. \
Printing command should contain %f symbols replaced by \
temporal PDF file name during printing.')
		label = Text(self, height=5, wrap=WORD)
		label.pack(side=TOP, anchor='nw')
		label.insert(END, text)

		frame = FlatFrame(self)
		frame.pack(side=TOP, fill=X, expand=1, pady=10)

		frame.columnconfigure(1, weight=1)

		label = Label(frame, text=_('Printing command:'), justify=LEFT)
		label.grid(column=0, row=0, sticky='w')


		combo = TCombobox(frame, state='normal', values=self.prn_commandrs, style='ComboNormal',
									 textvariable=self.var_print_command)#, width=30)
		combo.grid(column=1, row=0, sticky='we', pady=5, padx=10)

		label = Label(frame, text=_('Output PDF level:'), justify=LEFT)
		label.grid(column=0, row=1, sticky='w')


		combo = TCombobox(frame, state='readonly', values=self.levels, style='ComboNormal',
									 width=10, textvariable=self.var_pdf_level)
		combo.grid(column=1, row=1, sticky='w', pady=5, padx=10)
예제 #2
0
	def build_dlg(self):
		if not self.builded:
			cmds = self.mw.canvas.commands.Ellipse

			label = TLabel(self.panel, text=_("Start:"))
			label.pack(side=LEFT, padx=2)
			self.entry_start = TSpinbox(self.panel, var=0, vartype=1, textvariable=self.start,
							min=-360, max=360, step=5, width=6, command=self.applyAngle)
			self.entry_start.pack(side=LEFT, padx=2)
			tooltips.AddDescription(self.entry_start, _('Arc start point angle'))

			#--------------
			sep = FlatFrame(self.panel, width=5, height=2)
			sep.pack(side=LEFT)
			#--------------

			label = TLabel(self.panel, text=_("End:"))
			label.pack(side=LEFT, padx=2)
			self.entry_end = TSpinbox(self.panel, var=0, vartype=1, textvariable=self.end,
							min=-360, max=360, step=5, width=6, command=self.applyAngle)
			self.entry_end.pack(side=LEFT, padx=2)
			tooltips.AddDescription(self.entry_end, _('Arc end point angle'))

			b = TButton(self.panel, command=self.ResetAngle, style='Toolbutton', image='context_arc_reset')
			tooltips.AddDescription(b, _('Reset angles'))
			b.pack(side=LEFT)

			b = TButton(self.panel, command=self.SwapAngle, style='Toolbutton', image='context_arc_swap')
			tooltips.AddDescription(b, _('Swap angles'))
			b.pack(side=LEFT)

			b = TLabel(self.panel, image="toolbar_sep")
			b.pack(side=LEFT)

			b = TButton(self.panel, command=cmds.EllipseArc.Invoke, style='Toolbutton', image='context_arc')
			tooltips.AddDescription(b, _('to Arc'))
			b.pack(side=LEFT)

			b = TButton(self.panel, command=cmds.EllipseChord.Invoke, style='Toolbutton', image='context_chord')
			tooltips.AddDescription(b, _('to Chord'))
			b.pack(side=LEFT)

			b = TButton(self.panel, command=cmds.EllipsePieSlice.Invoke, style='Toolbutton', image='context_pie')
			tooltips.AddDescription(b, _('to Pie'))
			b.pack(side=LEFT)
			self.builded = 1
		else:
			obj = self.mw.document.CurrentObject()
			if obj and obj.is_Ellipse:
				start_angle = round(obj.start_angle / degrees, 2)
				end_angle = round(obj.end_angle / degrees, 2)
				self.entry_start.set_value(start_angle)
				self.entry_end.set_value(end_angle)
예제 #3
0
    def __init__(self, parent):
        CtxSubPanel.__init__(self, parent)
        self.radius1 = DoubleVar(self.mw.root, 0)
        self.radius2 = DoubleVar(self.mw.root, 0)
        label = TLabel(self.panel, image='context_rect_rx')
        label.pack(side=LEFT, padx=2)
        self.entry_radius1 = TSpinbox(self.panel,
                                      var=0,
                                      vartype=1,
                                      textvariable=self.radius1,
                                      min=0,
                                      max=100,
                                      step=1,
                                      width=6,
                                      command=self.applyRadius1)
        self.entry_radius1.pack(side=LEFT, padx=2)
        tooltips.AddDescription(self.entry_radius1,
                                _('Horizontal radius of rounded corners'))

        #--------------
        sep = FlatFrame(self.panel, width=4, height=2)
        sep.pack(side=LEFT)
        #--------------

        label = TLabel(self.panel, image='context_rect_ry')
        label.pack(side=LEFT, padx=2)
        self.entry_radius2 = TSpinbox(self.panel,
                                      var=0,
                                      vartype=1,
                                      textvariable=self.radius2,
                                      min=0,
                                      max=100,
                                      step=1,
                                      width=6,
                                      command=self.applyRadius1)
        self.entry_radius2.pack(side=LEFT, padx=2)
        tooltips.AddDescription(self.entry_radius2,
                                _('Vertical radius of rounded corners'))

        self.ReSubscribe()
예제 #4
0
    def build(self):
        text = _(
            'sK1 generates PDF file as a printing output. So as a printing target you can use any application \
which accepts PDF file on input: evince, kprinter, acroread etc. \
Printing command should contain %f symbols replaced by \
temporal PDF file name during printing.')
        label = Text(self, height=5, wrap=WORD)
        label.pack(side=TOP, anchor='nw')
        label.insert(END, text)

        frame = FlatFrame(self)
        frame.pack(side=TOP, fill=X, expand=1, pady=10)

        frame.columnconfigure(1, weight=1)

        label = Label(frame, text=_('Printing command:'), justify=LEFT)
        label.grid(column=0, row=0, sticky='w')

        combo = TCombobox(frame,
                          state='normal',
                          values=self.prn_commandrs,
                          style='ComboNormal',
                          textvariable=self.var_print_command)  #, width=30)
        combo.grid(column=1, row=0, sticky='we', pady=5, padx=10)

        label = Label(frame, text=_('Output PDF level:'), justify=LEFT)
        label.grid(column=0, row=1, sticky='w')

        combo = TCombobox(frame,
                          state='readonly',
                          values=self.levels,
                          style='ComboNormal',
                          width=10,
                          textvariable=self.var_pdf_level)
        combo.grid(column=1, row=1, sticky='w', pady=5, padx=10)
예제 #5
0
	def __init__(self, parent):
		CtxSubPanel.__init__(self, parent)
		self.radius1 = DoubleVar(self.mw.root, 0)
		self.radius2 = DoubleVar(self.mw.root, 0)
		label = TLabel(self.panel, image='context_rect_rx')
		label.pack(side=LEFT, padx=2)
		self.entry_radius1 = TSpinbox(self.panel, var=0, vartype=1, textvariable=self.radius1,
						min=0, max=100, step=1, width=6, command=self.applyRadius1)
		self.entry_radius1.pack(side=LEFT, padx=2)
		tooltips.AddDescription(self.entry_radius1, _('Horizontal radius of rounded corners'))

		#--------------
		sep = FlatFrame(self.panel, width=4, height=2)
		sep.pack(side=LEFT)
		#--------------

		label = TLabel(self.panel, image='context_rect_ry')
		label.pack(side=LEFT, padx=2)
		self.entry_radius2 = TSpinbox(self.panel, var=0, vartype=1, textvariable=self.radius2,
						min=0, max=100, step=1, width=6, command=self.applyRadius1)
		self.entry_radius2.pack(side=LEFT, padx=2)
		tooltips.AddDescription(self.entry_radius2, _('Vertical radius of rounded corners'))

		self.ReSubscribe()
예제 #6
0
	def __init__(self, parent):
		CtxSubPanel.__init__(self, parent)

		self.USER_SPECIFIC = _("<Custom Size>")

		root = self.mw.root
		self.var_format_name = StringVar(root)
		self.var_format_name.set(config.preferences.default_paper_format)
		self.page_orientation = config.preferences.default_page_orientation

		label = TLabel(self.panel, text=_("Page:"))
		label.pack(side=LEFT, padx=2)
		self.page_formats = TCombobox(self.panel, state='readonly', postcommand=self.set_format,
									 values=self.make_formats(), width=17, style='ComboNormal',
									 textvariable=self.var_format_name)
		tooltips.AddDescription(self.page_formats, _("Page formats"))
		self.page_formats.pack(side=LEFT, padx=2)

		#--------------
		sep = FlatFrame(self.panel, width=5, height=2)
		sep.pack(side=LEFT)
		#--------------

		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)
		jump = config.preferences.default_unit_jump

		label = TLabel(self.panel, text=_("H:"))
		label.pack(side=LEFT)
		self.widthentry = TSpinbox(self.panel, textvariable=var_width_number, command=self.applyResize,
								vartype=1, min=5, max=50000, step=jump, width=7)
		tooltips.AddDescription(self.widthentry, _("Page width"))
		self.widthentry.pack(side=LEFT, padx=2)

		#--------------
		sep = FlatFrame(self.panel, width=5, height=2)
		sep.pack(side=LEFT)
		#--------------

		label = TLabel(self.panel, text=_("V:"))
		label.pack(side=LEFT)
		self.heightentry = TSpinbox(self.panel, textvariable=var_height_number, command=self.applyResize,
		 						vartype=1, min=5, max=50000, step=jump, width=7)
		tooltips.AddDescription(self.heightentry, _("Page height"))
		self.heightentry.pack(side=LEFT, padx=2)

		self.portrait_val = StringVar(root)
		self.landscape_val = StringVar(root)

		self.portrait = TCheckbutton(self.panel, image='context_portrait', variable=self.portrait_val,
								   command=self.set_portrait, style='ToolBarCheckButton')
		tooltips.AddDescription(self.portrait, _("Portrait"))
		self.portrait.pack(side=LEFT, padx=2)
		self.landscape = TCheckbutton(self.panel, image='context_landscape', variable=self.landscape_val,
									command=self.set_landscape, style='ToolBarCheckButton')
		tooltips.AddDescription(self.landscape, _("Landscape"))
		self.landscape.pack(side=LEFT)
		config.preferences.Subscribe(CHANGED, self.update_pref)
		self.doc.Subscribe(PAGE, self.update_pref)
		self.doc.Subscribe(UNDO, self.update_pref)
예제 #7
0
    def __init__(self, parent):
        CtxSubPanel.__init__(self, parent)

        self.USER_SPECIFIC = _("<Custom Size>")

        root = self.mw.root
        self.var_format_name = StringVar(root)
        self.var_format_name.set(config.preferences.default_paper_format)
        self.page_orientation = config.preferences.default_page_orientation

        label = TLabel(self.panel, text=_("Page:"))
        label.pack(side=LEFT, padx=2)
        self.page_formats = TCombobox(self.panel,
                                      state='readonly',
                                      postcommand=self.set_format,
                                      values=self.make_formats(),
                                      width=17,
                                      style='ComboNormal',
                                      textvariable=self.var_format_name)
        tooltips.AddDescription(self.page_formats, _("Page formats"))
        self.page_formats.pack(side=LEFT, padx=2)

        #--------------
        sep = FlatFrame(self.panel, width=5, height=2)
        sep.pack(side=LEFT)
        #--------------

        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)
        jump = config.preferences.default_unit_jump

        label = TLabel(self.panel, text=_("H:"))
        label.pack(side=LEFT)
        self.widthentry = TSpinbox(self.panel,
                                   textvariable=var_width_number,
                                   command=self.applyResize,
                                   vartype=1,
                                   min=5,
                                   max=50000,
                                   step=jump,
                                   width=7)
        tooltips.AddDescription(self.widthentry, _("Page width"))
        self.widthentry.pack(side=LEFT, padx=2)

        #--------------
        sep = FlatFrame(self.panel, width=5, height=2)
        sep.pack(side=LEFT)
        #--------------

        label = TLabel(self.panel, text=_("V:"))
        label.pack(side=LEFT)
        self.heightentry = TSpinbox(self.panel,
                                    textvariable=var_height_number,
                                    command=self.applyResize,
                                    vartype=1,
                                    min=5,
                                    max=50000,
                                    step=jump,
                                    width=7)
        tooltips.AddDescription(self.heightentry, _("Page height"))
        self.heightentry.pack(side=LEFT, padx=2)

        self.portrait_val = StringVar(root)
        self.landscape_val = StringVar(root)

        self.portrait = TCheckbutton(self.panel,
                                     image='context_portrait',
                                     variable=self.portrait_val,
                                     command=self.set_portrait,
                                     style='ToolBarCheckButton')
        tooltips.AddDescription(self.portrait, _("Portrait"))
        self.portrait.pack(side=LEFT, padx=2)
        self.landscape = TCheckbutton(self.panel,
                                      image='context_landscape',
                                      variable=self.landscape_val,
                                      command=self.set_landscape,
                                      style='ToolBarCheckButton')
        tooltips.AddDescription(self.landscape, _("Landscape"))
        self.landscape.pack(side=LEFT)
        config.preferences.Subscribe(CHANGED, self.update_pref)
        self.doc.Subscribe(PAGE, self.update_pref)
        self.doc.Subscribe(UNDO, self.update_pref)
예제 #8
0
    def build_dlg(self):
        if not self.builded:
            cmds = self.mw.canvas.commands.Ellipse

            label = TLabel(self.panel, text=_("Start:"))
            label.pack(side=LEFT, padx=2)
            self.entry_start = TSpinbox(self.panel,
                                        var=0,
                                        vartype=1,
                                        textvariable=self.start,
                                        min=-360,
                                        max=360,
                                        step=5,
                                        width=6,
                                        command=self.applyAngle)
            self.entry_start.pack(side=LEFT, padx=2)
            tooltips.AddDescription(self.entry_start,
                                    _('Arc start point angle'))

            #--------------
            sep = FlatFrame(self.panel, width=5, height=2)
            sep.pack(side=LEFT)
            #--------------

            label = TLabel(self.panel, text=_("End:"))
            label.pack(side=LEFT, padx=2)
            self.entry_end = TSpinbox(self.panel,
                                      var=0,
                                      vartype=1,
                                      textvariable=self.end,
                                      min=-360,
                                      max=360,
                                      step=5,
                                      width=6,
                                      command=self.applyAngle)
            self.entry_end.pack(side=LEFT, padx=2)
            tooltips.AddDescription(self.entry_end, _('Arc end point angle'))

            b = TButton(self.panel,
                        command=self.ResetAngle,
                        style='Toolbutton',
                        image='context_arc_reset')
            tooltips.AddDescription(b, _('Reset angles'))
            b.pack(side=LEFT)

            b = TButton(self.panel,
                        command=self.SwapAngle,
                        style='Toolbutton',
                        image='context_arc_swap')
            tooltips.AddDescription(b, _('Swap angles'))
            b.pack(side=LEFT)

            b = TLabel(self.panel, image="toolbar_sep")
            b.pack(side=LEFT)

            b = TButton(self.panel,
                        command=cmds.EllipseArc.Invoke,
                        style='Toolbutton',
                        image='context_arc')
            tooltips.AddDescription(b, _('to Arc'))
            b.pack(side=LEFT)

            b = TButton(self.panel,
                        command=cmds.EllipseChord.Invoke,
                        style='Toolbutton',
                        image='context_chord')
            tooltips.AddDescription(b, _('to Chord'))
            b.pack(side=LEFT)

            b = TButton(self.panel,
                        command=cmds.EllipsePieSlice.Invoke,
                        style='Toolbutton',
                        image='context_pie')
            tooltips.AddDescription(b, _('to Pie'))
            b.pack(side=LEFT)
            self.builded = 1
        else:
            obj = self.mw.document.CurrentObject()
            if obj and obj.is_Ellipse:
                start_angle = round(obj.start_angle / degrees, 2)
                end_angle = round(obj.end_angle / degrees, 2)
                self.entry_start.set_value(start_angle)
                self.entry_end.set_value(end_angle)