예제 #1
0
    def __init__(self, parent, **kw):
        TFrame.__init__(self, parent, style='FlatFrame', **kw)

        spot_frame = TFrame(self, borderwidth=2, style='FlatFrame')
        spot_frame.pack(side=TOP)

        label = TLabel(spot_frame, text=_('Color name:'), justify=LEFT)
        label.pack(side=TOP)

        self.colorname_value = StringVar('')

        self.colorname = TEntrybox(spot_frame,
                                   text='',
                                   width=25,
                                   textvariable=self.colorname_value)
        self.colorname.set_state('readonly')
        self.colorname.pack(side=BOTTOM, fill=X)

        cmyk_frame = TFrame(self, borderwidth=2, style='FlatFrame')
        cmyk_frame.pack(side=TOP)

        self.CMYK_label = TLabel(cmyk_frame,
                                 text='C:\nM:\nY:\nK:',
                                 justify=LEFT)
        self.CMYK_label.pack(side=LEFT, padx=10)

        self.RGB_label = TLabel(cmyk_frame, text='R:\nG:\nB:', justify=LEFT)
        self.RGB_label.pack(side=LEFT, padx=10)

        self.HTML_label = TLabel(self, text='HTML:', justify=LEFT)
        self.HTML_label.pack(side=BOTTOM, pady=5)
예제 #2
0
	def init(self, master):
		PluginPanel.init(self, master)

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

		sign = TFrame(top, style='RoundedFrame', borderwidth=5)
		sign.pack(side = TOP)

		self.sign=TLabel(sign, image='shaping_trim')
		self.sign.pack(side=TOP)

		button = UpdatedButton(top, text = _("Apply"),
								command = self.apply_action,
								sensitivecb = self.is_correct_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)
				
		self.var_originals = IntVar(top)
		self.var_originals.set(0)
		
		self.autoupdate_check = TCheckbutton(button_frame, text = _("Leave originals"), 
											variable = self.var_originals)
		self.autoupdate_check.pack(side = LEFT, anchor=W, padx=10)

		self.init_from_doc()
		self.subscribe_receivers()
예제 #3
0
파일: pager.py 프로젝트: kindlychung/sk1
	def __init__(self, parent, mainwindow):
		self.parent=parent
		self.mainwindow=mainwindow
		TFrame.__init__(self, self.parent, name = 'pagerPanel', style='FlatFrame', borderwidth=0)
		top_border=TLabel(self, style='FlatLabel', image='space_1')
		top_border.pack(side=TOP, fill=X)
		
		self.container=TFrame(self, style='FlatFrame', borderwidth=0)

		space=TLabel(self.container, style='FlatLabel', image='space_3')
		space.pack(side=LEFT, fill=Y)
		self.home_but=TButton(self.container, style='PagerHome', command=self.PageHome)
		self.home_but.pack(side=LEFT)
		self.home_but=TButton(self.container, style='PagerPrevious', command=self.PagePrevious)
		self.home_but.pack(side=LEFT)
		self.text=TLabel(self.container, style='FlatLabel', text=' '+_('Page 2 of 2')+' ')
		self.text.pack(side=LEFT)
		self.home_but=TButton(self.container, style='PagerNext', command=self.PageNext)
		self.home_but.pack(side=LEFT)
		self.home_but=TButton(self.container, style='PagerEnd', command=self.PageEnd)
		self.home_but.pack(side=LEFT)
		space=TLabel(self.container, style='FlatLabel', image='space_3')
		space.pack(side=LEFT, fill=Y)
		self.mainwindow.Subscribe(DOCUMENT, self.Resubscribe)
		self.Resubscribe()
		self.doc_paged()
		self.text.bind('<Double-Button-1>', self.GoToPage)
예제 #4
0
	def init(self, master):
		self.master = master
		self.mw = app.mw
		self.pcontainer = self.master.master
		self.document = self.mw.document
		TFrame.__init__(self, self.master, style='FlatFrame', borderwidth=0)
		self.top = TFrame(self, style='PWinHead', borderwidth=3)
		self.panel = TFrame(self, style='PWinBody', borderwidth=3)
		self.activated = 1
		self.visible = 1
		self.packed = 1

		for item in self.pcontainer.loaded:
			if not item.collapsed:
				item.collapse_panel()

		self.pack(side=TOP, fill=self.fill, expand=self.expand, padx=1, pady=1)
		self.top.pack(side=TOP, fill=X)
		self.panel.pack(side=TOP, fill=BOTH, expand=1)

		self.iconlabel = TLabel(self.top, style='PWLabel', image=self.icon)
		self.textlabel = TLabel(self.top, style='PWLabel', text=self.title, anchor=W)
		if not 'bold' in self.textlabel['font'].split():
			self.textlabel['font'] += ' bold'
		self.closebut = TButton(self.top, style='PWButton', image='close_pw', command=self.close_panel)
		self.collapsebut = TButton(self.top, style='PWButton', image='minimize_pw', command=self.click)
		self.iconlabel.pack(side=LEFT, padx=2)
		self.textlabel.pack(side=LEFT, fill=BOTH, expand=1, padx=3)
		self.closebut.pack(side=RIGHT)
		self.collapsebut.pack(side=RIGHT)
		self.textlabel.bind("<Button-1>", self.click)
		self.mw.Subscribe(DOCUMENT, self.doc_changed)
예제 #5
0
    def __init__(self, parent):
        self.my_changes = 0

        CtxSubPanel.__init__(self, parent)
        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)

        label = TLabel(self.panel, text=_("Jump:"))
        label.pack(side=LEFT, padx=2)
        self.entry_jump = TSpinbox(self.panel,
                                   var=0,
                                   vartype=1,
                                   textvariable=self.var_jump_number,
                                   min=0,
                                   max=1000,
                                   step=.1,
                                   width=6,
                                   command=self.applyJump)
        self.entry_jump.pack(side=LEFT, padx=2)
        config.preferences.Subscribe(CHANGED, self.update)
        self.var_jump.set(config.preferences.handle_jump)
        self.update(0, 0)
예제 #6
0
파일: tooltips.py 프로젝트: kindlychung/sk1
	def create_balloon(self, root):
		self.root = root
		self.balloon = Toplevel(self.root)
		self.balloon.withdraw()
		self.balloon.overrideredirect(1)
		self.balloon["relief"] = 'flat'
		label = TLabel(self.balloon, text='Tooltip', style='Tooltips')
		label.pack(ipadx=2, ipady=2)
		self.balloon_label = label
예제 #7
0
 def __init__(self, parent):
     self.receivers = {}
     self.parent = parent
     self.mw = self.parent.mainwindow
     self.doc = self.parent.mainwindow.document
     self.panel = TFrame(parent.panel, style='FlatFrame', borderwidth=0)
     self.separator = TLabel(self.panel, image="toolbar_sep")
     self.mw.Subscribe(DOCUMENT, self.doc_changed)
     self.setNormal()
예제 #8
0
 def create_balloon(self, root):
     self.root = root
     self.balloon = Toplevel(self.root)
     self.balloon.withdraw()
     self.balloon.overrideredirect(1)
     self.balloon["relief"] = 'flat'
     label = TLabel(self.balloon, text='Tooltip', style='Tooltips')
     label.pack(ipadx=2, ipady=2)
     self.balloon_label = label
예제 #9
0
파일: doctabs.py 프로젝트: kindlychung/sk1
	def __init__(self, parent, mainwindow):
		self.parent = parent
		self.mainwindow = mainwindow
		TFrame.__init__(self, self.parent, name='tabsPanel', style='FlatFrame',
					borderwidth=0)
		self.left_label = TLabel(self, style=LEFT_CORNER, image='space_3')
		self.right_label = TLabel(self, style=RIGHT_CORNER, image='space_3')
		self.stub_label = TLabel(self, style='DrawingAreaTop', image='space_5')
		self.stub_label.pack(side=TOP, fill=X)
예제 #10
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)
예제 #11
0
파일: ctxPanel.py 프로젝트: kindlychung/sk1
	def __init__(self, parent, mainwindow):
		self.parent = parent
		self.mainwindow = mainwindow
		self.doc = self.mainwindow.document
		self.panel = TFrame(self.parent, name='ctxPanel', style='ToolBarFrame', borderwidth=2)
		label = TLabel(self.panel, image="toolbar_left")
		label.pack(side=LEFT)
		self.initPanels()
		self.mainwindow.Subscribe(DOCUMENT, self.doc_changed)
		self.ReSubscribe()
		self.changeContent(forPage)
예제 #12
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()
예제 #13
0
	def __init__(self, parent):
		CtxSubPanel.__init__(self, parent)
		self.my_changes=0
		
		self.var_unit = StringVar(self.mw.root)
		self.var_unit.set(config.preferences.default_unit)
		
		label = TLabel(self.panel, text=_("Units:"))
		label.pack(side = LEFT, padx=2)
		self.entry_width = TCombobox(self.panel, state='readonly', postcommand = self.applyUnits, 
									 values=self.make_units(), width=4, style='ComboNormal', textvariable=self.var_unit)
		self.entry_width.pack(side = LEFT, padx=2)
		
		config.preferences.Subscribe(CHANGED, self.update)
예제 #14
0
 def __init__(self, parent, mainwindow):
     self.parent = parent
     self.mainwindow = mainwindow
     self.doc = self.mainwindow.document
     self.panel = TFrame(self.parent,
                         name='ctxPanel',
                         style='ToolBarFrame',
                         borderwidth=2)
     label = TLabel(self.panel, image="toolbar_left")
     label.pack(side=LEFT)
     self.initPanels()
     self.mainwindow.Subscribe(DOCUMENT, self.doc_changed)
     self.ReSubscribe()
     self.changeContent(forPage)
예제 #15
0
	def build_dlg(self):
		root = TFrame(self.top, style='FlatFrame', borderwidth = 10)
		root.pack(side = TOP, fill = BOTH, expand = 1)

		middle = TFrame(root, style='FlatFrame', borderwidth = 5)
		middle.pack(side = TOP, fill = X, expand = 1)
	
		label = TLabel(middle, text = _("Delete page No.:")+" ", style='FlatLabel')
		label.pack(side = LEFT)
		self.pagenum_spin = TSpinbox(middle, var=app.mw.document.active_page+1, vartype=0, textvariable = self.pagenum,
						min = 1, max = len(app.mw.document.pages), step = 1, width = 6, command = self.ok)
		self.pagenum_spin.pack(side = LEFT)
		if len(app.mw.document.pages)==1:
			self.pagenum_spin.set_state('disabled')
			

		bottom = TFrame(root, style='FlatFrame', borderwidth = 5)
		bottom.pack(side = BOTTOM, fill = X, expand = 1)
		cancel = TButton(bottom, text=_("Cancel"), command=self.cancel)
		cancel.pack(side = RIGHT)

		label = TLabel(bottom, text = '  ', style='FlatLabel')
		label.pack(side = RIGHT)
		ok = TButton(bottom, text=_("OK"), command=self.ok)
		ok.pack(side = RIGHT)
		self.focus_widget = ok
		
		self.top.bind('<Escape>', self.cancel)
		self.top.protocol('WM_DELETE_WINDOW', self.cancel)		
		self.top.resizable (width=0, height=0)
예제 #16
0
	def __init__(self, master, root, mw, cnf={}, **kw):
		self.mw = mw
		self.root = root
		self.master = master
		ResizableTFrame.__init__(self, master, root, size=240, orient=LEFT,
								min=240, max=400)

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

		self.pbrowser = PluginBrowser()

		self.plugins = app.objprop_plugins + app.layout_plugins
		self.plugins += app.transform_plugins + app.extentions_plugins
		self.plugins += app.effects_plugins + app.shaping_plugins
		self.plugins += [self.pbrowser]
예제 #17
0
파일: divide.py 프로젝트: kindlychung/sk1
	def init(self, master):
		PluginPanel.init(self, master)

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

		self.sign=TLabel(sign, image='shaping_divide')
		self.sign.pack(side=TOP)

		button = UpdatedButton(top, text = _("Apply"),
								command = self.apply_action,
								sensitivecb = self.is_correct_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)
				
		self.var_originals = IntVar(top)
		self.var_originals.set(1)
		
		self.autoupdate_check = TCheckbutton(button_frame, text = _("Leave originals"), 
											variable = self.var_originals)
		self.autoupdate_check.pack(side = LEFT, anchor=W, padx=10)

		self.init_from_doc()
		self.subscribe_receivers()
예제 #18
0
 def __init__(self, parent, color=None, **kw):
     TFrame.__init__(self, parent, style='FlatFrame', **kw)
     label = TLabel(self, image='empty_pattern_chooser', justify=CENTER)
     label.pack(side=TOP, pady=3)
     label2 = TLabel(
         self,
         text=_('Empty pattern selected,\ni.e. object will not be filled'),
         justify=CENTER)
     label2.pack(side=TOP, pady=10)
예제 #19
0
파일: subpanel.py 프로젝트: kindlychung/sk1
	def __init__(self, parent):
		self.receivers={}
		self.parent=parent
		self.mw=self.parent.mainwindow
		self.doc=self.parent.mainwindow.document
		self.panel=TFrame(parent.panel, style='FlatFrame', borderwidth=0)
		self.separator = TLabel(self.panel, image = "toolbar_sep")
		self.mw.Subscribe(DOCUMENT, self.doc_changed)
		self.setNormal()
예제 #20
0
    def __init__(self, parent):
        CtxSubPanel.__init__(self, parent)
        self.my_changes = 0

        self.var_unit = StringVar(self.mw.root)
        self.var_unit.set(config.preferences.default_unit)

        label = TLabel(self.panel, text=_("Units:"))
        label.pack(side=LEFT, padx=2)
        self.entry_width = TCombobox(self.panel,
                                     state='readonly',
                                     postcommand=self.applyUnits,
                                     values=self.make_units(),
                                     width=4,
                                     style='ComboNormal',
                                     textvariable=self.var_unit)
        self.entry_width.pack(side=LEFT, padx=2)

        config.preferences.Subscribe(CHANGED, self.update)
예제 #21
0
	def init(self, master):
		
		TFrame.__init__(self, master)
		
		##### Title #########################
		
		self.title_label=TLabel(self, text=self.title, font=config.preferences.large_font, justify=LEFT)
		self.title_label.pack(side=TOP, anchor=W)
		
		##### line #########################
				
		line = TLabel(self, style='HLine2')
		line.pack(side = TOP, fill = X)				

		##### here should be panel content #########################
		
		self.init_vars()		
		self.build()
		self.activated=1
예제 #22
0
	def __init__(self, parent):
		self.my_changes=0
		
		CtxSubPanel.__init__(self, parent)
		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)
		
		label = TLabel(self.panel, text=_("Jump:"))
		label.pack(side = LEFT, padx=2)
		self.entry_jump = TSpinbox(self.panel,  var=0, 
						vartype=1, textvariable = self.var_jump_number,
						min = 0, max = 1000, step = .1, width = 6, command = self.applyJump)
		self.entry_jump.pack(side = LEFT, padx=2)
		config.preferences.Subscribe(CHANGED, self.update)		
		self.var_jump.set(config.preferences.handle_jump)
		self.update(0, 0)	
예제 #23
0
class PrefPanel(TFrame):

    name = 'PreferencePanel'
    title = _('Preference Panel')
    icon = 'pref_plugin'
    activated = 0
    contents = []

    def init(self, master):

        TFrame.__init__(self, master)

        ##### Title #########################

        self.title_label = TLabel(self,
                                  text=self.title,
                                  font=config.preferences.large_font,
                                  justify=LEFT)
        self.title_label.pack(side=TOP, anchor=W)

        ##### line #########################

        line = TLabel(self, style='HLine2')
        line.pack(side=TOP, fill=X)

        ##### here should be panel content #########################

        self.init_vars()
        self.build()
        self.activated = 1

    def init_vars(self):
        #Copies preferences to object fields
        pass

    def build(self):
        #builds panel UI
        pass

    def apply(self):
        #Applies changes
        pass
예제 #24
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)
예제 #25
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)
예제 #26
0
    def __init__(self, master, root, mw, cnf={}, **kw):
        self.mw = mw
        self.root = root
        self.master = master
        ResizableTFrame.__init__(self,
                                 master,
                                 root,
                                 size=240,
                                 orient=LEFT,
                                 min=240,
                                 max=400)

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

        self.pbrowser = PluginBrowser()

        self.plugins = app.objprop_plugins + app.layout_plugins
        self.plugins += app.transform_plugins + app.extentions_plugins
        self.plugins += app.effects_plugins + app.shaping_plugins
        self.plugins += [self.pbrowser]
예제 #27
0
    def init(self, master):
        PluginPanel.init(self, master)

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

        sign = TFrame(top, style='RoundedFrame', borderwidth=5)
        sign.pack(side=TOP)

        self.sign = TLabel(sign, image='messagebox_construct')
        self.sign.pack(side=TOP)

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

        self.init_from_doc()
        self.subscribe_receivers()
예제 #28
0
	def build_dlg(self):
		root = self.top
		top = TFrame(root, style='FlatFrame', borderwidth=10)
		top.pack(side=TOP, fill=BOTH, expand=1)

		frame = TFrame(top, name='top', style='FlatFrame')
		frame.pack(side=TOP, fill=BOTH, expand=1)
		label = TLabel(frame, image='messagebox_' + self.image, style='FlatLabel')
		label.pack(side=LEFT, padx=5, pady=5)
		label = TLabel(frame, text=self.message, name='msg', style='FlatLabel', justify='center', anchor='center')
		label.pack(side=RIGHT, fill=BOTH, expand=1)

		frame = TFrame(top, name='bot', style='FlatFrame')
		frame.pack(side=BOTTOM)#, fill = X, expand = 1)

		command = self.ok
		for i in range(len(self.buttons)):
			button = UpdatedButton(frame, text='  ' + self.buttons[i] + '  ', command=command, args=i)
			button.grid(column=i, row=0, sticky='ew', padx=10, pady=0)
			if i == self.default:
				if TkVersion >= 8.0:
					button['default'] = 'active'
				self.focus_widget = button
			else:
				if TkVersion >= 8.0:
					button['default'] = 'normal'

		if self.default is not None:
			top.bind('<Return>', self.invoke_default)

		frame = TFrame(top, name='mid', style='FlatFrame', borderwidth=1)
		frame.pack(side=TOP, fill=X)

		root.resizable (width=0, height=0)
예제 #29
0
	def init(self, master):
		PluginPanel.init(self, master)
		top = TFrame(self.panel, style='FlatFrame', borderwidth=7)
		top.pack(side = TOP, fill=BOTH)
		
		sign = TFrame(top, style='RoundedFrame', borderwidth=5)
		sign.pack(side=TOP)

		self.sign = TLabel(sign, image='color_converter')
		self.sign.pack(side=TOP)
		
		self.cs_name = StringVar(top)
		self.cs_name.set(RGB)
		
		label = TLabel(top, text=_("Colorspace:")+" ")
		label.pack(side = TOP, anchor=W)
		
		self.colorspaces = TCombobox(top, state='readonly', postcommand = self.set_cs, 
									 values=self.make_cs_list(), width=14, style='ComboNormal',
									 textvariable=self.cs_name)
		self.colorspaces.pack(side = TOP, fill=X, pady=3)
		
		button = UpdatedButton(top, text = _("Apply"),
								command = self.apply_colorspace,
								sensitivecb = self.is_selection)
		button.pack(side = BOTTOM, expand = 1, fill = X, pady=3)
		self.Subscribe(SELECTION, button.Update)
		


		self.init_from_doc()
		self.subscribe_receivers()
예제 #30
0
	def __init__(self, parent, **kw):
		TFrame.__init__(self, parent, style='FlatFrame', **kw)	
			
		spot_frame = TFrame(self, borderwidth=2, style='FlatFrame')
		spot_frame.pack(side=TOP)
		
		label = TLabel(spot_frame, text=_('Color name:'), justify=LEFT)
		label.pack(side=TOP)
		
		self.colorname_value = StringVar('')
		
		self.colorname = TEntrybox(spot_frame, text='', width=25, textvariable=self.colorname_value)
		self.colorname.set_state('readonly')
		self.colorname.pack(side=BOTTOM, fill=X)
		
		cmyk_frame = TFrame(self, borderwidth=2, style='FlatFrame')
		cmyk_frame.pack(side=TOP)
		
		self.CMYK_label = TLabel(cmyk_frame, text='C:\nM:\nY:\nK:', justify=LEFT)
		self.CMYK_label.pack(side=LEFT, padx=10)
		
		self.RGB_label = TLabel(cmyk_frame, text='R:\nG:\nB:', justify=LEFT)
		self.RGB_label.pack(side=LEFT, padx=10)
		
		self.HTML_label = TLabel(self, text='HTML:', justify=LEFT)
		self.HTML_label.pack(side=BOTTOM, pady=5)		
예제 #31
0
	def build_dlg(self):
		root = TFrame(self.top, style='FlatFrame', borderwidth = 10)
		root.pack(side = TOP, fill = BOTH, expand = 1)

		middle = TFrame(root, style='FlatFrame', borderwidth = 5)
		middle.pack(side = TOP, fill = X, expand = 1)
	
		label = TLabel(middle, text = _("Go to page No.:")+" ", style='FlatLabel')
		label.pack(side = LEFT)
		self.pagenum_spin = TSpinbox(middle, var=app.mw.document.active_page+1, vartype=0, textvariable = self.pagenum,
						min = 1, max = len(app.mw.document.pages), step = 1, width = 6, command = self.ok)
		self.pagenum_spin.pack(side = LEFT)
		if len(app.mw.document.pages)==1:
			self.pagenum_spin.set_state('disabled')
			

		bottom = TFrame(root, style='FlatFrame', borderwidth = 5)
		bottom.pack(side = BOTTOM, fill = X, expand = 1)
		cancel = TButton(bottom, text=_("Cancel"), command=self.cancel)
		cancel.pack(side = RIGHT)

		label = TLabel(bottom, text = '  ', style='FlatLabel')
		label.pack(side = RIGHT)
		ok = TButton(bottom, text=_("OK"), command=self.ok)
		ok.pack(side = RIGHT)
		self.focus_widget = ok
		
		self.top.bind('<Escape>', self.cancel)
		self.top.protocol('WM_DELETE_WINDOW', self.cancel)		
		self.top.resizable (width=0, height=0)
예제 #32
0
class PrefPanel(TFrame):
	
	name='PreferencePanel'
	title=_('Preference Panel')
	icon='pref_plugin'
	activated=0
	contents=[]
	
	def init(self, master):
		
		TFrame.__init__(self, master)
		
		##### Title #########################
		
		self.title_label=TLabel(self, text=self.title, font=config.preferences.large_font, justify=LEFT)
		self.title_label.pack(side=TOP, anchor=W)
		
		##### line #########################
				
		line = TLabel(self, style='HLine2')
		line.pack(side = TOP, fill = X)				

		##### here should be panel content #########################
		
		self.init_vars()		
		self.build()
		self.activated=1
		
	def init_vars(self):
		#Copies preferences to object fields
		pass
		
	def build(self):
		#builds panel UI
		pass
	
	def apply(self):
		#Applies changes
		pass
예제 #33
0
class CtxSubPanel:
    def __init__(self, parent):
        self.receivers = {}
        self.parent = parent
        self.mw = self.parent.mainwindow
        self.doc = self.parent.mainwindow.document
        self.panel = TFrame(parent.panel, style='FlatFrame', borderwidth=0)
        self.separator = TLabel(self.panel, image="toolbar_sep")
        self.mw.Subscribe(DOCUMENT, self.doc_changed)
        self.setNormal()

    def ReSubscribe(self):
        pass

    def doc_changed(self, doc):
        self.doc = doc
        self.ReSubscribe()

    def setLast(self):
        self.separator.forget()

    def setNormal(self):
        self.separator.pack(side=RIGHT, padx=2)
예제 #34
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)
예제 #35
0
파일: subpanel.py 프로젝트: kindlychung/sk1
class CtxSubPanel:
	
	def __init__(self, parent):
		self.receivers={}
		self.parent=parent
		self.mw=self.parent.mainwindow
		self.doc=self.parent.mainwindow.document
		self.panel=TFrame(parent.panel, style='FlatFrame', borderwidth=0)
		self.separator = TLabel(self.panel, image = "toolbar_sep")
		self.mw.Subscribe(DOCUMENT, self.doc_changed)
		self.setNormal()
		
	def ReSubscribe(self):
		pass

	def doc_changed(self, doc):
		self.doc=doc
		self.ReSubscribe()
		
	def setLast(self):
		self.separator.forget()
		
	def setNormal(self):
		self.separator.pack(side = RIGHT, padx=2)
예제 #36
0
	def init(self, master):
		PluginPanel.init(self, master)

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

		sign = TFrame(top, style='RoundedFrame', borderwidth=5)
		sign.pack(side=TOP)

		self.sign = TLabel(sign, image='effects_blend')
		self.sign.pack(side=TOP)

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

		self.update_buttons = []
		button = UpdatedButton(top, text=_("Apply"),
								command=self.apply_blend,
								sensitivecb=self.doc_can_blend)
		button.pack(in_=button_frame, side=LEFT, expand=1, fill=X)
		self.document.Subscribe(SELECTION, button.Update)
		self.update_buttons.append(button)


		steps_frame = TFrame(top, style='FlatFrame', borderwidth=15)
		steps_frame.pack(side=TOP)
		label = TLabel(steps_frame, text="  " + _("Steps:") + " ")
		label.pack(side=LEFT, anchor=E)

		self.var_steps = IntVar(top)
		self.var_steps.set(config.preferences.blend_panel_default_steps)

		self.entry = TSpinbox(steps_frame, var=10, vartype=0, textvariable=self.var_steps,
									min=1, max=100000, step=1, width=6, command=self.apply_blend)
		self.entry.pack(side=LEFT, anchor=E)


		button = UpdatedButton(top, text=_("Select Start"),
								sensitivecb=self.can_select,
								command=self.select_control,
								args=SelectStart)
		button.pack(side=BOTTOM, fill=X, expand=1, pady=3)
		self.document.Subscribe(SELECTION, button.Update)
		self.update_buttons.append(button)

		button = UpdatedButton(top, text=_("Select End"),
								sensitivecb=self.can_select,
								command=self.select_control,
								args=SelectEnd)
		button.pack(side=BOTTOM, fill=X, expand=1)
		self.document.Subscribe(SELECTION, button.Update)
		self.update_buttons.append(button)

		self.init_from_doc()
		self.subscribe_receivers()
예제 #37
0
    def build_dlg(self):
        root = self.top
        top = TFrame(root, style='FlatFrame', borderwidth=10)
        top.pack(side=TOP, fill=BOTH, expand=1)

        frame = TFrame(top, name='top', style='FlatFrame')
        frame.pack(side=TOP, fill=BOTH, expand=1)
        label = TLabel(frame,
                       image='messagebox_' + self.image,
                       style='FlatLabel')
        label.pack(side=LEFT, padx=5, pady=5)
        label = TLabel(frame,
                       text=self.message,
                       name='msg',
                       style='FlatLabel',
                       justify='center',
                       anchor='center')
        label.pack(side=RIGHT, fill=BOTH, expand=1)

        frame = TFrame(top, name='bot', style='FlatFrame')
        frame.pack(side=BOTTOM)  #, fill = X, expand = 1)

        command = self.ok
        for i in range(len(self.buttons)):
            button = UpdatedButton(frame,
                                   text='  ' + self.buttons[i] + '  ',
                                   command=command,
                                   args=i)
            button.grid(column=i, row=0, sticky='ew', padx=10, pady=0)
            if i == self.default:
                if TkVersion >= 8.0:
                    button['default'] = 'active'
                self.focus_widget = button
            else:
                if TkVersion >= 8.0:
                    button['default'] = 'normal'

        if self.default is not None:
            top.bind('<Return>', self.invoke_default)

        frame = TFrame(top, name='mid', style='FlatFrame', borderwidth=1)
        frame.pack(side=TOP, fill=X)

        root.resizable(width=0, height=0)
예제 #38
0
파일: aboutdlg.py 프로젝트: kindlychung/sk1
	def build_dlg(self):
		self.root = TFrame(self.top, style='FlatFrame', borderwidth=5)
		self.root.pack(side=TOP, fill=BOTH, expand=1)

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

		icon = TLabel(panel, style='FlatLabel', image='icon_sk1_48')
		icon.pack(side=LEFT, padx=5, pady=5)

		panel = TFrame(panel, style='FlatFrame', borderwidth=5)
		panel.pack(side=LEFT)

		text = TLabel(panel, style='FlatLabel', text='sK1 v.%s' % app.sKVersion,
				font=app.config.preferences.large_font + ' bold')
		text.pack(side=TOP, anchor=W)

		text = TLabel(panel, style='FlatLabel',
				text=_('Uses libraries: Tcl/Tk %s; Python %s; LCMS %s') %
				(TclVersion, string.split(sys.version)[0], cms.get_version()))
		text.pack(side=TOP, anchor=W)

		self.nb = TNotebook(self.root, height=150, width=500, padding=5)
		self.nb.pack(side=TOP, fill=BOTH, expand=1)

		self.build_tab_about()
		self.build_tab_authors()
		self.build_tab_localization()
		self.build_tab_license()

		ok = TButton(self.root, text=_("Close"), command=self.ok)
		ok.pack(side=RIGHT, padx=5, pady=5)

		self.focus_widget = ok

		self.top.bind('<Escape>', self.cancel)
		self.top.protocol('WM_DELETE_WINDOW', self.cancel)
		self.top.resizable (width=0, height=0)
예제 #39
0
 def __init__(self, parent, mainwindow):
     self.parent = parent
     self.mainwindow = mainwindow
     TFrame.__init__(self,
                     self.parent,
                     name='tabsPanel',
                     style='FlatFrame',
                     borderwidth=0)
     self.left_label = TLabel(self, style=LEFT_CORNER, image='space_3')
     self.right_label = TLabel(self, style=RIGHT_CORNER, image='space_3')
     self.stub_label = TLabel(self, style='DrawingAreaTop', image='space_5')
     self.stub_label.pack(side=TOP, fill=X)
예제 #40
0
class SPOTDigitizer(TFrame):
    def __init__(self, parent, **kw):
        TFrame.__init__(self, parent, style='FlatFrame', **kw)

        spot_frame = TFrame(self, borderwidth=2, style='FlatFrame')
        spot_frame.pack(side=TOP)

        label = TLabel(spot_frame, text=_('Color name:'), justify=LEFT)
        label.pack(side=TOP)

        self.colorname_value = StringVar('')

        self.colorname = TEntrybox(spot_frame,
                                   text='',
                                   width=25,
                                   textvariable=self.colorname_value)
        self.colorname.set_state('readonly')
        self.colorname.pack(side=BOTTOM, fill=X)

        cmyk_frame = TFrame(self, borderwidth=2, style='FlatFrame')
        cmyk_frame.pack(side=TOP)

        self.CMYK_label = TLabel(cmyk_frame,
                                 text='C:\nM:\nY:\nK:',
                                 justify=LEFT)
        self.CMYK_label.pack(side=LEFT, padx=10)

        self.RGB_label = TLabel(cmyk_frame, text='R:\nG:\nB:', justify=LEFT)
        self.RGB_label.pack(side=LEFT, padx=10)

        self.HTML_label = TLabel(self, text='HTML:', justify=LEFT)
        self.HTML_label.pack(side=BOTTOM, pady=5)

    def set_color(self, color):
        self.color = color
        c, m, y, k = color.getCMYK()
        self.CMYK_label['text'] = 'C: %d\nM: %d\nY: %d\nK: %d' % (round(
            c * 100, 2), round(m * 100, 2), round(y * 100, 2), round(
                k * 100, 2))

        r, g, b = color.getRGB()
        text = 'R: %d\nG: %d\nB: %d' % (round(r * 255, 2), round(
            g * 255, 2), round(b * 255, 2))
        self.RGB_label['text'] = text

        int_color = (round(r * 255), round(g * 255), round(b * 255))
        text = 'HTML: #%02X%02X%02X' % int_color
        self.HTML_label['text'] = text

        if color.name == 'All':
            self.colorname_value.set(color.toString())
        else:
            self.colorname_value.set(color.name)
예제 #41
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)
예제 #42
0
    def build_dlg(self):
        root = TFrame(self.top, style='FlatFrame', borderwidth=10)
        root.pack(side=TOP, fill=BOTH, expand=1)

        label = TLabel(root, text='', style='FlatLabel', textvariable=info1)
        label.pack(side=TOP, anchor=W, pady=5)

        label = TLabel(root, text='', style='FlatLabel', textvariable=info2)
        label.pack(side=TOP, anchor=W, pady=5)

        self.prgrs = TProgressbar(root,
                                  orient='horizontal',
                                  style='Horizontal.Progress',
                                  length=450,
                                  value=10,
                                  variable=info3)
        self.prgrs.pack(side=TOP, anchor=W)

        self.top.protocol('WM_DELETE_WINDOW', self.cancel)
        self.top.resizable(width=0, height=0)
예제 #43
0
    def __init__(self, parent, callback, color, sign, allow_emtpy=1, **kw):
        self.color = color
        self.callback = callback
        TFrame.__init__(self, parent, style='FlatFrame', **kw)
        self.cs_name = StringVar(self)
        self.set_cs_name(self.color)

        self.colorspaces = TCombobox(self,
                                     state='readonly',
                                     postcommand=self.set_cs,
                                     values=self.make_cs_list(allow_emtpy),
                                     width=17,
                                     style='ComboNormal',
                                     textvariable=self.cs_name)
        self.colorspaces.pack(side=BOTTOM, fill=X, pady=3)

        label = TLabel(self, text=_("Colorspace:") + " ")
        label.pack(side=LEFT, anchor='sw')

        label = TLabel(self, image=sign)
        label.pack(side=RIGHT)
예제 #44
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()
예제 #45
0
파일: outline.py 프로젝트: kindlychung/sk1
	def init(self, master):
		PluginPanel.init(self, master)

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

		self.sign=TLabel(sign, image='messagebox_construct')
		self.sign.pack(side=TOP)

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

		self.init_from_doc()
		self.subscribe_receivers()
예제 #46
0
	def build_dlg(self):		
		root = TFrame(self.top, style='FlatFrame', borderwidth = 10)
		root.pack(side = TOP, fill = BOTH, expand = 1)
	
		label = TLabel(root, text = '', style='FlatLabel', textvariable=info1)
		label.pack(side = TOP, anchor=W, pady=5)
		
		label = TLabel(root, text = '', style='FlatLabel', textvariable=info2)
		label.pack(side = TOP, anchor=W, pady=5)
		
		self.prgrs = TProgressbar(root, orient = 'horizontal', style='Horizontal.Progress',
								length = 450, value=10, variable=info3)
		self.prgrs.pack(side = TOP, anchor=W)

		self.top.protocol('WM_DELETE_WINDOW', self.cancel)		
		self.top.resizable (width=0, height=0)
예제 #47
0
	def build_dlg(self):

		root = self.top
		top = TFrame(root, style='FlatFrame', borderwidth=13)
		top.pack(side=TOP)

		label = TLabel(top, text=_("Please select the object categories whose\n default properties you want to change"))
		label.pack(side=TOP, anchor=W)
		frame = TFrame(top, style='FlatFrame', borderwidth=10)
		frame.pack(side=TOP)
		self.var_graphics_style = IntVar(top)
		self.var_graphics_style.set(0)
		if self.category != 'font':
			self.var_graphics_style.set(1)
		button = TCheckbutton(frame, text=_("Graphics Objects"), state=(self.category == 'font' and DISABLED or NORMAL), variable=self.var_graphics_style)
		button.pack(side=TOP, anchor=W)
		self.var_text_style = IntVar(top)
		self.var_text_style.set(0)
		if self.category == 'font':
			self.var_text_style.set(1)
		button = TCheckbutton(frame, text=_("Text Objects"), state=(self.category == 'line' and DISABLED or NORMAL), variable=self.var_text_style)
		button.pack(side=TOP, anchor=W)

		label = TLabel(top, style="HLine")
		label.pack(side=TOP, fill=BOTH)

		but_frame = TFrame(top, style='FlatFrame')
		but_frame.pack(side=TOP, fill=BOTH, expand=1)

		button = TButton(but_frame, text=_("Cancel"), command=self.cancel)
		button.pack(side=RIGHT, expand=1)

		button = TButton(but_frame, text=_("OK"), command=self.ok)
		button.pack(side=RIGHT, expand=1)


		root.resizable (width=0, height=0)
예제 #48
0
	def __init__(self, parent, callback, color, sign, allow_emtpy=1, **kw):
		self.color=color
		self.callback=callback
		TFrame.__init__(self, parent, style='FlatFrame', **kw)
		self.cs_name = StringVar(self)
		self.set_cs_name(self.color)
		
		self.colorspaces = TCombobox(self, state='readonly', postcommand = self.set_cs, 
									 values=self.make_cs_list(allow_emtpy), width=17, style='ComboNormal',
									 textvariable=self.cs_name)
		self.colorspaces.pack(side = BOTTOM, fill=X, pady=3)
		
		label = TLabel(self, text=_("Colorspace:")+" ")
		label.pack(side = LEFT, anchor='sw')
		
		label = TLabel(self, image=sign)
		label.pack(side = RIGHT)
예제 #49
0
class SPOTDigitizer(TFrame):
	
	def __init__(self, parent, **kw):
		TFrame.__init__(self, parent, style='FlatFrame', **kw)	
			
		spot_frame = TFrame(self, borderwidth=2, style='FlatFrame')
		spot_frame.pack(side=TOP)
		
		label = TLabel(spot_frame, text=_('Color name:'), justify=LEFT)
		label.pack(side=TOP)
		
		self.colorname_value = StringVar('')
		
		self.colorname = TEntrybox(spot_frame, text='', width=25, textvariable=self.colorname_value)
		self.colorname.set_state('readonly')
		self.colorname.pack(side=BOTTOM, fill=X)
		
		cmyk_frame = TFrame(self, borderwidth=2, style='FlatFrame')
		cmyk_frame.pack(side=TOP)
		
		self.CMYK_label = TLabel(cmyk_frame, text='C:\nM:\nY:\nK:', justify=LEFT)
		self.CMYK_label.pack(side=LEFT, padx=10)
		
		self.RGB_label = TLabel(cmyk_frame, text='R:\nG:\nB:', justify=LEFT)
		self.RGB_label.pack(side=LEFT, padx=10)
		
		self.HTML_label = TLabel(self, text='HTML:', justify=LEFT)
		self.HTML_label.pack(side=BOTTOM, pady=5)		
		
	def set_color(self, color):
		self.color = color
		c, m, y, k = color.getCMYK()
		self.CMYK_label['text'] = 'C: %d\nM: %d\nY: %d\nK: %d' % (round(c * 100, 2), round(m * 100, 2), round(y * 100, 2), round(k * 100, 2))
				
		r, g, b = color.getRGB()
		text = 'R: %d\nG: %d\nB: %d' % (round(r * 255, 2), round(g * 255, 2), round(b * 255, 2))
		self.RGB_label['text'] = text	
		
		int_color = (round(r * 255), round(g * 255), round(b * 255))
		text = 'HTML: #%02X%02X%02X' % int_color
		self.HTML_label['text'] = text	
		
		if color.name == 'All':
			self.colorname_value.set(color.toString())
		else:
			self.colorname_value.set(color.name)		
예제 #50
0
    def init(self, master):

        TFrame.__init__(self, master)

        ##### Title #########################

        self.title_label = TLabel(self,
                                  text=self.title,
                                  font=config.preferences.large_font,
                                  justify=LEFT)
        self.title_label.pack(side=TOP, anchor=W)

        ##### line #########################

        line = TLabel(self, style='HLine2')
        line.pack(side=TOP, fill=X)

        ##### here should be panel content #########################

        self.init_vars()
        self.build()
        self.activated = 1
예제 #51
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)
예제 #52
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()
예제 #53
0
class ColorSpaceConverter(PluginPanel):
	name='ColorSpaceConverter'
	title = _("Color Space Converter")


	def init(self, master):
		PluginPanel.init(self, master)
		top = TFrame(self.panel, style='FlatFrame', borderwidth=7)
		top.pack(side = TOP, fill=BOTH)
		
		sign = TFrame(top, style='RoundedFrame', borderwidth=5)
		sign.pack(side=TOP)

		self.sign = TLabel(sign, image='color_converter')
		self.sign.pack(side=TOP)
		
		self.cs_name = StringVar(top)
		self.cs_name.set(RGB)
		
		label = TLabel(top, text=_("Colorspace:")+" ")
		label.pack(side = TOP, anchor=W)
		
		self.colorspaces = TCombobox(top, state='readonly', postcommand = self.set_cs, 
									 values=self.make_cs_list(), width=14, style='ComboNormal',
									 textvariable=self.cs_name)
		self.colorspaces.pack(side = TOP, fill=X, pady=3)
		
		button = UpdatedButton(top, text = _("Apply"),
								command = self.apply_colorspace,
								sensitivecb = self.is_selection)
		button.pack(side = BOTTOM, expand = 1, fill = X, pady=3)
		self.Subscribe(SELECTION, button.Update)
		


		self.init_from_doc()
		self.subscribe_receivers()

###############################################################################
	def is_selection(self):
		return (len(self.document.selection) > 0)
	
	def subscribe_receivers(self):
		self.document.Subscribe(SELECTION, self.init_from_doc)

	def unsubscribe_receivers(self):
		self.document.Unsubscribe(SELECTION, self.init_from_doc)

	def init_from_doc(self, *arg):
		self.issue(SELECTION)

	def Update(self):
		pass

	def make_cs_list(self):
		cs=()
		cs+=(RGB,CMYK)
		return cs

	def set_cs(self):
		pass

	def apply_colorspace(self):
		objects = self.document.selection.GetObjects()
		name = self.cs_name.get()
		if name==RGB:
			cs_name= 'RGB'
		elif name==CMYK:
			cs_name= 'CMYK'
		
		self.document.begin_transaction(name)
		try:
			try:
				add_undo = self.document.add_undo
				self.apply_cs(objects, cs_name)
				add_undo(self.document.queue_edited())
			except:
				self.document.abort_transaction()
		finally:
			self.document.end_transaction()
		app.mw.canvas.ForceRedraw()

	def apply_cs(self, objects, cs_name):
		for object in objects:
			if object.is_Compound:
				self.apply_cs(object.GetObjects(),cs_name)
			
			elif object.is_Text or object.is_Bezier or object.is_Rectangle or object.is_Ellipse:
				self.document.add_undo(self.FillStyle(object,cs_name))
				self.document.add_undo(self.OutlineStyle(object,cs_name))
			
			elif object.is_Image:
				if not cs_name==object.data.image_mode:
					self.document.add_undo(object.Convert(cs_name))


	def FillStyle(self, object, cs_name):
		undo_info = None
		try:
			fill_pattern = object.properties.fill_pattern
			
			if fill_pattern is EmptyPattern:
				pass
			
			elif fill_pattern.is_Solid:
				color=fill_pattern.Color()
				undo_info = self.setSolidPatternFill(object, color, cs_name)
			
			elif fill_pattern.is_Hatching:
				pass
			
			elif fill_pattern.is_Tiled:
				pass
			
			elif fill_pattern.is_Gradient:
				pass
			
			elif fill_pattern.is_Image:
				pass
		finally:
			if undo_info is not None:
				return undo_info
			return NullUndo

	def setSolidPatternFill(self, object, color, cs_name):
		if color.model == cs_name:
			return
		color=self.convert_color(color, cs_name)
		undo=(object.SetProperties(fill_pattern=SolidPattern(color)))
		return undo



	def OutlineStyle(self, object, cs_name):
		undo_info = None
		try:
			line_pattern=object.properties.line_pattern
			if line_pattern is EmptyPattern:
					pass
			elif line_pattern.is_Solid:
					color=line_pattern.Color()
					undo_info = self.setSolidPatternOutline(object, color, cs_name)
		finally:
			if undo_info is not None:
				return undo_info
			return NullUndo

	def setSolidPatternOutline(self, object, color, cs_name):
		if color.model == cs_name:
			return
		color=self.convert_color(color, cs_name)
		undo=(object.SetProperties(line_pattern=SolidPattern(color)))
		return undo




	def convert_color(self, color, cs_name):
		if cs_name is None:
			return color
		
		elif cs_name == 'CMYK':
			c, m, y, k = color.getCMYK()
			return CreateCMYKAColor(c, m, y, k, color.alpha)
		
		elif cs_name == 'RGB':
			r, g, b = color.getRGB()
			return CreateRGBAColor(r, g, b, color.alpha)
예제 #54
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()