コード例 #1
0
ファイル: filedialog.py プロジェクト: kindlychung/sk1
	def build_dlg(self):

		parent = TFrame(self.top, style='FlatFrame', borderwidth=10)
		parent.pack(side=TOP, fill=BOTH, expand=1)

		bwpanel = BrowsePanel(parent, self, style='FlatFrame')
		bwpanel.pack(side=TOP, fill=X, expand=0)

		Frame(parent, relief='flat', height=5).pack(side=TOP, fill=X, expand=0)

		cmdpanel = CommandPanel(parent, self, style='FlatFrame')
		cmdpanel.pack(side=BOTTOM, fill=X, expand=0)

		Frame(parent, relief='flat', height=5).pack(side=BOTTOM, fill=X, expand=0)

		places = PlacesPanel(parent, self, borderwidth=3)
		places.pack(side=LEFT, fill=Y, expand=0)

		Frame(parent, relief='flat', width=5).pack(side=LEFT, fill=Y, expand=0)

		filepnl = FilePanel(parent, self, clr='white')
		filepnl.pack(side=TOP, fill=BOTH, expand=1)

		self.top.bind('<Escape>', self.cancel)
		self.top.protocol('WM_DELETE_WINDOW', self.cancel)
コード例 #2
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()
コード例 #3
0
    def init(self, master):
        PluginPanel.init(self, master)
        top = self.panel

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

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

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

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

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

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

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

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

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

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

        app.mw.docmanager.activedoc.Subscribe(GRID, self.init_from_doc)
        app.mw.Subscribe(DOCUMENT, self.init_from_doc)
        self.init_from_doc()
コード例 #4
0
    def build_tab_about(self):
        panel = TFrame(self.root, style='FlatFrame', borderwidth=10)
        self.nb.add(panel, text=_('About application'))

        subpanel = TFrame(panel, style='FlatFrame', borderwidth=0)
        subpanel.pack(side=TOP, fill=Y, expand=1)

        subpanel = TFrame(subpanel, style='FlatFrame', borderwidth=5)
        subpanel.pack(side=LEFT, anchor='center')

        text = TLabel(subpanel,
                      style='FlatLabel',
                      text=_("Illustration program for prepress"))
        text.pack(side=TOP, anchor=W, pady=10)

        from time import gmtime, strftime
        year = strftime("%Y", gmtime())

        text = TLabel(subpanel,
                      style='FlatLabel',
                      text="(c)2003-%s sK1 Team" % (year))
        text.pack(side=TOP, anchor=W, pady=10)

        text = TLabel(subpanel,
                      style='FlatLabel',
                      text='http://sk1project.org',
                      foreground='blue',
                      underline=20,
                      cursor='hand2')
        text.pack(side=TOP, anchor=W)
        text.bind('<Button-1>', self.goToSite)
コード例 #5
0
    def build_dlg(self):

        parent = TFrame(self.top, style='FlatFrame', borderwidth=10)
        parent.pack(side=TOP, fill=BOTH, expand=1)

        bwpanel = BrowsePanel(parent, self, style='FlatFrame')
        bwpanel.pack(side=TOP, fill=X, expand=0)

        Frame(parent, relief='flat', height=5).pack(side=TOP, fill=X, expand=0)

        cmdpanel = CommandPanel(parent, self, style='FlatFrame')
        cmdpanel.pack(side=BOTTOM, fill=X, expand=0)

        Frame(parent, relief='flat', height=5).pack(side=BOTTOM,
                                                    fill=X,
                                                    expand=0)

        places = PlacesPanel(parent, self, borderwidth=3)
        places.pack(side=LEFT, fill=Y, expand=0)

        Frame(parent, relief='flat', width=5).pack(side=LEFT, fill=Y, expand=0)

        filepnl = FilePanel(parent, self, clr='white')
        filepnl.pack(side=TOP, fill=BOTH, expand=1)

        self.top.bind('<Escape>', self.cancel)
        self.top.protocol('WM_DELETE_WINDOW', self.cancel)
コード例 #6
0
ファイル: colordigitizer.py プロジェクト: kindlychung/sk1
	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)		
コード例 #7
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)
コード例 #8
0
ファイル: colorchooser.py プロジェクト: kindlychung/sk1
	def __init__(self, parent, color=None, **kw):
		TFrame.__init__(self, parent, style='FlatFrame', **kw)

		frame = TFrame(self, style="RoundedFrame", borderwidth=5)
		frame.pack(side=LEFT)

		self.color_monitor = Canvas(frame, width=100, height=50, relief='flat')
		self.color_monitor.pack(side=TOP)
コード例 #9
0
    def __init__(self, parent, color=None, **kw):
        TFrame.__init__(self, parent, style='FlatFrame', **kw)

        frame = TFrame(self, style="RoundedFrame", borderwidth=5)
        frame.pack(side=LEFT)

        self.color_monitor = Canvas(frame, width=100, height=50, relief='flat')
        self.color_monitor.pack(side=TOP)
コード例 #10
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()
コード例 #11
0
ファイル: grid_plugin.py プロジェクト: kindlychung/sk1
	def init(self, master):
		PluginPanel.init(self, master)
		top = self.panel

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

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

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

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

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


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

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

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

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


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

		app.mw.docmanager.activedoc.Subscribe(GRID, self.init_from_doc)
		app.mw.Subscribe(DOCUMENT, self.init_from_doc)
		self.init_from_doc()
コード例 #12
0
ファイル: colorchooser.py プロジェクト: kindlychung/sk1
	def __init__(self, parent, callback, color=None, **kw):
		TFrame.__init__(self, parent, style='FlatFrame', **kw)

		frame = TFrame(self, style="RoundedFrame", borderwidth=5)
		frame.pack(side=LEFT)
		self.viewxy = ChooseRGBXY(frame, callback, xyramp_size[0], xyramp_size[1], 0, 1)
		self.viewxy.pack(side=LEFT)

		frame = TFrame(self, style="RoundedFrame", borderwidth=5)
		frame.pack(side=LEFT)
		self.viewz = ChooseRGBZ(frame, callback, zramp_size[0], zramp_size[1], 2)
		self.viewz.pack(side=LEFT)
コード例 #13
0
ファイル: insertpagedlg.py プロジェクト: kindlychung/sk1
	def build_dlg(self):
		root = TFrame(self.top, style='FlatFrame', borderwidth = 10)
		root.pack(side = TOP, fill = BOTH, expand = 1)
		
		top = TFrame(root, style='FlatFrame', borderwidth = 5)
		top.pack(side = TOP, fill = X, expand = 1)
		label = TLabel(top, text = _("Insert:")+" ", style='FlatLabel')
		label.pack(side = LEFT)
		self.numpages_spin = TSpinbox(top,  var=1, vartype=0, textvariable = self.numpages,
						min = 1, max = 1000, step = 1, width = 6, command = self.ok)
		self.numpages_spin.pack(side = LEFT)		
		label = TLabel(top, text = " "+_("page(s)"), style='FlatLabel')
		label.pack(side = LEFT)


		middle = TFrame(root, style='FlatFrame', borderwidth = 5)
		middle.pack(side = TOP, fill = X, expand = 1)
		
		rbframe = TFrame(middle, style='FlatFrame', borderwidth = 5)
		rbframe.pack(side = LEFT)
		self.var_reference = StringVar(self.master)
		if self.is_before:
			self.var_reference.set('before')
		else:
			self.var_reference.set('after')			
		radio = UpdatedRadiobutton(rbframe, value = 'before', text = _("Before")+" ", variable = self.var_reference)
		radio.pack(side=TOP, anchor=W)
		radio = UpdatedRadiobutton(rbframe, value = 'after', text = _("After")+" ", variable = self.var_reference)
		radio.pack(side=TOP, anchor=W)	
		
		label = TLabel(middle, text = " "+_("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)
コード例 #14
0
class PluginBrowser(PluginPanel):

    name = 'PluginBrowser'
    title = _("Plugin Browser")
    icon = 'strip_pbrowser'

    built = 0
    fill = BOTH
    expand = 1

    def init(self, master):
        PluginPanel.init(self, master)
        top = self.panel
        ctheme = app.uimanager.currentColorTheme

        self.browserframe = TFrame(top, style='RoundedFrame', borderwidth=5)
        self.browserframe.pack(side=TOP, fill=BOTH, expand=1)
        self.scanvas = ScrolledCanvas(self.browserframe,
                                      bg=ctheme.editfieldbackground,
                                      height=150,
                                      width=170)
        self.scanvas.frame.pack(side=TOP, fill=BOTH, expand=1)
        self.after_idle(self.rebuild_pb)

    def rebuild_pb(self):
        self.build_plugins_tree()
        ctheme = app.uimanager.currentColorTheme
        item = PluginsTreeItem(self.ptree, self.pcontainer)
        node = TreeNode(self.scanvas.canvas, None, item, ctheme)
        node.expand()

    def build_plugins_tree(self):
        self.ptree = PluginCategory('ROOT', _("Plugins"))
        objprop_group = PluginCategory('ObjProp', _("Object properties"))
        layout_group = PluginCategory('Layout', _("Layout"))
        transform_group = PluginCategory('Transform', _("Transformation"))
        shaping_group = PluginCategory('Shaping', _("Shaping"))
        effects_group = PluginCategory('Effects', _("Effects"))
        extentions_group = PluginCategory('Extentions', _("Extensions"))

        objprop_group.contents = app.objprop_plugins
        layout_group.contents = app.layout_plugins
        transform_group.contents = app.transform_plugins
        shaping_group.contents = app.shaping_plugins
        effects_group.contents = app.effects_plugins
        extentions_group.contents = app.extentions_plugins

        self.ptree.contents += [
            objprop_group, layout_group, transform_group, shaping_group,
            effects_group, extentions_group
        ]
コード例 #15
0
ファイル: sketchdlg.py プロジェクト: kindlychung/sk1
	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)
コード例 #16
0
    def __init__(self, parent, callback, color=None, **kw):
        TFrame.__init__(self, parent, style='FlatFrame', **kw)

        frame = TFrame(self, style="RoundedFrame", borderwidth=5)
        frame.pack(side=LEFT)
        self.viewxy = ChooseRGBXY(frame, callback, xyramp_size[0],
                                  xyramp_size[1], 0, 1)
        self.viewxy.pack(side=LEFT)

        frame = TFrame(self, style="RoundedFrame", borderwidth=5)
        frame.pack(side=LEFT)
        self.viewz = ChooseRGBZ(frame, callback, zramp_size[0], zramp_size[1],
                                2)
        self.viewz.pack(side=LEFT)
コード例 #17
0
ファイル: progressdialog.py プロジェクト: kindlychung/sk1
	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)
コード例 #18
0
ファイル: pbrowser.py プロジェクト: kindlychung/sk1
class PluginBrowser(PluginPanel):

	name = 'PluginBrowser'
	title = _("Plugin Browser")
	icon = 'strip_pbrowser'

	built = 0
	fill = BOTH
	expand = 1

	def init(self, master):
		PluginPanel.init(self, master)
		top = self.panel
		ctheme = app.uimanager.currentColorTheme

		self.browserframe = TFrame(top, style='RoundedFrame', borderwidth=5)
		self.browserframe.pack(side=TOP, fill=BOTH, expand=1)
		self.scanvas = ScrolledCanvas(self.browserframe, bg=ctheme.editfieldbackground, height=150, width=170)
		self.scanvas.frame.pack(side=TOP, fill=BOTH, expand=1)
		self.after_idle(self.rebuild_pb)


	def rebuild_pb(self):
		self.build_plugins_tree()
		ctheme = app.uimanager.currentColorTheme
		item = PluginsTreeItem(self.ptree, self.pcontainer)
		node = TreeNode(self.scanvas.canvas, None, item, ctheme)
		node.expand()

	def build_plugins_tree(self):
		self.ptree = PluginCategory('ROOT', _("Plugins"))
		objprop_group = PluginCategory('ObjProp', _("Object properties"))
		layout_group = PluginCategory('Layout', _("Layout"))
		transform_group = PluginCategory('Transform', _("Transformation"))
		shaping_group = PluginCategory('Shaping', _("Shaping"))
		effects_group = PluginCategory('Effects', _("Effects"))
		extentions_group = PluginCategory('Extentions', _("Extensions"))

		objprop_group.contents = app.objprop_plugins
		layout_group.contents = app.layout_plugins
		transform_group.contents = app.transform_plugins
		shaping_group.contents = app.shaping_plugins
		effects_group.contents = app.effects_plugins
		extentions_group.contents = app.extentions_plugins

		self.ptree.contents += [objprop_group, layout_group, transform_group,
							shaping_group, effects_group, extentions_group]
コード例 #19
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()
コード例 #20
0
ファイル: fill_plugin.py プロジェクト: kindlychung/sk1
	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()
コード例 #21
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()
コード例 #22
0
    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)
コード例 #23
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)
コード例 #24
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()
コード例 #25
0
ファイル: outline.py プロジェクト: sanyaade-multimedia/sk1-tk
    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()
コード例 #26
0
ファイル: trim.py プロジェクト: sanyaade-multimedia/sk1-tk
	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()
コード例 #27
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)
コード例 #28
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()
コード例 #29
0
ファイル: gotopagedlg.py プロジェクト: kindlychung/sk1
	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)
コード例 #30
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)
コード例 #31
0
ファイル: aboutdlg.py プロジェクト: kindlychung/sk1
	def build_tab_about(self):
		panel = TFrame(self.root, style='FlatFrame', borderwidth=10)
		self.nb.add(panel, text=_('About application'))

		subpanel = TFrame(panel, style='FlatFrame', borderwidth=0)
		subpanel.pack(side=TOP, fill=Y, expand=1)

		subpanel = TFrame(subpanel, style='FlatFrame', borderwidth=5)
		subpanel.pack(side=LEFT, anchor='center')

		text = TLabel(subpanel, style='FlatLabel',
				text=_("Illustration program for prepress"))
		text.pack(side=TOP, anchor=W, pady=10)

		from time import gmtime, strftime
		year = strftime("%Y", gmtime())

		text = TLabel(subpanel, style='FlatLabel', text="(c)2003-%s sK1 Team" % (year))
		text.pack(side=TOP, anchor=W, pady=10)

		text = TLabel(subpanel, style='FlatLabel', text='http://sk1project.org',
				foreground='blue', underline=20, cursor='hand2')
		text.pack(side=TOP, anchor=W)
		text.bind('<Button-1>', self.goToSite)
コード例 #32
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)
コード例 #33
0
	def __init__(self, parent, anchor='C', command = None, **kw):
		TFrame.__init__(self, parent, style='FlatFrame', **kw)
		self.command = command
		self.anchor = anchor
		#---------------------------------------------------------
		# Basepoint check
		# NW -- N -- NE
		# |     |     |
		# W  -- C --  E
		# |     |     |
		# SW -- S -- SE
		#
		# USER - basepoint
		
		frame=TFrame(self, style='FlatFrame')
		frame.pack(side = TOP, fill = BOTH)
		
		radio = UpdatedRadiobutton(frame, value = 'NW',variable = self.anchor, command = self.command)
		radio.pack(side=LEFT, anchor=W)
		radio = UpdatedRadiobutton(frame, value = 'N', variable = self.anchor, command = self.command)
		radio.pack(side=LEFT, anchor=W)
		radio = UpdatedRadiobutton(frame, value = 'NE', variable = self.anchor, command = self.command)
		radio.pack(side=LEFT, anchor=W)
		
		frame=TFrame(self, style='FlatFrame')
		frame.pack(side = TOP, fill = BOTH)
		
		radio = UpdatedRadiobutton(frame, value = 'W', variable = self.anchor, command = self.command)
		radio.pack(side=LEFT, anchor=W)
		radio = UpdatedRadiobutton(frame, value = 'C', variable = self.anchor, command = self.command)
		radio.pack(side=LEFT, anchor=W)
		radio = UpdatedRadiobutton(frame, value = 'E', variable = self.anchor, command = self.command)
		radio.pack(side=LEFT, anchor=W)
		
		frame=TFrame(self, style='FlatFrame')
		frame.pack(side = TOP, fill = BOTH)
		
		radio = UpdatedRadiobutton(frame, value = 'SW', variable = self.anchor, command = self.command)
		radio.pack(side=LEFT, anchor=W)
		radio = UpdatedRadiobutton(frame, value = 'S',  variable = self.anchor, command = self.command)
		radio.pack(side=LEFT, anchor=W)
		radio = UpdatedRadiobutton(frame, value = 'SE', variable = self.anchor, command = self.command)
		radio.pack(side=LEFT, anchor=W)
コード例 #34
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)
コード例 #35
0
class AlignPlugin(PluginPanel):

    name = 'Alignment'
    title = _("Alignment")

    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 subscribe_receivers(self):
        self.document.Subscribe(SELECTION, self.Update)

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

    def init_from_doc(self):
        self.Update()
        self.issue(SELECTION)

    def Update(self, *arg):
        reference = self.var_reference.get()
        if self.is_selection(reference):
            state = NORMAL
        else:
            state = DISABLED
        self.button_apply['state'] = state

    def apply_button_show(self, state):
        if not state:
            self.button_apply.pack_forget()
        else:
            self.button_apply.pack(side=BOTTOM, expand=1, fill=X, pady=3)

    def make_cs_list(self):
        cs = ()
        cs += (SELECT, LOWERMOST, PAGE)
        return cs

    def set_cs(self):
        self.Update()

    def is_selection(self, reference=SELECT):
        if not self.var_auto_apply.get(
        ) and self.value_x == 0 and self.value_y == 0:
            return 0
        if reference == PAGE:
            return (len(self.document.selection) > 0)
        else:
            return (len(self.document.selection) > 1)

    def apply_x(self):
        x = self.var_x.get()
        if self.var_auto_apply.get():
            self.reset()
            self.apply(x=x)
        else:
            if self.value_x == x:
                self.var_x.set(0)
                self.value_x = 0
            else:
                self.value_x = x
            self.Update()

    def apply_y(self):
        y = self.var_y.get()
        if self.var_auto_apply.get():
            self.reset()
            self.apply(y=y)
        else:
            if self.value_y == y:
                self.var_y.set(0)
                self.value_y = 0
            else:
                self.value_y = y
            self.Update()

    def apply(self, x=None, y=None, reference=None):
        reference = self.var_reference.get()
        if not self.is_selection(reference):
            return

        if x is None:
            x = self.var_x.get()

        if y is None:
            y = self.var_y.get()

        if reference is None:
            reference = self.var_reference.get()

        reference = self.reference_command(reference)

        self.document.AlignSelection(x, y, reference=reference)

    def reference_command(self, reference):
        if reference == SELECT:
            return 'selection'
        if reference == LOWERMOST:
            return 'lowermost'
        if reference == PAGE:
            return 'page'

    def reset(self):
        self.var_x.set(0)
        self.value_x = 0
        self.var_y.set(0)
        self.value_y = 0
        ##		self.apply_button_show(not self.var_auto_apply.get())
        self.Update()
コード例 #36
0
    def init(self, master):
        PluginPanel.init(self, master)

        self.width_priority = 1

        root = self.mw.root

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        self.init_from_doc()
        self.subscribe_receivers()
コード例 #37
0
    def init(self, master):
        PluginPanel.init(self, master)
        root = self.mw.root
        self.var_reference = StringVar(root)
        self.var_reference.set(SELECT)

        #---------------------------------------------------------
        top = TFrame(self.panel, style='FlatFrame')
        top.pack(side=TOP, fill=BOTH)
        #---------------------------------------------------------
        label = TLabel(top,
                       text=" " + _("Relative to") + " ",
                       style="FlatLabel")
        label.pack(side=TOP, fill=BOTH, padx=5)
        rel_frame = TLabelframe(top,
                                labelwidget=label,
                                style='Labelframe',
                                borderwidth=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()
コード例 #38
0
    def init(self, master):
        PluginPanel.init(self, master)
        top = self.panel

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        parametersFrame.pack(side=TOP, fill=X, pady=2)
コード例 #39
0
ファイル: colordigitizer.py プロジェクト: kindlychung/sk1
	def __init__(self, parent, callback, **kw):
		self.callback = callback
		TFrame.__init__(self, parent, style='FlatFrame', **kw)
		self.C_value = DoubleVar(0)
		self.M_value = DoubleVar(0)
		self.Y_value = DoubleVar(0)
		self.K_value = DoubleVar(0)
		self.A_value = DoubleVar(0)
		
		b = TLabel(self, style='HLine')
		b.pack(side=BOTTOM, fill=X)
		
		frame = TFrame(self, borderwidth=0, style='FlatFrame')
		frame.pack(side=BOTTOM)
		label = TLabel(frame, text=_("Opacity: "))
		label.pack(side=LEFT)
		self.A_spin = TSpinbox(frame, min=0, max=255, step=1, vartype=0, width=7,
							textvariable=self.A_value, command=self.cmyk_component_changed)
		self.A_spin.pack(side=RIGHT)
		
		b = TLabel(self, style='HLine')
		b.pack(side=BOTTOM, fill=X)
		
		cmyk_frame = TFrame(self, borderwidth=2, style='FlatFrame')
		cmyk_frame.pack(side=LEFT, padx=10)
		
		frame = TFrame(cmyk_frame, borderwidth=2, style='FlatFrame')
		frame.pack(side=TOP)
		label = TLabel(frame, text="C: ")
		label.pack(side=LEFT)
		self.C_spin = TSpinbox(frame, min=0, max=100, step=1, vartype=1, width=7,
							textvariable=self.C_value, command=self.cmyk_component_changed)
		self.C_spin.pack(side=RIGHT)

		frame = TFrame(cmyk_frame, borderwidth=2, style='FlatFrame')
		frame.pack(side=TOP)
		label = TLabel(frame, text="M: ")
		label.pack(side=LEFT)
		self.M_spin = TSpinbox(frame, min=0, max=100, step=1, vartype=1, width=7,
							textvariable=self.M_value, command=self.cmyk_component_changed)
		self.M_spin.pack(side=RIGHT)

		frame = TFrame(cmyk_frame, borderwidth=2, style='FlatFrame')
		frame.pack(side=TOP)
		label = TLabel(frame, text="Y: ")
		label.pack(side=LEFT)
		self.Y_spin = TSpinbox(frame, min=0, max=100, step=1, vartype=1, width=7,
							textvariable=self.Y_value, command=self.cmyk_component_changed)
		self.Y_spin.pack(side=RIGHT)		

		frame = TFrame(cmyk_frame, borderwidth=2, style='FlatFrame')
		frame.pack(side=TOP)
		label = TLabel(frame, text="K: ")
		label.pack(side=LEFT)
		self.K_spin = TSpinbox(frame, min=0, max=100, step=1, vartype=1, width=7,
							textvariable=self.K_value, command=self.cmyk_component_changed)
		self.K_spin.pack(side=RIGHT)
		
		rgb_frame = TFrame(self, borderwidth=2, style='FlatFrame')
		rgb_frame.pack(side=LEFT)
		
		self.RGB_label = TLabel(rgb_frame, text='R:\nG:\nB:', justify=LEFT)
		self.RGB_label.pack(side=LEFT)		
コード例 #40
0
    def __init__(self, parent, callback, **kw):
        self.callback = callback
        TFrame.__init__(self, parent, style='FlatFrame', **kw)
        self.C_value = DoubleVar(0)
        self.M_value = DoubleVar(0)
        self.Y_value = DoubleVar(0)
        self.K_value = DoubleVar(0)
        self.A_value = DoubleVar(0)

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

        frame = TFrame(self, borderwidth=0, style='FlatFrame')
        frame.pack(side=BOTTOM)
        label = TLabel(frame, text=_("Opacity: "))
        label.pack(side=LEFT)
        self.A_spin = TSpinbox(frame,
                               min=0,
                               max=255,
                               step=1,
                               vartype=0,
                               width=7,
                               textvariable=self.A_value,
                               command=self.cmyk_component_changed)
        self.A_spin.pack(side=RIGHT)

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

        cmyk_frame = TFrame(self, borderwidth=2, style='FlatFrame')
        cmyk_frame.pack(side=LEFT, padx=10)

        frame = TFrame(cmyk_frame, borderwidth=2, style='FlatFrame')
        frame.pack(side=TOP)
        label = TLabel(frame, text="C: ")
        label.pack(side=LEFT)
        self.C_spin = TSpinbox(frame,
                               min=0,
                               max=100,
                               step=1,
                               vartype=1,
                               width=7,
                               textvariable=self.C_value,
                               command=self.cmyk_component_changed)
        self.C_spin.pack(side=RIGHT)

        frame = TFrame(cmyk_frame, borderwidth=2, style='FlatFrame')
        frame.pack(side=TOP)
        label = TLabel(frame, text="M: ")
        label.pack(side=LEFT)
        self.M_spin = TSpinbox(frame,
                               min=0,
                               max=100,
                               step=1,
                               vartype=1,
                               width=7,
                               textvariable=self.M_value,
                               command=self.cmyk_component_changed)
        self.M_spin.pack(side=RIGHT)

        frame = TFrame(cmyk_frame, borderwidth=2, style='FlatFrame')
        frame.pack(side=TOP)
        label = TLabel(frame, text="Y: ")
        label.pack(side=LEFT)
        self.Y_spin = TSpinbox(frame,
                               min=0,
                               max=100,
                               step=1,
                               vartype=1,
                               width=7,
                               textvariable=self.Y_value,
                               command=self.cmyk_component_changed)
        self.Y_spin.pack(side=RIGHT)

        frame = TFrame(cmyk_frame, borderwidth=2, style='FlatFrame')
        frame.pack(side=TOP)
        label = TLabel(frame, text="K: ")
        label.pack(side=LEFT)
        self.K_spin = TSpinbox(frame,
                               min=0,
                               max=100,
                               step=1,
                               vartype=1,
                               width=7,
                               textvariable=self.K_value,
                               command=self.cmyk_component_changed)
        self.K_spin.pack(side=RIGHT)

        rgb_frame = TFrame(self, borderwidth=2, style='FlatFrame')
        rgb_frame.pack(side=LEFT)

        self.RGB_label = TLabel(rgb_frame, text='R:\nG:\nB:', justify=LEFT)
        self.RGB_label.pack(side=LEFT)
コード例 #41
0
ファイル: skew_plugin.py プロジェクト: sk1project/sk1-tk
    def init(self, master):
        PluginPanel.init(self, master)

        self.width_priority = 1

        root = self.mw.root

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        self.init_from_doc()
        self.subscribe_receivers()
コード例 #42
0
    def build_dlg(self):
        self.root = TFrame(self.top, style='FlatFrame', borderwidth=10)
        self.root.pack(side=TOP, fill=BOTH, expand=1)

        ##### top panel #########################RoundedFrame

        toppanel = TFrame(self.root, style='FlatFrame')
        toppanel.pack(side=TOP, fill=BOTH, expand=1)

        rpanel = ResizableTFrame(toppanel, self.top, size=220, orient=RIGHT)
        rpanel.pack(side=LEFT, fill=Y)

        panel = TFrame(rpanel.panel, style='RoundedFrame', borderwidth=5)
        panel.pack(side=LEFT, fill=BOTH, expand=1)

        ctheme = app.uimanager.currentColorTheme

        self.scanvas = ScrolledCanvas(panel,
                                      bg=ctheme.editfieldbackground,
                                      height=420,
                                      width=200)
        self.scanvas.frame.pack(side=LEFT, fill=BOTH, expand=1)

        self.plugpanel = TFrame(toppanel, style='FlatFrame')
        self.plugpanel.pack(side=RIGHT, fill=BOTH, expand=1)

        #		lab=TLabel(self.plugpanel, style='FlatLabel', text='Test label')
        #		lab.pack(side = LEFT)

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

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

        ##### bottom panel #########################

        botpanel = TFrame(self.root, style='FlatFrame')
        botpanel.pack(side=BOTTOM, fill=X, expand=0)

        cancel_bt = TButton(botpanel, text=_("Cancel"), command=self.cancel)
        cancel_bt.pack(side=RIGHT)

        apply_bt = TButton(botpanel, text=_("Apply"), command=self.do_apply)
        apply_bt.pack(side=RIGHT, padx=10)

        ok_bt = TButton(botpanel, text=_("OK"), command=self.ok)
        ok_bt.pack(side=RIGHT)

        help_bt = TButton(botpanel, text=_("Help"), state='disabled')
        help_bt.pack(side=LEFT)

        rdefs_bt = TButton(botpanel,
                           text=_("Restore Defaults"),
                           command=self.do_restore)
        rdefs_bt.pack(side=LEFT, padx=10)

        self.focus_widget = cancel_bt

        self.top.bind('<Escape>', self.cancel)
        self.top.protocol('WM_DELETE_WINDOW', self.cancel)
        self.width = 700
        self.height = 500
        self.build_plugins_tree()

        item = PluginsTreeItem(self.root_cat, self)
        node = TreeNode(self.scanvas.canvas, None, item, ctheme, 26)
        node.expand()
        self.loadByName('general')
コード例 #43
0
class TSpinbox(TFrame):
    def __init__(self,
                 master=None,
                 min=0,
                 max=100,
                 step=1,
                 textvariable=None,
                 var=0,
                 vartype=0,
                 command=None,
                 state=NORMAL,
                 width=5,
                 args=(),
                 **kw):
        '''vartype=0 - integer   vartype=1 - float '''
        self.min_value = min
        self.max_value = max
        self.step = step
        self.variable = var
        self.vartype = vartype
        if textvariable:
            self.text_var = textvariable
        else:
            self.text_var = StringVar()
        self.command = command
        self.state = state
        self.width = width
        apply(TFrame.__init__, (self, master), kw)
        self["style"] = "FlatFrame"
        self.entry = TEntryExt(self,
                               textvariable=self.text_var,
                               width=self.width,
                               style='SpinEntry')
        self.entry.pack(side=LEFT, expand=1, fill=BOTH)
        self.button_frame = TFrame(self, style="FlatFrame")
        self.button_frame.pack(side=LEFT, fill=Y)
        self.up_button = TButton(self.button_frame,
                                 class_='Repeater',
                                 command=self.increase,
                                 image='pal_arrow_up',
                                 style='SpinUpButton',
                                 takefocus=0)
        self.up_button.pack(side=TOP)
        self.down_button = TButton(self.button_frame,
                                   class_='Repeater',
                                   command=self.decrease,
                                   image='pal_arrow_down',
                                   style='SpinDownButton',
                                   takefocus=0)
        self.down_button.pack(side=TOP)
        if self.vartype == 1:
            self.variable = float(self.variable)
        else:
            self.variable = int(self.variable)
        self.text_var.set(str(self.variable))
        self.entry.bind('<Button-4>', self.wheel_increase)
        self.entry.bind('<Button-5>', self.wheel_decrease)
        self.entry.bind('<Key-Up>', self.wheel_increase)
        self.entry.bind('<Key-Down>', self.wheel_decrease)
        self.entry.bind('<Key-Return>', self.apply_command)
        self.entry.bind('<Key-KP_Enter>', self.apply_command)
        #self.entry.bind ( '<KeyPress>', self.check_input)

    def check_input(self, event):
        event = None

    def apply_command(self, *args):
        if self.state == NORMAL:
            text = self.entry.get()
            text = text.replace(',', '.')
            text = text.replace('/', '*1./')
            if text and not expression.search(text):
                try:
                    variable = eval(text)
                except:
                    pass
                else:
                    self.set_value(variable)
                    self.command(*args)

    def set_state(self, state):
        self.state = state
        self.entry.configure(state=state)
        self.up_button.configure(state=state)
        self.down_button.configure(state=state)

    def get_state(self):
        return self.state

    def wheel_increase(self, event):
        self.increase()

    def wheel_decrease(self, event):
        self.decrease()

    def increase(self):
        if self.state == NORMAL:
            try:
                self.variable = float(self.text_var.get())
            except:
                self.text_var.set('0')
                self.variable = float(self.text_var.get())
            self.variable = self.variable + self.step

            self.set_value(self.variable)

    def decrease(self):
        if self.state == NORMAL:
            try:
                self.variable = float(self.text_var.get())
            except:
                self.text_var.set('0')
                self.variable = float(self.text_var.get())
            self.variable = self.variable - self.step

            self.set_value(self.variable)

    def set_value(self, value=0):
        try:
            value = float(value)
        except:
            value = 0
        value = min(self.max_value, value)
        value = max(self.min_value, value)
        if self.vartype == 1:
            self.variable = float(value)
        else:
            self.variable = int(round(value))
        self.text_var.set(str(self.variable))

    def get_value(self):
        try:
            self.variable = float(self.text_var.get())
        except:
            self.text_var.set('0')
            self.variable = float(self.text_var.get())
        if self.vartype == 1:
            self.variable = float(self.variable)
        else:
            self.variable = int(round(self.variable))
        return self.variable

    def destroy(self):
        self.entry.unbind_all(self.entry)
        self.entry.destroy()
        self.button_frame.destroy()
        self.up_button.destroy()
        self.down_button.destroy()
        self.command = self.args = None
        TFrame.destroy(self)
コード例 #44
0
    def __init__(self, parent, callback, **kw):
        self.callback = callback
        TFrame.__init__(self, parent, style='FlatFrame', **kw)
        self.R_value = IntVar(0)
        self.G_value = IntVar(0)
        self.B_value = IntVar(0)
        self.A_value = IntVar(0)

        self.HTML_value = StringVar('')

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

        frame = TFrame(self, borderwidth=0, style='FlatFrame')
        frame.pack(side=BOTTOM)
        label = TLabel(frame, text=_("Alpha channel: "))
        label.pack(side=LEFT)
        self.A_spin = TSpinbox(frame,
                               min=0,
                               max=255,
                               step=1,
                               vartype=0,
                               width=7,
                               textvariable=self.A_value,
                               command=self.rgb_component_changed)
        self.A_spin.pack(side=RIGHT)

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

        html_frame = TFrame(self, borderwidth=2, style='FlatFrame')
        html_frame.pack(side=BOTTOM)

        self.HTML_entry = TEntrybox(html_frame,
                                    text='#000000',
                                    width=10,
                                    textvariable=self.HTML_value,
                                    command=self.html_component_changed)
        self.HTML_entry.pack(side=RIGHT)

        label = TLabel(html_frame, text="HTML: ")
        label.pack(side=RIGHT)

        rgb_frame = TFrame(self, borderwidth=2, style='FlatFrame')
        rgb_frame.pack(side=LEFT, padx=10)

        frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame')
        frame.pack(side=TOP)
        label = TLabel(frame, text="R: ")
        label.pack(side=LEFT)
        self.R_spin = TSpinbox(frame,
                               min=0,
                               max=255,
                               step=1,
                               vartype=0,
                               width=7,
                               textvariable=self.R_value,
                               command=self.rgb_component_changed)
        self.R_spin.pack(side=RIGHT)

        frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame')
        frame.pack(side=TOP)
        label = TLabel(frame, text="G: ")
        label.pack(side=LEFT)
        self.G_spin = TSpinbox(frame,
                               min=0,
                               max=255,
                               step=1,
                               vartype=0,
                               width=7,
                               textvariable=self.G_value,
                               command=self.rgb_component_changed)
        self.G_spin.pack(side=RIGHT)

        frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame')
        frame.pack(side=TOP)
        label = TLabel(frame, text="B: ")
        label.pack(side=LEFT)
        self.B_spin = TSpinbox(frame,
                               min=0,
                               max=255,
                               step=1,
                               vartype=0,
                               width=7,
                               textvariable=self.B_value,
                               command=self.rgb_component_changed)
        self.B_spin.pack(side=RIGHT)

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

        self.CMYK_label = TLabel(cmyk_frame,
                                 text='C:\nM:\nY:\nK:',
                                 justify=LEFT)
        self.CMYK_label.pack(side=LEFT)
コード例 #45
0
class ResizableTFrame(TFrame):
    def __init__(self,
                 parent,
                 toplevel,
                 size=300,
                 orient=LEFT,
                 min=200,
                 max=500,
                 cnf={},
                 **kw):
        TFrame.__init__(self, parent, style='FlatFrame', **kw)
        self.parent = parent
        self.panel = TFrame(self, style='FlatFrame')
        self.orient = orient
        self.min = min
        self.max = max
        self.size = size
        self.toplevel = toplevel
        self.canv_size = 0
        self.counter = 0

        if orient in [LEFT, RIGHT]:
            self.spacer = Frame(self, width=size, height=1)
            self.grip = TButton(self,
                                style='VGrip',
                                cursor=appconst.CurHResize)
            if orient == LEFT:
                self.spacer.pack(side=TOP)
                self.grip.pack(side=LEFT, fill=Y)
                self.panel.pack(side=RIGHT, fill=BOTH, expand=1)
            else:
                self.spacer.pack(side=TOP)
                self.grip.pack(side=RIGHT, fill=Y)
                self.panel.pack(side=LEFT, fill=BOTH, expand=1)
        else:
            self.spacer = Frame(self, width=1, height=size)
            self.grip = TButton(self,
                                style='HGrip',
                                cursor=appconst.CurVResize)
            if orient == BOTTOM:
                self.grip.pack(side=BOTTOM, fill=X)
                self.spacer.pack(side=RIGHT)
                self.panel.pack(side=LEFT, fill=BOTH, expand=1)
            else:
                self.grip.pack(side=TOP, fill=X)
                self.spacer.pack(side=RIGHT)
                self.panel.pack(side=LEFT, fill=BOTH, expand=1)

        self.grip.bind("<Button-1>", self.start)
        self.grip.bind("<ButtonRelease-1>", self.stop)

    def start(self, *args):
        self.toplevel.bind("<Motion>", self.resize)

    def stop(self, *args):
        self.toplevel.unbind("<Motion>")

    def resize(self, args):
        self.counter += 1
        if self.counter < 5:
            return
        self.counter = 0

        if self.orient in [LEFT, RIGHT]:
            self.canv_size = args.x
        else:
            self.canv_size = args.y

        if self.orient in [LEFT, RIGHT]:
            cw = string.atoi(self.spacer['width'])
            if self.orient == LEFT:
                cw -= self.canv_size
            else:
                cw += self.canv_size
            if cw < self.min: cw = self.min
            if cw > self.max: cw = self.max
            self.spacer['width'] = cw
        else:
            cw = string.atoi(self.spacer['height'])
            if self.orient == TOP:
                cw -= self.canv_size
            else:
                cw += self.canv_size
            if cw < self.min: cw = self.min
            if cw > self.max: cw = self.max
            self.spacer['height'] = cw
コード例 #46
0
ファイル: pager.py プロジェクト: kindlychung/sk1
class Pager(TFrame, Publisher):
	
	hidden=1
	
	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)
				
	def stub(self):
		pass
	
	def doc_paged(self):		
		current_page=self.mainwindow.document.active_page+1
		num_pages=len(self.mainwindow.document.pages)
		if self.hidden and num_pages>1:
			self.container.pack(side=LEFT, fill=Y)
			self.hidden=0
		if not self.hidden and num_pages==1:
			self.container.forget()
			self.hidden=1		
		self.text['text']=' '+_('Page %u of %u')%(current_page,num_pages)+' '
		
	def Resubscribe(self, *arg):
		self.mainwindow.document.Subscribe(PAGE, self.doc_paged)
		self.doc_paged()
		
	def PageHome(self):
		self.mainwindow.document.GoToPage(0)
		self.mainwindow.document.SelectNone()
		self.mainwindow.canvas.ForceRedraw()
	
	def PageEnd(self):
		self.mainwindow.document.GoToPage(len(self.mainwindow.document.pages)-1)
		self.mainwindow.document.SelectNone()
		self.mainwindow.canvas.ForceRedraw()
				
	def PagePrevious(self):
		self.mainwindow.PreviousPage()
		
	def PageNext(self):
		self.mainwindow.NextPage()	
		
	def GoToPage(self, *args):
		self.mainwindow.GotoPage()
コード例 #47
0
ファイル: styledlg.py プロジェクト: kindlychung/sk1
	def build_dlg(self):
		root = self.top

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

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

		button = UpdatedButton(top, text=_("Apply style"), command=self.apply_style, sensitivecb=self.can_apply, width=15)
		button.pack(side=BOTTOM, expand=0)
		self.Subscribe(SELECTION, button.Update)

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

		button = UpdatedButton(top, text=_("Delete style"), command=self.remove_style, sensitivecb=self.can_remove, width=15)
		button.pack(side=BOTTOM, expand=0)

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

		button = UpdatedButton(top, text=_("Create new style"), command=self.CreateStyleFromSelection,
							sensitivecb=self.main_window.document.CanCreateStyle, width=15)
		button.pack(side=BOTTOM, expand=0)
		self.Subscribe(SELECTION, button.Update)

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

		list_frame = TFrame(top, style="RoundedFrame", borderwidth=5)
		list_frame.pack(side=TOP, expand=1, fill=BOTH)

		sb_vert = TScrollbar(list_frame, takefocus=0)
		sb_vert.pack(side=RIGHT, fill=Y)

		styles = UpdatedListbox(list_frame, bg='white', borderwidth=0, selectborderwidth=0)
		styles.pack(expand=1, fill=BOTH)
		styles.Subscribe(COMMAND, self.apply_style)

		sb_vert['command'] = (styles, 'yview')
		styles['yscrollcommand'] = (sb_vert, 'set')
		self.styles = styles
		root.resizable(width=0, height=0)
コード例 #48
0
ファイル: rotate_plugin.py プロジェクト: sk1project/sk1-tk
    def init(self, master):
        PluginPanel.init(self, master)

        root = self.mw.root

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

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

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

        self.cnt_x_absolute = None
        self.cnt_y_absolute = None

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        self.init_from_doc()
        self.subscribe_receivers()
コード例 #49
0
ファイル: distribute_plugin.py プロジェクト: kindlychung/sk1
class DistributePlugin(PluginPanel):
	
	name='Distribute'
	title = _("Distribution")
	
	def init(self, master):
		PluginPanel.init(self, master)
		root=self.mw.root
		self.var_reference = StringVar(root)
		self.var_reference.set(SELECT)
		
		#---------------------------------------------------------
		top = TFrame(self.panel, style='FlatFrame')
		top.pack(side = TOP, fill=BOTH)
		#---------------------------------------------------------
		label=TLabel(top, text=" "+_("Relative to")+" ", style="FlatLabel")
		label.pack(side = TOP, fill = BOTH, padx=5)
		rel_frame=TLabelframe(top, labelwidget=label, style='Labelframe', borderwidth=4)
		rel_frame.pack(side = TOP, fill=X, padx=5, pady=2)
		button_frame=TFrame(rel_frame, style='FlatFrame')
		button_frame.pack(side = TOP, fill = BOTH, padx=5)
		
		self.reference = TCombobox(button_frame, state='readonly', values=self.make_cs_list(), style='ComboNormal',width=14,
									 textvariable=self.var_reference, postcommand = self.set_cs)
		self.reference.pack(side = TOP)
		#---------------------------------------------------------
		label=TLabel(top, text=" "+_("Distribute type")+" ", style="FlatLabel")
		label.pack(side = TOP, fill = BOTH, padx=5)
		framec=TLabelframe(top, labelwidget=label, style='Labelframe', borderwidth=3)
		framec.pack(side = TOP, fill=X, padx=5, pady=2)
		
		
		framex = TFrame(framec, style='FlatFrame')
		framex.pack(side = TOP, expand = 0, padx = 5, pady = 5)
		
		framey = TFrame(framec, style='FlatFrame')
		framey.pack(side = TOP, expand = 0, padx = 5, pady = 5)


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

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

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

		self.init_from_doc()
		self.subscribe_receivers()


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

	def subscribe_receivers(self):
		self.document.Subscribe(SELECTION, self.Update)

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

	def init_from_doc(self):
		self.Update()

	def Update(self, *arg):
		reference = self.var_reference.get()
		if self.is_selection(reference):
			state=NORMAL
		else:
			state=DISABLED
		self.button_apply['state']=state

	def apply_button_show(self, state):
		if not state:
			self.button_apply.pack_forget()
		else:
			self.button_apply.pack(side = BOTTOM, expand = 1, fill = X, pady=3)

	def make_cs_list(self):
		cs=()
		cs+=(SELECT,PAGE,EDGE)
		return cs

	def set_cs(self):
		self.Update()

	def is_selection(self, reference = SELECT):
		if not self.var_auto_apply.get() and self.value_x==0 and self.value_y==0:
			return 0
		if reference == SELECT:
			return (len(self.document.selection) > 2)
		else:
			return (len(self.document.selection) > 1)

	def HDistributeSelection(self, x, reference = SELECT):
		if self.is_selection(reference) and x:
			self.document.begin_transaction(TRANSACTION)
			try:
				try:
					add_undo = self.document.add_undo
					objects = self.document.selection.GetObjects()
					if reference == PAGE:
						brleft, brbottom, brright, brtop = self.document.PageRect()
					else:
						brleft,  brbottom, brright, brtop = self.document.selection.coord_rect
					
					posh = []
					total_width=0
					for obj in objects:
						rect = obj.coord_rect
						posh.append((rect.left, rect.right - rect.left, obj))
						total_width += rect.right - rect.left
					posh.sort()
					
					first_obj_left, first_obj_width, first_obj = posh[0]
					last_obj_left, last_obj_width, last_obj = posh[-1]
					
					# how much influence of the width. 1-no, 0-full
					part_obj_dict=[None, 1.0, 0.5, 1.0, 0]
					# influence the width last object
					first_obj_dict = [None, 0, first_obj_width*0.5, 0, first_obj_width]
					# influence the width last object
					last_obj_dict  = [None, last_obj_width, last_obj_width*0.5, 0, 0]
					# influence the width. 0-no , 1-yes
					width_obj_dict = [None, 0,0,1,0]
					
					brleft  += first_obj_dict[x]
					brright -= last_obj_dict[x]
					brwidth = (brright-brleft - total_width*width_obj_dict[x])
					if reference == EDGE:
						step = config.preferences.handle_jump
					else:
						step = brwidth / (len(posh)-1)
					part=part_obj_dict[x]
					next = 0
					for left, width, obj in posh[0:]:
						off = Point(next - left +brleft - width + width*part, 0)
						self.document.add_undo(obj.Translate(off))
						next += step+width*width_obj_dict[x]
					add_undo(self.document.queue_edited())
				except:
					self.document.abort_transaction()
			finally:
				self.document.end_transaction()



	def VDistributeSelection(self, y, reference = SELECT):
		if self.is_selection(reference) and y:
			self.document.begin_transaction(TRANSACTION)
			try:
				try:
					add_undo = self.document.add_undo
					objects = self.document.selection.GetObjects()
					if reference == PAGE:
						brleft, brbottom, brright, brtop = self.document.PageRect()
					else:
						brleft,  brbottom, brright, brtop = self.document.selection.coord_rect
					
					posv = []
					total_height=0
					for obj in objects:
						rect = obj.coord_rect
						posv.append((rect.top, rect.bottom - rect.top, obj))
						total_height += rect.bottom - rect.top
					posv.sort()
					posv.reverse()
					
					first_obj_top, first_obj_height, first_obj = posv[0]
					last_obj_top, last_obj_height, last_obj = posv[-1]
					
					# how much influence of the height. 1-no, 0-full
					part_obj_dict=[None, 1.0, 0.5, 1.0, 0]
					# influence the height last object
					first_obj_dict = [None, 0, first_obj_height*0.5, 0, first_obj_height]
					# influence the height last object
					last_obj_dict  = [None, last_obj_height, last_obj_height*0.5, 0, 0]
					# influence the height. 0-no , 1-yes
					height_obj_dict = [None, 0,0,1,0]
					
					brtop  += first_obj_dict[y]
					brbottom -= last_obj_dict[y]
					brwidth = (brbottom-brtop - total_height*height_obj_dict[y])
					if reference == EDGE:
						step = -1*config.preferences.handle_jump
					else:
						step = brwidth / (len(posv)-1)
					part=part_obj_dict[y]
					next = 0
					for top, height, obj in posv[0:]:
						off = Point(0, next - top +brtop - height + height*part)
						self.document.add_undo(obj.Translate(off))
						next += step+height*height_obj_dict[y]
					add_undo(self.document.queue_edited())
				except:
					self.document.abort_transaction()
			finally:
					self.document.end_transaction()

	def apply_x(self):
		x = self.var_x.get()
		reference = self.var_reference.get()
		if self.var_auto_apply.get():
			self.reset()
			self.HDistributeSelection(x, reference = reference)
		else:
			if self.value_x==x:
				self.var_x.set(0)
				self.value_x = 0
			else:
				self.value_x = x
			self.Update()

	def apply_y(self):
		y = self.var_y.get()
		reference = self.var_reference.get()
		if self.var_auto_apply.get():
			self.reset()
			self.VDistributeSelection(y, reference = reference)
		else:
			if self.value_y==y:
				self.var_y.set(0)
				self.value_y = 0
			else:
				self.value_y = y
			self.Update()

	def apply_distribute(self):
		if self.var_auto_apply.get():
			return
		self.document.begin_transaction(TRANSACTION)
		try:
			try:
				reference = self.var_reference.get()
				x = self.value_x
				y = self.value_y
				self.HDistributeSelection(x, reference = reference)
				self.VDistributeSelection(y, reference = reference)
			except:
				self.document.abort_transaction()
		finally:
					self.document.end_transaction()

	def reset(self):
		self.var_x.set(0)
		self.value_x = 0
		self.var_y.set(0)
		self.value_y = 0
##		self.apply_button_show(not self.var_auto_apply.get())
		self.Update()
コード例 #50
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()
コード例 #51
0
ファイル: distribute_plugin.py プロジェクト: kindlychung/sk1
	def init(self, master):
		PluginPanel.init(self, master)
		root=self.mw.root
		self.var_reference = StringVar(root)
		self.var_reference.set(SELECT)
		
		#---------------------------------------------------------
		top = TFrame(self.panel, style='FlatFrame')
		top.pack(side = TOP, fill=BOTH)
		#---------------------------------------------------------
		label=TLabel(top, text=" "+_("Relative to")+" ", style="FlatLabel")
		label.pack(side = TOP, fill = BOTH, padx=5)
		rel_frame=TLabelframe(top, labelwidget=label, style='Labelframe', borderwidth=4)
		rel_frame.pack(side = TOP, fill=X, padx=5, pady=2)
		button_frame=TFrame(rel_frame, style='FlatFrame')
		button_frame.pack(side = TOP, fill = BOTH, padx=5)
		
		self.reference = TCombobox(button_frame, state='readonly', values=self.make_cs_list(), style='ComboNormal',width=14,
									 textvariable=self.var_reference, postcommand = self.set_cs)
		self.reference.pack(side = TOP)
		#---------------------------------------------------------
		label=TLabel(top, text=" "+_("Distribute type")+" ", style="FlatLabel")
		label.pack(side = TOP, fill = BOTH, padx=5)
		framec=TLabelframe(top, labelwidget=label, style='Labelframe', borderwidth=3)
		framec.pack(side = TOP, fill=X, padx=5, pady=2)
		
		
		framex = TFrame(framec, style='FlatFrame')
		framex.pack(side = TOP, expand = 0, padx = 5, pady = 5)
		
		framey = TFrame(framec, style='FlatFrame')
		framey.pack(side = TOP, expand = 0, padx = 5, pady = 5)


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

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

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

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

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


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

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

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

		def CallBoth(arg, x = self.var_width, y = self.var_height):
			x.UpdateUnit(arg)
			y.UpdateUnit(arg)

		optmenu = create_unit_menu(size_frame, CallBoth, variable = var_width_unit, width = 3)
		optmenu.pack(side = RIGHT, padx = 5)

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

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

#---------------------------------------------------------------------------------------------------------------------
		button_frame = TFrame(top_root, borderwidth=1, style='FlatFrame')
		button_frame.pack(side = BOTTOM, fill = BOTH, pady=2)
		button = UpdatedButton(button_frame, text = _("Apply"), command = self.apply_settings, width=15)
		button.pack(side = BOTTOM)
		
		app.mw.docmanager.activedoc.Subscribe(LAYOUT, self.init_from_doc)
		app.mw.Subscribe(DOCUMENT, self.init_from_doc)
コード例 #53
0
ファイル: colordigitizer.py プロジェクト: kindlychung/sk1
	def __init__(self, parent, callback, **kw):
		self.callback = callback
		TFrame.__init__(self, parent, style='FlatFrame', **kw)
		self.R_value = IntVar(0)
		self.G_value = IntVar(0)
		self.B_value = IntVar(0)
		self.A_value = IntVar(0)
		
		self.HTML_value = StringVar('')
		
			
		b = TLabel(self, style='HLine')
		b.pack(side=BOTTOM, fill=X)	
		
		frame = TFrame(self, borderwidth=0, style='FlatFrame')
		frame.pack(side=BOTTOM)
		label = TLabel(frame, text=_("Alpha channel: "))
		label.pack(side=LEFT)
		self.A_spin = TSpinbox(frame, min=0, max=255, step=1, vartype=0, width=7,
							textvariable=self.A_value, command=self.rgb_component_changed)
		self.A_spin.pack(side=RIGHT)
		
		b = TLabel(self, style='HLine')
		b.pack(side=BOTTOM, fill=X)
		
		
		html_frame = TFrame(self, borderwidth=2, style='FlatFrame')
		html_frame.pack(side=BOTTOM)
		

		self.HTML_entry = TEntrybox(html_frame, text='#000000', width=10,
								textvariable=self.HTML_value, command=self.html_component_changed)
		self.HTML_entry.pack(side=RIGHT)
		
		label = TLabel(html_frame, text="HTML: ")
		label.pack(side=RIGHT)
		
		rgb_frame = TFrame(self, borderwidth=2, style='FlatFrame')
		rgb_frame.pack(side=LEFT, padx=10)
		
		frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame')
		frame.pack(side=TOP)
		label = TLabel(frame, text="R: ")
		label.pack(side=LEFT)
		self.R_spin = TSpinbox(frame, min=0, max=255, step=1, vartype=0, width=7,
							textvariable=self.R_value, command=self.rgb_component_changed)
		self.R_spin.pack(side=RIGHT)

		frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame')
		frame.pack(side=TOP)
		label = TLabel(frame, text="G: ")
		label.pack(side=LEFT)
		self.G_spin = TSpinbox(frame, min=0, max=255, step=1, vartype=0, width=7,
							textvariable=self.G_value, command=self.rgb_component_changed)
		self.G_spin.pack(side=RIGHT)

		frame = TFrame(rgb_frame, borderwidth=2, style='FlatFrame')
		frame.pack(side=TOP)
		label = TLabel(frame, text="B: ")
		label.pack(side=LEFT)
		self.B_spin = TSpinbox(frame, min=0, max=255, step=1, vartype=0, width=7,
							textvariable=self.B_value, command=self.rgb_component_changed)
		self.B_spin.pack(side=RIGHT)
		
		cmyk_frame = TFrame(self, borderwidth=2, style='FlatFrame')
		cmyk_frame.pack(side=LEFT)
		
		self.CMYK_label = TLabel(cmyk_frame, text='C:\nM:\nY:\nK:', justify=LEFT)
		self.CMYK_label.pack(side=LEFT)