def __init__(self, parent):
        CtxSubPanel.__init__(self, parent)
        self.var_reference = StringVar(self.mw.root, 'left')
        self.var_stub = StringVar(self.mw.root)

        radio = UpdatedRadiobutton(self.panel,
                                   value='left',
                                   image='context_text_left',
                                   command=self.applyProperties,
                                   variable=self.var_reference,
                                   style='ToolbarRadiobutton')
        radio.pack(side=LEFT)
        tooltips.AddDescription(radio, _('Left alignment'))
        radio = UpdatedRadiobutton(self.panel,
                                   value='center',
                                   image='context_text_center',
                                   command=self.applyProperties,
                                   variable=self.var_reference,
                                   style='ToolbarRadiobutton')
        radio.pack(side=LEFT)
        tooltips.AddDescription(radio, _('Center alignment'))
        radio = UpdatedRadiobutton(self.panel,
                                   value='right',
                                   image='context_text_right',
                                   command=self.applyProperties,
                                   variable=self.var_reference,
                                   style='ToolbarRadiobutton')
        radio.pack(side=LEFT)
        tooltips.AddDescription(radio, _('Right alignment'))
        #		radio = UpdatedRadiobutton(self.panel, value = 'justify', image='context_text_justify_disabled',
        #								command=self.applyProperties, variable = self.var_stub, style='ToolbarRadiobutton', state='disabled')
        #		radio.pack(side=LEFT)
        #		tooltips.AddDescription(radio, _('Justify'))

        self.ReSubscribe()
    def build_dlg(self):
        if not self.builded:
            cmds = self.mw.commands

            b = ToolbarButton(self.panel,
                              command=cmds.Convert_to_CMYK,
                              style='Toolbutton',
                              image='context_image_cmyk')
            tooltips.AddDescription(b, _('Convert to CMYK'))
            b.pack(side=LEFT)

            b = ToolbarButton(self.panel,
                              command=cmds.Convert_to_RGB,
                              style='Toolbutton',
                              image='context_image_rgb')
            tooltips.AddDescription(b, _('Convert to RGB'))
            b.pack(side=LEFT)

            b = ToolbarButton(self.panel,
                              command=cmds.Convert_to_Grayscale,
                              style='Toolbutton',
                              image='context_image_gray')
            tooltips.AddDescription(b, _('Convert to Grayscale'))
            b.pack(side=LEFT)

            b = ToolbarButton(self.panel,
                              command=cmds.Convert_to_BW,
                              style='Toolbutton',
                              image='context_image_bw')
            tooltips.AddDescription(b, _('Convert to B&W'))
            b.pack(side=LEFT)

            self.builded = 1
Exemple #3
0
    def init(self, master):
        PluginPanel.init(self, master)

        self.initial_color = self.default_color
        self.current_color = copy.copy(self.initial_color)

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

        self.selector = ColorSpaceSelector(top, self.refresh_widgets,
                                           self.current_color, self.sign)
        self.selector.pack(side=TOP, expand=1, fill=X)

        self.picker = ColorChooserWidget(top, self.refresh_widgets,
                                         self.current_color)
        self.picker.pack(side=TOP, expand=1, fill=X)

        self.digitizer = ColorDigitizer(top, self.refresh_widgets,
                                        self.current_color)
        self.digitizer.pack(side=TOP, expand=1, fill=X)

        button = UpdatedButton(top,
                               text=_("Apply"),
                               command=self.apply_pattern,
                               sensitivecb=self.is_selection)
        button.pack(side=BOTTOM, expand=1, fill=X)
        self.Subscribe(SELECTION, button.Update)

        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_color)
        button.pack(side=LEFT, padx=5)
        tooltips.AddDescription(button, _("Restore color"))

        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.init_from_doc()
        self.subscribe_receivers()
Exemple #4
0
	def __init__(self, parent):
		CtxSubPanel.__init__(self, parent)
		
		b = TButton(self.panel, command=self.flip, style='Toolbutton', image='context_hflip')
		tooltips.AddDescription(b, _('Flip Horizontal'))
		b.pack(side = LEFT)
		b = TButton(self.panel,  command=self.flop, style='Toolbutton', image='context_vflip')
		tooltips.AddDescription(b, _('Flip Vertical'))
		b.pack(side = LEFT)
Exemple #5
0
    def __init__(self, parent):
        CtxSubPanel.__init__(self, parent)
        b = TButton(self.panel,
                    command=self.makePageFrame,
                    style='Toolbutton',
                    image='context_add_page_frame')
        tooltips.AddDescription(b, _('Add page frame'))
        b.pack(side=LEFT)
        b = TButton(self.panel,
                    command=self.addCenteredGuides,
                    style='Toolbutton',
                    image='context_add_centered_guides')
        tooltips.AddDescription(b, _('Add guides for page center'))
        b.pack(side=LEFT)

        #############
        b = TLabel(self.panel, image="toolbar_sep")
        b.pack(side=LEFT)
        b = TButton(self.panel,
                    command=self.addGuidesFrame,
                    style='Toolbutton',
                    image='context_add_guides_frame')
        tooltips.AddDescription(b, _('Add guides across page border'))
        b.pack(side=LEFT)

        self.var_jump_number = DoubleVar(self.mw.root)

        unit = config.preferences.default_unit
        var_jump_unit = StringVar(self.mw.root)
        self.var_jump = LengthVar(10, unit, self.var_jump_number,
                                  var_jump_unit)

        self.entry_jump = TSpinbox(self.panel,
                                   var=0,
                                   vartype=1,
                                   textvariable=self.var_jump_number,
                                   min=-1000,
                                   max=1000,
                                   step=5,
                                   width=6,
                                   command=self.addGuidesFrame)
        self.entry_jump.pack(side=LEFT, padx=2)
        config.preferences.Subscribe(CHANGED, self.update)
        self.var_jump.set(0)
        self.update(0, 0)

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

        b = TButton(self.panel,
                    command=self.removeAllGuides,
                    style='Toolbutton',
                    image='context_remove_all_guides')
        tooltips.AddDescription(b, _('Remove all guides'))
        b.pack(side=LEFT)
    def __init__(self, parent):
        CtxSubPanel.__init__(self, parent)
        self.my_changes = 0
        self.text_linegap = StringVar(self.mw.root, '100.0')
        self.text_wordgap = StringVar(self.mw.root, '100.0')
        self.text_chargap = StringVar(self.mw.root, '100.0')

        label = TLabel(self.panel, image='context_between_word')
        label.pack(side=LEFT)
        tooltips.AddDescription(label, _('Distance between words'))
        self.entry_word = TSpinbox(self.panel,
                                   var=100.0,
                                   vartype=1,
                                   textvariable=self.text_wordgap,
                                   min=0,
                                   max=5000,
                                   step=10,
                                   width=6,
                                   command=self.applyProperties)
        self.entry_word.pack(side=LEFT, padx=2)

        label = TLabel(self.panel, text='% ')
        label.pack(side=LEFT)
        label = TLabel(self.panel, image='context_between_line')
        label.pack(side=LEFT)
        tooltips.AddDescription(label, _('Distance between lines'))
        self.entry_line = TSpinbox(self.panel,
                                   var=100.0,
                                   vartype=1,
                                   textvariable=self.text_linegap,
                                   min=0,
                                   max=5000,
                                   step=10,
                                   width=6,
                                   command=self.applyProperties)
        self.entry_line.pack(side=LEFT, padx=2)

        label = TLabel(self.panel, text='% ')
        label.pack(side=LEFT)
        label = TLabel(self.panel, image='context_between_char')
        label.pack(side=LEFT)
        tooltips.AddDescription(label, _('Distance between characters'))
        self.entry_char = TSpinbox(self.panel,
                                   var=100.0,
                                   vartype=1,
                                   textvariable=self.text_chargap,
                                   min=0,
                                   max=5000,
                                   step=10,
                                   width=6,
                                   command=self.applyProperties)
        self.entry_char.pack(side=LEFT, padx=2)
        label = TLabel(self.panel, text='% ')
        label.pack(side=LEFT)

        self.ReSubscribe()
Exemple #7
0
	def __init__(self, parent):
		CtxSubPanel.__init__(self, parent)
		
		b = TCommandButton(self.panel, self.mw.commands.CombineBeziers, style='Toolbutton', image='context_combine')
		b.pack(side = LEFT)
		tooltips.AddDescription(b, _('Combine'))
		
		b = TCommandButton(self.panel, self.mw.commands.SplitBeziers, style='Toolbutton', image='context_split')
		b.pack(side = LEFT)
		tooltips.AddDescription(b, _('Split'))
Exemple #8
0
    def __init__(self, parent):
        CtxSubPanel.__init__(self, parent)
        self.my_changes = 0
        self.var_width_number = DoubleVar(self.mw.root)
        self.var_height_number = DoubleVar(self.mw.root)

        var_width_unit = StringVar(self.mw.root)
        var_height_unit = StringVar(self.mw.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)

        label = TLabel(self.panel, image='size_h')
        label.pack(side=LEFT)

        self.entry_width = TSpinbox(self.panel,
                                    var=0,
                                    vartype=1,
                                    textvariable=self.var_width_number,
                                    min=0,
                                    max=50000,
                                    step=jump,
                                    width=6,
                                    command=self.applyResize)
        tooltips.AddDescription(self.entry_width, _("Width of selection"))
        self.entry_width.pack(side=LEFT, padx=5)

        label = TLabel(self.panel, image='size_v')
        label.pack(side=LEFT)

        self.entry_height = TSpinbox(self.panel,
                                     var=0,
                                     vartype=1,
                                     textvariable=self.var_height_number,
                                     min=0,
                                     max=50000,
                                     step=jump,
                                     width=6,
                                     command=self.applyResize)
        tooltips.AddDescription(self.entry_height, _("Height of selection"))
        self.entry_height.pack(side=LEFT, padx=5)

        self.ReSubscribe()
        config.preferences.Subscribe(CHANGED, self.update_pref)
Exemple #9
0
	def __init__(self, parent):
		CtxSubPanel.__init__(self, parent)
		
		b = TCommandButton(self.panel, self.mw.commands.GroupSelected, style='Toolbutton', image='context_group')
		b.pack(side = LEFT)
		tooltips.AddDescription(b, _('Group'))
		
		b = TCommandButton(self.panel, self.mw.commands.UngroupSelected, style='Toolbutton', image='context_ungroup')
		b.pack(side = LEFT)
		tooltips.AddDescription(b, _('Ungroup'))
		
		b = TCommandButton(self.panel, self.mw.commands.UngrAll, style='Toolbutton', image='context_ungroupall')
		b.pack(side = LEFT)
		tooltips.AddDescription(b, _('Ungroup All'))
Exemple #10
0
 def _update(self):
     state = self.command.sensitive and NORMAL or DISABLED
     self.configure(state=state)
     tooltips.AddDescription(self, self.command.menu_name)
     self.command.Unsubscribe(CHANGED, self._update)
     pax.unregister_object(self.command)
     self.configure(command=MakeMethodCommand(self.command.Invoke))
     self.command.Subscribe(CHANGED, self._update)
Exemple #11
0
 def _update(self):
     state = self.command.sensitive and NORMAL or DISABLED
     #		if self.command.bitmap:
     #			bitmap = PixmapTk.load_image(self.command.bitmap)
     #			if type(bitmap) == StringType:
     #				self.configure(bitmap = bitmap, state = state)
     #			else:
     #				self.configure(image = bitmap, state = state)
     #		else:
     self.configure(text=self.command.button_name, state=state)
     tooltips.AddDescription(self, self.command.menu_name)
Exemple #12
0
 def __init__(self, master, command=None, image="no_image", args=(), **kw):
     self.pict = image
     self.command = command
     if type(args) != TupleType:
         args = (args, )
     self.args = args
     kw['command'] = self.command.Invoke  #MakeMethodCommand(self.command.Invoke)
     command.Subscribe(CHANGED, self._update)
     apply(TButton.__init__, (self, master), kw)
     tooltips.AddDescription(self, command.menu_name)
     self["style"] = "ToolsButton"
     self._update()
    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()
Exemple #14
0
 def _update(self):
     state = self.command.sensitive and NORMAL or DISABLED
     if state == 'disabled':
         self.configure(image=self.pict + '_disabled')
     else:
         state = '!disabled'
         self.configure(image=self.pict)
     self.state(state)
     tooltips.AddDescription(self, self.command.menu_name)
     self.command.Unsubscribe(CHANGED, self._update)
     pax.unregister_object(self.command)
     self.configure(command=MakeMethodCommand(self.command.Invoke))
     self.command.Subscribe(CHANGED, self._update)
Exemple #15
0
    def __init__(self, parent):
        CtxSubPanel.__init__(self, parent)
        self.angle = DoubleVar(self.mw.root)
        self.angle.set(0)

        label = TLabel(self.panel, image='context_R')
        label.pack(side=LEFT)
        self.entry_width = TSpinbox(self.panel,
                                    var=0,
                                    vartype=1,
                                    textvariable=self.angle,
                                    min=-360,
                                    max=360,
                                    step=1,
                                    width=6,
                                    command=self.applyRotate)
        tooltips.AddDescription(self.entry_width, _('Rotation angle'))
        self.entry_width.pack(side=LEFT, padx=5)
        b = TButton(self.panel,
                    command=self.rotLeft,
                    style='Toolbutton',
                    image='context_rotate_ccw')
        tooltips.AddDescription(b, _(u'Rotate -90°'))
        b.pack(side=LEFT)
        b = TButton(self.panel,
                    command=self.rot180,
                    style='Toolbutton',
                    image='context_rotate')
        tooltips.AddDescription(b, _(u'Rotate 180°'))
        b.pack(side=LEFT)
        b = TButton(self.panel,
                    command=self.rotRight,
                    style='Toolbutton',
                    image='context_rotate_cw')
        tooltips.AddDescription(b, _(u'Rotate 90°'))
        b.pack(side=LEFT)
Exemple #16
0
 def __init__(self, master, command=None, args=(), **kw):
     self.command = command
     if type(args) != TupleType:
         args = (args, )
     self.args = args
     kw['command'] = MakeMethodCommand(self.command.Invoke)
     #		if command.bitmap:
     #			bitmap = PixmapTk.load_image(command.bitmap)
     #			if type(bitmap) == StringType:
     #				kw['bitmap'] = bitmap
     #			else:
     #				kw['image'] = bitmap
     #		else:
     kw['text'] = command.button_name
     command.Subscribe(CHANGED, self._update)
     apply(Tkinter.Button.__init__, (self, master), kw)
     tooltips.AddDescription(self, command.menu_name)
     self._update()
Exemple #17
0
 def __init__(self,
              master,
              command=None,
              style='Toolbutton',
              image='',
              args=(),
              **kw):
     self.image = image
     self.command = command
     if type(args) != TupleType:
         args = (args, )
     self.args = args
     if self.image:
         kw['image'] = self.image
     kw['command'] = self.command.Invoke
     command.Subscribe(CHANGED, self._update)
     apply(TButton.__init__, (self, master), kw)
     tooltips.AddDescription(self, command.menu_name)
     self["style"] = style
     self._update()
Exemple #18
0
	def build_tools(self):
		tframe = self.tframe
		canvas = self.canvas

		TFrame(tframe, style='FlatFrame').pack(side=TOP, pady=5)

		#Selection Mode Button
		b = ToolsCheckbutton(tframe, canvas.commands.SelectionMode, image='tools_pointer')
		b.pack(side=TOP)
		tooltips.AddDescription(b, canvas.commands.SelectionMode.menu_name)
		#CurveEdit Mode Button
		b = ToolsCheckbutton(tframe, canvas.commands.EditMode, image='tools_shaper')
		b.pack(side=TOP)
		tooltips.AddDescription(b, canvas.commands.EditMode.menu_name)
		#Zoom Mode Button
		b = ToolsCheckbutton(tframe, canvas.commands.ZoomMode, image='tools_zoom')
		b.pack(side=TOP)
		tooltips.AddDescription(b, canvas.commands.ZoomMode.menu_name)

		#PolyLine Mode Button
		b = ToolsCheckbutton(tframe, canvas.commands.CreatePolyLine, image='tools_pencil_line')
		b.pack(side=TOP)
		tooltips.AddDescription(b, canvas.commands.CreatePolyLine.menu_name)
		#PolyBezier Mode Button
		b = ToolsCheckbutton(tframe, canvas.commands.CreatePolyBezier, image='tools_pencil_curve')
		b.pack(side=TOP)
		tooltips.AddDescription(b, canvas.commands.CreatePolyBezier.menu_name)

		#Ellipse Mode Button
		b = ToolsCheckbutton(tframe, canvas.commands.CreateEllipse, image='tools_ellipse')
		b.pack(side=TOP)
		tooltips.AddDescription(b, canvas.commands.CreateEllipse.menu_name)

		#Rectangle Mode Button
		b = ToolsCheckbutton(tframe, canvas.commands.CreateRectangle, image='tools_rectangle')
		b.pack(side=TOP)
		tooltips.AddDescription(b, canvas.commands.CreateRectangle.menu_name)

		#SimpleText Mode Button
		b = ToolsCheckbutton(tframe, canvas.commands.CreateSimpleText, image='tools_text')
		b.pack(side=TOP)
		tooltips.AddDescription(b, canvas.commands.CreateSimpleText.menu_name)

		b = TLabel(tframe, style='HLine')
		b.pack(side=TOP, fill=X)

		#Outline Button
		b = ToolsButton(tframe, self.commands.CreateLineStyleDialog, image='tools_color_line')
		b.pack(side=TOP)
		tooltips.AddDescription(b, self.commands.CreateLineStyleDialog.menu_name)

		#Fill Button
		b = ToolsButton(tframe, self.commands.CreateFillStyleDialog, image='tools_color_fill')
		b.pack(side=TOP)
		tooltips.AddDescription(b, self.commands.CreateFillStyleDialog.menu_name)
		#Spacer
#		b = TLabel(tframe, style='HLine')
#		b.pack(side=TOP, fill=X)


		b = TLabel(tframe, style='HLine')
		b.pack(side=BOTTOM, fill=X)

		b = ToolbarButton(tframe, self.commands.MoveSelectedToBottom, image='tools_lower')
		b.pack(side=BOTTOM, fill=X)
		b = ToolbarButton(tframe, self.commands.MoveSelectionDown, image='tools_backward')
		b.pack(side=BOTTOM, fill=X)
		b = ToolbarButton(tframe, self.commands.MoveSelectionUp, image='tools_forward')
		b.pack(side=BOTTOM, fill=X)
		b = ToolbarButton(tframe, self.commands.MoveSelectedToTop, image='tools_raise')
		b.pack(side=BOTTOM, fill=X)
Exemple #19
0
	def __init__(self, parent):
		CtxSubPanel.__init__(self, parent)
		b = TCommandButton(self.panel, self.mw.commands.ConvertToCurve, style='Toolbutton', image='context_to_curve')
		b.pack(side = LEFT)
		tooltips.AddDescription(b, _('Convert to curve'))
Exemple #20
0
 def _update(self):
     #state = self.command.sensitive and NORMAL or DISABLED
     self.configure(image=self.pict)  #, state = state)
     tooltips.AddDescription(self, self.command.menu_name)
    def __init__(self, parent):
        CtxSubPanel.__init__(self, parent)

        self.var_font_name = StringVar(self.mw.root, ' ')
        self.var_style_name = StringVar(self.mw.root, ' ')
        self.var_font_size = StringVar(self.mw.root, ' ')

        label = TLabel(self.panel, image='context_font_name')
        label.pack(side=LEFT, padx=2)
        tooltips.AddDescription(label, _('Font name'))
        self.font_name = TCombobox(self.panel,
                                   state='readonly',
                                   postcommand=self.name_changed,
                                   values=self.make_families(),
                                   width=25,
                                   style='PseudoActive',
                                   textvariable=self.var_font_name)
        self.font_name.pack(side=LEFT, padx=2)

        label = TLabel(self.panel, text=' ')
        label.pack(side=LEFT)

        label = TLabel(self.panel, image='context_font_style')
        label.pack(side=LEFT)
        tooltips.AddDescription(label, _('Font style'))
        self.style_name = TCombobox(self.panel,
                                    state='readonly',
                                    postcommand=self.style_changed,
                                    values=(),
                                    width=18,
                                    style='PseudoActive',
                                    textvariable=self.var_style_name)
        self.style_name.pack(side=LEFT, padx=2)

        label = TLabel(self.panel, text=' ')
        label.pack(side=LEFT)

        label = TLabel(self.panel, image='context_font_size')
        label.pack(side=LEFT)
        tooltips.AddDescription(label, _('Font size'))
        self.font_size = TCombobox(self.panel,
                                   state='normal',
                                   postcommand=self.apply_changes,
                                   values=self.make_sizes(),
                                   width=5,
                                   style='ComboNormal',
                                   textvariable=self.var_font_size)
        self.font_size.pack(side=LEFT, padx=2)

        ######################################
        self.var_bold = StringVar(self.mw.root, '')
        self.var_italic = StringVar(self.mw.root, '')
        self.var_underline = StringVar(self.mw.root, '')

        self.bold_check = UpdatedRadiobutton(self.panel,
                                             value='bold',
                                             image='context_text_bold',
                                             command=self.bold_action,
                                             variable=self.var_bold,
                                             style='ToolbarRadiobutton')
        self.bold_check.pack(side=LEFT, padx=2)
        tooltips.AddDescription(self.bold_check, _('Bold'))

        self.italic_check = UpdatedRadiobutton(self.panel,
                                               value='italic',
                                               image='context_text_italic',
                                               command=self.italic_action,
                                               variable=self.var_italic,
                                               style='ToolbarRadiobutton')
        self.italic_check.pack(side=LEFT, padx=2)
        tooltips.AddDescription(self.italic_check, _('Italic'))

        #		self.underline_check = UpdatedRadiobutton(self.panel, value = 'under', image='context_text_under_disabled', state='disabled',
        #								command=self.action, variable = self.var_underline, style='ToolbarRadiobutton')
        #		self.underline_check.pack(side=LEFT, padx=2)
        #		tooltips.AddDescription(self.underline_check, _('Underline'))

        self.ReSubscribe()
    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)
    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()
    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()
Exemple #25
0
	def build_window(self):
		root = self.application.root

		# the menu
		self.mbar = TFrame(root, name='menubar', style='MenuBarFrame', borderwidth=2)
		self.mbar.pack(fill=X)

		# the toolbar
		self.tbar = TFrame(root, name='toolbar', style='ToolBarFrame', borderwidth=2)
		self.tbar.pack(fill=X)

		# the context panel
		self.ctxpanel = ctxPanel.ContexPanel(root, self)
		self.ctxpanel.panel.pack(fill=X)

		b = ToolbarButton(self.ctxpanel.panel, self.commands.PCshowHide, image="show_side_panel")
		tooltips.AddDescription(b, self.commands.PCshowHide.menu_name)
		b.pack(side=RIGHT)

		# the status bar
		self.status_bar = TFrame(root, name='statusbar', style='FlatFrame')
		self.status_bar.pack(side=BOTTOM, fill=X)

		# the tools bar
		self.tframe = TFrame(root, name='tools_frame', style='FlatFrame', borderwidth=2)
		self.tframe.pack(side=LEFT, fill=Y)

		# the palette

		p_frame = TFrame(root, style='FlatFrame')
		p_frame.pack(side='right', fill=Y)

		palette_frame = TFrame(p_frame, style='FlatFrame')
		palette_frame.pack(side='right', fill=Y, pady=5, padx=3)

		b = TLabel(root, style='VLine2')
		b.pack(side=RIGHT, fill=Y)

		####################################
		# Drawing area creating
		####################################

		pc_frame = TFrame(root, style='FlatFrame')
		pc_frame.pack(side='right', fill=Y, expand=1)

		self.pc = PluginContainer(pc_frame, self.root, self)

		base_frame = TFrame(root, name='drawing_area_frame', style='FlatFrame')
		base_frame.pack(side=LEFT, fill=BOTH, expand=1)

		self.tabspanel = TabsPanel(base_frame, self)
		self.tabspanel.pack(side=TOP, fill=X)
		self.docmanager.Activate(self.tabspanel)

		label = TLabel(base_frame, style='DrawingAreaBottom', image='space_5')
		label.pack(side=BOTTOM, fill=X)

		label = TLabel(base_frame, style='DrawingAreaLeft', image='space_5')
		label.pack(side=LEFT, fill=Y, expand=1)

		label = TLabel(base_frame, style='DrawingAreaRight', image='space_5')
		label.pack(side=RIGHT, fill=Y, expand=1)

		####################################
		frame = TFrame(base_frame, name='canvas_frame', style='FlatFrame')
		frame.pack(side=LEFT, fill=BOTH, expand=1)

		vbar = TScrollbar(frame)
		vbar.grid(in_=frame, column=3, row=1, sticky='ns')
		vbar.bind('<Button-4>', self.ScrollUpCanvas)
		vbar.bind('<Button-5>', self.ScrollDownCanvas)

		############Pager###################
		pframe = TFrame(frame, style='FlatFrame')
		pframe.grid(in_=frame, column=2, row=2, sticky='ew')

		lab = Pager(pframe, self)
		lab.pack(side=LEFT, fill=Y)
		####################################
		hbar = TScrollbar(pframe, orient=HORIZONTAL)
		hbar.pack(side=RIGHT, fill=X, expand=1)
		hbar.bind('<Button-4>', self.ScrollLeftCanvas)
		hbar.bind('<Button-5>', self.ScrollRightCanvas)
		####################################

		hrule = tkruler.Ruler(frame, orient=tkruler.HORIZONTAL,
							  bg=config.preferences.ruler_color, relief='flat')

		hrule.grid(in_=frame, column=2, row=0, sticky='nsew', columnspan=2)
		hrule.bind('<Double-Button-1>', self.RulerDoublePressH)

		####################################

		vrule = tkruler.Ruler(frame, orient=tkruler.VERTICAL,
							  bg=config.preferences.ruler_color, relief='flat')

		vrule.grid(in_=frame, column=1, row=1, sticky='nsew', rowspan=2)
		vrule.bind('<Double-Button-1>', self.RulerDoublePressV)

		#ruler corner
		b = tkruler.RulerCorner(frame, bg=config.preferences.ruler_color)
		tooltips.AddDescription(b, _('Change system coordinates'))
		b.grid(column=1, row=0, sticky='news')

		resolution = config.preferences.screen_resolution
		self.canvas = SketchCanvas(root, toplevel=root, background='white', name='canvas',
				width=self.root.winfo_screenwidth(), height=self.root.winfo_screenheight(),
				resolution=resolution, main_window=self, document=self.document)

		self.canvas.grid(in_=frame, column=2, row=1, sticky='news')
		self.canvas.focus()
		self.canvas.SetScrollbars(hbar, vbar)
		self.canvas.SetRulers(hrule, vrule)

		vrule.SetCanvas(self.canvas)
		hrule.SetCanvas(self.canvas)

		frame.columnconfigure(0, weight=0)
		frame.columnconfigure(1, weight=0)
		frame.columnconfigure(2, weight=1)
		frame.columnconfigure(3, weight=0)
		frame.rowconfigure(0, weight=0)
		frame.rowconfigure(1, weight=1)
		frame.rowconfigure(2, weight=0)
		hbar['command'] = self.canvas._w + ' xview'
		vbar['command'] = self.canvas._w + ' yview'

		# the palette

		pal = palette.get_default_palette()

		palette_trough = TFrame(palette_frame, style='FlatFrame')
		palette_container = TFrame(palette_trough, style='FlatFrame')

		self.palette = palette.PaletteWidget(palette_container)
		self.palette.SetPalette(pal)
		ScrollXUnits = self.palette.ScrollXUnits
		ScrollXPages = self.palette.ScrollXPages
		CanScrollLeft = self.palette.CanScrollLeft
		CanScrollRight = self.palette.CanScrollRight

		but1 = UpdatedTButton(palette_frame, class_='Repeater', style='Pal2TopButton', image='pal_dbl_arrow_up',
					command=ScrollXPages, args=-1, sensitivecb=CanScrollLeft)
		but1.pack(side=TOP)
		but2 = UpdatedTButton(palette_frame, class_='Repeater', style='PalTopButton', image='pal_arrow_up',
					command=ScrollXUnits, args=-1, sensitivecb=CanScrollLeft)
		but2.pack(side=TOP)

		palette_trough.pack(side=TOP, fill=Y, expand=1)

		b = TLabel(palette_trough, style='PalLBorder')
		b.pack(side=LEFT, fill=Y)

		palette_container.pack(side=LEFT, fill=Y, expand=1)

		but = UpdatedTButton(palette_container, style='PalNoColorButton', image='pal_no_color',
					command=self.no_pattern, args='fill')
		but.pack(side=TOP)
		but.bind('<ButtonPress-3>', self.no_pattern, 'line')
		tooltips.AddDescription(but, _("No color"))

		self.palette.pack(side=LEFT, fill=Y, expand=1)

		b = TLabel(palette_trough, style='PalRBorder')
		b.pack(side='right', fill=Y)

		but3 = UpdatedTButton(palette_frame, class_='Repeater', style='PalBottomButton', image='pal_arrow_down',
					command=ScrollXUnits, args=+1, sensitivecb=CanScrollRight)
		but3.pack(side=TOP)
		but4 = UpdatedTButton(palette_frame, class_='Repeater', style='Pal2BottomButton', image='pal_dbl_arrow_down',
					command=ScrollXPages, args=+1, sensitivecb=CanScrollRight)
		but4.pack(side=TOP)

		self.palette.Subscribe(COLOR1, self.canvas.FillSolid)
		self.palette.Subscribe(COLOR2, self.canvas.LineColor)
		root.protocol('WM_DELETE_WINDOW', tkext.MakeMethodCommand(self.Exit))

		#Binding for mouse wheel
		self.palette.bind('<Button-4>', self.ScrollUpPallette)
		self.palette.bind('<Button-5>', self.ScrollDownPallette)
		self.canvas.bind('<Button-4>', self.ScrollUpCanvas)
		self.canvas.bind('<Button-5>', self.ScrollDownCanvas)
		self.canvas.bind('<Control-Button-4>', self.ScrollLeftCanvas)
		self.canvas.bind('<Control-Button-5>', self.ScrollRightCanvas)
		self.canvas.bind('<Shift-Button-4>', self.CanvasZoomingOut)
		self.canvas.bind('<Shift-Button-5>', self.CanvasZoomingIn)
    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)
Exemple #27
0
	def build_toolbar(self):
		tbar = self.tbar
		canvas = self.canvas
		commands = self.commands

		label = TLabel(tbar, image="toolbar_left")
		label.pack(side=LEFT)

		b = ToolbarButton(tbar, commands.NewDocument, image="toolbar_new")
		tooltips.AddDescription(b, commands.NewDocument.menu_name)
		b.pack(side=LEFT)
		b = ToolbarButton(tbar, commands.LoadFromFile, image="toolbar_open")
		tooltips.AddDescription(b, commands.LoadFromFile.menu_name)
		b.pack(side=LEFT)

		label = TLabel(tbar, image="toolbar_sep")
		label.pack(side=LEFT)

		b = ToolbarButton(tbar, commands.SaveToFile, image="toolbar_save")
		tooltips.AddDescription(b, commands.SaveToFile.menu_name)
		b.pack(side=LEFT)
		b = ToolbarButton(tbar, commands.SaveToFileAs, image="toolbar_saveas")
		tooltips.AddDescription(b, commands.SaveToFileAs.menu_name)
		b.pack(side=LEFT)


		label = TLabel(tbar, image="toolbar_sep")
		label.pack(side=LEFT)

		b = ToolbarButton(tbar, commands.KPrinting, image="toolbar_print")
		tooltips.AddDescription(b, commands.KPrinting.menu_name)
		b.pack(side=LEFT)


		b = ToolbarButton(tbar, commands.PrintToPDF, image="print_tofile")
		tooltips.AddDescription(b, commands.PrintToPDF.menu_name)
		b.pack(side=LEFT)

		label = TLabel(tbar, image="toolbar_sep")
		label.pack(side=LEFT)

		b = ToolbarButton(tbar, commands.CloseDoc, image="toolbar_fileclose")
		tooltips.AddDescription(b, commands.CloseDoc.menu_name)
		b.pack(side=LEFT)

		label = TLabel(tbar, image="toolbar_sep")
		label.pack(side=LEFT)

		b = ToolbarButton(tbar, commands.Undo, image="toolbar_undo")
		tooltips.AddDescription(b, commands.Undo.menu_name)
		b.pack(side=LEFT)
		b = ToolbarButton(tbar, commands.Redo, image="toolbar_redo")
		tooltips.AddDescription(b, commands.Redo.menu_name)
		b.pack(side=LEFT)
		b = ToolbarButton(tbar, commands.RemoveSelected, image="toolbar_delete")
		tooltips.AddDescription(b, commands.RemoveSelected.menu_name)
		b.pack(side=LEFT)
		b = ToolbarButton(tbar, commands.CutSelected, image="toolbar_cut")
		tooltips.AddDescription(b, commands.CutSelected.menu_name)
		b.pack(side=LEFT)
		b = ToolbarButton(tbar, commands.CopySelected, image="toolbar_copy")
		tooltips.AddDescription(b, commands.CopySelected.menu_name)
		b.pack(side=LEFT)
		b = ToolbarButton(tbar, commands.PasteClipboard, image="toolbar_paste")
		tooltips.AddDescription(b, commands.PasteClipboard.menu_name)
		b.pack(side=LEFT)

		label = TLabel(tbar, image="toolbar_sep")
		label.pack(side=LEFT)

		b = ToolbarButton(tbar, commands.InsertFile, image="toolbar_iVector")
		tooltips.AddDescription(b, commands.InsertFile.menu_name)
		b.pack(side=LEFT)
		b = ToolbarButton(tbar, commands.CreateImage, image="toolbar_iRaster")
		tooltips.AddDescription(b, commands.CreateImage.menu_name)
		b.pack(side=LEFT)

		label = TLabel(tbar, image="toolbar_sep")
		label.pack(side=LEFT)

		b = ToolbarButton(tbar, commands.ExportAs, image="toolbar_eVector")
		tooltips.AddDescription(b, commands.ExportAs.menu_name)
		b.pack(side=LEFT)

		b = ToolbarButton(tbar, commands.ExportPNG, image="toolbar_eRaster")
		tooltips.AddDescription(b, commands.ExportPNG.menu_name)
		b.pack(side=LEFT)

		label = TLabel(tbar, image="toolbar_sep")
		label.pack(side=LEFT)

		b = ToolbarButton(tbar, canvas.commands.FitPageToWindow, image="toolbar_FitToPage")
		tooltips.AddDescription(b, canvas.commands.FitPageToWindow.menu_name)
		b.pack(side=LEFT)

		b = ToolbarButton(tbar, commands.FitToNat, image="toolbar_FitToNative")
		tooltips.AddDescription(b, commands.FitToNat.menu_name)
		b.pack(side=LEFT)

		b = ToolbarButton(tbar, canvas.commands.FitSelectedToWindow, image="toolbar_FitToSelected")
		tooltips.AddDescription(b, canvas.commands.FitSelectedToWindow.menu_name)
		b.pack(side=LEFT)

		b = ToolbarButton(tbar, canvas.commands.ZoomIn, image="toolbar_zoom+")
		tooltips.AddDescription(b, canvas.commands.ZoomIn.menu_name)
		b.pack(side=LEFT)

		b = ToolbarButton(tbar, canvas.commands.ZoomOut, image="toolbar_zoom-")
		tooltips.AddDescription(b, canvas.commands.ZoomOut.menu_name)
		b.pack(side=LEFT)

		label = TLabel(tbar, image="toolbar_sep")
		label.pack(side=LEFT)

		b = ToolbarCheckbutton(tbar, canvas.commands.ToggleOutlineMode, image='toolbar_contour')
		b.pack(side=LEFT)
		tooltips.AddDescription(b, canvas.commands.ToggleOutlineMode.menu_name)
Exemple #28
0
	def build_status_bar(self):
		status_bar = self.status_bar
		canvas = self.canvas

		#Container
		sb1 = TFrame(status_bar, style="FlatFrame")
		sb1.pack(side=LEFT, fill=Y)
		#Position Info
		stat_pos = PositionLabel(sb1, name='position', text='', anchor='center', width=20, updatecb=canvas.GetCurrentPos)
		stat_pos.pack(side=LEFT, fill=X)
		stat_pos.Update()
		canvas.Subscribe(POSITION, stat_pos.Update)


		sb_frame2 = TFrame(status_bar, style="RoundedSBFrame", borderwidth=2)
		sb_frame2.pack(side=LEFT, fill=BOTH)

		#OnGrid
		b = ToolbarCheckbutton(sb_frame2, canvas.commands.ToggleSnapToGrid, image='snap_to_grid')
		b.pack(side=LEFT)
		tooltips.AddDescription(b, canvas.commands.ToggleSnapToGrid.menu_name)

		label = TLabel(sb_frame2, image="sb_sep")
		label.pack(side=LEFT)

		#OnGuide
		b = ToolbarCheckbutton(sb_frame2, canvas.commands.ToggleSnapToGuides, image='snap_to_guide')
		b.pack(side=LEFT)
		tooltips.AddDescription(b, canvas.commands.ToggleSnapToGuides.menu_name)

		label = TLabel(sb_frame2, image="sb_sep")
		label.pack(side=LEFT)

		#OnObject
		b = ToolbarCheckbutton(sb_frame2, canvas.commands.ToggleSnapToObjects, image='snap_to_object')
		b.pack(side=LEFT)
		tooltips.AddDescription(b, canvas.commands.ToggleSnapToObjects.menu_name)


		label = TLabel(sb_frame2, image="sb_sep")
		label.pack(side=LEFT)

		#ForceRedraw
		b = ToolbarButton(sb_frame2, canvas.commands.ForceRedraw, image='statusbar_refresh')
		b.pack(side=LEFT)
		tooltips.AddDescription(b, canvas.commands.ForceRedraw.menu_name)


		#Zoom Info
		#l=Label(status_bar, anchor=SW, text='    Zoom:')
		#l.pack(side='left')

		#stat_zoom = UpdatedLabel(status_bar, name = 'zoom', text = '', updatecb = canvas.ZoomInfoText)
		#stat_zoom.pack(side = 'left')
		#stat_zoom.Update()
		#canvas.Subscribe(VIEW, stat_zoom.Update)

		#stat_edited = UpdatedLabel(status_bar, name = 'edited', text = '',
		#                          updatecb = self.EditedInfoText)
		#stat_edited.pack(side = 'left')
		#stat_edited.Update()
		#self.Subscribe(UNDO, stat_edited.Update)

		#Selection Color switch
		def ColorInfo():
				if len(self.document.selection) != 1 or self.document.CanUngroup():
					fill_frame["style"] = 'ColorWatchDisabled'
					outline_frame["style"] = 'ColorWatchDisabled'
					fill_frame['background'] = app.uimanager.currentColorTheme.bg
					outline_frame['background'] = app.uimanager.currentColorTheme.bg
					return ""

				properties = self.document.CurrentProperties()
				filltxt = ''
				outlinetxt = ''
				try:
					fill_frame["style"] = 'ColorWatchNormal'
					fillcolor = rgb_to_tk(properties.fill_pattern.Color().RGB())
					fill_frame["background"] = fillcolor
					filltxt = _('Fill:') + ' ' + properties.fill_pattern.Color().toString()
				except:
					fill_frame["style"] = 'ColorWatchTransp'
					filltxt = _('Fill: None')

				try:
					outline_frame["style"] = 'ColorWatchNormal'
					outline_frame["background"] = rgb_to_tk(properties.line_pattern.Color().RGB())
					outlinetxt = _('Outline:') + ' ' + str(math.ceil(math.floor(10 ** 4 * properties.line_width / 2.83465) / 10) / 1000) + ' mm'
				except:
					outline_frame["style"] = 'ColorWatchTransp'
					outlinetxt = _('Outline: None')

				return filltxt + "\n" + outlinetxt

		space = Frame(status_bar, relief='flat', width=5)
		space.pack(side=RIGHT, fill=Y)
		sb3f = Frame(status_bar, relief='flat', borderwidth=1, width=20, height=15)
		sb3f.pack(side=RIGHT)

		fill_frame = TLabel(sb3f, style='ColorWatchDisabled', image='space_12')
		outline_frame = TLabel(sb3f, style='ColorWatchDisabled', image='space_12')

		fill_frame.grid(row=0, column=0, sticky='EW')
		outline_frame.grid(row=1, column=0, sticky='EW', pady=1)

		l = UpdatedLabel(status_bar, name='colors', text='', justify='right', updatecb=ColorInfo)
		l.pack(side=RIGHT)
		l.Update()
		canvas.Subscribe(POSITION, l.Update)
		canvas.Subscribe(EDITED, l.Update)
		canvas.Subscribe(SELECTION, l.Update)

		#Object Info
		stat_sel = UpdatedLabel(status_bar, name='selection', justify='center', anchor='center', text='', updatecb=canvas.CurrentInfoText)
		stat_sel.pack(side='left', fill=X, expand=1)
		stat_sel.Update()
		update = stat_sel.Update
		canvas.Subscribe(SELECTION, update)
		canvas.Subscribe(CURRENTINFO, update)
		canvas.Subscribe(EDITED, update)
Exemple #29
0
    def build_dlg(self):
        if not self.builded:
            cmds = self.mw.canvas.commands.PolyBezierEditor
            b = TButton(self.panel,
                        command=cmds.InsertNodes.Invoke,
                        style='Toolbutton',
                        image='context_node_add')
            tooltips.AddDescription(b, _('Insert node'))
            b.pack(side=LEFT)
            b = TButton(self.panel,
                        command=cmds.DeleteNodes.Invoke,
                        style='Toolbutton',
                        image='context_node_remove')
            tooltips.AddDescription(b, _('Remove nodes'))
            b.pack(side=LEFT)

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

            b = TButton(self.panel,
                        command=cmds.CloseNodes.Invoke,
                        style='Toolbutton',
                        image='context_node_join')
            tooltips.AddDescription(b, _('Join selected nodes'))
            b.pack(side=LEFT)
            b = TButton(self.panel,
                        command=cmds.OpenNodes.Invoke,
                        style='Toolbutton',
                        image='context_node_break')
            tooltips.AddDescription(b, _('Break path at selected nodes'))
            b.pack(side=LEFT)

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

            b = TButton(self.panel,
                        command=cmds.ContAngle.Invoke,
                        style='Toolbutton',
                        image='context_node_corner')
            tooltips.AddDescription(b, _('Make selected nodes corner'))
            b.pack(side=LEFT)
            b = TButton(self.panel,
                        command=cmds.ContSmooth.Invoke,
                        style='Toolbutton',
                        image='context_node_smooth')
            tooltips.AddDescription(b, _('Make selected nodes smooth'))
            b.pack(side=LEFT)
            b = TButton(self.panel,
                        command=cmds.ContSymmetrical.Invoke,
                        style='Toolbutton',
                        image='context_node_symm')
            tooltips.AddDescription(b, _('Make selected nodes symmetric'))
            b.pack(side=LEFT)

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

            b = TButton(self.panel,
                        command=cmds.SegmentsToLines.Invoke,
                        style='Toolbutton',
                        image='context_node_line')
            tooltips.AddDescription(b, _('Make selected segments lines'))
            b.pack(side=LEFT)
            b = TButton(self.panel,
                        command=cmds.SegmentsToCurve.Invoke,
                        style='Toolbutton',
                        image='context_node_curve')
            tooltips.AddDescription(b, _('Make selected segments curves'))
            b.pack(side=LEFT)

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

            b = TButton(self.panel,
                        command=cmds.SelectAllNodes.Invoke,
                        style='Toolbutton',
                        image='context_node_all')
            tooltips.AddDescription(b, _('Select all nodes in path'))
            b.pack(side=LEFT)

            self.builded = 1